platform/upstream/gcc.git
3 years ago[Ada] Fix overriding subprogram being incorrectly seen as returning
Ghjuvan Lacambre [Thu, 22 Apr 2021 15:13:19 +0000 (17:13 +0200)]
[Ada] Fix overriding subprogram being incorrectly seen as returning

gcc/ada/

* sem_ch3.adb (Check_Abstract_Overriding): Check for renamings.

3 years ago[Ada] Do not catch 'N rem -1' in CodePeer_Mode
Boris Yakobowski [Wed, 21 Apr 2021 12:49:15 +0000 (14:49 +0200)]
[Ada] Do not catch 'N rem -1' in CodePeer_Mode

gcc/ada/

* exp_ch4.adb (Expand_N_Op_Rem): Remove special case for rem -1
in CodePeer_Mode.

3 years agotestsuite: gcc.dg/debug/btf/btf-bitfields-3.c requires -fno-short-enums PR debug...
Christophe Lyon [Mon, 5 Jul 2021 11:33:45 +0000 (11:33 +0000)]
testsuite: gcc.dg/debug/btf/btf-bitfields-3.c requires -fno-short-enums PR debug/101321

arm-eabi uses -fshort-enums by default while arm-linux-gnueabi* do not,
like most (all?) other targets, but this test relies -fno-short-enums.
Fix it by forcing -fno-short-enums.

2021-07-05  Christophe Lyon  <christophe.lyon@foss.st.com>

PR debug/101321
gcc/testsuite/
* gcc.dg/debug/btf/btf-bitfields-3.c: Add -fno-short-enums.

3 years agoDo not set both LOOP_C_INFINITE and LOOP_C_FINITE on vectorized loop
Richard Biener [Mon, 5 Jul 2021 10:00:17 +0000 (12:00 +0200)]
Do not set both LOOP_C_INFINITE and LOOP_C_FINITE on vectorized loop

The setting is likely a typo and was meant to affect the scalar version
but even there LOOP_C_INFINITE is at most an optimization to the
niter analysis.  Clearly setting it on the vectorized loop which we
just versioned to be _not_ infinite is bogus so the following change
removes this.

2021-07-05  Richard Biener  <rguenther@suse.de>

* tree-vect-loop-manip.c (vect_loop_versioning): Do not
set LOOP_C_INFINITE on the vectorized loop.

3 years agomiddle-end/101291 - set loop copy of versioned loop
Richard Biener [Mon, 5 Jul 2021 09:53:07 +0000 (11:53 +0200)]
middle-end/101291 - set loop copy of versioned loop

This fixes the vectorizer loop versioning code failing to clear
niter related info on the scalar loop as it assumed get_loop_copy
would work even for the outermost loop.  The patch makes that
assumption hold by adjusting the loop versioning code.

2021-07-05  Richard Biener  <rguenther@suse.de>

PR middle-end/101291
* cfgloopmanip.c (loop_version): Set the loop copy of the
versioned loop to the new loop.

3 years agotestsuite/101299 - add missing vect_double requires to bb-slp-74.c
Richard Biener [Mon, 5 Jul 2021 06:38:29 +0000 (08:38 +0200)]
testsuite/101299 - add missing vect_double requires to bb-slp-74.c

This should fix the FAIL of gcc.dg/vect/bb-slp-74.c on arm.

2021-07-05  Richard Biener  <rguenther@suse.de>

PR testsuite/101299
* gcc.dg/vect/bb-slp-74.c: Add vect_double requires.

3 years agoRemove xfail for pr92658-avx512vl.c
liuhongt [Mon, 5 Jul 2021 04:55:57 +0000 (12:55 +0800)]
Remove xfail for pr92658-avx512vl.c

Typo of standard pattern name has been fixed by r12-1970, remove those
xfails.

gcc/testsuite/ChangeLog

* gcc.target/i386/pr92658-avx512vl.c: Refine testcase.

3 years agoDaily bump.
GCC Administrator [Mon, 5 Jul 2021 00:16:28 +0000 (00:16 +0000)]
Daily bump.

3 years agoDarwin, config : Adjust X86 biarch definitions ordering [PR100269].
Iain Sandoe [Fri, 30 Apr 2021 15:20:42 +0000 (16:20 +0100)]
Darwin, config : Adjust X86 biarch definitions ordering [PR100269].

This reorganises the biarch definitions to cater for the
macro changes and removals at r12-36.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR target/100269 - [12 Regression] i686 biarch compiler fails for Darwin after r12-36.

        PR target/100269

gcc/ChangeLog:

PR target/100269
* config.gcc: Ensure that Darwin biarch definitions are
added before i386.h.
* config/i386/darwin.h (TARGET_64BIT): Remove.
(PR80556_WORKAROUND): New.
(REAL_LIBGCC_SPEC): Amend to use PR80556_WORKAROUND.
(DARWIN_SUBARCH_SPEC): New.
* config/i386/darwin32-biarch.h (TARGET_64BIT_DEFAULT,
TARGET_BI_ARCH, PR80556_WORKAROUND): New.
(REAL_LIBGCC_SPEC): Remove.
* config/i386/darwin64-biarch.h (TARGET_64BIT_DEFAULT,
TARGET_BI_ARCH, PR80556_WORKAROUND): New.
(REAL_LIBGCC_SPEC): Remove.

3 years agoDaily bump.
GCC Administrator [Sun, 4 Jul 2021 00:16:25 +0000 (00:16 +0000)]
Daily bump.

3 years agotestsuite: Disable BTF and CTF testsuite on AIX.
David Edelsohn [Thu, 1 Jul 2021 14:49:27 +0000 (10:49 -0400)]
testsuite: Disable BTF and CTF testsuite on AIX.

CTF utilizes DWARF sections, but it is a distinct debugging
format.  The CTF support in GCC is not implemented as a
separate debugging format.  AIX supports DWARF but not CTF
section.

The GCC testsuite test for target support of a debugging format
checks if GCC itself emits an error message, not if the
debugging output compiles correctly.  Because CTF is not
a distinct debugging format, GCC does not distinguish support
for targets and does not have the ability to produce an error
message.

This patch skips the CTF and BTF debug directories, and
explicitly reports that AIX doesn't support CTF.  Currently the
        dejagnu code to skip multiple debugging levels for CTF does
        not ensure that CTF is a supported debugging format. The patch
also shifts the CTF options logic to within the test that CTF
debug format is supported.

Bootstrapped on powerpc-ibm-aix7.2.3.0 and powerpc64le-linux.

gcc/testsuite/ChangeLog:

* gcc.dg/debug/btf/btf.exp: Skip on AIX.
* gcc.dg/debug/ctf/ctf.exp: Skip on AIX.
* lib/gcc-dg.exp (gcc-dg-target-supports-debug-format): AIX
doesn't support CTF.
(gcc-dg-debug-runtest): Move CTF support within
target support format test.

3 years agoDon't use vec_duplicate on vector in CTOR expansion
H.J. Lu [Fri, 2 Jul 2021 17:03:48 +0000 (10:03 -0700)]
Don't use vec_duplicate on vector in CTOR expansion

Since vec_duplicate only works on scalar, don't use it on vector in
store constructor expansion.

gcc/

PR middle-end/101294
* expr.c (store_constructor): Don't use vec_duplicate on vector.

gcc/testsuite/

PR middle-end/101294
* gcc.dg/pr101294.c: New test.

3 years agod: Missed RVO optimization with non-POD structs
Iain Buclaw [Sat, 3 Jul 2021 00:42:14 +0000 (02:42 +0200)]
d: Missed RVO optimization with non-POD structs

The D front-end semantic pass sometimes declares a temporary inside a
return expression.  This is now detected with the RESULT_DECL replacing
the temporary, allowing for RVO to be done.

PR d/101273

gcc/d/ChangeLog:

* toir.cc (IRVisitor::visit (ReturnStatement *)): Detect returns that
use a temporary, and replace with return value.

gcc/testsuite/ChangeLog:

* gdc.dg/torture/pr101273.d: New test.

3 years agoDaily bump.
GCC Administrator [Sat, 3 Jul 2021 00:16:31 +0000 (00:16 +0000)]
Daily bump.

3 years agod: RHS value lost when a target_expr modifies LHS in a cond_expr
Iain Buclaw [Fri, 2 Jul 2021 22:13:29 +0000 (00:13 +0200)]
d: RHS value lost when a target_expr modifies LHS in a cond_expr

To prevent the RHS of an assignment modifying the LHS before the
assignment proper, a target_expr is forced so that function calls that
return with slot optimization modify the temporary instead.  This did
not work for conditional expressions however, to give one example.  So
now the RHS is always forced to a temporary.

PR d/101282

gcc/d/ChangeLog:

* d-codegen.cc (build_assign): Force target_expr on RHS for non-POD
assignment expressions.

gcc/testsuite/ChangeLog:

* gdc.dg/torture/pr101282.d: New test.

3 years agoImprove warning suppression for inlined functions [PR98512].
Martin Sebor [Fri, 2 Jul 2021 22:16:31 +0000 (16:16 -0600)]
Improve warning suppression for inlined functions [PR98512].

Resolves:
PR middle-end/98871 - Cannot silence -Wmaybe-uninitialized at declaration site
PR middle-end/98512 - #pragma GCC diagnostic ignored ineffective in conjunction with alias attribute

gcc/ChangeLog:

PR middle-end/98871
PR middle-end/98512
* diagnostic.c (get_any_inlining_info): New.
(update_effective_level_from_pragmas): Handle inlining context.
(diagnostic_enabled): Same.
(diagnostic_report_diagnostic): Same.
* diagnostic.h (struct diagnostic_info): Add ctor.
(struct diagnostic_context): Add new member.
* tree-diagnostic.c (set_inlining_locations): New.
(tree_diagnostics_defaults): Set new callback pointer.

3 years agoopenmp: Initial support for OpenMP directives expressed as C++11 attributes
Jakub Jelinek [Fri, 2 Jul 2021 19:59:21 +0000 (21:59 +0200)]
openmp: Initial support for OpenMP directives expressed as C++11 attributes

This is an OpenMP 5.1 feature, but I think it is something very useful for
OpenMP users, so I'm committing it now instead of waiting until all 5.0
work is done.

The support is incomplete, only attributes on statements (or block local
declarations) are supported right now, while for non-executable directives
they should be also supported at namespace scope and at class scope, and
for declarations in all places that appertain to the declarations rather
than e.g. types.

I need to also fix up handling of C++11 non-OpenMP attributes mixed with
OpenMP attributes before block local declarations (currently it throws
them away), probably reject if the directives appertain to labels etc.

In order not to complicate all the OpenMP directive parsing, it is done
by remembering the tokens from the attribute, slightly adjusting them and
feeding them through a temporary new lexer to cp_parse_pragma.

2021-07-02  Jakub Jelinek  <jakub@redhat.com>

gcc/c-family/
* c-common.h (enum c_omp_directive_kind): New enum.
(struct c_omp_directive): New type.
(c_omp_categorize_directive): Declare.
* c-omp.c (omp_directives): New variable.
(c_omp_categorize_directive): New function.
gcc/cp/
* parser.h (struct cp_lexer): Add in_omp_attribute_pragma member.
(struct cp_omp_declare_simd_data): Likewise.
* cp-tree.h (enum cp_tree_index): Add CPTI_OMP_IDENTIFIER.
(omp_identifier): Define.
* parser.c (cp_parser_skip_to_pragma_eol): Handle
in_omp_attribute_pragma CPP_PRAGMA_EOL followed by CPP_EOF.
(cp_parser_require_pragma_eol): Likewise.
(struct cp_omp_attribute_data): New type.
(cp_parser_handle_statement_omp_attributes): New function.
(cp_parser_statement): Handle OpenMP directives in statement's
attribute-specifier-seq.
(cp_parser_omp_directive_args, cp_parser_omp_sequence_args): New
functions.
(cp_parser_std_attribute): Handle omp::directive and omp::sequence
attributes.
(cp_parser_omp_all_clauses): If in_omp_attribute_pragma, allow
a comma also before the first clause.
(cp_parser_omp_allocate): Likewise.
(cp_parser_omp_atomic): Likewise.
(cp_parser_omp_depobj): Likewise.
(cp_parser_omp_flush): Likewise.
(cp_parser_omp_ordered): Likewise.
(cp_parser_omp_declare_simd): Save in_omp_attribute_pragma
into struct cp_omp_declare_simd_data.
(cp_finish_omp_declare_variant): Add in_omp_attribute_pragma
argument.  If set, allow a comma also before match clause.
(cp_parser_late_parsing_omp_declare_simd): If in_omp_attribute_pragma,
allow a comma also before the first clause.  Adjust
cp_finish_omp_declare_variant caller.
(cp_parser_omp_declare_target): If in_omp_attribute_pragma, allow
a comma also before the first clause.
(cp_parser_omp_declare_reduction_exprs): Likewise.
(cp_parser_omp_requires): Likewise.
* decl.c (initialize_predefined_identifiers): Initialize
omp_identifier.
* decl2.c (cplus_decl_attributes): Reject omp::directive and
omp::sequence attributes.
gcc/testsuite/
* g++.dg/gomp/attrs-1.C: New test.
* g++.dg/gomp/attrs-2.C: New test.
* g++.dg/gomp/attrs-3.C: New test.

