platform/upstream/gcc.git
4 years agoaarch64: Add --params to control the number of recip steps [PR94154]
Bu Le [Thu, 12 Mar 2020 22:39:12 +0000 (22:39 +0000)]
aarch64: Add --params to control the number of recip steps [PR94154]

-mlow-precision-div hard-coded the number of iterations to 2 for double
and 1 for float.  This patch adds a --param to control the number.

2020-03-13  Bu Le  <bule1@huawei.com>

gcc/
PR target/94154
* config/aarch64/aarch64.opt (-param=aarch64-float-recp-precision=)
(-param=aarch64-double-recp-precision=): New options.
* doc/invoke.texi: Document them.
* config/aarch64/aarch64.c (aarch64_emit_approx_div): Use them
instead of hard-coding the choice of 1 for float and 2 for double.

4 years agoFix incorrect filling of delay slots in branchy code at -O2
Eric Botcazou [Fri, 13 Mar 2020 08:58:44 +0000 (09:58 +0100)]
Fix incorrect filling of delay slots in branchy code at -O2

The issue is that relax_delay_slots can streamline the CFG in some cases,
in particular remove BARRIERs, but removing BARRIERs changes the way the
instructions are associated with (basic) blocks by the liveness analysis
code in resource.c (find_basic_block) and thus can cause entries in the
cache maintained by resource.c to become outdated, thus producing wrong
answers downstream.

The fix is to invalidate the cache entries affected by the removal of
BARRIERs in relax_delay_slots, i.e. for the instructions down to the
next BARRIER.

PR rtl-optimization/94119
* resource.h (clear_hashed_info_until_next_barrier): Declare.
* resource.c (clear_hashed_info_until_next_barrier): New function.
* reorg.c (add_to_delay_list): Fix formatting.
(relax_delay_slots): Call clear_hashed_info_until_next_barrier on
the next instruction after removing a BARRIER.

4 years agoFix unaligned load with small memcpy on the ARM
Eric Botcazou [Fri, 13 Mar 2020 08:16:29 +0000 (09:16 +0100)]
Fix unaligned load with small memcpy on the ARM

store_integral_bit_field is ready to handle BLKmode fields, there is
even a subtlety with their handling on big-endian targets, see e.g.
PR middle-end/50325, but not if they are unaligned, so the fix is
simply to call extract_bit_field for them in order to generate an
unaligned load.  As a bonus, this subsumes  the big-endian specific
path that was added under PR middle-end/50325.

PR middle-end/92071
* expmed.c (store_integral_bit_field): For fields larger than a
word, call extract_bit_field on the value if the mode is BLKmode.
Remove specific path for big-endian targets and tidy things up a
little bit.

4 years agoDaily bump.
GCC Administrator [Fri, 13 Mar 2020 00:16:15 +0000 (00:16 +0000)]
Daily bump.

4 years agoRemove no-op register to register copies in CSE just like we remove no-op memory...
Richard Sandiford [Thu, 12 Mar 2020 22:09:27 +0000 (16:09 -0600)]
Remove no-op register to register copies in CSE just like we remove no-op memory to memory copies.

        PR rtl-optimization/90275
        * cse.c (cse_insn): Delete no-op register moves too.

        PR rtl-optimization/90275
        * gcc.c-torture/compile/pr90275.c: New test.

4 years agoSupport for the CPEN control register was removed in rev .50 of the RXv1 Instruction...
Jeff Law [Thu, 12 Mar 2020 19:41:28 +0000 (13:41 -0600)]
Support for the CPEN control register was removed in rev .50 of the RXv1 Instruction Set Architecture manual in Feb 2009.  This patch removes it from GCC.

* config/rx/rx.md (CTRLREG_CPEN): Remove.
* config/rx/rx.c (rx_print_operand): Remove CTRLREG_CPEN support.

4 years agomaintainer-scripts: Fix up gcc_release without -l, where mkdir was using umask 077...
Jakub Jelinek [Thu, 12 Mar 2020 17:30:16 +0000 (18:30 +0100)]
maintainer-scripts: Fix up gcc_release without -l, where mkdir was using umask 077 after migration

2020-03-12  Jakub Jelinek  <jakub@redhat.com>

* gcc_release (upload_files): Without -l, pass -m 755 to the mkdir
command invoked through ssh.

4 years agomaintainer-scripts: Fix jit documentation build with update_web_docs_git
Jakub Jelinek [Thu, 12 Mar 2020 13:46:28 +0000 (14:46 +0100)]
maintainer-scripts: Fix jit documentation build with update_web_docs_git

scripts/update_web_docs_git -r 9.3.0 -d gcc-9.3.0
failed after the sourceware upgrade, there is no python-sphinx10 package and
python3-sphinx is new enough that the docs build succeeded.

2020-03-12  Jakub Jelinek  <jakub@redhat.com>

* update_web_docs_git: Drop SPHINXBUILD=/usr/bin/sphinx-1.0-build.

4 years agotree-optimization/94103 avoid CSE of loads with padding
Richard Biener [Thu, 12 Mar 2020 13:18:35 +0000 (14:18 +0100)]
tree-optimization/94103 avoid CSE of loads with padding

VN currently replaces a load of a 16 byte entity 128 bits of precision
(TImode) with the result of a load of a 16 byte entity with 80 bits of
mode precision (XFmode).  That will go downhill since if the padding
bits are not actually filled with memory contents those bits are
missing.

2020-03-12  Richard Biener  <rguenther@suse.de>

PR tree-optimization/94103
* tree-ssa-sccvn.c (visit_reference_op_load): Avoid type
punning when the mode precision is not sufficient.

* gcc.target/i386/pr94103.c: New testcase.

4 years agolibstdc++: Fix test failure due to -Wnonnull warnings
Jonathan Wakely [Thu, 12 Mar 2020 11:03:04 +0000 (11:03 +0000)]
libstdc++: Fix test failure due to -Wnonnull warnings

This test fails in the Fedora RPM build (but not elsewhere, for unknown
reasons). The warning is correct, we're passing a null pointer.

* testsuite/tr1/8_c_compatibility/cstdlib/functions.cc: Do not pass
a null pointer to functions with nonnull(1) attribute.

4 years agoi386: Use ix86_output_ssemov for MMX TYPE_SSEMOV
H.J. Lu [Thu, 12 Mar 2020 10:47:45 +0000 (03:47 -0700)]
i386: Use ix86_output_ssemov for MMX TYPE_SSEMOV

There is no need to set mode attribute to XImode since ix86_output_ssemov
can properly encode xmm16-xmm31 registers with and without AVX512VL.

PR target/89229
* config/i386/i386.c (ix86_output_ssemov): Handle MODE_DI,
MODE_V1DF and MODE_V2SF.
* config/i386/mmx.md (MMXMODE:*mov<mode>_internal): Call
ix86_output_ssemov for TYPE_SSEMOV.  Remove ext_sse_reg_operand
check.

4 years ago[Fortran, OpenACC] Reject vars of different scope in $acc declare (PR94120)
Tobias Burnus [Thu, 12 Mar 2020 09:57:56 +0000 (10:57 +0100)]
[Fortran, OpenACC] Reject vars of different scope in $acc declare (PR94120)

2020-03-12  Tobias Burnus  <tobias@codesourcery.com>

        PR middle-end/94120
        * openmp.c (gfc_match_oacc_declare): Accept function-result
        variables; reject variables declared in a different scoping unit.

2020-03-12  Tobias Burnus  <tobias@codesourcery.com>

        PR middle-end/94120
        * gfortran.dg/goacc/pr78260-2.f90: Correct scan-tree-dump-times.
        Extend test case to result variables.
        * gfortran.dg/goacc/declare-2.f95: Actually check module-declaration
        restriction of OpenACC.
        * gfortran.dg/goacc/declare-3.f95: Remove case where this
        restriction is violated.
        * gfortran.dg/goacc/pr94120-1.f90: New.
        * gfortran.dg/goacc/pr94120-2.f90: New.
        * gfortran.dg/goacc/pr94120-3.f90: New.

4 years agodoc: Fix up ASM_OUTPUT_ALIGNED_DECL_LOCAL description
Jakub Jelinek [Thu, 12 Mar 2020 08:35:30 +0000 (09:35 +0100)]
doc: Fix up ASM_OUTPUT_ALIGNED_DECL_LOCAL description

When looking into PR94134, I've noticed bugs in the
ASM_OUTPUT_ALIGNED_DECL_LOCAL documentation.  varasm.c has:
  #if defined ASM_OUTPUT_ALIGNED_DECL_LOCAL
    unsigned int align = symtab_node::get (decl)->definition_alignment ();
    ASM_OUTPUT_ALIGNED_DECL_LOCAL (asm_out_file, decl, name,
                                   size, align);
    return true;
  #elif defined ASM_OUTPUT_ALIGNED_LOCAL
    unsigned int align = symtab_node::get (decl)->definition_alignment ();
    ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size, align);
    return true;
  #else
    ASM_OUTPUT_LOCAL (asm_out_file, name, size, rounded);
    return false;
  #endif
and the ASM_OUTPUT_ALIGNED_LOCAL documentation properly mentions:
Like @code{ASM_OUTPUT_LOCAL} and mentions the same macro in another place.
The ASM_OUTPUT_ALIGNED_DECL_LOCAL description mentions non-existing macros
ASM_OUTPUT_ALIGNED_DECL and ASM_OUTPUT_DECL instead of the right ones
ASM_OUTPUT_ALIGNED_LOCAL and ASM_OUTPUT_LOCAL.

2020-03-12  Jakub Jelinek  <jakub@redhat.com>

