]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
2 years agolibgomp.texi: List GCN's 'gfx803' under OpenMP Context Selectors
Tobias Burnus [Wed, 30 Nov 2022 12:18:17 +0000 (13:18 +0100)] 
libgomp.texi: List GCN's 'gfx803' under OpenMP Context Selectors

libgomp/ChangeLog:

* libgomp.texi (OpenMP Context Selectors): Add 'gfx803' to gcn's isa.

(cherry picked from commit e0b95c2e8b771b53876321a6a0a9497619af73cd)

2 years agoamdgcn: Support AMD-specific 'isa' traits in OpenMP context selectors
Paul-Antoine Arras [Tue, 29 Nov 2022 15:22:07 +0000 (16:22 +0100)] 
amdgcn: Support AMD-specific 'isa' traits in OpenMP context selectors

Add support for gfx803 as an alias for fiji.
Add test cases for all supported 'isa' values.

gcc/ChangeLog:

* config/gcn/gcn.cc (gcn_omp_device_kind_arch_isa): Add gfx803.
* config/gcn/t-omp-device: Add gfx803.

libgomp/ChangeLog:

* testsuite/libgomp.c/declare-variant-4-fiji.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx803.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx900.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx906.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx908.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx90a.c: New test.
* testsuite/libgomp.c/declare-variant-4.h: New header file.

(cherry picked from commit 1fd508744eccda9ad9c6d6fcce5b2ea9c568818d)

2 years agogcn: Fix __builtin_gcn_first_call_this_thread_p
Tobias Burnus [Mon, 28 Nov 2022 14:21:30 +0000 (15:21 +0100)] 
gcn: Fix __builtin_gcn_first_call_this_thread_p

Contrary naive expectation, unspec_volatile (via prologue_use) did not
prevent the cprop pass (at -O2) to remove the access to the s[0:1]
(PRIVATE_SEGMENT_BUFFER_ARG) register as the volatile got just put on
the preceeding pseudoregister.  Solution: Use gen_rtx_USE instead.
Additionally, this patch removes (gen_)prologue_use_di as it is then no
longer used.

Finally, as we already do bit manipulation, instead of using the full
64bit side - and then just keeping the value of 's0', just move directly
to use only s1 of s[0:1] and do the bit manipulations there, generating
more readable assembly code and better matching the '#else' branch.

gcc/ChangeLog:

* config/gcn/gcn.cc (gcn_expand_builtin_1): Work on s1 instead
of s[0:1] and use USE to prevent removal of setting that register.
* config/gcn/gcn.md (prologue_use_di): Remove.

(cherry picked from commit 9fa67f1c1228a852e23943a41e68b664172c654c)

2 years agoOpenMP/Fortran: Permit end-clause on directive
Tobias Burnus [Mon, 28 Nov 2022 14:20:36 +0000 (15:20 +0100)] 
OpenMP/Fortran: Permit end-clause on directive

gcc/fortran/ChangeLog:

* openmp.cc (OMP_DO_CLAUSES, OMP_SCOPE_CLAUSES,
OMP_SECTIONS_CLAUSES): Add 'nowait'.
(OMP_SINGLE_CLAUSES): Add 'nowait' and 'copyprivate'.
(gfc_match_omp_distribute_parallel_do,
gfc_match_omp_distribute_parallel_do_simd,
gfc_match_omp_parallel_do,
gfc_match_omp_parallel_do_simd,
gfc_match_omp_parallel_sections,
gfc_match_omp_teams_distribute_parallel_do,
gfc_match_omp_teams_distribute_parallel_do_simd): Disallow 'nowait'.
(gfc_match_omp_workshare): Match 'nowait' clause.
(gfc_match_omp_end_single): Use clause matcher for 'nowait'.
(resolve_omp_clauses): Reject 'nowait' + 'copyprivate'.
* parse.cc (decode_omp_directive): Break too long line.
(parse_omp_do, parse_omp_structured_block): Diagnose duplicated
'nowait' clause.

libgomp/ChangeLog:

* libgomp.texi (OpenMP 5.2): Mark end-directive as Y.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/copyprivate-1.f90: New test.
* gfortran.dg/gomp/copyprivate-2.f90: New test.
* gfortran.dg/gomp/nowait-2.f90: Move dg-error tests ...
* gfortran.dg/gomp/nowait-4.f90: ... to this new file.
* gfortran.dg/gomp/nowait-5.f90: New test.
* gfortran.dg/gomp/nowait-6.f90: New test.
* gfortran.dg/gomp/nowait-7.f90: New test.
* gfortran.dg/gomp/nowait-8.f90: New test.

(cherry picked from commit 091b6dbc48177fa3ef15d62ea280ef6cb61c05b2)

2 years agolibgomp: Add no-target-region rev offload test + fix plugin-nvptx
Tobias Burnus [Mon, 28 Nov 2022 14:16:47 +0000 (15:16 +0100)] 
libgomp: Add no-target-region rev offload test + fix plugin-nvptx

OpenMP permits that a 'target device(ancestor:1)' is called without being
enclosed in a target region - using the current device (i.e. the host) in
that case.  This commit adds a testcase for this.

In case of nvptx, the missing on-device 'GOMP_target_ext' call causes that
it and also the associated on-device GOMP_REV_OFFLOAD_VAR variable are not
linked in from nvptx's libgomp.a. Thus, handle the failing cuModuleGetGlobal
gracefully by disabling reverse offload and assuming that the failure is fine.

libgomp/ChangeLog:

* plugin/plugin-nvptx.c (GOMP_OFFLOAD_load_image): Use unsigned int
for 'i' to match 'fn_entries'; regard absent GOMP_REV_OFFLOAD_VAR
as valid and the code having no reverse-offload code.
* testsuite/libgomp.c-c++-common/reverse-offload-2.c: New test.

(cherry picked from commit 9f9d128f459e0c5ace8f7b85504d277b5a838daf)

2 years agolibgomp.texi: OpenMP Impl Status 5.1 additions + TR11
Tobias Burnus [Mon, 28 Nov 2022 14:15:35 +0000 (15:15 +0100)] 
libgomp.texi: OpenMP Impl Status 5.1 additions + TR11

libgomp/ChangeLog:

* libgomp.texi (OpenMP Implementation Status): Add three 5.1 items
and status for Technical Report (TR) 11.

(cherry picked from commit c16e85d726a7793c05209af031dac0bebf035ab9)

2 years agoOpenMP: Generate SIMD clones for functions with "declare target"
Sandra Loosemore [Sat, 26 Nov 2022 01:35:32 +0000 (01:35 +0000)] 
OpenMP: Generate SIMD clones for functions with "declare target"

This patch causes the IPA simdclone pass to generate clones for
functions with the "omp declare target" attribute as if they had
"omp declare simd", provided the function appears to be suitable for
SIMD execution.  The filter is conservative, rejecting functions
that write memory or that call other functions not known to be safe.
A new option -fopenmp-target-simd-clone is added to control this
transformation; it's enabled for offload processing at -O2 and higher.

Backport of mainline commit 309e2d95e3b930c6f15c8a5346b913158404c76d.

gcc/ChangeLog:

* common.opt (fopenmp-target-simd-clone): New option.
(target_simd_clone_device): New enum to go with it.
* doc/invoke.texi (-fopenmp-target-simd-clone): Document.
* flag-types.h (enum omp_target_simd_clone_device_kind): New.
* omp-simd-clone.cc (auto_simd_fail): New function.
(auto_simd_check_stmt): New function.
(plausible_type_for_simd_clone): New function.
(ok_for_auto_simd_clone): New function.
(simd_clone_create): Add force_local argument, make the symbol
have internal linkage if it is true.
(expand_simd_clones): Also check for cloneable functions with
"omp declare target".  Pass explicit_p argument to
simd_clone.compute_vecsize_and_simdlen target hook.
* opts.cc (default_options_table): Add -fopenmp-target-simd-clone.
* target.def (TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN):
Add bool explicit_p argument.
* doc/tm.texi: Regenerated.
* config/aarch64/aarch64.cc
(aarch64_simd_clone_compute_vecsize_and_simdlen): Update.
* config/gcn/gcn.cc
(gcn_simd_clone_compute_vecsize_and_simdlen): Update.
* config/i386/i386.cc
(ix86_simd_clone_compute_vecsize_and_simdlen): Update.

gcc/testsuite/ChangeLog:

* g++.dg/gomp/target-simd-clone-1.C: New.
* g++.dg/gomp/target-simd-clone-2.C: New.
* gcc.dg/gomp/target-simd-clone-1.c: New.
* gcc.dg/gomp/target-simd-clone-2.c: New.
* gcc.dg/gomp/target-simd-clone-3.c: New.
* gcc.dg/gomp/target-simd-clone-4.c: New.
* gcc.dg/gomp/target-simd-clone-5.c: New.
* gcc.dg/gomp/target-simd-clone-6.c: New.
* gcc.dg/gomp/target-simd-clone-7.c: New.
* gcc.dg/gomp/target-simd-clone-8.c: New.
* lib/scanoffloadipa.exp: New.

libgomp/ChangeLog:

* testsuite/lib/libgomp.exp: Load scanoffloadipa.exp library.
* testsuite/libgomp.c/target-simd-clone-1.c: New.
* testsuite/libgomp.c/target-simd-clone-2.c: New.
* testsuite/libgomp.c/target-simd-clone-3.c: New.

2 years agoRevert "OpenMP: Generate SIMD clones for functions with "declare target""
Sandra Loosemore [Mon, 31 Oct 2022 17:12:47 +0000 (17:12 +0000)] 
Revert "OpenMP: Generate SIMD clones for functions with "declare target""

This reverts commit f01e3b9dfd81973498c0a71a266e530aeb6f0c97.

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Fri, 25 Nov 2022 10:36:18 +0000 (11:36 +0100)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-8941-ged8d7ecac11d587687986a0895050955c09d2f43 (25th Nov 2022)

2 years agoDaily bump.
GCC Administrator [Fri, 25 Nov 2022 10:07:49 +0000 (10:07 +0000)] 
Daily bump.

2 years agoFix thinko in operator_bitwise_xor::op1_range
Eric Botcazou [Fri, 25 Nov 2022 09:49:20 +0000 (10:49 +0100)] 
Fix thinko in operator_bitwise_xor::op1_range

