]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
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.

2 years agoopenmp: Bugfix in omp_expand_metadirective for same blocks/edges to be deleted.
Marcel Vollweiler [Tue, 1 Nov 2022 13:05:18 +0000 (13:05 +0000)] 
openmp: Bugfix in omp_expand_metadirective for same blocks/edges to be deleted.

This patch handles an ICE that is thrown in omp_expand_metadirective when a
basic_block for a metadirective label is tried to be deleted multiple times.
To avoid this situation, processed labels are added to the already existing
list of labels that are not intended to be deleted.

The issue occured in the attached test case.

gcc/ChangeLog:

* omp-expand-metadirective.cc (omp_expand_metadirective): Add already
processed labels to "labels" (the list of labels not to be deleted).

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/metadirective-8.c: New test.

2 years agoamdgcn: add fmin/fmax patterns
Andrew Stubbs [Fri, 28 Oct 2022 12:09:20 +0000 (13:09 +0100)] 
amdgcn: add fmin/fmax patterns

Add fmin/fmax for scalar, vector, and reductions.  The smin/smax patterns are
already using the IEEE compliant hardware instructions anyway, so we can just
expand to use those insns.

gcc/ChangeLog:

* config/gcn/gcn-valu.md (fminmaxop): New iterator.
(<fexpander><mode>3): New define_expand.
(<fexpander><mode>3<exec>): Likewise.
(reduc_<fexpander>_scal_<mode>): Likewise.
* config/gcn/gcn.md (fexpander): New attribute.

(cherry picked from commit 10aa0356118f44e5f4d720a2a4c731b173baa298)

2 years agoamdgcn: multi-size vector reductions
Andrew Stubbs [Fri, 28 Oct 2022 11:38:43 +0000 (12:38 +0100)] 
amdgcn: multi-size vector reductions

Add support for vector reductions for any vector width by switching iterators
and generalising the code slightly.  There's no one-instruction way to move an
item from lane 31 to lane 0 (63, 15, 7, 3, and 1 are all fine though), and
vec_extract is probably fewer cycles anyway, so now we always reduce to an
SGPR.

gcc/ChangeLog:

* config/gcn/gcn-valu.md (V64_SI): Delete iterator.
(V64_DI): Likewise.
(V64_1REG): Likewise.
(V64_INT_1REG): Likewise.
(V64_2REG): Likewise.
(V64_ALL): Likewise.
(V64_FP): Likewise.
(reduc_<reduc_op>_scal_<mode>): Use V_ALL. Use gen_vec_extract.
(fold_left_plus_<mode>): Use V_FP.
(*<reduc_op>_dpp_shr_<mode>): Use V_1REG.
(*<reduc_op>_dpp_shr_<mode>): Use V_DI.
(*plus_carry_dpp_shr_<mode>): Use V_INT_1REG.
(*plus_carry_in_dpp_shr_<mode>): Use V_SI.
(*plus_carry_dpp_shr_<mode>): Use V_DI.
(mov_from_lane63_<mode>): Delete.
(mov_from_lane63_<mode>): Delete.
* config/gcn/gcn.cc (gcn_expand_reduc_scalar): Support partial vectors.
* config/gcn/gcn.md (unspec): Remove UNSPEC_MOV_FROM_LANE63.

(cherry picked from commit f539029c1ce6fb9163422d1a8b6ac12a2554eaa2)

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

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

2 years agoDaily bump.
GCC Administrator [Sun, 30 Oct 2022 00:19:54 +0000 (00:19 +0000)] 
Daily bump.

2 years agoFortran: Add missing TKR initialization to class variables [PR100097, PR100098]
José Rui Faustino de Sousa [Tue, 18 Oct 2022 20:29:59 +0000 (22:29 +0200)] 
Fortran: Add missing TKR initialization to class variables [PR100097, PR100098]

gcc/fortran/ChangeLog:

PR fortran/100097
PR fortran/100098
* trans-array.cc (gfc_trans_class_array): New function to
initialize class descriptor's TKR information.
* trans-array.h (gfc_trans_class_array): Add function prototype.
* trans-decl.cc (gfc_trans_deferred_vars): Add calls to the new
function for both pointers and allocatables.

gcc/testsuite/ChangeLog:

PR fortran/100097
PR fortran/100098
* gfortran.dg/PR100097.f90: New test.
* gfortran.dg/PR100098.f90: New test.

(cherry picked from commit 4cfdaeb2755121ac1069f09898def56469b0fb51)

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