3 years agoopenmp: Reject #pragma omp atomic update, [PR101297]
Jakub Jelinek [Fri, 2 Jul 2021 19:57:24 +0000 (21:57 +0200)]
openmp: Reject #pragma omp atomic update, [PR101297]

I've noticed that we allow a trailing comma on OpenMP atomic construct
if there is at least one clause.  Commas should be only allowed to
separate the clauses (or in OpenMP 5.1 to separate directive name
from the clauses).

2021-07-02  Jakub Jelinek  <jakub@redhat.com>

PR c/101297
* c-parser.c (c_parser_omp_atomic): Consume comma only if it
appears before a CPP_NAME.

* parser.c (cp_parser_omp_atomic): Consume comma only if it
appears before a CPP_NAME.

* c-c++-common/gomp/atomic-24.c: New test.

3 years agoc++: unqualified member template in constraint [PR101247]
Patrick Palka [Fri, 2 Jul 2021 17:54:57 +0000 (13:54 -0400)]
c++: unqualified member template in constraint [PR101247]

Here any_template_parm_r is failing to mark the template parameters
implicitly used by the unqualified use of 'd' inside the constraint
because the code to do so assumes each level of a template parameter
list points to the corresponding primary template, but here the
parameter level for A in the out-of-line definition of A::B does not
(nor do the parameter levels for A and C in the definition of A::C),
which causes us to overlook the sharing.

So it seems we can't in general depend on the TREE_TYPE of a template
parameter level being non-empty here.  This patch partially fixes this
by rewriting the relevant part of any_template_parm_r to not depend on
the TREE_TYPE of outer levels.  We still depend on the innermost level
to point to the innermost primary template, so we still crash on the
commented out line in the below testcase.

PR c++/101247

gcc/cp/ChangeLog:

* pt.c (any_template_parm_r) <case TEMPLATE_DECL>: Rewrite to
use common_enclosing_class and to not depend on the TREE_TYPE
of outer levels pointing to the corresponding primary template.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-memtmpl4.C: New test.

3 years agors6000: Add MMA __builtin_vsx_lxvp and __builtin_vsx_stxvp built-ins
Peter Bergner [Fri, 2 Jul 2021 16:27:52 +0000 (11:27 -0500)]
rs6000: Add MMA __builtin_vsx_lxvp and __builtin_vsx_stxvp built-ins

Add support for the __builtin_vsx_lxvp and __builtin_vsx_stxvp built-ins
to keep in sync with LLVM which added these earlier.

2021-07-02  Peter Bergner  <bergner@linux.ibm.com>

gcc/
* config/rs6000/rs6000-builtin.def (BU_MMA_PAIR_LD, BU_MMA_PAIR_ST):
New macros.
(__builtin_vsx_lxvp, __builtin_vsx_stxvp): New built-ins.
* config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin): Expand
lxvp and stxvp built-ins.
(mma_init_builtins): Handle lxvp and stxvp built-ins.
(builtin_function_type): Likewise.
* doc/extend.texi (__builtin_vsx_lxvp, __builtin_mma_stxvp): Document.

gcc/testsuite/
* gcc.target/powerpc/mma-builtin-7.c: New test.
* gcc.target/powerpc/mma-builtin-8.c: New test.

3 years agoUse shift instructions to eliminate redundant compare/test instructions on the H8
Jeff Law [Fri, 2 Jul 2021 15:58:47 +0000 (11:58 -0400)]
Use shift instructions to eliminate redundant compare/test instructions on the H8

gcc/ChangeLog

* config/h8300/h8300-protos.h (compute_a_shift_cc): Accept
additional argument for the code.
* config/h8300/h8300.c (compute_a_shift_cc): Accept additional
argument for the code.  Just return if the ZN bits are useful or
not rather than the old style CC_* enums.
* config/h8300/shiftrotate.md (shiftqi_noscratch): Move before
more generic shiftqi patterns.
(shifthi_noscratch, shiftsi_noscratch): Similarly.
(shiftqi_noscratch_set_flags): New pattern.
(shifthi_noscratch_set_flags, shiftsi_noscratch_set_flags): Likewise.

3 years agoFix build_gt and build_lt for signed 1 bit values.
Andrew MacLeod [Wed, 30 Jun 2021 18:15:53 +0000 (14:15 -0400)]
Fix build_gt and build_lt for signed 1 bit values.

Signed 1 bit values have a range of [-1, 0] but neither (0 - 1) nor (-1 + 1)
can be represented.  For signed values, add or subtract -1 as appropriate.

PR tree-optimization/101223
gcc/
* range-op.cc (build_lt): Add -1 for signed values.
(built_gt): Subtract -1 for signed values.

gcc/testsuite/
* gcc.dg/pr101223.c: New.

3 years agoBTF: Support for BTF_KIND_FLOAT
David Faust [Tue, 1 Jun 2021 16:22:59 +0000 (09:22 -0700)]
BTF: Support for BTF_KIND_FLOAT

Add BTF_KIND_FLOAT, a new BTF type kind which has recently stabilized in
the linux kernel [1]. This kind is used for encoding floating point
types, and is of particular use when generating BTF for some s390
arch-specific kernel headers.

Also update some BTF tests which previously used floating point types to
check correct behavior for types with no BTF representation.

[1]: https://github.com/torvalds/linux/commit/b1828f0b04828aa8cccadf00a702f459caefeed9

include/ChangeLog:

* btf.h (struct btf_type): Update bit usage comment.
(BTF_INFO_KIND): Update bit mask.
(BTF_KIND_FLOAT): New define.
(BTF_KIND_MAX): Update.

gcc/ChangeLog:

* btfout.c (get_btf_kind): Support BTF_KIND_FLOAT.
(btf_asm_type): Likewise.

gcc/testsuite/ChangeLog:

* gcc.dg/debug/btf/btf-float-1.c: New test.
* gcc.dg/debug/btf/btf-function-3.c: Use different unrepresentable type.
* gcc.dg/debug/btf/btf-struct-2.c: Likewise.
* gcc.dg/debug/btf/btf-variables-2.c: Likewise.

3 years agoPreparing to use shifts to eliminate redundant test/compare insns on H8
Jeff Law [Fri, 2 Jul 2021 15:07:37 +0000 (11:07 -0400)]
Preparing to use shifts to eliminate redundant test/compare insns on H8

* config/h8300/h8300-protos.h (output_a_shift): Make first argument
an array of rtx rather than a pointer to rtx.  Add code argument.
(compute_a_shift_length): Similarly.
* config/h8300/h8300.c (h8300_shift_costs): Adjust now that the
shift itself isn't an operand.  Create dummy operand[0] to carry
a mode and pass a suitable rtx code to compute_a_shift_length.
(get_shift_alg): Adjust operand number of clobber in output templates.
(output_a_shift): Make first argument an array of rtx rather than
a pointer to rtx.  Add code argument for the type of shift.
Adjust now that the shift itself is no longer an operand.
(compute_a_shift_length): Similarly.
* config/h8300/shiftrotate.md (shiftqi, shifthi, shiftsi): Use an
iterator rather than nshift_operator.
(shiftqi_noscratch, shifthi_noscratch, shiftsi_noscratch): Likewise.
(shiftqi_clobber_flags): Adjust to API changes in output_a_shift
and compute_a_shift_length.
(shiftqi_noscratch_clobber_flags): Likewise.
(shifthi_noscratch_clobber_flags): Likewise.
(shiftsi_noscratch_clobber_flags): Likewise.

3 years agoDarwin, CTF, BTF: Do not run the DWARF debug link for BTF/CTF [PR101283].
Iain Sandoe [Fri, 2 Jul 2021 08:51:57 +0000 (09:51 +0100)]
Darwin, CTF, BTF: Do not run the DWARF debug link for BTF/CTF [PR101283].

Darwin uses an efficient two-stage process for debug linking.
The static linker (ld64) notes the inputs required but does not
link the debug.  When required / on demand the debug is linked
into a separate package by the debug linker (dsymutil).  At
present none of the Darwin tools consume or understand BTF/CTF.
The static linker silently accepts the sections (but will not
act on them as containing anything to be processed).

However, the debug linker produces a warning that it has been
presented with input with no [DWARF] debug content:
warning: no debug symbols in executable (-arch x86_64).

This causes several testsuite fails with excess errors.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf

PR debug/101283

gcc/ChangeLog:

* config/darwin.h (DSYMUTIL_SPEC): Do not try to run
dsymutil for BTF/CTF.

3 years agoDarwin, BTF: Provide a suitable section name for BTF [PR101283].
Iain Sandoe [Fri, 2 Jul 2021 08:44:59 +0000 (09:44 +0100)]
Darwin, BTF: Provide a suitable section name for BTF [PR101283].

In a similar manner to r12-1960-gcc8453012f75d, this provides a
placeholder section name for BTF data.  This change groups BTF
and CTF debug formats in the same segment, but keeps them in
separate sections.

As per the CTF section designation, this should be agreed or
amended to an agreed form before GCC 12 ships.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf

PR debug/101283

gcc/ChangeLog:

* config/darwin.h (CTF_INFO_SECTION_NAME): Update the
segment to include BTF.
(BTF_INFO_SECTION_NAME): New.

3 years agoFix m32r target specific fallout from recent int->bool changes
Jeff Law [Fri, 2 Jul 2021 14:48:26 +0000 (10:48 -0400)]
Fix m32r target specific fallout from recent int->bool changes

gcc/ChangeLog

* config/m32r/m32r-protos.h (call_operand): Adjust return type.
(small_data_operand, memreg_operand, small_insn_p): Likewise.
* config/m32r/m32r.c (call_operand): Adjust return type.
(small_data_operand, memreg_operand): Likewise.

3 years agoFix frv target specific fallout from recent int->bool changes
Jeff Law [Fri, 2 Jul 2021 14:37:52 +0000 (10:37 -0400)]
Fix frv target specific fallout from recent int->bool changes

gcc/ChangeLog

* config/frv/frv-protos.h  (integer_register_operand): Adjust return
type.
(frv_load_operand, gpr_or_fpr_operand, gpr_no_subreg_operand): Likewise.
(fpr_or_int6_operand, gpr_or_int_operand); Likewise.
(gpr_or_int12_operand, gpr_or_int10_operand); Likewise.
(move_source_operand, move_destination_operand): Likewise.
(condexec_source_operand, condexec_dest_operand): Likewise.
(lr_operand, gpr_or_memory_operand, fpr_or_memory_operand): Likewise.
(reg_or_0_operand, fcc_operand, icc_operand, cc_operand): Likewise.
(fcr_operand, icr_operand, cr_operand, call_operand): Likewise.
(fpr_operand, even_reg_operand, odd_reg_operand): Likewise.
(even_gpr_operand, odd_gpr_operand, quad_fpr_operand): Likewise.
(even_fpr_operand, odd_fpr_operand): Likewise.
(dbl_memory_one_insn_operand, dbl_memory_two_insn_operand): Likewise.
(int12_operand, int6_operand, int5_operand, uint5_operand): Likewise.
(uint4_operand, uint1_operand, int_2word_operand): Likewise
(upper_int16_operand, uint16_operand, symbolic_operand): Likewise.
(relational_operator, float_relational_operator): Likewise.
(ccr_eqne_operator, minmax_operator): Likewise.
(condexec_si_binary_operator, condexec_si_media_operator): Likewise.
(condexec_si_divide_operator, condexec_si_unary_operator): Likewise.
(condexec_sf_conv_operator, condexec_sf_add_operator): Likewise.
(intop_compare_operator, acc_operand, even_acc_operand): Likewise.
(quad_acc_operand, accg_operand): Likewise.

3 years agoAdd description of how testsuite parallelization works
Maxim Kuvyrkov [Fri, 2 Jul 2021 14:15:35 +0000 (14:15 +0000)]
Add description of how testsuite parallelization works

... for the benefit of the next poor soul who will need to debug it.

gcc/testsuite/
* lib/gcc-defs.exp: Add a comment.

3 years agoFix xstormy16 target specific fallout from recent int->bool changes
Jeff Law [Fri, 2 Jul 2021 14:31:31 +0000 (10:31 -0400)]
Fix xstormy16 target specific fallout from recent int->bool changes

gcc/
* config/stormy16/stormy16-protos.h (xstormy16_below_100_symbol): Change
return type to a bool.
(nonimmediate_nonstack_operand): Likewise.
(xstormy16_splittable_below100_operand): Likewise.
* config/stormy16/stormy16.c (xstormy16_below_100_symbol): Fix
return type.
(xstormy16_splittable_below100_operand): Likewise.

3 years agotree-optimization/101293 - further enhance LIMs ref canonicalization
Richard Biener [Fri, 2 Jul 2021 10:57:06 +0000 (12:57 +0200)]
tree-optimization/101293 - further enhance LIMs ref canonicalization

