185415 Commits

Author SHA1 Message Date
Uros Bizjak
c01c433111 i386: Add push insns for 4-byte vectors [PR100722]
2021-05-23  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	PR target/100722
	* config/i386/mmx.md (*push<VI_32:mode>2_rex64):
	New instruction pattern.
	(*push<VI_32:mode>2): Ditto.
	(push splitter for SSE registers): New splitter.

gcc/testsuite/

	PR target/100722
	* gcc.target/i386/pr100722.c: New test.
2021-05-23 22:14:59 +02:00
Harald Anlauf
fe03f4fc95 Fortran: fix passing return value to class(*) dummy argument
gcc/fortran/ChangeLog:

	PR fortran/100551
	* trans-expr.c (gfc_conv_procedure_call): Adjust check for
	implicit conversion of actual argument to an unlimited polymorphic
	procedure argument.

gcc/testsuite/ChangeLog:

	PR fortran/100551
	* gfortran.dg/pr100551.f90: New test.
2021-05-23 20:51:14 +02:00
Martin Liska
a4dbd5cffa Revert "Add ChangeLogs for the previous commit."
This reverts commit 1160d9c1e482ea1dc524c056aa8eeaff6b1a591e.
2021-05-23 14:19:08 +02:00
Martin Liska
6bf8847c73 Revert "PR98301 Add missing changelog entries."
This reverts commit c4771b3438a8cd9afcef1762957b763f8df3fa6e.
2021-05-23 14:08:08 +02:00
Tobias Burnus
5d3ef9189a fortran/intrinsic.texi: Use proper variable name
gcc/fortran/ChangeLog:

	* intrinsic.texi (ATOMIC_ADD, ATOMIC_FETCH_ADD): Use the
	proper variable name in the description.
2021-05-23 11:56:39 +02:00
Andrew Pinski
1160d9c1e4 Add ChangeLogs for the previous commit. 2021-05-23 08:11:06 +00:00
Andrew Pinski
99b76adb94 Don't simplify (A & C) != 0 ? D : 0 for pointer types.
While rewriting part of PHI-OPT to use match-and-simplify,
I ran into a bug where this pattern in match.pd would hit
and would produce invalid gimple; a shift of a pointer type.

This just disables this simplification for pointer types similarly
to what is already done in PHI-OPT for the generic A ? D : 0 case.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

2021-5-23  Andrew Pinski  <apinski@marvell.com>

gcc/
	* match.pd ((A & C) != 0 ? D : 0): Limit to non pointer types.

gcc/testsuite/
	* gcc.dg/gimplefe-45.c: New test.
2021-05-23 08:08:14 +00:00
GCC Administrator
15d30d2f20 Daily bump. 2021-05-23 00:16:24 +00:00
Andre Vehreschild
c4771b3438 PR98301 Add missing changelog entries. 2021-05-22 13:36:31 +02:00
Andre Vehreschild
26ca6dbda2 Steve Kargl <kargl@gcc.gnu.org>
PR fortran/98301 - random_init() is broken

Correct implementation of random_init() when -fcoarray=lib is given.

gcc/fortran/ChangeLog:

	PR fortran/98301
	* trans-decl.c (gfc_build_builtin_function_decls): Move decl.
	* trans-intrinsic.c (conv_intrinsic_random_init): Use bool for
	lib-call of caf_random_init instead of logical (4-byte).
	* trans.h: Add tree var for random_init.

libgfortran/ChangeLog:

	PR fortran/98301
	* caf/libcaf.h (_gfortran_caf_random_init): New function.
	* caf/single.c (_gfortran_caf_random_init): New function.
	* gfortran.map: Added fndecl.
	* intrinsics/random_init.f90: Implement random_init.
2021-05-22 13:27:42 +02:00
Thomas Schwinge
3050a1a182 [OpenACC privatization] Prune uninteresting/varying diagnostics in 'libgomp.oacc-fortran/privatized-ref-2.f90'
Minor fix-up for my recent commit 11b8286a83289f5b54e813f14ff56d730c3f3185
"[OpenACC privatization] Largely extend diagnostics and corresponding testsuite
coverage [PR90115]".

	libgomp/
	PR testsuite/90115
	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Prune
	uninteresting/varying diagnostics.

Reported-by: Sunil K Pandey <skpandey@sc.intel.com>
2021-05-22 10:37:17 +02:00
Aaron Sawdey
5e28089157 Fix rs6000 p10 fusion patterns with old attr type names
Somehow I managed to check in a version of genfusion.pl this
afternoon that was not updated to the new insn attr type names.
Committing as obvious and to make the code match what was posted
and reviewed.

gcc/
	* config/rs6000/genfusion.pl (gen_addadd): Fix incorrect attr types.
	* config/rs6000/fusion.md: Regenerate file.