* doc/tm.texi.in (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Change
ASM_OUTPUT_ALIGNED_DECL in description to ASM_OUTPUT_ALIGNED_LOCAL
and ASM_OUTPUT_DECL to ASM_OUTPUT_LOCAL.
* doc/tm.texi: Regenerated.

4 years agotree-dse: Fix mem* head trimming if call has lhs [PR94130]
Jakub Jelinek [Thu, 12 Mar 2020 08:34:00 +0000 (09:34 +0100)]
tree-dse: Fix mem* head trimming if call has lhs [PR94130]

As the testcase shows, if DSE decides to head trim {mem{set,cpy,move},strncpy}
and the call has lhs, it is incorrect to leave the lhs as is, because it
will then point to the adjusted address (base + head_trim) instead of the
original base.
The following patch fixes that by dropping the lhs of the call and assigning
lhs the original base in a following statement.

2020-03-12  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/94130
* tree-ssa-dse.c: Include gimplify.h.
(increment_start_addr): If stmt has lhs, drop the lhs from call and
set it after the call to the original value of the first argument.
Formatting fixes.
(decrement_count): Formatting fix.

* gcc.c-torture/execute/pr94130.c: New test.

4 years agoc++: Tweak reshape_init_array_1 [PR94124]
Jakub Jelinek [Thu, 12 Mar 2020 07:28:05 +0000 (08:28 +0100)]
c++: Tweak reshape_init_array_1 [PR94124]

Isn't it wasteful to first copy perhaps a large constructor (recursively)
and then truncate it to very few elts (zero in this case)?

> We should certainly avoid copying if they're the same.  The code above for
> only copying the bits that aren't going to be thrown away seems pretty
> straightforward, might as well use it even if the savings aren't likely to
> be large.

Calling vec_safe_truncate with the same number of elts the vector already
has is a nop, so IMHO we just should make sure we only unshare if it
changed.

2020-03-12  Jakub Jelinek  <jakub@redhat.com>

PR c++/94124
* decl.c (reshape_init_array_1): Don't unshare constructor if there
aren't any trailing zero elts, otherwise only unshare the first
nelts.

4 years agoUpdate myself to MAINTAINERS
Bin Bin Lv [Thu, 12 Mar 2020 03:32:40 +0000 (23:32 -0400)]
Update myself to MAINTAINERS

This updates myself to the right place in MAINTAINERS.

gcc/ChangeLog

2020-03-11  Bin Bin Lv  <shlb@linux.ibm.com>

* MAINTAINERS (Write After Approval): Update myself.

4 years ago[rs6000] Fix a wrong GC issue
Bin Bin Lv [Thu, 12 Mar 2020 02:25:31 +0000 (22:25 -0400)]
[rs6000] Fix a wrong GC issue

The source file rs6000.c was split up into several smaller source files
through commit 1acf024.  However, variable "altivec_builtin_mask_for_load" and
"builtin_mode_to_type[MAX_MACHINE_MODE][2]" were marked with the wrong syntax
"GTY(([options])) type name", which led these two variables were not marked as
roots correctly and wrongly GCed.  And when "altivec_builtin_mask_for_load"
was wrongly GCed, the compiling for openJDK is failed with ICEs enabling
precompiled header under mcpu=power7.  So roots must be declared using one of
the following syntaxes: "extern GTY(([options])) type name;" and "static
GTY(([options])) type name;".

And the following patch adds variable "altivec_builtin_mask_for_load" and
"builtin_mode_to_type[MAX_MACHINE_MODE][2]" into the roots array.

Bootstrap and regression tests were done on powerpc64le-linux-gnu (LE) with no
regressions.

gcc/ChangeLog

2020-03-11  Bin Bin Lv  <shlb@linux.ibm.com>

* config/rs6000/rs6000-internal.h (altivec_builtin_mask_for_load,
builtin_mode_to_type): Remove the declaration.
* config/rs6000/rs6000.h (altivec_builtin_mask_for_load,
builtin_mode_to_type): Add an extern GTY(()) declaration.
* config/rs6000/rs6000.c (altivec_builtin_mask_for_load,
builtin_mode_to_type): Remove the GTY(()) declaration.

4 years agoAdd myself to MAINTAINERS
Bin Bin Lv [Thu, 12 Mar 2020 01:41:18 +0000 (21:41 -0400)]
Add myself to MAINTAINERS

This adds myself to MAINTAINERS in the Write After Approval section.

gcc/ChangeLog

2020-03-11  Bin Bin Lv  <shlb@linux.ibm.com>

* MAINTAINERS (Write After Approval): Add myself.

4 years agotestsuite: Fix concepts-using2.C failure on 32-bit targets [PR93907]
Jakub Jelinek [Thu, 12 Mar 2020 00:28:55 +0000 (01:28 +0100)]
testsuite: Fix concepts-using2.C failure on 32-bit targets [PR93907]

The test FAILs on 32-bit targets that don't have __int128 type.

2020-03-12  Jakub Jelinek  <jakub@redhat.com>

PR c++/93907
* g++.dg/cpp2a/concepts-using2.C (cc): Use long long instead of
__int128 if __SIZEOF_INT128__ isn't defined.

4 years agoDaily bump.
GCC Administrator [Thu, 12 Mar 2020 00:16:14 +0000 (00:16 +0000)]
Daily bump.

4 years agoc++: Fix ICE with concepts and aliases [PR93907].
Jason Merrill [Wed, 11 Mar 2020 04:53:01 +0000 (00:53 -0400)]
c++: Fix ICE with concepts and aliases [PR93907].

The problem here was that we were checking satisfaction once with 'e', a
typedef of 'void', and another time with 'void' directly, and treated them
as different for hashing based on the assumption that
canonicalize_type_argument would have already removed a typedef that wasn't
a complex dependent alias.  But that wasn't happening here, so let's add a
call.

gcc/cp/ChangeLog
2020-03-11  Jason Merrill  <jason@redhat.com>

PR c++/93907
* constraint.cc (tsubst_parameter_mapping): Canonicalize type
argument.

4 years agoc++: Fix wrong modifying const object error for COMPONENT_REF [PR94074]
Marek Polacek [Fri, 6 Mar 2020 22:30:11 +0000 (17:30 -0500)]
c++: Fix wrong modifying const object error for COMPONENT_REF [PR94074]

I got a report that building Chromium fails with the "modifying a const
object" error.  After some poking I realized it's a bug in GCC, not in
their codebase.

Much like with ARRAY_REFs, which can be const even though the array
itself isn't, COMPONENT_REFs can be const although neither the object
nor the field were declared const.  So let's dial down the checking.
Here the COMPONENT_REF was const because of the "const_cast<const U &>(m)"
thing -- cxx_eval_component_reference then builds a COMPONENT_REF with
TREE_TYPE (t).

While looking into this I noticed that we don't detect modifying a const
object in certain cases like in
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94074#c2>.  That's because
we never evaluate an X::X() CALL_EXPR -- there's none.  Fixed as per
Jason's suggestion by setting TREE_READONLY on a CONSTRUCTOR after
initialization in cxx_eval_store_expression.

2020-03-11  Marek Polacek  <polacek@redhat.com>
    Jason Merrill  <jason@redhat.com>

PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
* constexpr.c (cref_has_const_field): New function.
(modifying_const_object_p): Consider a COMPONENT_REF
const only if any of its fields are const.
(cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
as readonly after its initialization has been done.

* g++.dg/cpp1y/constexpr-tracking-const17.C: New test.
* g++.dg/cpp1y/constexpr-tracking-const18.C: New test.
* g++.dg/cpp1y/constexpr-tracking-const19.C: New test.
* g++.dg/cpp1y/constexpr-tracking-const20.C: New test.
* g++.dg/cpp1y/constexpr-tracking-const21.C: New test.
* g++.dg/cpp1y/constexpr-tracking-const22.C: New test.

4 years agolibstdc++: Add a test that takes the split_view of a non-forward range
Patrick Palka [Wed, 11 Mar 2020 15:08:49 +0000 (11:08 -0400)]
libstdc++: Add a test that takes the split_view of a non-forward range

This adds a tests that verifies taking the split_view of a non-forward range
works correctly.  Doing so revealed a typo in one of _OuterIter's constructors.

It also revealed that the default constructor of
__gnu_test::test_range::iterator misbehaves, because by delegating to
Iter<T>(nullptr, nullptr) we perform a null-pointer deref at runtime in
input_iterator_wrapper's constructor due to the ITERATOR_VERIFY check therein.
Instead of delegating to this constructor it seems we can just inherit the
protected default constructor, which does not contain this ITERATOR_VERIFY
check.

libstdc++-v3/ChangeLog:

* include/std/ranges (split_view::_OuterIter::_OuterIter): Typo fix,
'address' -> 'std::__addressof'.
* testsuite/std/ranges/adaptors/split.cc: Test taking the split_view of
a non-forward input_range.
* testsuite/util/testsuite_iterators.h (output_iterator_wrapper): Make
default constructor protected instead of deleted, like with
input_iterator_wrapper.
(test_range::iterator): Add comment explaining that this type is used
only when the underlying wrapper is input_iterator_wrapper or
output_iterator_wrapper.  Remove delegating defaulted constructor so
that the inherited default constructor is used instead.

4 years agoBug fix: cannot convert 'const short int*' to 'const __bf16*'
Delia Burduv [Wed, 11 Mar 2020 18:01:26 +0000 (18:01 +0000)]
Bug fix: cannot convert 'const short int*' to 'const __bf16*'

This patch fixes a bug introduced by my earlier patch (
https://gcc.gnu.org/pipermail/gcc-patches/2020-March/541680.html ).
It introduces a new scalar builtin type that was missing in the original
patch.

Bootstrapped cleanly on arm-none-linux-gnueabihf.
Tested for regression on arm-none-linux-gnueabihf. No regression from
before the original patch.
Tests that failed or became unsupported because of the original tests
now work as they did before it.

* config/arm/arm-builtins.c
(arm_init_simd_builtin_scalar_types): New.
* config/arm/arm_neon.h (vld2_bf16): Used new builtin type.
(vld2q_bf16): Used new builtin type.
(vld3_bf16): Used new builtin type.
(vld3q_bf16): Used new builtin type.
(vld4_bf16): Used new builtin type.
(vld4q_bf16): Used new builtin type.
(vld2_dup_bf16): Used new builtin type.
(vld2q_dup_bf16): Used new builtin type.
(vld3_dup_bf16): Used new builtin type.
(vld3q_dup_bf16): Used new builtin type.
(vld4_dup_bf16): Used new builtin type.
(vld4q_dup_bf16): Used new builtin type.

4 years agopdp11: Fix handling of common (local and global) vars [PR94134]
Jakub Jelinek [Wed, 11 Mar 2020 17:35:13 +0000 (18:35 +0100)]
pdp11: Fix handling of common (local and global) vars [PR94134]

As mentioned in the PR, the generic code decides to put the a variable into
lcomm_section, which is a NOSWITCH section and thus the generic code doesn't
switch into a particular section before using
ASM_OUTPUT{_ALIGNED{,_DECL}_}_LOCAL, on many targets that results just in
.lcomm (or for non-local .comm) directives which don't need a switch to some
section, other targets put switch_to_section (bss_section) at the start of
that macro.
pdp11 doesn't do that (and doesn't have bss_section), and so emits the
lcomm/comm variables in whatever section is current (it has only .text/.data
and for DEC assembler rodata).

The following patch fixes that by putting it always into data section, and
additionally avoids emitting an empty line in the assembly for the lcomm
vars.

2020-03-11  Jakub Jelinek  <jakub@redhat.com>

PR target/94134
* config/pdp11/pdp11.c (pdp11_asm_output_var): Call switch_to_section
at the start to switch to data section.  Don't print extra newline if
.globl directive has not been emitted.

* gcc.c-torture/execute/pr94134.c: New test.

4 years agoRISC-V: Fix testsuite regression due to recent IRA changes.
Kito Cheng [Wed, 11 Mar 2020 09:48:10 +0000 (17:48 +0800)]
RISC-V: Fix testsuite regression due to recent IRA changes.

After IRA changes, atomic version will use one more register, but
non-atomic still use 2 registers, however this testcase isn't testing for
atomic feature, so I decide change the testcase to always use COUNT++
to test.

ChangeLog

gcc/testsuite/

Kito Cheng  <kito.cheng@sifive.com>

* gcc.target/riscv/interrupt-2.c: Update testcase and expected output.

4 years agofold undefined pointer offsetting
Richard Biener [Wed, 11 Mar 2020 14:34:47 +0000 (15:34 +0100)]
fold undefined pointer offsetting

This avoids breaking the old broken pointer offsetting via
(T)(ptr - ((T)0)->x) which should have used offsetof.  Breakage
was exposed by the introduction of POINTER_DIFF_EXPR and making
PTA not considering that producing a pointer.  The mitigation
for simple cases is to canonicalize

  _2 = _1 - 8B;
  o_9 = (struct obj *) _2;

to

  o_9 = &MEM[_1 + -8B];

eliding one statement and the offending pointer subtraction.

2020-03-11  Richard Biener  <rguenther@suse.de>

* match.pd ((T *)(ptr - ptr-cst) -> &MEM[ptr + -ptr-cst]):
New pattern.

* gcc.dg/torture/20200311-1.c: New testcase.

4 years ago[testsuite] Add @ lines to check-function-bodies fluff
Matthew Malcomson [Wed, 11 Mar 2020 14:06:21 +0000 (14:06 +0000)]
[testsuite] Add @ lines to check-function-bodies fluff

When using `check-function-bodies`, the subroutine `parse_function_bodies` uses
the `fluff` regexp to remove uninteresting assembly lines.

Arm targets generate assembly with some lines prefixed by `@`, these lines are
left by this process.

As an example of some lines prefixed by `@': the assembly output from the
`stacktest1` function in "bfloat16_simd_3_1.c" is:

        .align  2
        .global stacktest1
        .arch armv8.2-a
        .syntax unified
        .arm
        .fpu neon-fp-armv8
        .type   stacktest1, %function
stacktest1:
        @ args = 0, pretend = 0, frame = 8
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        sub     sp, sp, #8
        add     r3, sp, #6
        vst1.16 {d0[0]}, [r3]
        vld1.16 {d0[0]}, [r3]
        add     sp, sp, #8
        @ sp needed
        bx      lr
        .size   stacktest1, .-stacktest1

It seems that previous uses of `check-function-bodies` in the arm backend have
avoided problems with such lines since they use the `...` regexp in each place
such fluff occurs.

I'm currently writing a patch that I'd like to match the entire function body,
so I'd like to remove such `@` lines automatically.

gcc/testsuite/ChangeLog:

2020-03-11  Matthew Malcomson  <matthew.malcomson@arm.com>

* lib/scanasm.exp (parse_function_bodies): Lines starting with '@' also
counted as fluff.

4 years agoFix GIMPLE verification failure in LTO mode on Ada code
Eric Botcazou [Wed, 11 Mar 2020 10:29:39 +0000 (11:29 +0100)]
Fix GIMPLE verification failure in LTO mode on Ada code

The issue is that tree_is_indexable doesn't return the same result for
a FIELD_DECL with QUAL_UNION_TYPE and the QUAL_UNION_TYPE, resulting
in two instances of the QUAL_UNION_TYPE in the bytecode.  The result
for the type is the correct one (false, since it is variably modified)
while the result for the field is falsely true because:

  else if (TREE_CODE (t) == FIELD_DECL
           && lto_variably_modified_type_p (DECL_CONTEXT (t)))
    return false;

is not satisfied.  The reason for this is that the DECL_QUALIFIER of
fields of a QUAL_UNION_TYPE depends on a discriminant in Ada, which
means that the size of the type does too (CONTAINS_PLACEHOLDER_P),
which in turn means that it is reset to a mere PLACEHOLDER_EXPR by
free_lang_data, which finally means that the size of DECL_CONTEXT is
too, so RETURN_TRUE_IF_VAR is false.

In other words, the CONTAINS_PLACEHOLDER_P property of the DECL_QUALIFIER
of fields of a QUAL_UNION_TYPE hides the variably_modified_type_p property
of  these fields, if you look from the outside.

PR middle-end/93961
* tree.c (variably_modified_type_p) <RECORD_TYPE>: Recurse into
fields whose type is a qualified union.

4 years agoFix internal error on locally-defined subpools
Eric Botcazou [Wed, 11 Mar 2020 09:47:34 +0000 (10:47 +0100)]
Fix internal error on locally-defined subpools

If the type is derived in the current compilation unit, and Allocate
is not overridden on derivation (as is typically the case with
Root_Storage_Pool_With_Subpools), the entity for Allocate of the
derived type is an alias for System.Storage_Pools.Subpools.Allocate.

The main assertion in gnat_to_gnu_entity fails in this case, since
this is not a definition and Is_Public is false (since the entity
is nested in the same compilation unit).

2020-03-11  Richard Wai  <richard@annexi-strayline.com>

* gcc-interface/decl.c (gnat_to_gnu_entity): Also test Is_Public on
the Alias of the entitiy, if is present, in the main assertion.

4 years agoaarch64: Fix ICE in aarch64_add_offset_1 [PR94121]
Jakub Jelinek [Wed, 11 Mar 2020 09:54:22 +0000 (10:54 +0100)]
aarch64: Fix ICE in aarch64_add_offset_1 [PR94121]

abs_hwi asserts that the argument is not HOST_WIDE_INT_MIN and as the
(invalid) testcase shows, the function can be called with such an offset.
The following patch is IMHO minimal fix, absu_hwi unlike abs_hwi allows even
that value and will return (unsigned HOST_WIDE_INT) HOST_WIDE_INT_MIN
in that case.  The function then uses moffset in two spots which wouldn't
care if the value is (unsigned HOST_WIDE_INT) HOST_WIDE_INT_MIN or
HOST_WIDE_INT_MIN and wouldn't accept it (!moffset and
aarch64_uimm12_shift (moffset)), then in one spot where the signedness of
moffset does matter and using unsigned is the right thing -
moffset < 0x1000000 - and finally has code which will handle even this
value right; the assembler doesn't really care for DImode immediates if
        mov     x1, -9223372036854775808
or
        mov     x1, 9223372036854775808
is used and similarly it doesn't matter if we add or sub it in DImode.

2020-03-11  Jakub Jelinek  <jakub@redhat.com>

PR target/94121
* config/aarch64/aarch64.c (aarch64_add_offset_1): Use absu_hwi
instead of abs_hwi, change moffset type to unsigned HOST_WIDE_INT.

* gcc.dg/pr94121.c: New test.

4 years agovalue-prof: Fix abs uses in value-prof.c [PR93962]
Jakub Jelinek [Wed, 11 Mar 2020 08:34:59 +0000 (09:34 +0100)]
value-prof: Fix abs uses in value-prof.c [PR93962]

Jeff has recently fixed dump_histogram_value to use std::abs instead of abs,
because on FreeBSD apparently the ::abs isn't overloaded and only has
int abs (int);
Seems on Solaris /usr/include/iso/stdlib_iso.h abs has:
int abs (int);
long abs (long);
overloads but already not
long long abs (long long);
and there is another abs use in get_nth_most_common_value, also on int64_t.
The long long std::abs (long long); overload is there only in C++11 and we
in GCC10 still support C++98.

Martin has said that a counter should never be INT64_MIN, so IMHO it is
better to use abs_hwi which will assert that.

2020-03-11  Jakub Jelinek  <jakub@redhat.com>

PR bootstrap/93962
* value-prof.c (dump_histogram_value): Use abs_hwi instead of
std::abs.
(get_nth_most_common_value): Use abs_hwi instead of abs.

4 years agodfp: Fix decimal_to_binary [PR94111]
Jakub Jelinek [Wed, 11 Mar 2020 08:33:52 +0000 (09:33 +0100)]
dfp: Fix decimal_to_binary [PR94111]

As e.g. decimal_from_decnumber shows, the REAL_VALUE_TYPE representation
contains a decimal128 embedded in ->sig only if it is rvc_normal, for
other kinds like rvc_inf or rvc_nan, ->sig is ignored and everything is
contained in the REAL_VALUE_TYPE flags (cl, sign, signalling and decimal).
decimal_to_binary which is used when folding a decimal{32,64,128} constant
to a binary floating point type ignores this and thus folds infinities and
NaNs into +0.0.
The following patch fixes that by only doing that for rvc_normal.
Similarly to the binary to decimal folding, it goes through a string, in
order to e.g. deal with canonical NaN mantissas, or binary float formats
that don't support infinities and/or NaNs.

2020-03-11  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/94111
* dfp.c (decimal_to_binary): Only use decimal128ToString if from->cl
is rvc_normal, otherwise use real_to_decimal to print the number to
string.

* gcc.dg/dfp/pr94111.c: New test.

4 years agoldist: Further fixes for -ftrapv [PR94114]
Jakub Jelinek [Wed, 11 Mar 2020 08:32:22 +0000 (09:32 +0100)]
ldist: Further fixes for -ftrapv [PR94114]

As the testcase shows, arithmetics that for -ftrapv would need multiple
basic blocks can show up not just in nb_bytes expressions where we
are calling rewrite_to_non_trapping_overflow for a while already,
but also in the pointer expression to the start of the region.
While the testcase covers just the first hunk and I've failed to create
a testcase for the latter, it is at least in theory possible too, so I've
adjusted that hunk too.

2020-03-11  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/94114
* tree-loop-distribution.c (generate_memset_builtin): Call
rewrite_to_non_trapping_overflow even on mem.
(generate_memcpy_builtin): Call rewrite_to_non_trapping_overflow even
on dest and src.

* gcc.dg/pr94114.c: New test.

4 years agolibstdc++: LWG 3286 ranges::size is not required to be valid after ...
Patrick Palka [Mon, 9 Mar 2020 16:10:16 +0000 (12:10 -0400)]
libstdc++: LWG 3286 ranges::size is not required to be valid after ...

... a call to ranges::begin on an input range.

This implements LWG 3286.  The new wording for the single-argument constructor
for subrange is implemented by splitting the constructor into two delegating
constructors, one constrained by _S_store_size and the other by !_S_store_size.

Tested on x86_64-pc-linux-gnu, both added tests fail before the patch and pass
with the patch.

libstdc++-v3/ChangeLog:

LWG 3286 ranges::size is not required to be valid after a call to
ranges::begin on an input range
* include/std/ranges (subrange::subrange): Split single-argument
constructor into two, one constrained by _S_store_size and another by
!_S_store_size.
(take_view::begin): Call size() before calling ranges::begin(_M_base).
* testsuite/std/ranges/adaptors/lwg3286.cc: New test.
* testsuite/std/ranges/subrange/lwg3286.cc: New test.

4 years agoFix length computation for movsi_insv which resulted in regressions due to out of...
Jeff Law [Wed, 11 Mar 2020 04:16:19 +0000 (22:16 -0600)]
Fix length computation for movsi_insv which resulted in regressions due to out of range branches on the bfin port.

* config/bfin/bfin.md (movsi_insv): Add length attribute.

4 years agoc++: Fix wrong conversion error with non-viable overload [PR94124]
Marek Polacek [Tue, 10 Mar 2020 22:55:42 +0000 (18:55 -0400)]
c++: Fix wrong conversion error with non-viable overload [PR94124]

This is a bad interaction between sharing a constructor for an array
and stripping its trailing zero-initializers.  Here we reuse a ctor
and then strip its 0s.  This breaks overload resolution in this test:
D can be initialized from {} but not from {0}, so if we truncate the
constructor not to include the zero, the F(D) overload becomes valid
and then we get the ambiguous conversion error.

PR c++/94124 - wrong conversion error with non-viable overload.
* decl.c (reshape_init_array_1): Unshare a constructor if we
stripped trailing zero-initializers.

* g++.dg/cpp0x/initlist-overload1.C: New test.

4 years agoc++: Fix deferred noexcept on constructor [PR93901].
Jason Merrill [Tue, 10 Mar 2020 21:31:33 +0000 (17:31 -0400)]
c++: Fix deferred noexcept on constructor [PR93901].

My change in r10-4394 to only update clones when we actually instantiate a
deferred noexcept-spec broke this because deferred parsing updates the
primary function but not the clones.  For GCC 10, let's just revert it.

gcc/cp/ChangeLog
2020-03-10  Jason Merrill  <jason@redhat.com>

PR c++/93901
* pt.c (maybe_instantiate_noexcept): Always update clones.

4 years agoc++: Fix ICE with omitted template args [PR93956].
Jason Merrill [Tue, 10 Mar 2020 21:51:46 +0000 (17:51 -0400)]
c++: Fix ICE with omitted template args [PR93956].

reshape_init only wants to work on BRACE_ENCLOSED_INITIALIZER_P, i.e. raw
initializer lists, and here was getting a CONSTRUCTOR that had already been
processed for type A<int>.  maybe_aggr_guide should also use that test.

gcc/cp/ChangeLog
2020-03-10  Jason Merrill  <jason@redhat.com>

PR c++/93956
* pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.

4 years agors6000: Check -+0 and NaN for smax/smin generation
Jiufu Guo [Tue, 10 Mar 2020 05:51:57 +0000 (13:51 +0800)]
rs6000: Check -+0 and NaN for smax/smin generation

PR93709 mentioned regressions on maxlocval_4.f90 and minlocval_f.f90 which
relates to max of '-inf' and 'nan'. This regression occur on P9 because
P9 new instruction 'xsmaxcdp' is generated.
And for C code `a < b ? b : a` is also generated as `xsmaxcdp` under -O2
for P9. While this instruction behavior more like C/C++ semantic (a>b?a:b).

This generates prevents 'xsmaxcdp' to be generated for those cases.
'xsmincdp' also is handled in patch.

gcc/
2020-03-10  Jiufu Guo  <guojiufu@linux.ibm.com>

PR target/93709
* gcc/config/rs6000/rs6000.c (rs6000_emit_p9_fp_minmax): Check
NAN and SIGNED_ZEROR for smax/smin.

gcc/testsuite
2020-03-10  Jiufu Guo  <guojiufu@linux.ibm.com>

PR target/93709
* gcc.target/powerpc/p9-minmax-3.c: New test.

4 years agoDaily bump.
GCC Administrator [Wed, 11 Mar 2020 00:16:14 +0000 (00:16 +0000)]
Daily bump.

4 years agolibstdc++: Fix uses of _M_current in split_view's outer iterator
Jonathan Wakely [Tue, 10 Mar 2020 22:15:58 +0000 (22:15 +0000)]
libstdc++: Fix uses of _M_current in split_view's outer iterator

These direct uses of _M_current should all be __current() so they are
valid when the base type doesn't satisfy the forward_range concept.

* include/std/ranges (split_view::_OuterIter::__at_end): Use __current
instead of _M_current.
(split_view::_OuterIter::operator++): Likewise.

4 years agoc++: Add tests for PR93922 and PR94041.
Jason Merrill [Tue, 10 Mar 2020 20:43:58 +0000 (16:43 -0400)]
c++: Add tests for PR93922 and PR94041.

4 years agoc++: Partially revert patch for PR66139.
Jason Merrill [Tue, 10 Mar 2020 20:05:18 +0000 (16:05 -0400)]
c++: Partially revert patch for PR66139.

The patch for 66139 exposed a long-standing bug with
split_nonconstant_init (since 4.7, apparently): initializion of individual
elements of an aggregate are not a full-expressions, but
split_nonconstant_init was making full-expressions out of them.  My fix for
66139 extended the use of split_nonconstant_init, and thus the bug, to
aggregate initialization of temporaries within an expression, in which
context (PR94041) the bug is more noticeable.  PR93922 is a problem with my
implementation strategy of splitting out at gimplification time, introducing
function calls that weren't in the GENERIC.  So I'm going to revert the
patch now and try again for GCC 11.

gcc/cp/ChangeLog
2020-03-10  Jason Merrill  <jason@redhat.com>

PR c++/93922
PR c++/94041
PR c++/52320
PR c++/66139
* cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
66139: Don't split_nonconstant_init.  Remove pre_p parameter.

4 years agoPR90763: PowerPC vec_xl_len should take const argument.
Will Schmidt [Tue, 10 Mar 2020 19:38:13 +0000 (14:38 -0500)]
PR90763: PowerPC vec_xl_len should take const argument.

PR target/90763
* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Add
clause to handle P9V_BUILTIN_VEC_LXVL with const arguments.

* gcc.target/powerpc/pr90763.c: New.

4 years agolibstdc++: Fix noexcept guarantees for ranges::split_view
Jonathan Wakely [Tue, 10 Mar 2020 17:45:45 +0000 (17:45 +0000)]
libstdc++: Fix noexcept guarantees for ranges::split_view

Also introduce the _M_i_current() accessors to solve the problem of
access to the private member of _OuterIter from the iter_move and
iter_swap overloads (which are only friends of _InnerIter not
_OuterIter).

* include/std/ranges (transform_view::_Iterator::__iter_move): Remove.
(transform_view::_Iterator::operator*): Add noexcept-specifier.
(transform_view::_Iterator::iter_move): Inline __iter_move body here.
(split_view::_OuterIter::__current): Add noexcept.
(split_view::_InnerIter::__iter_swap): Remove.
(split_view::_InnerIter::__iter_move): Remove.
(split_view::_InnerIter::_M_i_current): New accessors.
(split_view::_InnerIter::__at_end): Use _M_i_current().
(split_view::_InnerIter::operator*): Likewise.
(split_view::_InnerIter::operator++): Likewise.
(iter_move(const _InnerIter&)): Likewise.
(iter_swap(const _InnerIter&, const _InnerIter&)): Likewise.
* testsuite/std/ranges/adaptors/split.cc: Check noexcept-specifier
for iter_move and iter_swap on split_view's inner iterator.

4 years agoloop-iv: make find_simple_exit static
Roman Zhuykov [Tue, 10 Mar 2020 16:54:50 +0000 (19:54 +0300)]
loop-iv: make find_simple_exit static

Function 'find_simple_exit' is used only from loop-iv.c
In 2004-2006 it was also used in predict.c, but since r118694
(992c31e62304ed5d34247dbdef2db276d08fac05) it does not.

gcc/ChangeLog:
* loop-iv.c (find_simple_exit): Make it static.
* cfgloop.h: Remove the corresponding prototype.

4 years agominor: fix intendation in ddg.c
Roman Zhuykov [Tue, 10 Mar 2020 16:47:53 +0000 (19:47 +0300)]
minor: fix intendation in ddg.c

gcc/ChangeLog:
* ddg.c (create_ddg): Fix intendation.
(set_recurrence_length): Likewise.
(create_ddg_all_sccs): Likewise.

4 years agotestsuite: Scan for SSE reg-reg moves only in pr80481.C
Uros Bizjak [Tue, 10 Mar 2020 16:39:21 +0000 (17:39 +0100)]
testsuite: Scan for SSE reg-reg moves only in pr80481.C

The function needs more than 8 SSE registers, avoid
false positives triggered by SSE spills for 32bit targets.

* g++.dg/pr80481.C (dg-final): Scan for SSE reg-reg moves only.

4 years agoRevert "Fix regression reported by tester due to recent IRA changes"
Jeff Law [Tue, 10 Mar 2020 14:38:14 +0000 (08:38 -0600)]
Revert "Fix regression reported by tester due to recent IRA changes"

This reverts commit d48e1175279a551bf90aa5b165fc46a1d5a2c07e.

2020-03-10  Jeff Law  <law@redhat.com>

Revert:
2020-02-29  Jeff Law  <law@redhat.com>

* gcc.target/xstormy16/sfr/06_sfrw_to_var.c: Update expected output.

4 years agolibstdc++: Fix invalid noexcept-specifier (PR 94117)
Jonathan Wakely [Tue, 10 Mar 2020 10:50:40 +0000 (10:50 +0000)]
libstdc++: Fix invalid noexcept-specifier (PR 94117)

G++ fails to diagnose this non-dependent expression, but Clang doesn't
like it.

PR c++/94117
* include/std/ranges (ranges::transform_view::_Iterator::iter_move):
Change expression in noexcept-specifier to match function body.

4 years agolibstdc++: Change compile-only test to run
Jonathan Wakely [Tue, 10 Mar 2020 09:47:15 +0000 (09:47 +0000)]
libstdc++: Change compile-only test to run

The 24_iterators/ostream_iterator/1.cc test uses VERIFY and so is
obviously meant to have been run, not just compiled.

* testsuite/23_containers/unordered_set/allocator/ext_ptr.cc: Add
comment explaining multiple dg-do directives.
* testsuite/24_iterators/ostream_iterator/1.cc: Fix do-do directive
so test is run as well as compiled.

4 years agoi386: Fix up *testqi_ext_3 insn&split for the *testdi_1 changes [PR94088]
Jakub Jelinek [Tue, 10 Mar 2020 08:26:44 +0000 (09:26 +0100)]
i386: Fix up *testqi_ext_3 insn&split for the *testdi_1 changes [PR94088]

In r10-1938-g460bf043c8266dd080308f4783137aee0d0f862c *testdi_1 has been
changed, so that if the mask has upper 32-bits 0 and then at least one bit
set, it requires CCZmode rather than CCNOmode, because in that case it uses
testl instruction rather than testq and so the SF flag wouldn't respect the
state of the 64-bit result.
The *testqi_ext_3 define_insn_and_split needs to match that though,
otherwise it can create an RTL pattern that used to match *testdi_1 but
doesn't anymore and we'd ICE due to an unrecognizable insn.

2020-03-10  Jakub Jelinek  <jakub@redhat.com>

PR target/94088
* config/i386/i386.md (*testqi_ext_3): Call ix86_match_ccmode with
CCZmode instead of CCNOmode if operands[2] has DImode and pos + len
is 32.

* gcc.target/i386/pr94088.c: New test.

4 years agoUpdate gcc sv.po.
Joseph Myers [Tue, 10 Mar 2020 00:53:37 +0000 (00:53 +0000)]
Update gcc sv.po.

* sv.po: Update.

4 years agogdbinit.in: Fix typo.
Jason Merrill [Mon, 9 Mar 2020 20:42:41 +0000 (16:42 -0400)]
gdbinit.in: Fix typo.

gcc/ChangeLog
2020-03-09  Jason Merrill  <jason@redhat.com>

* gdbinit.in (pgs): Fix typo in documentation.

4 years agoDaily bump.
GCC Administrator [Tue, 10 Mar 2020 00:16:15 +0000 (00:16 +0000)]
Daily bump.

4 years agoUpdate cpplib da.po.
Joseph Myers [Tue, 10 Mar 2020 00:13:42 +0000 (00:13 +0000)]
Update cpplib da.po.

* da.po: Update.

4 years agoc++: Fix convert_like in template [PR91465, PR93870, PR92031, PR94068]
Marek Polacek [Fri, 28 Feb 2020 21:57:04 +0000 (16:57 -0500)]
c++: Fix convert_like in template [PR91465, PR93870, PR92031, PR94068]

The point of this patch is to fix the recurring problem of trees
generated by convert_like while processing a template that break when
substituting.  For instance, when convert_like creates a CALL_EXPR
while in a template, substituting such a call breaks in finish_call_expr
because we have two 'this' arguments.  Another problem is that we
can create &TARGET_EXPR<> and then fail when substituting because we're
taking the address of an rvalue.  I've analyzed some of the already fixed
PRs and also some of the currently open ones:

In c++/93870 we create EnumWrapper<E>::operator E(&operator~(E)).
In c++/87145 we create S::operator int (&{N}).
In c++/92031 we create &TARGET_EXPR <0>.

The gist of the problem is when convert_like_real creates a call for
a ck_user or wraps a TARGET_EXPR in & in a template.  So in these cases
use IMPLICIT_CONV_EXPR.  In a template we shouldn't need to perform the
actual conversion, we only need it's result type.
perform_direct_initialization_if_possible and
perform_implicit_conversion_flags can also create an IMPLICIT_CONV_EXPR.

Given the change above, build_converted_constant_expr can return an
IMPLICIT_CONV_EXPR so call fold_non_dependent_expr rather than
maybe_constant_value to deal with that.

To avoid the problem of instantiating something twice in a row I'm
removing a call to instantiate_non_dependent_expr_sfinae in
compute_array_index_type_loc.  And the build_converted_constant_expr
pattern can now be simplified.

2020-03-09  Marek Polacek  <polacek@redhat.com>

PR c++/92031 - bogus taking address of rvalue error.
PR c++/91465 - ICE with template codes in check_narrowing.
PR c++/93870 - wrong error when converting template non-type arg.
PR c++/94068 - ICE with template codes in check_narrowing.
* call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
in a template when not ck_identity and we're dealing with a class.
(convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
in a template if we need a temporary.
* decl.c (compute_array_index_type_loc): Remove
instantiate_non_dependent_expr_sfinae call.  Call
fold_non_dependent_expr instead of maybe_constant_value.
(build_explicit_specifier): Don't instantiate or create a sentinel
before converting the expression.
* except.c (build_noexcept_spec): Likewise.
* pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
build_converted_constant_expr returned.
* typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
of maybe_constant_value.

* g++.dg/cpp0x/conv-tmpl2.C: New test.
* g++.dg/cpp0x/conv-tmpl3.C: New test.
* g++.dg/cpp0x/conv-tmpl4.C: New test.
* g++.dg/cpp0x/conv-tmpl5.C: New test.
* g++.dg/cpp0x/conv-tmpl6.C: New test.
* g++.dg/cpp1z/conv-tmpl1.C: New test.

4 years agolibstdc++: Handle type-changing path concatenations (PR 94063)
Jonathan Wakely [Mon, 9 Mar 2020 23:22:57 +0000 (23:22 +0000)]
libstdc++: Handle type-changing path concatenations (PR 94063)

The filesystem::path::operator+= and filesystem::path::concat functions
operate directly on the native format of the path and so can cause a
path to mutate to a completely different type.

For Windows combining a filename "x" with a filename ":" produces a
root-name "x:". Similarly, a Cygwin root-directory "/" combined with a
root-directory and filename "/x" produces a root-name "//x".

Before this patch the implemenation didn't support those kind of
mutations, assuming that concatenating two filenames would always
produce a filename and concatenating with a root-dir would still have a
root-dir.

This patch fixes it simply by checking for the problem cases and
creating a new path by re-parsing the result of the string
concatenation. This is slightly suboptimal because the argument has
already been parsed if it's a path, but more importantly it doesn't
reuse any excess capacity that the path object being modified might
already have allocated. That can be fixed later though.

PR libstdc++/94063
* src/c++17/fs_path.cc (path::operator+=(const path&)): Add kluge to
handle concatenations that change the type of the first component.
(path::operator+=(basic_string_view<value_type>)): Likewise.
* testsuite/27_io/filesystem/path/concat/94063.cc: New test.

4 years agoc++: Readd [LR]ROTATE_EXPR support to constexpr.c [PR94067]
Jakub Jelinek [Mon, 9 Mar 2020 20:52:18 +0000 (21:52 +0100)]
c++: Readd [LR]ROTATE_EXPR support to constexpr.c [PR94067]

Since r10-6527-gaaa26bf496a646778ac861aed124d960b5bf549f fold_for_warn
will perform maybe_constant_value even on some cp_fold produced trees and
so can include rotate exprs which were removed last fall from constexpr.c

2020-03-09  Jakub Jelinek  <jakub@redhat.com>

PR c++/94067
Revert
2019-10-11  Paolo Carlini  <paolo.carlini@oracle.com>

* constexpr.c (cxx_eval_constant_expression): Do not handle
RROTATE_EXPR and LROTATE_EXPR.

* g++.dg/warn/Wconversion-pr94067.C: New test.

4 years agoRevert: One more patch for PR93564: Prefer smaller hard regno when we do not honor...
Vladimir N. Makarov [Mon, 9 Mar 2020 18:05:09 +0000 (14:05 -0400)]
Revert: One more patch for PR93564: Prefer smaller hard regno when we do not honor reg alloc order.

2020-03-09  Vladimir Makarov  <vmakarov@redhat.com>

Revert:

2020-02-28  Vladimir Makarov  <vmakarov@redhat.com>

PR rtl-optimization/93564
* ira-color.c (assign_hard_reg): Prefer smaller hard regno when we
do not honor reg alloc order.

4 years agoFix 'A' operand modifier: PR inline-asm/94095
Andrew Pinski [Mon, 9 Mar 2020 16:45:23 +0000 (09:45 -0700)]
Fix 'A' operand modifier: PR inline-asm/94095

The problem here is there was a typo in the documentation
for the 'A' modifier in the table, it was recorded as 'a'
in the table on the modifier column.

Committed as obvious.

2020-03-09  Andrew Pinski  <apinski@marvell.com>

PR inline-asm/94095
* doc/extend.texi (x86 Operand Modifiers): Fix column
for 'A' modifier.

4 years agors6000: Fix -mlong-double documentation
Carl Love [Thu, 5 Mar 2020 18:52:35 +0000 (12:52 -0600)]
rs6000: Fix -mlong-double documentation

gcc/ChangeLog

2020-03-09  Carl Love  <cel@us.ibm.com>

* config/rs6000/rs6000.opt: Update the description of the
command line option.

4 years agoconfigure - build libgomp by default for amdgcn
Tobias Burnus [Mon, 9 Mar 2020 16:00:39 +0000 (17:00 +0100)]
configure - build libgomp by default for amdgcn

        * configure.ac: Build libgomp by default for amdgcn.
        * configure: Regenerate.

4 years agoc++: Fix ABI issue with alignas on armv7hl [PR94050]
Marek Polacek [Thu, 5 Mar 2020 19:07:25 +0000 (14:07 -0500)]
c++: Fix ABI issue with alignas on armv7hl [PR94050]

The static_assert in the following test was failing on armv7hl because
we were disregarding the alignas specifier on Cell.  BaseShape's data
takes up 20B on 32-bit architectures, but we failed to round up its
TYPE_SIZE.  This happens since the
<https://gcc.gnu.org/ml/gcc-patches/2019-06/msg01189.html>
patch: here, in layout_class_type for TenuredCell, we see that the size
of TenuredCell and its CLASSTYPE_AS_BASE match, so we set

  CLASSTYPE_AS_BASE (t) = t;

While TYPE_USER_ALIGN of TenuredCell was 0, because finalize_type_size
called from finish_record_layout reset it, TYPE_USER_ALIGN of its
CLASSTYPE_AS_BASE still remained 1.  After we replace it, it's no longer
1.  Then we perform layout_empty_base_or_field for TenuredCell and since
TYPE_USER_ALIGN of its CLASSTYPE_AS_BASE is now 0, we don't do this
adjustment:

  if (CLASSTYPE_USER_ALIGN (type))
    {
      rli->record_align = MAX (rli->record_align, CLASSTYPE_ALIGN (type));
      if (warn_packed)
        rli->unpacked_align = MAX (rli->unpacked_align, CLASSTYPE_ALIGN (type));
      TYPE_USER_ALIGN (rli->t) = 1;
    }

where rli->t is BaseShape.  Then finalize_record_size won't use the
correct rli->record_align and therefore
  /* Round the size up to be a multiple of the required alignment.  */
  TYPE_SIZE (rli->t) = round_up (unpadded_size, TYPE_ALIGN (rli->t));
after this we end up with the wrong size.

Since the original fix was to avoid creating extra copies for LTO
purposes, I think the following fix should be acceptable.

PR c++/94050 - ABI issue with alignas on armv7hl.
* class.c (layout_class_type): Don't replace a class's
CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.

* g++.dg/abi/align3.C: New test.

4 years ago[testsuite][arm] Fix typo in fuse-caller-save.c
Christophe Lyon [Mon, 9 Mar 2020 13:15:10 +0000 (13:15 +0000)]
[testsuite][arm] Fix typo in fuse-caller-save.c

2020-03-09  Christophe Lyon  <christophe.lyon@linaro.org>

* gcc.target/arm/fuse-caller-save.c: Fix DejaGnu typo.

4 years agoRestore alignment in rs6000 target.
Martin Liska [Mon, 9 Mar 2020 13:13:04 +0000 (14:13 +0100)]
Restore alignment in rs6000 target.

PR target/93800
* config/rs6000/rs6000.c (rs6000_option_override_internal):
Remove set of str_align_loops and str_align_jumps as these
should be set in previous 2 conditions in the function.
PR target/93800
* gcc.target/powerpc/pr93800.c: New test.

4 years agoalias: Punt after walking too many VALUEs during a toplevel find_base_term call ...
Jakub Jelinek [Mon, 9 Mar 2020 12:38:23 +0000 (13:38 +0100)]
alias: Punt after walking too many VALUEs during a toplevel find_base_term call [PR94045]

As mentioned in the PR, on a largish C++ testcase the compile time
on i686-linux is about 16 minutes on a fast box, mostly spent in
find_base_term recursive calls dealing with very deep chains of preserved
VALUEs during var-tracking.

The following patch punts after we process many VALUEs (we already have code
to punt if we run into a VALUE cycle).

I've gathered statistics on when we punt this way (with BITS_PER_WORD, TU,
function columns piped through sort | uniq -c | sort -n):
     36 32 ../../gcc/asan.c _Z29initialize_sanitizer_builtinsv.part.0
    108 32 _first_test.go reflect_test.reflect_test..import
   1005 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr85180.c foo
   1005 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr87985.c foo
   1005 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr85180.c foo
   1005 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr87985.c foo
   2534 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/stack-check-9.c f3
   6346 32 ../../gcc/brig/brig-lang.c brig_define_builtins
   6398 32 ../../gcc/d/d-builtins.cc d_define_builtins
   8816 32 ../../gcc/c-family/c-common.c c_common_nodes_and_builtins
   8824 32 ../../gcc/lto/lto-lang.c lto_define_builtins
  41413 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr43058.c test
Additionally, for most of these (for the builtins definitions tested just
one) I've verified with a different alias.c change which didn't punt but
in the toplevel find_base_term recorded if visited_vals reached the limit
whether the return value was NULL_RTX or something different, and in all
these cases the end result was NULL_RTX, so at least in these cases it
should just shorten the time until it returns NULL.

2020-03-09  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/94045
* params.opt (-param=max-find-base-term-values=): New option.
* alias.c (find_base_term): Add cut-off for number of visited VALUEs
in a single toplevel find_base_term call.

4 years agoInsert default return_void at the end of coroutine body
Bin Cheng [Mon, 9 Mar 2020 10:54:57 +0000 (18:54 +0800)]
Insert default return_void at the end of coroutine body

Exception in coroutine is not correctly handled because the default
return_void call is now inserted before the finish suspend point,
rather than at the end of the original coroutine body.  This patch
fixes the issue by expanding code as following:
  co_await promise.initial_suspend();
  try {
    // The original coroutine body

    promise.return_void(); // The default return_void call.
  } catch (...) {
    promise.unhandled_exception();
  }
  final_suspend:
  // ...

gcc/cp/
    * coroutines.cc (build_actor_fn): Factor out code inserting the
    default return_void call to...
    (morph_fn_to_coro): ...here, also hoist local var declarations.

gcc/testsuite/
    * g++.dg/coroutines/torture/co-ret-15-default-return_void.C: New.

4 years ago[testsuite] Fix PR94019 to check vector char when vect_hw_misalign
Kewen Lin [Mon, 9 Mar 2020 02:55:11 +0000 (21:55 -0500)]
[testsuite] Fix PR94019 to check vector char when vect_hw_misalign

As PR94019 shows, without misaligned vector access support but with
realign load, the vectorized loop will end up with realign scheme.
It generates mask (control vector) with return type vector signed
char which breaks the not check.

gcc/testsuite/ChangeLog

2020-03-09  Kewen Lin  <linkw@gcc.gnu.org>

    PR testsuite/94019
    * gcc.dg/vect/vect-over-widen-17.c: Don't expect vector char if
    it's without misaligned vector access support.

4 years ago[testsuite] Fix PR94023 to guard case under vect_hw_misalign
Kewen Lin [Mon, 9 Mar 2020 02:34:13 +0000 (21:34 -0500)]
[testsuite] Fix PR94023 to guard case under vect_hw_misalign

As PR94023 shows, the expected SLP requires misaligned vector access
support.  This patch is to guard the check under the target condition
vect_hw_misalign to ensure that.

gcc/testsuite/ChangeLog

2020-03-09  Kewen Lin  <linkw@gcc.gnu.org>

    PR testsuite/94023
    * gcc.dg/vect/slp-perm-12.c: Expect loop vectorized messages only on
    vect_hw_misalign targets.

4 years agoDaily bump.
GCC Administrator [Mon, 9 Mar 2020 00:16:14 +0000 (00:16 +0000)]
Daily bump.

4 years agoPatch and ChangeLogs for PR93581
Paul Thomas [Sun, 8 Mar 2020 18:52:35 +0000 (18:52 +0000)]
Patch and ChangeLogs for PR93581

4 years agoc++: Fix missing SFINAE when binding a bit-field to a reference (PR 93729)
Patrick Palka [Tue, 3 Mar 2020 17:27:33 +0000 (12:27 -0500)]
c++: Fix missing SFINAE when binding a bit-field to a reference (PR 93729)

We are unconditionally emitting an error here, without first checking complain.

gcc/cp/ChangeLog:

PR c++/93729
* call.c (convert_like_real): Check complain before emitting an error
about binding a bit-field to a reference.

gcc/testsuite/ChangeLog:

PR c++/93729
* g++.dg/concepts/pr93729.C: New test.

4 years agoc++: Fix pretty printing of TYPENAME_TYPEs
Patrick Palka [Fri, 6 Mar 2020 18:19:13 +0000 (13:19 -0500)]
c++: Fix pretty printing of TYPENAME_TYPEs

I noticed that in some concepts diagnostic messages, we were printing typename
types incorrectly, e.g. printing remove_reference_t<T> as

  typename remove_reference<T>::remove_reference_t

instead of

  typename remove_reference<T>::type.

Fix this by printing the TYPENAME_TYPE_FULLNAME instead of the TYPE_NAME in
cxx_pretty_printer::simple_type_specifier, which is consistent with how
dump_typename in error.c does it.

gcc/cp/ChangeLog:

* cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
[TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
TYPE_NAME.

gcc/testsuite/ChangeLog:

* g++.dg/concepts/diagnostic4.C: New test.

4 years agogcc.target/i386/pr89229-3c.c: Include "pr89229-3a.c"
H.J. Lu [Sun, 8 Mar 2020 12:01:03 +0000 (05:01 -0700)]
gcc.target/i386/pr89229-3c.c: Include "pr89229-3a.c"

PR target/89229
PR target/89346
* gcc.target/i386/pr89229-3c.c: Include "pr89229-3a.c", instead
of "pr89229-5a.c".

4 years agoDaily bump.
GCC Administrator [Sat, 7 Mar 2020 00:16:29 +0000 (00:16 +0000)]
Daily bump.

4 years agoanalyzer: improvements to region_model::get_representative_tree
David Malcolm [Fri, 6 Mar 2020 15:13:59 +0000 (10:13 -0500)]
analyzer: improvements to region_model::get_representative_tree

This patch extends region_model::get_representative_tree so that dumps
are able to refer to string literals, which I've found useful in
investigating a state-bloat issue.

Doing so uncovered a bug in the handling of views I introduced in
r10-7024-ge516294a1acb28aaaad44cfd583cc6a80354044e where the code was
erroneously using TREE_TYPE on the view region's type, rather than just
using its type, which the patch also fixes.

gcc/analyzer/ChangeLog:
* analyzer.h (class array_region): New forward decl.
* program-state.cc (selftest::test_program_state_dumping_2): New.
(selftest::analyzer_program_state_cc_tests): Call it.
* region-model.cc (array_region::constant_from_key): New.
(region_model::get_representative_tree): Handle region_svalue by
generating an ADDR_EXPR.
(region_model::get_representative_path_var): In view handling,
remove erroneous TREE_TYPE when determining the type of the tree.
Handle array regions and STRING_CST.
(selftest::assert_dump_tree_eq): New.
(ASSERT_DUMP_TREE_EQ): New macro.
(selftest::test_get_representative_tree): New selftest.
(selftest::analyzer_region_model_cc_tests): Call it.
* region-model.h (region::dyn_cast_array_region): New vfunc.
(array_region::dyn_cast_array_region): New vfunc implementation.
(array_region::constant_from_key): New decl.

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/malloc-4.c: Update expected output of leak to
reflect fix to region_model::get_representative_path_var, adding
the missing "*" from the cast.

4 years agoanalyzer: improvements to state dumping
David Malcolm [Thu, 5 Mar 2020 17:06:58 +0000 (12:06 -0500)]
analyzer: improvements to state dumping

This patch fixes a bug in which summarized state dumps involving a
non-NULL pointer to a region for which get_representative_path_var
returned NULL were erroneously dumped as "NULL".

It also extends sm-state dumps so that they show representative tree
values, where available.

Finally, it adds some selftest coverage for such dumps.  Doing so
requires replacing some %qE with a dump_quoted_tree, to avoid
C vs C++ differences between "make selftest-c" and "make selftest-c++".

gcc/analyzer/ChangeLog:
* analyzer.h (dump_quoted_tree): New decl.
* engine.cc (exploded_node::dump_dot): Pass region model to
sm_state_map::print.
* program-state.cc: Include diagnostic-core.h.
(sm_state_map::print): Add "model" param and use it to print
representative trees.  Only print origin information if non-null.
(sm_state_map::dump): Pass NULL for model to print call.
(program_state::print): Pass region model to sm_state_map::print.
(program_state::dump_to_pp): Use spaces rather than newlines when
summarizing.  Pass region_model to sm_state_map::print.
(ana::selftest::assert_dump_eq): New function.
(ASSERT_DUMP_EQ): New macro.
(ana::selftest::test_program_state_dumping): New function.
(ana::selftest::analyzer_program_state_cc_tests): Call it.
* program-state.h (program_state::print): Add model param.
* region-model.cc (dump_quoted_tree): New function.
(map_region::print_fields): Use dump_quoted_tree rather than
%qE to avoid lang-dependent output.
(map_region::dump_child_label): Likewise.
(region_model::dump_summary_of_map): For SK_REGION, when
get_representative_path_var fails, print the region id rather than
erroneously printing NULL.
* sm.cc (state_machine::get_state_by_name): New function.
* sm.h (state_machine::get_state_by_name): New decl.

4 years agoFix mangling ICE [PR94027]
Nathan Sidwell [Fri, 6 Mar 2020 18:51:26 +0000 (10:51 -0800)]
Fix mangling ICE [PR94027]

PR c++/94027
* mangle.c (find_substitution): Don't call same_type_p on template
args that cannot match.

Now same_type_p rejects argument packs, we need to be more careful
calling it with template argument vector contents.

The mangler needs to do some comparisons to find the special
substitutions.  While that code looks a little ugly, this seems the
smallest fix.

4 years ago[AArch64] Use intrinsics for widening multiplies (PR91598)
Wilco Dijkstra [Fri, 6 Mar 2020 18:29:02 +0000 (18:29 +0000)]
[AArch64] Use intrinsics for widening multiplies (PR91598)

Inline assembler instructions don't have latency info and the scheduler does
not attempt to schedule them at all - it does not even honor latencies of
asm source operands.  As a result, SIMD intrinsics which are implemented using
inline assembler perform very poorly, particularly on in-order cores.
Add new patterns and intrinsics for widening multiplies, which results in a
63% speedup for the example in the PR, thus fixing the reported regression.

    gcc/
PR target/91598
* config/aarch64/aarch64-builtins.c (TYPES_TERNOPU_LANE): Add define.
* config/aarch64/aarch64-simd.md
(aarch64_vec_<su>mult_lane<Qlane>): Add new insn for widening lane mul.
(aarch64_vec_<su>mlal_lane<Qlane>): Likewise.
* config/aarch64/aarch64-simd-builtins.def: Add intrinsics.
* config/aarch64/arm_neon.h:
(vmlal_lane_s16): Expand using intrinsics rather than inline asm.
(vmlal_lane_u16): Likewise.
(vmlal_lane_s32): Likewise.
(vmlal_lane_u32): Likewise.
(vmlal_laneq_s16): Likewise.
(vmlal_laneq_u16): Likewise.
(vmlal_laneq_s32): Likewise.
(vmlal_laneq_u32): Likewise.
(vmull_lane_s16): Likewise.
(vmull_lane_u16): Likewise.
(vmull_lane_s32): Likewise.
(vmull_lane_u32): Likewise.
(vmull_laneq_s16): Likewise.
(vmull_laneq_u16): Likewise.
(vmull_laneq_s32): Likewise.
(vmull_laneq_u32): Likewise.
* config/aarch64/iterators.md (Vcondtype): New iterator for lane mul.
(Qlane): Likewise.

4 years ago[AArch64] Fix lane specifier syntax
Wilco Dijkstra [Fri, 6 Mar 2020 18:19:46 +0000 (18:19 +0000)]
[AArch64] Fix lane specifier syntax

The syntax for lane specifiers uses a vector element rather than a vector:

fmls    v0.2s, v1.2s, v1.s[1]  // rather than v1.2s[1]

Fix all the lane specifiers to use Vetype which uses the correct element type.

    gcc/
* aarch64/aarch64-simd.md (aarch64_mla_elt<mode>): Correct lane syntax.
(aarch64_mla_elt_<vswap_width_name><mode>): Likewise.
(aarch64_mls_elt<mode>): Likewise.
(aarch64_mls_elt_<vswap_width_name><mode>): Likewise.
(aarch64_fma4_elt<mode>): Likewise.
(aarch64_fma4_elt_<vswap_width_name><mode>): Likewise.
(aarch64_fma4_elt_to_64v2df): Likewise.
(aarch64_fnma4_elt<mode>): Likewise.
(aarch64_fnma4_elt_<vswap_width_name><mode>): Likewise.
(aarch64_fnma4_elt_to_64v2df): Likewise.

    testsuite/
* gcc.target/aarch64/fmla_intrinsic_1.c: Check for correct lane syntax.
* gcc.target/aarch64/fmls_intrinsic_1.c: Likewise.
* gcc.target/aarch64/mla_intrinsic_1.c: Likewise.
* gcc.target/aarch64/mls_intrinsic_1.c: Likewise.

4 years ago[AArch64][SVE] Add missing movprfx attribute to some ternary arithmetic patterns
Kyrylo Tkachov [Fri, 6 Mar 2020 16:21:33 +0000 (16:21 +0000)]
[AArch64][SVE] Add missing movprfx attribute to some ternary arithmetic patterns

The two affected SVE2 patterns in this patch output a movprfx'ed instruction in their second alternative
but don't set the "movprfx" attribute, which will result in the wrong instruction length being assumed by the midend.

This patch fixes that in the same way as the other SVE patterns in the backend.

Bootstrapped and tested on aarch64-none-linux-gnu.

2020-03-06  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

* config/aarch64/aarch64-sve2.md (@aarch64_sve_<sve_int_op><mode>:
Specify movprfx attribute.
(@aarch64_sve_<sve_int_op>_lane_<mode>): Likewise.

4 years agors6000: Correct logic to disable NO_SUM_IN_TOC and NO_FP_IN_TOC [PR94065]
David Edelsohn [Fri, 6 Mar 2020 01:41:08 +0000 (20:41 -0500)]
rs6000: Correct logic to disable NO_SUM_IN_TOC and NO_FP_IN_TOC [PR94065]

aix61.h, aix71.h and aix72.h intends to prevent SUM_IN_TOC and FP_IN_TOC
when cmodel=large.  This patch defines the variables associated with the
target options to 1 to _enable_ NO_SUM_IN_TOC and enable NO_FP_IN_TOC.

Bootstrapped on powerpc-ibm-aix7.2.0.0

2020-03-06  David Edelsohn  <dje.gcc@gmail.com>
PR target/94065
* config/rs6000/aix61.h (TARGET_NO_SUM_IN_TOC): Set to 1 for
cmodel=large.
(TARGET_NO_FP_IN_TOC): Same.
* config/rs6000/aix71.h: Same.
* config/rs6000/aix72.h: Same.

4 years agoAvoid putting a REG_NOTE on anything other than an INSN in haifa-sched.c
Andrew Pinski [Fri, 6 Mar 2020 15:34:01 +0000 (08:34 -0700)]
Avoid putting a REG_NOTE on anything other than an INSN in haifa-sched.c

PR rtl-optimization/93996
* haifa-sched.c (remove_notes): Be more careful when adding
REG_SAVE_NOTE.

4 years agoarc: Update tumaddsidi4 test.
Claudiu Zissulescu [Fri, 6 Mar 2020 14:36:23 +0000 (16:36 +0200)]
arc: Update tumaddsidi4 test.

The test is using -O1 and, the macu instruction is generated by the
combiner and not in the expand step. My previous "arc: Improve code
gen for 64bit add/sub operations." is actually splitting the 64-bit
add in the expand, leading to the impossibility to match the multiply
and accumulate on 64 bit datum by the combiner, hence, the error. This
patch is stepping up the optimization level which will generate the
macu instruction at the expand time.

xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

* gcc.target/arc/tumaddsidi4.c: Step-up optimization level.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
4 years agolibstdc++: Add missing friend declaration to join_view::_Sentinel
Patrick Palka [Thu, 5 Mar 2020 16:19:17 +0000 (11:19 -0500)]
libstdc++: Add missing friend declaration to join_view::_Sentinel

The converting constructor of join_view::_Sentinel<true> needs to be able to
access the private members of join_view::_Sentinel<false>.

libstdc++-v3/ChangeLog:

* include/std/ranges (join_view::_Sentinel<_Const>): Befriend
join_view::_Sentinel<!_Const>.
* testsuite/std/ranges/adaptors/join.cc: Augment test.

4 years agolibstdc++: Give ranges::empty() a concrete return type (PR 93978)
Patrick Palka [Thu, 5 Mar 2020 15:04:06 +0000 (10:04 -0500)]
libstdc++: Give ranges::empty() a concrete return type (PR 93978)

This works around PR 93978 by avoiding having to instantiate the body of
ranges::empty() when checking the constraints of view_interface::operator
bool().  When ranges::empty() has an auto return type, then we must instantiate
its body in order to determine whether the requires expression {
ranges::empty(_M_derived()); } is well-formed.  But this means instantiating
view_interface::empty() and hence view_interface::_M_derived(), all before we've
yet deduced the return type of join_view::end().  (The reason
view_interface::operator bool() is needed in join_view::end() in the first place
is because in this function we perform direct initialization of
join_view::_Sentinel from a join_view, and so we try to find a conversion
sequence from the latter to the former that goes through this conversion
operator.)

Giving ranges::empty() a concrete return type of bool should be safe according
to [range.prim.empty]/4 which says "whenever ranges::empty(E) is a valid
expression, it has type bool."

This fixes the test case in PR 93978 when compiling without -Wall, but with -Wall
the test case still fails due to the issue described in PR c++/94038, I think.
I still don't quite understand why the test case doesn't fail without -O.

libstdc++-v3/ChangeLog:

PR libstdc++/93978
* include/bits/range_access.h (__cust_access::_Empty::operator()):
Declare return type to be bool instead of auto.
* testsuite/std/ranges/adaptors/93978.cc: New test.

4 years agolibstdc++: Fix PR number in ChangeLog (PR 94069)
Jonathan Wakely [Fri, 6 Mar 2020 12:24:37 +0000 (12:24 +0000)]
libstdc++: Fix PR number in ChangeLog (PR 94069)

4 years agolibstdc++: Fix call to __glibcxx_rwlock_init (PR 93244)
Jonathan Wakely [Fri, 6 Mar 2020 12:03:17 +0000 (12:03 +0000)]
libstdc++: Fix call to __glibcxx_rwlock_init (PR 93244)

When the target doesn't define PTHREAD_RWLOCK_INITIALIZER we use a
wrapper around pthread_wrlock_init, but the wrapper only takes one
argument and we try to call it with two.

This went unnnoticed on most targets because they do define the
PTHREAD_RWLOCK_INITIALIZER macro, but it causes a bootstrap failure on
darwin8.

PR libstdc++/93244
* include/std/shared_mutex [!PTHREAD_RWLOCK_INITIALIZER]
(__shared_mutex_pthread::__shared_mutex_pthread()): Remove incorrect
second argument to __glibcxx_rwlock_init.
* testsuite/30_threads/shared_timed_mutex/94069.cc: New test.

4 years agoAdd missing ChangeLog entries
Andreas Krebbel [Fri, 6 Mar 2020 11:44:27 +0000 (12:44 +0100)]
Add missing ChangeLog entries

4 years agolibstdc++: Fix failing filesystem::path tests (PR 93244)
Jonathan Wakely [Fri, 6 Mar 2020 11:27:34 +0000 (11:27 +0000)]
libstdc++: Fix failing filesystem::path tests (PR 93244)

The checks for PR 93244 don't actually pass on Windows (which is the
target where the bug is present) because of a different bug, PR 94063.

This adjusts the tests to not be affected by 94063 so that they verify
that 93244 was fixed.

PR libstdc++/93244
* testsuite/27_io/filesystem/path/generic/generic_string.cc: Adjust
test to not fail due to PR 94063.
* testsuite/27_io/filesystem/path/generic/utf.cc: Likewise.
* testsuite/27_io/filesystem/path/generic/wchar_t.cc: Likewise.

4 years agolibstdc++: Deal with ENOSYS == ENOTSUP
Andreas Krebbel [Fri, 6 Mar 2020 08:37:55 +0000 (09:37 +0100)]
libstdc++: Deal with ENOSYS == ENOTSUP

zTPF uses the same numeric value for ENOSYS and ENOTSUP.

libstdc++-v3/ChangeLog:

2020-03-06  Andreas Krebbel  <krebbel@linux.ibm.com>

* src/c++11/system_error.cc: Omit the ENOTSUP case statement if it
would match ENOSYS.

4 years agoACLE intrinsics: BFloat16 load intrinsics for AArch32
Delia Burduv [Fri, 6 Mar 2020 10:38:20 +0000 (10:38 +0000)]
ACLE intrinsics: BFloat16 load intrinsics for AArch32

2020-03-06  Delia Burduv  <delia.burduv@arm.com>

* config/arm/arm_neon.h (vld2_bf16): New.
(vld2q_bf16): New.
(vld3_bf16): New.
(vld3q_bf16): New.
(vld4_bf16): New.
(vld4q_bf16): New.
(vld2_dup_bf16): New.
(vld2q_dup_bf16): New.
(vld3_dup_bf16): New.
(vld3q_dup_bf16): New.
(vld4_dup_bf16): New.
(vld4q_dup_bf16): New.
* config/arm/arm_neon_builtins.def
(vld2): Changed to VAR13 and added v4bf, v8bf
(vld2_dup): Changed to VAR8 and added v4bf, v8bf
(vld3): Changed to VAR13 and added v4bf, v8bf
(vld3_dup): Changed to VAR8 and added v4bf, v8bf
(vld4): Changed to VAR13 and added v4bf, v8bf
(vld4_dup): Changed to VAR8 and added v4bf, v8bf
* config/arm/iterators.md (VDXBF2): New iterator.
*config/arm/neon.md (neon_vld2): Use new iterators.
(neon_vld2_dup<mode): Use new iterators.
(neon_vld3<mode>): Likewise.
(neon_vld3qa<mode>): Likewise.
(neon_vld3qb<mode>): Likewise.
(neon_vld3_dup<mode>): Likewise.
(neon_vld4<mode>): Likewise.
(neon_vld4qa<mode>): Likewise.
(neon_vld4qb<mode>): Likewise.
(neon_vld4_dup<mode>): Likewise.
(neon_vld2_dupv8bf): New.
(neon_vld3_dupv8bf): Likewise.
(neon_vld4_dupv8bf): Likewise.

* gcc.target/arm/simd/bf16_vldn_1.c: New test.

4 years agoACLE intrinsics: BFloat16 store (vst<n>{q}_bf16) intrinsics for AArch32
Delia Burduv [Fri, 6 Mar 2020 10:32:20 +0000 (10:32 +0000)]
ACLE intrinsics: BFloat16 store (vst<n>{q}_bf16) intrinsics for AArch32

2020-03-06  Delia Burduv  <delia.burduv@arm.com>

* config/arm/arm_neon.h (bfloat16x4x2_t): New typedef.
(bfloat16x8x2_t): New typedef.
(bfloat16x4x3_t): New typedef.
(bfloat16x8x3_t): New typedef.
(bfloat16x4x4_t): New typedef.
(bfloat16x8x4_t): New typedef.
(vst2_bf16): New.
(vst2q_bf16): New.
(vst3_bf16): New.
(vst3q_bf16): New.
(vst4_bf16): New.
(vst4q_bf16): New.
* config/arm/arm-builtins.c (v2bf_UP): Define.
(VAR13): New.
(arm_init_simd_builtin_types): Init Bfloat16x2_t eltype.
* config/arm/arm-modes.def (V2BF): New mode.
* config/arm/arm-simd-builtin-types.def
(Bfloat16x2_t): New entry.
* config/arm/arm_neon_builtins.def
(vst2): Changed to VAR13 and added v4bf, v8bf
(vst3): Changed to VAR13 and added v4bf, v8bf
(vst4): Changed to VAR13 and added v4bf, v8bf
* config/arm/iterators.md (VDXBF): New iterator.
(VQ2BF): New iterator.
*config/arm/neon.md (neon_vst2<mode>): Used new iterators.
(neon_vst2<mode>): Used new iterators.
(neon_vst3<mode>): Used new iterators.
(neon_vst3<mode>): Used new iterators.
(neon_vst3qa<mode>): Used new iterators.
(neon_vst3qb<mode>): Used new iterators.
(neon_vst4<mode>): Used new iterators.
(neon_vst4<mode>): Used new iterators.
(neon_vst4qa<mode>): Used new iterators.
(neon_vst4qb<mode>): Used new iterators.

* gcc.target/arm/simd/bf16_vstn_1.c: New test.

4 years agoRISC-V: Fix testsuite regression due to recent IRA changes.
Kito Cheng [Fri, 6 Mar 2020 08:30:48 +0000 (16:30 +0800)]
RISC-V: Fix testsuite regression due to recent IRA changes.

4 years agoaarch64: ACLE intrinsics for BFCVTN, BFCVTN2 and BFCVT
Delia Burduv [Wed, 4 Mar 2020 19:25:09 +0000 (19:25 +0000)]
aarch64: ACLE intrinsics for BFCVTN, BFCVTN2 and BFCVT

This patch adds the Armv8.6-a ACLE intrinsics for bfcvtn, bfcvtn2 and
bfcvt as part of the BFloat16 extension.
(https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics)
The intrinsics are declared in arm_bf16.h and arm_neon.h and the RTL
patterns are defined in aarch64-simd.md.

2020-03-06  Delia Burduv  <delia.burduv@arm.com>

gcc/
* config/aarch64/aarch64-simd-builtins.def
(bfcvtn): New built-in function.
(bfcvtn_q): New built-in function.
(bfcvtn2): New built-in function.
(bfcvt): New built-in function.
* config/aarch64/aarch64-simd.md
(aarch64_bfcvtn<q><mode>): New pattern.
(aarch64_bfcvtn2v8bf): New pattern.
(aarch64_bfcvtbf): New pattern.
* config/aarch64/arm_bf16.h (float32_t): New typedef.
(vcvth_bf16_f32): New intrinsic.
* config/aarch64/arm_bf16.h (vcvt_bf16_f32): New intrinsic.
(vcvtq_low_bf16_f32): New intrinsic.
(vcvtq_high_bf16_f32): New intrinsic.
* config/aarch64/iterators.md (V4SF_TO_BF): New mode iterator.
(UNSPEC_BFCVTN): New UNSPEC.
(UNSPEC_BFCVTN2): New UNSPEC.
(UNSPEC_BFCVT): New UNSPEC.
* config/arm/types.md (bf_cvt): New type.

gcc/testsuite/
* gcc.target/aarch64/advsimd-intrinsics/bfcvt-compile.c: New test.
* gcc.target/aarch64/advsimd-intrinsics/bfcvt-nobf16.c: New test.
* gcc.target/aarch64/advsimd-intrinsics/bfcvt-nosimd.c: New test.
* gcc.target/aarch64/advsimd-intrinsics/bfcvtnq2-untied.c: New test.

4 years agoFix error format string.
Andreas Krebbel [Fri, 6 Mar 2020 08:51:34 +0000 (09:51 +0100)]
Fix error format string.

gcc/ChangeLog:

2020-03-06  Andreas Krebbel  <krebbel@linux.ibm.com>

* config/s390/s390.md ("tabort"): Get rid of two consecutive
blanks in format string.

4 years agore PR tree-optimization/90883 (Generated code is worse if returned struct is unnamed)
Kito Cheng [Tue, 3 Mar 2020 06:16:42 +0000 (14:16 +0800)]
re PR tree-optimization/90883 (Generated code is worse if returned struct is unnamed)

After add --param max-inline-insns-size=1 all target will remove the
redundant store at dse1, except some targets like AArch64 and MIPS will
expand the struct initialization into loop due to CLEAR_RATIO.

Tested on cross compiler of riscv32, riscv64, x86, x86_64, mips, mips64,
aarch64, nds32 and arm.

gcc/testsuite/ChangeLog

PR tree-optimization/90883
* g++.dg/tree-ssa/pr90883.c: Add --param max-inline-insns-size=1.
Add aarch64-*-* mips*-*-* to XFAIL.

4 years agoi386: Properly encode vector registers in vector move
H.J. Lu [Fri, 6 Mar 2020 00:45:05 +0000 (16:45 -0800)]
i386: Properly encode vector registers in vector move

On x86, when AVX and AVX512 are enabled, vector move instructions can
be encoded with either 2-byte/3-byte VEX (AVX) or 4-byte EVEX (AVX512):

   0: c5 f9 6f d1           vmovdqa %xmm1,%xmm2
   4: 62 f1 fd 08 6f d1     vmovdqa64 %xmm1,%xmm2

We prefer VEX encoding over EVEX since VEX is shorter.  Also AVX512F
only supports 512-bit vector moves.  AVX512F + AVX512VL supports 128-bit
and 256-bit vector moves.  xmm16-xmm31 and ymm16-ymm31 are disallowed in
128-bit and 256-bit modes when AVX512VL is disabled.  Mode attributes on
x86 vector move patterns indicate target preferences of vector move
encoding.  For scalar register to register move, we can use 512-bit
vector move instructions to move 32-bit/64-bit scalar if AVX512VL isn't
available.  With AVX512F and AVX512VL, we should use VEX encoding for
128-bit/256-bit vector moves if upper 16 vector registers aren't used.
This patch adds a function, ix86_output_ssemov, to generate vector moves:

1. If zmm registers are used, use EVEX encoding.
2. If xmm16-xmm31/ymm16-ymm31 registers aren't used, SSE or VEX encoding
will be generated.
3. If xmm16-xmm31/ymm16-ymm31 registers are used:
   a. With AVX512VL, AVX512VL vector moves will be generated.
   b. Without AVX512VL, xmm16-xmm31/ymm16-ymm31 register to register
      move will be done with zmm register move.

There is no need to set mode attribute to XImode explicitly since
ix86_output_ssemov can properly encode xmm16-xmm31/ymm16-ymm31 registers
with and without AVX512VL.

Tested on AVX2 and AVX512 with and without --with-arch=native.

gcc/

PR target/89229
PR target/89346
* config/i386/i386-protos.h (ix86_output_ssemov): New prototype.
* config/i386/i386.c (ix86_get_ssemov): New function.
(ix86_output_ssemov): Likewise.
* config/i386/sse.md (VMOVE:mov<mode>_internal): Call
ix86_output_ssemov for TYPE_SSEMOV.  Remove TARGET_AVX512VL
check.
(*movxi_internal_avx512f): Call ix86_output_ssemov for TYPE_SSEMOV.
(*movoi_internal_avx): Call ix86_output_ssemov for TYPE_SSEMOV.
Remove ext_sse_reg_operand and TARGET_AVX512VL check.
(*movti_internal): Likewise.
(*movtf_internal): Call ix86_output_ssemov for TYPE_SSEMOV.

gcc/testsuite/

PR target/89229
PR target/89346
* gcc.target/i386/avx512vl-vmovdqa64-1.c: Updated.
* gcc.target/i386/pr89229-2a.c: New test.
* gcc.target/i386/pr89229-2b.c: Likewise.
* gcc.target/i386/pr89229-2c.c: Likewise.
* gcc.target/i386/pr89229-3a.c: Likewise.
* gcc.target/i386/pr89229-3b.c: Likewise.
* gcc.target/i386/pr89229-3c.c: Likewise.
* gcc.target/i386/pr89346.c: Likewise.