Commit Graph

2564 Commits

Author SHA1 Message Date
GCC Administrator 03fed2a80b Daily bump. 2025-10-17 00:18:48 +00:00
Tobias Burnus e1e5444ff2 libgomp.c/declare-variant-4-gfx*: Add missing archs + dg-excess-errors
Add missing tests for gfx* context selectors; mark all but the
default-arch declare-variant-4.c with 'dg-excess-errors' to
silence libgomp not-found errors (still passing the
scan-offload-tree-dump check) - or at least causing just
UNRESOLVED errors if the error is
  "built without library support ... consider compiling for
   the associated generic architecture".

In case the multilib is configured, the result will be
an XPASS.

libgomp/ChangeLog:

	* testsuite/libgomp.c/declare-variant-4-gfx10-3-generic.c: Add
	dg-excess-errors to handle possible missing libgomp multi lib.
	* testsuite/libgomp.c/declare-variant-4-gfx1030.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1036.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx11-generic.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1100.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1103.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx9-4-generic.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx9-generic.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx900.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx906.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx908.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx90a.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx90c.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx942.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1031.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1032.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1033.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1034.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1035.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1101.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1102.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1150.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1151.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1152.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1153.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx902.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx904.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx909.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx950.c: New test.
2025-10-16 11:11:39 +02:00
GCC Administrator b9c253795e Daily bump. 2025-10-16 00:21:56 +00:00
Tobias Burnus b3c0e9aadb gcn: Add missing GFX9_4_GENERIC, OpenMP context-selector update
The definition for gfx942 and gfx950 missed the GFX9_4_GENERIC
family flag.

For OpenMP context selectors: The t-omp-device file missed the
generic selectors.

Additionally, there is now a note in the OpenMP documentation that
there is a one-to-one match for ISA names, ignoring any compatibility.
For instance, for Nvidia GPUs 'isa("sm_70")' is only true when compiling
for 'sm_70', even though sm < 7.0 code also runs on sm_70 hardware.
And, for AMD GPUs, gfx9-4-generic neither matches 'gfx942'
(even though such generic code runs on gfx942) - nor the reverse
(although all gfx9-4-generic code runs on gfx942).

gcc/ChangeLog:

	* config/gcn/gcn-devices.def (gfx942, gfx950): Set generic name
	to GFX9_4_GENERIC.
	* config/gcn/t-omp-device: Include generic names for OpenMP's
	ISA trait.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP Context Selectors): Add note that there is
	currently an exact match between ISA and compilation, ignoring
	compatibilities in both ways.
	* testsuite/libgomp.c/declare-variant-4.h: Add missing variant
	functions for specific and generic AMD GPUs.
	* testsuite/libgomp.c/declare-variant-4-gfx10-3-generic.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx11-generic.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx9-4-generic.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx9-generic.c: New test.
2025-10-15 19:15:15 +02:00
GCC Administrator ddd6dff0ba Daily bump. 2025-10-11 00:21:09 +00:00
Tobias Burnus d2ad7e9083 libgomp: Add is_integrated_apu function to plugin/plugin-{gcn,nvptx}.c
The added function is currently '#if 0' but is planned to be used to enable
self mapping automatically. Prerequisite for auto self maps is still mapping
'declare target' variables (if any, in libgomp) or converting all
'declare target' variables to 'declare target link' in the compiler
(as required for 'omp requires self_maps').

include/ChangeLog:

	* hsa_ext_amd.h (enum hsa_amd_agent_info_s): Add
	HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES.
	(enum): Add HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU.

libgomp/ChangeLog:

	* plugin/plugin-gcn.c (is_integrated_apu): New; currently '#if 0'.
	* plugin/plugin-nvptx.c (is_integrated_apu): Likewise.
2025-10-10 09:48:37 +02:00
GCC Administrator 7f57e04ce4 Daily bump. 2025-10-05 16:50:51 +00:00
Sam James ac273977ad
*: regenerate autotools
libatomic/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

libcc1/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.

libffi/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* include/Makefile.in: Regenerate.
	* man/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

libgcobol/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libgfortran/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libgm2/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* libm2cor/Makefile.in: Regenerate.
	* libm2iso/Makefile.in: Regenerate.
	* libm2log/Makefile.in: Regenerate.
	* libm2min/Makefile.in: Regenerate.
	* libm2pim/Makefile.in: Regenerate.

libgomp/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

libgrust/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* libformat_parser/Makefile.in: Regenerate.
	* libproc_macro_internal/Makefile.in: Regenerate.

libitm/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

libobjc/ChangeLog:

	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libphobos/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* libdruntime/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

libquadmath/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libsanitizer/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* asan/Makefile.in: Regenerate.
	* configure: Regenerate.
	* hwasan/Makefile.in: Regenerate.
	* interception/Makefile.in: Regenerate.
	* libbacktrace/Makefile.in: Regenerate.
	* lsan/Makefile.in: Regenerate.
	* sanitizer_common/Makefile.in: Regenerate.
	* tsan/Makefile.in: Regenerate.
	* ubsan/Makefile.in: Regenerate.

libssp/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* doc/Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* python/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++20/Makefile.in: Regenerate.
	* src/c++23/Makefile.in: Regenerate.
	* src/c++26/Makefile.in: Regenerate.
	* src/c++98/Makefile.in: Regenerate.
	* src/experimental/Makefile.in: Regenerate.
	* src/filesystem/Makefile.in: Regenerate.
	* src/libbacktrace/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

libvtv/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

lto-plugin/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
2025-10-05 17:14:49 +01:00
GCC Administrator f07d1f3135 Daily bump. 2025-09-19 00:20:17 +00:00
Tobias Burnus 97c1d2fa97 OpenMP: Unshare expr in context-selector condition [PR121922]
As the testcase shows, a missing unshare_expr caused that the condition
was only evaluated once instead of every time when a 'declare variant'
was resolved.

	PR middle-end/121922

gcc/ChangeLog:

	* omp-general.cc (omp_dynamic_cond): Use 'unshare_expr' for
	the user condition.

libgomp/ChangeLog:

	* testsuite/libgomp.c-c++-common/declare-variant-1.c: New test.