2021-05-21 21:59:39 -05:00
GCC Administrator
2832d51b38 Daily bump. 2021-05-22 00:16:29 +00:00
Aaron Sawdey
842a055189 combine patterns for add-add fusion
This patch adds a function to genfusion.pl to add a couple
more patterns so combine can do fusion of pairs of add and
vaddudm instructions.

gcc/ChangeLog:

	* config/rs6000/genfusion.pl (gen_addadd): New function.
	* config/rs6000/fusion.md: Regenerate file.
	* config/rs6000/rs6000-cpus.def: Add
	OPTION_MASK_P10_FUSION_2ADD to masks.
	* config/rs6000/rs6000.c (rs6000_option_override_internal):
	Handle default value of OPTION_MASK_P10_FUSION_2ADD.
	* config/rs6000/rs6000.opt: Add -mpower10-fusion-2add.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/fusion-p10-addadd.c: New file.
2021-05-21 16:20:11 -05:00
Aaron Sawdey
bdc7162351 Test cases for p10 fusion patterns
This adds some test cases to make sure that the combine patterns for p10
fusion are working.

gcc/testsuite/ChangeLog:
	* gcc.target/powerpc/fusion-p10-ldcmpi.c: New file.
	* gcc.target/powerpc/fusion-p10-2logical.c: New file.
2021-05-21 16:18:53 -05:00
Jakub Jelinek
b5c1c7a96b openmp: Fix up firstprivate+lastprivate clause handling [PR99928]
The C/C++ clause splitting happens very early during construct parsing,
but only the FEs later on handle possible instantiations, non-static
member handling and array section lowering.
In the OpenMP 5.0/5.1 rules, whether firstprivate is added to combined
target depends on whether it isn't also mentioned in lastprivate or map
clauses, but unfortunately I think such checks are much better done only
when the FEs perform all the above mentioned changes.
So, this patch arranges for the firstprivate clause to be copied or moved
to combined target construct (as before), but sets flags on that clause,
which tell the FE *finish_omp_clauses and the gimplifier it has been added
only conditionally and let the FEs and gimplifier DTRT for these.

2021-05-21  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/99928
gcc/
	* tree.h (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET): Define.
	* gimplify.c (enum gimplify_omp_var_data): Fix up
	GOVD_MAP_HAS_ATTACHMENTS value, add GOVD_FIRSTPRIVATE_IMPLICIT.
	(omp_lastprivate_for_combined_outer_constructs): If combined target
	has GOVD_FIRSTPRIVATE_IMPLICIT set for the decl, change it to
	GOVD_MAP | GOVD_SEEN.
	(gimplify_scan_omp_clauses): Set GOVD_FIRSTPRIVATE_IMPLICIT for
	firstprivate clauses with OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT.
	(gimplify_adjust_omp_clauses): For firstprivate clauses with
	OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT either clear that bit and
	OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET too, or remove it and
	let it be replaced by implicit map clause.
gcc/c-family/
	* c-omp.c (c_omp_split_clauses): Set OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT
	on firstprivate clause copy going to target construct, and for
	target simd set also OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET bit.
gcc/c/
	* c-typeck.c (c_finish_omp_clauses): Move firstprivate clauses with
	OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT to the end of the chain.  Don't error
	if a decl is mentioned both in map clause and in such firstprivate
	clause unless OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET is also set.
gcc/cp/
	* semantics.c (finish_omp_clauses): Move firstprivate clauses with
	OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT to the end of the chain.  Don't error
	if a decl is mentioned both in map clause and in such firstprivate
	clause unless OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET is also set.
gcc/testsuite/
	* c-c++-common/gomp/pr99928-3.c: Remove all xfails.
	* c-c++-common/gomp/pr99928-15.c: New test.
2021-05-21 21:16:21 +02:00
Jakub Jelinek
0c6e792dd5 openmp: Fix up handling of implicit lastprivate on outer constructs for implicit linear and lastprivate IVs [PR99928]
This patch fixes the handling of lastprivate propagation to outer combined/composite
leaf constructs from implicit linear or lastprivate clauses on simd IVs and adds missing
testsuite coverage for explicit and implicit lastprivate on simd IVs.

2021-05-21  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/99928
	* gimplify.c (omp_lastprivate_for_combined_outer_constructs): New
	function.
	(gimplify_scan_omp_clauses) <case OMP_CLAUSE_LASTPRIVATE>: Use it.
	(gimplify_omp_for): Likewise.

	* c-c++-common/gomp/pr99928-6.c: Remove all xfails.
	* c-c++-common/gomp/pr99928-13.c: New test.
	* c-c++-common/gomp/pr99928-14.c: New test.