This makes sure to handle MEM[p + 4] and MEM[p].j with j at offset 4
as the same ref in store motion.  For hashing we need to be
more restrictive in what we handle since there's no poly-int
handlers for inchash.  For comparison we can compare poly_offsets directly.

2021-07-02  Richard Biener  <rguenther@suse.de>

PR tree-optimization/101293
* tree-ssa-loop-im.c (mem_ref_hasher::equal): Compare MEM_REF bases
with combined offsets.
(gather_mem_refs_stmt): Hash MEM_REFs as if their offset were
combined with the rest of the offset.

* gcc.dg/tree-ssa/ssa-lim-15.c: New testcase.

3 years agolibstdc++: Revert changes to std::unique_ptr<T[]>::operator[] [PR 101271]
Jonathan Wakely [Fri, 2 Jul 2021 07:46:18 +0000 (08:46 +0100)]
libstdc++: Revert changes to std::unique_ptr<T[]>::operator[] [PR 101271]

This reverts the changes in r12-1778 which added a noexcept-specifier to
std::unique_ptr<T[]>::operator[], and the changes in r12-1844 which
tried to make it work with incomplete types (for PR 101236).

The noexcept-specifier is not required by the standard, and is causing
regressions, so just remove it.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

PR libstdc++/101271
* include/bits/unique_ptr.h (unique_ptr<T[],D>::operator[]):
Remove noexcept-specifier.
(unique_ptr<T[],D>::_S_nothrow_deref): Remove.
* testsuite/20_util/unique_ptr/lwg2762.cc: Remove checks for
operator[].

3 years agoChange EH pointer encodings to PC relative on Windows
Eric Botcazou [Fri, 2 Jul 2021 08:21:11 +0000 (10:21 +0200)]
Change EH pointer encodings to PC relative on Windows

A big difference between ELF and PE-COFF is that, with the latter, you can
build position-independent executables or DLLs without generating PIC; as
a  matter of fact, flag_pic has historically been forced to 0 for 32-bit:

/* Don't allow flag_pic to propagate since gas may produce invalid code
   otherwise.  */

\
do {
        \
  flag_pic = TARGET_64BIT ? 1 : 0; \
} while (0)

The reason is that the linker builds a .reloc section that collects the
absolute relocations in the generated binary, and the loader uses them to
relocate it at load time if need be (e.g. if --dynamicbase is enabled).

Up to binutils 2.35, the GNU linker didn't build the .reloc section for
executables and defaulted to --enable-auto-image-base for DLLs, which means
that DLLs had an essentially unique load address and, therefore, need not
be relocated by the loader in most cases.

With binutils 2.36 and later, the GNU linker builds a .reloc section for
executables (thus making them PIE), --enable-auto-image-base is disabled
and --dynamicbase is enabled by default, which means that essentially all
the binaries are relocated at load time.

This badly breaks the 32-bit compiler configured to use DWARF-2 EH because
the loader corrupts the .eh_frame section when processing the relocations
contained in the .reloc section.

gcc/
* config/i386/i386.c (asm_preferred_eh_data_format): Always use the
PIC encodings for PE-COFF targets.

3 years agoi386: Punt on broadcasts from TImode integers [PR101286]
Jakub Jelinek [Fri, 2 Jul 2021 08:06:56 +0000 (10:06 +0200)]
i386: Punt on broadcasts from TImode integers [PR101286]

ix86_expand_vector_init_duplicate doesn't handle TImode -> V2TImode
or TImode -> V4TImode broadcasts, so I think we should punt on TImode
inner mode in ix86_broadcast_from_integer_constant, otherwise we ICE
in ix86_expand_vector_move when ix86_broadcast_from_integer_constant
returns non-NULL and ix86_expand_vector_init_duplicate returns false.

In theory TImode element broadcasts could be handled by some permutations,
but I'm not sure it is worth it.

2021-07-02  Jakub Jelinek  <jakub@redhat.com>

PR target/101286
* config/i386/i386-expand.c (ix86_broadcast_from_integer_constant):
Return nullptr for TImode inner mode.

* gcc.target/i386/avx2-pr101286.c: New test.

3 years agotree-optimization/101280 - re-revise interchange fix for PR101173
Richard Biener [Fri, 2 Jul 2021 06:51:43 +0000 (08:51 +0200)]
tree-optimization/101280 - re-revise interchange fix for PR101173

The following fixes up the revision of the original fix for PR101173
to properly guard all dependence checks with DDR_REVERSED_P or its
inverse.

2021-07-01  Richard Biener  <rguenther@suse.de>

PR tree-optimization/101280
PR tree-optimization/101173
* gimple-loop-interchange.cc
(tree_loop_interchange::valid_data_dependences): Properly
guard all dependence checks with DDR_REVERSED_P or its
inverse.

3 years agoClear odata for aes(enc|dec)(wide)?kl intrinsics when ZF is set.
Hongyu Wang [Wed, 30 Jun 2021 06:38:31 +0000 (14:38 +0800)]
Clear odata for aes(enc|dec)(wide)?kl intrinsics when ZF is set.

For Keylocker aesenc/aesdec intrinsics, current implementation
moves idata to odata unconditionally, which causes safety issue when
the instruction meets runtime error. So we add a branch to clear
odata when ZF is set after instruction exectution.

gcc/ChangeLog:

* config/i386/i386-expand.c (ix86_expand_builtin):
Add branch to clear odata when ZF is set for asedecenc_expand
and wideaesdecenc_expand.

gcc/testsuite/ChangeLog:

* gcc.target/i386/keylocker-aesdec128kl.c: Update test.
* gcc.target/i386/keylocker-aesdec256kl.c: Likewise.
* gcc.target/i386/keylocker-aesdecwide128kl.c: Likewise.
* gcc.target/i386/keylocker-aesdecwide256kl.c: Likewise.
* gcc.target/i386/keylocker-aesenc128kl.c: Likewise.
* gcc.target/i386/keylocker-aesenc256kl.c: Likewise.
* gcc.target/i386/keylocker-aesencwide128kl.c: Likewise.
* gcc.target/i386/keylocker-aesencwide256kl.c: Likewise.

3 years agoUpdate gen_autofdo_event.py and gcc-auto-profile.
Eugene Rozenfeld [Thu, 1 Jul 2021 23:21:36 +0000 (16:21 -0700)]
Update gen_autofdo_event.py and gcc-auto-profile.

gen_autofdo_event.py was stumbling on models with stepping so
I updated the script to handle this case similar to the code in
https://github.com/andikleen/pmu-tools/blob/c6a5f63aede19def8886d6a8b74d7a55c38ca947/event_download.py

The second change was to tolerate cases when the CPU supports PEBS but the
perf command with /p fails. This can happen in, e.g., a virtual machine.

I regenerated gcc-auto-profile using the updated script.

contrib/ChangeLog:

* gen_autofdo_event.py: handle stepping, non-working PEBS

gcc/ChangeLog:

* config/i386/gcc-auto-profile: regenerate

3 years agoFix typo in standard pattern name of trunc<mode><pmov_dst_4>2.
liuhongt [Wed, 30 Jun 2021 09:10:44 +0000 (17:10 +0800)]
Fix typo in standard pattern name of trunc<mode><pmov_dst_4>2.

gcc/ChangeLog

* config/i386/sse.md (trunc<mode><pmov_dst_4>2): Refined to ..
(trunc<mode><pmov_dst_4_lower>2): this.

3 years agoDaily bump.
GCC Administrator [Fri, 2 Jul 2021 00:16:47 +0000 (00:16 +0000)]
Daily bump.

3 years agosoft-fp: Update soft-fp from glibc
H.J. Lu [Thu, 1 Jul 2021 19:27:00 +0000 (12:27 -0700)]
soft-fp: Update soft-fp from glibc

This patch is updating soft-fp from glibc:

1. Add __extendhfxf2 to return an IEEE half converted to IEEE extended.
2. Add __truncxfhf2 to truncate IEEE extended into IEEE half.

These are needed by x86 _Float16 support.

* soft-fp/extendhfxf2.c: New file.
* soft-fp/truncxfhf2.c: Likewise.

3 years agoinput.c: move file caching globals to a new file_cache class
David Malcolm [Thu, 1 Jul 2021 21:44:51 +0000 (17:44 -0400)]
input.c: move file caching globals to a new file_cache class

This moves some global state from input.c to a new file_cache class,
of which an instance is owned by global_dc.  Various state is also
made private.

No functional change intended.

gcc/ChangeLog:
* diagnostic.h (diagnostic_context::m_file_cache): New field.
* input.c (class fcache): Rename to...
(class file_cache_slot): ...this, making most members private and
prefixing fields with "m_".
(file_cache_slot::get_file_path): New accessor.
(file_cache_slot::get_use_count): New accessor.
(file_cache_slot::missing_trailing_newline_p): New accessor.
(file_cache_slot::inc_use_count): New.
(fcache_buffer_size): Move to...
(file_cache_slot::buffer_size): ...here.
(fcache_line_record_size): Move to...
(file_cache_slot::line_record_size): ...here.
(fcache_tab): Delete, in favor of global_dc->m_file_cache.
(fcache_tab_size): Move to file_cache::num_file_slots.
(diagnostic_file_cache_init): Update for move of fcache_tab
to global_dc->m_file_cache.
(diagnostic_file_cache_fini): Likewise.
(lookup_file_in_cache_tab): Convert to...
(file_cache::lookup_file): ...this.
(diagnostics_file_cache_forcibly_evict_file): Update for move of
fcache_tab to global_dc->m_file_cache, moving most of
implementation to...
(file_cache::forcibly_evict_file): ...this new function and...
(file_cache_slot::evict): ...this new function.
(evicted_cache_tab_entry): Convert to...
(file_cache::evicted_cache_tab_entry): ...this.
(add_file_to_cache_tab): Convert to...
(file_cache::add_file): ...this, moving bulk of implementation
to...
(file_cache_slot::create): ..this new function.
(file_cache::file_cache): New.
(file_cache::~file_cache): New.
(lookup_or_add_file_to_cache_tab): Convert to...
(file_cache::lookup_or_add_file): ..this new function.
(fcache::fcache): Rename to...
(file_cache_slot::file_cache_slot): ...this, adding "m_" prefixes
to fields.
(fcache::~fcache): Rename to...
(file_cache_slot::~file_cache_slot): ...this, adding "m_" prefixes
to fields.
(needs_read): Convert to...
(file_cache_slot::needs_read_p): ...this.
(needs_grow): Convert to...
(file_cache_slot::needs_grow_p): ...this.
(maybe_grow): Convert to...
(file_cache_slot::maybe_grow): ...this.
(read_data): Convert to...
(file_cache_slot::read_data): ...this.
(maybe_read_data): Convert to...
(file_cache_slot::maybe_read_data): ...this.
(get_next_line): Convert to...
(file_cache_slot::get_next_line): ...this.
(goto_next_line): Convert to...
(file_cache_slot::goto_next_line): ...this.
(read_line_num): Convert to...
(file_cache_slot::read_line_num): ...this.
(location_get_source_line): Update for moving of globals to
global_dc->m_file_cache.
(location_missing_trailing_newline): Likewise.
* input.h (class file_cache_slot): New forward decl.
(class file_cache): New.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
3 years agoFortran: set version field in CFI_cdesc_t to CFI_VERSION
Sandra Loosemore [Thu, 1 Jul 2021 20:07:59 +0000 (13:07 -0700)]
Fortran: set version field in CFI_cdesc_t to CFI_VERSION

When converting a GFC descriptor to a CFI descriptor, it was
incorrectly copying the version number from the former to the latter.
It should be using the value of CFI_VERSION instead (currently 1).
Going the other direction, the GFC version field is initialized to
zero elsewhere, so do that here too.

2021-06-30  Tobias Burnus  <tobias@codesourcery.com>
    Sandra Loosemore  <sandra@codesourcery.com>

libgfortran/
* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc):
Initialize version field to 0.
(gfc_desc_to_cfi_desc): Initialize version field to CFI_VERSION.

3 years agoAdd IEEE 128-bit fp conditional move on PowerPC.
Michael Meissner [Thu, 1 Jul 2021 18:50:34 +0000 (14:50 -0400)]
Add IEEE 128-bit fp conditional move on PowerPC.

This patch adds the support for power10 IEEE 128-bit floating point conditional
move and for automatically generating min/max.

In this patch, I simplified things compared to previous patches.  Instead of
allowing any four of the modes to be used for the conditional move comparison
and the move itself could use different modes, I restricted the conditional
move to just the same mode.  I.e. you can do:

    _Float128 a, b, c, d, e, r;

    r = (a == b) ? c : d;

But you can't do:

    _Float128 c, d, r;
    double a, b;

    r = (a == b) ? c : d;

or:

    _Float128 a, b;
    double c, d, r;

    r = (a == b) ? c : d;

This eliminates a lot of the complexity of the code, because you don't have to
worry about the sizes being different, and the IEEE 128-bit types being
restricted to Altivec registers, while the SF/DF modes can use any VSX
register.

I did not modify the existing support that allowed conditional moves where
SFmode operands are compared and DFmode operands are moved (and vice versa).