Co-authored-by: Sandra Loosemore <sloosemore@baylibre.com>
2025-09-18 11:07:50 +02:00
GCC Administrator 9bd24f83a1 Daily bump. 2025-09-18 00:20:40 +00:00
Tobias Burnus da5803c794 libgomp: Init hash table for 'indirect'-clause of 'declare target' on the host [PR114445, PR119857]
Especially with unified-shared memory and especially with C++'s virtual
functions, it is not uncommon to have on the device a function pointer
that points to the host function - but has an associated device.
If the pointed-to function is (explicitly or implicitly) 'declare target'
with the 'indirect' clause, it is added to the lookup table.

Before this commit, the conversion of the lookup table into a lookup
hash table happened every time a device kernel was launched on the first
team - albeit if already converted, the function immediately returned.

Ignoring the overhead, there was also a race: If multiple teams were
launched, it could happen that another team of the same target region
already tried to use the lookup table which it was still being created.
Likewise when lauching a kernel with 'nowait' and directly afterward
another kernel, there could be a race of creating the table.

With this commit, the creating of the kernel has been moved to the
host-plugin's GOMP_OFFLOAD_load_image. The previous code stored a
pointer to the host/device pointer array, which makes it hard when
creating the hash table on the host (data is needed for finding the
slot) - but accessing it on the device (where the lookup has to work
as well). As the hash-table implementation (only) supports integral
value as payload (0 and 1 having special meaning), the solution was
to move to an uint128_t variable to store both the host and device
address.

As the host-side library is typically dynamically linked and the
device-side one statically, there is the problem of backward
compatibility. The current implementation permits both older
binaries and newer libgomp and newer binaries with older libgomp.
I could imagine us breaking the latter eventually, but for now
there is up and downward compatibility. (Obviously, the race is
only fixed if new + new is combined.)

Code wise, on the device exist GOMP_INDIRECT_ADDR_MAP which was
updated to point to the host/device-address array. Now additionally
GOMP_INDIRECT_ADDR_HMAP exists, which contains the hash-table map.

If the latter exists, libgomp only updates it and the former remains
a NULL pointer; it is also untouched if there are no indirect functions.
Being NULL therefore avoids the call to the device-side build_indirect_map.
The code also currently supports to have no hash and a linear walk. I think
that remained from testing; due to the backward-compat feature, it can
actually be turned of on either side.

libgomp/ChangeLog:

	PR libgomp/119857
	PR libgomp/114445
	* config/accel/target-indirect.c: Change to use uint128_t instead
	of a struct as data structure and add GOMP_INDIRECT_ADDR_HMAP as
	host-accessible variable.
	(struct indirect_map_t): Remove.
	(USE_HASHTAB_LOOKUP, INDIRECT_DEV_ADDR, INDIRECT_HOST_ADDR,
	SET_INDIRECT_HOST_ADDR, SET_INDIRECT_ADDRS): Define.
	(htab_free): Use __builtin_unreachable.
	(htab_hash, htab_eq, GOMP_target_map_indirect_ptr,
	build_indirect_map): Update for new representation and new
	pointer-to-hash variable.
	* config/gcn/team.c (gomp_gcn_enter_kernel): Only call
	build_indirect_map when GOMP_INDIRECT_ADDR_MAP.
	* config/nvptx/team.c (gomp_nvptx_main): Likewise.
	* libgomp-plugin.h (GOMP_INDIRECT_ADDR_HMAP): Define.
	* plugin/plugin-gcn.c: Conditionally include
	build-target-indirect-htab.h.
	(USE_HASHTAB_LOOKUP_FOR_INDIRECT): Define.
	(create_target_indirect_map): New prototype.
	(GOMP_OFFLOAD_load_image): Update to create the device's
	indirect-function hash table on the host.
	* plugin/plugin-nvptx.c: Conditionally include
	build-target-indirect-htab.h.
	(USE_HASHTAB_LOOKUP_FOR_INDIRECT): Define.
	(create_target_indirect_map): New prototype.
	(GOMP_OFFLOAD_load_image): Update to create the device's
	indirect-function hash table on the host.
	* plugin/build-target-indirect-htab.h: New file.
2025-09-17 08:47:36 +02:00
Tobias Burnus 16d2b8881c libgomp: Add Fortran version of acc_copyout_finalize_async and acc_delete_finalize_async
OpenACC 2.5 added several functions for C and Fortran; while
acc_{copyout,delete}{,_finalize,_async} exist for both, for some
reasons only the C version of acc_{copyout,delete}_finalize_async
was actually added, even though the documentation (.texi) and
the .map file listed also the auxiliar Fortran functions!

OpenACC 2.5 added the Fortran version with the following odd
interface:  'type, dimension(:[,:]...)'. In OpenACC 2.6, it
was then updated to the Fortran 2018 syntax:
'type(*), dimension(..)', which is also used in openacc.f90
internally.
This commit now also updates the documentation to the newer
syntax - plus fixes a function-name typo: acc_delete_async_finalize
should have the _async at the end not in the middle!

libgomp/ChangeLog:

	* libgomp.map (OACC_2.5): Move previously unimplemented
	acc_{copyout,delete}_finalize_async_{32,64,array}_h_ to ...
	(OACC_2.6.1): ... here.
	* libgomp.texi (acc_copyin, acc_present_or_copyin, acc_create,
	acc_present_or_create, acc_copyout, acc_update_device,
	acc_update_self, acc_is_present): Use 'type(*), dimension(..)'
	instead of 'type, dimension(:[,:]...)' for Fortran.
	(acc_delete): Likewise; change acc_delete_async_finalize to
	acc_delete_finalize_async.
	* openacc.f90 (openacc_internal): Add interfaces for
	acc_{copyout,delete}_finalize_async_{{32,64,array}_h,_l}.
	(openacc): Add generic interfaces for
	acc_copyout_finalize_async and acc_delete_finalize_async.
	(acc_{copyout,delete}_finalize_async_{32,64,array}_h): New.
	* openacc_lib.h: Add generic interfaces for
	acc_copyout_finalize_async and acc_delete_finalize_async.
	* testsuite/libgomp.oacc-fortran/pr92970-1.f90: New test.