2021-05-21 21:13:06 +02:00
Thomas Schwinge
325aa13996 [OpenACC privatization] Reject 'static', 'external' in blocks [PR90115]
gcc/
	PR middle-end/90115
	* omp-low.c (oacc_privatization_candidate_p): Reject 'static',
	'external' in blocks.
	gcc/testsuite/
	PR middle-end/90115
	* c-c++-common/goacc/privatization-1-compute-loop.c: Update.
	* c-c++-common/goacc/privatization-1-compute.c: Likewise.
	* c-c++-common/goacc/privatization-1-routine_gang-loop.c:
	Likewise.
	* c-c++-common/goacc/privatization-1-routine_gang.c: Likewise.
	libgomp/
	PR middle-end/90115
	* testsuite/libgomp.oacc-c-c++-common/static-variable-1.c: Update.
	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise.
2021-05-21 20:23:34 +02:00
Thomas Schwinge
11b8286a83 [OpenACC privatization] Largely extend diagnostics and corresponding testsuite coverage [PR90115]
gcc/
	PR middle-end/90115
	* flag-types.h (enum openacc_privatization): New.
	* params.opt (-param=openacc-privatization): New.
	* doc/invoke.texi (openacc-privatization): Document it.
	* omp-general.h (get_openacc_privatization_dump_flags): New
	function.
	* omp-low.c (oacc_privatization_candidate_p): Add diagnostics.
	* omp-offload.c (execute_oacc_device_lower)
	<IFN_UNIQUE_OACC_PRIVATE>: Re-work diagnostics.
	* target.def (goacc.adjust_private_decl): Add 'location_t'
	parameter.
	* doc/tm.texi: Regenerate.
	* config/gcn/gcn-protos.h (gcn_goacc_adjust_private_decl): Adjust.
	* config/gcn/gcn-tree.c (gcn_goacc_adjust_private_decl): Likewise.
	* config/nvptx/nvptx.c (nvptx_goacc_adjust_private_decl):
	Likewise.  Preserve it for...
	(nvptx_goacc_expand_var_decl): ... use here.
	gcc/testsuite/
	PR middle-end/90115
	* c-c++-common/goacc/privatization-1-compute-loop.c: New file.
	* c-c++-common/goacc/privatization-1-compute.c: Likewise.
	* c-c++-common/goacc/privatization-1-routine_gang-loop.c:
	Likewise.
	* c-c++-common/goacc/privatization-1-routine_gang.c: Likewise.
	* gfortran.dg/goacc/privatization-1-compute-loop.f90: Likewise.
	* gfortran.dg/goacc/privatization-1-compute.f90: Likewise.
	* gfortran.dg/goacc/privatization-1-routine_gang-loop.f90:
	Likewise.
	* gfortran.dg/goacc/privatization-1-routine_gang.f90: Likewise.
	* c-c++-common/goacc-gomp/nesting-1.c: Update.
	* c-c++-common/goacc/private-reduction-1.c: Likewise.
	* gfortran.dg/goacc/private-3.f95: Likewise.
	libgomp/
	PR middle-end/90115
	* testsuite/libgomp.oacc-fortran/private-atomic-1-vector.f90: New
	file.
	* testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: Update.
	* testsuite/libgomp.oacc-c-c++-common/host_data-7.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-3.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-4.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-5.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-3.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-4.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-5.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-6.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-3.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-4.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-5.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-6.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-7.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-g-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-g-2.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-v-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/parallel-reduction.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/private-atomic-1-gang.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/private-atomic-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/private-variables.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/routine-4.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/static-variable-1.c:
	Likewise.
	* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
	* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
	* testsuite/libgomp.oacc-fortran/declare-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/host_data-5.F90: Likewise.
	* testsuite/libgomp.oacc-fortran/if-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-1.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-2.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-3.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-6.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-1.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-2.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-1.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-2.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-3.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-4.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-5.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-6.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-7.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/optional-private.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/private-atomic-1-gang.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/private-atomic-1-worker.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/private-variables.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/routine-7.f90: Likewise.
2021-05-21 20:09:59 +02:00
Thomas Schwinge
d42c10563e Add '__OPTIMIZE__' DejaGnu selector
gcc/testsuite/
	* lib/target-supports.exp (check_effective_target___OPTIMIZE__):
	New proc.
	* gcc.c-torture/compile/ssa-unused-1.c: New file.
	gcc/
	* doc/sourcebuild.texi (Other attributes): Document '__OPTIMIZE__'
	DejaGnu selector.
2021-05-21 20:09:16 +02:00
Thomas Schwinge
5a0fe1f6c4 [OpenACC privatization] Explain OpenACC privatization candidate selection [PR90115]
gcc/
	PR middle-end/90115
	* omp-low.c (oacc_privatization_candidate_p): New function.
	(oacc_privatization_scan_clause_chain)
	(oacc_privatization_scan_decl_chain): Use it.  Also
	'gcc_checking_assert' that we're not seeing duplicates.
2021-05-21 20:08:14 +02:00
Thomas Schwinge
ad4612cb04 [OpenACC privatization] Skip processing if no work to be done [PR90115]
gcc/
	PR middle-end/90115
	* omp-offload.c (execute_oacc_device_lower): Skip processing if no
	work to be done.