I modified the test cases that I added to reflect this change.  I have also
fixed the test for not equal to use '!=' instead of '=='.

2021-07-01 Michael Meissner  <meissner@linux.ibm.com>

gcc/

* config/rs6000/rs6000.c (rs6000_maybe_emit_fp_cmove): Add IEEE
128-bit floating point conditional move support.
(have_compare_and_set_mask): Add IEEE 128-bit floating point
types.
* config/rs6000/rs6000.md (mov<mode>cc, IEEE128 iterator): New insn.
(mov<mode>cc_p10, IEEE128 iterator): New insn.
(mov<mode>cc_invert_p10, IEEE128 iterator): New insn.
(fpmask<mode>, IEEE128 iterator): New insn.
(xxsel<mode>, IEEE128 iterator): New insn.

gcc/testsuite/

* gcc.target/powerpc/float128-cmove.c: New test.
* gcc.target/powerpc/float128-minmax-3.c: New test.

3 years agolibstdc++: Improvements to Doxygen markup
Jonathan Wakely [Wed, 30 Jun 2021 23:30:54 +0000 (00:30 +0100)]
libstdc++: Improvements to Doxygen markup

This attempst to improve the doxygen output to work around what seems to
be some bugs in doxygen (issues 8635 and 8638).

The @addtogroup command doesn't work for entities inside a nested
namespace (see 8635) so we need to close and reopen groups on entering
and elaving nested namespaces. This fixes the problem that
chrono::duration and chrono::time_point were not documented in the
"Time" documentation group. I am unable to make the path classes appear
as part of their relevant groups (File System and Filesystem TS), nor
the contents of <exception> or <system_error>. I have made some minor
improvements to the docs for those types, including starting to address
PR 97001 by adding @since to the doxygen comments.

This change also excludes the <experimental/bits/net.h> header from
Doxygen processing, so we don't get an unwanted "Networking-ts" group
in the documentation.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* doc/doxygen/doxygroups.cc: Fix docs for std::literals.
* doc/doxygen/user.cfg.in: Exclude the Networking TS header.
Add some more predefined macros.
* include/bits/fs_fwd.h: Move @addtogroup commands inside
namespaces. Add better documentation.
* include/bits/fs_path.h: Likewise.
* include/experimental/bits/fs_fwd.h: Likewise.
* include/experimental/bits/fs_path.h: Likewise.
* include/ext/throw_allocator.h: Fix typo and improve docs.
* include/std/chrono: Move @addtogroup commands.
* include/std/system_error: Move @addtogroup commands.
* libsupc++/exception: Improve documentation.
* libsupc++/exception.h: Add @since documentation.

3 years agoImprove packed record layout support with -fdump-ada-spec
Eric Botcazou [Thu, 1 Jul 2021 16:06:46 +0000 (18:06 +0200)]
Improve packed record layout support with -fdump-ada-spec

We cannot fully support packed record layout in -fdump-ada-spec, as packing
in C and Ada does not behave the same, so we issue a warning.  But simple
cases are OK and can actually be handled without much work.

gcc/c-family/
* c-ada-spec.c (packed_layout): New global variable.
(dump_ada_declaration): Set it upon seeing a packed record type.
Do not put the "aliased" keyword if it is set.
(dump_ada_structure): Add Pack aspect if it is set and clear it.
gcc/testsuite/
* c-c++-common/dump-ada-spec-14.c: Adjust dg-warning directive.

3 years agoFix duplicate name issues in output of -fdump-ada-spec #2
Eric Botcazou [Thu, 1 Jul 2021 16:02:47 +0000 (18:02 +0200)]
Fix duplicate name issues in output of -fdump-ada-spec #2

This extends the type name conflict detection mechanism to variables.

gcc/c-family/
* c-ada-spec.c (check_name): Rename into...
(check_type_name_conflict): ...this.  Minor tweak.
(dump_ada_function_declaration): Adjust to above renaming.
(dump_ada_array_domains): Fix oversight.
(dump_ada_declaration): Call check_type_name_conflict for variables.

3 years agoUse intermediate integer type with proper signedness
Eric Botcazou [Thu, 1 Jul 2021 15:57:16 +0000 (17:57 +0200)]
Use intermediate integer type with proper signedness

This is a minor regression present on mainline and 11 branch, whereby the
value of the Enum_Rep attribute is always unsigned.

gcc/ada/
PR ada/101094
* exp_attr.adb (Get_Integer_Type): Return an integer type with the
same signedness as the input type.

3 years agoDarwin: Define a suitable section name for CTF [PR101283]
Iain Sandoe [Thu, 1 Jul 2021 14:02:43 +0000 (15:02 +0100)]
Darwin: Define a suitable section name for CTF [PR101283]

This is a placeholder name ahead of any CTF implementation on
LLVM (which sets Darwin ABI).  Ideally, we would get agreement
on this choice (or any replacement) before GCC12 is shipped.

PR debug/101283 - Several tests fail on Darwin with -gctf

PR debug/101283

gcc/ChangeLog:

* config/darwin.h (CTF_INFO_SECTION_NAME): New.

3 years agox86: Add vec_duplicate<mode> expander
H.J. Lu [Mon, 7 Jun 2021 21:23:04 +0000 (14:23 -0700)]
x86: Add vec_duplicate<mode> expander

Add vec_duplicate<mode> expander for SSE2 if we can move from GPR to SSE
register directly.

* config/i386/i386-expand.c (ix86_expand_vector_init_duplicate):
Make it global.
* config/i386/i386-protos.h (ix86_expand_vector_init_duplicate):
New prototype.
* config/i386/sse.md (INT_BROADCAST_MODE): New mode iterator.
(vec_duplicate<mode>): New expander.

3 years agox86: Convert CONST_WIDE_INT/CONST_VECTOR to broadcast
H.J. Lu [Wed, 2 Jun 2021 14:15:45 +0000 (07:15 -0700)]
x86: Convert CONST_WIDE_INT/CONST_VECTOR to broadcast

1. Update move expanders to convert the CONST_WIDE_INT and CONST_VECTOR
operands to vector broadcast from an integer with AVX.
2. Add ix86_gen_scratch_sse_rtx to return a scratch SSE register which
won't increase stack alignment requirement and blocks transformation by
the combine pass.

A small benchmark:

https://gitlab.com/x86-benchmarks/microbenchmark/-/tree/memset/broadcast

shows that broadcast is a little bit faster on Intel Core i7-8559U:

$ make
gcc -g -I. -O2   -c -o test.o test.c
gcc -g   -c -o memory.o memory.S
gcc -g   -c -o broadcast.o broadcast.S
gcc -g   -c -o vec_dup_sse2.o vec_dup_sse2.S
gcc -o test test.o memory.o broadcast.o vec_dup_sse2.o
./test
memory      : 147215
broadcast   : 121213
vec_dup_sse2: 171366
$

broadcast is also smaller:

$ size memory.o broadcast.o
   text    data     bss     dec     hex filename
    132       0       0     132      84 memory.o
    122       0       0     122      7a broadcast.o
$

3. Update PR 87767 tests to expect integer broadcast instead of broadcast
from memory.
4. Update avx512f_cond_move.c to expect integer broadcast.

A small benchmark:

https://gitlab.com/x86-benchmarks/microbenchmark/-/tree/vpaddd/broadcast

shows that integer broadcast is faster than embedded memory broadcast:

$ make
gcc -g -I. -O2 -march=skylake-avx512   -c -o test.o test.c
gcc -g   -c -o memory.o memory.S
gcc -g   -c -o broadcast.o broadcast.S
gcc -o test test.o memory.o broadcast.o
./test
memory      : 425538
broadcast   : 375260
$

gcc/

PR target/100865
* config/i386/i386-expand.c (ix86_expand_vector_init_duplicate):
New prototype.
(ix86_byte_broadcast): New function.
(ix86_convert_const_wide_int_to_broadcast): Likewise.
(ix86_expand_move): Convert CONST_WIDE_INT to broadcast if mode
size is 16 bytes or bigger.
(ix86_broadcast_from_integer_constant): New function.
(ix86_expand_vector_move): Convert CONST_WIDE_INT and CONST_VECTOR
to broadcast if mode size is 16 bytes or bigger.
* config/i386/i386-protos.h (ix86_gen_scratch_sse_rtx): New
prototype.
* config/i386/i386.c (ix86_gen_scratch_sse_rtx): New function.

gcc/testsuite/

PR target/100865
* gcc.target/i386/avx512f-broadcast-pr87767-1.c: Expect integer
broadcast.
* gcc.target/i386/avx512f-broadcast-pr87767-5.c: Likewise.
* gcc.target/i386/avx512vl-broadcast-pr87767-1.c: Likewise.
* gcc.target/i386/avx512vl-broadcast-pr87767-5.c: Likewise.
* gcc.target/i386/avx512f_cond_move.c: Also pass
-mprefer-vector-width=512 and expect integer broadcast.
* gcc.target/i386/pr100865-1.c: New test.
* gcc.target/i386/pr100865-2.c: Likewise.
* gcc.target/i386/pr100865-3.c: Likewise.
* gcc.target/i386/pr100865-4a.c: Likewise.
* gcc.target/i386/pr100865-4b.c: Likewise.
* gcc.target/i386/pr100865-5a.c: Likewise.
* gcc.target/i386/pr100865-5b.c: Likewise.
* gcc.target/i386/pr100865-6a.c: Likewise.
* gcc.target/i386/pr100865-6b.c: Likewise.
* gcc.target/i386/pr100865-6c.c: Likewise.
* gcc.target/i386/pr100865-7a.c: Likewise.
* gcc.target/i386/pr100865-7b.c: Likewise.
* gcc.target/i386/pr100865-7c.c: Likewise.
* gcc.target/i386/pr100865-8a.c: Likewise.
* gcc.target/i386/pr100865-8b.c: Likewise.
* gcc.target/i386/pr100865-8c.c: Likewise.
* gcc.target/i386/pr100865-9a.c: Likewise.
* gcc.target/i386/pr100865-9b.c: Likewise.
* gcc.target/i386/pr100865-9c.c: Likewise.
* gcc.target/i386/pr100865-10a.c: Likewise.
* gcc.target/i386/pr100865-10b.c: Likewise.
* gcc.target/i386/pr100865-11a.c: Likewise.
* gcc.target/i386/pr100865-11b.c: Likewise.
* gcc.target/i386/pr100865-11c.c: Likewise.
* gcc.target/i386/pr100865-12a.c: Likewise.
* gcc.target/i386/pr100865-12b.c: Likewise.
* gcc.target/i386/pr100865-12c.c: Likewise.

3 years agoi386: Return true/false instead of 1/0 from predicates.
Uros Bizjak [Thu, 1 Jul 2021 14:57:57 +0000 (16:57 +0200)]
i386: Return true/false instead of 1/0 from predicates.

No functional changes.

2021-07-01  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
* config/i386/predicates.md (ix86_endbr_immediate_operand):
Return true/false instead of 1/0.
(movq_parallel): Ditto.

3 years agoReturn true/false instead of 1/0 from generic predicates.
Uros Bizjak [Thu, 1 Jul 2021 14:52:11 +0000 (16:52 +0200)]
Return true/false instead of 1/0 from generic predicates.

No functional changes.

2021-07-01  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
* recog.c (general_operand): Return true/false instead of 1/0.
(register_operand): Ditto.
(immediate_operand): Ditto.
(const_int_operand): Ditto.
(const_scalar_int_operand): Ditto.
(const_double_operand): Ditto.
(push_operand): Ditto.
(pop_operand): Ditto.
(memory_operand): Ditto.
(indirect_operand): Ditto.

3 years agoChange the type of predicates to bool.
Uros Bizjak [Thu, 1 Jul 2021 13:18:50 +0000 (15:18 +0200)]
Change the type of predicates to bool.

The patch was tested on many targets, but some fallout is expected.
To fix the build error, simply change the function type from int to bool,
as was done in the patch for several targets.

2021-07-01  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
* genpreds.c (write_predicate_subfunction):
Change the type of written subfunction to bool.
(write_one_predicate_function):
Change the type of written function to bool.
(write_tm_preds_h): Ditto.
* recog.h (*insn_operand_predicate_fn): Change the type to bool.
* recog.c (general_operand): Change the type to bool.
(address_operand): Ditto.
(register_operand): Ditto.
(pmode_register_operand): Ditto.
(scratch_operand): Ditto.
(immediate_operand): Ditto.
(const_int_operand): Ditto.
(const_scalar_int_operand): Ditto.
(const_double_operand): Ditto.
(nonimmediate_operand): Ditto.
(nonmemory_operand): Ditto.
(push_operand): Ditto.
(pop_operand): Ditto.
(memory_operand): Ditto.
(indirect_operand): Ditto.
(ordered_comparison_operator): Ditto.
(comparison_operator): Ditto.

* config/i386/i386-expand.c (ix86_expand_sse_cmp):
Change the type of indirect predicate function to bool.

* config/rs6000/rs6000.c (easy_vector_constant):
Change the type to bool.

* config/mips/mips-protos.h (m16_based_address_p):
Change the type of operand 3 to bool.