2025-09-17 08:43:58 +02:00
GCC Administrator 3b7f0be2d5 Daily bump. 2025-09-07 00:20:16 +00:00
Jakub Jelinek db7a807ef2 libgomp: Use consistent formatting in <omp.h>
I've noticed the new C++ part of omp.h uses libstdc++ coding conventions,
while the rest of the header (and libgomp) is formatted using the normal
gcc coding conventions like gcc/.

This patch makes it consistent.

2025-09-06  Jakub Jelinek  <jakub@redhat.com>

	* omp.h.in: Fix up formatting of __cplusplus >= 201103L
	guarded code from libstc++ style to GCC/libgomp style.
2025-09-06 12:24:31 +02:00
GCC Administrator ca2169c65b Daily bump. 2025-08-07 00:20:46 +00:00
Kwok Cheung Yeung 87262627fd openmp: Add support for iterators in 'target update' clauses (C/C++)
This adds support for iterators in 'to' and 'from' clauses in the
'target update' OpenMP directive.

gcc/c/

	* c-parser.cc (c_parser_omp_clause_from_to): Parse 'iterator' modifier.
	* c-typeck.cc (c_finish_omp_clauses): Finish iterators for to/from
	clauses.

gcc/cp/

	* parser.cc (cp_parser_omp_clause_from_to): Parse 'iterator' modifier.
	* semantics.cc (finish_omp_clauses): Finish iterators for to/from
	clauses.

gcc/

	* gimplify.cc (remove_unused_omp_iterator_vars): Display unused
	variable warning for 'to' and 'from' clauses.
	(gimplify_scan_omp_clauses): Add argument for iterator loop sequence.
	Gimplify the clause decl and size into the iterator loop if iterators
	are used.
	(gimplify_omp_workshare): Add argument for iterator loops sequence
	in call to gimplify_scan_omp_clauses.
	(gimplify_omp_target_update): Call remove_unused_omp_iterator_vars and
	build_omp_iterators_loops.  Add loop sequence as argument when calling
	gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses and building
	the Gimple statement.
	* tree-pretty-print.cc (dump_omp_clause): Call dump_omp_iterators
	for to/from clauses with iterators.
	* tree.cc (omp_clause_num_ops): Add extra operand for OMP_CLAUSE_FROM
	and OMP_CLAUSE_TO.
	* tree.h (OMP_CLAUSE_HAS_ITERATORS): Add check for OMP_CLAUSE_TO and
	OMP_CLAUSE_FROM.
	(OMP_CLAUSE_ITERATORS): Likewise.

gcc/testsuite/

	* c-c++-common/gomp/target-update-iterators-1.c: New.
	* c-c++-common/gomp/target-update-iterators-2.c: New.
	* c-c++-common/gomp/target-update-iterators-3.c: New.

libgomp/

	* target.c (gomp_update): Call gomp_merge_iterator_maps.  Free
	allocated variables.
	* testsuite/libgomp.c-c++-common/target-update-iterators-1.c: New.
	* testsuite/libgomp.c-c++-common/target-update-iterators-2.c: New.
	* testsuite/libgomp.c-c++-common/target-update-iterators-3.c: New.
2025-08-06 01:37:10 +01:00
Kwok Cheung Yeung 8b8b0eada6 openmp: Add support for iterators in map clauses (C/C++)
This adds preliminary support for iterators in map clauses within OpenMP
'target' constructs (which includes constructs such as 'target enter data').

Iterators with non-constant loop bounds are not currently supported.

gcc/c/

	* c-parser.cc (c_parser_omp_variable_list): Use location of the
	map expression as the clause location.
	(c_parser_omp_clause_map): Parse 'iterator' modifier.
	* c-typeck.cc (c_finish_omp_clauses): Finish iterators.  Apply
	iterators to generated clauses.

gcc/cp/

	* parser.cc (cp_parser_omp_clause_map): Parse 'iterator' modifier.
	* semantics.cc (finish_omp_clauses): Finish iterators.  Apply
	iterators to generated clauses.

gcc/

	* gimple-pretty-print.cc (dump_gimple_omp_target): Print expanded
	iterator loops.
	* gimple.cc (gimple_build_omp_target): Add argument for iterator
	loops sequence.  Initialize iterator loops field.
	* gimple.def (GIMPLE_OMP_TARGET): Set GSS symbol to GSS_OMP_TARGET.
	* gimple.h (gomp_target): Set GSS symbol to GSS_OMP_TARGET.  Add extra
	field for iterator loops.
	(gimple_build_omp_target): Add argument for iterator loops sequence.
	(gimple_omp_target_iterator_loops): New.
	(gimple_omp_target_iterator_loops_ptr): New.
	(gimple_omp_target_set_iterator_loops): New.
	* gimplify.cc (find_var_decl): New.
	(copy_omp_iterator): New.
	(remap_omp_iterator_var_1): New.
	(remap_omp_iterator_var): New.
	(remove_unused_omp_iterator_vars): New.
	(struct iterator_loop_info_t): New type.
	(iterator_loop_info_map_t): New type.
	(build_omp_iterators_loops): New.
	(enter_omp_iterator_loop_context_1): New.
	(enter_omp_iterator_loop_context): New.
	(enter_omp_iterator_loop_context): New.
	(exit_omp_iterator_loop_context): New.
	(gimplify_adjust_omp_clauses): Add argument for iterator loop
	sequence.  Gimplify the clause decl and size into the iterator
	loop if iterators are used.
	(gimplify_omp_workshare): Call remove_unused_omp_iterator_vars and
	build_omp_iterators_loops for OpenMP target expressions.  Add
	loop sequence as argument when calling gimplify_adjust_omp_clauses
	and building the Gimple statement.
	* gimplify.h (enter_omp_iterator_loop_context): New prototype.
	(exit_omp_iterator_loop_context): New prototype.
	* gsstruct.def (GSS_OMP_TARGET): New.
	* omp-low.cc (lower_omp_map_iterator_expr): New.
	(lower_omp_map_iterator_size): New.
	(finish_omp_map_iterators): New.
	(lower_omp_target): Add sorry if iterators used with deep mapping.
	Call lower_omp_map_iterator_expr before assigning to sender ref.
	Call lower_omp_map_iterator_size before setting the size.  Insert
	iterator loop sequence before the statements for the target clause.
	* tree-nested.cc (convert_nonlocal_reference_stmt): Walk the iterator
	loop sequence of OpenMP target statements.
	(convert_local_reference_stmt): Likewise.
	(convert_tramp_reference_stmt): Likewise.
	* tree-pretty-print.cc (dump_omp_iterators): Dump extra iterator
	information if present.
	(dump_omp_clause): Call dump_omp_iterators for iterators in map
	clauses.
	* tree.cc (omp_clause_num_ops): Add operand for OMP_CLAUSE_MAP.
	(walk_tree_1): Do not walk last operand of OMP_CLAUSE_MAP.
	* tree.h (OMP_CLAUSE_HAS_ITERATORS): New.
	(OMP_CLAUSE_ITERATORS): New.