There is a thinko in the op1_range method of ranger's operator_bitwise_xor
class in a boolean context: if the result is known to be true, it may infer
that a specific operand is false without any basis.

gcc/
* range-op.cc (operator_bitwise_xor::op1_range): Fix thinko.

gcc/testsuite/
* gnat.dg/opt100.adb: New test.
* gnat.dg/opt100_pkg.adb, gnat.dg/opt100_pkg.ads: New helper.

2 years agoFix wrong array type conversion with different storage orde
Eric Botcazou [Tue, 22 Nov 2022 18:03:49 +0000 (19:03 +0100)] 
Fix wrong array type conversion with different storage orde

When two arrays of scalars have a different storage order in Ada, the
front-end makes sure that the conversion is performed component-wise
so that each component can be reversed.  So it's a little bit counter
productive that the ldist pass performs the opposite transformation
and synthesizes a memcpy/memmove in this case.

gcc/
* tree-loop-distribution.cc (loop_distribution::classify_builtin_ldst):
Bail out if source and destination do not have the same storage order.

gcc/testsuite/
* gnat.dg/sso18.adb: New test.

2 years agolibstdc++: Remove unnecessary header from <memory>
Jonathan Wakely [Thu, 15 Sep 2022 17:21:32 +0000 (18:21 +0100)] 
libstdc++: Remove unnecessary header from <memory>

Previously <memory> included <bits/stl_algobase.h> so that std::copy,
std::fill etc. could be used by <bits/stl_uninitialized.h>. But that
includes it explicitly now, so that it can be compiled as a header unit.
There's no need to include it in <memory>, where its purpose isn't
obvious.

libstdc++-v3/ChangeLog:

* include/std/memory: Do not include <bits/stl_algobase.h>.

(cherry picked from commit d6ccad7641da10d9c5f1f6cfc676d5f5b9d2d126)

2 years agolibstdc++: Fix tests with non-const operator==
Jonathan Wakely [Thu, 10 Nov 2022 14:11:27 +0000 (14:11 +0000)] 
libstdc++: Fix tests with non-const operator==

These tests fail in strict -std=c++20 mode but their equality ops don't
need to be non-const, it looks like an accident.

This fixes two FAILs with -std=c++20:
FAIL: 20_util/tuple/swap.cc (test for excess errors)
FAIL: 26_numerics/valarray/87641.cc (test for excess errors)

libstdc++-v3/ChangeLog:

* testsuite/20_util/tuple/swap.cc (MoveOnly::operator==): Add
const qualifier.
* testsuite/26_numerics/valarray/87641.cc (X::operator==):
Likewise.

(cherry picked from commit fbad7a74aaaddea3d7b39045a09dd3860603658e)

2 years agolibstdc++: Remove unnecessary variant member in std::expected
Jonathan Wakely [Tue, 1 Nov 2022 13:47:24 +0000 (13:47 +0000)] 
libstdc++: Remove unnecessary variant member in std::expected

Hui Xie pointed out that we don't need a dummy member in the union,
because all constructors always initialize either _M_val or _M_unex.

We still need the _M_void member of the expected<void, E>
specialization, because the constructor has to initialize something when
not using the _M_unex member.

libstdc++-v3/ChangeLog:

* include/std/expected (expected::_M_invalid): Remove.

(cherry picked from commit f4874691812bc20e3d8e3302db439c27f30c472c)

2 years agolibstdc++: Check static assertions earlier in chrono::duration
Jonathan Wakely [Mon, 21 Nov 2022 11:52:34 +0000 (11:52 +0000)] 
libstdc++: Check static assertions earlier in chrono::duration

This ensures that we fail a static assertion before giving any other
errors. Instantiating chrono::duration<int, chrono::seconds> will now
print this before the other errors caused by it:

error: static assertion failed: period must be a specialization of ratio

libstdc++-v3/ChangeLog:

* include/bits/chrono.h (duration): Check preconditions on
template arguments before using them.

(cherry picked from commit ed77dcb9be76e592b62449c75a5e751485514afd)

2 years agolibstdc++: Fix dangling reference in filesystem::path::filename()
Jonathan Wakely [Fri, 28 Oct 2022 14:28:09 +0000 (15:28 +0100)] 
libstdc++: Fix dangling reference in filesystem::path::filename()

The new -Wdangling-reference warning noticed this.

libstdc++-v3/ChangeLog:

* include/bits/fs_path.h (path::filename()): Fix dangling
reference.

(cherry picked from commit 49237fe6ef677a81eae701f937546210c90b5914)

2 years agolibstdc++: Document LWG 1203 API change in manual
Jonathan Wakely [Wed, 14 Sep 2022 12:48:25 +0000 (13:48 +0100)] 
libstdc++: Document LWG 1203 API change in manual

libstdc++-v3/ChangeLog:

* doc/xml/manual/intro.xml: Document LWG 1203.
* doc/html/*: Regenerate.

(cherry picked from commit 8b1bc3051bd68ce193a8612fa3b1a65c0353b5b0)

2 years agolibstdc++: Add missing runtime exception to licence notice
Jonathan Wakely [Tue, 6 Sep 2022 10:58:21 +0000 (11:58 +0100)] 
libstdc++: Add missing runtime exception to licence notice

This file is missing the GCC Runtime Library Exception text in the
licence header. That is unintentional, and it should have been present.

libstdc++-v3/ChangeLog:

* include/std/barrier: Add missing runtime exception.

(cherry picked from commit d7f282c4243e24f567b11a5cb6048a27a3df733d)

2 years agolibstdc++: Add comparisons to std::default_sentinel_t (LWG 3719)
Jonathan Wakely [Thu, 4 Aug 2022 11:48:22 +0000 (12:48 +0100)] 
libstdc++: Add comparisons to std::default_sentinel_t (LWG 3719)

This library defect was recently approved for C++23.

libstdc++-v3/ChangeLog:

* include/bits/fs_dir.h (directory_iterator): Add comparison
with std::default_sentinel_t. Remove redundant operator!= for
C++20.
* (recursive_directory_iterator): Likewise.
* include/bits/iterator_concepts.h [!__cpp_lib_concepts]
(default_sentinel_t, default_sentinel): Define even if concepts
are not supported.
* include/bits/regex.h (regex_iterator): Add comparison with
std::default_sentinel_t. Remove redundant operator!= for C++20.
(regex_token_iterator): Likewise.
(regex_token_iterator::_M_end_of_seq()): Add noexcept.
* testsuite/27_io/filesystem/iterators/lwg3719.cc: New test.
* testsuite/28_regex/iterators/regex_iterator/lwg3719.cc:
New test.
* testsuite/28_regex/iterators/regex_token_iterator/lwg3719.cc:
New test.

(cherry picked from commit db33daa4677997399485176303406794dc900987)

2 years agolibstdc++: Fix std::is_nothrow_invocable_r for uncopyable prvalues [PR91456]
Jonathan Wakely [Fri, 23 Sep 2022 12:28:37 +0000 (13:28 +0100)] 
libstdc++: Fix std::is_nothrow_invocable_r for uncopyable prvalues [PR91456]

This is the last missing piece of PR 91456.

This also removes the only use of the C++11 version of
std::is_nothrow_invocable.

libstdc++-v3/ChangeLog:

PR libstdc++/91456
* include/std/type_traits (__is_nothrow_invocable): Remove.
(__is_invocable_impl::__nothrow_type): New member type which
checks if the conversion can throw.
(__is_nt_invocable_impl): Replace class template with alias
template to __is_nt_invocable_impl::__nothrow_type.
* testsuite/20_util/is_nothrow_invocable/91456.cc: New test.
* testsuite/20_util/is_nothrow_convertible/value.cc: Remove
macro used by value_ext.cc test.
* testsuite/20_util/is_nothrow_convertible/value_ext.cc: Remove
test for non-standard __is_nothrow_invocable trait.

(cherry picked from commit 71c828f84572d933979468baf2cf744180258ee4)

2 years agoDaily bump.
GCC Administrator [Thu, 24 Nov 2022 00:21:33 +0000 (00:21 +0000)] 
Daily bump.

2 years agogcn: Add __builtin_gcn_{get_stack_limit,first_call_this_thread_p}
Tobias Burnus [Wed, 23 Nov 2022 10:42:42 +0000 (11:42 +0100)] 
gcn: Add __builtin_gcn_{get_stack_limit,first_call_this_thread_p}

The new builtins have been added for newlib to reduce dependency on
compiler-internal implementation choices of GCC in newlibs' getreent.c.

gcc/ChangeLog:

* config/gcn/gcn-builtins.def (FIRST_CALL_THIS_THREAD_P,
GET_STACK_LIMIT): Add new builtins.
* config/gcn/gcn.cc (gcn_expand_builtin_1): Expand them.
* config/gcn/gcn.md (prologue_use): Add "register_operand" as
arg to match_operand.
(prologue_use_di): New; DI insn_and_split variant of the former.

Co-Authored-By: Andrew Stubbs <ams@codesourcery.com>
(cherry picked from commit d6bbca7b78745915d98bb1324d79de6a1e6dc801)

2 years agoDaily bump.
GCC Administrator [Wed, 23 Nov 2022 00:21:13 +0000 (00:21 +0000)] 
Daily bump.

2 years agolibstdc++: Add workaround for fs::path constraint recursion [PR106201]
Jonathan Wakely [Tue, 22 Nov 2022 18:15:56 +0000 (18:15 +0000)] 
libstdc++: Add workaround for fs::path constraint recursion [PR106201]

This works around a compiler bug where overload resolution attempts
implicit conversion to path in order to call a function with a path&
parameter. Such conversion would produce a prvalue, which would not be
able to bind to the lvalue reference anyway. Attempting to check the
conversion causes a constraint recursion because the arguments to the
path constructor are checked to see if they're iterators, which checks
if they're swappable, which tries to use the swap function that
triggered the conversion in the first place.

This replaces the swap function with an abbreviated function template
that is constrained with same_as<path> auto& so that the invalid
conversion is never considered.

libstdc++-v3/ChangeLog:

PR libstdc++/106201
* include/bits/fs_path.h (filesystem::swap(path&, path&)):
Replace with abbreviated function template.
* include/experimental/bits/fs_path.h (filesystem::swap):
Likewise.
* testsuite/27_io/filesystem/iterators/106201.cc: New test.
* testsuite/experimental/filesystem/iterators/106201.cc: New test.

2 years agolibstdc++: Fix pool resource build errors for H8 [PR107801]
Jonathan Wakely [Tue, 22 Nov 2022 09:53:36 +0000 (09:53 +0000)] 
libstdc++: Fix pool resource build errors for H8 [PR107801]

The array of pool sizes was previously adjusted to work for msp430-elf
which has 16-bit int and either 16-bit size_t or 20-bit size_t. The
largest pool sizes were disabled unless size_t has more than 20 bits.

The H8 family has 16-bit int but 32-bit size_t, which means that the
largest sizes are enabled, but 1<<15 produces a negative number that
then cannot be narrowed to size_t.

Replace the test for 32-bit size_t with a test for 32-bit int, which
means we won't use the 4kiB to 4MiB pools for targets with 16-bit int
even if they have a wider size_t.

libstdc++-v3/ChangeLog:

PR libstdc++/107801
* src/c++17/memory_resource.cc (pool_sizes): Disable large pools
for targets with 16-bit int.

(cherry picked from commit 0f9659e770304d3c44cfa0e793833a461bc487aa)

2 years agoDaily bump.
GCC Administrator [Tue, 22 Nov 2022 00:21:37 +0000 (00:21 +0000)] 
Daily bump.

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Mon, 21 Nov 2022 14:27:57 +0000 (15:27 +0100)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-8924-ga6b1f6126de5e45777610699b6d634605c17711c (21st Nov 2022)

2 years agolibgomp/gcn: fix/improve struct output
Tobias Burnus [Mon, 21 Nov 2022 14:25:48 +0000 (15:25 +0100)] 
libgomp/gcn: fix/improve struct output

output.printf_data.(value union) contains text[128], which has the size
of 128 bytes, sufficient for 16 uint64_t variables; hence value_u64[2]
could be extended to value_u64[6] - sufficient for all required arguments
to gomp_target_rev.  Additionally, next_output.printf_data.(msg union)
contained msg_u64 which then is no longer needed and also caused 32bit
vs 64bit alignment issues.

libgomp/
* config/gcn/libgomp-gcn.h (struct output):
Remove 'msg_u64' from the union, change
value_u64[2] to value_u64[6].
* config/gcn/target.c (GOMP_target_ext): Update accordingly.
* plugin/plugin-gcn.c (process_reverse_offload, console_output):
Likewise.

(cherry picked from commit 6edcb5dc42625cb0cf84b19c6fe4f944f6322ea0)

2 years agoi386: Uglify some local identifiers in *intrin.h [PR107748]
Jakub Jelinek [Mon, 21 Nov 2022 09:28:27 +0000 (10:28 +0100)] 
i386: Uglify some local identifiers in *intrin.h [PR107748]

While reporting PR107748 (where is a problem with non-uglified names,
but I've left it out because it needs fixing anyway), I've noticed
various spots where identifiers in *intrin.h headers weren't uglified.
The following patch fixed those that are related to unions (I've grepped
for [a-zA-Z]\.[a-zA-Z] spots).
The reason we need those to be uglified is the same as why the arguments
of the inlines are __ prefixed and most of automatic vars in the inlines
- say a, v or u aren't part of implementation namespace and so users could
 #define u whatever->something
 #include <x86intrin.h>
and it should still work, as long as u is not e.g. one of the names
of the functions/macros the header provides (_mm* etc.).

2022-11-21  Jakub Jelinek  <jakub@redhat.com>

PR target/107748
* config/i386/avx512fp16intrin.h (_mm512_castph512_ph128,
_mm512_castph512_ph256, _mm512_castph128_ph512,
_mm512_castph256_ph512, _mm512_set1_pch): Uglify names of local
variables and union members.
* config/i386/avx512fp16vlintrin.h (_mm256_castph256_ph128,
_mm256_castph128_ph256, _mm256_set1_pch, _mm_set1_pch): Likewise.
* config/i386/smmintrin.h (_mm_extract_ps): Likewise.
* config/i386/avx512bf16intrin.h (_mm_cvtsbh_ss): Likewise.

(cherry picked from commit ec8ec09f9414be871e322fecf4ebf53e3687bd22)

2 years agoDaily bump.
GCC Administrator [Mon, 21 Nov 2022 00:21:29 +0000 (00:21 +0000)] 
Daily bump.

2 years agoreg-stack: Fix a -fcompare-debug bug in reg-stack [PR107183]
Jakub Jelinek [Sun, 20 Nov 2022 16:42:42 +0000 (17:42 +0100)] 
reg-stack: Fix a -fcompare-debug bug in reg-stack [PR107183]

As the following testcase shows, the swap_rtx_condition function
in reg-stack can result in different code generation between -g and -g0.
The function is doing the changes as it goes, so does analysis and
changes together, which makes it harder to deal with DEBUG_INSNs,
where normally analysis phase ignores them and the later phase
doesn't.
swap_rtx_condition walks instructions two different ways, one is
using next_flags_user function which stops on non-call instructions
that mention the flags register, and the other is a loop on fnstsw
where it stops on instructions mentioning it and tries to find
sahf instruction that uses it (in both cases calls stop it and so
does end of basic block).
Now both of these currently stop on DEBUG_INSNs that mention
the flags register resp. the fnstsw result register.
On success the function recurses on next flags user instruction
if still live and if the recursion failed, reverts the changes
it did too and fails.
If it were just for the next_flags_user case, the fix could be
just not doing
      INSN_CODE (insn) = -1;
      if (recog_memoized (insn) == -1)
        fail = 1;
on DEBUG_INSNs (assuming all changes to those are fine),
swap_rtx_condition_1 just changes one comparison to a different
one.  But due to the possibility of fnstsw result being used
in theory before sahf in some DEBUG_INSNs, this patch takes
a different approach.  swap_rtx_condition has now a new argument
and two modes.  The first mode is when debug_seen is >= 0, in this
case both next_flags_user and the loop for fnstsw -> sahf will
ignore but note DEBUG_INSNs (that mention flags register or fnstsw
result).  If no such DEBUG_INSN is found during the whole call
including recursive invocations (so e.g. for -g0 but probably most
often for -g as well), it behaves as before, if it returns true
all the changes are done and nothing further needs to be done later.
If any DEBUG_INSNs are seen along the way, even when returning success
all the changes are reverted, so it just reports that the function
would be successful if DEBUG_INSNs were ignored.
In this case, compare_for_stack_reg needs to call it again in
debug_seen = -1 mode, which tells the function to update everything
including DEBUG_INSNs.  For the fnstsw -> sahf case which I hope
will be very rare I just reset the DEBUG_INSNs, I don't really
know how to express it easily otherwise.  For the rest
swap_rtx_condition_1 is done even on the DEBUG_INSNs.

2022-11-20  Jakub Jelinek  <jakub@redhat.com>

PR target/107183
* reg-stack.cc (next_flags_user): Add DEBUG_SEEN argument.
If >= 0 and a DEBUG_INSN would be otherwise returned, set
DEBUG_SEEN to 1 and ignore it.
(swap_rtx_condition): Add DEBUG_SEEN argument.  In >= 0
mode only set DEBUG_SEEN to 1 if problematic DEBUG_ISNSs
were seen and revert all changes on success in that case.
Don't try to recog_memoized DEBUG_INSNs.
(compare_for_stack_reg): Adjust swap_rtx_condition caller.
If it returns true and debug_seen is 1, call swap_rtx_condition
again with debug_seen -1.

* gcc.dg/ubsan/pr107183.c: New test.

(cherry picked from commit 6b5c98c1c0003bd470a4428bede6c862637a94b8)

2 years agoc++: Fix a typo in function name
Jakub Jelinek [Tue, 15 Nov 2022 07:17:11 +0000 (08:17 +0100)] 
c++: Fix a typo in function name

I've noticed I've made a typo in the name of the function.
Fixed thusly.

2022-11-15  Jakub Jelinek  <jakub@redhat.com>

* cp-tree.h (next_common_initial_seqence): Rename to ...
(next_common_initial_sequence): ... this.
* typeck.cc (next_common_initial_seqence): Rename to ...
(next_common_initial_sequence): ... this.
(layout_compatible_type_p): Call next_common_initial_sequence
rather than next_common_initial_seqence.
* semantics.cc (is_corresponding_member_aggr): Likewise.

(cherry picked from commit 87c4057b3fc7fe2c2f8914d2755024ca890a3bc1)

2 years agolibatomic: Handle AVX+CX16 AMD like Intel for 16b atomics [PR104688]
Jakub Jelinek [Tue, 15 Nov 2022 07:14:45 +0000 (08:14 +0100)] 
libatomic: Handle AVX+CX16 AMD like Intel for 16b atomics [PR104688]

We got a response from AMD in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104688#c10
so the following patch starts treating AMD with AVX and CMPXCHG16B
ISAs like Intel by using vmovdqa for atomic load/store in libatomic.
We still don't have confirmation from Zhaoxin and VIA (anything else
with CPUs featuring AVX and CX16?).

2022-11-15  Jakub Jelinek  <jakub@redhat.com>

PR target/104688
* config/x86/init.c (__libat_feat1_init): Don't clear
bit_AVX on AMD CPUs.

(cherry picked from commit 4a7a846687e076eae58ad3ea959245b2bf7fdc07)

2 years agolibgomp/gcn: Prepare for reverse-offload callback handling
Tobias Burnus [Sat, 19 Nov 2022 17:06:04 +0000 (18:06 +0100)] 
libgomp/gcn: Prepare for reverse-offload callback handling

libgomp/ChangeLog:

* config/gcn/libgomp-gcn.h: New file; contains
struct output, declared previously in plugin-gcn.c.
* config/gcn/target.c: Include it.
(GOMP_ADDITIONAL_ICVS): Declare as extern var.
(GOMP_target_ext): Handle reverse offload.
* plugin/plugin-gcn.c: Include libgomp-gcn.h.
(struct kernargs): Replace struct def by the one
from libgomp-gcn.h for output_data.
(process_reverse_offload): New.
(console_output): Call it.

(cherry picked from commit 8c05d8cd4300f74bf2698f0a6b96464b5be571be)

2 years agonvptx: In 'STARTFILE_SPEC', fix 'crt0.o' for '-mmainkernel'
Thomas Schwinge [Fri, 18 Nov 2022 22:57:52 +0000 (23:57 +0100)] 
nvptx: In 'STARTFILE_SPEC', fix 'crt0.o' for '-mmainkernel'

A recent nvptx-tools change: commit 886a95faf66bf66a82fc0fe7d2a9fd9e9fec2820
"ld: Don't search for input files in '-L'directories" (of
<https://github.com/MentorEmbedded/nvptx-tools/pull/38>
"Match standard 'ld' "search" behavior") in GCC/nvptx target testing
generally causes linking to fail with:

    error opening crt0.o
    collect2: error: ld returned 1 exit status
    compiler exited with status 1

Indeed per GCC '-v' output, there is an undecorated 'crt0.o' on the linker
('collect2') command line:

     [...]/build-gcc/./gcc/collect2 -o [...] crt0.o [...]

This is due to:

    gcc/config/nvptx/nvptx.h:#define STARTFILE_SPEC "%{mmainkernel:crt0.o}"

..., and the fix, as used by numerous other GCC targets, is to instead use
'crt0.o%s'; for '%s' means, per 'gcc/gcc.cc', "The Specs Language":

     %s     current argument is the name of a library or startup file of some sort.
            Search for that file in a standard list of directories
            and substitute the full name found.

With that, we get the expected path to 'crt0.o'.

gcc/
* config/nvptx/nvptx.h (STARTFILE_SPEC): Fix 'crt0.o' for
'-mmainkernel'.

(cherry picked from commit dda43e1ef0c9f6c32ad022d3a08ce7651e42a129)

2 years agoLoongArch: Fix atomic_exchange expanding [PR107713]
Jinyang He [Thu, 17 Nov 2022 06:38:52 +0000 (14:38 +0800)] 
LoongArch: Fix atomic_exchange expanding [PR107713]

We used to expand atomic_exchange_n(ptr, new, mem_order) for subword types
into something like:

    {
      __typeof__(*ptr) t = atomic_load_n(ptr, mem_order);
      atomic_compare_exchange_n(ptr, &t, new, true, mem_order, mem_order);
      return t;
    }

It's incorrect because another thread may store a different value into *ptr
after atomic_load_n.  Then atomic_compare_exchange_n will not store into
*ptr, but atomic_exchange_n should always perform the store.

gcc/ChangeLog:

PR target/107713
* config/loongarch/sync.md
(atomic_cas_value_exchange_7_<mode>): New define_insn.
(atomic_exchange): Use atomic_cas_value_exchange_7_si instead of
atomic_cas_value_cmp_and_7_si.

gcc/testsuite/ChangeLog:

PR target/107713
* gcc.target/loongarch/pr107713-1.c: New test.
* gcc.target/loongarch/pr107713-2.c: New test.

(cherry picked from commit f0024bfb228f94e60e06dc32a4983e40a9b90be5)

2 years agoDaily bump.
GCC Administrator [Fri, 18 Nov 2022 18:13:03 +0000 (18:13 +0000)] 
Daily bump.

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Fri, 18 Nov 2022 09:47:08 +0000 (10:47 +0100)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-8916-g14faa5f585f6025df1e04c8c8b34340ff5e4d494 (18th Nov 2022)

2 years agogcn: Add __builtin_gcn_kernarg_ptr
Tobias Burnus [Fri, 18 Nov 2022 09:46:48 +0000 (10:46 +0100)] 
gcn: Add __builtin_gcn_kernarg_ptr

Add __builtin_gcn_kernarg_ptr to avoid using hard-coded register values
and permit future ABI changes while keeping the API.

gcc/ChangeLog:

* config/gcn/gcn-builtins.def (KERNARG_PTR): Add.
* config/gcn/gcn.cc (gcn_init_builtin_types): Change siptr_type_node,
sfptr_type_node and voidptr_type_node from FLAT to ADDR_SPACE_DEFAULT.
(gcn_expand_builtin_1): Handle GCN_BUILTIN_KERNARG_PTR.
(gcn_oacc_dim_size): Return in ADDR_SPACE_FLAT.

libgomp/ChangeLog:

* config/gcn/team.c (gomp_gcn_enter_kernel): Use
__builtin_gcn_kernarg_ptr instead of asm ("s8").

Co-Authored-By: Andrew Stubbs <ams@codesourcery.com>
(cherry picked from commit 6f83861cc1c4d09425aa6539877bfa50ef90f183)

2 years agoc++: constinit on pointer to function [PR104066]
Marek Polacek [Thu, 17 Nov 2022 16:59:29 +0000 (11:59 -0500)] 
c++: constinit on pointer to function [PR104066]

[dcl.constinit]: "The constinit specifier shall be applied only to
a declaration of a variable with static or thread storage duration."

Thus, this ought to be OK:

  constinit void (*p)() = nullptr;

but the error message I introduced when implementing constinit was
not looking at funcdecl_p, so the code above was rejected.

Fixed thus.  I'm checking constinit_p first because I think that's
far more likely to be false than funcdecl_p.

PR c++/104066

gcc/cp/ChangeLog:

* decl.cc (grokdeclarator): Check funcdecl_p before complaining
about constinit.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/constinit18.C: New test.

(cherry picked from commit 7b3b2f50953c5143d4b14b59d322d8a793f411dd)

2 years agoDaily bump.
GCC Administrator [Thu, 17 Nov 2022 00:20:14 +0000 (00:20 +0000)] 
Daily bump.

2 years agoaarch64: Add support for Ampere-1A (-mcpu=ampere1a) CPU
Philipp Tomsich [Mon, 7 Nov 2022 13:22:21 +0000 (14:22 +0100)] 
aarch64: Add support for Ampere-1A (-mcpu=ampere1a) CPU

This patch adds support for Ampere-1A CPU:
 - recognize the name of the core and provide detection for -mcpu=native,
 - updated extra_costs,
 - adds a new fusion pair for (A+B+1 and A-B-1).

Ampere-1A and Ampere-1 have more timing difference than the extra
costs indicate, but these don't propagate through to the headline
items in our extra costs (e.g. the change in latency for scalar sqrt
doesn't have a corresponding table entry).

gcc/ChangeLog:

* config/aarch64/aarch64-cores.def (AARCH64_CORE): Add ampere1a.
* config/aarch64/aarch64-cost-tables.h: Add ampere1a_extra_costs.
* config/aarch64/aarch64-fusion-pairs.def (AARCH64_FUSION_PAIR):
Define a new fusion pair for A+B+1/A-B-1 (i.e., add/subtract two
registers and then +1/-1).
* config/aarch64/aarch64-tune.md: Regenerate.
* config/aarch64/aarch64.cc (aarch_macro_fusion_pair_p): Implement
idiom-matcher for the new fusion pair.
* doc/invoke.texi: Add ampere1a.

(cherry picked from commit 590a06afbf0e96813b5879742f38f3665512c854)

2 years agoSRA: Limit replacement creation for accesses propagated from LHSs
Martin Jambor [Wed, 16 Nov 2022 12:11:27 +0000 (13:11 +0100)] 
SRA: Limit replacement creation for accesses propagated from LHSs

PR 107206 is fallout from the fix to PR 92706 where we started
propagating accesses across assignments also from LHS to RHS of
assignments so that we would not do harmful total scalarization of the
aggregates on the RHS.

But this can lead to new scalarization of these aggregates and in the
testcase of PR 107206 these can appear in superfluous uses of
un-initialized values and spurious warnings.

Fixed by making sure the the accesses created by propagation in this
direction are only used as a basis for replacements when the structure
would be totally scalarized anyway.

gcc/ChangeLog:

2022-10-18  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/107206
* tree-sra.cc (struct access): New field grp_result_of_prop_from_lhs.
(analyze_access_subtree): Do not create replacements for accesses with
this flag when not toally scalarizing.
(propagate_subaccesses_from_lhs): Set the new flag.

gcc/testsuite/ChangeLog:

2022-10-18  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/107206
* g++.dg/tree-ssa/pr107206.C: New test.

(cherry picked from commit f6c168f8c06047bfaa3005e570126831b8855dcc)

2 years agonvptx/mkoffload.cc: Fix "$nohost" check
Tobias Burnus [Wed, 16 Nov 2022 10:19:46 +0000 (11:19 +0100)] 
nvptx/mkoffload.cc: Fix "$nohost" check

If lhd_set_decl_assembler_name is invoked - in particular if
!TREE_PUBLIC (decl) && !DECL_FILE_SCOPE_P (decl) - the '.nohost' suffix
might change to '.nohost.2'. This happens for the existing reverse offload
testcases via cgraph_node::analyze and is a side effect of
r13-3455-g178ac530fe67e4f2fc439cc4ce89bc19d571ca31 for some reason.

The solution is to not only check for a tailing '$nohost' but also for
'$nohost$' in nvptx/mkoffload.cc.

gcc/ChangeLog:

* config/nvptx/mkoffload.cc (process): Recognize '$nohost$...'
besides tailing '$nohost' as being for reverse offload.

(cherry picked from commit d59858f6ee7f356f27ccc2d29129826781f9483f)

2 years agoDaily bump.
GCC Administrator [Wed, 16 Nov 2022 00:20:28 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Tue, 15 Nov 2022 00:20:44 +0000 (00:20 +0000)] 
Daily bump.

2 years agolibstdc++: Fix std::move_only_function for incomplete parameter types
Jonathan Wakely [Tue, 18 Oct 2022 19:49:42 +0000 (20:49 +0100)] 
libstdc++: Fix std::move_only_function for incomplete parameter types

The std::move_only_function::__param_t alias template attempts to
optimize argument passing for the invoker, by passing by rvalue
reference for types that are non-trivial or large. However, the
precondition for is_trivally_copyable makes it unsuitable for using
here, and can cause ODR violations. Just use is_scalar instead, and pass
all class types (even small, trivial ones) by value.

libstdc++-v3/ChangeLog:

* include/bits/mofunc_impl.h (move_only_function::__param_t):
Use __is_scalar instead of is_trivially_copyable.
* testsuite/20_util/move_only_function/call.cc: Check parameters
involving incomplete types.

2 years agolibstdc++: Fix wstring conversions in filesystem::path [PR95048]
Jonathan Wakely [Fri, 11 Nov 2022 15:22:02 +0000 (15:22 +0000)] 
libstdc++: Fix wstring conversions in filesystem::path [PR95048]

In commit r9-7381-g91756c4abc1757 I changed filesystem::path to use
std::codecvt<CharT, char, mbstate_t> for conversions from all wide
strings to UTF-8, instead of using std::codecvt_utf8<CharT>. This was
done because for 16-bit wchar_t, std::codecvt_utf8<wchar_t> only
supports UCS-2 and not UTF-16. The rationale for the change was sound,
but the actual fix was not. It's OK to use std::codecvt for char16_t or
char32_t, because the specializations for those types always use UTF-8 ,
but std::codecvt<wchar_t, char, mbstate_t> uses the current locale's
encodings, and the narrow encoding is probably ASCII and can't support
non-ASCII characters.

The correct fix is to use std::codecvt only for char16_t and char32_t.
For 32-bit wchar_t we could have continued using std::codecvt_utf8
because that uses UTF-32 which is fine, switching to std::codecvt broke
non-Windows targets with 32-bit wchar_t. For 16-bit wchar_t we did need
to change, but should have changed to std::codecvt_utf8_utf16<wchar_t>
instead, as that always uses UTF-16 not UCS-2. I actually noted that in
the commit message for r9-7381-g91756c4abc1757 but didn't use that
option. Oops.

This replaces the unconditional std::codecvt<CharT, char, mbstate_t>
with a type defined via template specialization, so it can vary
depending on the wide character type. The code is also simplified to
remove some of the mess of #ifdef and if-constexpr conditions.

libstdc++-v3/ChangeLog:

PR libstdc++/95048
* include/bits/fs_path.h (path::_Codecvt): New class template
that selects the kind of code conversion done.
(path::_Codecvt<wchar_t>): Select based on sizeof(wchar_t).
(_GLIBCXX_CONV_FROM_UTF8): New macro to allow the same code to
be used for Windows and POSIX.
(path::_S_convert(const EcharT*, const EcharT*)): Simplify by
using _Codecvt and _GLIBCXX_CONV_FROM_UTF8 abstractions.
(path::_S_str_convert(basic_string_view<value_type>, const A&)):
Simplify nested conditions.
* include/experimental/bits/fs_path.h (path::_Cvt): Define
nested typedef controlling type of code conversion done.
(path::_Cvt::_S_wconvert): Use new typedef.
(path::string(const A&)): Likewise.
* testsuite/27_io/filesystem/path/construct/95048.cc: New test.
* testsuite/experimental/filesystem/path/construct/95048.cc: New
test.

(cherry picked from commit b331bf303bdc1edead41e2b3d11d1a7804b433cf)

2 years agolibstdc++: Set active union member in constexpr std::string [PR103295]
Nathaniel Shead [Fri, 11 Nov 2022 11:23:31 +0000 (22:23 +1100)] 
libstdc++: Set active union member in constexpr std::string [PR103295]

Clang still complains about using std::string in constexpr contexts due
to the changes made in commit 98a0d72a. This patch ensures that we set
the active member of the union as according to [class.union.general] p6.

libstdc++-v3/ChangeLog:

PR libstdc++/103295
* include/bits/basic_string.h (_M_use_local_data): Set active
member to _M_local_buf.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
(cherry picked from commit 52672be7d328df50f9a05ce3ab44ebcae50fee1b)

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Mon, 14 Nov 2022 08:15:43 +0000 (09:15 +0100)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-8907-g58da1386d2233b8e01aaac8f7c4a61a2ccf52743 (14th Nov 2022)

2 years agolibgomp: Fix up build on mingw [PR107641]
Jakub Jelinek [Mon, 14 Nov 2022 08:15:08 +0000 (09:15 +0100)] 
libgomp: Fix up build on mingw [PR107641]

Pointers should be first casted to intptr_t/uintptr_t before casting
them to another integral type to avoid warnings.
Furthermore, the function has code like
  else if (upper <= UINT_MAX)
    something;
  else
    something_else;
so it seems using unsigned type for upper where upper <= UINT_MAX is always
true is not intended.

2022-11-12  Jakub Jelinek  <jakub@redhat.com>

PR libgomp/107641
* env.c (parse_unsigned_long): Cast params[2] to uintptr_t rather than
unsigned long.  Change type of upper from unsigned to unsigned long.

(cherry picked from commit 2a193e9df82917eaf440a20f99a3febe91dcb5fe)

2 years agoDaily bump.
GCC Administrator [Mon, 14 Nov 2022 00:21:14 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sun, 13 Nov 2022 00:21:21 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 12 Nov 2022 00:21:12 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Fri, 11 Nov 2022 00:20:37 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Thu, 10 Nov 2022 00:23:52 +0000 (00:23 +0000)] 
Daily bump.

2 years agoAdd guality testcase for RTL alias analysis fix
Eric Botcazou [Wed, 9 Nov 2022 11:27:34 +0000 (12:27 +0100)] 
Add guality testcase for RTL alias analysis fix

gcc/testsuite/
* gcc.dg/guality/param-6.c: New test.

2 years agoRestore RTL alias analysis for hard frame pointer
Eric Botcazou [Sat, 29 Oct 2022 08:16:18 +0000 (10:16 +0200)] 
Restore RTL alias analysis for hard frame pointer

The change:

2021-07-28  Bin Cheng  <bin.cheng@linux.alibaba.com>

alias.c (init_alias_analysis): Don't skip prologue/epilogue.

broke the alias analysis for the hard frame pointer (when it is used as a
frame pointer, i.e. when the frame pointer is not eliminated) described in
the large comment at the top of the file, because static_reg_base_value is
set for it and, consequently, new_reg_base_value too.

When the instruction saving the stack pointer into the hard frame pointer in
the prologue is processed, it is viewed as a second set of the hard frame
pointer and to a different value by record_set, which then proceeds to reset
new_reg_base_value to 0 and the game is over.

gcc/
* alias.cc (init_alias_analysis): Do not record sets to the hard
frame pointer if the frame pointer has not been eliminated.

2 years agoDaily bump.
GCC Administrator [Wed, 9 Nov 2022 00:23:44 +0000 (00:23 +0000)] 
Daily bump.

2 years agoAlways use TYPE_MODE instead of DECL_MODE for vector field
H.J. Lu [Wed, 19 Oct 2022 19:53:35 +0000 (12:53 -0700)] 
Always use TYPE_MODE instead of DECL_MODE for vector field

e034c5c8957 re PR target/78643 (ICE in convert_move, at expr.c:230)

fixed the case where DECL_MODE of a vector field is BLKmode and its
TYPE_MODE is a vector mode because of target attribute.  Remove the
BLKmode check for the case where DECL_MODE of a vector field is a vector
mode and its TYPE_MODE isn't a vector mode because of target attribute.

gcc/

PR target/107304
* expr.cc (get_inner_reference): Always use TYPE_MODE for vector
field with vector raw mode.

gcc/testsuite/

PR target/107304
* gcc.target/i386/pr107304.c: New test.

(cherry picked from commit 1c64aba8cdf6509533f554ad86640f274cdbe37f)

2 years agolibstdc++: Remove empty <author> elements in manual
Jonathan Wakely [Mon, 7 Nov 2022 22:27:08 +0000 (22:27 +0000)] 
libstdc++: Remove empty <author> elements in manual

This fixes a spurious comma before the list of authors in the PDF
version of the libstdc++ manual.

Also fix the commented-out examples which should show <personblurb> not
<authorblurb>.

libstdc++-v3/ChangeLog:

* doc/xml/authors.xml: Remove empty author element.
* doc/xml/manual/spine.xml: Likewise.
* doc/html/manual/index.html: Regenerate.

(cherry picked from commit 4596339d9fabdcbd66b5a7430fa56544f75ecef1)

2 years agoDaily bump.
GCC Administrator [Tue, 8 Nov 2022 00:21:57 +0000 (00:21 +0000)] 
Daily bump.

2 years agoamdgcn: Fix expansion of GCN_BUILTIN_LDEXPV builtin
Kwok Cheung Yeung [Mon, 7 Nov 2022 13:11:33 +0000 (13:11 +0000)] 
amdgcn: Fix expansion of GCN_BUILTIN_LDEXPV builtin

2022-11-07  Kwok Cheung Yeung  <kcy@codesourcery.com>

gcc/
* config/gcn/gcn.cc (gcn_expand_builtin_1): Expand first argument
of GCN_BUILTIN_LDEXPV to V64DFmode.

2 years agoamdgcn: Various fixes for SIMD math library
Kwok Cheung Yeung [Mon, 7 Nov 2022 12:28:23 +0000 (12:28 +0000)] 
amdgcn: Various fixes for SIMD math library

Fix an error if VECTOR_RETURN is used on a constant.
Simplify the implementation of ilogb by removing VECTOR_IFs with a trivial
body.

2022-11-07  Kwok Cheung Yeung  <kcy@codesourcery.com>

libgcc/
* config/gcn/simd-math/amdgcnmach.h (VECTOR_RETURN): Store value of
return value in a local variable first.
* config/gcn/simd-math/v64df_ilogb.c (ilogb): Simplify.

2 years agoamdgcn: Fixed intermittent failure in vectorized version of rint
Kwok Cheung Yeung [Mon, 7 Nov 2022 12:17:08 +0000 (12:17 +0000)] 
amdgcn: Fixed intermittent failure in vectorized version of rint

The lane mask was not being updated properly in nested conditionals.
Also fixed an issue causing inaccuracy in double-precision rint.

2022-11-07  Kwok Cheung Yeung  <kcy@codesourcery.com>

libgcc/
* config/gcn/simd-math/v64df_rint.c (rint): Simplified.  Fixed bug in
nested VECTOR_IF.  Fixed issue with signed right-shift.
* config/gcn/simd-math/v64sf_rint.c (rintf): Simplified.  Fixed bug in
nested VECTOR_IF.

2 years agoRemove AVX512_VP2INTERSECT from PTA_SAPPHIRERAPIDS
Cui,Lili [Mon, 7 Nov 2022 03:25:41 +0000 (11:25 +0800)] 
Remove AVX512_VP2INTERSECT from PTA_SAPPHIRERAPIDS

gcc/ChangeLog:

* config/i386/driver-i386.cc (host_detect_local_cpu):
Move sapphirerapids out of AVX512_VP2INTERSECT.
* config/i386/i386.h: Remove AVX512_VP2INTERSECT from PTA_SAPPHIRERAPIDS
* doc/invoke.texi: Remove AVX512_VP2INTERSECT from SAPPHIRERAPIDS

2 years agoDaily bump.
GCC Administrator [Mon, 7 Nov 2022 00:20:45 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sun, 6 Nov 2022 11:09:16 +0000 (11:09 +0000)] 
Daily bump.

2 years agodoc: Document correct -fwide-exec-charset defaults [PR41041]
Jonathan Wakely [Fri, 4 Nov 2022 12:10:32 +0000 (12:10 +0000)] 
doc: Document correct -fwide-exec-charset defaults [PR41041]

As shown in the PR, the default is not UTF-32 but rather UTF-32BE or
UTF-32LE, avoiding the need for a byte order mark in literals.

gcc/ChangeLog:

PR c/41041
* doc/cppopts.texi: Document -fwide-exec-charset defaults
correctly.

(cherry picked from commit e50ea3a42f058c14ee29327d5277ab0435e3d36b)

2 years agoFix recent thinko in operand_equal_p
Eric Botcazou [Fri, 4 Nov 2022 10:23:12 +0000 (11:23 +0100)] 
Fix recent thinko in operand_equal_p

There is a thinko in a recent improvement made to operand_equal_p where
the code just looks at operand 2 of COMPONENT_REF, if it is present, to
compare addresses.  That's wrong because operand 2 contains the number of
DECL_OFFSET_ALIGN-bit-sized words so, when DECL_OFFSET_ALIGN > 8, not all
the  bytes are included and some of them are in DECL_FIELD_BIT_OFFSET, see
get_inner_reference for the model computation.

In other words, you would need to compare operand 2 and DECL_OFFSET_ALIGN
and DECL_FIELD_BIT_OFFSET in this situation, but I'm not sure this is worth
the hassle in practice so the fix just removes this alternate handling.

gcc/
* fold-const.cc (operand_compare::operand_equal_p) <COMPONENT_REF>:
Do not take into account operand 2.
(operand_compare::hash_operand) <COMPONENT_REF>: Likewise.

gcc/testsuite/
* gnat.dg/opt99.adb: New test.
* gnat.dg/opt99_pkg1.ads, gnat.dg/opt99_pkg1.adb: New helper.
* gnat.dg/opt99_pkg2.ads: Likewise.

2 years agoAlign with: "OpenMP/Fortran: 'target update' with DT components"
Tobias Burnus [Fri, 4 Nov 2022 10:20:24 +0000 (11:20 +0100)] 
Align with: "OpenMP/Fortran: 'target update' with DT components"

This commit partially undos the OG12 commit
   cb934e37962eeccc8641982b9a9855408979c767
   OpenMP/Fortran: 'target update' with strides + DT components
to match the mainline (GCC 13) version:
   r13-3625-g6629444170f85e9b1e243aa07e3e07a8b9f8fce5
   OpenMP/Fortran: 'target update' with DT components

The difference is that strides are not permitted in the mainline
version; for the reason and to-do, see: https://gcc.gnu.org/PR107517

Interdiff changelog:

2022-11-04  Tobias Burnus  <tobias@codesourcery.com>

gcc/fortran/ChangeLog.omp
        Partial Revert:
        2022-11-02  Tobias Burnus  <tobias@codesourcery.com>

        * openmp.cc (resolve_omp_clauses):Accept noncontiguous arrays.

libgomp/ChangeLog.omp

        * testsuite/libgomp.fortran/target-13.f90: Remove strides to match
        mainline (GCC 13) version.

(cherry picked from commit 6629444170f85e9b1e243aa07e3e07a8b9f8fce5)

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Fri, 4 Nov 2022 10:13:55 +0000 (11:13 +0100)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-8891-g14a92220a2f061328aae32ee6b5cdc7f62375902 (4th Nov 2022)

Note: This includes in principle some OpenMP/libgomp commits, but those have
been cherry picked already.

2 years agoDaily bump.
GCC Administrator [Fri, 4 Nov 2022 00:21:37 +0000 (00:21 +0000)] 
Daily bump.

2 years agoi386: Fix uninitialized register after peephole2 conversion [PR107404]
Uros Bizjak [Thu, 3 Nov 2022 13:17:42 +0000 (14:17 +0100)] 
i386: Fix uninitialized register after peephole2 conversion [PR107404]

The eliminate reg-reg move by inverting the condition of
a cmove #2 peephole2 converts the following sequence:

  473: bx:DI=[r14:DI*0x8+r12:DI]
  960: r15:DI=r8:DI
  485: {flags:CCC=cmp(r15:DI+bx:DI,bx:DI);r15:DI=r15:DI+bx:DI;}
  737: r15:DI={(geu(flags:CCC,0))?r15:DI:bx:DI}

to:

 1110: {flags:CCC=cmp(r8:DI+bx:DI,bx:DI);r8:DI=r8:DI+bx:DI;}
 1111: r15:DI=[r14:DI*0x8+r12:DI]
 1112: r15:DI={(geu(flags:CCC,0))?r8:DI:r15:DI}

Please note that(insn 1110) uses register BX, but its
initialization was eliminated.

Avoid conversion if eliminated move intialized a register, used
in the moved instruction.

2022-11-03  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

PR target/107404
* config/i386/i386.md (eliminate reg-reg move by inverting the
condition of a cmove #2 peephole2): Check if eliminated move
initialized a register, used in the moved instruction.

gcc/testsuite/ChangeLog:

PR target/107404
* g++.target/i386/pr107404.C: New test.

(cherry picked from commit 553b1d3dd5b9253ebdf66ee3260c717d5b807dd1)

2 years agoc, c++: Fix up excess precision handling of scalar_to_vector conversion [PR107358]
Jakub Jelinek [Mon, 24 Oct 2022 15:53:16 +0000 (17:53 +0200)] 
c, c++: Fix up excess precision handling of scalar_to_vector conversion [PR107358]

As mentioned earlier in the C++ excess precision support mail, the following
testcase is broken with excess precision both in C and C++ (though just in C++
it was triggered in real-world code).
scalar_to_vector is called in both FEs after the excess precision promotions
(or stripping of EXCESS_PRECISION_EXPR), so we can then get invalid
diagnostics that say float vector + float involves truncation (on ia32
from long double to float).

The following patch fixes that by calling scalar_to_vector on the operands
before the excess precision promotions, let scalar_to_vector just do the
diagnostics (it does e.g. fold_for_warn so it will fold
EXCESS_PRECISION_EXPR around REAL_CST to constants etc.) but will then
do the actual conversions using the excess precision promoted operands
(so say if we have vector double + (float + float) we don't actually do
vector double + (float) ((long double) float + (long double) float)
but
vector double + (double) ((long double) float + (long double) float)

2022-10-24  Jakub Jelinek  <jakub@redhat.com>

PR c++/107358
gcc/c/
* c-typeck.cc (build_binary_op): Pass operands before excess precision
promotions to scalar_to_vector call.
gcc/testsuite/
* c-c++-common/pr107358.c: New test.

(cherry picked from commit 65e3274e363cb2c6bfe6b5e648916eb7696f7e2f)

2 years agoc++: Fix up constexpr handling of char/signed char/short pre/post inc/decrement ...
Jakub Jelinek [Mon, 24 Oct 2022 14:25:29 +0000 (16:25 +0200)] 
c++: Fix up constexpr handling of char/signed char/short pre/post inc/decrement [PR105774]

signed char, char or short int pre/post inc/decrement are represented by
normal {PRE,POST}_{INC,DEC}REMENT_EXPRs in the FE and only gimplification
ensures that the {PLUS,MINUS}_EXPR is done in unsigned version of those
types:
    case PREINCREMENT_EXPR:
    case PREDECREMENT_EXPR:
    case POSTINCREMENT_EXPR:
    case POSTDECREMENT_EXPR:
      {
        tree type = TREE_TYPE (TREE_OPERAND (*expr_p, 0));
        if (INTEGRAL_TYPE_P (type) && c_promoting_integer_type_p (type))
          {
            if (!TYPE_OVERFLOW_WRAPS (type))
              type = unsigned_type_for (type);
            return gimplify_self_mod_expr (expr_p, pre_p, post_p, 1, type);
          }
        break;
      }
This means during constant evaluation we need to do it similarly (either
using unsigned_type_for or using widening to integer_type_node).
The following patch does the latter.

2022-10-24  Jakub Jelinek  <jakub@redhat.com>

PR c++/105774
* constexpr.cc (cxx_eval_increment_expression): For signed types
that promote to int, evaluate PLUS_EXPR or MINUS_EXPR in int type.

* g++.dg/cpp1y/constexpr-105774.C: New test.

(cherry picked from commit da8c362c4c18cff2f2dfd5c4706bdda7576899a4)

2 years agolibgomp: Fix up creation of artificial teams
Jakub Jelinek [Wed, 12 Oct 2022 15:54:08 +0000 (17:54 +0200)] 
libgomp: Fix up creation of artificial teams

When not in explicit parallel/target/teams construct, we in some cases create
an artificial parallel with a single thread (either to handle target nowait
or for task reduction purposes).  In those cases, it handled again artificially
created implicit task (created by gomp_new_icv for cases where we needed to write
to some ICVs), but as the testcases show, didn't take into account possibility
of this being done from explicit task(s).  The code would destroy/free the previous
task and replace it with the new implicit task.  If task is an explicit task
(when teams is NULL, all explicit tasks behave like if (0)), it is a pointer to
a local stack variable, so freeing it doesn't work, and additionally we shouldn't
lose the explicit tasks - the new implicit task should instead replace the
ancestor task which is the first implicit one.

2022-10-12  Jakub Jelinek  <jakub@redhat.com>

* task.c (gomp_create_artificial_team): Fix up handling of invocations
from within explicit task.
* target.c (GOMP_target_ext): Likewise.
* testsuite/libgomp.c/task-7.c: New test.
* testsuite/libgomp.c/task-8.c: New test.
* testsuite/libgomp.c-c++-common/task-reduction-17.c: New test.
* testsuite/libgomp.c-c++-common/task-reduction-18.c: New test.

(cherry picked from commit a58a965eb73253759f6a3e1c7380392557da89c8)

2 years agotree-cfg: Fix a verification diagnostic typo [PR107121]
Jakub Jelinek [Sun, 2 Oct 2022 14:42:32 +0000 (16:42 +0200)] 
tree-cfg: Fix a verification diagnostic typo [PR107121]

Obvious typo in diagnostics.

2022-10-02  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/107121
* tree-cfg.cc (verify_gimple_call): Fix a typo in diagnostics,
DEFFERED_INIT -> DEFERRED_INIT.

(cherry picked from commit d01bd0b0f3b8f4c33c437ff10f0b949200627f56)

2 years agoopenmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]
Jakub Jelinek [Sat, 24 Sep 2022 07:24:26 +0000 (09:24 +0200)] 
openmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]

The following testcase ICEs because with -O0 -fexceptions GOMP_taskgroup_end
call isn't directly followed by GOMP_RETURN statement, but there are some
conditionals to handle exceptions and we fail to find the correct GOMP_RETURN.

The fix is to treat taskgroup similarly to target data, both of these constructs
emit a try { body } finally { end_call } around the construct's body during
gimplification and we need to see proper construct nesting during gimplification
and omp lowering (including nesting of regions checks), but during omp expansion
we don't really need their nesting anymore, all we need is emit something at
the start of the region and the end of the region is the end API call we've
already emitted during gimplification.  For target data, we weren't adding
GOMP_RETURN statement during omp lowering, so after that pass it is treated
merely like stand-alone omp directives.  This patch does the same for
taskgroup too.

2022-09-24  Jakub Jelinek  <jakub@redhat.com>

PR c/107001
* omp-low.cc (lower_omp_taskgroup): Don't add GOMP_RETURN statement
at the end.
* omp-expand.cc (build_omp_regions_1): Clarify GF_OMP_TARGET_KIND_DATA
is not stand-alone directive.  For GIMPLE_OMP_TASKGROUP, also don't
update parent.
(omp_make_gimple_edges) <case GIMPLE_OMP_TASKGROUP>: Reset
cur_region back after new_omp_region.

* c-c++-common/gomp/pr107001.c: New test.

(cherry picked from commit ad2aab5c816a6fd56b46210c0a4a4c6243da1de9)

2 years agoopenmp, c: Tighten up c_tree_equal [PR106981]
Jakub Jelinek [Sat, 24 Sep 2022 07:19:26 +0000 (09:19 +0200)] 
openmp, c: Tighten up c_tree_equal [PR106981]

This patch changes c_tree_equal to work more like cp_tree_equal, be
more strict in what it accepts.  The ICE on the first testcase was
due to INTEGER_CST wi::wide (t1) == wi::wide (t2) comparison which
ICEs if the two constants have different precision, but as the second
testcase shows, being too lenient in it can also lead to miscompilation
of valid OpenMP programs where we think certain expression is the same
even when it isn't and can be guaranteed at runtime to represent different
memory location.  So, the patch looks through only NON_LVALUE_EXPRs
and for constants as well as casts requires that the types match before
actually comparing the constant values or recursing on the cast operands.

2022-09-24  Jakub Jelinek  <jakub@redhat.com>

PR c/106981
gcc/c/
* c-typeck.cc (c_tree_equal): Only strip NON_LVALUE_EXPRs at the
start.  For CONSTANT_CLASS_P or CASE_CONVERT: return false if t1 and
t2 have different types.
gcc/testsuite/
* c-c++-common/gomp/pr106981.c: New test.
libgomp/
* testsuite/libgomp.c-c++-common/pr106981.c: New test.

(cherry picked from commit 3c5bccb608c665ac3f62adb1817c42c845812428)

2 years agoopenmp: Fix handling of target constructs in static member functions [PR106829]
Jakub Jelinek [Wed, 7 Sep 2022 06:54:13 +0000 (08:54 +0200)] 
openmp: Fix handling of target constructs in static member functions [PR106829]

Just calling current_nonlambda_class_type in static member functions returns
non-NULL, but something that isn't *this and if unlucky can match part of the
IL and can be added to target clauses.
      if (DECL_NONSTATIC_MEMBER_P (decl)
          && current_class_ptr)
is a guard used elsewhere (in check_accessibility_of_qualified_id).

2022-09-07  Jakub Jelinek  <jakub@redhat.com>

PR c++/106829
* semantics.cc (finish_omp_target_clauses): If current_function_decl
isn't a nonstatic member function, don't set data.current_object to
non-NULL.

* g++.dg/gomp/pr106829.C: New test.

(cherry picked from commit e90af965e5c858ba02c0cdfbac35d0a19da1c2f6)

2 years agoDaily bump.
GCC Administrator [Thu, 3 Nov 2022 00:20:46 +0000 (00:20 +0000)] 
Daily bump.

2 years agoFortran "declare create"/allocate support for OpenACC: adjust 'libgomp.oacc-fortran...
Thomas Schwinge [Wed, 2 Nov 2022 15:50:33 +0000 (16:50 +0100)] 
Fortran "declare create"/allocate support for OpenACC: adjust 'libgomp.oacc-fortran/declare-allocatable-array_descriptor-1*.f90'

libgomp/
* testsuite/libgomp.oacc-fortran/declare-allocatable-array_descriptor-1-directive.f90:
Adjust.
* testsuite/libgomp.oacc-fortran/declare-allocatable-array_descriptor-1-runtime.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/declare-allocatable-array_descriptor-1.f90:
New.

2 years agoFortran "declare create"/allocate support for OpenACC: adjust 'libgomp.oacc-fortran...
Thomas Schwinge [Wed, 2 Nov 2022 15:49:13 +0000 (16:49 +0100)] 
Fortran "declare create"/allocate support for OpenACC: adjust 'libgomp.oacc-fortran/declare-allocatable-1*.f90'

libgomp/
* testsuite/libgomp.oacc-fortran/declare-allocatable-1-directive.f90:
Adjust.
* testsuite/libgomp.oacc-fortran/declare-allocatable-1-runtime.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/declare-allocatable-1.f90:
Likewise.

2 years agoXFAIL some OpenACC 'kernels' confusion in 'libgomp.oacc-fortran/declare-allocatable...
Thomas Schwinge [Wed, 2 Nov 2022 14:44:46 +0000 (15:44 +0100)] 
XFAIL some OpenACC 'kernels' confusion in 'libgomp.oacc-fortran/declare-allocatable-1*.f90'

Seen only for certain optimizations levels, as indicated; so there are a few
XPASSes otherwise.

There are neither OpenACC 'kernels' constructs here, nor other 'loop'
constructs with 'auto' clause, so I'm not sure what's going on.

libgomp/
* testsuite/libgomp.oacc-fortran/declare-allocatable-1-directive.f90:
XFAIL some OpenACC 'kernels' confusion.
* testsuite/libgomp.oacc-fortran/declare-allocatable-1-runtime.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/declare-allocatable-1.f90:
Likewise.

2 years agoSupport OpenACC 'declare create' with Fortran allocatable arrays, part II [PR106643...
Thomas Schwinge [Fri, 28 Oct 2022 13:06:45 +0000 (15:06 +0200)] 
Support OpenACC 'declare create' with Fortran allocatable arrays, part II [PR106643, PR96668]

PR libgomp/106643
PR fortran/96668
libgomp/
* oacc-mem.c (goacc_enter_data_internal): Support
OpenACC 'declare create' with Fortran allocatable arrays, part II.
* testsuite/libgomp.oacc-fortran/declare-allocatable-array_descriptor-1-directive.f90:
Adjust.
* testsuite/libgomp.oacc-fortran/pr106643-1.f90: New.

(cherry picked from commit f6ce1e77bbf5d3a096f52e674bfd7354c6537d10)

2 years agoSupport OpenACC 'declare create' with Fortran allocatable arrays, part I [PR106643]
Thomas Schwinge [Thu, 27 Oct 2022 19:52:07 +0000 (21:52 +0200)] 
Support OpenACC 'declare create' with Fortran allocatable arrays, part I [PR106643]

PR libgomp/106643
libgomp/
* oacc-mem.c (goacc_enter_data_internal): Support
OpenACC 'declare create' with Fortran allocatable arrays, part I.
* testsuite/libgomp.oacc-fortran/declare-allocatable-1-directive.f90:
New.
* testsuite/libgomp.oacc-fortran/declare-allocatable-array_descriptor-1-directive.f90:
New.

(cherry picked from commit da8e0e1191c5512244a752b30dea0eba83e3d10c)

2 years agoAdd 'libgomp.oacc-fortran/declare-allocatable-array_descriptor-1-runtime.f90'
Thomas Schwinge [Wed, 26 Oct 2022 21:47:29 +0000 (23:47 +0200)] 
Add 'libgomp.oacc-fortran/declare-allocatable-array_descriptor-1-runtime.f90'

libgomp/
* testsuite/libgomp.oacc-fortran/declare-allocatable-array_descriptor-1-runtime.f90:
New.

(cherry picked from commit abeaf3735fe2568b9d5b8096318da866b1fe1e5c)

2 years agoAdd 'libgomp.oacc-fortran/declare-allocatable-1-runtime.f90'
Thomas Schwinge [Fri, 14 Oct 2022 15:36:51 +0000 (17:36 +0200)] 
Add 'libgomp.oacc-fortran/declare-allocatable-1-runtime.f90'

... which is 'libgomp.oacc-fortran/declare-allocatable-1.f90' adjusted
for missing support for OpenACC "Changes from Version 2.0 to 2.5":
"The 'declare create' directive with a Fortran 'allocatable' has new behavior".
Thus, after 'allocate'/before 'deallocate', call 'acc_create'/'acc_delete'
manually.

libgomp/
* testsuite/libgomp.oacc-fortran/declare-allocatable-1-runtime.f90:
New.

(cherry picked from commit 59c6c5dbf267cd9d0a8df72b2a5eb5657b64268e)

2 years agoAdd 'libgomp.oacc-fortran/declare-allocatable-1.f90'
Cesar Philippidis [Wed, 5 Apr 2017 15:23:58 +0000 (08:23 -0700)] 
Add 'libgomp.oacc-fortran/declare-allocatable-1.f90'

libgomp/
* testsuite/libgomp.oacc-fortran/declare-allocatable-1.f90: New.

Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
(cherry picked from commit 8c357d884b16cb3c14cba8a61be5b53fd04a6bfe)

2 years agoFortran/OpenMP: Fix DT struct-component with 'alloc' and array descr
Tobias Burnus [Wed, 2 Nov 2022 16:04:53 +0000 (17:04 +0100)] 
Fortran/OpenMP: Fix DT struct-component with 'alloc' and array descr

When using 'map(alloc: var, dt%comp)' needs to have a 'to' mapping of
the array descriptor as otherwise the bounds are not available in the
target region. - Likewise for character strings.

This patch implements this; however, some additional issues are exposed
by the testcase; those are '#if 0'ed and will be handled later.

Submitted to mainline (but pending review):
https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604887.html

gcc/fortran/ChangeLog:

* trans-openmp.cc (gfc_trans_omp_clauses): Ensure DT struct-comp with
array descriptor and 'alloc:' have the descriptor mapped with 'to:'.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/target-enter-data-3.f90: New test.

2 years agolibgomp.c-c++-common/requires-4.c: Fix dg-xfail-run-if condition
Tobias Burnus [Wed, 2 Nov 2022 08:20:40 +0000 (09:20 +0100)] 
libgomp.c-c++-common/requires-4.c: Fix dg-xfail-run-if condition

Seemingly an extra { } is required. This is a follow up to
OG12 commit 0c47ae1c9283a812f832e80e451bfa82519c21e8

libgomp/
* testsuite/libgomp.c-c++-common/requires-4.c: Fix dg-xfail-run-if
condition.

2 years agoOpenMP/Fortran: 'target update' with strides + DT components
Tobias Burnus [Wed, 2 Nov 2022 08:06:28 +0000 (09:06 +0100)] 
OpenMP/Fortran: 'target update' with strides + DT components

OpenMP 5.0 permits to use arrays with strides and derived
type components for the list items to the 'from'/'to' clauses
of the 'target update' directive.

Submitted to mainline (but pending review):
https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604687.html

gcc/fortran/ChangeLog:

* openmp.cc (gfc_match_omp_clauses): Permit derived types.
(resolve_omp_clauses):Accept noncontiguous
arrays.
* trans-openmp.cc (gfc_trans_omp_clauses): Fixes for
derived-type changes; fix size for scalars.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/target-11.f90: New test.
* testsuite/libgomp.fortran/target-13.f90: New test.

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Wed, 2 Nov 2022 07:40:39 +0000 (08:40 +0100)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-8881-gb80a690673272919896ee5939250e50d882f2418 (2nd Nov 2022)

2 years agoamdgcn: Enable SIMD vectorization of math functions
Kwok Cheung Yeung [Tue, 1 Nov 2022 22:50:30 +0000 (22:50 +0000)] 
amdgcn: Enable SIMD vectorization of math functions

Calls to vectorized versions of routines in the math library will now
be inserted when vectorizing code containing supported math functions.

2022-11-01  Kwok Cheung Yeung  <kcy@codesourcery.com>
    Paul-Antoine Arras  <pa@codesourcery.com>

gcc/
* builtins.cc (mathfn_built_in_explicit): New.
* config/gcn/gcn.cc: Include case-cfn-macros.h.
(mathfn_built_in_explicit): Add prototype.
(gcn_vectorize_builtin_vectorized_function): New.
(gcn_libc_has_function): New.
(TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION): Define.
(TARGET_LIBC_HAS_FUNCTION): Define.

gcc/testsuite/
* gcc.target/gcn/simd-math-1.c: New testcase.

libgomp/
* testsuite/libgomp.c/simd-math-1.c: New testcase.

2 years agoamdgcn: Add SIMD versions of math routines to libgcc
Kwok Cheung Yeung [Tue, 1 Nov 2022 22:42:40 +0000 (22:42 +0000)] 
amdgcn: Add SIMD versions of math routines to libgcc

These should eventually be moved into Newlib.

2022-11-01  Kwok Cheung Yeung  <kcy@codesourcery.com>
    Paul-Antoine Arras  <pa@codesourcery.com>
    Andrew Jenner  <andrew@codesourcery.com>

libgcc/
* config.host: Add t-simdmath for GCN if header files present.
* config/gcn/simd-math/amdgcnmach.h: New.
* config/gcn/simd-math/v64_mathcnst.c: New.
* config/gcn/simd-math/v64_reent.c: New.
* config/gcn/simd-math/v64df_acos.c: New.
* config/gcn/simd-math/v64df_acosh.c: New.
* config/gcn/simd-math/v64df_asin.c: New.
* config/gcn/simd-math/v64df_asine.c: New.
* config/gcn/simd-math/v64df_asinh.c: New.
* config/gcn/simd-math/v64df_atan.c: New.
* config/gcn/simd-math/v64df_atan2.c: New.
* config/gcn/simd-math/v64df_atangent.c: New.
* config/gcn/simd-math/v64df_atanh.c: New.
* config/gcn/simd-math/v64df_copysign.c: New.
* config/gcn/simd-math/v64df_cos.c: New.
* config/gcn/simd-math/v64df_cosh.c: New.
* config/gcn/simd-math/v64df_erf.c: New.
* config/gcn/simd-math/v64df_exp.c: New.
* config/gcn/simd-math/v64df_exp2.c: New.
* config/gcn/simd-math/v64df_finite.c: New.
* config/gcn/simd-math/v64df_fmod.c: New.
* config/gcn/simd-math/v64df_gamma.c: New.
* config/gcn/simd-math/v64df_hypot.c: New.
* config/gcn/simd-math/v64df_ilogb.c: New.
* config/gcn/simd-math/v64df_isnan.c: New.
* config/gcn/simd-math/v64df_ispos.c: New.
* config/gcn/simd-math/v64df_lgamma.c: New.
* config/gcn/simd-math/v64df_lgamma_r.c: New.
* config/gcn/simd-math/v64df_log.c: New.
* config/gcn/simd-math/v64df_log10.c: New.
* config/gcn/simd-math/v64df_log2.c: New.
* config/gcn/simd-math/v64df_modf.c: New.
* config/gcn/simd-math/v64df_numtest.c: New.
* config/gcn/simd-math/v64df_pow.c: New.
* config/gcn/simd-math/v64df_remainder.c: New.
* config/gcn/simd-math/v64df_rint.c: New.
* config/gcn/simd-math/v64df_scalb.c: New.
* config/gcn/simd-math/v64df_scalbn.c: New.
* config/gcn/simd-math/v64df_signif.c: New.
* config/gcn/simd-math/v64df_sin.c: New.
* config/gcn/simd-math/v64df_sine.c: New.
* config/gcn/simd-math/v64df_sineh.c: New.
* config/gcn/simd-math/v64df_sinh.c: New.
* config/gcn/simd-math/v64df_sqrt.c: New.
* config/gcn/simd-math/v64df_tan.c: New.
* config/gcn/simd-math/v64df_tanh.c: New.
* config/gcn/simd-math/v64df_tgamma.c: New.
* config/gcn/simd-math/v64sf_acos.c: New.
* config/gcn/simd-math/v64sf_acosh.c: New.
* config/gcn/simd-math/v64sf_asin.c: New.
* config/gcn/simd-math/v64sf_asine.c: New.
* config/gcn/simd-math/v64sf_asinh.c: New.
* config/gcn/simd-math/v64sf_atan.c: New.
* config/gcn/simd-math/v64sf_atan2.c: New.
* config/gcn/simd-math/v64sf_atangent.c: New.
* config/gcn/simd-math/v64sf_atanh.c: New.
* config/gcn/simd-math/v64sf_copysign.c: New.
* config/gcn/simd-math/v64sf_cos.c: New.
* config/gcn/simd-math/v64sf_cosh.c: New.
* config/gcn/simd-math/v64sf_erf.c: New.
* config/gcn/simd-math/v64sf_exp.c: New.
* config/gcn/simd-math/v64sf_exp2.c: New.
* config/gcn/simd-math/v64sf_finite.c: New.
* config/gcn/simd-math/v64sf_fmod.c: New.
* config/gcn/simd-math/v64sf_gamma.c: New.
* config/gcn/simd-math/v64sf_hypot.c: New.
* config/gcn/simd-math/v64sf_ilogb.c: New.
* config/gcn/simd-math/v64sf_isnan.c: New.
* config/gcn/simd-math/v64sf_ispos.c: New.
* config/gcn/simd-math/v64sf_lgamma.c: New.
* config/gcn/simd-math/v64sf_lgamma_r.c: New.
* config/gcn/simd-math/v64sf_log.c: New.
* config/gcn/simd-math/v64sf_log10.c: New.
* config/gcn/simd-math/v64sf_log2.c: New.
* config/gcn/simd-math/v64sf_modf.c: New.
* config/gcn/simd-math/v64sf_numtest.c: New.
* config/gcn/simd-math/v64sf_pow.c: New.
* config/gcn/simd-math/v64sf_remainder.c: New.
* config/gcn/simd-math/v64sf_rint.c: New.
* config/gcn/simd-math/v64sf_scalb.c: New.
* config/gcn/simd-math/v64sf_scalbn.c: New.
* config/gcn/simd-math/v64sf_sin.c: New.
* config/gcn/simd-math/v64sf_sine.c: New.
* config/gcn/simd-math/v64sf_sineh.c: New.
* config/gcn/simd-math/v64sf_sinh.c: New.
* config/gcn/simd-math/v64sf_sqrt.c: New.
* config/gcn/simd-math/v64sf_tan.c: New.
* config/gcn/simd-math/v64sf_tanh.c: New.
* config/gcn/simd-math/v64sf_tgamma.c: New.
* config/gcn/t-simdmath: New.

2 years agoDaily bump.
GCC Administrator [Wed, 2 Nov 2022 00:20:29 +0000 (00:20 +0000)] 
Daily bump.

2 years agoamdgcn: Add builtins for vector floor/floorf
Kwok Cheung Yeung [Tue, 1 Nov 2022 22:56:54 +0000 (22:56 +0000)] 
amdgcn: Add builtins for vector floor/floorf

2022-11-01  Kwok Cheung Yeung  <kcy@codesourcery.com>

gcc/
* config/gcn/gcn-builtins.def (FLOORVF): New builtin.
(FLOORV): New builtin.
* config/gcn/gcn.cc (gcn_expand_builtin_1): Expand GCN_BUILTIN_FLOORVF
and GCN_BUILTIN_FLOORV.

2 years agoamdgcn: Fix expansion of builtin for vector fabs operation
Kwok Cheung Yeung [Tue, 1 Nov 2022 23:05:44 +0000 (23:05 +0000)] 
amdgcn: Fix expansion of builtin for vector fabs operation

2022-11-01  Kwok Cheung Yeung  <kcy@codesourcery.com>

* config/gcn/gcn.cc (gcn_expand_builtin_1): Fix expansion of
GCN_BUILTIN_FABSV.