3 years agotree-optimization/101280 - revise interchange fix for PR101173
Richard Biener [Thu, 1 Jul 2021 10:49:45 +0000 (12:49 +0200)]
tree-optimization/101280 - revise interchange fix for PR101173

The following revises the original fix for PR101173 to correctly
check for a reversed dependence rather than disallowing a zero
distance.  It also adds a check from TSVC which asks for this
kind of interchange (but with a valid dependence).

2021-07-01  Richard Biener  <rguenther@suse.de>

PR tree-optimization/101280
PR tree-optimization/101173
* gimple-loop-interchange.cc
(tree_loop_interchange::valid_data_dependences): Revert
previous change and instead correctly handle DDR_REVERSED_P
dependence.

* gcc.dg/tree-ssa/loop-interchange-16.c: New testcase.

3 years agoMAINTAINERS - Add myself for write after approval
Ankur Saini [Thu, 1 Jul 2021 11:13:24 +0000 (16:43 +0530)]
MAINTAINERS - Add myself for write after approval

2021-07-01  Ankur Saini  <arsenic@sourceware.org>

* MAINTAINERS: Add myself for write after approval.

3 years agotree-optimization/101278 - handle self-use in DSE analysis
Richard Biener [Thu, 1 Jul 2021 09:16:01 +0000 (11:16 +0200)]
tree-optimization/101278 - handle self-use in DSE analysis

DSE store classification short-cuts the to-be classified stmt itself
from chaining but fails to first check whether the store uses itself
which can be the case when it is a call with the LHS also passed by
value as argument.

2021-07-01  Richard Biener  <rguenther@suse.de>

PR tree-optimization/101278
* tree-ssa-dse.c (dse_classify_store): First check for
uses, then ignore stmt for chaining purposes.

* gcc.dg/torture/pr101278.c: New testcase.

3 years agotree-optimization/100778 - fix placement of trapping vectorized ops
Richard Biener [Thu, 1 Jul 2021 08:35:38 +0000 (10:35 +0200)]
tree-optimization/100778 - fix placement of trapping vectorized ops

This avoids placing possibly trapping vectorized operations where
the corresponding scalar operation was possibly not executed.

2021-01-07  Richard Biener  <rguenther@suse.de>

PR tree-optimization/100778
* tree-vect-slp.c (vect_schedule_slp_node): Do not place trapping
vectorized ops ahead of their scalar BB.

* gcc.dg/torture/pr100778.c: New testcase.

3 years agoi386: Add integer nabs instructions [PR101044]
Uros Bizjak [Thu, 1 Jul 2021 08:56:32 +0000 (10:56 +0200)]
i386: Add integer nabs instructions [PR101044]

The patch adds integer nabs "(NEG (ABS (...)))" instructions, adds STV
conversion and adjusts STV cost calculations accordingly.  When CMOV
instruction is used to implement abs, the sign is determined from the
preceeding operand negation, and CMOVS is used to select between
negated and non-negated value.

To implement nabs, just reverse the condition and emit CMOVNS instead.

The STV costs are adjusted for inherent NOT of nabs insn. V2DI NOT is
somehow costly operation, since it is implemented as a load of zero,
followed by a SUB insn. OTOH, integer nabs with inherent NOT is relatively
cheap, so some STV chains became less profitable for conversion.

The patch rewrites operand scanner in compute_convert_gain to a switch
and reorders case instances in general_scalar_to_vector_candidate_p
to benefit from fallthroughs, and to remove special processing of
andnot in the later case.

gcc/

2021-07-01  Uroš Bizjak  <ubizjak@gmail.com>

PR target/101044
* config/i386/i386.md (*nabs<dwi>2_doubleword):
New insn_and_split pattern.
(*nabs<dwi>2_1): Ditto.
* config/i386/i386-features.c
(general_scalar_chain::compute_convert_gain):
Handle (NEG (ABS (...))) RTX.  Rewrite src code
scanner as switch statement.
(general_scalar_chain::convert_insn):
Handle (NEG (ABS (...))) RTX.
(general_scalar_to_vector_candidate_p):
Detect  (NEG (ABS (...))) RTX.  Reorder case statements
for (AND (NOT (...) ...)) fallthrough.

gcc/testsuite/

2021-07-01  Uroš Bizjak  <ubizjak@gmail.com>

PR target/101044
* gcc.target/i386/pr101044.c: New test.

3 years agotree-optimization/101178 - handle VEC_PERM in SLP permute propagation
Richard Biener [Wed, 30 Jun 2021 14:28:50 +0000 (16:28 +0200)]
tree-optimization/101178 - handle VEC_PERM in SLP permute propagation

This adds handling of VEC_PERM nodes to SLP permute propagation.
Previously VEC_PERM acted as forced materialization of incoming
permutes since it is a good place to do that (with the constraint
of those only appearing for two-operator nodes).  The following
patch, in addition to supporting (but not forcing) this, enables
VEC_PERM nodes acting as "any" permute on the outgoing side since
they also can consume arbitrary permutes on that side.

This again (meh) changes how we represent permutes and materialization
on the graph vertices now explicitely having the common incoming
permute as well as an outgoing permute and in case both are
different the vertex acts as materialization point of the incoming
permute.

2021-06-30  Richard Biener  <rguenther@suse.de>

PR tree-optimization/101178
* tree-vect-slp.c (slpg_vertex::materialize): Remove.
(slpg::perm_in): Add.
(slpg::get_perm_in): Remove.
(slpg::get_perm_materialized): Add.
(vect_optimize_slp): Handle VEC_PERM nodes more optimally
during permute propagation and materialization.

* gcc.dg/vect/bb-slp-72.c: New testcase.
* gcc.dg/vect/bb-slp-73.c: Likewise.
* gcc.dg/vect/bb-slp-74.c: Likewise.

3 years agodwarf2out: Handle COMPOUND_LITERAL_EXPR in loc_list_from_tree_1 [PR101266]
Jakub Jelinek [Thu, 1 Jul 2021 07:45:02 +0000 (09:45 +0200)]
dwarf2out: Handle COMPOUND_LITERAL_EXPR in loc_list_from_tree_1 [PR101266]

In this case dwarf2out_decl is called from the FEs with GENERIC but not
yet gimplified expressions in it.

As loc_list_from_tree_1 has an exhaustive list of tree codes it wants to
handle and for checking asserts no other codes makes it in, we should
handle even GENERIC trees that shouldn't be valid in GIMPLE.

The following patch handles COMPOUND_LITERAL_EXPR by hnadling it like the
underlying VAR_DECL temporary.

Verified the emitted DWARF is correct (but unoptimized, we emit
DW_OP_lit1 DW_OP_lit1 DW_OP_minus for the upper bound).

2021-07-01  Jakub Jelinek  <jakub@redhat.com>

PR debug/101266
* dwarf2out.c (loc_list_from_tree_1): Handle COMPOUND_LITERAL_EXPR.

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

3 years agoopenmp - Fix up && and || reductions [PR94366]
Jakub Jelinek [Thu, 1 Jul 2021 06:55:49 +0000 (08:55 +0200)]
openmp - Fix up && and || reductions [PR94366]

As the testcase shows, the special treatment of && and || reduction combiners
where we expand them as omp_out = (omp_out != 0) && (omp_in != 0) (or with ||)
is not needed just for &&/|| on floating point or complex types, but for all
&&/|| reductions - when expanded as omp_out = omp_out && omp_in (not in C but
GENERIC) it is actually gimplified into NOP_EXPRs to bool from both operands,
which turns non-zero values multiple of 2 into 0 rather than 1.

This patch just treats all &&/|| the same and furthermore uses bool type
instead of int for the comparisons.

2021-07-01  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/94366
gcc/
* omp-low.c (lower_rec_input_clauses): Rename is_fp_and_or to
is_truth_op, set it for TRUTH_*IF_EXPR regardless of new_var's type,
use boolean_type_node instead of integer_type_node as NE_EXPR type.
(lower_reduction_clauses): Likewise.
libgomp/
* testsuite/libgomp.c-c++-common/pr94366.c: New test.

3 years agoc++: cxx_eval_array_reference and empty elem type [PR101194]
Patrick Palka [Thu, 1 Jul 2021 00:44:52 +0000 (20:44 -0400)]
c++: cxx_eval_array_reference and empty elem type [PR101194]

Here the initializer for x is represented as an empty CONSTRUCTOR due to
its empty element type.  So during constexpr evaluation of the ARRAY_REF
x[0], we end up trying to value initialize the omitted element at index 0,
which fails because the element type is not default constructible.

This patch makes cxx_eval_array_reference specifically handle the case
where the element type is an empty type.

PR c++/101194

gcc/cp/ChangeLog:

* constexpr.c (cxx_eval_array_reference): When the element type
is an empty type and the corresponding element is omitted, just
return an empty CONSTRUCTOR instead of attempting value
initialization.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/constexpr-empty16.C: New test.

3 years agoc++: Extend the PR96204 fix to variable templates too
Patrick Palka [Thu, 1 Jul 2021 00:21:16 +0000 (20:21 -0400)]
c++: Extend the PR96204 fix to variable templates too

r12-1829 corrected the access scope during partial specialization
matching of class templates, but overlooked the variable template case.
This patch moves the access scope adjustment to within
most_specialized_partial_spec so that all callers can benefit.