gcc/testsuite/

	* c-c++-common/gomp/map-6.c (foo): Amend expected error message.
	* c-c++-common/gomp/target-map-iterators-1.c: New.
	* c-c++-common/gomp/target-map-iterators-2.c: New.
	* c-c++-common/gomp/target-map-iterators-3.c: New.
	* c-c++-common/gomp/target-map-iterators-4.c: New.

libgomp/

	* target.c (kind_to_name): New.
	(gomp_merge_iterator_maps): New.
	(gomp_map_vars_internal): Call gomp_merge_iterator_maps.  Copy
	address of only the first iteration to target vars.  Free allocated
	variables.
	* testsuite/libgomp.c-c++-common/target-map-iterators-1.c: New.
	* testsuite/libgomp.c-c++-common/target-map-iterators-2.c: New.
	* testsuite/libgomp.c-c++-common/target-map-iterators-3.c: New.

Co-authored-by: Andrew Stubbs <ams@baylibre.com>
2025-08-06 01:37:10 +01:00
GCC Administrator ec8ceeab58 Daily bump. 2025-07-22 00:19:29 +00:00
Thomas Schwinge 04b42c4245 Adjust 'libgomp.c++/target-cdtor-{1,2}.C' for 'targetm.cxx.use_aeabi_atexit' [PR119853, PR119854]
Fix-up for commit aafe942227
"GCN, nvptx offloading: Host/device compatibility: Itanium C++ ABI, DSO Object Destruction API [PR119853, PR119854]":
we need to adjust for 'targetm.cxx.use_aeabi_atexit':

    gcc/config/arm/arm.cc:#define TARGET_CXX_USE_AEABI_ATEXIT arm_cxx_use_aeabi_atexit

    gcc/config/arm/arm.cc:/* The EABI says __aeabi_atexit should be used to register static
    gcc/config/arm/arm.cc-   destructors.  */
    gcc/config/arm/arm.cc-
    gcc/config/arm/arm.cc-static bool
    gcc/config/arm/arm.cc:arm_cxx_use_aeabi_atexit (void)
    gcc/config/arm/arm.cc-{
    gcc/config/arm/arm.cc-  return TARGET_AAPCS_BASED;
    gcc/config/arm/arm.cc-}

..., which 'gcc/cp/decl.cc:get_atexit_node' then acts on: call '__aeabi_atexit'
instead of '__cxa_atexit', and swap two arguments.

	PR target/119853
	PR target/119854
	libgomp/
	* testsuite/libgomp.c++/target-cdtor-1.C: Adjust for
	'targetm.cxx.use_aeabi_atexit'.
	* testsuite/libgomp.c++/target-cdtor-2.C: Likewise.
2025-07-21 08:49:32 +02:00
GCC Administrator 191155769b Daily bump. 2025-07-19 00:19:41 +00:00
Andrew Stubbs 6f275d3628 amdgcn, libgomp: Remove unused variable (PR121156)
There's a new compiler warning breaking the build.  This fixes it.  The
variable appears to be genuinely vestigial.

libgomp/ChangeLog:

	PR target/121156
	* config/gcn/bar.c (gomp_team_barrier_wait_end): Remove unused
	"generation" variable.
	(gomp_team_barrier_wait_cancel_end): Likewise.
2025-07-18 10:59:13 +00:00
GCC Administrator 0c473aa8fd Daily bump. 2025-07-18 00:19:21 +00:00
Thomas Schwinge aa143261bd GCN, nvptx offloading: Restrain 'WARNING: program timed out.' while in 'dynamic_cast' only for effective-target 'offload_device' [PR119692]
In PR119692 "C++ 'typeinfo', 'vtable' vs. OpenACC, OpenMP 'target' offloading":

> --- Comment #8 from Rainer Orth <ro at gcc dot gnu.org> ---
> The last commit made things worse on sparc-sun-solaris2.11: since that one
> (dg-timeout 10) I regularly get
>
> WARNING: libgomp.c++/target-exceptions-bad_cast-1.C (test for excess errors)
> program timed out.
> FAIL: libgomp.c++/target-exceptions-bad_cast-1.C (test for excess errors)
> UNRESOLVED: libgomp.c++/target-exceptions-bad_cast-1.C compilation failed to produce executable
> UNRESOLVED: libgomp.c++/target-exceptions-bad_cast-1.C scan-tree-dump-times optimized "gimple_call <__cxa_bad_cast, " 1
>
> Before that, the test had no issue.  Compiling the test on an unloaded system
> usually takes less than 1 sec, but when fully loaded, times can go up.

To keep things simple, let's restrict this temporary (yeah...) workaround to
apply only for effective-target 'offload_device', just like the
'dg-xfail-run-if' itself.

	PR target/119692
	libgomp/
	* testsuite/libgomp.c++/pr119692-1-4.C: '{ dg-timeout 10 { target offload_device } }'.
	* testsuite/libgomp.c++/pr119692-1-5.C: Likewise.
	* testsuite/libgomp.c++/target-exceptions-bad_cast-1.C: Likewise.
	* testsuite/libgomp.c++/target-exceptions-bad_cast-2.C: Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C: Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C: Likewise.