2021-05-21 20:07:19 +02:00
Thomas Schwinge
21803fcaeb [OpenACC privatization] Explain two different configurations [PR90115]
gcc/
	PR middle-end/90115
	* omp-offload.c (execute_oacc_device_lower): Explain.
2021-05-21 20:06:02 +02:00
Thomas Schwinge
ff451ea723 [OpenACC privatization] Don't let unhandled 'IFN_UNIQUE_OACC_PRIVATE' linger [PR90115]
Make sure they're all handled in 'execute_oacc_device_lower'.  Why we at all
can have 'level == -1' cases is a separate bug to be fixed.

	gcc/
	PR middle-end/90115
	* omp-offload.c (execute_oacc_device_lower)
	<IFN_UNIQUE_OACC_PRIVATE>: Diagnose and handle for 'level == -1'
	case, too.
	* internal-fn.c (expand_UNIQUE): Don't expect
	'IFN_UNIQUE_OACC_PRIVATE'.
2021-05-21 20:02:41 +02:00
Thomas Schwinge
3a285ebd0c [OpenACC privatization] Don't evaluate OpenMP 'for' clauses [PR90115]
gcc/
	PR middle-end/90115
	* omp-low.c (lower_omp_for): Don't evaluate OpenMP 'for' clauses.
2021-05-21 20:01:04 +02:00
Thomas Schwinge
f6f45309d9 [OpenACC privatization, nvptx] Tighten some aspects [PR90115]
No functional change.

	gcc/
	PR middle-end/90115
	* config/nvptx/nvptx.c (nvptx_goacc_adjust_private_decl)
	(nvptx_goacc_expand_var_decl): Tighten.
2021-05-21 19:59:44 +02:00
Julian Brown
29a2f51806 openacc: Add support for gang local storage allocation in shared memory [PR90115]
This patch implements a method to track the "private-ness" of
OpenACC variables declared in offload regions in gang-partitioned,
worker-partitioned or vector-partitioned modes. Variables declared
implicitly in scoped blocks and those declared "private" on enclosing
directives (e.g. "acc parallel") are both handled. Variables that are
e.g. gang-private can then be adjusted so they reside in GPU shared
memory.

The reason for doing this is twofold: correct implementation of OpenACC
semantics, and optimisation, since shared memory might be faster than
the main memory on a GPU. Handling of private variables is intimately
tied to the execution model for gangs/workers/vectors implemented by
a particular target: for current targets, we use (or on mainline, will
soon use) a broadcasting/neutering scheme.

That is sufficient for code that e.g. sets a variable in worker-single
mode and expects to use the value in worker-partitioned mode. The
difficulty (semantics-wise) comes when the user wants to do something like
an atomic operation in worker-partitioned mode and expects a worker-single
(gang private) variable to be shared across each partitioned worker.
Forcing use of shared memory for such variables makes that work properly.

In terms of implementation, the parallelism level of a given loop is
not fixed until the oaccdevlow pass in the offload compiler, so the
patch delays fixing the parallelism level of variables declared on or
within such loops until the same point. This is done by adding a new
internal UNIQUE function (OACC_PRIVATE) that lists (the address of) each
private variable as an argument, and other arguments set so as to be able
to determine the correct parallelism level to use for the listed
variables. This new internal function fits into the existing scheme for
demarcating OpenACC loops, as described in comments in the patch.

Two new target hooks are introduced: TARGET_GOACC_ADJUST_PRIVATE_DECL and
TARGET_GOACC_EXPAND_VAR_DECL.  The first can tweak a variable declaration
at oaccdevlow time, and the second at expand time.  The first or both
of these target hooks can be used by a given offload target, depending
on its strategy for implementing private variables.