This patch also adjusts a couple of these callers to avoid always
passing the most general template of a variable template specialization,
since that'd cause us to push the wrong access scope for e.g. the second
testcase below (we'd push A<T> instead of A<int>/A<char>).  We ought to
be passing the partially instantiated template instead.

PR c++/96204

gcc/cp/ChangeLog:

* pt.c (finish_template_variable): Pass the partially
instantiated template and its args to instantiate_template.
(instantiate_class_template_1): No need to call
push_nested_class and pop_nested_class around the call to
most_specialized_partial_spec.
(instantiate_template_1): Pass the partially instantiated
template to lookup_template_variable.
(most_specialized_partial_spec):  Use push_access_scope_guard
to set the access scope appropriately.  Use
deferring_access_check_sentinel to force access to get checked
immediately.
(instantiate_decl): Just pass the VAR_DECL to
most_specialized_partial_spec.

gcc/testsuite/ChangeLog:

* g++.dg/template/access41.C: New test.
* g++.dg/template/access41a.C: New test.

3 years agoDaily bump.
GCC Administrator [Thu, 1 Jul 2021 00:16:41 +0000 (00:16 +0000)]
Daily bump.

3 years agolibstdc++: Improve Doxygen documentation groups [PR 101258]
Jonathan Wakely [Wed, 30 Jun 2021 15:00:58 +0000 (16:00 +0100)]
libstdc++: Improve Doxygen documentation groups [PR 101258]

This defines some new Doxygen groups for C++17 variable templates and
for the contents of <experimental/type_traits>. By documenting the group
as a whole and adding each template to a group we don't need to document
them individually.

Also mark more internals with "@cond undocumented" so that Doxygen
ignores them by default. Also make Doxygen process <experimental/simd>.

For some reason, many of the class templates in <type_traits> do not
appear in the "Metaprogramming" group. For example, add_cv,
remove_extent, and all the is_xxx_constructible and is_xxx_assignable
traits. For some reason, Doxygen doesn't include them in the group,
despite doing it correctly for other traits in the same header.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

PR libstdc++/101258
* doc/doxygen/user.cfg.in (INPUT): Add <experimental/simd>.
(COLS_IN_ALPHA_INDEX): Remove obsolete tag.
(PREDEFINED): Add/fix some more macros that need to be expanded.
* include/bits/random.h: Stop Doxygen from documenting internal
implementation details.
* include/bits/random.tcc: Likewise.
* include/bits/this_thread_sleep.h: Fix @file name.
* include/experimental/bits/simd.h: Add to Doxygen group. Do not
document internal implementation details.
* include/experimental/bits/simd_detail.h: Do not document
internal implementation details.
* include/experimental/simd: Define Doxygen groups.
* include/experimental/type_traits: Improve documentation for
the header file. Define groups. Use @since commands.
* include/std/scoped_allocator (scoped_allocator_adaptor): Move
declaration before undocumented region.
* include/std/type_traits (true_type, false_type): Use using
declaration instead of typedef.
(is_invocable_v, is_nothrow_invocable_v, is_invocable_r_v)
(is_nothrow_invocable_r_v): Move definitions next to other C++17
variable templates.
Do not document internal implementation details. Move misplaced
group-end command. Define group for variable templates.
* include/std/variant: Do not document internal implementation
details.
* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
line number.

3 years agolibstdc++: Make <experimental/simd> depend on C++17
Jonathan Wakely [Wed, 30 Jun 2021 20:35:51 +0000 (21:35 +0100)]
libstdc++: Make <experimental/simd> depend on C++17

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/experimental/simd: Do not define anything pre-C++17.

3 years agolibstdc++: Suppress redundant definitions of static members in <random>
Jonathan Wakely [Wed, 30 Jun 2021 14:47:41 +0000 (15:47 +0100)]
libstdc++: Suppress redundant definitions of static members in <random>

Since C++17 the static members of the random number engines are
implicitly inline, so don't need definitions.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/random.tcc [__cpp_inline_variables]: Remove
redundant definitions of static constexpr member variables.
* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
line number.

3 years agotestsuite: Add missing dg-add-options to CTF testcase ctf-skip-types-4.c
Indu Bhagat [Wed, 30 Jun 2021 22:13:50 +0000 (15:13 -0700)]
testsuite: Add missing dg-add-options to CTF testcase ctf-skip-types-4.c

The test already has the appropriate dg-require-effective-target, but requires
the dg-add-options to use the flags needed, if any. This patch fixes the
failure of this testcase on powerpc64.

2021-06-30  Indu Bhagat  <indu.bhagat@oracle.com>

gcc/testsuite/
* gcc.dg/debug/ctf/ctf-skip-types-4.c: Add dg-add-options float64 and
float64x.

3 years agolibiberty: No longer use /usr/tmp
Gerald Pfeifer [Mon, 28 Jun 2021 22:39:15 +0000 (00:39 +0200)]
libiberty: No longer use /usr/tmp

/usr/tmp is antiquated and not present on decently modern systems.
Remove it from consideration when choosing a directory for temporary
files.

libiberty:

2021-06-29  Gerald Pfeifer  <gerald@pfeifer.com>

* make-temp-file.c (usrtmp): Remove.
(choose_tmpdir): Remove use of usrtmp.

3 years agoFix IEEE 128-bit min/max test.
Michael Meissner [Wed, 30 Jun 2021 18:54:48 +0000 (14:54 -0400)]
Fix IEEE 128-bit min/max test.

This patch fixes the float128-minmax.c test so that it can accommodate the
generation of xsmincqp and xsmaxcqp instructions on power10.  I changed the
effective target from 'float128' to 'ppc_float128_hw', since this needs the
IEEE 128-bit float hardware support.  Changing to use 'ppc_float128_hw' allows
the 'lp64' test to be dropped.  The 'lp64' test originally was needed because
big endian 32-bit code cannot enable the IEEE 128-bit floating point
instructions.

gcc/testsuite/
2021-06-30  Michael Meissner  <meissner@linux.ibm.com>

* gcc.target/powerpc/float128-minmax.c: Adjust expected code for
power10.
* lib/target-supports.exp (check_effective_target_has_arch_pwr10):
New.

3 years agoc++: Fix push_access_scope and introduce RAII wrapper for it
Patrick Palka [Wed, 30 Jun 2021 17:12:36 +0000 (13:12 -0400)]
c++: Fix push_access_scope and introduce RAII wrapper for it

When push_access_scope is passed a TYPE_DECL for a class type (which
can happen during e.g. satisfaction), we undesirably push only the
enclosing context of the class instead of the class itself.  This
causes us to mishandle e.g. testcase below due to us not entering the
scope of A before checking its constraints.

This patch adjusts push_access_scope accordingly, and introduces an
RAII wrapper for it.  We make use of this wrapper right away by
replacing the only user of push_nested_class_guard with this new
wrapper, which means we can remove push_nested_class_guard (whose
functionality is basically subsumed by the new wrapper).

gcc/cp/ChangeLog:

* constraint.cc (get_normalized_constraints_from_decl): Use
push_access_scope_guard instead of push_nested_class_guard.
* cp-tree.h (struct push_nested_class_guard): Replace with ...
(struct push_access_scope_guard): ... this.
* pt.c (push_access_scope): When the argument corresponds to
a class type, push the class instead of its context.
(pop_access_scope): Adjust accordingly.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-access2.C: New test.

3 years ago[amdgcn] Add hook for DWARF address spaces.
Hafiz Abid Qadeer [Fri, 28 May 2021 17:06:57 +0000 (18:06 +0100)]
[amdgcn] Add hook for DWARF address spaces.

Map GCN address spaces to the proposed DWARF address spaces defined by AMD at
https://llvm.org/docs/AMDGPUUsage.html#amdgpu-dwarf-address-class-mapping-table

gcc/

* config/gcn/gcn.c: Include dwarf2.h.
(gcn_addr_space_debug): New function.
(TARGET_ADDR_SPACE_DEBUG): New hook.

3 years ago[amdgcn] Use frame pointer for CFA expressions.
Hafiz Abid Qadeer [Mon, 21 Jun 2021 21:47:58 +0000 (22:47 +0100)]
[amdgcn] Use frame pointer for CFA expressions.

As size of address is bigger than registers in amdgcn, we are forced to use
DW_CFA_def_cfa_expression to make an expression that concatenates multiple
registers for the value of the CFA.  This then prohibits us from using many
of the dwarf ops which expect CFA rule to be a single regsiter plus an offset.
Using frame pointer in the CFA rule is only real possibility as it is saved
in every frame and it is easy to unwind its value.

So unless user gives fomit-frame-pointer, we use frame pointer for the
cfi information.  This options also has a different default now.

gcc/

* common/config/gcn/gcn-common.c
(gcn_option_optimization_table): Change OPT_fomit_frame_pointer to -O3.
* config/gcn/gcn.c (gcn_expand_prologue): Prefer the frame pointer
when emitting CFI.
(gcn_expand_prologue): Prefer the frame pointer when emitting CFI.
(gcn_frame_pointer_rqd): New function.
(TARGET_FRAME_POINTER_REQUIRED): New hook.

3 years ago[amdgcn] Update CFI configuration
Hafiz Abid Qadeer [Fri, 28 May 2021 16:49:46 +0000 (17:49 +0100)]
[amdgcn] Update CFI configuration

Currently we don't get any call frame information for the amdgcn target.
This patch makes necessary adjustments to generate CFI that can work with
ROCGDB (ROCm 3.8+).

gcc/

* config/gcn/gcn.c (move_callee_saved_registers): Emit CFI notes for
prologue register saves.
(gcn_debug_unwind_info): Use UI_DWARF2.
(gcn_dwarf_register_number): Map DWARF_LINK_REGISTER to DWARF PC.
(gcn_dwarf_register_span): DWARF_LINK_REGISTER doesn't span.
* config/gcn/gcn.h: (DWARF_FRAME_RETURN_COLUMN): New define.
(DWARF_LINK_REGISTER): New define.
(FIRST_PSEUDO_REGISTER): Increment.
(FIXED_REGISTERS): Add entry for DWARF_LINK_REGISTER.
(CALL_USED_REGISTERS): Likewise.
(REGISTER_NAMES): Likewise.

3 years agoc++: DR2397 - auto specifier for * and & to arrays [PR100975]
Marek Polacek [Tue, 29 Jun 2021 18:30:51 +0000 (14:30 -0400)]
c++: DR2397 - auto specifier for * and & to arrays [PR100975]

This patch implements DR2397, which removes the restriction in
[dcl.array]p4 that the array element type may not be a placeholder
type.  We don't need to worry about decltype(auto) here, so this
allows code like

  int a[3];
  auto (*p)[3] = &a;
  auto (&r)[3] = a;

However, note that

  auto (&&r)[2] = { 1, 2 };
  auto arr[2] = { 1, 2 };

still doesn't work (although one day it might) and neither does

  int arr[5];
  auto x[5] = arr;

given that auto deduction is performed in terms of function template
argument deduction, so the array decays to *.

PR c++/100975
DR 2397

gcc/cp/ChangeLog:

* decl.c (create_array_type_for_decl): Allow array of auto.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/auto24.C: Remove dg-error.
* g++.dg/cpp0x/auto3.C: Adjust dg-error.
* g++.dg/cpp0x/auto42.C: Likewise.
* g++.dg/cpp0x/initlist75.C: Likewise.
* g++.dg/cpp0x/initlist80.C: Likewise.
* g++.dg/diagnostic/auto1.C: Remove dg-error.
* g++.dg/cpp23/auto-array.C: New test.

3 years agotree-optimization/101267 - fix SLP vect with masked operations
Richard Biener [Wed, 30 Jun 2021 10:35:45 +0000 (12:35 +0200)]
tree-optimization/101267 - fix SLP vect with masked operations

This fixes the missed handling of external/constant mask SLP
operations, for the testcase in particular masked loads.  The
patch adjusts the vect_check_scalar_mask API to reflect the
required vect_is_simple_use SLP compatible API plus adjusts
for the special handling of masked loads in SLP discovery.

The issue is likely latent.

2021-06-30  Richard Biener  <rguenther@suse.de>

PR tree-optimization/101267
* tree-vect-stmts.c (vect_check_scalar_mask): Adjust
API and use SLP compatible interface of vect_is_simple_use.
Reject not vectorized SLP defs for callers that do not support
that.
(vect_check_store_rhs): Handle masked stores and pass down
the appropriate operator index.
(vectorizable_call): Adjust.
(vectorizable_store): Likewise.
(vectorizable_load): Likewise.  Handle SLP pecularity of
masked loads.
(vect_is_simple_use): Remove special-casing of masked stores.

* gfortran.dg/pr101267.f90: New testcase.

3 years agoanalyzer: eliminate enum binding_key [PR95006]
David Malcolm [Wed, 30 Jun 2021 13:39:04 +0000 (09:39 -0400)]
analyzer: eliminate enum binding_key [PR95006]

I rewrote the way the analyzer's region_model tracks the state of memory
in GCC 11 (in 808f4dfeb3a95f50f15e71148e5c1067f90a126d), which
introduced a store with a binding_map class, mapping binding keys to
symbolic values.

The GCC 11 implementation of binding keys has an enum binding_kind,
which can be "default" vs "direct"; the idea being that direct
bindings take priority over default bindings, where the latter could
be used to represent e.g. a zero-fill of a buffer, and the former
expresses those subregions that have since been touched.

This doesn't work well: it doesn't express the idea of filling
different subregions with different values, or a memset that only
touches part of a buffer, leading to numerous XFAILs in the memset
test cases (and elsewhere).

As preparatory work towards tracking uninitialized values, this patch
eliminates the enum binding_kind, so that all bindings have
equal weight; the order in which they happen is all that matters.
If a write happens which partially overwrites an existing binding,
the new code can partially overwrite a binding, potentially punching a
hole so that an existing binding is split into two parts.

The patch adds some new classes:
- a new "bits_within_svalue" symbolic value to support extracting
  parts of an existing value when its binding is partially clobbered
- a new "repeated_svalue" symbolic value to better express filling
  a region with repeated copies of a symbolic value (e.g. constant
  zero)
- a new "sized_region" region to express accessing a subregion
  with a symbolic size in bytes
and it rewrites e.g. how memset is implemented, so that we can precisely
track which bits in a region have not been touched.

That said, the patch doesn't actually implement "uninitialized" values;
I'm saving that for a followup.

gcc/analyzer/ChangeLog:
PR analyzer/95006
* analyzer.h (class repeated_svalue): New forward decl.
(class bits_within_svalue): New forward decl.
(class sized_region): New forward decl.
(get_field_at_bit_offset): New forward decl.
* engine.cc (exploded_graph::get_or_create_node): Validate the
merged state.
(exploded_graph::maybe_process_run_of_before_supernode_enodes):
Validate the states at each stage.
* program-state.cc (program_state::validate): Validate
m_region_model.
* region-model-impl-calls.cc (region_model::impl_call_memset):
Replace special-case logic for handling constant sizes with
a call to fill_region of a sized_region with the given fill value.
* region-model-manager.cc (maybe_undo_optimize_bit_field_compare):
Drop DK_direct.
(region_model_manager::maybe_fold_sub_svalue):  Fold element-based
subregions of an initial value into initial values of an element.
Fold subvalues of repeated svalues.
(region_model_manager::maybe_fold_repeated_svalue): New.
(region_model_manager::get_or_create_repeated_svalue): New.
(get_bit_range_for_field): New.
(get_byte_range_for_field): New.
(get_field_at_byte_range): New.
(region_model_manager::maybe_fold_bits_within_svalue): New.
(region_model_manager::get_or_create_bits_within): New.
(region_model_manager::get_sized_region): New.
(region_model_manager::log_stats): Update for addition of
m_repeated_values_map, m_bits_within_values_map, and
m_sized_regions.
* region-model.cc (region_model::validate): New.
(region_model::on_assignment): Drop enum binding_kind.
(region_model::get_initial_value_for_global): Likewise.
(region_model::get_rvalue_for_bits): Replace body with call to
get_or_create_bits_within.
(region_model::get_capacity): Handle RK_SIZED.
(region_model::set_value): Drop enum binding_kind.
(region_model::fill_region): New.
(region_model::get_representative_path_var_1): Handle RK_SIZED.
* region-model.h (visitor::visit_repeated_svalue): New.
(visitor::visit_bits_within_svalue): New.
(region_model_manager::get_or_create_repeated_svalue): New decl.
(region_model_manager::get_or_create_bits_within): New decl.
(region_model_manager::get_sized_region): New decl.
(region_model_manager::maybe_fold_repeated_svalue): New decl.
(region_model_manager::maybe_fold_bits_within_svalue): New decl.
(region_model_manager::repeated_values_map_t): New typedef.
(region_model_manager::m_repeated_values_map): New field.
(region_model_manager::bits_within_values_map_t): New typedef.
(region_model_manager::m_bits_within_values_map): New field.
(region_model_manager::m_sized_regions): New field.
(region_model::fill_region): New decl.
* region.cc (region::get_base_region): Handle RK_SIZED.
(region::base_region_p): Likewise.
(region::get_byte_size_sval): New.
(get_field_at_bit_offset): Make non-static.
(region::calc_offset): Move implementation of cases to
get_relative_concrete_offset vfunc implementations.  Handle
RK_SIZED.
(region::get_relative_concrete_offset): New.
(decl_region::get_svalue_for_initializer): Drop enum binding_kind.
(field_region::get_relative_concrete_offset): New, from
region::calc_offset.
(element_region::get_relative_concrete_offset): Likewise.
(offset_region::get_relative_concrete_offset): Likewise.
(sized_region::accept): New.
(sized_region::dump_to_pp): New.
(sized_region::get_byte_size): New.
(sized_region::get_bit_size): New.
* region.h (enum region_kind): Add RK_SIZED.
(region::dyn_cast_sized_region): New.
(region::get_byte_size): Make virtual.
(region::get_bit_size): Likewise.
(region::get_byte_size_sval): New decl.
(region::get_relative_concrete_offset): New decl.
(field_region::get_relative_concrete_offset): New decl.
(element_region::get_relative_concrete_offset): Likewise.
(offset_region::get_relative_concrete_offset): Likewise.
(class sized_region): New.
* store.cc (binding_kind_to_string): Delete.
(binding_key::make): Drop enum binding_kind.
(binding_key::dump_to_pp): Delete.
(binding_key::cmp_ptrs): Drop enum binding_kind.
(bit_range::contains_p): New.
(byte_range::dump): New.
(byte_range::contains_p): New.
(byte_range::cmp): New.
(concrete_binding::dump_to_pp): Drop enum binding_kind.
(concrete_binding::cmp_ptr_ptr): Likewise.
(symbolic_binding::dump_to_pp): Likewise.
(symbolic_binding::cmp_ptr_ptr): Likewise.
(binding_map::apply_ctor_val_to_range): Likewise.
(binding_map::apply_ctor_pair_to_child_region): Likewise.
(binding_map::get_overlapping_bindings): New.
(binding_map::remove_overlapping_bindings): New.
(binding_cluster::validate): New.
(binding_cluster::bind): Drop enum binding_kind.
(binding_cluster::bind_compound_sval): Likewise.
(binding_cluster::purge_region): Likewise.
(binding_cluster::zero_fill_region): Reimplement in terms of...
(binding_cluster::fill_region): New.
(binding_cluster::mark_region_as_unknown): Drop enum binding_kind.
(binding_cluster::get_binding): Likewise.
(binding_cluster::get_binding_recursive): Likewise.
(binding_cluster::get_any_binding): Likewise.
(binding_cluster::maybe_get_compound_binding): Reimplement.
(binding_cluster::get_overlapping_bindings): Delete.
(binding_cluster::remove_overlapping_bindings): Reimplement in
terms of binding_map::remove_overlapping_bindings.
(binding_cluster::can_merge_p): Update for removal of
enum binding_kind.
(binding_cluster::on_unknown_fncall): Drop enum binding_kind.
(binding_cluster::maybe_get_simple_value): Likewise.
(store_manager::get_concrete_binding): Likewise.
(store_manager::get_symbolic_binding): Likewise.
(store::validate): New.
(store::set_value): Drop enum binding_kind.
(store::zero_fill_region): Reimplement in terms of...
(store::fill_region): New.
(selftest::test_binding_key_overlap): Drop enum binding_kind.
* store.h (enum binding_kind): Delete.
(binding_kind_to_string): Delete decl.
(binding_key::make): Drop enum binding_kind.
(binding_key::dump_to_pp): Make pure virtual.
(binding_key::get_kind): Delete.
(binding_key::mark_deleted): Delete.
(binding_key::mark_empty): Delete.
(binding_key::is_deleted): Delete.
(binding_key::is_empty): Delete.
(binding_key::binding_key): Delete.
(binding_key::impl_hash): Delete.
(binding_key::impl_eq): Delete.
(binding_key::m_kind): Delete.
(bit_range::get_last_bit_offset): New.
(bit_range::contains_p): New.
(byte_range::contains_p): New.
(byte_range::operator==): New.
(byte_range::get_start_byte_offset): New.
(byte_range::get_next_byte_offset): New.
(byte_range::get_last_byte_offset): New.
(byte_range::as_bit_range): New.
(byte_range::cmp): New.
(concrete_binding::concrete_binding): Drop enum binding_kind.
(concrete_binding::hash): Likewise.
(concrete_binding::operator==): Likewise.
(concrete_binding::mark_deleted): New.
(concrete_binding::mark_empty): New.
(concrete_binding::is_deleted): New.
(concrete_binding::is_empty): New.
(default_hash_traits<ana::concrete_binding>::empty_zero_p): Make false.
(symbolic_binding::symbolic_binding): Drop enum binding_kind.
(symbolic_binding::hash): Likewise.
(symbolic_binding::operator==): Likewise.
(symbolic_binding::mark_deleted): New.
(symbolic_binding::mark_empty): New.
(symbolic_binding::is_deleted): New.
(symbolic_binding::is_empty): New.
(binding_map::remove_overlapping_bindings): New decl.
(binding_map::get_overlapping_bindings): New decl.
(binding_cluster::validate): New decl.
(binding_cluster::bind): Drop enum binding_kind.
(binding_cluster::fill_region): New decl.
(binding_cluster::get_binding): Drop enum binding_kind.
(binding_cluster::get_binding_recursive): Likewise.
(binding_cluster::get_overlapping_bindings): Delete.
(store::validate): New decl.
(store::set_value): Drop enum binding_kind.
(store::fill_region): New decl.
(store_manager::get_concrete_binding): Drop enum binding_kind.
(store_manager::get_symbolic_binding): Likewise.
* svalue.cc (svalue::cmp_ptr): Handle SK_REPEATED and
SK_BITS_WITHIN.
(svalue::extract_bit_range): New.
(svalue::maybe_fold_bits_within): New.
(constant_svalue::maybe_fold_bits_within): New.
(unknown_svalue::maybe_fold_bits_within): New.
(unaryop_svalue::maybe_fold_bits_within): New.
(repeated_svalue::repeated_svalue): New.
(repeated_svalue::dump_to_pp): New.
(repeated_svalue::accept): New.
(repeated_svalue::all_zeroes_p): New.
(repeated_svalue::maybe_fold_bits_within): New.
(bits_within_svalue::bits_within_svalue): New.
(bits_within_svalue::dump_to_pp): New.
(bits_within_svalue::maybe_fold_bits_within): New.
(bits_within_svalue::accept): New.
(bits_within_svalue::implicitly_live_p): New.
(compound_svalue::maybe_fold_bits_within): New.
* svalue.h (enum svalue_kind): Add SK_REPEATED and SK_BITS_WITHIN.
(svalue::dyn_cast_repeated_svalue): New.
(svalue::dyn_cast_bits_within_svalue): New.
(svalue::extract_bit_range): New decl.
(svalue::maybe_fold_bits_within): New vfunc decl.
(region_svalue::key_t::mark_empty): Use 2 rather than NULL_TREE.
(region_svalue::key_t::is_empty): Likewise.
(default_hash_traits<region_svalue::key_t>::empty_zero_p): Make false.
(constant_svalue::maybe_fold_bits_within): New.
(unknown_svalue::maybe_fold_bits_within): New.
(poisoned_svalue::key_t::mark_empty): Use 2 rather than NULL_TREE.
(poisoned_svalue::key_t::is_empty): Likewise.
(default_hash_traits<poisoned_svalue::key_t>::empty_zero_p): Make
false.
(setjmp_svalue::key_t::mark_empty): Use 2 rather than NULL_TREE.
(setjmp_svalue::key_t::is_empty): Likewise.
(default_hash_traits<setjmp_svalue::key_t>::empty_zero_p): Make
false.
(unaryop_svalue::key_t::mark_empty): Use 2 rather than NULL_TREE.
(unaryop_svalue::key_t::is_empty): Likewise.
(unaryop_svalue::maybe_fold_bits_within): New.
(default_hash_traits<unaryop_svalue::key_t>::empty_zero_p): Make
false.
(binop_svalue::key_t::mark_empty): Use 2 rather than NULL_TREE.
(binop_svalue::key_t::is_empty): Likewise.
(default_hash_traits<binop_svalue::key_t>::empty_zero_p): Make
false.
(sub_svalue::key_t::mark_empty): Use 2 rather than NULL_TREE.
(sub_svalue::key_t::is_empty): Likewise.
(default_hash_traits<sub_svalue::key_t>::empty_zero_p): Make
false.
(class repeated_svalue): New.
(is_a_helper <const repeated_svalue *>::test): New.
(struct default_hash_traits<repeated_svalue::key_t>): New.
(class bits_within_svalue): New.
(is_a_helper <const bits_within_svalue *>::test): New.
(struct default_hash_traits<bits_within_svalue::key_t>): New.
(widening_svalue::key_t::mark_empty): Use 2 rather than NULL_TREE.
(widening_svalue::key_t::is_empty): Likewise.
(default_hash_traits<widening_svalue::key_t>::empty_zero_p): Make
false.
(compound_svalue::key_t::mark_empty): Use 2 rather than NULL_TREE.
(compound_svalue::key_t::is_empty): Likewise.
(compound_svalue::maybe_fold_bits_within): New.
(default_hash_traits<compound_svalue::key_t>::empty_zero_p): Make
false.

gcc/testsuite/ChangeLog:
PR analyzer/95006
* gcc.dg/analyzer/clobbers-1.c: New test.
* gcc.dg/analyzer/clobbers-2.c: New test.
* gcc.dg/analyzer/data-model-1.c (test_26): Mark xfail as fixed.
(test_28): Likewise.
(test_52): Likewise.  Add coverage for end of buffer.
* gcc.dg/analyzer/explode-1.c: Add leak warning.
* gcc.dg/analyzer/memset-1.c (test_3): Mark xfail as fixed.
(test_4): Use char.  Mark xfail as fixed.
(test_6b): New.
(test_7): Mark xfail as fixed.  Add coverage for start of buffer.
(test_8): New.
(test_9): New.
* gcc.dg/analyzer/memset-CVE-2017-18549-1.c: New test.
* gcc.dg/analyzer/symbolic-8.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
3 years agogcc.c: Add -foffload= to display_help
Tobias Burnus [Wed, 30 Jun 2021 12:49:48 +0000 (14:49 +0200)]
gcc.c: Add -foffload= to display_help

gcc/ChangeLog:

* common.opt (foffload): Remove help as Driver only.
* gcc.c (display_help): Add -foffload.

3 years ago[testsuite]: Add missing dg-add-options float16 to gcc.dg/debug/ctf/ctf-skip-types-2.c
Christophe Lyon [Wed, 30 Jun 2021 11:44:00 +0000 (11:44 +0000)]
[testsuite]: Add missing dg-add-options float16 to gcc.dg/debug/ctf/ctf-skip-types-2.c

The test already checks dg-require-effective-target float16, but this
is not sufficient to use the flags needed, if any.
This patch makes the test pass on arm.

2021-06-30  Christophe Lyon  <christophe.lyon@foss.st.com>

gcc/testsuite/
* gcc.dg/debug/ctf/ctf-skip-types-2.c: Add dg-add-options float16.

3 years agogcc.c's check_offload_target_name: Fixes to inform hints
Tobias Burnus [Wed, 30 Jun 2021 11:17:54 +0000 (13:17 +0200)]
gcc.c's check_offload_target_name: Fixes to inform hints

gcc/ChangeLog:

* gcc.c (close_at_file, execute): Replace alloca by XALLOCAVEC.
(check_offload_target_name): Fix splitting OFFLOAD_TARGETS into
a candidate list; better inform no offload target is configured
and fix hint extraction when passed target is not '\0' at [len].
* common.opt (foffload): Add tailing '.'.
(foffload-options): Likewise; fix flag name in the help string.

3 years agoarm/66791: Gate comparison in vca intrinsics on __FAST_MATH__.
prathamesh.kulkarni [Wed, 30 Jun 2021 09:42:06 +0000 (15:12 +0530)]
arm/66791: Gate comparison in vca intrinsics on __FAST_MATH__.

gcc/ChangeLog:

PR target/66791
* config/arm/arm_neon.h: Move vabs intrinsics before vcage_f32.
(vcage_f32): Gate comparison on __FAST_MATH__.
(vcageq_f32): Likewise.
(vcale_f32): Likewise.
(vcaleq_f32): Likewise.
(vcagt_f32): Likewise.
(vcagtq_f32): Likewise.
(vcalt_f32): Likewise.
(vcaltq_f32): Likewise.
(vcage_f16): Likewise.
(vcageq_f16): Likewise.
(vcale_f16): Likewise.
(vcaleq_f16): Likewise.
(vcagt_f16): Likewise.
(vcagtq_f16): Likewise.
(vcalt_f16): Likewise.
(vcaltq_f16): Likewise.

3 years agotree-optimization/101264 - rework SLP "any" permute forward prop
Richard Biener [Wed, 30 Jun 2021 07:48:37 +0000 (09:48 +0200)]
tree-optimization/101264 - rework SLP "any" permute forward prop

This integrates the forward propagation of SLP "any" permutes into
the main propagation stage as a separate single-pass propagation
didn't work out.

2021-06-30  Richard Biener  <rguenther@suse.de>

PR tree-optimization/101264
* tree-vect-slp.c (vect_optimize_slp): Propagate the
computed perm_in to all "any" permute successors
we cannot de-duplicate immediately.

* gfortran.dg/pr101264.f90: New testcase.

3 years agoMAINTAINERS: Add myself for write after approval
Xi Ruoyao [Wed, 30 Jun 2021 02:47:17 +0000 (10:47 +0800)]
MAINTAINERS: Add myself for write after approval

ChangeLog:

* MAINTAINERS (Write After Approval): Add myself.

3 years agofixinc: don't "fix" machine names in __has_include(...) [PR91085]
Xi Ruoyao [Mon, 28 Jun 2021 05:54:58 +0000 (13:54 +0800)]
fixinc: don't "fix" machine names in __has_include(...) [PR91085]

fixincludes/

PR other/91085
* fixfixes.c (check_has_inc): New static function.
  (machine_name_fix): Don't replace header names in
  __has_include(...).
* inclhack.def (machine_name): Adjust test.
* tests/base/testing.h: Update.

3 years agoThe upper bits of FIXUPIMMS{S,D} should come from src1 not dest.
liuhongt [Mon, 28 Jun 2021 11:27:23 +0000 (19:27 +0800)]
The upper bits of FIXUPIMMS{S,D} should come from src1 not dest.

gcc/ChangeLog:

PR target/101248
* config/i386/sse.md
(avx512f_sfixupimm<mode><sd_maskz_name><round_saeonly_name>):
Refined to ..
(avx512f_sfixupimm<mode><maskz_scalar_name><round_saeonly_name>):
this.
(avx512f_sfixupimm<mode>_mask<round_saeonly_name>"): Refined.
* config/i386/subst.md (maskz_scalar): New define_subst.
(maskz_scalar_name): New subst_attr.
(maskz_scalar_op5): Ditto.
(round_saeonly_maskz_scalar_op5): Ditto.
(round_saeonly_maskz_scalar_operand5): Ditto.

gcc/testsuite/ChangeLog

PR target/101248
* gcc.target/i386/pr101248.c: New test.

3 years agoaix: align text CSECTs to at least 32 bytes.
David Edelsohn [Wed, 12 May 2021 01:07:19 +0000 (21:07 -0400)]
aix: align text CSECTs to at least 32 bytes.

gcc/ChangeLog:

* config/rs6000/rs6000.c (rs6000_xcoff_section_type_flags):
Increase code CSECT alignment to at least 32 bytes.
* config/rs6000/xcoff.h (TEXT_SECTION_ASM_OP): Add 32 byte
alignment designation.

3 years agoDaily bump.
GCC Administrator [Wed, 30 Jun 2021 00:16:52 +0000 (00:16 +0000)]
Daily bump.

3 years agodocs: Fix s/net yet/not yet/ typo
Sergei Trofimovich [Tue, 29 Jun 2021 21:11:39 +0000 (22:11 +0100)]
docs: Fix s/net yet/not yet/ typo

gcc/ChangeLog:

* doc/generic.texi: Fix s/net yet/not yet/ typo.

3 years agoc++: don't treat member var as var template
Jason Merrill [Tue, 29 Jun 2021 19:11:25 +0000 (15:11 -0400)]
c++: don't treat member var as var template

While looking at a partial instantiation issue I noticed that we were
wrongly hitting the partial instantiation code when instantiating a static
data member of a class template.  I don't think this broke anything, but we
don't need to do that (small) extra work.

gcc/cp/ChangeLog:

* pt.c (instantiate_decl): Only consider partial specializations of
actual variable templates.

3 years agocompiler: don't generate temporaries for composite literals
Ian Lance Taylor [Tue, 29 Jun 2021 19:53:02 +0000 (12:53 -0700)]
compiler: don't generate temporaries for composite literals

We were generating temporaries for composite literals when a
conversion to interface type was required.  However, Cherry's
https://golang.org/cl/176459 changed the compiler to insert explicit
type conversions.  And those explicit type conversions insert the
required temporaries in Type_conversion_expression::do_flatten.
So in practice the composite literal do_flatten methods would never
insert temporaries, as the values they see would always be multi_eval_safe.
So just remove the unnecessary do_flatten methods.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/331691

3 years agogo-gcc: set DECL_NAMELESS for temporary variables
Ian Lance Taylor [Tue, 29 Jun 2021 19:12:16 +0000 (12:12 -0700)]
go-gcc: set DECL_NAMELESS for temporary variables

* go-gcc.cc (Gcc_backend::static_chain_variable): Set
DECL_NAMELESS on the new decl.
(Gcc_backend::temporary_variable): Likewise.
(Gcc_backend::function): Set DECL_NAMELESS on the result decl.

3 years agoFix MINUS_EXPR relations.
Andrew MacLeod [Tue, 29 Jun 2021 14:52:58 +0000 (10:52 -0400)]
Fix MINUS_EXPR relations.

Flesh out and correct relations for both wrapping and non-wrapping values.

gcc/
PR tree-optimization/101254
* range-op.cc (operator_minus::op1_op2_relation_effect): Check for
wrapping/non-wrapping when setting the result range.

gcc/testsuite
* gcc.dg/pr101254.c: New.

3 years agoAllow PHIs to pick up global values.
Andrew MacLeod [Fri, 25 Jun 2021 19:31:39 +0000 (15:31 -0400)]
Allow PHIs to pick up global values.

We can also apply known global values to PHI nodes in EVRP.

* value-query.cc (gimple_range_global): Allow phis.

3 years agoAdd stmt context in simplify_using_ranges.
Andrew MacLeod [Fri, 25 Jun 2021 15:24:30 +0000 (11:24 -0400)]
Add stmt context in simplify_using_ranges.

There were places simplify_using_ranges was not utilzing the stmt context.

* vr-values.c (vr_values::vrp_stmt_computes_nonzero): Use stmt.
(simplify_using_ranges::op_with_boolean_value_range_p): Add a
statement for location context.
(check_for_binary_op_overflow): Ditto.
(simplify_using_ranges::get_vr_for_comparison): Ditto.
(simplify_using_ranges::compare_name_with_value): Ditto.
(simplify_using_ranges::compare_names): Ditto.
(vrp_evaluate_conditional_warnv_with_ops_using_ranges): Ditto.
(simplify_using_ranges::simplify_truth_ops_using_ranges): Ditto.
(simplify_using_ranges::simplify_min_or_max_using_ranges): Ditto.
(simplify_using_ranges::simplify_internal_call_using_ranges): Ditto.
(simplify_using_ranges::two_valued_val_range_p): Ditto.
(simplify_using_ranges::simplify): Ditto.
* vr-values.h: Adjust prototypes.

3 years agocompiler: in composite literals use temps only for interfaces
Ian Lance Taylor [Mon, 28 Jun 2021 23:47:55 +0000 (16:47 -0700)]
compiler: in composite literals use temps only for interfaces

For a composite literal we only need to introduce a temporary variable
if we may be converting to an interface type, so only do it then.
This saves over 80% of compilation time when using gccgo to compile
cmd/internal/obj/x86, as the GCC middle-end spends a lot of time
pointlessly computing interactions between temporary variables.

For PR debug/101064
For golang/go#46600

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/331513

3 years agoi386: Add V2SFmode vec_addsub pattern [PR95046]
Uros Bizjak [Tue, 29 Jun 2021 17:14:35 +0000 (19:14 +0200)]
i386: Add V2SFmode vec_addsub pattern [PR95046]

gcc/

2021-06-21  Uroš Bizjak  <ubizjak@gmail.com>

PR target/95046
* config/i386/mmx.md (vec_addsubv2sf3): New insn pattern.

gcc/testsuite/

2021-06-21  Uroš Bizjak  <ubizjak@gmail.com>

PR target/95046
* gcc.target/i386/pr95046-9.c: New test.

3 years agoFortran: Re-enable 128-bit integers for AMD GCN
Julian Brown [Fri, 11 Jun 2021 21:44:36 +0000 (14:44 -0700)]
Fortran: Re-enable 128-bit integers for AMD GCN

This patch reverts the part of Tobias's patch for PR target/96306 that
disables 128-bit integer support for AMD GCN.

2021-06-18  Julian Brown  <julian@codesourcery.com>

libgfortran/
PR target/96306
* configure.ac: Remove stanza that removes KIND=16 integers for AMD GCN.
* configure: Regenerate.

3 years agoamdgcn: Enable support for TImode for AMD GCN
Julian Brown [Wed, 9 Jun 2021 13:18:23 +0000 (06:18 -0700)]
amdgcn: Enable support for TImode for AMD GCN

This patch enables support for TImode for AMD GCN, the lack of which
is currently causing a number of test failures for the target and which
is also needed to support "omp_depend_kind" for OpenMP 5.0, since that
is implemented as a 128-bit integer.

Several libgcc support routines are built by default for the "word size"
of a machine, and also for "2 * word size" of the machine.  The libgcc
build for AMD GCN is changed so that it builds for a "word size" of 64
bits, in order to better match the (64-bit) host compiler.  However it
isn't really true that we have 64-bit words -- GCN has 32-bit registers,
so changing UNITS_PER_WORD unconditionally would be the wrong thing to do.

Changing this setting for libgcc (only) means that support routines
are built for "single word" operations that are DImode (64 bits), and
those for "double word" operations are built for TImode (128 bits).
That leaves some gaps regarding previous operations that were built
for a "single word" size of 32 bits and a "double word" size of 64 bits
(generic code doesn't cover both alternatives for all operations that
might be needed).  Those gaps are filled in by this patch, or by the
preceding patches in the series.

2021-06-18  Julian Brown  <julian@codesourcery.com>

gcc/
* config/gcn/gcn.c (gcn_init_libfuncs): New function.
(TARGET_INIT_LIBFUNCS): Define target hook using above function.
* config/gcn/gcn.h (UNITS_PER_WORD): Define to 8 for IN_LIBGCC2, 4
otherwise.
(LIBGCC2_UNITS_PER_WORD, BITS_PER_WORD): Remove definitions.
(MAX_FIXED_MODE_SIZE): Change to 128.

libgcc/
* config/gcn/lib2-bswapti2.c: New file.
* config/gcn/lib2-divmod-di.c: New file.
* config/gcn/lib2-gcn.h (DItype, UDItype, TItype, UTItype): Add
typedefs.
(__divdi3, __moddi3, __udivdi3, __umoddi3): Add prototypes.
* config/gcn/t-amdgcn (LIB2ADD): Add lib2-divmod-di.c and
lib2-bswapti2.c.

3 years agoamdgcn: Add clrsbsi2/clrsbdi2 implementation
Julian Brown [Thu, 17 Jun 2021 17:52:51 +0000 (10:52 -0700)]
amdgcn: Add clrsbsi2/clrsbdi2 implementation

This patch adds an open-coded implementation of the clrsb<mode>2
(count leading redundant sign bit) standard names using the GCN flbit_i*
instructions for SImode and DImode.  Those don't count exactly as we need,
so we need a couple of other instructions to fix up the result afterwards.

These patterns are lost from libgcc if we build it for DImode/TImode
rather than SImode/DImode, a change we make in a later patch in this
series.

2021-06-18  Julian Brown  <julian@codesourcery.com>

gcc/
* config/gcn/gcn.md (UNSPEC_FLBIT_INT): New unspec constant.
(s_mnemonic): Add clrsb.
(gcn_flbit<mode>_int): Add insn pattern for SImode/DImode.
(clrsb<mode>2): Add expander for SImode/DImode.

3 years agoamdgcn: Add [us]mulsid3/muldi3 patterns
Julian Brown [Tue, 29 Jun 2021 10:57:31 +0000 (03:57 -0700)]
amdgcn: Add [us]mulsid3/muldi3 patterns

This patch improves 64-bit multiplication for AMD GCN: patterns for
unsigned and signed 32x32->64 bit multiplication have been added, and
also 64x64->64 bit multiplication is now open-coded rather than calling
a library function (which may be a win for code size as well as speed:
the function calling sequence isn't particularly concise for GCN).

This version of the patch uses define_insn_and_split in order to keep
multiply operations together during RTL optimisations up to register
allocation: this appears to produce more compact code via inspection on
small test cases than the previous approach using an expander.

The DImode multiply implementation is lost from libgcc if we build it
for DImode/TImode rather than SImode/DImode, a change we make in a later
patch in this series.

2021-06-29  Julian Brown  <julian@codesourcery.com>

gcc/
* config/gcn/gcn.md (<su>mulsidi3, <su>mulsidi3_reg, <su>mulsidi3_imm,
muldi3): Add patterns.