2025-07-17 14:53:41 +02:00
GCC Administrator 3924740946 Daily bump. 2025-06-25 00:19:34 +00:00
Tobias Burnus 1e35a51825 Fortran/OpenACC: Add Fortran support for acc_attach/acc_detach
While C/++ support the routines acc_attach{,_async} and
acc_detach{,_finalize}{,_async} routines since a long time, the Fortran
API routines where only added in OpenACC 3.3.

Unfortunately, they cannot directly be implemented in the library as
GCC will introduce a temporary array descriptor in some cases, which
causes the attempted attachment to the this temporary variable instead
of to the original one.

Therefore, those API routines are handled in a special way in the compiler.

gcc/fortran/ChangeLog:

	* trans-stmt.cc (gfc_trans_call_acc_attach_detach): New.
	(gfc_trans_call): Call it.

libgomp/ChangeLog:

	* libgomp.texi (acc_attach, acc_detach): Update for Fortran
	version.
	* openacc.f90 (acc_attach{,_async}, acc_detach{,_finalize}{,_async}):
	Add.
	* openacc_lib.h: Likewise.
	* testsuite/libgomp.oacc-fortran/acc-attach-detach-1.f90: New test.
	* testsuite/libgomp.oacc-fortran/acc-attach-detach-2.f90: New test.
