David Edelsohn [Sun, 17 Jan 2021 23:18:56 +0000 (18:18 -0500)]
testsuite: Skip DWARF 5 testcases on AIX.
AIX does not support DWARF 5.
This patch skips the DWARF 5-specific testcases.
gcc/testsuite/ChangeLog:
* g++.dg/debug/dwarf2/inline-ns-2.C: Skip on AIX.
* g++.dg/debug/dwarf2/inline-var-2.C: Skip on AIX.
* g++.dg/debug/dwarf2/inline-var-3.C: Skip on AIX.
* g++.dg/debug/dwarf2/lang-cpp11.C: Skip on AIX.
* g++.dg/debug/dwarf2/lang-cpp14.C: Skip on AIX.
* g++.dg/debug/dwarf2/lang-cpp17.C: Skip on AIX.
* g++.dg/debug/dwarf2/lang-cpp20.C: Skip on AIX.
* gcc.dg/debug/dwarf2/inline6.c: Skip on AIX.
* gcc.dg/debug/dwarf2/lang-c11.c: Skip on AIX.
* gcc.dg/debug/dwarf2/pr41445-7.c: Skip on AIX.
* gcc.dg/debug/dwarf2/pr41445-8.c: Skip on AIX.
David Edelsohn [Sun, 17 Jan 2021 20:39:46 +0000 (15:39 -0500)]
aix: default to DWARF 4.
GCC now defaults to DWARF 5. AIX only supports DWARF 4 (3.5).
This patch overrides the default DWARF version to 4 unless explicitly
stated.
gcc/ChangeLog:
* config/rs6000/aix71.h (SUBTARGET_OVERRIDE_OPTIONS): Override
dwarf_version to 4.
* config/rs6000/aix72.h (SUBTARGET_OVERRIDE_OPTIONS): Same.
Martin Sebor [Sun, 17 Jan 2021 22:27:08 +0000 (15:27 -0700)]
Avoid assuming SSA_NAME_IDENTIFIER is nonnull.
gcc/c-family/ChangeLog:
* c-pretty-print.c (c_pretty_printer::primary_expression): Don't
assume SSA_NAME_IDENTIFIER evaluates to nonzero.
Martin Jambor [Sun, 17 Jan 2021 21:31:09 +0000 (22:31 +0100)]
ipa: Adjust cgraph verifier to materialization on demand (PR 98222)
after switching to materialization of clones on demand, the verifier
can happen to see edges leading to a clone of a materialized clone.
This means its clone_of is NULL and former_clone_of needs to be
checked in order to verify that the callee is a clone of the original
decl, which it did not do and reported edges to pointing to a wrong
place.
Fixed with the following patch, which has been pre-approved by Honza.
Bootstrapped and tested on x86_64-linux, pushed to master.
Martin
gcc/ChangeLog:
2021-01-15 Martin Jambor <mjambor@suse.cz>
PR ipa/98222
* cgraph.c (clone_of_p): Check also former_clone_of as we climb
the clone tree.
gcc/testsuite/ChangeLog:
2021-01-15 Martin Jambor <mjambor@suse.cz>
PR ipa/98222
* gcc.dg/ipa/pr98222.c: New test.
Mark Wielaard [Tue, 29 Sep 2020 13:52:44 +0000 (15:52 +0200)]
Default to DWARF5
gcc/ChangeLog:
* common.opt (gdwarf-): Init(5).
* doc/invoke.texi (-gdwarf): Document default to 5.
GCC Administrator [Sun, 17 Jan 2021 00:16:23 +0000 (00:16 +0000)]
Daily bump.
Jakub Jelinek [Sat, 16 Jan 2021 21:52:43 +0000 (22:52 +0100)]
testsuite: Fix up a testcase to find the right ISO_Fortran_binding.h.
2021-01-16 Jakub Jelinek <jakub@redhat.com>
* gfortran.dg/iso_fortran_binding_uint8_array_driver.c: Include
../../../libgfortran/ISO_Fortran_binding.h rather than
ISO_Fortran_binding.h.
Kwok Cheung Yeung [Sat, 16 Jan 2021 20:58:13 +0000 (12:58 -0800)]
openmp: Add support for the OpenMP 5.0 task detach clause
2021-01-16 Kwok Cheung Yeung <kcy@codesourcery.com>
gcc/
* builtin-types.def
(BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT): Rename
to...
(BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT_PTR):
...this. Add extra argument.
* gimplify.c (omp_default_clause): Ensure that event handle is
firstprivate in a task region.
(gimplify_scan_omp_clauses): Handle OMP_CLAUSE_DETACH.
(gimplify_adjust_omp_clauses): Likewise.
* omp-builtins.def (BUILT_IN_GOMP_TASK): Change function type to
BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT_PTR.
* omp-expand.c (expand_task_call): Add GOMP_TASK_FLAG_DETACH to flags
if detach clause specified. Add detach argument when generating
call to GOMP_task.
* omp-low.c (scan_sharing_clauses): Setup data environment for detach
clause.
(finish_taskreg_scan): Move field for variable containing the event
handle to the front of the struct.
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_DETACH. Fix
ordering.
* tree-nested.c (convert_nonlocal_omp_clauses): Handle
OMP_CLAUSE_DETACH clause.
(convert_local_omp_clauses): Handle OMP_CLAUSE_DETACH clause.
* tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_DETACH.
* tree.c (omp_clause_num_ops): Add entry for OMP_CLAUSE_DETACH.
Fix ordering.
(omp_clause_code_name): Add entry for OMP_CLAUSE_DETACH. Fix
ordering.
(walk_tree_1): Handle OMP_CLAUSE_DETACH.
gcc/c-family/
* c-pragma.h (pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_DETACH.
Redefine PRAGMA_OACC_CLAUSE_DETACH.
gcc/c/
* c-parser.c (c_parser_omp_clause_detach): New.
(c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DETACH clause.
(OMP_TASK_CLAUSE_MASK): Add mask for PRAGMA_OMP_CLAUSE_DETACH.
* c-typeck.c (c_finish_omp_clauses): Handle PRAGMA_OMP_CLAUSE_DETACH
clause. Prevent use of detach with mergeable and overriding the
data sharing mode of the event handle.
gcc/cp/
* parser.c (cp_parser_omp_clause_detach): New.
(cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DETACH.
(OMP_TASK_CLAUSE_MASK): Add mask for PRAGMA_OMP_CLAUSE_DETACH.
* pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_DETACH clause.
* semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DETACH clause.
Prevent use of detach with mergeable and overriding the data sharing
mode of the event handle.
gcc/fortran/
* dump-parse-tree.c (show_omp_clauses): Handle detach clause.
* frontend-passes.c (gfc_code_walker): Walk detach expression.
* gfortran.h (struct gfc_omp_clauses): Add detach field.
(gfc_c_intptr_kind): New.
* openmp.c (gfc_free_omp_clauses): Free detach clause.
(gfc_match_omp_detach): New.
(enum omp_mask1): Add OMP_CLAUSE_DETACH.
(enum omp_mask2): Remove OMP_CLAUSE_DETACH.
(gfc_match_omp_clauses): Handle OMP_CLAUSE_DETACH for OpenMP.
(OMP_TASK_CLAUSES): Add OMP_CLAUSE_DETACH.
(resolve_omp_clauses): Prevent use of detach with mergeable and
overriding the data sharing mode of the event handle.
* trans-openmp.c (gfc_trans_omp_clauses): Handle detach clause.
* trans-types.c (gfc_c_intptr_kind): New.
(gfc_init_kinds): Initialize gfc_c_intptr_kind.
* types.def
(BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT): Rename
to...
(BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT_PTR):
...this. Add extra argument.
gcc/testsuite/
* c-c++-common/gomp/task-detach-1.c: New.
* g++.dg/gomp/task-detach-1.C: New.
* gcc.dg/gomp/task-detach-1.c: New.
* gfortran.dg/gomp/task-detach-1.f90: New.
include/
* gomp-constants.h (GOMP_TASK_FLAG_DETACH): New.
libgomp/
* fortran.c (omp_fulfill_event_): New.
* libgomp.h (struct gomp_task): Add detach and completion_sem fields.
(struct gomp_team): Add task_detach_queue and task_detach_count
fields.
* libgomp.map (OMP_5.0.1): Add omp_fulfill_event and omp_fulfill_event_.
* libgomp_g.h (GOMP_task): Add extra argument.
* omp.h.in (enum omp_event_handle_t): New.
(omp_fulfill_event): New.
* omp_lib.f90.in (omp_event_handle_kind): New.
(omp_fulfill_event): New.
* omp_lib.h.in (omp_event_handle_kind): New.
(omp_fulfill_event): Declare.
* priority_queue.c (priority_tree_find): New.
(priority_list_find): New.
(priority_queue_find): New.
* priority_queue.h (priority_queue_predicate): New.
(priority_queue_find): New.
* task.c (gomp_init_task): Initialize detach field.
(task_fulfilled_p): New.
(GOMP_task): Add detach argument. Ignore detach argument if
GOMP_TASK_FLAG_DETACH not set in flags. Initialize completion_sem
field. Copy address of completion_sem into detach argument and
into the start of the data record. Wait for detach event if task
not deferred.
(gomp_barrier_handle_tasks): Queue tasks with unfulfilled events.
Remove completed tasks and requeue dependent tasks.
(omp_fulfill_event): New.
* team.c (gomp_new_team): Initialize task_detach_queue and
task_detach_count fields.
(free_team): Free task_detach_queue field.
* testsuite/libgomp.c-c++-common/task-detach-1.c: New testcase.
* testsuite/libgomp.c-c++-common/task-detach-2.c: New testcase.
* testsuite/libgomp.c-c++-common/task-detach-3.c: New testcase.
* testsuite/libgomp.c-c++-common/task-detach-4.c: New testcase.
* testsuite/libgomp.c-c++-common/task-detach-5.c: New testcase.
* testsuite/libgomp.c-c++-common/task-detach-6.c: New testcase.
* testsuite/libgomp.fortran/task-detach-1.f90: New testcase.
* testsuite/libgomp.fortran/task-detach-2.f90: New testcase.
* testsuite/libgomp.fortran/task-detach-3.f90: New testcase.
* testsuite/libgomp.fortran/task-detach-4.f90: New testcase.
* testsuite/libgomp.fortran/task-detach-5.f90: New testcase.
* testsuite/libgomp.fortran/task-detach-6.f90: New testcase.
Sebastian Huber [Thu, 14 Jan 2021 19:09:49 +0000 (20:09 +0100)]
RTEMS: Add -mcustom-fpu-cfg=fph2 multilib
This multilib supports Nios II configurations with the "Nios II Floating
Point Hardware 2 Component".
gcc/
* config/nios2/t-rtems: Reset all MULTILIB_* variables. Shorten
multilib directory names. Use MULTILIB_REQUIRED instead of
MULTILIB_EXCEPTIONS. Add -mhw-mul -mhw-mulx -mhw-div
-mcustom-fpu-cfg=fph2 multilib.
Sebastian Huber [Thu, 14 Jan 2021 18:09:36 +0000 (19:09 +0100)]
nios2: Add -mcustom-fpu-cfg=fph2
The new -mcustom-fpu-cfg=fph2 option variant is useful to build a
multilib for the "Nios II Floating Point Hardware 2 Component":
https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/ug/ug_nios2_custom_instruction.pdf
Directly using the corresponding -mcustom-insn=N options for this
floating-point unit leads to a combinatorial explosion in the potential
count of multilibs which may break the build.
gcc/
* config/nios2/nios2.c (NIOS2_FPU_CONFIG_NUM): Adjust value.
(nios2_init_fpu_configs): Provide register values for new
-mcustom-fpu-cfg=fph2 option variant.
* doc/invoke.texi (-mcustom-fpu-cfg=fph2): Document new option
variant.
Sebastian Huber [Sat, 16 Jan 2021 08:00:23 +0000 (09:00 +0100)]
nios2: Remove custom instruction warnings
Do not warn if custom instructions are not used due to missing
optimization flags. This prevents build errors with -Werror which
cannot be disabled via a dedicated warning option.
One reason to remove these warnings is to enable a multilib for the
"Nios II Floating Point Hardware 2 Component". For example, the
libatomic target library in GCC is built with -Werror and the warnings
removed by this patch resulted in errors like:
cc1: error: switch '-mcustom-fmins' has no effect unless '-ffinite-math-only' is specified [-Werror]
cc1: error: switch '-mcustom-fmaxs' has no effect unless '-ffinite-math-only' is specified [-Werror]
cc1: error: switch '-mcustom-round' has no effect unless '-fno-math-errno' is specified [-Werror]
gcc/
* config/nios2/nios2.c (nios2_custom_check_insns): Remove
custom instruction warnings.
Jakub Jelinek [Sat, 16 Jan 2021 08:21:52 +0000 (09:21 +0100)]
match.pd: Optimize ((cst << x) & 1) [PR96669]
While we had a ((1 << x) & 1) != 0 to x == 0 optimization already,
this patch adds ((cst << x) & 1) optimization too, this time the
second constant must be 1 though, not some power of two, but the first
one can be any constant. If it is even, the result is false, if it is
odd, the result is x == 0.
2021-01-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/96669
* match.pd ((CST << x) & 1 -> x == 0): New simplification.
* gcc.dg/tree-ssa/pr96669-1.c: Adjust regexp.
* gcc.dg/tree-ssa/pr96669-2.c: New test.
Jakub Jelinek [Sat, 16 Jan 2021 08:17:38 +0000 (09:17 +0100)]
cd_dce: Return TODO_update_address_taken from last cd_dce [PR96271]
On the following testcase, handle_builtin_memcmp in the strlen pass folds
the memcmp into comparison of two MEM_REFs. But nothing triggers updating
of addressable vars afterwards, so even when the parameters are no longer
address taken, we force the parameters to stack and back anyway.
This patch causes TODO_update_address_taken to happen right before last forwprop
pass (at the end of last cd_dce), so after strlen1 too.
2021-01-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/96271
* passes.def: Pass false argument to first two pass_cd_dce
instances and true to last instance. Add comment that
last instance rewrites no longer addressed locals.
* tree-ssa-dce.c (pass_cd_dce): Add update_address_taken_p member and
initialize it.
(pass_cd_dce::set_pass_param): New method.
(pass_cd_dce::execute): Return TODO_update_address_taken from
last cd_dce instance.
* gcc.target/i386/pr96271.c: New test.
H.J. Lu [Sat, 16 Jan 2021 01:27:53 +0000 (17:27 -0800)]
libstdc++-v3: Add -fcf-protection=none to -march=i486
-fcf-protection is automatically enabled in libstdc++ on Linux/x86.
Starting from
commit
77d372abec0fbf2cfe922e3140ee3410248f979e
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Jan 14 05:56:46 2021 -0800
x86: Error on -fcf-protection with incompatible target
GCC issues an error on -fcf-protection with incompatible target:
... -fcf-protection ... libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc -m32 -O2 -g0 -fno-exceptions -fno-asynchronous-unwind-tables -march=i486 ...
cc1plus: error: '-fcf-protection' is not compatible with this target
FAIL: 29_atomics/atomic_flag/test_and_set/explicit-hle.cc (test for excess errors)
Add -fcf-protection=none to -march=i486 to compile explicit-hle.cc.
* testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc:
Add -fcf-protection=none to -march=i486.
GCC Administrator [Sat, 16 Jan 2021 00:16:29 +0000 (00:16 +0000)]
Daily bump.
Carl Love [Sat, 5 Sep 2020 00:24:22 +0000 (19:24 -0500)]
rs6000, vector integer multiply/divide/modulo instructions
2021-01-15 Carl Love <cel@us.ibm.com>
gcc/ChangeLog:
* config/rs6000/altivec.h (vec_mulh, vec_div, vec_dive, vec_mod):
New defines.
* config/rs6000/altivec.md (VIlong): Move define to file vsx.md.
* config/rs6000/rs6000-builtin.def (DIVES_V4SI, DIVES_V2DI,
DIVEU_V4SI, DIVEU_V2DI, DIVS_V4SI, DIVS_V2DI, DIVU_V4SI,
DIVU_V2DI, MODS_V2DI, MODS_V4SI, MODU_V2DI, MODU_V4SI,
MULHS_V2DI, MULHS_V4SI, MULHU_V2DI, MULHU_V4SI, MULLD_V2DI):
Add builtin define.
(MULH, DIVE, MOD): Add new BU_P10_OVERLOAD_2 definitions.
* config/rs6000/rs6000-call.c (VSX_BUILTIN_VEC_DIV,
VSX_BUILTIN_VEC_DIVE, P10_BUILTIN_VEC_MOD, P10_BUILTIN_VEC_MULH):
New overloaded definitions.
(builtin_function_type) [P10V_BUILTIN_DIVEU_V4SI,
P10V_BUILTIN_DIVEU_V2DI, P10V_BUILTIN_DIVU_V4SI,
P10V_BUILTIN_DIVU_V2DI, P10V_BUILTIN_MODU_V2DI,
P10V_BUILTIN_MODU_V4SI, P10V_BUILTIN_MULHU_V2DI,
P10V_BUILTIN_MULHU_V4SI]: Add case
statement for builtins.
* config/rs6000/rs6000.md (bits): Add new attribute sizes V4SI, V2DI.
* config/rs6000/vsx.md (VIlong): Moved from config/rs6000/altivec.md.
(UNSPEC_VDIVES, UNSPEC_VDIVEU): New unspec definitions.
(vsx_mul_v2di): Add if TARGET_POWER10 statement.
(vsx_udiv_v2di): Add if TARGET_POWER10 statement.
(dives_<mode>, diveu_<mode>, div<mode>3, uvdiv<mode>3,
mods_<mode>, modu_<mode>, mulhs_<mode>, mulhu_<mode>, mulv2di3):
Add define_insn, mode is VIlong.
* doc/extend.texi (vec_mulh, vec_mul, vec_div, vec_dive, vec_mod):
Add builtin descriptions.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/builtins-1-p10-runnable.c: New test file.
Eric Botcazou [Fri, 15 Jan 2021 21:50:48 +0000 (22:50 +0100)]
Reset force_source_line in final.c
Unlike the other global variables, it is not reset at the beginning of a
function so can leak into the next one.
gcc/ChangeLog:
* final.c (final_start_function_1): Reset force_source_line.
Jerry DeLisle [Fri, 15 Jan 2021 21:48:42 +0000 (13:48 -0800)]
fortran: Fixes a bug in ISO_Fortran_binding.c.
libgfortran/ChangeLog:
* runtime/ISO_Fortran_binding.c (CFI_establish): Fixed signed
char arrays. Signed char or uint8_t arrays would cause
crashes unless an element size is specified.
gcc/testsuite/ChangeLog:
* gfortran.dg/iso_fortran_binding_uint8_array.f90: New test.
* gfortran.dg/iso_fortran_binding_uint8_array_driver.c: New test.
Nathan Sidwell [Fri, 15 Jan 2021 19:38:43 +0000 (11:38 -0800)]
c++: Fix qualified array-type construction [PR 98538]
This was an assert that was too picky. The reason I had to alter
array construction was that on stream in, we cannot dynamically determine
a type's dependentness. Thus on stream out of the 'problematic' types,
we save the dependentness for reconstruction. Fortunately the paths into
cp_build_qualified_type_real from streamin with arrays do have the array's
dependentess set as needed.
PR c++/98538
gcc/cp/
* tree.c (cp_build_qualified_type_real): Propagate an array's
dependentness to the copy, if known.
gcc/testsuite/
* g++.dg/template/pr98538.C: New.
Nathan Sidwell [Fri, 15 Jan 2021 19:02:38 +0000 (11:02 -0800)]
preprocessor: Make quoting : [PR 95253]
I missed some testsuite fall out with my patch to fix mkdeps file
mangling.
PR preprocessor/95253
gcc/testsuite/
* g++.dg/modules/dep-1_a.C: Adjust expected output.
* g++.dg/modules/dep-1_b.C: Likewise.
* g++.dg/modules/dep-2.C: Likewise.
Jakub Jelinek [Fri, 15 Jan 2021 20:12:14 +0000 (21:12 +0100)]
match.pd: Generalize the PR64309 simplifications [PR96669]
The following patch generalizes the PR64309 simplifications, so that instead
of working only with constants 1 and 1 it works with any two power of two
constants, and works also for right shift (in that case it rules out the
first one being negative, as it is arithmetic shift then).
2021-01-15 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/96669
* match.pd (((1 << A) & 1) != 0 -> A == 0,
((1 << A) & 1) == 0 -> A != 0): Generalize for 1s replaced by
possibly different power of two constants and to right shift too.
* gcc.dg/tree-ssa/pr96669-1.c: New test.
Jakub Jelinek [Fri, 15 Jan 2021 20:10:44 +0000 (21:10 +0100)]
match.pd: Optimize (x < 0) ^ (y < 0) to (x ^ y) < 0 etc. [PR96681]
This patch simplifies comparisons that test the sign bit xored together.
If the comparisons are both < 0 or both >= 0, then we should xor the operands
together and compare the result to < 0, if the comparisons are different,
we should compare to >= 0.
2021-01-15 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/96681
* match.pd ((x < 0) ^ (y < 0) to (x ^ y) < 0): New simplification.
((x >= 0) ^ (y >= 0) to (x ^ y) < 0): Likewise.
((x < 0) ^ (y >= 0) to (x ^ y) >= 0): Likewise.
((x >= 0) ^ (y < 0) to (x ^ y) >= 0): Likewise.
* gcc.dg/tree-ssa/pr96681.c: New test.
Alexandre Oliva [Fri, 15 Jan 2021 19:22:54 +0000 (16:22 -0300)]
drop -dumpbase-ext from producer string
The -dumpbase and -dumpdir options are excluded from the producer
string output in debug information, but -dumpbase-ext was not. This
patch excludes it as well.
for gcc/ChangeLog
* opts.c (gen_command_line_string): Exclude -dumpbase-ext.
Jason Merrill [Wed, 13 Jan 2021 18:27:06 +0000 (13:27 -0500)]
c++: Avoid redundant copy in {} init [PR98642]
Here, initializing from { } implies a call to the default constructor for
base. We were then seeing that we're initializing a base subobject, so we
tried to copy the result of that call. This is clearly wrong; we should
initialize the base directly from its default constructor.
This patch does a lot of refactoring of unsafe_copy_elision_p and adds
make_safe_copy_elision that will also try to do the base constructor
rewriting from the last patch.
gcc/cp/ChangeLog:
PR c++/98642
* call.c (unsafe_return_slot_p): Return int.
(init_by_return_slot_p): Split out from...
(unsafe_copy_elision_p): ...here.
(unsafe_copy_elision_p_opt): New name for old meaning.
(build_over_call): Adjust.
(make_safe_copy_elision): New.
* typeck2.c (split_nonconstant_init_1): Elide copy from safe
list-initialization.
* cp-tree.h: Adjust.
gcc/testsuite/ChangeLog:
PR c++/98642
* g++.dg/cpp1z/elide5.C: New test.
Jason Merrill [Wed, 13 Jan 2021 18:27:53 +0000 (13:27 -0500)]
c++: Fix copy elision for base initialization
While working on PR98642 I noticed that in this testcase we were eliding the
copy, calling the complete default constructor to initialize the B base
subobject, and therefore wrongly initializing the non-existent A subobject
of B. The test doesn't care whether the copy is elided or not, but checks
that we are actually calling a base constructor for B.
The patch preserves the elision, but changes the initializer to call the
base constructor instead of the complete constructor.
gcc/cp/ChangeLog:
* call.c (base_ctor_for, make_base_init_ok): New.
(build_over_call): Use make_base_init_ok.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/elide4.C: New test.
Tamar Christina [Fri, 15 Jan 2021 18:50:27 +0000 (18:50 +0000)]
AArch64: Add NEON, SVE and SVE2 RTL patterns for Multiply, FMS and FMA.
This adds implementation for the optabs for complex operations. With this the
following C code:
void g (float complex a[restrict N], float complex b[restrict N],
float complex c[restrict N])
{
for (int i=0; i < N; i++)
c[i] = a[i] * b[i];
}
generates
NEON:
g:
movi v3.4s, 0
mov x3, 0
.p2align 3,,7
.L2:
mov v0.16b, v3.16b
ldr q2, [x1, x3]
ldr q1, [x0, x3]
fcmla v0.4s, v1.4s, v2.4s, #0
fcmla v0.4s, v1.4s, v2.4s, #90
str q0, [x2, x3]
add x3, x3, 16
cmp x3, 1600
bne .L2
ret
SVE:
g:
mov x3, 0
mov x4, 400
ptrue p1.b, all
whilelo p0.s, xzr, x4
mov z3.s, #0
.p2align 3,,7
.L2:
ld1w z1.s, p0/z, [x0, x3, lsl 2]
ld1w z2.s, p0/z, [x1, x3, lsl 2]
movprfx z0, z3
fcmla z0.s, p1/m, z1.s, z2.s, #0
fcmla z0.s, p1/m, z1.s, z2.s, #90
st1w z0.s, p0, [x2, x3, lsl 2]
incw x3
whilelo p0.s, x3, x4
b.any .L2
ret
SVE2 (with int instead of float)
g:
mov x3, 0
mov x4, 400
mov z3.b, #0
whilelo p0.s, xzr, x4
.p2align 3,,7
.L2:
ld1w z1.s, p0/z, [x0, x3, lsl 2]
ld1w z2.s, p0/z, [x1, x3, lsl 2]
movprfx z0, z3
cmla z0.s, z1.s, z2.s, #0
cmla z0.s, z1.s, z2.s, #90
st1w z0.s, p0, [x2, x3, lsl 2]
incw x3
whilelo p0.s, x3, x4
b.any .L2
ret
gcc/ChangeLog:
* config/aarch64/aarch64-simd.md (cml<fcmac1><conj_op><mode>4,
cmul<conj_op><mode>3): New.
* config/aarch64/iterators.md (UNSPEC_FCMUL,
UNSPEC_FCMUL180, UNSPEC_FCMLA_CONJ, UNSPEC_FCMLA180_CONJ,
UNSPEC_CMLA_CONJ, UNSPEC_CMLA180_CONJ, UNSPEC_CMUL, UNSPEC_CMUL180,
FCMLA_OP, FCMUL_OP, conj_op, rotsplit1, rotsplit2, fcmac1, sve_rot1,
sve_rot2, SVE2_INT_CMLA_OP, SVE2_INT_CMUL_OP, SVE2_INT_CADD_OP): New.
(rot): Add UNSPEC_FCMUL, UNSPEC_FCMUL180.
(rot_op): Renamed to conj_op.
* config/aarch64/aarch64-sve.md (cml<fcmac1><conj_op><mode>4,
cmul<conj_op><mode>3): New.
* config/aarch64/aarch64-sve2.md (cml<fcmac1><conj_op><mode>4,
cmul<conj_op><mode>3): New.
Jason Merrill [Fri, 15 Jan 2021 16:42:00 +0000 (11:42 -0500)]
c++: Fix list-init of array of no-copy type [PR63707]
build_vec_init_elt models initialization from some arbitrary object of the
type, i.e. copy, but in the case of list-initialization we don't do a copy
from the elements, we initialize them directly.
gcc/cp/ChangeLog:
PR c++/63707
* tree.c (build_vec_init_expr): Don't call build_vec_init_elt
if we got a CONSTRUCTOR.
gcc/testsuite/ChangeLog:
PR c++/63707
* g++.dg/cpp0x/initlist-array13.C: New test.
Alexandre Oliva [Fri, 15 Jan 2021 18:36:22 +0000 (15:36 -0300)]
gcc.dg/analyzer tests: use __builtin_alloca, not alloca.h
Use __builtin_alloca. Some systems don't have alloca.h or alloca.
Co-Authored-By: Olivier Hainque <hainque@adacore.com>
for gcc/testsuite/ChangeLog
* gcc.dg/analyzer/alloca-leak.c: Drop alloca.h, use builtin.
* gcc.dg/analyzer/data-model-1.c: Likewise.
* gcc.dg/analyzer/malloc-1.c: Likewise.
* gcc.dg/analyzer/malloc-paths-8.c: Likewise.
Jakub Jelinek [Fri, 15 Jan 2021 18:26:01 +0000 (19:26 +0100)]
testsuite: Add testcase coverage for already fixed [PR96671]
The fix for this PR didn't come with any test coverage, I've added
tests that make sure we optimize it no matter what order of the x ^ y ^ z
operands is used.
2021-01-15 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/96671
* gcc.dg/tree-ssa/pr96671-1.c: New test.
* gcc.dg/tree-ssa/pr96671-2.c: New test.
David Malcolm [Fri, 15 Jan 2021 18:26:39 +0000 (13:26 -0500)]
bootstrap: fix failing diagnostic selftest on Windows [PR98696]
In one of the selftests in g:
f10960558540636800cf5d3d6355969621fbc17e
I didn't consider that paths can contain backslashes, which happens
for the tempfiles on Windows hosts.
gcc/ChangeLog:
PR bootstrap/98696
* diagnostic.c
(selftest::test_print_parseable_fixits_bytes_vs_display_columns):
Escape the tempfile name when constructing the expected output.
Jakub Jelinek [Fri, 15 Jan 2021 18:20:29 +0000 (19:20 +0100)]
c-family: Improve MEM_REF printing for diagnostics [PR98597]
Ok, here is an updated patch which fixes what I found, and implements what
has been discussed on the mailing list and on IRC, i.e. if the types
are compatible as well as alias sets are same, then it prints
what c_fold_indirect_ref_for_warn managed to create, otherwise it uses
that info for printing offsets using offsetof (except when it starts
with ARRAY_REFs, because one can't have offsetof (struct T[2][2], [1][0].x.y)
The uninit-38.c test (which was the only one I believe which had tests on the
exact spelling of MEM_REF printing) contains mainly changes to have space
before * for pointer types (as that is how the C pretty-printers normally
print types, int * rather than int*), plus what might be considered a
regression from what Martin printed, but it is actually a correctness fix.
When the arg is a pointer with type pointer to VLA with char element type
(let's say the pointer is p), which is what happens in several of the
uninit-38.c tests, omitting the (char *) cast is incorrect, as p + 1
is not the 1 byte after p, but pointer to the end of the VLA.
It only happened to work because of the hacks (which I don't like at all
and are dangerous, DECL_ARTIFICIAL var names with dot inside can be pretty
much anything, e.g. a lot of passes construct their helper vars from some
prefix that designates intended use of the var plus numeric suffix), where
the a.1 pointer to VLA is printed as a which if one is lucky happens to be
a variable with VLA type (rather than pointer to it), and for such vars
a + 1 is indeed &a[0] + 1 rather than &a + 1. But if we want to do this
reliably, we'd need to make sure it comes from VLA (e.g. verify that the
SSA_NAME is defined to __builtin_alloca_with_align and that there exists
a corresponding VAR_DECL with DECL_VALUE_EXPR that has the a.1 variable
in it).
2021-01-15 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/98597
* c-pretty-print.c: Include options.h.
(c_fold_indirect_ref_for_warn): New function.
(print_mem_ref): Use it. If it returns something that has compatible
type and is TBAA compatible with zero offset, print it and return,
otherwise print it using offsetof syntax or array ref syntax. Fix up
printing if MEM_REFs first operand is ADDR_EXPR, or when the first
argument has pointer to array type. Print pointers using the standard
formatting.
* gcc.dg/uninit-38.c: Expect a space in between type name and asterisk.
Expect for now a (char *) cast for VLAs.
* gcc.dg/uninit-40.c: New test.
Jakub Jelinek [Fri, 15 Jan 2021 18:17:53 +0000 (19:17 +0100)]
openmp: Change the way of building of reduction array type
The PR98597 patch regresses on _Atomic-3.c, as in the C FE building an
array type with qualified elements results in a type incompatible with
when an array type with unqualified elements is qualified afterwards.
This patch adds a workaround for that.
2021-01-15 Jakub Jelinek <jakub@redhat.com>
* c-typeck.c (c_finish_omp_clauses): For reduction build array with
unqualified element type and then call c_build_qualified_type on the
ARRAY_TYPE.
Kyrylo Tkachov [Fri, 15 Jan 2021 17:55:57 +0000 (17:55 +0000)]
[PATCH] aarch64: Implement vmlsl[_high]* intrinsics using builtins
This patch reimplements some more intrinsics using RTL builtins in the
straightforward way.
Thankfully most of the RTL infrastructure is already in place for it.
gcc/
* config/aarch64/aarch64-simd.md (*aarch64_<su>mlsl_hi<mode>):
Rename to...
(aarch64_<su>mlsl_hi<mode>): ... This.
(aarch64_<su>mlsl_hi<mode>): Define.
(*aarch64_<su>mlsl<mode): Rename to...
(aarch64_<su>mlsl<mode): ... This.
* config/aarch64/aarch64-simd-builtins.def (smlsl, umlsl,
smlsl_hi, umlsl_hi): Define builtins.
* config/aarch64/arm_neon.h (vmlsl_high_s8, vmlsl_high_s16,
vmlsl_high_s32, vmlsl_high_u8, vmlsl_high_u16, vmlsl_high_u32,
vmlsl_s8, vmlsl_s16, vmlsl_s32, vmlsl_u8,
vmlsl_u16, vmlsl_u32): Reimplement with builtins.
Uros Bizjak [Fri, 15 Jan 2021 17:15:26 +0000 (18:15 +0100)]
i386: Use cpp_define_formatted for __SIZEOF_FLOAT80__ definition
2021-01-15 Uroš Bizjak <ubizjak@gmail.com>
gcc/
* config/i386/i386-c.c (ix86_target_macros):
Use cpp_define_formatted for __SIZEOF_FLOAT80__ definition.
Nathan Sidwell [Fri, 15 Jan 2021 14:47:13 +0000 (06:47 -0800)]
preprocessor: Make quoting : [PR 95253]
Make doesn't need ':' quoting (in a filename).
PR preprocessor/95253
libcpp/
* mkdeps.c (munge): Do not escape ':'.
Nathan Sidwell [Fri, 15 Jan 2021 16:48:54 +0000 (08:48 -0800)]
c++: Fix langspecs with -fsyntax-only [PR98591]
-fsyntax-only is handled specially in the driver and causes it to add
'-o /dev/null' (or a suitable OS-specific variant thereof). PCH is
handled in the language driver. I'd not sufficiently protected the
-fmodule-only action of adding a dummy assembler from the actions of
-fsyntax-only, so we ended up with two -o options.
PR c++/98591
gcc/cp/
* lang-specs.h: Fix handling of -fmodule-only with -fsyntax-only.
Richard Sandiford [Fri, 15 Jan 2021 16:45:42 +0000 (16:45 +0000)]
aarch64: Add a minipass for fusing CC insns [PR88836]
This patch adds a small target-specific pass to remove redundant SVE
PTEST instructions. There are two important uses of this:
- Removing PTESTs after WHILELOs (PR88836). The original testcase
no longer exhibits the problem due to more recent optimisations,
but it can still be seen in simple cases like the one in the patch.
It also shows up in 450.soplex.
- Removing PTESTs after RDFFRs in ACLE code.
This is just an interim “solution” for GCC 11. I hope to replace
it with something generic and target-independent for GCC 12.
However, the use cases above are very important for performance,
so I'd rather not leave the bug unfixed for yet another release cycle.
Since the pass is intended to be short-lived, I've not added
a command-line option for it. The pass can be disabled using
-fdisable-rtl-cc_fusion if necessary.
Although what the pass does is independent of SVE, it's motivated
only by SVE cases and doesn't trigger for any non-SVE test I've seen.
I've therefore gated it on TARGET_SVE and restricted it to PTEST
patterns.
gcc/
PR target/88836
* config.gcc (aarch64*-*-*): Add aarch64-cc-fusion.o to extra_objs.
* Makefile.in (RTL_SSA_H): New variable.
* config/aarch64/t-aarch64 (aarch64-cc-fusion.o): New rule.
* config/aarch64/aarch64-protos.h (make_pass_cc_fusion): Declare.
* config/aarch64/aarch64-passes.def: Add pass_cc_fusion after
pass_combine.
* config/aarch64/aarch64-cc-fusion.cc: New file.
gcc/testsuite/
PR target/88836
* gcc.target/aarch64/sve/acle/general/ldff1_8.c: New test.
* gcc.target/aarch64/sve/ptest_1.c: Likewise.
Richard Sandiford [Fri, 15 Jan 2021 16:45:41 +0000 (16:45 +0000)]
recog: Fix insn_change_watermark destructor
Noticed while working on something else that the insn_change_watermark
destructor could call cancel_changes for changes that no longer exist.
The loop in cancel_changes is a nop in that case, but:
num_changes = num;
can mess things up.
I think this would only affect nested uses of insn_change_watermark.
gcc/
* recog.h (insn_change_watermark::~insn_change_watermark): Avoid
calling cancel_changes for changes that no longer exist.
Richard Sandiford [Fri, 15 Jan 2021 16:45:40 +0000 (16:45 +0000)]
rtl-ssa: Fix a silly typo
s/ref/reg/ on a previously unused function name.
gcc/
* rtl-ssa/functions.h (function_info::ref_defs): Rename to...
(function_info::reg_defs): ...this.
* rtl-ssa/member-fns.inl (function_info::ref_defs): Rename to...
(function_info::reg_defs): ...this.
Marius Hillenbrand [Fri, 15 Jan 2021 13:07:44 +0000 (14:07 +0100)]
IBM Z: Fix linking to libatomic in target test cases
One of the test cases failed to link because of missing paths to
libatomic. Reuse procedures in lib/atomic-dg.exp to gather these paths.
gcc/testsuite/ChangeLog:
2021-01-15 Marius Hillenbrand <mhillen@linux.ibm.com>
* gcc.target/s390/s390.exp: Call lib atomic-dg.exp to link
libatomic into testcases in gcc.target/s390/md.
* gcc.target/s390/md/atomic_exchange-1.c: Remove no unnecessary
-latomic.
Christophe Lyon [Thu, 15 Oct 2020 17:13:59 +0000 (17:13 +0000)]
arm: Implement vceqq_p64, vceqz_p64 and vceqzq_p64 intrinsics
This patch adds implementations for vceqq_p64, vceqz_p64 and
vceqzq_p64 intrinsics.
vceqq_p64 uses the existing vceq_p64 after splitting the input vectors
into their high and low halves.
vceqz[q] simply call the vceq and vceqq with a second argument equal
to zero.
The added (executable) testcases make sure that the poly64x2_t
variants have results with one element of all zeroes (false) and the
other element with all bits set to one (true).
2021-01-15 Christophe Lyon <christophe.lyon@linaro.org>
gcc/
PR target/71233
* config/arm/arm_neon.h (vceqz_p64, vceqq_p64, vceqzq_p64): New.
gcc/testsuite/
PR target/71233
* gcc.target/aarch64/advsimd-intrinsics/p64_p128.c: Add tests for
vceqz_p64, vceqq_p64 and vceqzq_p64.
* gcc.target/arm/simd/vceqz_p64.c: New test.
* gcc.target/arm/simd/vceqzq_p64.c: New test.
Christophe Lyon [Fri, 15 Jan 2021 14:09:32 +0000 (14:09 +0000)]
Revert "arm: Implement vceqq_p64, vceqz_p64 and vceqzq_p64 intrinsics"
This reverts commit
1a6306420090409cb397e2e042256eb1905f415f.
Richard Biener [Fri, 15 Jan 2021 13:20:43 +0000 (14:20 +0100)]
tree-optimization/96376 - do not check alignment for invariant loads
The testcases show that we fail to disregard alignment for invariant
loads. The patch handles them like we handle gather and scatter.
2021-01-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/96376
* tree-vect-stmts.c (get_load_store_type): Disregard alignment
for VMAT_INVARIANT.
Martin Liska [Thu, 14 Jan 2021 08:09:32 +0000 (09:09 +0100)]
Pytest in tests: improve
gcc/ChangeLog:
* doc/install.texi: Document that some tests need pytest module.
* doc/sourcebuild.texi: Likewise.
gcc/testsuite/ChangeLog:
* lib/gcov.exp: Use 'env python3' for execution of pytests.
Check that pytest accepts all needed options first.
Improve formatting of PASS/FAIL lines.
Richard Biener [Fri, 15 Jan 2021 13:03:37 +0000 (14:03 +0100)]
testsuite/96147 - align vector access
This aligns p so that the testcase is meaningful for targets
without a hw misaligned access.
2021-01-15 Richard Biener <rguenther@suse.de>
PR testsuite/96147
* gcc.dg/vect/bb-slp-32.c: Align p.
Richard Biener [Fri, 15 Jan 2021 13:02:06 +0000 (14:02 +0100)]
testsuite/96147 - scan for vectorized load
This changes gcc.dg/vect/bb-slp-9.c to scan for a vectorized load
instead of a vectorized BB which then correctly captures the
unaligned load we try to test and not some intermediate built
from scalar vector.
2021-01-15 Richard Biener <rguenther@suse.de>
PR testsuite/96147
* gcc.dg/vect/bb-slp-9.c: Scan for a vector load transform.
Richard Biener [Fri, 15 Jan 2021 12:52:12 +0000 (13:52 +0100)]
testsuite/96147 - key scanning on vect_hw_misalign
gcc.dg/vect/slp-45.c failed to key the vectorization capability
scanning on vect_hw_misalign. Since the stores are strided
they cannot be (all) analyzed to be aligned.
2021-01-15 Richard Biener <rguenther@suse.de>
PR testsuite/96147
* gcc.dg/vect/slp-45.c: Key scanning on
vect_hw_misalign.
Richard Biener [Fri, 15 Jan 2021 12:49:04 +0000 (13:49 +0100)]
testsuite/96147 - remove scanning for ! vect_hw_misalign
This removes scanning that's too difficult to get correct for all
targets, leaving the correctness test for them and keeping the
vectorization capability check to vect_hw_misalign targets.
2021-01-15 Richard Biener <rguenther@suse.de>
PR testsuite/96147
* gcc.dg/vect/slp-43.c: Remove ! vect_hw_misalign scan.
Christophe Lyon [Thu, 15 Oct 2020 17:13:59 +0000 (17:13 +0000)]
arm: Implement vceqq_p64, vceqz_p64 and vceqzq_p64 intrinsics
This patch adds implementations for vceqq_p64, vceqz_p64 and
vceqzq_p64 intrinsics.
vceqq_p64 uses the existing vceq_p64 after splitting the input vectors
into their high and low halves.
vceqz[q] simply call the vceq and vceqq with a second argument equal
to zero.
The added (executable) testcases make sure that the poly64x2_t
variants have results with one element of all zeroes (false) and the
other element with all bits set to one (true).
2021-01-15 Christophe Lyon <christophe.lyon@linaro.org>
gcc/
PR target/71233
* config/arm/arm_neon.h (vceqz_p64, vceqq_p64, vceqzq_p64): New.
gcc/testsuite/
PR target/71233
* gcc.target/aarch64/advsimd-intrinsics/p64_p128.c: Add tests for
vceqz_p64, vceqq_p64 and vceqzq_p64.
Richard Biener [Fri, 15 Jan 2021 12:31:28 +0000 (13:31 +0100)]
testsuite/96098 - remove redundant testcase
The testcase morphed in a way no longer testing what it was originally supposed to do and slightly altering it shows the original issue isn't fixed (anymore).
The limit as set as result of PR91403 (and dups) prevents the issue for larger
arrays but the testcase has
double a[128][128];
which results in a group size of "just" 512 (the limit is 4096). Avoiding
the 'BB vectorization with gaps at the end of a load is not supported'
by altering it to do
void foo(void)
{
b[0] = a[0][0];
b[1] = a[1][0];
b[2] = a[2][0];
b[3] = a[3][127];
}
shows that costing has improved further to not account the dead loads making
the previous test inefficient. In fact the underlying issue isn't fixed
(we do code-generate dead loads).
In fact the vector permute load is even profitable, just the excessive
code-generation issue exists (and is "fixed" by capping it a constant
boundary, just too high for this particular testcase).
The testcase now has "dups", so I'll simply remove it.
2021-01-15 Richard Biener <rguenther@suse.de>
PR testsuite/96098
* gcc.dg/vect/bb-slp-pr68892.c: Remove.
Jakub Jelinek [Fri, 15 Jan 2021 12:12:59 +0000 (13:12 +0100)]
libatomic, libgomp, libitc: Fix bootstrap [PR70454]
The recent changes to error on mixing -march=i386 and -fcf-protection broke
bootstrap. This patch changes lib{atomic,gomp,itm} configury, so that it
only adds -march=i486 to flags if really needed (i.e. when 486 or later isn't
on by default already). Similarly, it will not use ifuncs if -mcx16
(or -march=i686 for 32-bit) is on by default.
2021-01-15 Jakub Jelinek <jakub@redhat.com>
PR target/70454
libatomic/
* configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
be added through preprocessor check on
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. Determine if try_ifunc is needed
based on preprocessor check on __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
or __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8.
libgomp/
* configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
be added through preprocessor check on
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.
libitm/
* configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
be added through preprocessor check on
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.
Christophe Lyon [Thu, 19 Nov 2020 16:25:48 +0000 (16:25 +0000)]
arm: Auto-vectorization for MVE: vshr
This patch enables MVE vshr instructions for auto-vectorization. New
MVE patterns are introduced that take a vector of constants as second
operand, all constants being equal.
The existing mve_vshrq_n_<supf><mode> is kept, as it takes a single
immediate as second operand, and is used by arm_mve.h.
The vashr<mode>3 and vlshr<mode>3 expanders are moved fron neon.md to
vec-common.md, updated to rely on the normal expansion scheme to
generate shifts by immediate.
2020-12-03 Christophe Lyon <christophe.lyon@linaro.org>
gcc/
* config/arm/mve.md (mve_vshrq_n_s<mode>_imm): New entry.
(mve_vshrq_n_u<mode>_imm): Likewise.
* config/arm/neon.md (vashr<mode>3, vlshr<mode>3): Move to ...
* config/arm/vec-common.md: ... here.
gcc/testsuite/
* gcc.target/arm/simd/mve-vshr.c: Add tests for vshr.
Christophe Lyon [Mon, 16 Nov 2020 14:58:19 +0000 (14:58 +0000)]
arm: Auto-vectorization for MVE: vshl
This patch enables MVE vshlq instructions for auto-vectorization.
The existing mve_vshlq_n_<supf><mode> is kept, as it takes a single
immediate as second operand, and is used by arm_mve.h.
We move the vashl<mode>3 insn from neon.md to an expander in
vec-common.md, and the mve_vshlq_<supf><mode> insn from mve.md to
vec-common.md, adding the second alternative fron neon.md.
mve_vshlq_<supf><mode> will be used by a later patch enabling
vectorization for vshr, as a unified version of
ashl3<mode3>_[signed|unsigned] from neon.md. Keeping the use of unspec
VSHLQ enables to generate both 's' and 'u' variants.
It is not clear whether the neon_shift_[reg|imm]<q> attribute is still
suitable, since this insn is also used for MVE.
I kept the mve_vshlq_<supf><mode> naming instead of renaming it to
ashl3_<supf>_<mode> as discussed because the reference in
arm_mve_builtins.def automatically inserts the "mve_" prefix and I
didn't want to make a special case for this.
I haven't yet found why the v16qi and v8hi tests are not vectorized.
With dest[i] = a[i] << b[i] and:
{
int i;
unsigned int i.24_1;
unsigned int _2;
int16_t * _3;
short int _4;
int _5;
int16_t * _6;
short int _7;
int _8;
int _9;
int16_t * _10;
short int _11;
unsigned int ivtmp_42;
unsigned int ivtmp_43;
<bb 2> [local count:
119292720]:
<bb 3> [local count:
954449105]:
i.24_1 = (unsigned int) i_23;
_2 = i.24_1 * 2;
_3 = a_15(D) + _2;
_4 = *_3;
_5 = (int) _4;
_6 = b_16(D) + _2;
_7 = *_6;
_8 = (int) _7;
_9 = _5 << _8;
_10 = dest_17(D) + _2;
_11 = (short int) _9;
*_10 = _11;
i_19 = i_23 + 1;
ivtmp_42 = ivtmp_43 - 1;
if (ivtmp_42 != 0)
goto <bb 5>; [87.50%]
else
goto <bb 4>; [12.50%]
<bb 5> [local count:
835156386]:
goto <bb 3>; [100.00%]
<bb 4> [local count:
119292720]:
return;
}
the vectorizer says:
mve-vshl.c:37:96: note: ==> examining statement: _5 = (int) _4;
mve-vshl.c:37:96: note: vect_is_simple_use: operand *_3, type of def: internal
mve-vshl.c:37:96: note: vect_is_simple_use: vectype vector(8) short int
mve-vshl.c:37:96: missed: conversion not supported by target.
mve-vshl.c:37:96: note: vect_is_simple_use: operand *_3, type of def: internal
mve-vshl.c:37:96: note: vect_is_simple_use: vectype vector(8) short int
mve-vshl.c:37:96: note: vect_is_simple_use: operand *_3, type of def: internal
mve-vshl.c:37:96: note: vect_is_simple_use: vectype vector(8) short int
mve-vshl.c:37:117: missed: not vectorized: relevant stmt not supported: _5 = (int) _4;
mve-vshl.c:37:96: missed: bad operation or unsupported loop bound.
mve-vshl.c:37:96: note: ***** Analysis failed with vector mode V8HI
2020-12-03 Christophe Lyon <christophe.lyon@linaro.org>
gcc/
* config/arm/mve.md (mve_vshlq_<supf><mode>): Move to
vec-commond.md.
* config/arm/neon.md (vashl<mode>3): Delete.
* config/arm/vec-common.md (mve_vshlq_<supf><mode>): New.
(vasl<mode>3): New expander.
gcc/testsuite/
* gcc.target/arm/simd/mve-vshl.c: Add tests for vshl.
Richard Biener [Fri, 15 Jan 2021 09:08:58 +0000 (10:08 +0100)]
tree-optimization/98685 - fix placement of extern converts
Avoid advancing to the next stmt when inserting at region boundary
and deal with a vector def being not the only child.
2021-01-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/98685
* tree-vect-slp.c (vect_schedule_slp_node): Refactor handling
of vector extern defs.
* gcc.dg/vect/bb-slp-pr98685.c: New testcase.
Tamar Christina [Fri, 15 Jan 2021 09:14:30 +0000 (09:14 +0000)]
testsuite: Fix sed script errors in complex tests
I ran sed script late over the tests which accidentally
introduced a syntax error in the tests.
This fixes it.
Committed under the obvious rule.
gcc/testsuite/ChangeLog:
* gcc.dg/vect/complex/complex-mla-template.c: Fix sed.
* gcc.dg/vect/complex/complex-mls-template.c: Likewise.
Ian Lance Taylor [Tue, 5 Jan 2021 02:37:08 +0000 (18:37 -0800)]
compiler: add support for reading embedcfg files
This is the code that parses an embedcfg file, which is a JSON file
created by the go command when it sees go:embed directives. This code
is not yet called, and does not yet do anything. It's being sent as a
separate CL to isolate just the JSON parsing code.
* Make-lang.in (GO_OBJS): Add go/embed.o.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281532
GCC Administrator [Fri, 15 Jan 2021 00:16:28 +0000 (00:16 +0000)]
Daily bump.
David Malcolm [Thu, 14 Jan 2021 22:54:02 +0000 (17:54 -0500)]
jit: remove "Alpha" warning from docs
I removed the "Alpha" warning from the JIT wiki page on
2020-05-18:
https://gcc.gnu.org/wiki/JIT?action=diff&rev1=47&rev2=48
but forgot to remove it from the documentation, which this
patch does.
gcc/jit/ChangeLog:
* docs/cp/index.rst: Remove "Alpha" warning.
* docs/index.rst: Likewise.
* docs/_build/texinfo/libgccjit.texi: Regenerate
Jason Merrill [Tue, 12 Jan 2021 20:57:05 +0000 (15:57 -0500)]
c++: Minor refactoring in process_init_constructor_record
This function had two different local variables for TREE_TYPE (field), one
of which shadowed a parameter, and wasn't using them consistently.
gcc/cp/ChangeLog:
* typeck2.c (process_init_constructor_record): Use fldtype
variable consistently.
David Malcolm [Thu, 14 Jan 2021 22:02:28 +0000 (17:02 -0500)]
Handle fancy_abort before diagnostic initialization [PR98586]
If fancy_abort is called before the diagnostic subsystem is initialized,
internal_error will crash internally in a way that prevents a useful
message reaching the user.
This can happen with libgccjit in the case of gcc_assert failures
that occur outside of the libgccjit mutex that guards the rest of
gcc's state, including global_dc (when global_dc may not be
initialized yet, or might be in use by another thread).
I tried a few approaches to fixing this as noted in PR jit/98586
e.g. using a temporary diagnostic_context and initializing it for
the call to internal_error, however the more code that runs, the
more chance there is for other errors to occur.
The best fix appears to be to simply fall back to a minimal abort
implementation that only relies on i18n, as implemented by this
patch.
gcc/ChangeLog:
PR jit/98586
* diagnostic.c (diagnostic_kind_text): Break out this array
from...
(diagnostic_build_prefix): ...here.
(fancy_abort): Detect when diagnostic_initialize has not yet been
called and fall back to a minimal implementation of printing the
ICE, rather than segfaulting in internal_error.
François Dumont [Thu, 14 Jan 2021 21:41:23 +0000 (22:41 +0100)]
libstdc++: Implement N3644 for _GLIBCXX_DEBUG iterators
libstdc++-v3/ChangeLog:
* testsuite/23_containers/deque/debug/98466.cc: Make it pre-C++11
compliant.
David Malcolm [Thu, 14 Jan 2021 21:25:02 +0000 (16:25 -0500)]
Add GCC_EXTRA_DIAGNOSTIC_OUTPUT environment variable for fix-it hints
GCC has had the ability to emit fix-it hints in machine-readable form
since GCC 7 via -fdiagnostics-parseable-fixits and
-fdiagnostics-generate-patch.
The former emits additional specially-formatted lines to stderr; the
option and its format were directly taken from a pre-existing option
in clang.
Ideally this could be used by IDEs so that the user can select specific
fix-it hints and have the IDE apply them to the user's source code
(perhaps turning them into clickable elements, perhaps with an
"Apply All" option, etc). Eclipse CDT has supported this option in
this way for a few years:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=497670
As a user of Emacs I would like Emacs to support such a feature.
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25987 tracks supporting
GCC fix-it output in Emacs. The discussion there identifies two issues
with the existing option:
(a) columns in the output are specified as byte-offsets within the
line (for exact compatibility with the option in clang), whereas emacs
would prefer to consume them as what GCC 11 calls "display columns".
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-column-unit
(b) injecting a command-line option into the build is a fiddly manual
step, varying between build systems. It's far easier for the
user if Emacs simply sets an environment variable when compiling,
GCC uses this to enable the option if it recognizes the value, and
the emacs compilation buffer decodes the additional lines of output
and adds appropriate widgets. In some ways it is a workaround for
not having a language server. Doing it this way means that for the
various combinations of older and newer GCC and older and newer Emacs
that a sufficiently modern combination of both can automatically
support the rich fix-it UI, whereas other combinations will either
not provide the envvar, or silently ignore it, gracefully doing
nothing extra.
Hence this patch adds a new GCC_EXTRA_DIAGNOSTIC_OUTPUT environment
variable to GCC which enables output of machine-parseable fix-it hints.
GCC_EXTRA_DIAGNOSTIC_OUTPUT=fixits-v1 is equivalent to the existing
-fdiagnostics-parseable-fixits option.
GCC_EXTRA_DIAGNOSTIC_OUTPUT=fixits-v2 is the same, but changes the
column output mode to "display columns" rather than bytes, as
required by Emacs.
The discussion in that Emacs bug has some concerns about the encoding
of these lines, and, indeed, the encoding of GCC's stderr in general:
currently we emit a mixture of bytes and UTF-8; I believe we emit
filenames as bytes, diagnostic messages as UTF-8, and quote source code
in the original encoding (PR other/93067 covers converting it to UTF-8 on
output). This patch prints octal-escaped bytes for bytes within
filenames and replacement text that aren't printable (as per
-fdiagnostics-parseable-fixits).
gcc/ChangeLog:
* diagnostic.c (diagnostic_initialize): Eliminate
parseable_fixits_p in favor of initializing extra_output_kind from
GCC_EXTRA_DIAGNOSTIC_OUTPUT.
(convert_column_unit): New function, split out from...
(diagnostic_converted_column): ...this.
(print_parseable_fixits): Add "column_unit" and "tabstop" params.
Use them to call convert_column_unit on the column values.
(diagnostic_report_diagnostic): Eliminate conditional on
parseable_fixits_p in favor of a switch statement on
extra_output_kind, passing the appropriate values to the new
params of print_parseable_fixits.
(selftest::test_print_parseable_fixits_none): Update for new
params of print_parseable_fixits.
(selftest::test_print_parseable_fixits_insert): Likewise.
(selftest::test_print_parseable_fixits_remove): Likewise.
(selftest::test_print_parseable_fixits_replace): Likewise.
(selftest::test_print_parseable_fixits_bytes_vs_display_columns):
New.
(selftest::diagnostic_c_tests): Call it.
* diagnostic.h (enum diagnostics_extra_output_kind): New.
(diagnostic_context::parseable_fixits_p): Delete field in favor
of...
(diagnostic_context::extra_output_kind): ...this new field.
* doc/invoke.texi (Environment Variables): Add
GCC_EXTRA_DIAGNOSTIC_OUTPUT.
* opts.c (common_handle_option): Update handling of
OPT_fdiagnostics_parseable_fixits for change to diagnostic_context
fields.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic-test-show-locus-GCC_EXTRA_DIAGNOSTIC_OUTPUT-fixits-v1.c:
New file.
* gcc.dg/plugin/diagnostic-test-show-locus-GCC_EXTRA_DIAGNOSTIC_OUTPUT-fixits-v2.c:
New file.
* gcc.dg/plugin/plugin.exp (plugin_test_list): Add them.
Tamar Christina [Thu, 14 Jan 2021 21:01:15 +0000 (21:01 +0000)]
slp: Add Tests for complex mul, mls and mla"
This adds the initial tests for the complex mul, mls and mla.
These will be enabled in the commits that add the optabs.
Committed as obvious variations of existing tests.
gcc/testsuite/ChangeLog:
* gcc.dg/vect/complex/complex-mla-template.c: New test.
* gcc.dg/vect/complex/complex-mls-template.c: New test.
* gcc.dg/vect/complex/complex-mul-template.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-double.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-float.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-half-float.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-double.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-float.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-half-float.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-double.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-float.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-half-float.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mla-double.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mla-float.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mla-half-float.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mls-double.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mls-float.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mls-half-float.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mul-double.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mul-float.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mul-half-float.c: New test.
Tamar Christina [Thu, 14 Jan 2021 21:00:10 +0000 (21:00 +0000)]
slp: Add complex operations class to share first match among all matchers
This introduces a common class complex_operations_pattern which encapsulates
the complex add, mul, fma and fms pattern in such a way so that the first match
is shared.
gcc/ChangeLog:
* tree-vect-slp-patterns.c (class complex_operations_pattern,
complex_operations_pattern::matches,
complex_operations_pattern::recognize,
complex_operations_pattern::build): New.
(slp_patterns): Use it.
Tamar Christina [Thu, 14 Jan 2021 20:59:12 +0000 (20:59 +0000)]
slp: support complex FMS and complex FMS conjugate
This adds support for FMS and FMS conjugated to the slp pattern matcher.
Example of matches:
#include <stdio.h>
#include <complex.h>
#define N 200
#define ROT
#define TYPE float
#define TYPE2 float
void g (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
for (int i=0; i < N; i++)
{
c[i] -= a[i] * (b[i] ROT);
}
}
void g_f1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
for (int i=0; i < N; i++)
{
c[i] -= conjf (a[i]) * (b[i]);
}
}
void g_s1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
for (int i=0; i < N; i++)
{
c[i] -= a[i] * conjf (b[i] ROT);
}
}
void caxpy_sub(double complex * restrict y, double complex * restrict x, size_t N, double complex f) {
for (size_t i = 0; i < N; ++i)
y[i] -= x[i]* f;
}
gcc/ChangeLog:
* internal-fn.def (COMPLEX_FMS, COMPLEX_FMS_CONJ): New.
* optabs.def (cmls_optab, cmls_conj_optab): New.
* doc/md.texi: Document them.
* tree-vect-slp-patterns.c (class complex_fms_pattern,
complex_fms_pattern::matches, complex_fms_pattern::recognize,
complex_fms_pattern::build): New.
Tamar Christina [Thu, 14 Jan 2021 20:58:12 +0000 (20:58 +0000)]
slp: support complex FMA and complex FMA conjugate
This adds support for FMA and FMA conjugated to the slp pattern matcher.
Example of instructions matched:
#include <stdio.h>
#include <complex.h>
#define N 200
#define ROT
#define TYPE float
#define TYPE2 float
void g (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
for (int i=0; i < N; i++)
{
c[i] += a[i] * (b[i] ROT);
}
}
void g_f1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
for (int i=0; i < N; i++)
{
c[i] += conjf (a[i]) * (b[i] ROT);
}
}
void g_s1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
for (int i=0; i < N; i++)
{
c[i] += a[i] * conjf (b[i] ROT);
}
}
void caxpy_add(double complex * restrict y, double complex * restrict x, size_t N, double complex f) {
for (size_t i = 0; i < N; ++i)
y[i] += x[i]* f;
}
gcc/ChangeLog:
* internal-fn.def (COMPLEX_FMA, COMPLEX_FMA_CONJ): New.
* optabs.def (cmla_optab, cmla_conj_optab): New.
* doc/md.texi: Document them.
* tree-vect-slp-patterns.c (vect_match_call_p,
class complex_fma_pattern, vect_slp_reset_pattern,
complex_fma_pattern::matches, complex_fma_pattern::recognize,
complex_fma_pattern::build): New.
Tamar Christina [Thu, 14 Jan 2021 20:57:17 +0000 (20:57 +0000)]
slp: support complex multiply and complex multiply conjugate
This adds support for complex multiply and complex multiply and accumulate to
the vect pattern detector.
Example of instructions matched:
#include <stdio.h>
#include <complex.h>
#define N 200
#define ROT
#define TYPE float
#define TYPE2 float
void g (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
for (int i=0; i < N; i++)
{
c[i] = a[i] * (b[i] ROT);
}
}
void g_f1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
for (int i=0; i < N; i++)
{
c[i] = conjf (a[i]) * (b[i] ROT);
}
}
void g_s1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
for (int i=0; i < N; i++)
{
c[i] = a[i] * conjf (b[i] ROT);
}
}
gcc/ChangeLog:
* internal-fn.def (COMPLEX_MUL, COMPLEX_MUL_CONJ): New.
* optabs.def (cmul_optab, cmul_conj_optab): New.
* doc/md.texi: Document them.
* tree-vect-slp-patterns.c (vect_match_call_complex_mla,
vect_normalize_conj_loc, is_eq_or_top, vect_validate_multiplication,
vect_build_combine_node, class complex_mul_pattern,
complex_mul_pattern::matches, complex_mul_pattern::recognize,
complex_mul_pattern::build): New.
Tamar Christina [Thu, 14 Jan 2021 20:50:57 +0000 (20:50 +0000)]
slp: Support optimizing load distribution
This introduces a post processing step for the pattern matcher to flatten
permutes introduced by the complex multiplications patterns.
This performs a blend early such that SLP is not cancelled by the LOAD_LANES
permute. This is a temporary workaround to the fact that loads are not CSEd
during building and is required to produce efficient code.
gcc/ChangeLog:
* tree-vect-slp.c (optimize_load_redistribution_1): New.
(optimize_load_redistribution, vect_is_slp_load_node): New.
(vect_match_slp_patterns): Use it.
Tamar Christina [Thu, 14 Jan 2021 20:49:55 +0000 (20:49 +0000)]
slp: elide intermediate nodes for complex add and avoid truncate
This applies the same feedback received for MUL and the rest to
ADD which was already committed. In short it elides the intermediate
nodes vec and avoids the use of truncate on the SLP child.
gcc/ChangeLog:
* tree-vect-slp-patterns.c (complex_add_pattern::build):
Elide nodes.
David Malcolm [Thu, 14 Jan 2021 20:39:14 +0000 (15:39 -0500)]
analyzer: fixes to -fdump-analyzer-json
I've been implementing a PyGTK viewer for the output of
-fdump-analyzer-json, to help me debug analyzer issues:
https://github.com/davidmalcolm/gcc-analyzer-viewer
The viewer is very much just a work in progress.
This patch adds some fields that were missing from the dump, and
fixes some mistakes I spotted whilst working on the viewer.
gcc/analyzer/ChangeLog:
* engine.cc (strongly_connected_components::to_json): New.
(worklist::to_json): New.
(exploded_graph::to_json): JSON-ify the worklist.
* exploded-graph.h (strongly_connected_components::to_json): New
decl.
(worklist::to_json): New decl.
* store.cc (store::to_json): Fix comment.
* supergraph.cc (supernode::to_json): Fix reference to
"returning_call" in comment. Add optional "fun" to JSON.
(edge_kind_to_string): New.
(superedge::to_json): Add "kind" to JSON.
David Malcolm [Thu, 14 Jan 2021 20:25:27 +0000 (15:25 -0500)]
analyzer: const fixes [PR98679]
gcc/analyzer/ChangeLog:
PR analyzer/98679
* analyzer.h (region_offset::operator==): Make const.
* pending-diagnostic.h (pending_diagnostic::equal_p): Likewise.
* store.h (binding_cluster::for_each_value): Likewise.
(binding_cluster::for_each_binding): Likewise.
Marek Polacek [Thu, 14 Jan 2021 19:44:59 +0000 (14:44 -0500)]
c++: Tweak g++.dg/template/pr98372.C.
This test was failing in C++11 because variable templates are only
available in C++14.
gcc/testsuite/ChangeLog:
* g++.dg/template/pr98372.C: Only run in C++14 and up.
Harald Anlauf [Thu, 14 Jan 2021 19:25:33 +0000 (20:25 +0100)]
PR fortran/93340 - fix missed substring simplifications
Substrings were not reduced early enough for use in initializations,
such as DATA statements. Add an early simplification for substrings
with constant starting and ending points.
gcc/fortran/ChangeLog:
* gfortran.h (gfc_resolve_substring): Add prototype.
* primary.c (match_string_constant): Simplify substrings with
constant starting and ending points.
* resolve.c: Rename resolve_substring to gfc_resolve_substring.
(gfc_resolve_ref): Use renamed function gfc_resolve_substring.
gcc/testsuite/ChangeLog:
* substr_10.f90: New test.
* substr_9.f90: New test.
Alexandre Oliva [Thu, 14 Jan 2021 19:12:22 +0000 (16:12 -0300)]
calibrate intervals to avoid zero in futures poll test
We get occasional failures of 30_threads/future/members/poll.cc
on some platforms whose high resolution clock doesn't have such a high
resolution; wait_for_0 ends up as 0, and then some asserts fail as
intervals measured as longer than zero are tested for less than
several times zero.
This patch adds some calibration in the iteration count to set a
measurable base time interval with some additional margin.
for libstdc++-v3/ChangeLog
* testsuite/30_threads/future/members/poll.cc: Calibrate
iteration count.
Alexandre Oliva [Thu, 14 Jan 2021 19:12:20 +0000 (16:12 -0300)]
use sigjmp_buf for analyzer sigsetjmp tests
The sigsetjmp analyzer tests use jmp_buf in sigsetjmp and siglongjmp
calls. Not every system that supports sigsetjmp uses the same data
structure for setjmp and sigsetjmp, which results in type mismatches.
This patch changes the tests to use sigjmp_buf, that is the
POSIX-specific type for use with sigsetjmp and siglongjmp.
for gcc/testsuite/ChnageLog
* gcc.dg/analyzer/sigsetjmp-5.c: Use sigjmp_buf.
* gcc.dg/analyzer/sigsetjmp-6.c: Likewise.
Alexandre Oliva [Thu, 14 Jan 2021 19:12:19 +0000 (16:12 -0300)]
declare getpass in analyzer/sensitive-1.c test
The getpass function is not available on all systems; and not
necessarily declared in unistd.h, as expected by the sensitive-1
analyzer test.
Since this is a compile-only test, it doesn't really matter if the
function is defined in the system libraries. All we need is a
declaration, to avoid warnings from calling an undeclared function.
This patch adds the declaration, in a way that is most unlikely to
conflict with any existing declaration.
for gcc/testsuite/ChangeLog
* gcc.dg/analyzer/sensitive-1.c: Declare getpass.
Thomas Schwinge [Tue, 28 Apr 2020 18:43:38 +0000 (20:43 +0200)]
[gcn offloading] Only supported in 64-bit configurations
Similar to nvptx offloading, see PR65099 "nvptx offloading: hard-coded 64-bit
assumptions".
gcc/
* config/gcn/mkoffload.c (main): Create an offload image only in
64-bit configurations.
François Dumont [Fri, 1 Jan 2021 16:35:56 +0000 (17:35 +0100)]
libstdc++: Implement N3644 for _GLIBCXX_DEBUG iterators
libstdc++-v3/ChangeLog:
PR libstdc++/98466
* include/bits/hashtable_policy.h (_Node_iterator_base()): Set _M_cur to nullptr.
(_Node_iterator()): Make default.
(_Node_const_iterator()): Make default.
* include/debug/macros.h (__glibcxx_check_erae_range_after): Add _M_singular
iterator checks.
* include/debug/safe_iterator.h
(_GLIBCXX_DEBUG_VERIFY_OPERANDS): Accept if both iterator are value initialized.
* include/debug/safe_local_iterator.h (_GLIBCXX_DEBUG_VERIFY_OPERANDS):
Likewise.
* include/debug/safe_iterator.tcc (_Safe_iterator<>::_M_valid_range): Add
_M_singular checks on input iterators.
* src/c++11/debug.cc (_Safe_iterator_base::_M_can_compare): Remove _M_singular
checks.
* testsuite/23_containers/deque/debug/98466.cc: New test.
* testsuite/23_containers/unordered_map/debug/98466.cc: New test.
Harald Anlauf [Thu, 14 Jan 2021 18:21:05 +0000 (19:21 +0100)]
PR fortran/98661 - valgrind issues with error recovery
During error recovery after an invalid derived type specification it was
possible to try to resolve an invalid array specification. We now skip
this if the component has the ALLOCATABLE or POINTER attribute and the
shape is not deferred.
gcc/fortran/ChangeLog:
PR fortran/98661
* resolve.c (resolve_component): Derived type components with
ALLOCATABLE or POINTER attribute shall have a deferred shape.
gcc/testsuite/ChangeLog:
PR fortran/98661
* gfortran.dg/pr98661.f90: New test.
Harald Anlauf [Thu, 14 Jan 2021 18:17:05 +0000 (19:17 +0100)]
Revert "PR fortran/98661 - valgrind issues with error recovery"
This reverts commit
d0d2becf2dfe8316c9014d962e7f77773ec5c27e.
Harald Anlauf [Thu, 14 Jan 2021 18:13:16 +0000 (19:13 +0100)]
PR fortran/98661 - valgrind issues with error recovery
During error recovery after an invalid derived type specification it was
possible to try to resolve an invalid array specification. We now skip
this if the component has the ALLOCATABLE or POINTER attribute and the
shape is not deferred.
gcc/fortran/ChangeLog:
PR fortran/98661
* resolve.c (resolve_component): Derived type components with
ALLOCATABLE or POINTER attribute shall have a deferred shape.
gcc/testsuite/ChangeLog:
PR fortran/98661
* gfortran.dg/pr98661.f90: New test.
Ian Lance Taylor [Wed, 13 Jan 2021 19:54:15 +0000 (11:54 -0800)]
libgo: update hurd support
Patch from Svante Signell.
Fixes PR go/98496
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/283692
Thomas Schwinge [Mon, 30 Nov 2020 14:15:20 +0000 (15:15 +0100)]
[nvptx libgomp plugin] Build only in supported configurations
As recently again discussed in <https://gcc.gnu.org/PR97436> "[nvptx] -m32
support", nvptx offloading other than for 64-bit host has never been
implemented, tested, supported. So we simply should buildn't the nvptx libgomp
plugin in this case.
This avoids build problems if, for example, in a (standard) bi-arch
x86_64-pc-linux-gnu '-m64'/'-m32' build, libcuda is available only in a 64-bit
variant but not in a 32-bit one, which, for example, is the case if you build
GCC against the CUDA toolkit's 'stubs/libcuda.so' (see
<https://stackoverflow.com/a/
52784819>).
This amends PR65099 commit
a92defdab79a1268f4b9dcf42b937e4002a4cf15 (r225560)
"[nvptx offloading] Only 64-bit configurations are currently supported" to
match the way we're doing this for the HSA/GCN plugins.
libgomp/
PR libgomp/65099
* plugin/configfrag.ac (PLUGIN_NVPTX): Restrict to supported
configurations.
* configure: Regenerate.
* plugin/plugin-nvptx.c (nvptx_get_num_devices): Remove 64-bit
check.
Jonathan Wakely [Thu, 14 Jan 2021 14:26:19 +0000 (14:26 +0000)]
libstdc++: Define function to throw filesystem_error [PR 98471]
Fix ordering problem on Windows targets where filesystem_error was used
before being defined.
libstdc++-v3/ChangeLog:
PR libstdc++/98471
* include/bits/fs_path.h (__throw_conversion_error): New
function to throw or abort on character conversion errors.
(__wstr_from_utf8): Move definition after filesystem_error has
been defined. Use __throw_conversion_error.
(path::_S_convert<_EcharT>): Use __throw_conversion_error.
(path::_S_str_convert<_CharT, _Traits, _Allocator>): Likewise.
(path::u8string): Likewise.
Sebastian Huber [Thu, 14 Jan 2021 15:05:14 +0000 (16:05 +0100)]
RTEMS: Fix Ada build for riscv
gcc/ada/
PR ada/98595
* Makefile.rtl (LIBGNAT_TARGET_PAIRS) <riscv*-*-rtems*>: Use
wraplf version of Aux_Long_Long_Float.
Martin Liska [Thu, 14 Jan 2021 16:08:32 +0000 (17:08 +0100)]
gcov: add one more pytest
gcc/testsuite/ChangeLog:
* g++.dg/gcov/gcov-17.C: New test.
* g++.dg/gcov/test-gcov-17.py: New test.
Martin Liska [Thu, 14 Jan 2021 16:06:08 +0000 (17:06 +0100)]
mklog: skip unsupported files
This fixes an infinite loop one could see for:
git show
b87ec922c40 | ./contrib/mklog.py
contrib/ChangeLog:
* mklog.py: Fix infinite loop for unsupported files.
H.J. Lu [Thu, 14 Jan 2021 13:56:46 +0000 (05:56 -0800)]
x86: Error on -fcf-protection with incompatible target
-fcf-protection with CF_BRANCH inserts ENDBR32 at function entries.
ENDBR32 is NOP only on 64-bit processors and 32-bit TARGET_CMOV
processors. Issue an error for -fcf-protection with CF_BRANCH when
compiling for 32-bit non-TARGET_CMOV targets.
gcc/
PR target/98667
* config/i386/i386-options.c (ix86_option_override_internal):
Issue an error for -fcf-protection with CF_BRANCH when compiling
for 32-bit non-TARGET_CMOV targets.
gcc/testsuite/
PR target/98667
* gcc.target/i386/pr98667-1.c: New file.
* gcc.target/i386/pr98667-2.c: Likewise.
* gcc.target/i386/pr98667-3.c: Likewise.
Uros Bizjak [Thu, 14 Jan 2021 15:28:27 +0000 (16:28 +0100)]
i386: Resolve variable shadowing in i386-options.c [PR98671]
Also change global variable pta_size to unsigned.
2021-01-14 Uroš Bizjak <ubizjak@gmail.com>
gcc/
PR target/98671
* config/i386/i386-options.c (ix86_valid_target_attribute_inner_p):
Remove declaration and initialization of shadow variable "ret".
(ix86_option_override_internal): Remove delcaration of
shadow variable "i". Redeclare shadowed variable to unsigned.
* common/config/i386/i386-common.c (pta_size): Redeclare to unsigned.
* config/i386/i386-builtins.c (get_builtin_code_for_version):
Update for redeclaration.
* config/i386/i386.h (pta_size): Ditto.
Richard Biener [Thu, 14 Jan 2021 13:08:41 +0000 (14:08 +0100)]
tree-optimization/98674 - improve dependence analysis
This improves dependence analysis on refs that access the same
array but with different typed but same sized accesses. That's
obviously safe for the case of types that cannot have any
access function based off them. For the testcase this is
signed short vs. unsigned short.
2021-01-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/98674
* tree-data-ref.c (base_supports_access_fn_components_p): New.
(initialize_data_dependence_relation): For two bases without
possible access fns resort to type size equality when determining
shape compatibility.
* gcc.dg/vect/pr98674.c: New testcase.
H.J. Lu [Thu, 14 Jan 2021 14:56:17 +0000 (06:56 -0800)]
i386: Update PR target/95021 tests
Also pass -mpreferred-stack-boundary=4 -mno-stackrealign to avoid
disabling STV by:
/* Disable STV if -mpreferred-stack-boundary={2,3} or
-mincoming-stack-boundary={2,3} or -mstackrealign - the needed
stack realignment will be extra cost the pass doesn't take into
account and the pass can't realign the stack. */
if (ix86_preferred_stack_boundary < 128
|| ix86_incoming_stack_boundary < 128
|| opts->x_ix86_force_align_arg_pointer)
opts->x_target_flags &= ~MASK_STV;
PR target/98676
* gcc.target/i386/pr95021-1.c: Add -mpreferred-stack-boundary=4
-mno-stackrealign.
* gcc.target/i386/pr95021-3.c: Likewise.
Prathamesh Kulkarni [Thu, 14 Jan 2021 14:28:35 +0000 (19:58 +0530)]
arm: Replace calls to __builtin_vcge* by <=,>= in arm_neon.h [PR66791]
gcc/
2021-01-14 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
PR target/66791
* config/arm/arm_neon.h: Replace calls to __builtin_vcge* by
<=, >= operators in vcle and vcge intrinsics respectively.
* config/arm/arm_neon_builtins.def: Remove entry for
vcge and vcgeu.
Jonathan Wakely [Thu, 14 Jan 2021 14:25:05 +0000 (14:25 +0000)]
libstdc++: Update copyright dates on new files
The patch adding these files was approved in 2020 but it wasn't
committed until 2021, so the copyright years were not updated along with
the years in all the existing files.
libstdc++-v3/ChangeLog:
* include/std/barrier: Update copyright years. Fix whitespace.
* include/std/version: Fix whitespace.
* testsuite/30_threads/barrier/1.cc: Update copyright years.
* testsuite/30_threads/barrier/2.cc: Likewise.
* testsuite/30_threads/barrier/arrive.cc: Likewise.
* testsuite/30_threads/barrier/arrive_and_drop.cc: Likewise.
* testsuite/30_threads/barrier/arrive_and_wait.cc: Likewise.
* testsuite/30_threads/barrier/completion.cc: Likewise.
Nathan Sidwell [Thu, 14 Jan 2021 13:15:33 +0000 (05:15 -0800)]
c++: Fix erroneous parm comparison logic [PR 98372]
I flubbed an application of De Morgan's law. Let's just express the
logic directly and let the compiler figure it out. This bug made it
look like pr52830 was fixed, but it is not.
PR c++/98372
gcc/cp/
* tree.c (cp_tree_equal): Correct map_context logic.
gcc/testsuite/
* g++.dg/cpp0x/constexpr-52830.C: Restore dg-ice
* g++.dg/template/pr98372.C: New.
Uros Bizjak [Thu, 14 Jan 2021 12:21:56 +0000 (13:21 +0100)]
i386: Remove reduntand assignment in i386-options.c [PR98671]
Also rename x86_prefetch_sse to ix86_prefetch_sse.
2021-01-14 Uroš Bizjak <ubizjak@gmail.com>
gcc/
PR target/98671
* config/i386/i386-options.c (ix86_function_specific_save):
Remove redundant assignment to opts->x_ix86_branch_cost.
* config/i386/i386.c (ix86_prefetch_sse):
Rename from x86_prefetch_sse. Update all uses.
* config/i386/i386.h: Update for rename.
* config/i386/i386-options.h: Ditto.
Jakub Jelinek [Thu, 14 Jan 2021 11:55:19 +0000 (12:55 +0100)]
i386: Fix the pmovzx SSE4.1 define_insn_and_split patterns [PR98670]
I've made two mistakes in the *sse4_1_zero_extend* define_insn_and_split
patterns. One is that when it uses vector_operand, it should use Bm rather
than m constraint, and the other one is that because it is a post-reload
splitter it needs isa attribute to select which alternatives are valid for
which ISAs. Sorry for messing this up.
2021-01-14 Jakub Jelinek <jakub@redhat.com>
PR target/98670
* config/i386/sse.md (*sse4_1_zero_extendv8qiv8hi2_3,
*sse4_1_zero_extendv4hiv4si2_3, *sse4_1_zero_extendv2siv2di2_3):
Use Bm instead of m for non-avx. Add isa attribute.
* gcc.target/i386/pr98670.c: New test.
Jakub Jelinek [Thu, 14 Jan 2021 11:50:33 +0000 (12:50 +0100)]
match.pd: Optimize ~(X >> Y) to ~X >> Y if ~X can be simplified [PR96688]
This patch optimizes two GIMPLE operations into just one.
As mentioned in the PR, there is some risk this might create more expensive
constants, but sometimes it will make them on the other side less expensive,
it really depends on the exact value.
And if it is an important issue, we should do it in md or during expansion.
2021-01-14 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/96688
* match.pd (~(X >> Y) -> ~X >> Y): New simplification if
~X can be simplified.
* gcc.dg/tree-ssa/pr96688.c: New test.
* gcc.dg/tree-ssa/reassoc-37.c: Adjust scan-tree-dump regex.
* gcc.target/i386/pr66821.c: Likewise.
Richard Sandiford [Thu, 14 Jan 2021 11:36:25 +0000 (11:36 +0000)]
vect: Account for unused IFN_LOAD_LANES results
At the moment, if we use only one vector of an LD4 result,
we'll treat the LD4 as having the cost of a single load.
But all 4 loads and any associated permutes take place
regardless of which results are actually used.
This patch therefore counts the cost of unused LOAD_LANES
results against the first statement in a group. An alternative
would be to multiply the ncopies of the first stmt by the group
size and treat other stmts in the group as having zero cost,
but I thought that might be more surprising when reading dumps.
gcc/
* tree-vect-stmts.c (vect_model_load_cost): Account for unused
IFN_LOAD_LANES results.
gcc/testsuite/
* gcc.target/aarch64/sve/cost_model_11.c: New test.
* gcc.target/aarch64/sve/mask_struct_load_5.c: Use
-fno-vect-cost-model.
Kyrylo Tkachov [Wed, 13 Jan 2021 12:48:57 +0000 (12:48 +0000)]
aarch64: Reimplememnt vmovn/vmovl intrinsics with builtins instead
Turns out __builtin_convertvector is not as good a fit for the widening
and narrowing intrinsics as I had hoped.
During the veclower phase we lower most of it to bitfield operations and
hope DCE cleans it back up into
vector pack/unpack and extend operations. I received reports that in
more complex cases GCC fails to do that
and we're left with many vector extract operations that clutter the
output.
I think veclower can be improved on that front, but for GCC 10 I'd like
to just implement these builtins
with a good old RTL builtin rather than inline asm.
gcc/
* config/aarch64/aarch64-simd.md (aarch64_<su>xtl<mode>):
Define.
(aarch64_xtn<mode>): Likewise.
* config/aarch64/aarch64-simd-builtins.def (sxtl, uxtl, xtn):
Define
builtins.
* config/aarch64/arm_neon.h (vmovl_s8): Reimplement using
builtin.
(vmovl_s16): Likewise.
(vmovl_s32): Likewise.
(vmovl_u8): Likewise.
(vmovl_u16): Likewise.
(vmovl_u32): Likewise.
(vmovn_s16): Likewise.
(vmovn_s32): Likewise.
(vmovn_s64): Likewise.
(vmovn_u16): Likewise.
(vmovn_u32): Likewise.
(vmovn_u64): Likewise.
Kyrylo Tkachov [Wed, 13 Jan 2021 12:14:30 +0000 (12:14 +0000)]
aarch64: reimplement vqmovn_high* intrinsics using builtins
This patch reimplements the saturating-truncate-and-insert-into-high
intrinsics using the appropriate RTL codes and builtins.
gcc/
* config/aarch64/aarch64-simd.md (aarch64_<su>qxtn2<mode>_le):
Define.
(aarch64_<su>qxtn2<mode>_be): Likewise.
(aarch64_<su>qxtn2<mode>): Likewise.
* config/aarch64/aarch64-simd-builtins.def (sqxtn2, uqxtn2):
Define builtins.
* config/aarch64/iterators.md (SAT_TRUNC): Define code_iterator.
(su): Handle ss_truncate and us_truncate.
* config/aarch64/arm_neon.h (vqmovn_high_s16): Reimplement using
builtin.
(vqmovn_high_s32): Likewise.
(vqmovn_high_s64): Likewise.
(vqmovn_high_u16): Likewise.
(vqmovn_high_u32): Likewise.
(vqmovn_high_u64): Likewise.
gcc/testsuite/
* gcc.target/aarch64/narrow_high-intrinsics.c: Update uqxtn2 and
sqxtn2 scan-assembler-times.