This patch updates the TARGET_GOACC_ADJUST_PRIVATE_DECL target hook in
the AMD GCN backend to the current name and prototype. (An earlier
version of the hook was already present, but dormant.)

	gcc/
	PR middle-end/90115
	* doc/tm.texi.in (TARGET_GOACC_EXPAND_VAR_DECL)
	(TARGET_GOACC_ADJUST_PRIVATE_DECL): Add documentation hooks.
	* doc/tm.texi: Regenerate.
	* expr.c (expand_expr_real_1): Expand decls using the
	expand_var_decl OpenACC hook if defined.
	* internal-fn.c (expand_UNIQUE): Handle IFN_UNIQUE_OACC_PRIVATE.
	* internal-fn.h (IFN_UNIQUE_CODES): Add OACC_PRIVATE.
	* omp-low.c (omp_context): Add oacc_privatization_candidates
	field.
	(lower_oacc_reductions): Add PRIVATE_MARKER parameter.  Insert
	before fork.
	(lower_oacc_head_tail): Add PRIVATE_MARKER parameter.  Modify
	private marker's gimple call arguments, and pass it to
	lower_oacc_reductions.
	(oacc_privatization_scan_clause_chain)
	(oacc_privatization_scan_decl_chain, lower_oacc_private_marker):
	New functions.
	(lower_omp_for, lower_omp_target, lower_omp_1): Use these.
	* omp-offload.c (convert.h): Include.
	(oacc_loop_xform_head_tail): Treat private-variable markers like
	fork/join when transforming head/tail sequences.
	(struct var_decl_rewrite_info): Add struct.
	(oacc_rewrite_var_decl, is_sync_builtin_call): New functions.
	(execute_oacc_device_lower): Support rewriting gang-private
	variables using target hook, and fix up addr_expr and var_decl
	nodes afterwards.
	* target.def (adjust_private_decl, expand_var_decl): New hooks.
	* config/gcn/gcn-protos.h (gcn_goacc_adjust_gangprivate_decl):
	Rename to...
	(gcn_goacc_adjust_private_decl): ...this.
	* config/gcn/gcn-tree.c (gcn_goacc_adjust_gangprivate_decl):
	Rename to...
	(gcn_goacc_adjust_private_decl): ...this. Add LEVEL parameter.
	* config/gcn/gcn.c (TARGET_GOACC_ADJUST_GANGPRIVATE_DECL): Rename
	definition using gcn_goacc_adjust_gangprivate_decl...
	(TARGET_GOACC_ADJUST_PRIVATE_DECL): ...to this, using
	gcn_goacc_adjust_private_decl.
	* config/nvptx/nvptx.c (tree-pretty-print.h): Include.
	(gang_private_shared_size): New global variable.
	(gang_private_shared_align): Likewise.
	(gang_private_shared_sym): Likewise.
	(gang_private_shared_hmap): Likewise.
	(nvptx_option_override): Initialize these.
	(nvptx_file_end): Output gang_private_shared_sym.
	(nvptx_goacc_adjust_private_decl, nvptx_goacc_expand_var_decl):
	New functions.
	(nvptx_set_current_function): Clear gang_private_shared_hmap.
	(TARGET_GOACC_ADJUST_PRIVATE_DECL): Define hook.
	(TARGET_GOACC_EXPAND_VAR_DECL): Likewise.
	libgomp/
	PR middle-end/90115
	* testsuite/libgomp.oacc-c-c++-common/private-atomic-1-gang.c: New
	test.
	* testsuite/libgomp.oacc-fortran/private-atomic-1-gang.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/private-atomic-1-worker.f90:
	Likewise.

Co-Authored-By: Chung-Lin Tang <cltang@codesourcery.com>
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
2021-05-21 18:58:07 +02:00
H.J. Lu
782e57f2c0 x86: Remove MAX_BITSIZE_MODE_ANY_INT
It is only defined for i386 and everyone uses the default:

 #define MAX_BITSIZE_MODE_ANY_INT (64*BITS_PER_UNIT)

Whatever problems we had before, they have been fixed now.

	* config/i386/i386-modes.def (MAX_BITSIZE_MODE_ANY_INT): Removed.
2021-05-21 08:06:30 -07:00
H.J. Lu
53fb833d63 Elide expand_constructor if move by pieces is preferred
Elide expand_constructor when the constructor is static storage and not
mostly zeros and we can move it by pieces prefer to do so since that's
usually more efficient than performing a series of stores from immediates.

2021-05-21  Richard Biener  <rguenther@suse.de>
	    H.J. Lu  <hjl.tools@gmail.com>

gcc/

	PR middle-end/90773
	* expr.c (expand_constructor): Elide expand_constructor if
	move by pieces is preferred.

gcc/testsuite/

	* gcc.target/i386/pr90773-24.c: New test.
	* gcc.target/i386/pr90773-25.c: Likewise.
2021-05-21 07:27:37 -07:00
Thomas Schwinge
5d42db5333 Don't skip 'libgomp.oacc-fortran/privatized-ref-2.f90' for nvptx offloading
libgomp/
	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Don't skip
	for nvptx offloading.
2021-05-21 16:22:46 +02:00
Tobias Burnus
61796dc03b Add 'libgomp.oacc-fortran/privatized-ref-2.f90'
libgomp/
	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: New.
2021-05-21 16:08:40 +02:00
Kyrylo Tkachov
079c23cfe0 aarch64: Add attributes for builtins specified in aarch64-builtins.c
Besides the builtins in aarch64-simd-builtins.def there are a number of builtins defined in aarch64-builtins.c itself.
They could also benefit from the attributes generated by aarch64_get_attributes.
However aarch64_get_attributes and its helpers are only set up to handle a aarch64_simd_builtin_datum.

This patch changes these functions to instead take a flag and mode value that are extracted from
aarch64_simd_builtin_datum.flags and aarch64_simd_builtin_datum.mode anyway.
Then the various builtin init functions in aarch64-builtins.c can pass down their own FLAG_* flags
that they want to derive attributes from.