2025-06-24 23:46:53 +02:00
GCC Administrator ec8f7700bd Daily bump. 2025-06-20 00:20:22 +00:00
Tobias Burnus 8a759dbb69 libgomp/target.c: Fix buffer size for 'omp requires' diagnostic
One of the buffers that printed the list of set 'omp requires'
requirements missed the 'self' clause addition, being potentially
to short when all device-affecting clauses were passed. Solved it
by moving the sizeof(<string of all permitted values>" into a new
'#define' just above the associated gomp_requires_to_name function.

libgomp/ChangeLog:

	* target.c (GOMP_REQUIRES_NAME_BUF_LEN): Define.
	(GOMP_offload_register_ver, gomp_target_init): Use it for the
	char buffer size.
2025-06-19 21:16:42 +02:00
Tobias Burnus b8617e0a24 libgomp.texi: Document omp(x)::allocator::*, restructure memory allocator doc
libgomp/ChangeLog:

	* libgomp.texi (omp_init_allocator): Refer to 'Memory allocation'
	for available memory spaces.
	(OMP_ALLOCATOR): Move list of traits and predefined memspaces
	and allocators to ...
	(Memory allocation): ... here. Document omp(x)::allocator::*;
	minor wording tweaks, be more explicit about memkind, pinned and
	pool_size.

Co-authored-by: waffl3x <waffl3x@baylibre.com>
2025-06-19 21:06:11 +02:00
GCC Administrator c41081b79c Daily bump. 2025-06-18 00:18:43 +00:00
Tobias Burnus ea43b99537 OpenMP: Fix implicit 'declare target' for <ostream>
libstdc++-v3/include/std/ostream contains:

  namespace std _GLIBCXX_VISIBILITY(default)
  {
    ...
    template<typename _CharT, typename _Traits>
      inline basic_ostream<_CharT, _Traits>&
      endl(basic_ostream<_CharT, _Traits>& __os)
      { return flush(__os.put(__os.widen('\n'))); }
  ...
  #include <bits/ostream.tcc>

and the latter, libstdc++-v3/include/bits/ostream.tcc, has:
    // Inhibit implicit instantiations for required instantiations,
    // which are defined via explicit instantiations elsewhere.
  #if _GLIBCXX_EXTERN_TEMPLATE
    extern template class basic_ostream<char>;
    extern template ostream& endl(ostream&);

Before this commit, omp_discover_declare_target_tgt_fn_r marked 'endl'
as (implicitly) declare target - but not the calls in it due to the
'extern' (DECL_EXTERNAL).

Thanks to inlining and as 'endl' is (therefore) not used and, hence,
discarded by the linker; hencet, it works with -O0 and -O1. However,
as the (unused) function still exits, IPA CP (enabled by -O2) will try
to do constant-value propagation and fails as the definition of 'widen'
is not available.

Solution is to still walk 'endl' despite being an 'extern(al)' decl;
this has been restricted for now to DECL_DECLARED_INLINE_P.

gcc/ChangeLog:

	* omp-offload.cc (omp_discover_declare_target_tgt_fn_r): Also
	walk external functions that are declare inline (and have a
	DECL_SAVED_TREE).

libgomp/ChangeLog:

	* testsuite/libgomp.c++/declare_target-2.C: New test.
2025-06-17 11:33:09 +02:00
GCC Administrator 2c3ce07c56 Daily bump. 2025-06-11 00:19:51 +00:00
Tobias Burnus 37b454b7e1 gcn: Add experimental MI300 (gfx942) support
As gfx942 and gfx950 belong to gfx9-4-generic, the latter two are also added.
Note that there are no specific optimizations for MI300, yet.

For none of the mentioned devices, any multilib is build by default; use
'--with-multilib-list=' when configuring GCC to build them alongside.
gfx942 was added in LLVM (and its mc assembler, used by GCC) in version 18,
generic support in LLVM 19 and gfx950 in LLVM 20.

gcc/ChangeLog:

	* config/gcn/gcn-devices.def: Add gfx942, gfx950 and gfx9-4-generic.
	* config/gcn/gcn-opts.h (TARGET_CDNA3, TARGET_CDNA3_PLUS,
	TARGET_GLC_NAME, TARGET_TARGET_SC_CACHE): Define.
	(TARGET_ARCHITECTED_FLAT_SCRATCH): Use also for CDNA3.
	* config/gcn/gcn.h (gcn_isa): Add ISA_CDNA3 to the enum.
	* config/gcn/gcn.cc (print_operand): Update 'g' to use
	TARGET_GLC_NAME; add 'G' to print TARGET_GLC_NAME unconditionally.
	* config/gcn/gcn-valu.md (scatter, gather): Use TARGET_GLC_NAME.
	* config/gcn/gcn.md: Use %G<num> instead of glc; use 'buffer_inv sc1'
	for TARGET_TARGET_SC_CACHE.
	* doc/invoke.texi (march): Add gfx942, gfx950 and gfx9-4-generic.
	* doc/install.texi (amdgcn*-*-*): Add gfx942, gfx950 and gfx9-4-generic.
	* config/gcn/gcn-tables.opt: Regenerate.

libgomp/ChangeLog:

	* testsuite/libgomp.c/declare-variant-4.h (gfx942): New variant function.
	* testsuite/libgomp.c/declare-variant-4-gfx942.c: New test.
2025-06-10 15:12:47 +02:00
GCC Administrator e1719c3c20 Daily bump. 2025-06-07 00:19:12 +00:00
Tobias Burnus 387209938d OpenMP: Add omp_get_initial_device/omp_get_num_devices builtins
By adding omp_get_initial_device and omp_get_num_devices builtins for
C, C++, and Fortran, the following can be achieved:
* By making them pure, multiple calls can be avoiding in some cases.
* Some comparisons can be optimized at compile time.

omp_get_initial_device will be converted to omp_get_num_devices for
consistency; note that OpenMP 6 also permits omp_initial_device (== -1)
as value.

If GCC has not been configure for offloading, either intrinsic will
leads to 0 - and on the offload side, -1 (= omp_initial_device) is
returned for omp_initial_device.

gcc/fortran/ChangeLog:

	* f95-lang.cc (ATTR_PURE_NOTHROW_LIST): Define.
	* trans-expr.cc (get_builtin_fn): Handle omp_get_num_devices
	and omp_get_intrinsic_device.
	* gfortran.h (gfc_option_t): Add disable_omp_... for them.
	* options.cc (gfc_handle_option): Handle them with
	-fno-builtin-.

gcc/ChangeLog:

	* gimple-fold.cc (gimple_fold_builtin_omp_get_initial_device,
	gimple_fold_builtin_omp_get_num_devices): New.
	(gimple_fold_builtin): Call them.
	* omp-builtins.def (BUILT_IN_OMP_GET_INITIAL_DEVICE): Add
	(BUILT_IN_OMP_GET_NUM_DEVICES): Make uservisible + pure.

libgomp/ChangeLog:

	* libgomp.texi (omp_get_num_devices, omp_get_intrinsic_device):
	Document builtin handling.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/omp_get_num_devices_initial_device-2.c: New test.
	* c-c++-common/gomp/omp_get_num_devices_initial_device.c: New test.
	* gfortran.dg/gomp/omp_get_num_devices_initial_device-2.f90: New test.
	* gfortran.dg/gomp/omp_get_num_devices_initial_device.f90: New test.

Co-authored-by: Sandra Loosemore <sloosemore@baylibre.com>
2025-06-06 16:22:06 +02:00
Tobias Burnus 16c742e107 libgomp.c/target-map-zero-sized-3.c: Fix code for non-USM offload [PR120530]
A mapping clause was missing, causing the code to fail with offloading
when a host pointer was not device accessible.

libgomp/ChangeLog:

	PR target/120530
	* testsuite/libgomp.c/target-map-zero-sized-3.c (main): Add missing
	map clause; remove unused variable.
2025-06-06 15:17:53 +02:00
GCC Administrator cbeb02011d Daily bump. 2025-06-05 00:19:21 +00:00
Tobias Burnus 0f56d67a49 libgomp.texi (omp_interop_*): Add note about 5.2-to-6.0 incompatibility
GCC uses the 6.0 types - which are unfortunately not quite compatible with
code expecting 5.1/5.2 data types.  Therefore, this commit adds a note to
hopefully reduce surprises. Namely:

For C/C++: while OpenMP 5.1 and 5.2 used 'int *ret_code', OpenMP 6.0 uses
'omp_interop_rc_t *ret_code' in omp_interop_{int,ptr,str} and 'int' instead
of 'omp_interop_rc_t ret_code' in omp_get_interop_rc_desc.

Neither C nor C++ like passing the wrong pointer type, albeit for C, GCC < 14
and clang only warn (gcc >= r14-6037-g9715c545d33b3a has an error) and
using -fpermissive turns it into a warning and -Wno-incompatible-pointer-types
silences it for C.

C++ also dislikes passing an int to an enum, albeit -fpermissive turns the
error into a warning with g++ (but not clang++). And, here, using an enum
on the caller side works with both int and enum on the callee side.

libgomp/ChangeLog:

	* libgomp.texi (omp_interop_{int,ptr,str,rc_desc}): Add note about
	the 'ret_code' type change in OpenMP 6.

Co-authored-by: Sandra Loosemore <sloosemore@baylibre.com>
2025-06-04 13:25:05 +02:00
GCC Administrator 5f737a612d Daily bump. 2025-06-04 00:18:13 +00:00
Jakub Jelinek a8c03f056f libgomp: Fix up omp_target_memset-3.c test for C++ [PR120444]
The test PASSes for C, but FAILs for C++:
.../libgomp.c-c++-common/omp_target_memset-3.c: In function 'void test_it(void*, int, size_t)':
.../libgomp.c-c++-common/omp_target_memset-3.c:31:7: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
.../libgomp.c-c++-common/omp_target_memset-3.c:33:13: error: invalid conversion from 'void*' to 'int8_t*' {aka 'signed char*'} [-fpermissive]
.../libgomp.c-c++-common/omp_target_memset-3.c:10:19: note: initializing argument 1 of 'void init_val(int8_t*, int, size_t)'
.../libgomp.c-c++-common/omp_target_memset-3.c:37:14: error: invalid conversion from 'void*' to 'int8_t*' {aka 'signed char*'} [-fpermissive]
.../libgomp.c-c++-common/omp_target_memset-3.c:17:20: note: initializing argument 1 of 'void check_val(int8_t*, int, size_t)'
.../libgomp.c-c++-common/omp_target_memset-3.c:38:18: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
.../libgomp.c-c++-common/omp_target_memset-3.c:38:18: error: invalid conversion from 'void*' to 'int8_t*' {aka 'signed char*'} [-fpermissive]
.../libgomp.c-c++-common/omp_target_memset-3.c:17:20: note: initializing argument 1 of 'void check_val(int8_t*, int, size_t)'
.../libgomp.c-c++-common/omp_target_memset-3.c: In function 'int main()':
.../libgomp.c-c++-common/omp_target_memset-3.c:46:7: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]

The following two-liner fixes that, tested on x86_64-linux and i686-linux.

2025-06-03  Jakub Jelinek  <jakub@redhat.com>

	PR libgomp/120444
	* testsuite/libgomp.c-c++-common/omp_target_memset-3.c (test_it):
	Change ptr argument type from void * to int8_t *.
	(main): Change ptr variable type from void * to int8_t * and cast
	omp_target_alloc result to the latter type.
2025-06-03 07:54:37 +02:00
GCC Administrator 13699eb988 Daily bump. 2025-06-03 00:18:06 +00:00
Tobias Burnus 4e47e2f833 libgomp: Add OpenMP's omp_target_memset/omp_target_memset_async
PR libgomp/120444

include/ChangeLog:

	* cuda/cuda.h (cuMemsetD8, cuMemsetD8Async): Declare.

libgomp/ChangeLog:

	* libgomp-plugin.h (GOMP_OFFLOAD_memset): Declare.
	* libgomp.h (struct gomp_device_descr): Add memset_func.
	* libgomp.map (GOMP_6.0.1): Add omp_target_memset{,_async}.
	* libgomp.texi (Device Memory Routines): Document them.
	* omp.h.in (omp_target_memset, omp_target_memset_async): Declare.
	* omp_lib.f90.in (omp_target_memset, omp_target_memset_async):
	Add interfaces.
	* omp_lib.h.in (omp_target_memset, omp_target_memset_async): Likewise.
	* plugin/cuda-lib.def: Add cuMemsetD8.
	* plugin/plugin-gcn.c (struct hsa_runtime_fn_info): Add
	hsa_amd_memory_fill_fn.
	(init_hsa_runtime_functions): DLSYM_OPT_FN load it.
	(GOMP_OFFLOAD_memset): New.
	* plugin/plugin-nvptx.c (GOMP_OFFLOAD_memset): New.
	* target.c (omp_target_memset_int, omp_target_memset,
	omp_target_memset_async_helper, omp_target_memset_async): New.
	(gomp_load_plugin_for_device): Add DLSYM (memset).
	* testsuite/libgomp.c-c++-common/omp_target_memset.c: New test.
	* testsuite/libgomp.c-c++-common/omp_target_memset-2.c: New test.
	* testsuite/libgomp.c-c++-common/omp_target_memset-3.c: New test.
	* testsuite/libgomp.fortran/omp_target_memset.f90: New test.
	* testsuite/libgomp.fortran/omp_target_memset-2.f90: New test.
2025-06-02 17:43:57 +02:00
GCC Administrator c7df2b7d43 Daily bump. 2025-05-31 00:19:06 +00:00
Thomas Schwinge 2ffada0296 Add 'libgomp.c++/target-valarray-1.C'
libgomp/
	* testsuite/libgomp.c++/target-std__valarray-1.C: New.
	* testsuite/libgomp.c++/target-std__valarray-1.output: Likewise.
2025-05-30 14:47:41 +02:00
Thomas Schwinge 83ca283853 libgomp: Add testcases for concurrent access to standard C++ containers on offload targets, a number of USM variants
libgomp/
	* testsuite/libgomp.c++/target-std__array-concurrent-usm.C: New.
	* testsuite/libgomp.c++/target-std__array-concurrent.C: Adjust.
	* testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C: New.
	* testsuite/libgomp.c++/target-std__bitset-concurrent.C: Adjust.
	* testsuite/libgomp.c++/target-std__deque-concurrent-usm.C: New.
	* testsuite/libgomp.c++/target-std__deque-concurrent.C: Adjust.
	* testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C: New.
	* testsuite/libgomp.c++/target-std__forward_list-concurrent.C: Adjust.
	* testsuite/libgomp.c++/target-std__list-concurrent-usm.C: New.
	* testsuite/libgomp.c++/target-std__list-concurrent.C: Adjust.
	* testsuite/libgomp.c++/target-std__map-concurrent-usm.C: New.
	* testsuite/libgomp.c++/target-std__map-concurrent.C: Adjust.
	* testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C: New.
	* testsuite/libgomp.c++/target-std__multimap-concurrent.C: Adjust.
	* testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C: New.
	* testsuite/libgomp.c++/target-std__multiset-concurrent.C: Adjust.
	* testsuite/libgomp.c++/target-std__set-concurrent-usm.C: New.
	* testsuite/libgomp.c++/target-std__set-concurrent.C: Adjust.
	* testsuite/libgomp.c++/target-std__span-concurrent-usm.C: New.
	* testsuite/libgomp.c++/target-std__span-concurrent.C: Adjust.
	* testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C: New.
	* testsuite/libgomp.c++/target-std__valarray-concurrent.C: Adjust.
	* testsuite/libgomp.c++/target-std__vector-concurrent-usm.C: New.
	* testsuite/libgomp.c++/target-std__vector-concurrent.C: Adjust.
2025-05-30 14:47:41 +02:00
Kwok Cheung Yeung a811d1d722 libgomp: Add testcases for concurrent access to standard C++ containers on offload targets
libgomp/

	* testsuite/libgomp.c++/target-std__array-concurrent.C: New.
	* testsuite/libgomp.c++/target-std__bitset-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__deque-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__flat_map-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__flat_multimap-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__flat_multiset-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__flat_set-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__forward_list-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__list-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__map-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__multimap-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__multiset-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__set-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__span-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__unordered_map-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__unordered_set-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__valarray-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__vector-concurrent.C: Likewise.

Co-authored-by: Thomas Schwinge <tschwinge@baylibre.com>
2025-05-30 14:47:40 +02:00
Kwok Cheung Yeung fbcd0ad41f libgomp: Add testcases for the standard C++ math library on offload targets
libgomp/

	* testsuite/libgomp.c++/target-std__cmath.C: New.
	* testsuite/libgomp.c++/target-std__complex.C: Likewise.
	* testsuite/libgomp.c++/target-std__numbers.C: Likewise.
2025-05-30 14:47:40 +02:00
Waffl3x 28a5bc2d4f Add 'libgomp.c++/target-flex-[...].C' test cases
libgomp/ChangeLog:

	* testsuite/libgomp.c++/target-flex-10.C: New test.
	* testsuite/libgomp.c++/target-flex-100.C: New test.
	* testsuite/libgomp.c++/target-flex-101.C: New test.
	* testsuite/libgomp.c++/target-flex-11.C: New test.
	* testsuite/libgomp.c++/target-flex-12.C: New test.
	* testsuite/libgomp.c++/target-flex-2000.C: New test.
	* testsuite/libgomp.c++/target-flex-2001.C: New test.
	* testsuite/libgomp.c++/target-flex-2002.C: New test.
	* testsuite/libgomp.c++/target-flex-2003.C: New test.
	* testsuite/libgomp.c++/target-flex-30.C: New test.
	* testsuite/libgomp.c++/target-flex-300.C: New test.
	* testsuite/libgomp.c++/target-flex-31.C: New test.
	* testsuite/libgomp.c++/target-flex-32.C: New test.
	* testsuite/libgomp.c++/target-flex-33.C: New test.
	* testsuite/libgomp.c++/target-flex-41.C: New test.
	* testsuite/libgomp.c++/target-flex-60.C: New test.
	* testsuite/libgomp.c++/target-flex-61.C: New test.
	* testsuite/libgomp.c++/target-flex-62.C: New test.
	* testsuite/libgomp.c++/target-flex-70.C: New test.
	* testsuite/libgomp.c++/target-flex-80.C: New test.
	* testsuite/libgomp.c++/target-flex-81.C: New test.
	* testsuite/libgomp.c++/target-flex-90.C: New test.
	* testsuite/libgomp.c++/target-flex-common.h: New test.

Co-authored-by: Thomas Schwinge <tschwinge@baylibre.com>
2025-05-30 14:47:40 +02:00
Thomas Schwinge 543f7e1d59 Defuse 'RESULT_DECL' check in 'pass_nrv' (for offloading compilation) [PR119835]
... to avoid running into ICEs per PR119835, until that's resolved properly.

	PR middle-end/119835
	gcc/
	* tree-nrv.cc (pass_nrv::execute): Defuse 'RESULT_DECL' check.
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c:
	'#pragma GCC optimize "-fno-inline"'.
	* testsuite/libgomp.c-c++-common/target-abi-struct-1.c: New.
	* testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c: Adjust.

Co-authored-by: Richard Biener <rguenther@suse.de>
2025-05-30 14:47:40 +02:00
Julian Brown 0c8d92a9ac OpenMP: Support OpenMP 5.0 "declare mapper" directives for C
This patch adds support for "declare mapper" directives (and the "mapper"
modifier on "map" clauses) for C.

gcc/c/ChangeLog:

	* c-decl.cc (c_omp_mapper_id, c_omp_mapper_decl, c_omp_mapper_lookup,
	c_omp_extract_mapper_directive, c_omp_map_array_section,
	c_omp_scan_mapper_bindings_r, c_omp_scan_mapper_bindings): New
	functions.
	* c-objc-common.h (LANG_HOOKS_OMP_FINISH_MAPPER_CLAUSES,
	LANG_HOOKS_OMP_MAPPER_LOOKUP, LANG_HOOKS_OMP_EXTRACT_MAPPER_DIRECTIVE,
	LANG_HOOKS_OMP_MAP_ARRAY_SECTION): Define langhooks for C.
	* c-parser.cc (c_parser_omp_clause_map): Add declare_mapper_p
	parameter; handle mapper modifier.
	(c_parser_omp_all_clauses): Update call to c_parser_omp_clause_map.
	(c_parser_omp_target): Instantiate explicit mappers and record bindings
	for implicit mappers.
	(c_parser_omp_declare_mapper): Parse "declare mapper" directives.
	(c_parser_omp_declare): Support "declare mapper".
	(c_parser_omp_declare_reduction): Use inform not error_at.
	* c-tree.h (c_omp_finish_mapper_clauses, c_omp_mapper_lookup,
	c_omp_extract_mapper_directive, c_omp_map_array_section,
	c_omp_mapper_id, c_omp_mapper_decl, c_omp_scan_mapper_bindings,
	c_omp_instantiate_mappers): Add prototypes.
	* c-typeck.cc (c_finish_omp_clauses): Handle GOMP_MAP_PUSH_MAPPER_NAME
	and GOMP_MAP_POP_MAPPER_NAME.
	(c_omp_finish_mapper_clauses): New function (langhook).

libgomp/ChangeLog:

	* testsuite/libgomp.c-c++-common/declare-mapper-9.c: Enable for C.
	* testsuite/libgomp.c-c++-common/declare-mapper-10.c: Likewise.
	* testsuite/libgomp.c-c++-common/declare-mapper-11.c: Likewise.
	* testsuite/libgomp.c-c++-common/declare-mapper-12.c: Likewise.
	* testsuite/libgomp.c-c++-common/declare-mapper-13.c: Likewise.
	* testsuite/libgomp.c-c++-common/declare-mapper-14.c: Likewise.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/declare-mapper-3.c: Enable for C.
	* c-c++-common/gomp/declare-mapper-4.c: Likewise.
	* c-c++-common/gomp/declare-mapper-5.c: Likewise.
	* c-c++-common/gomp/declare-mapper-6.c: Likewise.
	* c-c++-common/gomp/declare-mapper-7.c: Likewise.
	* c-c++-common/gomp/declare-mapper-8.c: Likewise.
	* c-c++-common/gomp/declare-mapper-9.c: Likewise.
	* c-c++-common/gomp/declare-mapper-10.c: Likewise.
	* c-c++-common/gomp/declare-mapper-12.c: Likewise.
	* c-c++-common/gomp/map-6.c: Update dg-error.
	* gcc.dg/gomp/udr-3.c: Update for change to dg-note.
	* c-c++-common/gomp/declare-mapper-11.c: New.
	* gcc.dg/gomp/declare-mapper-10.c: New test.
	* gcc.dg/gomp/declare-mapper-11.c: New test.
	* gcc.dg/gomp/declare-mapper-13.c: New test.
2025-05-30 14:19:40 +02:00