2 years agoFortran: BOZ literal constants are not compatible to any type [PR103413]
Harald Anlauf [Wed, 26 Oct 2022 19:00:44 +0000 (21:00 +0200)] 
Fortran: BOZ literal constants are not compatible to any type [PR103413]

gcc/fortran/ChangeLog:

PR fortran/103413
* symbol.cc (gfc_type_compatible): A boz-literal-constant has no type
and thus is not considered compatible to any type.

gcc/testsuite/ChangeLog:

PR fortran/103413
* gfortran.dg/illegal_boz_arg_4.f90: New test.

(cherry picked from commit f7d28818179247685f3c101f9f2f16366f56309b)

2 years agoopenmp: Allow optional comma after directive-specifier in C/C++
Jakub Jelinek [Fri, 28 Oct 2022 09:03:56 +0000 (11:03 +0200)] 
openmp: Allow optional comma after directive-specifier in C/C++

Previously we've been allowing that comma only in C++ when in attribute
form (which was the reason why it has been allowed), but 5.1 allows that
even in pragma form in C/C++ (with clarifications in 5.2) and 5.2
also in Fortran (which this patch doesn't implement).

Note, for directives which take an argument (== unnamed clause),
comma is not allowed in between the directive name and the argument,
like the directive-1.c testcase shows.

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

gcc/c/
* c-parser.cc (c_parser_omp_all_clauses): Allow optional
comma before the first clause.
(c_parser_omp_allocate, c_parser_omp_atomic, c_parser_omp_depobj,
c_parser_omp_flush, c_parser_omp_scan_loop_body,
c_parser_omp_ordered, c_finish_omp_declare_variant,
c_parser_omp_declare_target, c_parser_omp_declare_reduction,
c_parser_omp_requires, c_parser_omp_error,
c_parser_omp_assumption_clauses): Likewise.
gcc/cp/
* parser.cc (cp_parser_omp_all_clauses): Allow optional comma
before the first clause even in pragma syntax.
(cp_parser_omp_allocate, cp_parser_omp_atomic, cp_parser_omp_depobj,
cp_parser_omp_flush, cp_parser_omp_scan_loop_body,
cp_parser_omp_ordered, cp_parser_omp_assumption_clauses,
cp_finish_omp_declare_variant, cp_parser_omp_declare_target,
cp_parser_omp_declare_reduction_exprs, cp_parser_omp_requires,
cp_parser_omp_error): Likewise.
gcc/testsuite/
* c-c++-common/gomp/directive-1.c: New test.
* c-c++-common/gomp/clauses-6.c: New test.
* c-c++-common/gomp/declare-variant-2.c (f75a): Declare.
(f75): Use f75a as variant instead of f1 and don't expect error.
* g++.dg/gomp/clause-4.C (foo): Don't expect error on comma
before first clause.
* gcc.dg/gomp/clause-2.c (foo): Likewise.

(cherry picked from commit 89999f2358724fa4e71c7c3b4de340582c0e43da)

2 years agoMerge commit '9b116c51a451995f1bae8fdac0748fcf3f06aafe'
Thomas Schwinge [Fri, 28 Oct 2022 08:46:23 +0000 (10:46 +0200)] 
Merge commit '9b116c51a451995f1bae8fdac0748fcf3f06aafe'

2 years ago[og12] OpenACC: Don't gang-privatize artificial variables: restrict to blocks: ChangeLog
Thomas Schwinge [Fri, 28 Oct 2022 08:43:24 +0000 (10:43 +0200)] 
[og12] OpenACC: Don't gang-privatize artificial variables: restrict to blocks: ChangeLog

... forgotten in og12 commit 9a50d282f03f7f1e1ad00de917143a2a8e0c0ee0
"[og12] OpenACC: Don't gang-privatize artificial variables: restrict to blocks".

2 years agoOpenACC: Don't gang-privatize artificial variables [PR90115]
Julian Brown [Wed, 12 Oct 2022 20:44:57 +0000 (20:44 +0000)] 
OpenACC: Don't gang-privatize artificial variables [PR90115]

This patch prevents compiler-generated artificial variables from being
treated as privatization candidates for OpenACC.

The rationale is that e.g. "gang-private" variables actually must be
shared by each worker and vector spawned within a particular gang, but
that sharing is not necessary for any compiler-generated variable (at
least at present, but no such need is anticipated either).  Variables on
the stack (and machine registers) are already private per-"thread"
(gang, worker and/or vector), and that's fine for artificial variables.

We're restricting this to blocks, as we still need to understand what it
means for a 'DECL_ARTIFICIAL' to appear in a 'private' clause.

Several tests need their scan output patterns adjusted to compensate.

2022-10-14  Julian Brown  <julian@codesourcery.com>

PR middle-end/90115
gcc/
* omp-low.cc (oacc_privatization_candidate_p): Artificial vars are not
privatization candidates.

libgomp/
* testsuite/libgomp.oacc-fortran/declare-1.f90: Adjust scan output.
* testsuite/libgomp.oacc-fortran/host_data-5.F90: Likewise.
* testsuite/libgomp.oacc-fortran/if-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/print-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise.

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

2 years ago[og12] OpenACC: Don't gang-privatize artificial variables: restrict to blocks
Thomas Schwinge [Tue, 18 Oct 2022 14:59:54 +0000 (16:59 +0200)] 
[og12] OpenACC: Don't gang-privatize artificial variables: restrict to blocks

Follow-up to og12 commit d4504346d2a1d6ffecb8b2d8e3e04ab8ea259785
"[og12] OpenACC: Don't gang-privatize artificial variables", to restore
the previous behavior, until we understand what it means for a
'DECL_ARTIFICIAL' to appear in a 'private' clause.

gcc/
* omp-low.cc (oacc_privatization_candidate_p) <DECL_ARTIFICIAL>:
Restrict to 'block's.
libgomp/
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Adjust.

2 years agoResolve '-Wsign-compare' issue in 'gcc/omp-low.cc:lower_rec_simd_input_clauses':...
Thomas Schwinge [Fri, 28 Oct 2022 07:55:22 +0000 (09:55 +0200)] 
Resolve '-Wsign-compare' issue in 'gcc/omp-low.cc:lower_rec_simd_input_clauses': ChangeLog

... forgotten in og12 commit 4e32d1582a137d5f34248fdd3e93d35a798f5221
"Resolve '-Wsign-compare' issue in 'gcc/omp-low.cc:lower_rec_simd_input_clauses'".

2 years agoResolve '-Wsign-compare' issue in 'gcc/omp-low.cc:lower_rec_simd_input_clauses'
Thomas Schwinge [Tue, 25 Oct 2022 07:45:31 +0000 (09:45 +0200)] 
Resolve '-Wsign-compare' issue in 'gcc/omp-low.cc:lower_rec_simd_input_clauses'

..., introduced in og12 commit 55722a87dd223149dcd41ca9c8eba16ad5b3eddc
"openmp: fix max_vf setting for amdgcn offloading":

    In file included from [...]/source-gcc/gcc/coretypes.h:482,
                     from [...]/source-gcc/gcc/omp-low.cc:27:
    [...]/source-gcc/gcc/poly-int.h: In instantiation of ‘typename if_nonpoly<Ca, bool>::type maybe_lt(const Ca&, const poly_int_pod<N, Cb>&) [with unsigned int N = 1; Ca = int; Cb = long unsigned int; typename if_nonpoly<Ca, bool>::type = bool]’:
    [...]/source-gcc/gcc/poly-int.h:1510:7:   required from ‘poly_int<N, typename poly_result<Ca, typename if_nonpoly<Cb>::type>::type> ordered_max(const poly_int_pod<N, C>&, const Cb&) [with unsigned int N = 1; Ca = long unsigned int; Cb = int; typename poly_result<Ca, typename if_nonpoly<Cb>::type>::type = long unsigned int; typename if_nonpoly<Cb>::type = int]’
    [...]/source-gcc/gcc/omp-low.cc:5180:33:   required from here
    [...]/source-gcc/gcc/poly-int.h:1384:12: error: comparison of integer expressions of different signedness: ‘const int’ and ‘const long unsigned int’ [-Werror=sign-compare]
     1384 |   return a < b.coeffs[0];
          |          ~~^~~~~~~~~~~
    [...]/source-gcc/gcc/poly-int.h: In instantiation of ‘typename if_nonpoly<Cb, bool>::type maybe_lt(const poly_int_pod<N, C>&, const Cb&) [with unsigned int N = 1; Ca = long unsigned int; Cb = int; typename if_nonpoly<Cb, bool>::type = bool]’:
    [...]/source-gcc/gcc/poly-int.h:1515:2:   required from ‘poly_int<N, typename poly_result<Ca, typename if_nonpoly<Cb>::type>::type> ordered_max(const poly_int_pod<N, C>&, const Cb&) [with unsigned int N = 1; Ca = long unsigned int; Cb = int; typename poly_result<Ca, typename if_nonpoly<Cb>::type>::type = long unsigned int; typename if_nonpoly<Cb>::type = int]’
    [...]/source-gcc/gcc/omp-low.cc:5180:33:   required from here
    [...]/source-gcc/gcc/poly-int.h:1373:22: error: comparison of integer expressions of different signedness: ‘const long unsigned int’ and ‘const int’ [-Werror=sign-compare]
     1373 |   return a.coeffs[0] < b;
          |          ~~~~~~~~~~~~^~~

gcc/
* omp-low.cc (lower_rec_simd_input_clauses): For 'ordered_max',
cast 'omp_max_simt_vf ()', 'omp_max_simd_vf ()' to 'unsigned'.

2 years agoFix target selector syntax in 'gcc.dg/vect/bb-slp-cond-1.c'
Thomas Schwinge [Tue, 25 Oct 2022 11:10:52 +0000 (13:10 +0200)] 
Fix target selector syntax in 'gcc.dg/vect/bb-slp-cond-1.c'

... to restore testing lost in recent
commit r13-3225-gbd9a05594d227cde79a67dc715bd9d82e9c464e9
"amdgcn: vector testsuite tweaks" (for example, x86_64-pc-linux-gnu):

    PASS: gcc.dg/vect/bb-slp-cond-1.c (test for excess errors)
    PASS: gcc.dg/vect/bb-slp-cond-1.c -flto -ffat-lto-objects  scan-tree-dump vect "(no need for alias check [^\\n]* when VF is 1|no alias between [^\\n]* when [^\\n]* is outside \\(-16, 16\\))"
    [-PASS: gcc.dg/vect/bb-slp-cond-1.c -flto -ffat-lto-objects  scan-tree-dump-times vect "loop vectorized" 1-]
    PASS: gcc.dg/vect/bb-slp-cond-1.c -flto -ffat-lto-objects (test for excess errors)
    PASS: gcc.dg/vect/bb-slp-cond-1.c -flto -ffat-lto-objects execution test
    PASS: gcc.dg/vect/bb-slp-cond-1.c execution test
    PASS: gcc.dg/vect/bb-slp-cond-1.c scan-tree-dump vect "(no need for alias check [^\\n]* when VF is 1|no alias between [^\\n]* when [^\\n]* is outside \\(-16, 16\\))"
    [-PASS: gcc.dg/vect/bb-slp-cond-1.c scan-tree-dump-times vect "loop vectorized" 1-]

gcc/testsuite/
* gcc.dg/vect/bb-slp-cond-1.c: Fix target selector syntax.

(cherry picked from commit 0607307768b66a90e27c5bc91a247acc938f070e)

2 years agoDaily bump.
GCC Administrator [Fri, 28 Oct 2022 00:22:49 +0000 (00:22 +0000)] 
Daily bump.

2 years agoopenacc: Revert erroneous gang reduction changes
Marcel Vollweiler [Thu, 27 Oct 2022 12:43:00 +0000 (12:43 +0000)] 
openacc: Revert erroneous gang reduction changes

This patch reverts some changes related to "gang reduction on an orphan loop"
of commit 3a5e525489f2f808093ae1f12b5d2b406f571ec7 "Various OpenACC reduction
enhancements - FE change" similar to the mainline commit
77d24d43644909852998043335b5a0e09d1e8f02.

gcc/c/ChangeLog:

* c-typeck.cc (c_finish_omp_clauses): Remove "gang reduction on an
orphan loop" checking.

gcc/cp/ChangeLog:

* semantics.cc (finish_omp_clauses): Remove "gang reduction on an
orphan loop" checking.

gcc/fortran/ChangeLog:

* openmp.cc (oacc_is_parallel): Remove.
(resolve_oacc_loop_blocks): Remove "gang reduction on an orphan loop"
checking.

2 years agoopenacc: Revert erroneous gang reduction change in OpenAcc test
Marcel Vollweiler [Wed, 26 Oct 2022 14:45:41 +0000 (14:45 +0000)] 
openacc: Revert erroneous gang reduction change in OpenAcc test

This patch reverts an erroneous modification of an OpenAcc test case in
d27d6c9e1e3bc18ba0113757b743b306ea69f825 "Various OpenACC reduction
enhancements - test cases".

The same reversion was already done on mainline with commit
77d24d43644909852998043335b5a0e09d1e8f02.

gcc/testsuite/ChangeLog:

        * gfortran.dg/goacc/orphan-reductions-1.f90: Adjust.

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Thu, 27 Oct 2022 11:44:50 +0000 (13:44 +0200)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-8872-gca0220d42e075194ca1341c98a0a9a9f3fd1c719 (27th Oct 2022)

2 years agolto: do not load LTO stream for aliases [PR107418]
Martin Liska [Thu, 27 Oct 2022 08:29:17 +0000 (10:29 +0200)] 
lto: do not load LTO stream for aliases [PR107418]

PR lto/107418

gcc/lto/ChangeLog:

* lto-dump.cc (lto_main): Do not load LTO stream for aliases.

(cherry picked from commit be6c75547385c69706370f4e792b04295f708a5a)

2 years agoIRA: Make sure array is big enough
Torbjörn SVENSSON [Tue, 25 Oct 2022 09:45:40 +0000 (11:45 +0200)] 
IRA: Make sure array is big enough

In commit 081c96621da, the call to resize_reg_info() was moved before
the call to remove_scratches() and the latter one can increase the
number of regs and that would cause an out of bounds usage on the
reg_renumber global array.

Without this patch, the following testcase randomly fails with:
during RTL pass: ira
In file included from /src/gcc/testsuite/gcc.dg/compat/struct-by-value-5b_y.c:13:
/src/gcc/testsuite/gcc.dg/compat/struct-by-value-5b_y.c: In function 'checkgSf13':
/src/gcc/testsuite/gcc.dg/compat/fp-struct-test-by-value-y.h:28:1: internal compiler error: Segmentation fault
/src/gcc/testsuite/gcc.dg/compat/struct-by-value-5b_y.c:22:1: note: in expansion of macro 'TEST'

gcc/ChangeLog:

* ira.cc: Resize array after reg number increased.

Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
(cherry picked from commit 4e1d704243a4f3c4ded47cd0d02427bb7efef069)

2 years agoDaily bump.
GCC Administrator [Thu, 27 Oct 2022 00:23:02 +0000 (00:23 +0000)] 
Daily bump.

2 years agoaarch64: update Ampere-1 core definition
Philipp Tomsich [Sun, 7 Aug 2022 22:30:52 +0000 (00:30 +0200)] 
aarch64: update Ampere-1 core definition

This brings the extensions detected by -mcpu=native on Ampere-1 systems
in sync with the defaults generated for -mcpu=ampere1.

Note that some early kernel versions on Ampere1 may misreport the
presence of PAUTH and PREDRES (i.e., -mcpu=native will add 'nopauth'
and 'nopredres').

gcc/ChangeLog:

* config/aarch64/aarch64-cores.def (AARCH64_CORE): Update
Ampere-1 core entry.

(cherry picked from commit db2f5d661239737157cf131de7d4df1c17d8d88d)

2 years agoaarch64: fix off-by-one in reading cpuinfo
Philipp Tomsich [Mon, 3 Oct 2022 19:59:50 +0000 (21:59 +0200)] 
aarch64: fix off-by-one in reading cpuinfo

Fixes: 341573406b39
Don't subtract one from the result of strnlen() when trying to point
to the first character after the current string.  This issue would
cause individual characters (where the 128 byte buffers are stitched
together) to be lost.

gcc/ChangeLog:

* config/aarch64/driver-aarch64.cc (readline): Fix off-by-one.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/cpunative/info_18: New test.
* gcc.target/aarch64/cpunative/native_cpu_18.c: New test.

(cherry picked from commit b1cfbccc41de6aec950c0f662e7e85ab34bfff8a)

2 years agoHandle operator new with alignment in usm transform.
Hafiz Abid Qadeer [Wed, 26 Oct 2022 08:51:01 +0000 (09:51 +0100)] 
Handle operator new with alignment in usm transform.

Since C++17, the is a variant of operator new with alignment. This
patch converts it to omp_aligned_alloc when unified shared memory is
being used.

gcc/ChangeLog:

* omp-low.cc (usm_transform): Handle operator new with alignment.

libgomp/ChangeLog:

* testsuite/libgomp.c++/usm-2.C: New test.

gcc/testsuite/ChangeLog:

* g++.dg/gomp/usm-4.C: New test.
* g++.dg/gomp/usm-5.C: New test.