gcc/ChangeLog:

	* config/aarch64/aarch64-builtins.c (aarch64_call_properties):
	Take a flag and mode value as arguments.
	(aarch64_modifies_global_state_p): Likewise.
	(aarch64_reads_global_state_p): Likewise.
	(aarch64_could_trap_p): Likewise.
	(aarch64_get_attributes): Likewise.
	(aarch64_init_simd_builtins): Adjust callsite of above.
	(aarch64_init_fcmla_laneq_builtins): Use aarch64_get_attributes to get
	function attributes to apply to builtins.
	(aarch64_init_crc32_builtins): Likewise.
	(aarch64_init_builtin_rsqrt): Likewise.
2021-05-21 14:46:00 +01:00
Aaron Sawdey
5ae352467a Add insn types for fusion pairs
This adds new values for insn attr type for p10 fusion. The genfusion.pl
script is modified to use them, and fusion.md regenerated to capture
the new patterns. There are also some formatting only changes to
fusion.md that apparently weren't captured after a previous commit
of genfusion.pl.

gcc/
	* config/rs6000/rs6000.md (define_attr "type"): Add types for fusion.
	* config/rs6000/genfusion.pl (gen_ld_cmpi_p10): Use new fusion types.
	(gen_2logical): Use new fusion types.
	* config/rs6000/fusion.md: Regenerate.
2021-05-21 07:31:08 -05:00
Uros Bizjak
2df9d3c52e i386: Add comparisons for 4-byte vectors [PR100637]
2021-05-21  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	PR target/100637
	* config/i386/i386-expand.c (ix86_expand_sse_movcc):
	Handle V4QI and V2HI modes.
	(ix86_expand_sse_movcc): Ditto.
	* config/i386/mmx.md (*<sat_plusminus:insn><VI_32:mode>3):
	New instruction pattern.
	(*eq<VI_32:mode>3): Ditto.
	(*gt<VI_32:mode>3): Ditto.
	(*xop_pcmov_<VI_32:mode>): Ditto.
	(mmx_pblendvb32): Ditto.
	(mmx_pblendvb64): Rename from mmx_pblendvb.
	(vec_cmp<VI_32:mode><VI_32:mode>): New expander.
	(vec_cmpu<VI_32:mode><VI_32:mode>): Ditto.
	(vcond<VI_32:mode><VI_32:mode>): Ditto.
	(vcondu<VI_32:mode><VI_32:mode>): Ditto.
	(vcond_mask_<VI_32:mode><VI_32:mode>): Ditto.

gcc/testsuite/

	PR target/100637
	* g++.target/i386/pr100637-1b.C: New test.
	* g++.target/i386/pr100637-1w.C: Ditto.
	* gcc.target/i386/pr100637-2b.c: Ditto.
	* gcc.target/i386/pr100637-2w.c: Ditto.
2021-05-21 13:15:53 +02:00
Piotr Trojanek
6fdacaf4b0 Detect illegal conditions in Raise_xxx_Error nodes
Enforce comment from sinfo.ads about the Condition field in N_Raise_xxx_Error
nodes. Only an extra sanity check; the behaviour is not affected.

gcc/ada/
	* gcc-interface/trans.c (Raise_Error_to_gnu): Add an assertion.
2021-05-21 11:31:46 +02:00
Tamar Christina
745dae5923 libsanitizer: Remove cyclades from libsanitizer
The Linux kernel has removed the interface to cyclades from
the latest kernel headers[1] due to them being orphaned for the
past 13 years.

libsanitizer uses this header when compiling against glibc, but
glibcs itself doesn't seem to have any references to cyclades.

Further more it seems that the driver is broken in the kernel and
the firmware doesn't seem to be available anymore.

As such since this is breaking the build of libsanitizer (and so the
GCC bootstrap[2]) I propose to remove this.

[1] https://lkml.org/lkml/2021/3/2/153
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100379

(cherry picked from commit f7c5351552387bd43f6ca3631016d7f0dfe0f135)

libsanitizer/ChangeLog:

	PR sanitizer/100379
	* sanitizer_common/sanitizer_common_interceptors_ioctl.inc: Cherry-pick
	llvm-project revision f7c5351552387bd43f6ca3631016d7f0dfe0f135.
	* sanitizer_common/sanitizer_platform_limits_posix.cpp: Likewise.
	* sanitizer_common/sanitizer_platform_limits_posix.h: Likewise.
2021-05-21 10:30:59 +01:00
Eric Botcazou
49c2c7f655 Remove discriminant checks in gigi
gcc/ada/
	* gcc-interface/utils.c (gnat_pushdecl): Fix typo in comment.
	* gcc-interface/utils2.c (build_simple_component_ref): Build NULL_EXPR
	if the offset of the field has overflowed.
	(build_component_ref): Add gigi checking assertion that the reference
	has been built and replace the discriminant check by a Program_Error.
2021-05-21 11:27:28 +02:00
Eric Botcazou
3553d8c2fe Consistently generate debug info for elaboration variables
This makes sure that debug info is generated for elaboration variables,
even if the variables are not generated exclusively for this purpose.

gcc/ada/
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Named_Integer>: Do
	not pass default value in call to create_var_decl.
	<E_Variable>: Likewise.
	<E_Record_Subtype>: Both pass true for const_flag and false for
	const_decl_allowed_p in call to create_var_decl.
	Small tweaks in the generic record type case.
	(elaborate_expression): Rename need_debug into need_for_debug and
	adjust throughout.
	(elaborate_expression_1): Likewise.  Pass Needs_Debug_Info instead
	of need_for_debug in call to create_var_decl.
	(elaborate_expression_2): Likewise.
	* gcc-interface/utils.c (maybe_pad_type): Pass false for
	const_decl_allowed_p in call to create_var_decl.
2021-05-21 11:19:32 +02:00
Ghjuvan Lacambre
4a29b8d627 Replace ? with ?? in warning messages
The former has been deprecated in favor of the latter.

gcc/ada/
	* gcc-interface/decl.c (gnat_to_gnu_entity): Replace ? with ??.
	(gnat_to_gnu_param): Likewise.
	(gnat_to_gnu_subprog_type): Likewise.
	(warn_on_field_placement): Likewise.
	(intrin_arglists_compatible_p): Likewise.
	* gcc-interface/trans.c (Pragma_to_gnu): Likewise.
	(gnat_to_gnu): Likewise.
	(validate_unchecked_conversion): Likewise.
	* gcc-interface/utils.c (maybe_pad_type): Likewise.
2021-05-21 11:14:13 +02:00
Eric Botcazou
dd9a8fff14 Fix internal error on locally derived bit-packed array type
This is a regression present on the mainline, 11 and 10 branches,
in the form of an ICE on a locally derived bit-packed array type.

gcc/ada/
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Process
	the implementation type of a packed type implemented specially.
gcc/testsuite/
	* gnat.dg/derived_type7.adb, gnat.dg/derived_type7.ads: New test.
2021-05-21 10:57:02 +02:00
Eric Botcazou
932198a8e1 Always translate Is_Pure flag into pure in C sense
Gigi has historically translated the Is_Pure flag of the front-end into
the "const" attribute of GNU C.  That's correct for subprograms of pure
Ada units, but not fully exact according to the semantics of the flag.

gcc/ada/
	* gcc-interface/decl.c (gnat_to_gnu_subprog_type): Always translate
	the Is_Pure flag into the "pure" attribute of GNU C.
2021-05-21 10:45:21 +02:00
Eric Botcazou
1e66a91700 Fix segfault at run time on strict-alignment platforms
This fixes a regression present on the mainline and 11 branch by
restricting the problematic change dealing with bitfields whose
nomimal subtype is self-referential to the cases where the size
is really lower.

gcc/ada/
	* gcc-interface/trans.c (Call_to_gnu): Restrict previous change
	to bitfields whose size is not equal to the type size.
	(gnat_to_gnu): Likewise.
2021-05-21 10:41:35 +02:00
Jakub Jelinek
f1c777f40a tree-optimization: Improve spaceship_replacement [PR94589]
On Wed, May 19, 2021 at 01:30:31PM -0400, Jason Merrill via Gcc-patches wrote:
> Here, when genericizing lexicographical_compare_three_way, we haven't yet
> walked the operands, so (a == a) still sees ADDR_EXPR <a>, but this is after
> we've changed the type of a to REFERENCE_TYPE.  When we try to fold (a == a)
> by constexpr evaluation, the constexpr code doesn't understand trying to
> take the address of a reference, and we end up crashing.
>
> Fixed by avoiding constexpr evaluation in genericize_spaceship, by using
> fold_build2 instead of build_new_op on scalar operands.  Class operands
> should have been expanded during parsing.

Unfortunately this slightly changed the IL and spaceship_replacement no
longer pattern matches it.

Here are 3 improvements that make it match:

1) as mentioned in the comment above spaceship_replacement, for
   strong_ordering, we are pattern matching something like:
   x == y ? 0 : x < y ? -1 : 1;
   and for partial_ordering
   x == y ? 0 : x < y ? -1 : x > y ? 1 : 2;
   but given the == comparison done first and the other comparisons only
   if == was false, we actually don't care if the other comparisons
   are < vs. <= (or > vs. >=), provided the operands of the comparison
   are the same; we know == is false when doing those and < vs. <= or
   > vs. >= have the same behavior for NaNs too
2) when y is an integral constant, we should treat x < 5 equivalently
   to x <= 4 etc.
3) the code punted if cond2_phi_edge wasn't a EDGE_TRUE_VALUE edge, but
   as the new IL shows, that isn't really needed; given 1) that
   > and >= are equivalent in the code, any of swapping the comparison
   operands, changing L[TE]_EXPR to G[TE]_EXPR or vice versa or
   swapping the EDGE_TRUE_VALUE / EDGE_FALSE_VALUE bits on the edges
   reverses one of the two comparisons

2021-05-21  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/94589
	* tree-ssa-phiopt.c (spaceship_replacement): For integral rhs1 and
	rhs2, treat x <= 4 equivalently to x < 5 etc.  In cmp1 and cmp2 (if
	not the same as cmp3) treat <= the same as < and >= the same as >.
	Don't require that cond2_phi_edge is true edge, instead take
	false/true edges into account based on cmp1/cmp2 comparison kinds.
2021-05-21 10:39:50 +02:00
Eric Botcazou
f53aff92ac Fix spurious No_Elaboration violation for Size attribute
We optimize the associated range check but nevertheless flag a violation.

gcc/ada/
	* gcc-interface/trans.c (Call_to_gnu): Minor tweaks.
	(gnat_to_gnu_external): Likewise.
	(Raise_Error_to_gnu): Return an empty statement list if there is a
	condition and it is always false.
	(gnat_to_gnu): Do not check for elaboration code a priori during the
	translation but a posteriori instead.
2021-05-21 10:34:48 +02:00
Eric Botcazou
b1cd7461ec Fix incorrect SLOC on instruction
This puts the missing SLOC on a statement generated by a return.

gcc/ada/
	* gcc-interface/trans.c (gnat_to_gnu) <N_Simple_Return_Statement>:
	Put a SLOC on the assignment from the return value to the return
	object in the copy-in/copy-out case.
2021-05-21 10:26:50 +02:00
Eric Botcazou
e5bfda0204 Use EXACT_DIV_EXPR as much as possible
...when the division is exact, typically dividing TYPE_SIZE by BITS_PER_UNIT.

gcc/ada/
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Replace
	CEIL_DIV_EXPR with EXACT_DIV_EXPR.
	* gcc-interface/misc.c (gnat_type_max_size): Likewise.
	* gcc-interface/utils.c (maybe_pad_type): Likewise.
	(finish_record_type): Likewise.  And always compute the unit size.
2021-05-21 10:21:09 +02:00
Uros Bizjak
dcde81134c i386: Add minmax and abs patterns for 4-byte vectors [PR100637]
2021-05-21  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	PR target/100637
	* config/i386/mmx.md (SMAXMIN_MMXMODEI): New mode iterator.
	(<smaxmin:code><SMAXMIN_MMXMODEI:mode>3): Macroize expander
	from <smaxmin:code>v4hi3> and <smaxmin:code><MMXMODE14:mode>3
	using SMAXMIN_MMXMODEI mode iterator.
	(*<smaxmin:code>v4qi3): New insn pattern.
	(*<smaxmin:code>v2hi3): Ditto.
	(SMAXMIN_VI_32): New mode iterator.
	(<smaxmin:code><SMAXMIN_VI_32>mode3): New expander.

	(UMAXMIN_MMXMODEI): New mode iterator.
	(<umaxmin:code><UMAXMIN_MMXMODEI:mode>3): Macroize expander
	from <umaxmin:code>v8qi3> and <umaxmin:code><MMXMODE24:mode>3
	using UMAXMIN_MMXMODEI mode iterator.
	(*<umaxmin:code>v4qi3): New insn pattern.
	(*<umaxmin:code>v2hi3): Ditto.
	(UMAXMIN_VI_32): New mode iterator.
	(<umaxmin:code><UMAXMIN_VI_32>mode3): New expander.

	(abs<VI_32:mode>2): New insn pattern.
	(ssse3_abs<MMXMODEI:mode>2, abs<MMXMODEI:mode>2): Move from ...
	* config/i386/sse.md: ... here.
2021-05-21 08:02:27 +02:00
Patrick Palka
11784fe27d libstdc++: Implement LWG 3490 change to drop_while_view::begin()
libstdc++-v3/ChangeLog:

	PR libstdc++/100606
	* include/std/ranges (drop_while_view::begin): Assert the
	precondition added by LWG 3490.
2021-05-21 00:05:18 -04:00
Patrick Palka
317a38cd46 libstdc++: Fix access issue in iota_view::_Sentinel [PR100690]
libstdc++-v3/ChangeLog:

	PR libstdc++/100690
	* include/std/ranges (iota_view::_Sentinel::_M_distance_from):
	Split out this member function from ...
	(iota_view::_Sentinel::operator-): ... here, for sake of access
	control.
	* testsuite/std/ranges/iota/iota_view.cc (test05): New test.
2021-05-20 23:39:05 -04:00
GCC Administrator
ea34e2edd3 Daily bump. 2021-05-21 00:16:57 +00:00