]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
6 months ago[PATCH v3] libiberty: Use posix_spawn in pex-unix when available.
Brendan Shanks [Fri, 10 Nov 2023 04:01:07 +0000 (21:01 -0700)] 
[PATCH v3] libiberty: Use posix_spawn in pex-unix when available.

Hi,

This patch implements pex_unix_exec_child using posix_spawn when
available.

This should especially benefit recent macOS (where vfork just calls
fork), but should have equivalent or faster performance on all
platforms.
In addition, the implementation is substantially simpler than the
vfork+exec code path.

Tested on x86_64-linux.

v2: Fix error handling (previously the function would be run twice in
case of error), and don't use a macro that changes control flow.

v3: Match file style for error-handling blocks, don't close
in/out/errdes on error, and check close() for errors.

libiberty/
* configure.ac (AC_CHECK_HEADERS): Add spawn.h.
(checkfuncs): Add posix_spawn, posix_spawnp.
(AC_CHECK_FUNCS): Add posix_spawn, posix_spawnp.
* aclocal.m4, configure, config.in: Rebuild.
* pex-unix.c [HAVE_POSIX_SPAWN] (pex_unix_exec_child): New function.

6 months agotest: Fix FAIL of pr97428.c for RVV
Juzhe-Zhong [Tue, 7 Nov 2023 15:18:59 +0000 (23:18 +0800)] 
test: Fix FAIL of pr97428.c for RVV

gcc/testsuite/ChangeLog:

* gcc.dg/vect/pr97428.c: Add additional compile option for riscv.

6 months agoRISC-V: Move cond_copysign from combine pattern to autovec pattern
Juzhe-Zhong [Thu, 9 Nov 2023 23:33:25 +0000 (07:33 +0800)] 
RISC-V: Move cond_copysign from combine pattern to autovec pattern

Since cond_copysign has been support into match.pd (middle-end).
We don't need to support conditional copysign by RTL combine pass.

Instead, we can support it by direct explicit cond_copysign optab.

conditional copysign tests are already available in the testsuite.
No need to add tests.

gcc/ChangeLog:

* config/riscv/autovec-opt.md (*cond_copysign<mode>): Remove.
* config/riscv/autovec.md (cond_copysign<mode>): New pattern.

6 months agoInternal-fn: Add FLOATN support for l/ll round and rint [PR/112432]
Pan Li [Thu, 9 Nov 2023 14:04:39 +0000 (22:04 +0800)] 
Internal-fn: Add FLOATN support for l/ll round and rint [PR/112432]

The defined DEF_EXT_LIB_FLOATN_NX_BUILTINS functions should also
have DEF_INTERNAL_FLT_FLOATN_FN instead of DEF_INTERNAL_FLT_FN for
the FLOATN support. According to the glibc API and gcc builtin, we
have below table for the FLOATN is supported or not.

+---------+-------+-------------------------------------+
|         | glibc | gcc: DEF_EXT_LIB_FLOATN_NX_BUILTINS |
+---------+-------+-------------------------------------+
| iceil   | N     | N                                   |
| ifloor  | N     | N                                   |
| irint   | N     | N                                   |
| iround  | N     | N                                   |
| lceil   | N     | N                                   |
| lfloor  | N     | N                                   |
| lrint   | Y     | Y                                   |
| lround  | Y     | Y                                   |
| llceil  | N     | N                                   |
| llfllor | N     | N                                   |
| llrint  | Y     | Y                                   |
| llround | Y     | Y                                   |
+---------+-------+-------------------------------------+

This patch would like to support FLOATN for:
1. lrint
2. lround
3. llrint
4. llround

The below tests are passed within this patch:
1. x86 bootstrap and regression test.
2. aarch64 regression test.
3. riscv regression tests.

PR target/112432

gcc/ChangeLog:

* internal-fn.def (LRINT): Add FLOATN support.
(LROUND): Ditto.
(LLRINT): Ditto.
(LLROUND): Ditto.

Signed-off-by: Pan Li <pan2.li@intel.com>
6 months ago[committed] Improve single bit zero extraction on H8.
Jeff Law [Fri, 10 Nov 2023 00:34:01 +0000 (17:34 -0700)] 
[committed] Improve single bit zero extraction on H8.

When zero extracting a single bit bitfield from bits 16..31 on the H8 we
currently generate some pretty bad code.

The fundamental issue is we can't shift efficiently and there's no trivial way
to extract a single bit out of the high half word of an SImode value.

What usually happens is we use a synthesized right shift to get the single bit
into the desired position, then a bit-and to mask off everything we don't care
about.

The shifts are expensive, even using tricks like half and quarter word moves to
implement shift-by-16 and shift-by-8.  Additionally a logical right shift must
clear out the upper bits which is redundant since we're going to mask things
with &1 later.

This patch provides a consistently better sequence for such extractions.  The
general form moves the high half into the low half, a bit extraction into C,
clear the destination, then move C into the destination with a few special
cases.

This also avoids all the shenanigans for H8/SX which has a much more capable
shifter.  It's not single cycle, but it is reasonably efficient.

This has been regression tested on the H8 without issues.  Pushing to the trunk
momentarily.

jeff

ps.  Yes, supporting zero extraction of multi-bit fields might be improvable as
well.  But I've already spent more time on this than I can reasonably justify.

gcc/
* config/h8300/combiner.md (single bit sign_extract): Avoid recently
added patterns for H8/SX.
(single bit zero_extract): New patterns.

6 months agoFix wrong code due to vec_merge + pcmp to blendvb splitter.
liuhongt [Thu, 9 Nov 2023 05:20:05 +0000 (13:20 +0800)] 
Fix wrong code due to vec_merge + pcmp to blendvb splitter.

gcc/ChangeLog:

PR target/112443
* config/i386/sse.md (*avx2_pcmp<mode>3_4): Fix swap condition
from LT to GT since there's not in the pattern.
(*avx2_pcmp<mode>3_5): Ditto.

gcc/testsuite/ChangeLog:

* g++.target/i386/pr112443.C: New test.

6 months agobpf: fix pseudo-c asm emitted for *mulsidi3_zeroextend
Jose E. Marchesi [Fri, 10 Nov 2023 00:12:49 +0000 (01:12 +0100)] 
bpf: fix pseudo-c asm emitted for *mulsidi3_zeroextend

This patch fixes the pseudo-c BPF assembly syntax used for
*mulsidi3_zeroextend, which was being emitted as:

  rN *= wM

instead of the proper way to denote a mul32 in pseudo-C syntax:

  wN *= wM

Includes test.
Tested in bpf-unknown-none-gcc target in x86_64-linux-gnu host.

gcc/ChangeLog:

* config/bpf/bpf.cc (bpf_print_register): Accept modifier code 'W'
to force emitting register names using the wN form.
* config/bpf/bpf.md (*mulsidi3_zeroextend): Force operands to
always use wN written form in pseudo-C assembly syntax.

gcc/testsuite/ChangeLog:

* gcc.target/bpf/mulsidi3-zeroextend-pseudoc.c: New test.

6 months agobpf: testsuite: fix expected regexp in gcc.target/bpf/ldxdw.c
Jose E. Marchesi [Thu, 9 Nov 2023 23:47:19 +0000 (00:47 +0100)] 
bpf: testsuite: fix expected regexp in gcc.target/bpf/ldxdw.c

gcc/testsuite/ChangeLog:

* gcc.target/bpf/ldxdw.c: Fix regexp with expected result.

6 months agolibstdc++: mark 20_util/scoped_allocator/noexcept.cc R-E-T hosted
Arsen Arsenović [Thu, 9 Nov 2023 19:22:26 +0000 (20:22 +0100)] 
libstdc++: mark 20_util/scoped_allocator/noexcept.cc R-E-T hosted

libstdc++-v3/ChangeLog:

* testsuite/20_util/scoped_allocator/noexcept.cc: Mark as
requiring hosted.

6 months agolibstdc++: declare std::allocator in !HOSTED as an extension
Arsen Arsenović [Wed, 8 Nov 2023 09:22:47 +0000 (10:22 +0100)] 
libstdc++: declare std::allocator in !HOSTED as an extension

This allows us to add features to freestanding which allow specifying
non-default allocators (generators, collections, ...) without having to
modify them.

libstdc++-v3/ChangeLog:

* include/bits/memoryfwd.h: Remove HOSTED check around allocator
and its specializations.

6 months agodiagnostics: cleanups to diagnostic-show-locus.cc
David Malcolm [Thu, 9 Nov 2023 22:22:52 +0000 (17:22 -0500)] 
diagnostics: cleanups to diagnostic-show-locus.cc

Reduce implicit usage of line_table global, and move source printing to
within diagnostic_context.

gcc/ChangeLog:
* diagnostic-show-locus.cc (layout::m_line_table): New field.
(compatible_locations_p): Convert to...
(layout::compatible_locations_p): ...this, replacing uses of
line_table global with m_line_table.
(layout::layout): Convert "richloc" param from a pointer to a
const reference.  Initialize m_line_table member.
(layout::maybe_add_location_range):  Replace uses of line_table
global with m_line_table.  Pass the latter to
linemap_client_expand_location_to_spelling_point.
(layout::print_leading_fixits): Pass m_line_table to
affects_line_p.
(layout::print_trailing_fixits): Likewise.
(gcc_rich_location::add_location_if_nearby): Update for change
to layout ctor params.
(diagnostic_show_locus): Convert to...
(diagnostic_context::maybe_show_locus): ...this, converting
richloc param from a pointer to a const reference.  Make "loc"
const.  Split out printing part of function to...
(diagnostic_context::show_locus): ...this.
(selftest::test_offset_impl): Update for change to layout ctor
params.
(selftest::test_layout_x_offset_display_utf8): Likewise.
(selftest::test_layout_x_offset_display_tab): Likewise.
(selftest::test_tab_expansion): Likewise.
* diagnostic.h (diagnostic_context::maybe_show_locus): New decl.
(diagnostic_context::show_locus): New decl.
(diagnostic_show_locus): Convert from a decl to an inline function.
* gdbinit.in (break-on-diagnostic): Update from a breakpoint
on diagnostic_show_locus to one on
diagnostic_context::maybe_show_locus.
* genmatch.cc (linemap_client_expand_location_to_spelling_point):
Add "set" param and use it in place of line_table global.
* input.cc (expand_location_1): Likewise.
(expand_location): Update for new param of expand_location_1.
(expand_location_to_spelling_point): Likewise.
(linemap_client_expand_location_to_spelling_point): Add "set"
param and use it in place of line_table global.
* tree-diagnostic-path.cc (event_range::print): Pass line_table
for new param of linemap_client_expand_location_to_spelling_point.

libcpp/ChangeLog:
* include/line-map.h (rich_location::get_expanded_location): Make
const.
(rich_location::get_line_table): New accessor.
(rich_location::m_line_table): Make the pointer be const.
(rich_location::m_have_expanded_location): Make mutable.
(rich_location::m_expanded_location): Likewise.
(fixit_hint::affects_line_p): Add const line_maps * param.
(linemap_client_expand_location_to_spelling_point): Likewise.
* line-map.cc (rich_location::get_expanded_location): Make const.
Pass m_line_table to
linemap_client_expand_location_to_spelling_point.
(rich_location::maybe_add_fixit): Likewise.
(fixit_hint::affects_line_p): Add set param and pass to
linemap_client_expand_location_to_spelling_point.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
6 months agoAdd missing declaration of get_restrict in C++ interface
Guillaume Gomez [Thu, 9 Nov 2023 21:29:02 +0000 (22:29 +0100)] 
Add missing declaration of get_restrict in C++ interface

gcc/jit/ChangeLog:

* libgccjit++.h:

6 months agoMAINTAINERS: Add myself to write after approval
Jivan Hakobyan [Thu, 9 Nov 2023 20:57:12 +0000 (00:57 +0400)] 
MAINTAINERS: Add myself to write after approval

Signed-off-by: Jeff Law <jeffreyalaw@gmail.com>
ChangeLog:

* MAINTAINERS: Add myself.

6 months agolibstdc++: Fix forwarding in __take/drop_of_repeat_view [PR112453]
Patrick Palka [Thu, 9 Nov 2023 20:15:08 +0000 (15:15 -0500)] 
libstdc++: Fix forwarding in __take/drop_of_repeat_view [PR112453]

We need to respect the value category of the repeat_view passed to these
two functions when accessing the view's _M_value member.  This revealed
that the space-efficient partial specialization of __box lacks && overloads
of operator* to match those of the primary template (inherited from
std::optional).

PR libstdc++/112453

libstdc++-v3/ChangeLog:

* include/std/ranges (__detail::__box<_Tp>::operator*): Define
&& overloads as well.
(__detail::__take_of_repeat_view): Forward __r when accessing
its _M_value member.
(__detail::__drop_of_repeat_view): Likewise.
* testsuite/std/ranges/repeat/1.cc (test07): New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
6 months agoRISC-V/testsuite: Fix several zvfh tests.
Robin Dapp [Thu, 9 Nov 2023 10:32:30 +0000 (11:32 +0100)] 
RISC-V/testsuite: Fix several zvfh tests.

This fixes some zvfh test oversights as well as adds zfh to the target
requirements.  It's not strictly necessary to have zfh but it greatly
simplifies test handling when we can just calculate the reference value
instead of working around it.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/binop/fmax_zvfh-1.c: Adjust.
* gcc.target/riscv/rvv/autovec/binop/fmax_zvfh_run-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/binop/fmin_zvfh-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/binop/fmin_zvfh_run-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int-1.h:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int-2.h:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int-rv32-1.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int-rv32-2.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int-rv64-1.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int-rv64-2.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_run-1.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_run-2.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_int2float_run-1.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_int2float_run-2.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh_run-1.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh_run-2.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh_run-3.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh_run-4.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh_run-1.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh_run-2.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh_run-3.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh_run-4.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_sqrt_run-zvfh-1.c:
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_sqrt_run-zvfh-2.c:
Ditto.
* gcc.target/riscv/rvv/autovec/reduc/reduc_zvfh-10.c: Ditto.
* gcc.target/riscv/rvv/autovec/reduc/reduc_zvfh_run-10.c: Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh-1.h: New test.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh-2.h: New test.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh-rv32-1.c: New test.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh-rv32-2.c: New test.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh-rv64-1.c: New test.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh-rv64-2.c: New test.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh_run-1.c: New test.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh_run-2.c: New test.

6 months agoi386: Improve stack protector patterns and peephole2s even more
Uros Bizjak [Thu, 9 Nov 2023 18:47:57 +0000 (19:47 +0100)] 
i386:  Improve stack protector patterns and peephole2s even more

Improve stack protector patterns and peephole2s even more:

a. Use unrelated register clears with integer mode size <= word
   mode size to clear stack protector scratch register.

b. Use unrelated register initializations in front of stack
   protector sequence to clear stack protector scratch register.

c. Use unrelated register initializations using LEA instructions
   to clear stack protector scratch register.

These stack protector improvements reuse 6914 unrelated register
initializations to substitute the clear of stack protector scratch
register in 12034 instances of stack protector sequence in recent linux
defconfig build.

gcc/ChangeLog:

* config/i386/i386.md (@stack_protect_set_1_<PTR:mode>_<W:mode>):
Use W mode iterator instead of SWI48.  Output MOV instead of XOR
for TARGET_USE_MOV0.
(stack_protect_set_1 peephole2): Use integer modes with
mode size <= word mode size for operand 3.
(stack_protect_set_1 peephole2 #2): New peephole2 pattern to
substitute stack protector scratch register clear with unrelated
register initialization, originally in front of stack
protector sequence.
(*stack_protect_set_3_<PTR:mode>_<SWI48:mode>): New insn pattern.
(stack_protect_set_1 peephole2): New peephole2 pattern to
substitute stack protector scratch register clear with unrelated
register initialization involving LEA instruction.

6 months ago[IRA]: Fixing conflict calculation from region landing pads.
Vladimir N. Makarov [Thu, 9 Nov 2023 13:51:15 +0000 (08:51 -0500)] 
[IRA]: Fixing conflict calculation from region landing pads.

The following patch fixes conflict calculation from exception landing
pads.  The previous patch processed only one newly created landing pad.
Besides it was wrong, it also resulted in large memory consumption by IRA.

gcc/ChangeLog:

PR rtl-optimization/110215
* ira-lives.cc: (add_conflict_from_region_landing_pads): New
function.
(process_bb_node_lives): Use it.

6 months agolibstdc++: [_Hashtable] Use RAII type to manage rehash functor state
François Dumont [Thu, 26 Oct 2023 05:06:18 +0000 (07:06 +0200)] 
libstdc++: [_Hashtable] Use RAII type to manage rehash functor state

Replace usage of __try/__catch with a RAII type to restore rehash functor
state when needed.

libstdc++-v3/ChangeLog:

* include/bits/hashtable_policy.h (_RehashStateGuard): New.
(_Insert_base<>::_M_insert_range(_IIt, _IIt, const _NodeGet&, false_type)):
Adapt.
* include/bits/hashtable.h (__rehash_guard_t): New.
(__rehash_state): Remove.
(_M_rehash): Remove.
(_M_rehash_aux): Rename into _M_rehash.
(_M_assign_elements, _M_insert_unique_node, _M_insert_multi_node): Adapt.
(rehash): Adapt.

6 months agoi386 PIE: accept @GOTOFF in load/store multi base address
Alexandre Oliva [Thu, 9 Nov 2023 15:26:41 +0000 (12:26 -0300)] 
i386 PIE: accept @GOTOFF in load/store multi base address

Looking at the code generated for sse2-{load,store}-multi.c with PIE,
I realized we could use UNSPEC_GOTOFF as a base address, and that this
would enable the test to use the vector insns expected by the tests
even with PIC, so I extended the base + offset logic used by the SSE2
multi-load/store peepholes to accept reg + symbolic base + offset too,
so that the test generated the expected insns even with PIE.

for  gcc/ChangeLog

* config/i386/i386.cc (symbolic_base_address_p,
base_address_p): New, factored out from...
(extract_base_offset_in_addr): ... here and extended to
recognize REG+GOTOFF, as in gcc.target/i386/sse2-load-multi.c
and sse2-store-multi.c with PIE enabled by default.

6 months agotestsuite: xfail scev-[35].c on ia32
Alexandre Oliva [Thu, 9 Nov 2023 15:26:38 +0000 (12:26 -0300)] 
testsuite: xfail scev-[35].c on ia32

These gimplefe tests never got the desired optimization on ia32, but
they only started visibly failing when the representation of MEMs in
dumps changed from printing 'symbol: a' to '&a'.

The transformation is not considered profitable on ia32, that's why it
doesn't take place.  Maybe that's a bug in itself, but it's not a
regression, and not something to be noisy about.

for  gcc/testsuite/ChangeLog

* gcc.dg/tree-ssa/scev-3.c: xfail on ia32.
* gcc.dg/tree-ssa/scev-5.c: Likewise.

6 months agoAArch64: Add SVE implementation for cond_copysign.
Tamar Christina [Thu, 9 Nov 2023 14:05:40 +0000 (14:05 +0000)] 
AArch64: Add SVE implementation for cond_copysign.

This adds an implementation for masked copysign along with an optimized
pattern for masked copysign (x, -1).

gcc/ChangeLog:

PR tree-optimization/109154
* config/aarch64/aarch64-sve.md (cond_copysign<mode>): New.

gcc/testsuite/ChangeLog:

PR tree-optimization/109154
* gcc.target/aarch64/sve/fneg-abs_5.c: New test.

6 months agoAArch64: Handle copysign (x, -1) expansion efficiently
Tamar Christina [Thu, 9 Nov 2023 14:04:57 +0000 (14:04 +0000)] 
AArch64: Handle copysign (x, -1) expansion efficiently

copysign (x, -1) is effectively fneg (abs (x)) which on AArch64 can be
most efficiently done by doing an OR of the signbit.

The middle-end will optimize fneg (abs (x)) now to copysign as the
canonical form and so this optimizes the expansion.

If the target has an inclusive-OR that takes an immediate, then the transformed
instruction is both shorter and faster.  For those that don't, the immediate
has to be separately constructed, but this still ends up being faster as the
immediate construction is not on the critical path.

Note that this is part of another patch series, the additional testcases
are mutually dependent on the match.pd patch.  As such the tests are added
there insteadof here.

gcc/ChangeLog:

PR tree-optimization/109154
* config/aarch64/aarch64.md (copysign<GPF:mode>3): Handle
copysign (x, -1).
* config/aarch64/aarch64-simd.md (copysign<mode>3): Likewise.
* config/aarch64/aarch64-sve.md (copysign<mode>3): Likewise.

6 months agoAArch64: Use SVE unpredicated LOGICAL expressions when Advanced SIMD inefficient...
Tamar Christina [Thu, 9 Nov 2023 14:18:48 +0000 (14:18 +0000)] 
AArch64: Use SVE unpredicated LOGICAL expressions when Advanced SIMD inefficient [PR109154]

SVE has much bigger immediate encoding range for bitmasks than Advanced SIMD has
and so on a system that is SVE capable if we need an Advanced SIMD Inclusive-OR
by immediate and would require a reload then use an unpredicated SVE ORR instead.

This has both speed and size improvements.

gcc/ChangeLog:

PR tree-optimization/109154
* config/aarch64/aarch64.md (<optab><mode>3): Add SVE split case.
* config/aarch64/aarch64-simd.md (ior<mode>3<vczle><vczbe>): Likewise.
* config/aarch64/predicates.md(aarch64_orr_imm_sve_advsimd): New.

gcc/testsuite/ChangeLog:

PR tree-optimization/109154
* gcc.target/aarch64/sve/fneg-abs_1.c: Updated.
* gcc.target/aarch64/sve/fneg-abs_2.c: Updated.
* gcc.target/aarch64/sve/fneg-abs_4.c: Updated.

6 months agoAArch64: Add movi for 0 moves for scalar types [PR109154]
Tamar Christina [Thu, 9 Nov 2023 14:03:04 +0000 (14:03 +0000)] 
AArch64: Add movi for 0 moves for scalar types [PR109154]

Following the Neoverse N/V and Cortex-A optimization guides SIMD 0 immediates
should be created with a movi of 0.

At the moment we generate an `fmov .., xzr` which is slower and requires a
GP -> FP transfer.

gcc/ChangeLog:

PR tree-optimization/109154
* config/aarch64/aarch64.md (*mov<mode>_aarch64, *movsi_aarch64,
*movdi_aarch64): Add new w -> Z case.
* config/aarch64/iterators.md (Vbtype): Add QI and HI.

gcc/testsuite/ChangeLog:

PR tree-optimization/109154
* gcc.target/aarch64/fneg-abs_2.c: Updated.
* gcc.target/aarch64/fneg-abs_4.c: Updated.
* gcc.target/aarch64/dbl_mov_immediate_1.c: Updated.

6 months agoAArch64: Add special patterns for creating DI scalar and vector constant 1 << 63...
Tamar Christina [Thu, 9 Nov 2023 14:02:21 +0000 (14:02 +0000)] 
AArch64: Add special patterns for creating DI scalar and vector constant 1 << 63 [PR109154]

This adds a way to generate special sequences for creation of constants for
which we don't have single instructions sequences which would have normally
lead to a GP -> FP transfer or a literal load.

The patch starts out by adding support for creating 1 << 63 using fneg (mov 0).

gcc/ChangeLog:

PR tree-optimization/109154
* config/aarch64/aarch64-protos.h (aarch64_simd_special_constant_p,
aarch64_maybe_generate_simd_constant): New.
* config/aarch64/aarch64-simd.md (*aarch64_simd_mov<VQMOV:mode>,
*aarch64_simd_mov<VDMOV:mode>): Add new coden for special constants.
* config/aarch64/aarch64.cc (aarch64_extract_vec_duplicate_wide_int):
Take optional mode.
(aarch64_simd_special_constant_p,
aarch64_maybe_generate_simd_constant): New.
* config/aarch64/aarch64.md (*movdi_aarch64): Add new codegen for
special constants.
* config/aarch64/constraints.md (Dx): new.

gcc/testsuite/ChangeLog:

PR tree-optimization/109154
* gcc.target/aarch64/fneg-abs_1.c: Updated.
* gcc.target/aarch64/fneg-abs_2.c: Updated.
* gcc.target/aarch64/fneg-abs_4.c: Updated.
* gcc.target/aarch64/dbl_mov_immediate_1.c: Updated.

6 months agoifcvt: Add support for conditional copysign
Tamar Christina [Thu, 9 Nov 2023 14:00:20 +0000 (14:00 +0000)] 
ifcvt: Add support for conditional copysign

This adds a masked variant of copysign.  Nothing very exciting just the
general machinery to define and use a new masked IFN.

Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.

Note: This patch is part of a testseries and tests for it are added in the
AArch64 patch that adds supports for the optab.

gcc/ChangeLog:

PR tree-optimization/109154
* internal-fn.def (COPYSIGN): New.
* match.pd (UNCOND_BINARY, COND_BINARY): Map IFN_COPYSIGN to
IFN_COND_COPYSIGN.
* optabs.def (cond_copysign_optab, cond_len_copysign_optab): New.

6 months agomiddle-end: optimize fneg (fabs (x)) to copysign (x, -1) [PR109154]
Tamar Christina [Thu, 9 Nov 2023 13:59:39 +0000 (13:59 +0000)] 
middle-end: optimize fneg (fabs (x)) to copysign (x, -1) [PR109154]

This patch transforms fneg (fabs (x)) into copysign (x, -1) which is more
canonical and allows a target to expand this sequence efficiently.  Such
sequences are common in scientific code working with gradients.

There is an existing canonicalization of copysign (x, -1) to fneg (fabs (x))
which I remove since this is a less efficient form.  The testsuite is also
updated in light of this.

gcc/ChangeLog:

PR tree-optimization/109154
* match.pd: Add new neg+abs rule, remove inverse copysign rule.

gcc/testsuite/ChangeLog:

PR tree-optimization/109154
* gcc.dg/fold-copysign-1.c: Updated.
* gcc.dg/pr55152-2.c: Updated.
* gcc.dg/tree-ssa/abs-4.c: Updated.
* gcc.dg/tree-ssa/backprop-6.c: Updated.
* gcc.dg/tree-ssa/copy-sign-2.c: Updated.
* gcc.dg/tree-ssa/mult-abs-2.c: Updated.
* gcc.target/aarch64/fneg-abs_1.c: New test.
* gcc.target/aarch64/fneg-abs_2.c: New test.
* gcc.target/aarch64/fneg-abs_3.c: New test.
* gcc.target/aarch64/fneg-abs_4.c: New test.
* gcc.target/aarch64/sve/fneg-abs_1.c: New test.
* gcc.target/aarch64/sve/fneg-abs_2.c: New test.
* gcc.target/aarch64/sve/fneg-abs_3.c: New test.
* gcc.target/aarch64/sve/fneg-abs_4.c: New test.

6 months agomiddle-end: expand copysign handling from lockstep to nested iters
Tamar Christina [Thu, 9 Nov 2023 13:58:59 +0000 (13:58 +0000)] 
middle-end: expand copysign handling from lockstep to nested iters

various optimizations in match.pd only happened on COPYSIGN in lock step
which means they exclude IFN_COPYSIGN.  COPYSIGN however is restricted to only
the C99 builtins and so doesn't work for vectors.

The patch expands these optimizations to work as nested iters.

This is needed for the second patch which will add the testcase.

gcc/ChangeLog:

PR tree-optimization/109154
* match.pd: expand existing copysign optimizations.

6 months agoFix PR ada/111813 (Inconsistent limit in Ada.Calendar.Formatting)
Simon Wright [Mon, 16 Oct 2023 13:32:43 +0000 (14:32 +0100)] 
Fix PR ada/111813 (Inconsistent limit in Ada.Calendar.Formatting)

The description of the second Value function (returning Duration) (ARM 9.6.1(87)
doesn't place any limitation on the Elapsed_Time parameter's value, beyond
"Constraint_Error is raised if the string is not formatted as described for Image, or
the function cannot interpret the given string as a Duration value".

It would seem reasonable that Value and Image should be consistent, in that any
string produced by Image should be accepted by Value. Since Image must produce
a two-digit representation of the Hours, there's an implication that its
Elapsed_Time parameter should be less than 100.0 hours (the ARM merely says
that in that case the result is implementation-defined).

The current implementation of Value raises Constraint_Error if the Elapsed_Time
parameter is greater than or equal to 24 hours.

This patch removes the restriction, so that the Elapsed_Time parameter must only
be less than 100.0 hours.

2023-10-15 Simon Wright <simon@pushface.org>

PR ada/111813
gcc/ada/
* libgnat/a-calfor.adb (Value (2)): Allow values of
parameter Elapsed_Time greater than or equal to 24 hours, by doing
the hour calculations in Natural rather than Hour_Number (0 ..
23). Calculate the result directly rather than by using Seconds_Of
(whose Hour parameter is of type Hour_Number).
If an exception occurs of type Constraint_Error, re-raise it
rather than raising a new CE.

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

6 months agoDo not prepend target triple to -fuse-ld=lld,mold.
Tatsuyuki Ishi [Mon, 16 Oct 2023 05:04:12 +0000 (14:04 +0900)] 
Do not prepend target triple to -fuse-ld=lld,mold.

lld and mold are platform-agnostic and not prefixed with target triple.
Prepending the target triple makes it less likely to find the intended
linker executable.

A potential breaking change is that we no longer try to search for
triple-prefixed lld/mold binaries anymore. However, since there doesn't
seem to be support to build LLVM or mold with triple-prefixed executable
names, it seems better to just not bother with that case.

PR driver/111605
* collect2.cc (main): Do not prepend target triple to
-fuse-ld=lld,mold.

6 months agoRefactor x86 decl based scatter vectorization, prepare SLP
Richard Biener [Wed, 8 Nov 2023 12:14:59 +0000 (13:14 +0100)] 
Refactor x86 decl based scatter vectorization, prepare SLP

The following refactors the x86 decl based scatter vectorization
similar to what I did to the gather path.  This prepares scatters
for SLP as well, mainly single-lane since there are multiple
missing bits to support multi-lane scatters.

Tested extensively on the SLP-only branch which has the ability
to force SLP even for single lanes.

PR tree-optimization/111133
* tree-vect-stmts.cc (vect_build_scatter_store_calls):
Remove and refactor to ...
(vect_build_one_scatter_store_call): ... this new function.
(vectorizable_store): Use vect_check_scalar_mask to record
the SLP node for the mask operand.  Code generate scatters
with builtin decls from the main scatter vectorization
path and prepare that for SLP.
* tree-vect-slp.cc (vect_get_operand_map): Do not look
at the VDEF to decide between scatter or gather since that
doesn't work for patterns.  Use the LHS being an SSA_NAME
or not instead.

6 months agoRISC-V: Refine frm emit after bb end in succ edges
Pan Li [Thu, 9 Nov 2023 06:42:04 +0000 (14:42 +0800)] 
RISC-V: Refine frm emit after bb end in succ edges

This patch would like to fine the frm insn emit when we
meet abnormal edge in the loop. Conceptually, we only need
to emit once when abnormal instead of every iteration in
the loop.

This patch would like to fix this defect and only perform
insert_insn_end_basic_block when at least one succ edge is
abnormal.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_frm_emit_after_bb_end): Only
perform once emit when at least one succ edge is abnormal.

Signed-off-by: Pan Li <pan2.li@intel.com>
6 months agoRISC-V: Add PR112450 test to avoid regression
Juzhe-Zhong [Thu, 9 Nov 2023 12:00:38 +0000 (20:00 +0800)] 
RISC-V: Add PR112450 test to avoid regression

ICE has been fixed by Richard:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112450.

Add test to avoid future regression. Committed.

PR target/112450

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr112450.c: New test.

6 months agotree-optimization/112450 - avoid AVX512 style masking for BImode masks
Richard Biener [Thu, 9 Nov 2023 10:44:07 +0000 (11:44 +0100)] 
tree-optimization/112450 - avoid AVX512 style masking for BImode masks

The following avoids running into the AVX512 style masking code for
RVV which would theoretically be able to handle it if I were not
relying on integer mode maskness in vect_get_loop_mask.  While that's
easy to fix (patch in PR), the preference is to not have AVX512 style
masking for RVV, thus the following.

* tree-vect-loop.cc (vect_verify_full_masking_avx512):
Check we have integer mode masks as required by
vect_get_loop_mask.

6 months agotree-optimization/112444 - avoid bougs PHI value-numbering
Richard Biener [Thu, 9 Nov 2023 08:41:10 +0000 (09:41 +0100)] 
tree-optimization/112444 - avoid bougs PHI value-numbering

With .DEFERRED_INIT ssa_undefined_value_p () can return true for
values we did not visit (because they proved unreachable) but
are not .VN_TOP.  Avoid using those as value which, because they
are not visited, are assumed to be defined outside of the region.

PR tree-optimization/112444
* tree-ssa-sccvn.cc (visit_phi): Avoid using not visited
defs as undefined vals.

* gcc.dg/torture/pr112444.c: New testcase.

6 months agoMAINTAINERS: Update my email address
YunQiang Su [Thu, 9 Nov 2023 10:03:01 +0000 (18:03 +0800)] 
MAINTAINERS: Update my email address

ChangeLog:

* MAINTAINERS: Update my email address.

6 months agoMIPS: Use -mnan value for -mabs if not specified
YunQiang Su [Thu, 9 Nov 2023 09:21:41 +0000 (17:21 +0800)] 
MIPS: Use -mnan value for -mabs if not specified

On most hardware, FCSR.ABS2008 is set the value same with FCSR.NAN2008.
Let's use this behaivor by default in GCC, aka
gcc -mnan=2008 -c fabs.c
will imply `-mabs=2008`.

And of course, `gcc -mnan=2008 -mabs=legacy` can continue workable
like previous.

gcc/ChangeLog

* config/mips/mips.cc(mips_option_override): Set mips_abs to
2008, if mips_abs is default and mips_nan is 2008.

gcc/testsuite/
* gcc.target/mips/fabs-nan2008.c: New test.
* gcc.target/mips/fabsf-nan2008.c: New test.

6 months agoi386: Fix C99 compatibility issues in the x86-64 AVX ABI test suite
Florian Weimer [Wed, 8 Nov 2023 14:14:40 +0000 (15:14 +0100)] 
i386: Fix C99 compatibility issues in the x86-64 AVX ABI test suite

gcc/testsuite/

* gcc.target/x86_64/abi/avx/avx-check.h (main): Call
__builtin_printf instead of printf.
* gcc.target/x86_64/abi/avx/test_passing_m256.c
(fun_check_passing_m256_8_values): Add missing void return
type.
* gcc.target/x86_64/abi/avx512f/avx512f-check.h (main): Call
__builtin_printf instead of printf.
* gcc.target/x86_64/abi/avx512f/test_passing_m512.c
(fun_check_passing_m512_8_values): Add missing void return
type.
* gcc.target/x86_64/abi/bf16/bf16-check.h (main): Call
__builtin_printf instead of printf.
* gcc.target/x86_64/abi/bf16/m256bf16/bf16-ymm-check.h (main):
Likewise.
* gcc.target/x86_64/abi/bf16/m256bf16/test_passing_m256.c
(fun_check_passing_m256bf16_8_values): Add missing void
return type.
* gcc.target/x86_64/abi/bf16/m512bf16/bf16-zmm-check.h (main):
Call __builtin_printf instead of printf.
* gcc.target/x86_64/abi/bf16/m512bf16/test_passing_m512.c
(fun_check_passing_m512bf16_8_values): Add missign void
return type.

6 months agoc: Add -Wreturn-mismatch warning, split from -Wreturn-type
Florian Weimer [Thu, 9 Nov 2023 08:50:54 +0000 (09:50 +0100)] 
c: Add -Wreturn-mismatch warning, split from -Wreturn-type

The existing -Wreturn-type option covers both constraint violations
(which are mandatory to diagnose) and warnings that have known
false positives.  The new -Wreturn-mismatch warning is only about
the constraint violations (missing or extra return expressions),
and should eventually be turned into a permerror.

The -std=gnu89 test cases show that by default, we do not warn for
return; in a function not returning void.  This matches previous
practice for -Wreturn-type.

gcc/c-family/

* c.opt (Wreturn-mismatch): New.

gcc/c/

* c-typeck.cc (c_finish_return): Use pedwarn with
OPT_Wreturn_mismatch for missing/extra return expressions.

gcc/

* doc/invoke.texi (Warning Options): Document
-Wreturn-mismatch.  Update -Wreturn-type documentation.

gcc/testsuite/

* gcc.dg/Wreturn-mismatch-1.c: New.
* gcc.dg/Wreturn-mismatch-2.c: New.
* gcc.dg/Wreturn-mismatch-3.c: New.
* gcc.dg/Wreturn-mismatch-4.c: New.
* gcc.dg/Wreturn-mismatch-5.c: New.
* gcc.dg/Wreturn-mismatch-6.c: New.
* gcc.dg/noncompile/pr55976-1.c: Change -Werror=return-type
to -Werror=return-mismatch.
* gcc.dg/noncompile/pr55976-2.c: Change -Wreturn-type
to -Wreturn-mismatch.

6 months agogcc.dg/Wmissing-parameter-type*: Test the intended warning
Florian Weimer [Thu, 9 Nov 2023 08:50:53 +0000 (09:50 +0100)] 
gcc.dg/Wmissing-parameter-type*: Test the intended warning

gcc/testsuite/ChangeLog:

* gcc.dg/Wmissing-parameter-type.c: Build with -std=gnu89
to trigger the -Wmissing-parameter-type warning
and not the default -Wimplicit warning.  Also match
against -Wmissing-parameter-type.
* gcc.dg/Wmissing-parameter-type-Wextra.c: Likewise.

6 months agos390: Revise vector reverse elements
Stefan Schulze Frielinghaus [Thu, 9 Nov 2023 08:33:10 +0000 (09:33 +0100)] 
s390: Revise vector reverse elements

Replace UNSPEC_VEC_ELTSWAP with a vec_select implementation.

Furthermore, for a vector reverse elements operation between registers
of mode V8HI perform three rotates instead of a vperm operation since
the latter involves loading the permutation vector from the literal
pool.

Prior z15, instead of
  larl + vl + vl + vperm
prefer
  vl + vpdi (+ verllg (+ verllf))
for a load operation.

Likewise, prior z15, instead of
  larl + vl + vperm + vst
prefer
  vpdi (+ verllg (+ verllf)) + vst
for a store operation.

gcc/ChangeLog:

* config/s390/s390.md: Remove UNSPEC_VEC_ELTSWAP.
* config/s390/vector.md (eltswapv16qi): New expander.
(*eltswapv16qi): New insn and splitter.
(eltswapv8hi): New insn and splitter.
(eltswap<mode>): New insn and splitter for modes V_HW_4 as well
as V_HW_2.
* config/s390/vx-builtins.md (eltswap<mode>): Remove.
(*eltswapv16qi): Remove.
(*eltswap<mode>): Remove.
(*eltswap<mode>_emu): Remove.

gcc/testsuite/ChangeLog:

* gcc.target/s390/zvector/vec-reve-load-halfword-z14.c: Remove
vperm and substitude by vpdi et al.
* gcc.target/s390/zvector/vec-reve-load-halfword.c: Likewise.
* gcc.target/s390/vector/reverse-elements-1.c: New test.
* gcc.target/s390/vector/reverse-elements-2.c: New test.
* gcc.target/s390/vector/reverse-elements-3.c: New test.
* gcc.target/s390/vector/reverse-elements-4.c: New test.
* gcc.target/s390/vector/reverse-elements-5.c: New test.
* gcc.target/s390/vector/reverse-elements-6.c: New test.
* gcc.target/s390/vector/reverse-elements-7.c: New test.

6 months agos390: Add expand_perm_reverse_elements
Stefan Schulze Frielinghaus [Thu, 9 Nov 2023 08:33:05 +0000 (09:33 +0100)] 
s390: Add expand_perm_reverse_elements

Replace expand_perm_with_rot, expand_perm_with_vster, and
expand_perm_with_vstbrq with a general implementation
expand_perm_reverse_elements.

gcc/ChangeLog:

* config/s390/s390.cc (expand_perm_with_rot): Remove.
(expand_perm_reverse_elements): New.
(expand_perm_with_vster): Remove.
(expand_perm_with_vstbrq): Remove.
(vectorize_vec_perm_const_1): Replace removed functions with new
one.

6 months agos390: Recognize further vpdi and vmr{l,h} pattern
Stefan Schulze Frielinghaus [Thu, 9 Nov 2023 08:32:58 +0000 (09:32 +0100)] 
s390: Recognize further vpdi and vmr{l,h} pattern

Deal with cases where vpdi and vmr{l,h} are still applicable if the
operands of those instructions are swapped.  For example, currently for

V2DI foo (V2DI x)
{
  return (V2DI) {x[1], x[0]};
}

the assembler sequence

vlgvg   %r1,%v24,1
vzero   %v0
vlvgg   %v0,%r1,0
vmrhg   %v24,%v0,%v24

is emitted.  With this patch a single vpdi is emitted.

Extensive tests are included in a subsequent patch of this series where
more cases are covered.

gcc/ChangeLog:

* config/s390/s390.cc (expand_perm_with_merge): Deal with cases
where vmr{l,h} are still applicable if the operands are swapped.
(expand_perm_with_vpdi): Likewise for vpdi.

6 months agos390: Reduce number of patterns where the condition is false anyway
Stefan Schulze Frielinghaus [Thu, 9 Nov 2023 08:30:45 +0000 (09:30 +0100)] 
s390: Reduce number of patterns where the condition is false anyway

For patterns which make use of two modes, do not build the cross product
and then exclude illegal combinations via conditions but rather do not
create those in the first place.  Here we are following the idea of the
attribute TOINTVEC/tointvec and introduce TOINT/toint.

gcc/ChangeLog:

* config/s390/s390.md (VX_CONV_INT): Remove iterator.
(gf): Add float mappings.
(TOINT, toint): New attribute.
(*fixuns_trunc<VX_CONV_BFP:mode><VX_CONV_INT:mode>2_z13):
Remove.
(*fixuns_trunc<mode><toint>2_z13): Add.
(*fix_trunc<VX_CONV_BFP:mode><VX_CONV_INT:mode>2_bfp_z13):
Remove.
(*fix_trunc<mode><toint>2_bfp_z13): Add.
(*floatuns<VX_CONV_INT:mode><VX_CONV_BFP:mode>2_z13): Remove.
(*floatuns<toint><mode>2_z13): Add.
* config/s390/vector.md (VX_VEC_CONV_INT): Remove iterator.
(float<VX_VEC_CONV_INT:mode><VX_VEC_CONV_BFP:mode>2): Remove.
(float<tointvec><mode>2): Add.
(floatuns<VX_VEC_CONV_INT:mode><VX_VEC_CONV_BFP:mode>2): Remove.
(floatuns<tointvec><mode>2): Add.
(fix_trunc<VX_VEC_CONV_BFP:mode><VX_VEC_CONV_INT:mode>2):
Remove.
(fix_trunc<mode><tointvec>2): Add.
(fixuns_trunc<VX_VEC_CONV_BFP:mode><VX_VEC_CONV_INT:mode>2):
Remove.
(fixuns_trunc<VX_VEC_CONV_BFP:mode><tointvec>2): Add.

6 months agolibgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833]
Jakub Jelinek [Thu, 9 Nov 2023 08:14:07 +0000 (09:14 +0100)] 
libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833]

The following patch adds the missing
{unsigned ,}__int128 <-> _Decimal{32,64,128}
conversion support into libgcc.a on top of the _BitInt support
(doing it without that would be larger amount of code and I hope all
the targets which support __int128 will eventually support _BitInt,
after all it is a required part of C23) and because it is in libgcc.a
only, it doesn't hurt that much if it is added for some architectures
only in GCC 15.
Initially I thought about doing this on the compiler side, but doing
it on the library side seems to be easier and more -Os friendly.
The tests currently require bitint effective target, that can be
removed when all the int128 targets support bitint.

2023-11-09  Jakub Jelinek  <jakub@redhat.com>

PR libgcc/65833
libgcc/
* config/t-softfp (softfp_bid_list): Add
{U,}TItype <-> _Decimal{32,64,128} conversions.
* soft-fp/floattisd.c: New file.
* soft-fp/floattidd.c: New file.
* soft-fp/floattitd.c: New file.
* soft-fp/floatuntisd.c: New file.
* soft-fp/floatuntidd.c: New file.
* soft-fp/floatuntitd.c: New file.
* soft-fp/fixsdti.c: New file.
* soft-fp/fixddti.c: New file.
* soft-fp/fixtdti.c: New file.
* soft-fp/fixunssdti.c: New file.
* soft-fp/fixunsddti.c: New file.
* soft-fp/fixunstdti.c: New file.
gcc/testsuite/
* gcc.dg/dfp/int128-1.c: New test.
* gcc.dg/dfp/int128-2.c: New test.
* gcc.dg/dfp/int128-3.c: New test.
* gcc.dg/dfp/int128-4.c: New test.

6 months agoattribs: Fix ICE with -Wno-attributes= [PR112339]
Jakub Jelinek [Thu, 9 Nov 2023 08:05:54 +0000 (09:05 +0100)] 
attribs: Fix ICE with -Wno-attributes= [PR112339]

The following testcase ICEs, because with -Wno-attributes=foo::no_sanitize
(but generally any other non-gnu namespace and some gnu well known attribute
name within that other namespace) the FEs don't really parse attribute
arguments of such attribute, but lookup_attribute_spec is non-NULL with
NULL handler and such attributes are added to DECL_ATTRIBUTES or
TYPE_ATTRIBUTES and then when e.g. middle-end does lookup_attribute
on a particular attribute and expects the attribute to mean something
and/or have a particular verified arguments, it can crash when seeing
the foreign attribute in there instead.

The following patch fixes that by never adding ignored attributes
to DECL_ATTRIBUTES/TYPE_ATTRIBUTES, previously that was the case just
for attributes in ignored namespace (where lookup_attribute_space
returned NULL).  We don't really know anything about those attributes,
so shouldn't pretend we know something about them, especially when
the arguments are error_mark_node or NULL instead of something that
would have been parsed.  And it would be really weird if we normally
ignore say [[clang::unused]] attribute, but when people use
-Wno-attributes=clang::unused we actually treated it as gnu::unused.
All the user asked for is suppress warnings about that attribute being
unknown.

The first hunk is just playing safe, I'm worried people could
-Wno-attributes=gnu::
and get various crashes with known GNU attributes not being actually
parsed and recorded (or worse e.g. when we tweak standard attributes
into GNU attributes and we wouldn't add those).
The -Wno-attributes= documentation says that it suppresses warning about
unknown attributes, so I think -Wno-attributes=gnu:: should prevent
warning about say [[gnu::foobarbaz]] attribute, but not about
[[gnu::unused]] because the latter is a known attribute.
The routine would return true for any scoped attribute in the ignored
namespace, with the change it ignores only unknown attributes in ignored
namespace, known ones in there will be ignored only if they have
max_length of -2 (e.g.. with
-Wno-attributes=gnu:: -Wno-attributes=gnu::foobarbaz).

2023-11-09  Jakub Jelinek  <jakub@redhat.com>

PR c/112339
* attribs.cc (attribute_ignored_p): Only return true for
attr_namespace_ignored_p if as is NULL.
(decl_attributes): Never add ignored attributes.

* c-c++-common/ubsan/Wno-attributes-1.c: New test.

6 months agoRISC-V: Fix the illegal operands for the XTheadMemidx extension.
Jin Ma [Thu, 9 Nov 2023 07:40:08 +0000 (15:40 +0800)] 
RISC-V: Fix the illegal operands for the XTheadMemidx extension.

The pattern "*extend<SHORT:mode><SUPERQI:mode>2_bitmanip" and
"*zero_extendhi<GPR:mode>2_bitmanip" in bitmanip.md are similar
to the pattern "*th_memidx_bb_extendqi<SUPERQI:mode>2" and
"*th_memidx_bb_zero_extendhi<GPR:mode>2" in thead.md, which will
cause the wrong instruction to be generated and report the
following error in binutils:
Assembler messages:
Error: illegal operands `lb a5,(a0),1,0'

In fact, the correct instruction is "th.lbia a5,(a0),1,0".

gcc/ChangeLog:

* config/riscv/bitmanip.md: Avoid the conflict between
zbb and xtheadmemidx in patterns.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/xtheadfmemidx-uindex-zbb.c: New test.

6 months agoFix SIMD clone SLP a bit more
Richard Biener [Wed, 8 Nov 2023 15:32:11 +0000 (16:32 +0100)] 
Fix SIMD clone SLP a bit more

The following fixes an omission, mangling the non-SLP and SLP
simd-clone info.

* tree-vect-stmts.cc (vectorizable_simd_clone_call): Record
to the correct simd_clone_info.

6 months agolibstdc++: [_Hashtable] Use RAII type to guard node while constructing value
François Dumont [Mon, 30 Oct 2023 05:39:00 +0000 (06:39 +0100)] 
libstdc++: [_Hashtable] Use RAII type to guard node while constructing value

libstdc++-v3/ChangeLog:

* include/bits/hashtable_policy.h
(struct _NodePtrGuard<_HashtableAlloc, _NodePtr>): New.
(_ReuseAllocNode::operator()(_Args&&...)): Use latter to guard allocated node
pointer while constructing in place the value_type instance.

6 months agoRISC-V: Fix dynamic LMUL cost model ICE
Juzhe-Zhong [Thu, 9 Nov 2023 02:39:17 +0000 (10:39 +0800)] 
RISC-V: Fix dynamic LMUL cost model ICE

When trying to use dynamic LMUL to compile benchmark.
Notice there is a bunch ICEs.

This patch fixes those ICEs and append tests.

gcc/ChangeLog:

* config/riscv/riscv-vector-costs.cc (costs::preferred_new_lmul_p): Fix ICE.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul-ice-1.c: New test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul-ice-2.c: New test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul-ice-3.c: New test.

6 months agolibstdc++: optimize bit iterators assuming normalization [PR110807]
Alexandre Oliva [Thu, 9 Nov 2023 03:01:37 +0000 (00:01 -0300)] 
libstdc++: optimize bit iterators assuming normalization [PR110807]

The representation of bit iterators, using a pointer into an array of
words, and an unsigned bit offset into that word, makes for some
optimization challenges: because the compiler doesn't know that the
offset is always in a certain narrow range, beginning at zero and
ending before the word bitwidth, when a function loads an offset that
it hasn't normalized itself, it may fail to derive certain reasonable
conclusions, even to the point of retaining useless calls that elicit
incorrect warnings.

Case at hand: The 110807.cc testcase for bit vectors assigns a 1-bit
list to a global bit vector variable.  Based on the compile-time
constant length of the list, we decide in _M_insert_range whether to
use the existing storage or to allocate new storage for the vector.
After allocation, we decide in _M_copy_aligned how to copy any
preexisting portions of the vector to the newly-allocated storage.
When copying two or more words, we use __builtin_memmove.

However, because we compute the available room using bit offsets
without range information, even comparing them with constants, we fail
to infer ranges for the preexisting vector depending on word size, and
may thus retain the memmove call despite knowing we've only allocated
one word.

Other parts of the compiler then detect the mismatch between the
constant allocation size and the much larger range that could
theoretically be copied into the newly-allocated storage if we could
reach the call.

Ensuring the compiler is aware of the constraints on the offset range
enables it to do a much better job at optimizing.  Using attribute
assume (_M_offset <= ...) didn't work, because gimple lowered that to
something that vrp could only use to ensure 'this' was non-NULL.
Exposing _M_offset as an automatic variable/gimple register outside
the unevaluated assume operand enabled the optimizer to do its job.

Rather than placing such load-then-assume constructs all over, I
introduced an always-inline member function in bit iterators that does
the job of conveying to the compiler the information that the
assumption is supposed to hold, and various calls throughout functions
pertaining to bit iterators that might not otherwise know that the
offsets have to be in range, so that the compiler no longer needs to
make conservative assumptions that prevent optimizations.

With the explicit assumptions, the compiler can correlate the test for
available storage in the vector with the test for how much storage
might need to be copied, and determine that, if we're not asking for
enough room for two or more words, we can omit entirely the code to
copy two or more words, without any runtime overhead whatsoever: no
traces remain of the undefined behavior or of the tests that inform
the compiler about the assumptions that must hold.

for  libstdc++-v3/ChangeLog

PR libstdc++/110807
* include/bits/stl_bvector.h (_Bit_iterator_base): Add
_M_assume_normalized member function.  Call it in _M_bump_up,
_M_bump_down, _M_incr, operator==, operator<=>, operator<, and
operator-.
(_Bit_iterator): Also call it in operator*.
(_Bit_const_iterator): Likewise.

6 months agotestsuite: adjust gomp test for x86 -m32
Alexandre Oliva [Thu, 9 Nov 2023 03:01:35 +0000 (00:01 -0300)] 
testsuite: adjust gomp test for x86 -m32

declare-target-3.C expects .quad for entries in offload_var_table, but
the entries are pointer-wide, so 32-bit targets use .long instead.
Accept both.

for  gcc/testsuite/ChangeLog

* g++.dg/gomp/declare-target-3.C: Adjust for 32-bit targets.

6 months agotestsuite: force PIC/PIE off for pr58245-1.C
Alexandre Oliva [Thu, 9 Nov 2023 03:01:32 +0000 (00:01 -0300)] 
testsuite: force PIC/PIE off for pr58245-1.C

This test expects a single mention of stack_chk_fail, as part of a
call sequence, but when e.g. PIE is enabled by default, we output
.hidden stack_chk_fail_local, which makes for a count mismatch.

Disable PIC/PIE so as to not depend on the configurable default.

for  gcc/testsuite/ChangeLog

* g++.dg/pr58245-1.C: Disable PIC/PIE.

6 months agoskip debug stmts when assigning locus discriminators
Alexandre Oliva [Thu, 9 Nov 2023 03:01:30 +0000 (00:01 -0300)] 
skip debug stmts when assigning locus discriminators

c-c++-common/goacc/kernels-loop-g.c has been failing (compare-debug)
on i686-linux-gnu since r13-3172, because the implementation enabled
debug stmts to cause discriminators to be assigned differently, and
the discriminators are printed in the .gkd dumps that -fcompare-debug
compares.

This patch prevents debug stmts from affecting the discriminators in
nondebug stmts, but enables debug stmts to get discriminators just as
nondebug stmts would if their line numbers match.

I suppose we could arrange for discriminators to be omitted from the
-fcompare-debug dumps, but keeping discriminators in sync is probably
good to avoid other potential sources of divergence between debug and
nondebug.

for  gcc/ChangeLog

* tree-cfg.cc (assign_discriminators): Handle debug stmts.

6 months agoRISC-V: Fix dynamic tests [NFC]
Juzhe-Zhong [Thu, 9 Nov 2023 01:55:37 +0000 (09:55 +0800)] 
RISC-V: Fix dynamic tests [NFC]

This patch just adapt dynamic LMUL tests for following preparing patches.

Committed.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul-mixed-1.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-1.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-2.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-3.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-4.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-5.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-6.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-7.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-1.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-2.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-3.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-4.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-5.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-6.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-7.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-1.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-2.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-3.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-4.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-5.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-6.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-7.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-8.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-9.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-1.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-10.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-2.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-3.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-4.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-5.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-6.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-7.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-8.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-9.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/no-dynamic-lmul-1.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/pr111848.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/rvv-costmodel-vect.exp: Run all tests.

6 months agoDaily bump.
GCC Administrator [Thu, 9 Nov 2023 00:17:25 +0000 (00:17 +0000)] 
Daily bump.

6 months agoi386: Apply LRA reload workaround to insns with high registers [PR82524]
Uros Bizjak [Wed, 8 Nov 2023 20:46:26 +0000 (21:46 +0100)] 
i386: Apply LRA reload workaround to insns with high registers [PR82524]

LRA is not able to reload zero_extracted in-out operand with matched input
operand in the same way as strict_low_part in-out operand.  The patch
applies the strict_low_part workaround, where we allow LRA to generate
an instruction with non-matched input operand, which is split post reload
to the instruction that inserts non-matched input operand to an in-out
operand and the instruction that uses matched operand, also to
zero_extracted in-out operand case.

The generated code from the pr82524.c testcase improves from:

movl    %esi, %ecx
movl    %edi, %eax
movsbl  %ch, %esi
addl    %esi, %edx
movb    %dl, %ah

to:
movl    %edi, %eax
movl    %esi, %ecx
movb    %ch, %ah
addb    %dl, %ah

The compiler is now also able to handle non-commutative operations:

movl    %edi, %eax
movl    %esi, %ecx
movb    %ch, %ah
subb    %dl, %ah

and unary operations:

movl    %edi, %eax
movl    %esi, %edx
movb    %dh, %ah
negb    %ah

The patch also robustifies split condition of the splitters to ensure that
only alternatives with unmatched operands are split.

PR target/82524

gcc/ChangeLog:

* config/i386/i386.md (*add<mode>_1_slp):
Split insn only for unmatched operand 0.
(*sub<mode>_1_slp): Ditto.
(*<any_logic:code><mode>_1_slp): Merge pattern from "*and<mode>_1_slp"
and "*<any_logic:code><mode>_1_slp" using any_logic code iterator.
Split insn only for unmatched operand 0.
(*neg<mode>1_slp): Split insn only for unmatched operand 0.
(*one_cmpl<mode>_1_slp): Ditto.
(*ashl<mode>3_1_slp): Ditto.
(*<any_shiftrt:insn><mode>_1_slp): Ditto.
(*<any_rotate:insn><mode>_1_slp): Ditto.
(*addqi_ext<mode>_1): Redefine as define_insn_and_split.  Add
alternative 1 and split insn after reload for unmatched operand 0.
(*<plusminus:insn>qi_ext<mode>_2): Merge pattern from
"*addqi_ext<mode>_2" and "*subqi_ext<mode>_2" using plusminus code
iterator. Redefine as define_insn_and_split.  Add alternative 1
and split insn after reload for unmatched operand 0.
(*subqi_ext<mode>_1): Redefine as define_insn_and_split.  Add
alternative 1 and split insn after reload for unmatched operand 0.
(*<any_logic:code>qi_ext<mode>_0): Merge pattern from
"*andqi_ext<mode>_0" and and "*<any_logic:code>qi_ext<mode>_0" using
any_logic code iterator.
(*<any_logic:code>qi_ext<mode>_1): Merge pattern from
"*andqi_ext<mode>_1" and "*<any_logic:code>qi_ext<mode>_1" using
any_logic code iterator. Redefine as define_insn_and_split.  Add
alternative 1 and split insn after reload for unmatched operand 0.
(*<any_logic:code>qi_ext<mode>_1_cc): Merge pattern from
"*andqi_ext<mode>_1_cc" and "*xorqi_ext<mode>_1_cc" using any_logic
code iterator. Redefine as define_insn_and_split.  Add alternative 1
and split insn after reload for unmatched operand 0.
(*<any_logic:code>qi_ext<mode>_2): Merge pattern from
"*andqi_ext<mode>_2" and "*<any_or:code>qi_ext<mode>_2" using
any_logic code iterator. Redefine as define_insn_and_split.  Add
alternative 1 and split insn after reload for unmatched operand 0.
(*<any_logic:code>qi_ext<mode>_3): Redefine as define_insn_and_split.
Add alternative 1 and split insn after reload for unmatched operand 0.
(*negqi_ext<mode>_1): Rename from "*negqi_ext<mode>_2".  Add
alternative 1 and split insn after reload for unmatched operand 0.
(*one_cmplqi_ext<mode>_1): Ditto.
(*ashlqi_ext<mode>_1): Ditto.
(*<any_shiftrt:insn>qi_ext<mode>_1): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr78904-1.c (test_sub): New test.
* gcc.target/i386/pr78904-1a.c (test_sub): Ditto.
* gcc.target/i386/pr78904-1b.c (test_sub): Ditto.
* gcc.target/i386/pr78904-2.c (test_sub): Ditto.
* gcc.target/i386/pr78904-2a.c (test_sub): Ditto.
* gcc.target/i386/pr78904-2b.c (test_sub): Ditto.
* gcc.target/i386/pr78952-4.c (test_sub): Ditto.
* gcc.target/i386/pr82524.c: New test.
* gcc.target/i386/pr82524-1.c: New test.
* gcc.target/i386/pr82524-2.c: New test.
* gcc.target/i386/pr82524-3.c: New test.

6 months agoFix SLP of emulated gathers
Richard Biener [Wed, 8 Nov 2023 14:42:16 +0000 (15:42 +0100)] 
Fix SLP of emulated gathers

The following fixes an error in the SLP of emulated gathers,
discovered by x86 specific tests when enabling single-lane SLP.

* tree-vect-stmts.cc (vectorizable_load): Adjust offset
vector gathering for SLP of emulated gathers.

6 months agoTLC to vect_check_store_rhs and vect_slp_child_index_for_operand
Richard Biener [Wed, 8 Nov 2023 14:25:51 +0000 (15:25 +0100)] 
TLC to vect_check_store_rhs and vect_slp_child_index_for_operand

This prepares us for the SLP of scatters.  We have to tell
vect_slp_child_index_for_operand whether we are dealing with
a scatter/gather stmt so this adds an argument similar to
the one we have for vect_get_operand_map.  This also refactors
vect_check_store_rhs to get the actual rhs and the associated
SLP node instead of leaving that to the caller.

* tree-vectorizer.h (vect_slp_child_index_for_operand):
Add gatherscatter_p argument.
* tree-vect-slp.cc (vect_slp_child_index_for_operand): Likewise.
Pass it on.
* tree-vect-stmts.cc (vect_check_store_rhs): Turn the rhs
argument into an output, also output the SLP node associated
with it.
(vectorizable_simd_clone_call): Adjust.
(vectorizable_store): Likewise.
(vectorizable_load): Likewise.

6 months agoFix SLP of masked loads
Richard Biener [Wed, 8 Nov 2023 14:18:21 +0000 (15:18 +0100)] 
Fix SLP of masked loads

The following adjusts things to use the correct mask operand for
the SLP of masked loads and gathers.  Test coverage is from
runtime fails of i386 specific AVX512 tests when enabling single-lane
SLP.

* tree-vect-stmts.cc (vectorizable_load): Use the correct
vectorized mask operand.

6 months agoRISC-V: Removed unnecessary sign-extend for vsetvl
Lehua Ding [Wed, 8 Nov 2023 13:17:48 +0000 (21:17 +0800)] 
RISC-V: Removed unnecessary sign-extend for vsetvl

Hi,

This patch try to combine bellow two insns and then further remove
unnecessary sign_extend operations. This optimization is borrowed
from LLVM (https://godbolt.org/z/4f6v56xej):
  (set (reg:DI 134 [ _1 ])
       (unspec:DI [
               (const_int 19 [0x13])
               (const_int 8 [0x8])
               (const_int 5 [0x5])
               (const_int 2 [0x2]) repeated x2
           ] UNSPEC_VSETVL))
  (set (reg/v:DI 135 [ <retval> ])
          (sign_extend:DI (subreg:SI (reg:DI 134 [ _1 ]) 0)))

The reason we can remove signe_extend is because currently the vl value
returned by the vsetvl instruction ranges from 0 to 65536 (uint16_t), and
bits 17 to 63 (including 31) are always 0, so there is no change after
sign_extend. Note that for HI and QI modes we cannot do this.
Of course, if the range returned by vsetvl later expands to 32 bits,
then this combine pattern needs to be removed. But that could be
a long time from now.

gcc/ChangeLog:

* config/riscv/vector.md (*vsetvldi_no_side_effects_si_extend):
New combine pattern.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/vsetvl/vsetvl_int.c: New test.

6 months agoImprove C99 compatibility of gcc.dg/setjmp-7.c test
Florian Weimer [Wed, 8 Nov 2023 10:19:10 +0000 (11:19 +0100)] 
Improve C99 compatibility of gcc.dg/setjmp-7.c test

gcc/testsuite/ChangeLog:

* gcc.dg/setjmp-7.c (_setjmp): Declare.

6 months agoLibF7: Tweak IEEE double multiplication.
Georg-Johann Lay [Wed, 8 Nov 2023 11:43:49 +0000 (12:43 +0100)] 
LibF7: Tweak IEEE double multiplication.

libgcc/config/avr/libf7/
* libf7-asm.sx (mul_mant) [AVR_HAVE_MUL]: Tweak code.

6 months agoRISC-V: Fix VSETVL VL check condition bug
Juzhe-Zhong [Wed, 8 Nov 2023 11:33:06 +0000 (19:33 +0800)] 
RISC-V: Fix VSETVL VL check condition bug

When fixing the induction variable vectorization bug, notice there is a ICE bug
in VSETVL PASS:

0x178015b rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int, char const*)
        ../../../../gcc/gcc/rtl.cc:770
0x1079cdd rhs_regno(rtx_def const*)
        ../../../../gcc/gcc/rtl.h:1934
0x1dab360 vsetvl_info::parse_insn(rtl_ssa::insn_info*)
        ../../../../gcc/gcc/config/riscv/riscv-vsetvl.cc:1070
0x1daa272 vsetvl_info::vsetvl_info(rtl_ssa::insn_info*)
        ../../../../gcc/gcc/config/riscv/riscv-vsetvl.cc:746
0x1da5d98 pre_vsetvl::fuse_local_vsetvl_info()
        ../../../../gcc/gcc/config/riscv/riscv-vsetvl.cc:2708
0x1da94d9 pass_vsetvl::lazy_vsetvl()
        ../../../../gcc/gcc/config/riscv/riscv-vsetvl.cc:3444
0x1da977c pass_vsetvl::execute(function*)
        ../../../../gcc/gcc/config/riscv/riscv-vsetvl.cc:3504

Committed as it is obvious.

gcc/ChangeLog:

* config/riscv/riscv-vsetvl.cc: Fix ICE.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vl-use-ice.c: New test.

6 months agolibgfortran: Remove empty array descriptor first dimension overwrite [PR112371]
Mikael Morin [Tue, 7 Nov 2023 10:24:04 +0000 (11:24 +0100)] 
libgfortran: Remove empty array descriptor first dimension overwrite [PR112371]

Remove the forced overwrite of the first dimension of the result array
descriptor to set it to zero extent, in the function templates for
transformational functions doing an array reduction along a dimension.  This
overwrite, which happened before early returning in case the result array
was empty, was wrong because an array may have a non-zero extent in the
first dimension and still be empty if it has a zero extent in a higher
dimension.  Overwriting the dimension was resulting in wrong array result
upper bound for the first dimension in that case.

The offending piece of code was present in several places, and this removes
them all.  More precisely, there is only one case to fix for logical
reduction functions, and there are three cases for other reduction
functions, corresponding to non-masked reduction, reduction with array mask,
and reduction with scalar mask.  The impacted m4 files are
ifunction_logical.m4 for logical reduction functions, ifunction.m4 for
regular functions and types, ifunction-s.m4 for character minloc and maxloc,
ifunction-s2.m4 for character minval and maxval, and ifindloc1.m4 for
findloc.

PR fortran/112371

libgfortran/ChangeLog:

* m4/ifunction.m4 (START_ARRAY_FUNCTION, START_MASKED_ARRAY_FUNCTION,
SCALAR_ARRAY_FUNCTION): Remove overwrite of the first dimension of the
array descriptor.
* m4/ifunction-s.m4 (START_ARRAY_FUNCTION, START_MASKED_ARRAY_FUNCTION,
SCALAR_ARRAY_FUNCTION): Ditto.
* m4/ifunction-s2.m4 (START_ARRAY_FUNCTION,
START_MASKED_ARRAY_FUNCTION, SCALAR_ARRAY_FUNCTION): Ditto.
* m4/ifunction_logical.m4 (START_ARRAY_FUNCTION): Ditto.
* m4/ifindloc1.m4: Ditto.
* generated/all_l1.c: Regenerate.
* generated/all_l16.c: Regenerate.
* generated/all_l2.c: Regenerate.
* generated/all_l4.c: Regenerate.
* generated/all_l8.c: Regenerate.
* generated/any_l1.c: Regenerate.
* generated/any_l16.c: Regenerate.
* generated/any_l2.c: Regenerate.
* generated/any_l4.c: Regenerate.
* generated/any_l8.c: Regenerate.
* generated/count_16_l.c: Regenerate.
* generated/count_1_l.c: Regenerate.
* generated/count_2_l.c: Regenerate.
* generated/count_4_l.c: Regenerate.
* generated/count_8_l.c: Regenerate.
* generated/findloc1_c10.c: Regenerate.
* generated/findloc1_c16.c: Regenerate.
* generated/findloc1_c17.c: Regenerate.
* generated/findloc1_c4.c: Regenerate.
* generated/findloc1_c8.c: Regenerate.
* generated/findloc1_i1.c: Regenerate.
* generated/findloc1_i16.c: Regenerate.
* generated/findloc1_i2.c: Regenerate.
* generated/findloc1_i4.c: Regenerate.
* generated/findloc1_i8.c: Regenerate.
* generated/findloc1_r10.c: Regenerate.
* generated/findloc1_r16.c: Regenerate.
* generated/findloc1_r17.c: Regenerate.
* generated/findloc1_r4.c: Regenerate.
* generated/findloc1_r8.c: Regenerate.
* generated/findloc1_s1.c: Regenerate.
* generated/findloc1_s4.c: Regenerate.
* generated/iall_i1.c: Regenerate.
* generated/iall_i16.c: Regenerate.
* generated/iall_i2.c: Regenerate.
* generated/iall_i4.c: Regenerate.
* generated/iall_i8.c: Regenerate.
* generated/iany_i1.c: Regenerate.
* generated/iany_i16.c: Regenerate.
* generated/iany_i2.c: Regenerate.
* generated/iany_i4.c: Regenerate.
* generated/iany_i8.c: Regenerate.
* generated/iparity_i1.c: Regenerate.
* generated/iparity_i16.c: Regenerate.
* generated/iparity_i2.c: Regenerate.
* generated/iparity_i4.c: Regenerate.
* generated/iparity_i8.c: Regenerate.
* generated/maxloc1_16_i1.c: Regenerate.
* generated/maxloc1_16_i16.c: Regenerate.
* generated/maxloc1_16_i2.c: Regenerate.
* generated/maxloc1_16_i4.c: Regenerate.
* generated/maxloc1_16_i8.c: Regenerate.
* generated/maxloc1_16_r10.c: Regenerate.
* generated/maxloc1_16_r16.c: Regenerate.
* generated/maxloc1_16_r17.c: Regenerate.
* generated/maxloc1_16_r4.c: Regenerate.
* generated/maxloc1_16_r8.c: Regenerate.
* generated/maxloc1_16_s1.c: Regenerate.
* generated/maxloc1_16_s4.c: Regenerate.
* generated/maxloc1_4_i1.c: Regenerate.
* generated/maxloc1_4_i16.c: Regenerate.
* generated/maxloc1_4_i2.c: Regenerate.
* generated/maxloc1_4_i4.c: Regenerate.
* generated/maxloc1_4_i8.c: Regenerate.
* generated/maxloc1_4_r10.c: Regenerate.
* generated/maxloc1_4_r16.c: Regenerate.
* generated/maxloc1_4_r17.c: Regenerate.
* generated/maxloc1_4_r4.c: Regenerate.
* generated/maxloc1_4_r8.c: Regenerate.
* generated/maxloc1_4_s1.c: Regenerate.
* generated/maxloc1_4_s4.c: Regenerate.
* generated/maxloc1_8_i1.c: Regenerate.
* generated/maxloc1_8_i16.c: Regenerate.
* generated/maxloc1_8_i2.c: Regenerate.
* generated/maxloc1_8_i4.c: Regenerate.
* generated/maxloc1_8_i8.c: Regenerate.
* generated/maxloc1_8_r10.c: Regenerate.
* generated/maxloc1_8_r16.c: Regenerate.
* generated/maxloc1_8_r17.c: Regenerate.
* generated/maxloc1_8_r4.c: Regenerate.
* generated/maxloc1_8_r8.c: Regenerate.
* generated/maxloc1_8_s1.c: Regenerate.
* generated/maxloc1_8_s4.c: Regenerate.
* generated/maxval1_s1.c: Regenerate.
* generated/maxval1_s4.c: Regenerate.
* generated/maxval_i1.c: Regenerate.
* generated/maxval_i16.c: Regenerate.
* generated/maxval_i2.c: Regenerate.
* generated/maxval_i4.c: Regenerate.
* generated/maxval_i8.c: Regenerate.
* generated/maxval_r10.c: Regenerate.
* generated/maxval_r16.c: Regenerate.
* generated/maxval_r17.c: Regenerate.
* generated/maxval_r4.c: Regenerate.
* generated/maxval_r8.c: Regenerate.
* generated/minloc1_16_i1.c: Regenerate.
* generated/minloc1_16_i16.c: Regenerate.
* generated/minloc1_16_i2.c: Regenerate.
* generated/minloc1_16_i4.c: Regenerate.
* generated/minloc1_16_i8.c: Regenerate.
* generated/minloc1_16_r10.c: Regenerate.
* generated/minloc1_16_r16.c: Regenerate.
* generated/minloc1_16_r17.c: Regenerate.
* generated/minloc1_16_r4.c: Regenerate.
* generated/minloc1_16_r8.c: Regenerate.
* generated/minloc1_16_s1.c: Regenerate.
* generated/minloc1_16_s4.c: Regenerate.
* generated/minloc1_4_i1.c: Regenerate.
* generated/minloc1_4_i16.c: Regenerate.
* generated/minloc1_4_i2.c: Regenerate.
* generated/minloc1_4_i4.c: Regenerate.
* generated/minloc1_4_i8.c: Regenerate.
* generated/minloc1_4_r10.c: Regenerate.
* generated/minloc1_4_r16.c: Regenerate.
* generated/minloc1_4_r17.c: Regenerate.
* generated/minloc1_4_r4.c: Regenerate.
* generated/minloc1_4_r8.c: Regenerate.
* generated/minloc1_4_s1.c: Regenerate.
* generated/minloc1_4_s4.c: Regenerate.
* generated/minloc1_8_i1.c: Regenerate.
* generated/minloc1_8_i16.c: Regenerate.
* generated/minloc1_8_i2.c: Regenerate.
* generated/minloc1_8_i4.c: Regenerate.
* generated/minloc1_8_i8.c: Regenerate.
* generated/minloc1_8_r10.c: Regenerate.
* generated/minloc1_8_r16.c: Regenerate.
* generated/minloc1_8_r17.c: Regenerate.
* generated/minloc1_8_r4.c: Regenerate.
* generated/minloc1_8_r8.c: Regenerate.
* generated/minloc1_8_s1.c: Regenerate.
* generated/minloc1_8_s4.c: Regenerate.
* generated/minval1_s1.c: Regenerate.
* generated/minval1_s4.c: Regenerate.
* generated/minval_i1.c: Regenerate.
* generated/minval_i16.c: Regenerate.
* generated/minval_i2.c: Regenerate.
* generated/minval_i4.c: Regenerate.
* generated/minval_i8.c: Regenerate.
* generated/minval_r10.c: Regenerate.
* generated/minval_r16.c: Regenerate.
* generated/minval_r17.c: Regenerate.
* generated/minval_r4.c: Regenerate.
* generated/minval_r8.c: Regenerate.
* generated/norm2_r10.c: Regenerate.
* generated/norm2_r16.c: Regenerate.
* generated/norm2_r17.c: Regenerate.
* generated/norm2_r4.c: Regenerate.
* generated/norm2_r8.c: Regenerate.
* generated/parity_l1.c: Regenerate.
* generated/parity_l16.c: Regenerate.
* generated/parity_l2.c: Regenerate.
* generated/parity_l4.c: Regenerate.
* generated/parity_l8.c: Regenerate.
* generated/product_c10.c: Regenerate.
* generated/product_c16.c: Regenerate.
* generated/product_c17.c: Regenerate.
* generated/product_c4.c: Regenerate.
* generated/product_c8.c: Regenerate.
* generated/product_i1.c: Regenerate.
* generated/product_i16.c: Regenerate.
* generated/product_i2.c: Regenerate.
* generated/product_i4.c: Regenerate.
* generated/product_i8.c: Regenerate.
* generated/product_r10.c: Regenerate.
* generated/product_r16.c: Regenerate.
* generated/product_r17.c: Regenerate.
* generated/product_r4.c: Regenerate.
* generated/product_r8.c: Regenerate.
* generated/sum_c10.c: Regenerate.
* generated/sum_c16.c: Regenerate.
* generated/sum_c17.c: Regenerate.
* generated/sum_c4.c: Regenerate.
* generated/sum_c8.c: Regenerate.
* generated/sum_i1.c: Regenerate.
* generated/sum_i16.c: Regenerate.
* generated/sum_i2.c: Regenerate.
* generated/sum_i4.c: Regenerate.
* generated/sum_i8.c: Regenerate.
* generated/sum_r10.c: Regenerate.
* generated/sum_r16.c: Regenerate.
* generated/sum_r17.c: Regenerate.
* generated/sum_r4.c: Regenerate.
* generated/sum_r8.c: Regenerate.

gcc/testsuite/ChangeLog:

* gfortran.dg/bound_11.f90: New test.

6 months agolibgfortran: Remove early return if extent is zero [PR112371]
Mikael Morin [Tue, 7 Nov 2023 10:24:03 +0000 (11:24 +0100)] 
libgfortran: Remove early return if extent is zero [PR112371]

Remove the early return present in function templates for transformational
functions doing a (masked) reduction of an array along a dimension.
This early return, which triggered if the extent in the reduction dimension
was zero, was wrong because even if the reduction operation degenerates to
a constant value in that case, one has to loop anyway along the other
dimensions to initialize every element of the resulting array with that
constant value.  The case of negative extent (not sure whether it may happen
in practice) which was also early returning, is handled by clamping to zero.

The offending piece of code was present in several places, and this removes
them all.  Namely, the impacted m4 files are ifunction.m4 for regular
functions and types, ifunction-s.m4 for character minloc and maxloc, and
ifunction-s2.m4 for character minval and maxval.

PR fortran/112371

libgfortran/ChangeLog:

* m4/ifunction.m4 (START_MASKED_ARRAY_FUNCTION): Remove early return if
extent is zero or less, and clamp negative value to zero.
* m4/ifunction-s.m4 (START_MASKED_ARRAY_FUNCTION): Ditto.
* m4/ifunction-s2.m4 (START_MASKED_ARRAY_FUNCTION): Ditto.
* generated/iall_i1.c: Regenerate.
* generated/iall_i16.c: Regenerate.
* generated/iall_i2.c: Regenerate.
* generated/iall_i4.c: Regenerate.
* generated/iall_i8.c: Regenerate.
* generated/iany_i1.c: Regenerate.
* generated/iany_i16.c: Regenerate.
* generated/iany_i2.c: Regenerate.
* generated/iany_i4.c: Regenerate.
* generated/iany_i8.c: Regenerate.
* generated/iparity_i1.c: Regenerate.
* generated/iparity_i16.c: Regenerate.
* generated/iparity_i2.c: Regenerate.
* generated/iparity_i4.c: Regenerate.
* generated/iparity_i8.c: Regenerate.
* generated/maxloc1_16_i1.c: Regenerate.
* generated/maxloc1_16_i16.c: Regenerate.
* generated/maxloc1_16_i2.c: Regenerate.
* generated/maxloc1_16_i4.c: Regenerate.
* generated/maxloc1_16_i8.c: Regenerate.
* generated/maxloc1_16_r10.c: Regenerate.
* generated/maxloc1_16_r16.c: Regenerate.
* generated/maxloc1_16_r17.c: Regenerate.
* generated/maxloc1_16_r4.c: Regenerate.
* generated/maxloc1_16_r8.c: Regenerate.
* generated/maxloc1_16_s1.c: Regenerate.
* generated/maxloc1_16_s4.c: Regenerate.
* generated/maxloc1_4_i1.c: Regenerate.
* generated/maxloc1_4_i16.c: Regenerate.
* generated/maxloc1_4_i2.c: Regenerate.
* generated/maxloc1_4_i4.c: Regenerate.
* generated/maxloc1_4_i8.c: Regenerate.
* generated/maxloc1_4_r10.c: Regenerate.
* generated/maxloc1_4_r16.c: Regenerate.
* generated/maxloc1_4_r17.c: Regenerate.
* generated/maxloc1_4_r4.c: Regenerate.
* generated/maxloc1_4_r8.c: Regenerate.
* generated/maxloc1_4_s1.c: Regenerate.
* generated/maxloc1_4_s4.c: Regenerate.
* generated/maxloc1_8_i1.c: Regenerate.
* generated/maxloc1_8_i16.c: Regenerate.
* generated/maxloc1_8_i2.c: Regenerate.
* generated/maxloc1_8_i4.c: Regenerate.
* generated/maxloc1_8_i8.c: Regenerate.
* generated/maxloc1_8_r10.c: Regenerate.
* generated/maxloc1_8_r16.c: Regenerate.
* generated/maxloc1_8_r17.c: Regenerate.
* generated/maxloc1_8_r4.c: Regenerate.
* generated/maxloc1_8_r8.c: Regenerate.
* generated/maxloc1_8_s1.c: Regenerate.
* generated/maxloc1_8_s4.c: Regenerate.
* generated/maxval1_s1.c: Regenerate.
* generated/maxval1_s4.c: Regenerate.
* generated/maxval_i1.c: Regenerate.
* generated/maxval_i16.c: Regenerate.
* generated/maxval_i2.c: Regenerate.
* generated/maxval_i4.c: Regenerate.
* generated/maxval_i8.c: Regenerate.
* generated/maxval_r10.c: Regenerate.
* generated/maxval_r16.c: Regenerate.
* generated/maxval_r17.c: Regenerate.
* generated/maxval_r4.c: Regenerate.
* generated/maxval_r8.c: Regenerate.
* generated/minloc1_16_i1.c: Regenerate.
* generated/minloc1_16_i16.c: Regenerate.
* generated/minloc1_16_i2.c: Regenerate.
* generated/minloc1_16_i4.c: Regenerate.
* generated/minloc1_16_i8.c: Regenerate.
* generated/minloc1_16_r10.c: Regenerate.
* generated/minloc1_16_r16.c: Regenerate.
* generated/minloc1_16_r17.c: Regenerate.
* generated/minloc1_16_r4.c: Regenerate.
* generated/minloc1_16_r8.c: Regenerate.
* generated/minloc1_16_s1.c: Regenerate.
* generated/minloc1_16_s4.c: Regenerate.
* generated/minloc1_4_i1.c: Regenerate.
* generated/minloc1_4_i16.c: Regenerate.
* generated/minloc1_4_i2.c: Regenerate.
* generated/minloc1_4_i4.c: Regenerate.
* generated/minloc1_4_i8.c: Regenerate.
* generated/minloc1_4_r10.c: Regenerate.
* generated/minloc1_4_r16.c: Regenerate.
* generated/minloc1_4_r17.c: Regenerate.
* generated/minloc1_4_r4.c: Regenerate.
* generated/minloc1_4_r8.c: Regenerate.
* generated/minloc1_4_s1.c: Regenerate.
* generated/minloc1_4_s4.c: Regenerate.
* generated/minloc1_8_i1.c: Regenerate.
* generated/minloc1_8_i16.c: Regenerate.
* generated/minloc1_8_i2.c: Regenerate.
* generated/minloc1_8_i4.c: Regenerate.
* generated/minloc1_8_i8.c: Regenerate.
* generated/minloc1_8_r10.c: Regenerate.
* generated/minloc1_8_r16.c: Regenerate.
* generated/minloc1_8_r17.c: Regenerate.
* generated/minloc1_8_r4.c: Regenerate.
* generated/minloc1_8_r8.c: Regenerate.
* generated/minloc1_8_s1.c: Regenerate.
* generated/minloc1_8_s4.c: Regenerate.
* generated/minval1_s1.c: Regenerate.
* generated/minval1_s4.c: Regenerate.
* generated/minval_i1.c: Regenerate.
* generated/minval_i16.c: Regenerate.
* generated/minval_i2.c: Regenerate.
* generated/minval_i4.c: Regenerate.
* generated/minval_i8.c: Regenerate.
* generated/minval_r10.c: Regenerate.
* generated/minval_r16.c: Regenerate.
* generated/minval_r17.c: Regenerate.
* generated/minval_r4.c: Regenerate.
* generated/minval_r8.c: Regenerate.
* generated/product_c10.c: Regenerate.
* generated/product_c16.c: Regenerate.
* generated/product_c17.c: Regenerate.
* generated/product_c4.c: Regenerate.
* generated/product_c8.c: Regenerate.
* generated/product_i1.c: Regenerate.
* generated/product_i16.c: Regenerate.
* generated/product_i2.c: Regenerate.
* generated/product_i4.c: Regenerate.
* generated/product_i8.c: Regenerate.
* generated/product_r10.c: Regenerate.
* generated/product_r16.c: Regenerate.
* generated/product_r17.c: Regenerate.
* generated/product_r4.c: Regenerate.
* generated/product_r8.c: Regenerate.
* generated/sum_c10.c: Regenerate.
* generated/sum_c16.c: Regenerate.
* generated/sum_c17.c: Regenerate.
* generated/sum_c4.c: Regenerate.
* generated/sum_c8.c: Regenerate.
* generated/sum_i1.c: Regenerate.
* generated/sum_i16.c: Regenerate.
* generated/sum_i2.c: Regenerate.
* generated/sum_i4.c: Regenerate.
* generated/sum_i8.c: Regenerate.
* generated/sum_r10.c: Regenerate.
* generated/sum_r16.c: Regenerate.
* generated/sum_r17.c: Regenerate.
* generated/sum_r4.c: Regenerate.
* generated/sum_r8.c: Regenerate.

gcc/testsuite/ChangeLog:

* gfortran.dg/bound_10.f90: New test.

6 months agolibgfortran: Don't skip allocation if size is zero [PR112412]
Mikael Morin [Tue, 7 Nov 2023 10:24:02 +0000 (11:24 +0100)] 
libgfortran: Don't skip allocation if size is zero [PR112412]

In the function template of transformational functions doing a reduction
of an array along one dimension, if the passed in result array was
unallocated and the calculated allocation size was zero (this is the case
of empty result arrays), an early return used to skip the allocation.  This
change moves the allocation before the early return, so that empty result
arrays are not seen as unallocated.  This is possible because zero size is
explicitly supported by the allocation function.

The offending code is present in several places, and this updates them all.
More precisely, there is one place in the template for logical reductions,
and there are two places in the templates corresponding to masked reductions
with respectively array mask and scalar mask.  Templates for unmasked
reductions, which already allocate before returning, are not affected, but
unmasked reductions are checked nevertheless in the testcase.  The affected
m4 files are ifunction.m4 for regular functions and types, ifunction-s.m4
for character minloc and maxloc, ifunction-s2.m4 for character minval and
maxval, and ifunction_logical for logical reductions.

PR fortran/112412

libgfortran/ChangeLog:

* m4/ifunction.m4 (START_MASKED_ARRAY_FUNCTION, SCALAR_ARRAY_FUNCTION):
Don't skip allocation if the allocation size is zero.
* m4/ifunction-s.m4 (START_MASKED_ARRAY_FUNCTION,
SCALAR_ARRAY_FUNCTION): Ditto.
* m4/ifunction-s2.m4 (START_MASKED_ARRAY_FUNCTION,
SCALAR_ARRAY_FUNCTION): Ditto.
* m4/ifunction_logical.m4 (START_ARRAY_FUNCTION): Ditto.
* generated/all_l1.c: Regenerate.
* generated/all_l16.c: Regenerate.
* generated/all_l2.c: Regenerate.
* generated/all_l4.c: Regenerate.
* generated/all_l8.c: Regenerate.
* generated/any_l1.c: Regenerate.
* generated/any_l16.c: Regenerate.
* generated/any_l2.c: Regenerate.
* generated/any_l4.c: Regenerate.
* generated/any_l8.c: Regenerate.
* generated/count_16_l.c: Regenerate.
* generated/count_1_l.c: Regenerate.
* generated/count_2_l.c: Regenerate.
* generated/count_4_l.c: Regenerate.
* generated/count_8_l.c: Regenerate.
* generated/iall_i1.c: Regenerate.
* generated/iall_i16.c: Regenerate.
* generated/iall_i2.c: Regenerate.
* generated/iall_i4.c: Regenerate.
* generated/iall_i8.c: Regenerate.
* generated/iany_i1.c: Regenerate.
* generated/iany_i16.c: Regenerate.
* generated/iany_i2.c: Regenerate.
* generated/iany_i4.c: Regenerate.
* generated/iany_i8.c: Regenerate.
* generated/iparity_i1.c: Regenerate.
* generated/iparity_i16.c: Regenerate.
* generated/iparity_i2.c: Regenerate.
* generated/iparity_i4.c: Regenerate.
* generated/iparity_i8.c: Regenerate.
* generated/maxloc1_16_i1.c: Regenerate.
* generated/maxloc1_16_i16.c: Regenerate.
* generated/maxloc1_16_i2.c: Regenerate.
* generated/maxloc1_16_i4.c: Regenerate.
* generated/maxloc1_16_i8.c: Regenerate.
* generated/maxloc1_16_r10.c: Regenerate.
* generated/maxloc1_16_r16.c: Regenerate.
* generated/maxloc1_16_r17.c: Regenerate.
* generated/maxloc1_16_r4.c: Regenerate.
* generated/maxloc1_16_r8.c: Regenerate.
* generated/maxloc1_16_s1.c: Regenerate.
* generated/maxloc1_16_s4.c: Regenerate.
* generated/maxloc1_4_i1.c: Regenerate.
* generated/maxloc1_4_i16.c: Regenerate.
* generated/maxloc1_4_i2.c: Regenerate.
* generated/maxloc1_4_i4.c: Regenerate.
* generated/maxloc1_4_i8.c: Regenerate.
* generated/maxloc1_4_r10.c: Regenerate.
* generated/maxloc1_4_r16.c: Regenerate.
* generated/maxloc1_4_r17.c: Regenerate.
* generated/maxloc1_4_r4.c: Regenerate.
* generated/maxloc1_4_r8.c: Regenerate.
* generated/maxloc1_4_s1.c: Regenerate.
* generated/maxloc1_4_s4.c: Regenerate.
* generated/maxloc1_8_i1.c: Regenerate.
* generated/maxloc1_8_i16.c: Regenerate.
* generated/maxloc1_8_i2.c: Regenerate.
* generated/maxloc1_8_i4.c: Regenerate.
* generated/maxloc1_8_i8.c: Regenerate.
* generated/maxloc1_8_r10.c: Regenerate.
* generated/maxloc1_8_r16.c: Regenerate.
* generated/maxloc1_8_r17.c: Regenerate.
* generated/maxloc1_8_r4.c: Regenerate.
* generated/maxloc1_8_r8.c: Regenerate.
* generated/maxloc1_8_s1.c: Regenerate.
* generated/maxloc1_8_s4.c: Regenerate.
* generated/maxval1_s1.c: Regenerate.
* generated/maxval1_s4.c: Regenerate.
* generated/maxval_i1.c: Regenerate.
* generated/maxval_i16.c: Regenerate.
* generated/maxval_i2.c: Regenerate.
* generated/maxval_i4.c: Regenerate.
* generated/maxval_i8.c: Regenerate.
* generated/maxval_r10.c: Regenerate.
* generated/maxval_r16.c: Regenerate.
* generated/maxval_r17.c: Regenerate.
* generated/maxval_r4.c: Regenerate.
* generated/maxval_r8.c: Regenerate.
* generated/minloc1_16_i1.c: Regenerate.
* generated/minloc1_16_i16.c: Regenerate.
* generated/minloc1_16_i2.c: Regenerate.
* generated/minloc1_16_i4.c: Regenerate.
* generated/minloc1_16_i8.c: Regenerate.
* generated/minloc1_16_r10.c: Regenerate.
* generated/minloc1_16_r16.c: Regenerate.
* generated/minloc1_16_r17.c: Regenerate.
* generated/minloc1_16_r4.c: Regenerate.
* generated/minloc1_16_r8.c: Regenerate.
* generated/minloc1_16_s1.c: Regenerate.
* generated/minloc1_16_s4.c: Regenerate.
* generated/minloc1_4_i1.c: Regenerate.
* generated/minloc1_4_i16.c: Regenerate.
* generated/minloc1_4_i2.c: Regenerate.
* generated/minloc1_4_i4.c: Regenerate.
* generated/minloc1_4_i8.c: Regenerate.
* generated/minloc1_4_r10.c: Regenerate.
* generated/minloc1_4_r16.c: Regenerate.
* generated/minloc1_4_r17.c: Regenerate.
* generated/minloc1_4_r4.c: Regenerate.
* generated/minloc1_4_r8.c: Regenerate.
* generated/minloc1_4_s1.c: Regenerate.
* generated/minloc1_4_s4.c: Regenerate.
* generated/minloc1_8_i1.c: Regenerate.
* generated/minloc1_8_i16.c: Regenerate.
* generated/minloc1_8_i2.c: Regenerate.
* generated/minloc1_8_i4.c: Regenerate.
* generated/minloc1_8_i8.c: Regenerate.
* generated/minloc1_8_r10.c: Regenerate.
* generated/minloc1_8_r16.c: Regenerate.
* generated/minloc1_8_r17.c: Regenerate.
* generated/minloc1_8_r4.c: Regenerate.
* generated/minloc1_8_r8.c: Regenerate.
* generated/minloc1_8_s1.c: Regenerate.
* generated/minloc1_8_s4.c: Regenerate.
* generated/minval1_s1.c: Regenerate.
* generated/minval1_s4.c: Regenerate.
* generated/minval_i1.c: Regenerate.
* generated/minval_i16.c: Regenerate.
* generated/minval_i2.c: Regenerate.
* generated/minval_i4.c: Regenerate.
* generated/minval_i8.c: Regenerate.
* generated/minval_r10.c: Regenerate.
* generated/minval_r16.c: Regenerate.
* generated/minval_r17.c: Regenerate.
* generated/minval_r4.c: Regenerate.
* generated/minval_r8.c: Regenerate.
* generated/product_c10.c: Regenerate.
* generated/product_c16.c: Regenerate.
* generated/product_c17.c: Regenerate.
* generated/product_c4.c: Regenerate.
* generated/product_c8.c: Regenerate.
* generated/product_i1.c: Regenerate.
* generated/product_i16.c: Regenerate.
* generated/product_i2.c: Regenerate.
* generated/product_i4.c: Regenerate.
* generated/product_i8.c: Regenerate.
* generated/product_r10.c: Regenerate.
* generated/product_r16.c: Regenerate.
* generated/product_r17.c: Regenerate.
* generated/product_r4.c: Regenerate.
* generated/product_r8.c: Regenerate.
* generated/sum_c10.c: Regenerate.
* generated/sum_c16.c: Regenerate.
* generated/sum_c17.c: Regenerate.
* generated/sum_c4.c: Regenerate.
* generated/sum_c8.c: Regenerate.
* generated/sum_i1.c: Regenerate.
* generated/sum_i16.c: Regenerate.
* generated/sum_i2.c: Regenerate.
* generated/sum_i4.c: Regenerate.
* generated/sum_i8.c: Regenerate.
* generated/sum_r10.c: Regenerate.
* generated/sum_r16.c: Regenerate.
* generated/sum_r17.c: Regenerate.
* generated/sum_r4.c: Regenerate.
* generated/sum_r8.c: Regenerate.

gcc/testsuite/ChangeLog:

* gfortran.dg/allocated_4.f90: New test.

6 months agoRISC-V: Eliminate unused parameter warning.
xuli [Wed, 8 Nov 2023 08:46:02 +0000 (08:46 +0000)] 
RISC-V: Eliminate unused parameter warning.

The parameter orig_fndecl is not used, use anonymous parameters instead.

../.././gcc/gcc/config/riscv/riscv-c.cc: In function ‘bool riscv_check_builtin_call(location_t, vec<unsigned int>, tree, tree, unsigned int, tree_node**)’:
../.././gcc/gcc/config/riscv/riscv-c.cc:207:11: warning: unused parameter ‘orig_fndecl’ [-Wunused-parameter]
      tree orig_fndecl, unsigned int nargs, tree *args)
           ^~~~~~~~~~~

gcc/ChangeLog:

* config/riscv/riscv-c.cc (riscv_check_builtin_call): Eliminate warning.

6 months ago[i386] APX: Fix ICE due to movti postreload splitter [PR112394]
Hongyu Wang [Tue, 7 Nov 2023 02:02:53 +0000 (10:02 +0800)] 
[i386] APX: Fix ICE due to movti postreload splitter [PR112394]

When APX EGPR enabled, the TImode move pattern *movti_internal allows
move between gpr and sse reg using constraint pair ("r","Yd"). Then a
post-reload splitter transform such move to vec_extractv2di, while under
-msse4.1 -mno-avx EGPR is not allowed for its enabled alternative, which
caused ICE that insn does not match the constraint. To prevent such ICE,
we need to adjust the constraint correspond to "Yd". Add a new
constraint "jc" to disable EGPR under -mno-avx.

gcc/ChangeLog:

PR target/112394
* config/i386/constraints.md (jc): New constraint that prohibits
EGPR on -mno-avx.
* config/i386/i386.md (*movdi_internal): Change r constraint
corresponds to Yd.
(*movti_internal): Likewise.

gcc/testsuite/ChangeLog:

PR target/112394
* gcc.target/i386/pr112394.c: New test.

6 months agotest: Fix bb-slp-33.c for RVV
Juzhe-Zhong [Tue, 7 Nov 2023 15:13:15 +0000 (23:13 +0800)] 
test: Fix bb-slp-33.c for RVV

gcc/testsuite/ChangeLog:

* gcc.dg/vect/bb-slp-33.c: Rewrite the condition.

6 months agoc-family: Enable -fpermissive for C and ObjC
Florian Weimer [Wed, 8 Nov 2023 05:41:15 +0000 (06:41 +0100)] 
c-family: Enable -fpermissive for C and ObjC

Future changes will treat some C front end warnings similar to
-Wnarrowing.

gcc/

* doc/invoke.texi (Warning Options): Mention C diagnostics
for -fpermissive.

gcc/c-family/

* c.opt (fpermissive): Enable for C and ObjC.
* c-opts.cc (c_common_post_options): Enable -fpermissive.

6 months agoRISC-V: Normalize user vsetvl intrinsics[PR112092]
Juzhe-Zhong [Wed, 8 Nov 2023 06:05:00 +0000 (14:05 +0800)] 
RISC-V: Normalize user vsetvl intrinsics[PR112092]

Since our user vsetvl intrinsics are defined as just calculate the VL output
which is the number of the elements to be processed. Such intrinsics do not
have any side effects.  We should normalize them when they have same ratio.

E.g __riscv_vsetvl_e8mf8 result is same as __riscv_vsetvl_e64m1.

Normalize them can allow us have better codegen.
Consider this following example:

#include "riscv_vector.h"

void foo(int32_t *in1, int32_t *in2, int32_t *in3, int32_t *out, size_t n, int cond, int avl) {

  size_t vl;
  if (cond)
    vl = __riscv_vsetvl_e32m1(avl);
  else
    vl = __riscv_vsetvl_e16mf2(avl);
  for (size_t i = 0; i < n; i += 1) {
    vint32m1_t a = __riscv_vle32_v_i32m1(in1, vl);
    vint32m1_t b = __riscv_vle32_v_i32m1_tu(a, in2, vl);
    vint32m1_t c = __riscv_vle32_v_i32m1_tu(b, in3, vl);
    __riscv_vse32_v_i32m1(out, c, vl);
  }
}

Before this patch:

foo:
        beq     a5,zero,.L2
        vsetvli a6,a6,e32,m1,tu,ma
.L3:
        li      a5,0
        beq     a4,zero,.L9
.L4:
        vle32.v v1,0(a0)
        addi    a5,a5,1
        vle32.v v1,0(a1)
        vle32.v v1,0(a2)
        vse32.v v1,0(a3)
        bne     a4,a5,.L4
.L9:
        ret
.L2:
        vsetvli zero,a6,e32,m1,tu,ma
        j       .L3

After this patch:

foo:
li a5,0
vsetvli zero,a6,e32,m1,tu,ma
beq a4,zero,.L9
.L4:
vle32.v v1,0(a0)
addi a5,a5,1
vle32.v v1,0(a1)
vle32.v v1,0(a2)
vse32.v v1,0(a3)
bne a4,a5,.L4
.L9:
ret

PR target/112092

gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc: Normalize the vsetvls.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/vsetvl/pr109743-1.c: Adapt test.
* gcc.target/riscv/rvv/vsetvl/pr109743-3.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvl-11.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvl-15.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvl-22.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvlmax-13.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvlmax-15.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvlmax-5.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvlmax-7.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvlmax-8.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/pr112092-1.c: New test.
* gcc.target/riscv/rvv/vsetvl/pr112092-2.c: New test.

6 months agoi386: Fix isa attribute for TI/TF andnot mode
Haochen Jiang [Mon, 6 Nov 2023 06:34:01 +0000 (14:34 +0800)] 
i386: Fix isa attribute for TI/TF andnot mode

gcc/ChangeLog:

PR target/111907
* config/i386/i386.md (avx_noavx512vl): New definition for isa
attribute.
* config/i386/sse.md (*andnot<mode>3): Change isa attribute from
avx_noavx512f to avx_noavx512vl.

gcc/testsuite/ChangeLog:

PR target/111907
* gcc.target/i386/pr111907.c: New test.

6 months agotestsuite: Rename c2x-*, gnu2x-* tests to c23-*, gnu23-*
Joseph Myers [Wed, 8 Nov 2023 00:15:22 +0000 (00:15 +0000)] 
testsuite: Rename c2x-*, gnu2x-* tests to c23-*, gnu23-*

Completing the move to refer to C23 in place of C2X, rename all tests
with "c2x" or "gnu2x" in their names to use "c23" or "gnu23" instead.
17 files in the testsuite that referred to such tests (or, in one
case, a generated .i file to be scanned) by those names are updated
for the renaming.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/testsuite/
* gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c: Move to ...
* gcc.dg/atomic/c23-stdatomic-lockfree-char8_t.c: ... here.
* gcc.dg/atomic/c2x-stdatomic-var-init-1.c: Move to ...
* gcc.dg/atomic/c23-stdatomic-var-init-1.c: ... here.
* gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c: Move to ...
* gcc.dg/atomic/gnu23-stdatomic-lockfree-char8_t.c: ... here.
Update reference to moved file.
* gcc.dg/c2x-align-1.c: Move to ...
* gcc.dg/c23-align-1.c: ... here.
* gcc.dg/c2x-align-6.c: Move to ...
* gcc.dg/c23-align-6.c: ... here.
* gcc.dg/c2x-attr-deprecated-1.c: Move to ...
* gcc.dg/c23-attr-deprecated-1.c: ... here.  Update reference to
moved file.
* gcc.dg/c2x-attr-deprecated-2.c: Move to ...
* gcc.dg/c23-attr-deprecated-2.c: ... here.
* gcc.dg/c2x-attr-deprecated-3.c: Move to ...
* gcc.dg/c23-attr-deprecated-3.c: ... here.
* gcc.dg/c2x-attr-deprecated-4.c: Move to ...
* gcc.dg/c23-attr-deprecated-4.c: ... here.
* gcc.dg/c2x-attr-fallthrough-1.c: Move to ...
* gcc.dg/c23-attr-fallthrough-1.c: ... here.
* gcc.dg/c2x-attr-fallthrough-2.c: Move to ...
* gcc.dg/c23-attr-fallthrough-2.c: ... here.
* gcc.dg/c2x-attr-fallthrough-3.c: Move to ...
* gcc.dg/c23-attr-fallthrough-3.c: ... here.
* gcc.dg/c2x-attr-fallthrough-4.c: Move to ...
* gcc.dg/c23-attr-fallthrough-4.c: ... here.
* gcc.dg/c2x-attr-fallthrough-5.c: Move to ...
* gcc.dg/c23-attr-fallthrough-5.c: ... here.
* gcc.dg/c2x-attr-fallthrough-6.c: Move to ...
* gcc.dg/c23-attr-fallthrough-6.c: ... here.
* gcc.dg/c2x-attr-maybe_unused-1.c: Move to ...
* gcc.dg/c23-attr-maybe_unused-1.c: ... here.
* gcc.dg/c2x-attr-maybe_unused-2.c: Move to ...
* gcc.dg/c23-attr-maybe_unused-2.c: ... here.
* gcc.dg/c2x-attr-maybe_unused-3.c: Move to ...
* gcc.dg/c23-attr-maybe_unused-3.c: ... here.
* gcc.dg/c2x-attr-maybe_unused-4.c: Move to ...
* gcc.dg/c23-attr-maybe_unused-4.c: ... here.
* gcc.dg/c2x-attr-nodiscard-1.c: Move to ...
* gcc.dg/c23-attr-nodiscard-1.c: ... here.
* gcc.dg/c2x-attr-nodiscard-2.c: Move to ...
* gcc.dg/c23-attr-nodiscard-2.c: ... here.
* gcc.dg/c2x-attr-nodiscard-3.c: Move to ...
* gcc.dg/c23-attr-nodiscard-3.c: ... here.
* gcc.dg/c2x-attr-nodiscard-4.c: Move to ...
* gcc.dg/c23-attr-nodiscard-4.c: ... here.
* gcc.dg/c2x-attr-noreturn-1.c: Move to ...
* gcc.dg/c23-attr-noreturn-1.c: ... here.
* gcc.dg/c2x-attr-noreturn-2.c: Move to ...
* gcc.dg/c23-attr-noreturn-2.c: ... here.
* gcc.dg/c2x-attr-noreturn-3.c: Move to ...
* gcc.dg/c23-attr-noreturn-3.c: ... here.
* gcc.dg/c2x-attr-syntax-1.c: Move to ...
* gcc.dg/c23-attr-syntax-1.c: ... here.
* gcc.dg/c2x-attr-syntax-2.c: Move to ...
* gcc.dg/c23-attr-syntax-2.c: ... here.
* gcc.dg/c2x-attr-syntax-3.c: Move to ...
* gcc.dg/c23-attr-syntax-3.c: ... here.
* gcc.dg/c2x-attr-syntax-4.c: Move to ...
* gcc.dg/c23-attr-syntax-4.c: ... here.
* gcc.dg/c2x-attr-syntax-5.c: Move to ...
* gcc.dg/c23-attr-syntax-5.c: ... here.
* gcc.dg/c2x-attr-syntax-6.c: Move to ...
* gcc.dg/c23-attr-syntax-6.c: ... here.
* gcc.dg/c2x-attr-syntax-7.c: Move to ...
* gcc.dg/c23-attr-syntax-7.c: ... here.
* gcc.dg/c2x-auto-1.c: Move to ...
* gcc.dg/c23-auto-1.c: ... here.
* gcc.dg/c2x-auto-2.c: Move to ...
* gcc.dg/c23-auto-2.c: ... here.
* gcc.dg/c2x-auto-3.c: Move to ...
* gcc.dg/c23-auto-3.c: ... here.
* gcc.dg/c2x-auto-4.c: Move to ...
* gcc.dg/c23-auto-4.c: ... here.
* gcc.dg/c2x-binary-constants-1.c: Move to ...
* gcc.dg/c23-binary-constants-1.c: ... here.
* gcc.dg/c2x-binary-constants-2.c: Move to ...
* gcc.dg/c23-binary-constants-2.c: ... here.
* gcc.dg/c2x-binary-constants-3.c: Move to ...
* gcc.dg/c23-binary-constants-3.c: ... here.
* gcc.dg/c2x-bool-1.c: Move to ...
* gcc.dg/c23-bool-1.c: ... here.
* gcc.dg/c2x-bool-2.c: Move to ...
* gcc.dg/c23-bool-2.c: ... here.
* gcc.dg/c2x-bool-limits-1.c: Move to ...
* gcc.dg/c23-bool-limits-1.c: ... here.
* gcc.dg/c2x-builtins-1.c: Move to ...
* gcc.dg/c23-builtins-1.c: ... here.
* gcc.dg/c2x-complit-1.c: Move to ...
* gcc.dg/c23-complit-1.c: ... here.
* gcc.dg/c2x-complit-2.c: Move to ...
* gcc.dg/c23-complit-2.c: ... here.
* gcc.dg/c2x-complit-3.c: Move to ...
* gcc.dg/c23-complit-3.c: ... here.
* gcc.dg/c2x-complit-4.c: Move to ...
* gcc.dg/c23-complit-4.c: ... here.
* gcc.dg/c2x-complit-5.c: Move to ...
* gcc.dg/c23-complit-5.c: ... here.
* gcc.dg/c2x-complit-6.c: Move to ...
* gcc.dg/c23-complit-6.c: ... here.
* gcc.dg/c2x-complit-7.c: Move to ...
* gcc.dg/c23-complit-7.c: ... here.
* gcc.dg/c2x-complit-8.c: Move to ...
* gcc.dg/c23-complit-8.c: ... here.
* gcc.dg/c2x-concat-1.c: Move to ...
* gcc.dg/c23-concat-1.c: ... here.
* gcc.dg/c2x-constexpr-1.c: Move to ...
* gcc.dg/c23-constexpr-1.c: ... here.
* gcc.dg/c2x-constexpr-2a.c: Move to ...
* gcc.dg/c23-constexpr-2a.c: ... here.  Update reference to moved
file.
* gcc.dg/c2x-constexpr-2b.c: Move to ...
* gcc.dg/c23-constexpr-2b.c: ... here.
* gcc.dg/c2x-constexpr-3.c: Move to ...
* gcc.dg/c23-constexpr-3.c: ... here.
* gcc.dg/c2x-constexpr-4.c: Move to ...
* gcc.dg/c23-constexpr-4.c: ... here.
* gcc.dg/c2x-constexpr-5.c: Move to ...
* gcc.dg/c23-constexpr-5.c: ... here.
* gcc.dg/c2x-constexpr-6.c: Move to ...
* gcc.dg/c23-constexpr-6.c: ... here.
* gcc.dg/c2x-constexpr-7.c: Move to ...
* gcc.dg/c23-constexpr-7.c: ... here.
* gcc.dg/c2x-constexpr-8.c: Move to ...
* gcc.dg/c23-constexpr-8.c: ... here.
* gcc.dg/c2x-constexpr-9.c: Move to ...
* gcc.dg/c23-constexpr-9.c: ... here.
* gcc.dg/c2x-digit-separators-1.c: Move to ...
* gcc.dg/c23-digit-separators-1.c: ... here.
* gcc.dg/c2x-digit-separators-2.c: Move to ...
* gcc.dg/c23-digit-separators-2.c: ... here.
* gcc.dg/c2x-digit-separators-3.c: Move to ...
* gcc.dg/c23-digit-separators-3.c: ... here.
* gcc.dg/c2x-empty-init-1.c: Move to ...
* gcc.dg/c23-empty-init-1.c: ... here.
* gcc.dg/c2x-empty-init-2.c: Move to ...
* gcc.dg/c23-empty-init-2.c: ... here.
* gcc.dg/c2x-empty-init-3.c: Move to ...
* gcc.dg/c23-empty-init-3.c: ... here.
* gcc.dg/c2x-enum-1.c: Move to ...
* gcc.dg/c23-enum-1.c: ... here.
* gcc.dg/c2x-enum-2.c: Move to ...
* gcc.dg/c23-enum-2.c: ... here.
* gcc.dg/c2x-enum-3.c: Move to ...
* gcc.dg/c23-enum-3.c: ... here.
* gcc.dg/c2x-enum-4.c: Move to ...
* gcc.dg/c23-enum-4.c: ... here.
* gcc.dg/c2x-enum-5.c: Move to ...
* gcc.dg/c23-enum-5.c: ... here.
* gcc.dg/c2x-enum-6.c: Move to ...
* gcc.dg/c23-enum-6.c: ... here.
* gcc.dg/c2x-enum-7.c: Move to ...
* gcc.dg/c23-enum-7.c: ... here.
* gcc.dg/c2x-enum-8.c: Move to ...
* gcc.dg/c23-enum-8.c: ... here.
* gcc.dg/c2x-float-1.c: Move to ...
* gcc.dg/c23-float-1.c: ... here.
* gcc.dg/c2x-float-10.c: Move to ...
* gcc.dg/c23-float-10.c: ... here.
* gcc.dg/c2x-float-11.c: Move to ...
* gcc.dg/c23-float-11.c: ... here.
* gcc.dg/c2x-float-12.c: Move to ...
* gcc.dg/c23-float-12.c: ... here.
* gcc.dg/c2x-float-13.c: Move to ...
* gcc.dg/c23-float-13.c: ... here.
* gcc.dg/c2x-float-2.c: Move to ...
* gcc.dg/c23-float-2.c: ... here.
* gcc.dg/c2x-float-3.c: Move to ...
* gcc.dg/c23-float-3.c: ... here.
* gcc.dg/c2x-float-4.c: Move to ...
* gcc.dg/c23-float-4.c: ... here.
* gcc.dg/c2x-float-5.c: Move to ...
* gcc.dg/c23-float-5.c: ... here.
* gcc.dg/c2x-float-6.c: Move to ...
* gcc.dg/c23-float-6.c: ... here.
* gcc.dg/c2x-float-7a.c: Move to ...
* gcc.dg/c23-float-7a.c: ... here.
* gcc.dg/c2x-float-7b.c: Move to ...
* gcc.dg/c23-float-7b.c: ... here.
* gcc.dg/c2x-float-7c.c: Move to ...
* gcc.dg/c23-float-7c.c: ... here.
* gcc.dg/c2x-float-8.c: Move to ...
* gcc.dg/c23-float-8.c: ... here.
* gcc.dg/c2x-float-9.c: Move to ...
* gcc.dg/c23-float-9.c: ... here.
* gcc.dg/c2x-float-no-dfp-1.c: Move to ...
* gcc.dg/c23-float-no-dfp-1.c: ... here.
* gcc.dg/c2x-float-no-dfp-2.c: Move to ...
* gcc.dg/c23-float-no-dfp-2.c: ... here.  Update reference to
moved file.
* gcc.dg/c2x-float-no-dfp-3.c: Move to ...
* gcc.dg/c23-float-no-dfp-3.c: ... here.
* gcc.dg/c2x-float-no-dfp-4.c: Move to ...
* gcc.dg/c23-float-no-dfp-4.c: ... here.  Update reference to
moved file.
* gcc.dg/c2x-floatn-1.c: Move to ...
* gcc.dg/c23-floatn-1.c: ... here.
* gcc.dg/c2x-floatn-2.c: Move to ...
* gcc.dg/c23-floatn-2.c: ... here.
* gcc.dg/c2x-floatn-3.c: Move to ...
* gcc.dg/c23-floatn-3.c: ... here.
* gcc.dg/c2x-floatn-4.c: Move to ...
* gcc.dg/c23-floatn-4.c: ... here.
* gcc.dg/c2x-floatn-5.c: Move to ...
* gcc.dg/c23-floatn-5.c: ... here.
* gcc.dg/c2x-floatn-6.c: Move to ...
* gcc.dg/c23-floatn-6.c: ... here.
* gcc.dg/c2x-floatn-7.c: Move to ...
* gcc.dg/c23-floatn-7.c: ... here.
* gcc.dg/c2x-floatn-8.c: Move to ...
* gcc.dg/c23-floatn-8.c: ... here.
* gcc.dg/c2x-fordecl-1.c: Move to ...
* gcc.dg/c23-fordecl-1.c: ... here.
* gcc.dg/c2x-fordecl-2.c: Move to ...
* gcc.dg/c23-fordecl-2.c: ... here.
* gcc.dg/c2x-fordecl-3.c: Move to ...
* gcc.dg/c23-fordecl-3.c: ... here.
* gcc.dg/c2x-fordecl-4.c: Move to ...
* gcc.dg/c23-fordecl-4.c: ... here.
* gcc.dg/c2x-has-c-attribute-1.c: Move to ...
* gcc.dg/c23-has-c-attribute-1.c: ... here.
* gcc.dg/c2x-has-c-attribute-2.c: Move to ...
* gcc.dg/c23-has-c-attribute-2.c: ... here.
* gcc.dg/c2x-has-c-attribute-3.c: Move to ...
* gcc.dg/c23-has-c-attribute-3.c: ... here.
* gcc.dg/c2x-has-c-attribute-4.c: Move to ...
* gcc.dg/c23-has-c-attribute-4.c: ... here.
* gcc.dg/c2x-labels-1.c: Move to ...
* gcc.dg/c23-labels-1.c: ... here.
* gcc.dg/c2x-labels-2.c: Move to ...
* gcc.dg/c23-labels-2.c: ... here.
* gcc.dg/c2x-labels-3.c: Move to ...
* gcc.dg/c23-labels-3.c: ... here.
* gcc.dg/c2x-limits-1.c: Move to ...
* gcc.dg/c23-limits-1.c: ... here.
* gcc.dg/c2x-no-dfp-1.c: Move to ...
* gcc.dg/c23-no-dfp-1.c: ... here.
* gcc.dg/c2x-nullptr-1.c: Move to ...
* gcc.dg/c23-nullptr-1.c: ... here.
* gcc.dg/c2x-nullptr-2.c: Move to ...
* gcc.dg/c23-nullptr-2.c: ... here.
* gcc.dg/c2x-nullptr-3.c: Move to ...
* gcc.dg/c23-nullptr-3.c: ... here.
* gcc.dg/c2x-nullptr-4.c: Move to ...
* gcc.dg/c23-nullptr-4.c: ... here.
* gcc.dg/c2x-nullptr-5.c: Move to ...
* gcc.dg/c23-nullptr-5.c: ... here.
* gcc.dg/c2x-nullptr-6.c: Move to ...
* gcc.dg/c23-nullptr-6.c: ... here.
* gcc.dg/c2x-old-style-definition-1.c: Move to ...
* gcc.dg/c23-old-style-definition-1.c: ... here.
* gcc.dg/c2x-old-style-definition-2.c: Move to ...
* gcc.dg/c23-old-style-definition-2.c: ... here.
* gcc.dg/c2x-old-style-definition-3.c: Move to ...
* gcc.dg/c23-old-style-definition-3.c: ... here.
* gcc.dg/c2x-old-style-definition-4.c: Move to ...
* gcc.dg/c23-old-style-definition-4.c: ... here.
* gcc.dg/c2x-old-style-definition-5.c: Move to ...
* gcc.dg/c23-old-style-definition-5.c: ... here.
* gcc.dg/c2x-old-style-definition-6.c: Move to ...
* gcc.dg/c23-old-style-definition-6.c: ... here.
* gcc.dg/c2x-parm-omit-1.c: Move to ...
* gcc.dg/c23-parm-omit-1.c: ... here.
* gcc.dg/c2x-parm-omit-2.c: Move to ...
* gcc.dg/c23-parm-omit-2.c: ... here.
* gcc.dg/c2x-parm-omit-3.c: Move to ...
* gcc.dg/c23-parm-omit-3.c: ... here.
* gcc.dg/c2x-parm-omit-4.c: Move to ...
* gcc.dg/c23-parm-omit-4.c: ... here.
* gcc.dg/c2x-qual-1.c: Move to ...
* gcc.dg/c23-qual-1.c: ... here.
* gcc.dg/c2x-qual-2.c: Move to ...
* gcc.dg/c23-qual-2.c: ... here.
* gcc.dg/c2x-qual-3.c: Move to ...
* gcc.dg/c23-qual-3.c: ... here.
* gcc.dg/c2x-qual-4.c: Move to ...
* gcc.dg/c23-qual-4.c: ... here.
* gcc.dg/c2x-qual-5.c: Move to ...
* gcc.dg/c23-qual-5.c: ... here.
* gcc.dg/c2x-qual-6.c: Move to ...
* gcc.dg/c23-qual-6.c: ... here.
* gcc.dg/c2x-qual-7.c: Move to ...
* gcc.dg/c23-qual-7.c: ... here.
* gcc.dg/c2x-static-assert-1.c: Move to ...
* gcc.dg/c23-static-assert-1.c: ... here.
* gcc.dg/c2x-static-assert-2.c: Move to ...
* gcc.dg/c23-static-assert-2.c: ... here.
* gcc.dg/c2x-static-assert-3.c: Move to ...
* gcc.dg/c23-static-assert-3.c: ... here.
* gcc.dg/c2x-static-assert-4.c: Move to ...
* gcc.dg/c23-static-assert-4.c: ... here.
* gcc.dg/c2x-stdarg-1.c: Move to ...
* gcc.dg/c23-stdarg-1.c: ... here.
* gcc.dg/c2x-stdarg-2.c: Move to ...
* gcc.dg/c23-stdarg-2.c: ... here.
* gcc.dg/c2x-stdarg-3.c: Move to ...
* gcc.dg/c23-stdarg-3.c: ... here.
* gcc.dg/c2x-stdarg-4.c: Move to ...
* gcc.dg/c23-stdarg-4.c: ... here.
* gcc.dg/c2x-stdarg-5.c: Move to ...
* gcc.dg/c23-stdarg-5.c: ... here.
* gcc.dg/c2x-stdatomic-1.c: Move to ...
* gcc.dg/c23-stdatomic-1.c: ... here.
* gcc.dg/c2x-stddef-1.c: Move to ...
* gcc.dg/c23-stddef-1.c: ... here.
* gcc.dg/c2x-stdint-1.c: Move to ...
* gcc.dg/c23-stdint-1.c: ... here.
* gcc.dg/c2x-thread-local-1.c: Move to ...
* gcc.dg/c23-thread-local-1.c: ... here.
* gcc.dg/c2x-thread-local-2.c: Move to ...
* gcc.dg/c23-thread-local-2.c: ... here.
* gcc.dg/c2x-typeof-1.c: Move to ...
* gcc.dg/c23-typeof-1.c: ... here.
* gcc.dg/c2x-typeof-2.c: Move to ...
* gcc.dg/c23-typeof-2.c: ... here.
* gcc.dg/c2x-typeof-3.c: Move to ...
* gcc.dg/c23-typeof-3.c: ... here.
* gcc.dg/c2x-unproto-1.c: Move to ...
* gcc.dg/c23-unproto-1.c: ... here.
* gcc.dg/c2x-unproto-2.c: Move to ...
* gcc.dg/c23-unproto-2.c: ... here.
* gcc.dg/c2x-unproto-3.c: Move to ...
* gcc.dg/c23-unproto-3.c: ... here.
* gcc.dg/c2x-unproto-4.c: Move to ...
* gcc.dg/c23-unproto-4.c: ... here.
* gcc.dg/c2x-unreachable-1.c: Move to ...
* gcc.dg/c23-unreachable-1.c: ... here.
* gcc.dg/c2x-utf8char-1.c: Move to ...
* gcc.dg/c23-utf8char-1.c: ... here.
* gcc.dg/c2x-utf8char-2.c: Move to ...
* gcc.dg/c23-utf8char-2.c: ... here.
* gcc.dg/c2x-utf8char-3.c: Move to ...
* gcc.dg/c23-utf8char-3.c: ... here.
* gcc.dg/c2x-utf8str-type.c: Move to ...
* gcc.dg/c23-utf8str-type.c: ... here.
* gcc.dg/c2x-utf8str.c: Move to ...
* gcc.dg/c23-utf8str.c: ... here.
* gcc.dg/cpp/c2x-elifdef-1.c: Move to ...
* gcc.dg/cpp/c23-elifdef-1.c: ... here.
* gcc.dg/cpp/c2x-elifdef-2.c: Move to ...
* gcc.dg/cpp/c23-elifdef-2.c: ... here.
* gcc.dg/cpp/c2x-scope-1.c: Move to ...
* gcc.dg/cpp/c23-scope-1.c: ... here.
* gcc.dg/cpp/c2x-scope-2.c: Move to ...
* gcc.dg/cpp/c23-scope-2.c: ... here.  Update reference to moved
file.
* gcc.dg/cpp/c2x-trigraphs-1.c: Move to ...
* gcc.dg/cpp/c23-trigraphs-1.c: ... here.
* gcc.dg/cpp/c2x-trigraphs-2.c: Move to ...
* gcc.dg/cpp/c23-trigraphs-2.c: ... here.
* gcc.dg/cpp/c2x-ucn-1.c: Move to ...
* gcc.dg/cpp/c23-ucn-1.c: ... here.
* gcc.dg/cpp/c2x-ucnid-1-utf8.c: Move to ...
* gcc.dg/cpp/c23-ucnid-1-utf8.c: ... here.
* gcc.dg/cpp/c2x-ucnid-1.c: Move to ...
* gcc.dg/cpp/c23-ucnid-1.c: ... here.
* gcc.dg/cpp/c2x-va-opt-1.c: Move to ...
* gcc.dg/cpp/c23-va-opt-1.c: ... here.
* gcc.dg/cpp/c2x-warning-1.c: Move to ...
* gcc.dg/cpp/c23-warning-1.c: ... here.
* gcc.dg/cpp/c2x-warning-2.c: Move to ...
* gcc.dg/cpp/c23-warning-2.c: ... here.
* gcc.dg/cpp/gnu2x-warning-1.c: Move to ...
* gcc.dg/cpp/gnu23-warning-1.c: ... here.
* gcc.dg/cpp/gnu2x-warning-2.c: Move to ...
* gcc.dg/cpp/gnu23-warning-2.c: ... here.
* gcc.dg/dfp/c2x-builtins-dfp-1.c: Move to ...
* gcc.dg/dfp/c23-builtins-dfp-1.c: ... here.
* gcc.dg/dfp/c2x-constants-1.c: Move to ...
* gcc.dg/dfp/c23-constants-1.c: ... here.
* gcc.dg/dfp/c2x-constants-2.c: Move to ...
* gcc.dg/dfp/c23-constants-2.c: ... here.
* gcc.dg/dfp/c2x-constexpr-dfp-1.c: Move to ...
* gcc.dg/dfp/c23-constexpr-dfp-1.c: ... here.
* gcc.dg/dfp/c2x-constexpr-dfp-2.c: Move to ...
* gcc.dg/dfp/c23-constexpr-dfp-2.c: ... here.
* gcc.dg/dfp/c2x-float-dfp-1.c: Move to ...
* gcc.dg/dfp/c23-float-dfp-1.c: ... here.
* gcc.dg/dfp/c2x-float-dfp-2.c: Move to ...
* gcc.dg/dfp/c23-float-dfp-2.c: ... here.  Update reference to
moved file.
* gcc.dg/dfp/c2x-float-dfp-3.c: Move to ...
* gcc.dg/dfp/c23-float-dfp-3.c: ... here.
* gcc.dg/dfp/c2x-float-dfp-4.c: Move to ...
* gcc.dg/dfp/c23-float-dfp-4.c: ... here.
* gcc.dg/dfp/c2x-float-dfp-5.c: Move to ...
* gcc.dg/dfp/c23-float-dfp-5.c: ... here.
* gcc.dg/dfp/c2x-float-dfp-6.c: Move to ...
* gcc.dg/dfp/c23-float-dfp-6.c: ... here.
* gcc.dg/dfp/c2x-float-dfp-7.c: Move to ...
* gcc.dg/dfp/c23-float-dfp-7.c: ... here.
* gcc.dg/dfp/c2x-float-dfp-8.c: Move to ...
* gcc.dg/dfp/c23-float-dfp-8.c: ... here.
* gcc.dg/dfp/c2x-keywords-1.c: Move to ...
* gcc.dg/dfp/c23-keywords-1.c: ... here.
* gcc.dg/dfp/c2x-keywords-2.c: Move to ...
* gcc.dg/dfp/c23-keywords-2.c: ... here.
* gcc.dg/format/c2x-dfp-printf-1.c: Move to ...
* gcc.dg/format/c23-dfp-printf-1.c: ... here.
* gcc.dg/format/c2x-dfp-scanf-1.c: Move to ...
* gcc.dg/format/c23-dfp-scanf-1.c: ... here.
* gcc.dg/format/c2x-printf-1.c: Move to ...
* gcc.dg/format/c23-printf-1.c: ... here.
* gcc.dg/format/c2x-scanf-1.c: Move to ...
* gcc.dg/format/c23-scanf-1.c: ... here.
* gcc.dg/format/c2x-strftime-1.c: Move to ...
* gcc.dg/format/c23-strftime-1.c: ... here.
* gcc.dg/gnu2x-attr-syntax-1.c: Move to ...
* gcc.dg/gnu23-attr-syntax-1.c: ... here.
* gcc.dg/gnu2x-attr-syntax-2.c: Move to ...
* gcc.dg/gnu23-attr-syntax-2.c: ... here.
* gcc.dg/gnu2x-attrs-1.c: Move to ...
* gcc.dg/gnu23-attrs-1.c: ... here.
* gcc.dg/gnu2x-attrs-2.c: Move to ...
* gcc.dg/gnu23-attrs-2.c: ... here.
* gcc.dg/gnu2x-auto-1.c: Move to ...
* gcc.dg/gnu23-auto-1.c: ... here.
* gcc.dg/gnu2x-builtins-no-dfp-1.c: Move to ...
* gcc.dg/gnu23-builtins-no-dfp-1.c: ... here.
* gcc.dg/gnu2x-complit-1.c: Move to ...
* gcc.dg/gnu23-complit-1.c: ... here.
* gcc.dg/gnu2x-complit-2.c: Move to ...
* gcc.dg/gnu23-complit-2.c: ... here.
* gcc.dg/gnu2x-constexpr-1.c: Move to ...
* gcc.dg/gnu23-constexpr-1.c: ... here.
* gcc.dg/gnu2x-empty-init-1.c: Move to ...
* gcc.dg/gnu23-empty-init-1.c: ... here.
* gcc.dg/gnu2x-empty-init-2.c: Move to ...
* gcc.dg/gnu23-empty-init-2.c: ... here.
* gcc.dg/gnu2x-enum-1.c: Move to ...
* gcc.dg/gnu23-enum-1.c: ... here.
* gcc.dg/gnu2x-static-assert-1.c: Move to ...
* gcc.dg/gnu23-static-assert-1.c: ... here.
* gcc.dg/gnu2x-stdarg-1.c: Move to ...
* gcc.dg/gnu23-stdarg-1.c: ... here.
* gcc.dg/gnu2x-typeof-1.c: Move to ...
* gcc.dg/gnu23-typeof-1.c: ... here.
* gcc.dg/gnu2x-utf8char-1.c: Move to ...
* gcc.dg/gnu23-utf8char-1.c: ... here.  Update reference to moved
file.
* gcc.dg/gnu2x-utf8str-type.c: Move to ...
* gcc.dg/gnu23-utf8str-type.c: ... here.  Update reference to
moved file.
* gcc.dg/gnu2x-utf8str.c: Move to ...
* gcc.dg/gnu23-utf8str.c: ... here.
* gcc.dg/torture/builtin-fp-int-inexact-c2x.c: Move to ...
* gcc.dg/torture/builtin-fp-int-inexact-c23.c: ... here.
* gcc.dg/torture/c2x-stdarg-split-1a.c: Move to ...
* gcc.dg/torture/c23-stdarg-split-1a.c: ... here.  Update
reference to moved file.
* gcc.dg/torture/c2x-stdarg-split-1b.c: Move to ...
* gcc.dg/torture/c23-stdarg-split-1b.c: ... here.
* objc.dg/attributes/gnu2x-attr-syntax-1.m: Move to ...
* objc.dg/attributes/gnu23-attr-syntax-1.m: ... here.  Update
reference to moved file.
* g++.dg/cpp/elifdef-2.C: Update reference to moved file.
* g++.dg/cpp/elifdef-4.C: Likewise.
* gcc.dg/c11-float-dfp-1.c: Likewise.
* gcc.dg/c11-float-dfp-2.c: Likewise.
* gcc.dg/cpp/gnu11-elifdef-1.c: Likewise.
* gcc.dg/dfp/ts18661-2-float-dfp-1.c: Likewise.

6 months agoDaily bump.
GCC Administrator [Wed, 8 Nov 2023 00:17:35 +0000 (00:17 +0000)] 
Daily bump.

6 months agoRISC-V: Support FP floor to i/l/ll diff size autovec
Pan Li [Tue, 7 Nov 2023 14:24:41 +0000 (22:24 +0800)] 
RISC-V: Support FP floor to i/l/ll diff size autovec

This patch would like to support the FP below API auto vectorization
with different type size

+----------+-----------+----------+
| API      | RV64      | RV32     |
+----------+-----------+----------+
| ifloor   | DF => SI  | DF => SI |
| ifloorf  | -         | -        |
| lfloor   | -         | DF => SI |
| lfloorf  | SF => DI  | -        |
| llfloor  | -         | -        |
| llfloorf | SF => DI  | SF => DI |
+----------+-----------+----------+

Given below code:
void
test_lfloorf (long *out, float *in, unsigned count)
{
  for (unsigned i = 0; i < count; i++)
    out[i] = __builtin_lceilf (in[i]);
}

Before this patch:
.L3:
  flw      fa0,0(s0)
  addi     s0,s0,4
  addi     s1,s1,8
  call     floorf
  fcvt.l.s a5,fa0,rtz
  sd       a5,-8(s1)
  bne      s2,s0,.L3

After this patch:
  fsrmi        2  // RDN mode
.L3:
  vsetvli      a5,a2,e32,mf2,ta,ma
  vle32.v      v2,0(a1)
  slli         a3,a5,2
  slli         a4,a5,3
  vfwcvt.x.f.v v1,v2
  sub          a2,a2,a5
  vse64.v      v1,0(a0)
  add          a1,a1,a3
  add          a0,a0,a4
  bne          a2,zero,.L3

Unfortunately, the HF mode is not include due to it requires
additional middle-end support from internal-fun.def.

gcc/ChangeLog:

* config/riscv/autovec.md: Remove the size check of lfloor.
* config/riscv/riscv-v.cc (expand_vec_lfloor): Leverage
emit_vec_rounding_to_integer for floor.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/unop/math-ifloor-1.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-ifloor-run-1.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lfloor-rv32-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lfloor-rv32-run-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lfloorf-rv64-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lfloorf-rv64-run-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-llfloorf-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-llfloorf-run-0.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-ifloor-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-lfloor-rv32-0.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-lfloorf-rv64-0.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-llfloorf-0.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
6 months agoFix libgomp build on targets that are not Linux-based or accelerators
Kwok Cheung Yeung [Tue, 7 Nov 2023 22:02:28 +0000 (22:02 +0000)] 
Fix libgomp build on targets that are not Linux-based or accelerators

The patch 'openmp: Add support for the 'indirect' clause in C/C++'
introduced a new file target-indirect.c into the Makefile sources,
but that file was only present in config/linux/ and config/accel/,
so targets that are not Linux-based or GPU accelerators will not
pick it up and fail to build.

This is fixed by making the version in config/linux/ the default by
moving it into the base directory of libgomp.

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

libgomp/
* config/linux/target-indirect.c: Move to...
* target-indirect.c: ...here.

6 months agotestsuite: Refer more consistently to C23 not C2X
Joseph Myers [Tue, 7 Nov 2023 22:00:48 +0000 (22:00 +0000)] 
testsuite: Refer more consistently to C23 not C2X

Continuing the move to refer to C23 in place of C2X throughout the
source tree, update testcase contents to use the "c23" or "gnu23"
option names in place of the old "c2x" or "gnu2x" names, except for
the few tests specifically intended to test the old names, and to
refer to C23 in comments.

This updates testcase *contents*; testcase naming (renaming c2x-*
tests to c23-* and gnu2x-* tests to gnu23-*), with a few consequent
changes to contents (where tests #include other tests, or refer to
them by name in comments) is to be addressed separately.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/testsuite/
* c-c++-common/alias-1.c: Use "c23" or "gnu23" option names in
place of "c2x" or "gnu2x" names, and refer to C23 in comments in
place of C2X or C2x.
* gcc.dg/Wformat-overflow1.c: Likewise.
* gcc.dg/asm-scope-1.c: Likewise.
* gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c: Likewise.
* gcc.dg/atomic/c2x-stdatomic-var-init-1.c: Likewise.
* gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c: Likewise.
* gcc.dg/atomic/stdatomic-bitint-1.c: Likewise.
* gcc.dg/atomic/stdatomic-bitint-2.c: Likewise.
* gcc.dg/attr-assume-1.c: Likewise.
* gcc.dg/attr-assume-2.c: Likewise.
* gcc.dg/attr-assume-3.c: Likewise.
* gcc.dg/attr-assume-4.c: Likewise.
* gcc.dg/bitint-1.c: Likewise.
* gcc.dg/bitint-10.c: Likewise.
* gcc.dg/bitint-11.c: Likewise.
* gcc.dg/bitint-12.c: Likewise.
* gcc.dg/bitint-13.c: Likewise.
* gcc.dg/bitint-14.c: Likewise.
* gcc.dg/bitint-15.c: Likewise.
* gcc.dg/bitint-16.c: Likewise.
* gcc.dg/bitint-17.c: Likewise.
* gcc.dg/bitint-18.c: Likewise.
* gcc.dg/bitint-19.c: Likewise.
* gcc.dg/bitint-2.c: Likewise.
* gcc.dg/bitint-20.c: Likewise.
* gcc.dg/bitint-21.c: Likewise.
* gcc.dg/bitint-22.c: Likewise.
* gcc.dg/bitint-23.c: Likewise.
* gcc.dg/bitint-25.c: Likewise.
* gcc.dg/bitint-28.c: Likewise.
* gcc.dg/bitint-29.c: Likewise.
* gcc.dg/bitint-3.c: Likewise.
* gcc.dg/bitint-30.c: Likewise.
* gcc.dg/bitint-31.c: Likewise.
* gcc.dg/bitint-32.c: Likewise.
* gcc.dg/bitint-34.c: Likewise.
* gcc.dg/bitint-35.c: Likewise.
* gcc.dg/bitint-36.c: Likewise.
* gcc.dg/bitint-38.c: Likewise.
* gcc.dg/bitint-39.c: Likewise.
* gcc.dg/bitint-4.c: Likewise.
* gcc.dg/bitint-5.c: Likewise.
* gcc.dg/bitint-6.c: Likewise.
* gcc.dg/bitint-7.c: Likewise.
* gcc.dg/bitint-8.c: Likewise.
* gcc.dg/bitint-9.c: Likewise.
* gcc.dg/c11-attr-syntax-3.c: Likewise.
* gcc.dg/c11-builtins-1.c: Likewise.
* gcc.dg/c11-complit-1.c: Likewise.
* gcc.dg/c11-complit-2.c: Likewise.
* gcc.dg/c11-complit-3.c: Likewise.
* gcc.dg/c11-digit-separators-1.c: Likewise.
* gcc.dg/c11-empty-init-3.c: Likewise.
* gcc.dg/c11-enum-1.c: Likewise.
* gcc.dg/c11-enum-2.c: Likewise.
* gcc.dg/c11-enum-3.c: Likewise.
* gcc.dg/c11-enum-4.c: Likewise.
* gcc.dg/c11-enum-5.c: Likewise.
* gcc.dg/c11-enum-6.c: Likewise.
* gcc.dg/c11-floatn-5.c: Likewise.
* gcc.dg/c11-floatn-6.c: Likewise.
* gcc.dg/c11-floatn-7.c: Likewise.
* gcc.dg/c11-floatn-8.c: Likewise.
* gcc.dg/c11-fordecl-3.c: Likewise.
* gcc.dg/c11-fordecl-4.c: Likewise.
* gcc.dg/c11-keywords-1.c: Likewise.
* gcc.dg/c11-old-style-definition-1.c: Likewise.
* gcc.dg/c11-old-style-definition-2.c: Likewise.
* gcc.dg/c11-parm-omit-3.c: Likewise.
* gcc.dg/c11-qual-1.c: Likewise.
* gcc.dg/c11-static-assert-9.c: Likewise.
* gcc.dg/c11-stdarg-3.c: Likewise.
* gcc.dg/c11-unproto-1.c: Likewise.
* gcc.dg/c11-unproto-2.c: Likewise.
* gcc.dg/c11-utf8char-1.c: Likewise.
* gcc.dg/c17-nullptr-2.c: Likewise.
* gcc.dg/c2x-align-1.c: Likewise.
* gcc.dg/c2x-align-6.c: Likewise.
* gcc.dg/c2x-attr-deprecated-1.c: Likewise.
* gcc.dg/c2x-attr-deprecated-2.c: Likewise.
* gcc.dg/c2x-attr-deprecated-3.c: Likewise.
* gcc.dg/c2x-attr-deprecated-4.c: Likewise.
* gcc.dg/c2x-attr-fallthrough-1.c: Likewise.
* gcc.dg/c2x-attr-fallthrough-2.c: Likewise.
* gcc.dg/c2x-attr-fallthrough-3.c: Likewise.
* gcc.dg/c2x-attr-fallthrough-4.c: Likewise.
* gcc.dg/c2x-attr-fallthrough-5.c: Likewise.
* gcc.dg/c2x-attr-fallthrough-6.c: Likewise.
* gcc.dg/c2x-attr-maybe_unused-1.c: Likewise.
* gcc.dg/c2x-attr-maybe_unused-2.c: Likewise.
* gcc.dg/c2x-attr-maybe_unused-3.c: Likewise.
* gcc.dg/c2x-attr-maybe_unused-4.c: Likewise.
* gcc.dg/c2x-attr-nodiscard-1.c: Likewise.
* gcc.dg/c2x-attr-nodiscard-2.c: Likewise.
* gcc.dg/c2x-attr-nodiscard-3.c: Likewise.
* gcc.dg/c2x-attr-nodiscard-4.c: Likewise.
* gcc.dg/c2x-attr-noreturn-1.c: Likewise.
* gcc.dg/c2x-attr-noreturn-2.c: Likewise.
* gcc.dg/c2x-attr-noreturn-3.c: Likewise.
* gcc.dg/c2x-attr-syntax-1.c: Likewise.
* gcc.dg/c2x-attr-syntax-2.c: Likewise.
* gcc.dg/c2x-attr-syntax-3.c: Likewise.
* gcc.dg/c2x-attr-syntax-4.c: Likewise.
* gcc.dg/c2x-attr-syntax-5.c: Likewise.
* gcc.dg/c2x-attr-syntax-7.c: Likewise.
* gcc.dg/c2x-auto-1.c: Likewise.
* gcc.dg/c2x-auto-2.c: Likewise.
* gcc.dg/c2x-auto-3.c: Likewise.
* gcc.dg/c2x-auto-4.c: Likewise.
* gcc.dg/c2x-binary-constants-1.c: Likewise.
* gcc.dg/c2x-binary-constants-2.c: Likewise.
* gcc.dg/c2x-binary-constants-3.c: Likewise.
* gcc.dg/c2x-bool-1.c: Likewise.
* gcc.dg/c2x-bool-2.c: Likewise.
* gcc.dg/c2x-bool-limits-1.c: Likewise.
* gcc.dg/c2x-builtins-1.c: Likewise.
* gcc.dg/c2x-complit-1.c: Likewise.
* gcc.dg/c2x-complit-2.c: Likewise.
* gcc.dg/c2x-complit-3.c: Likewise.
* gcc.dg/c2x-complit-4.c: Likewise.
* gcc.dg/c2x-complit-5.c: Likewise.
* gcc.dg/c2x-complit-6.c: Likewise.
* gcc.dg/c2x-complit-7.c: Likewise.
* gcc.dg/c2x-complit-8.c: Likewise.
* gcc.dg/c2x-concat-1.c: Likewise.
* gcc.dg/c2x-constexpr-1.c: Likewise.
* gcc.dg/c2x-constexpr-2a.c: Likewise.
* gcc.dg/c2x-constexpr-2b.c: Likewise.
* gcc.dg/c2x-constexpr-3.c: Likewise.
* gcc.dg/c2x-constexpr-4.c: Likewise.
* gcc.dg/c2x-constexpr-5.c: Likewise.
* gcc.dg/c2x-constexpr-6.c: Likewise.
* gcc.dg/c2x-constexpr-7.c: Likewise.
* gcc.dg/c2x-constexpr-8.c: Likewise.
* gcc.dg/c2x-constexpr-9.c: Likewise.
* gcc.dg/c2x-digit-separators-1.c: Likewise.
* gcc.dg/c2x-digit-separators-2.c: Likewise.
* gcc.dg/c2x-digit-separators-3.c: Likewise.
* gcc.dg/c2x-empty-init-1.c: Likewise.
* gcc.dg/c2x-empty-init-2.c: Likewise.
* gcc.dg/c2x-empty-init-3.c: Likewise.
* gcc.dg/c2x-enum-1.c: Likewise.
* gcc.dg/c2x-enum-2.c: Likewise.
* gcc.dg/c2x-enum-3.c: Likewise.
* gcc.dg/c2x-enum-4.c: Likewise.
* gcc.dg/c2x-enum-5.c: Likewise.
* gcc.dg/c2x-enum-6.c: Likewise.
* gcc.dg/c2x-enum-7.c: Likewise.
* gcc.dg/c2x-enum-8.c: Likewise.
* gcc.dg/c2x-float-1.c: Likewise.
* gcc.dg/c2x-float-10.c: Likewise.
* gcc.dg/c2x-float-11.c: Likewise.
* gcc.dg/c2x-float-12.c: Likewise.
* gcc.dg/c2x-float-13.c: Likewise.
* gcc.dg/c2x-float-2.c: Likewise.
* gcc.dg/c2x-float-3.c: Likewise.
* gcc.dg/c2x-float-4.c: Likewise.
* gcc.dg/c2x-float-5.c: Likewise.
* gcc.dg/c2x-float-6.c: Likewise.
* gcc.dg/c2x-float-7a.c: Likewise.
* gcc.dg/c2x-float-7b.c: Likewise.
* gcc.dg/c2x-float-7c.c: Likewise.
* gcc.dg/c2x-float-8.c: Likewise.
* gcc.dg/c2x-float-9.c: Likewise.
* gcc.dg/c2x-float-no-dfp-1.c: Likewise.
* gcc.dg/c2x-float-no-dfp-2.c: Likewise.
* gcc.dg/c2x-float-no-dfp-3.c: Likewise.
* gcc.dg/c2x-float-no-dfp-4.c: Likewise.
* gcc.dg/c2x-floatn-1.c: Likewise.
* gcc.dg/c2x-floatn-2.c: Likewise.
* gcc.dg/c2x-floatn-3.c: Likewise.
* gcc.dg/c2x-floatn-4.c: Likewise.
* gcc.dg/c2x-floatn-5.c: Likewise.
* gcc.dg/c2x-floatn-6.c: Likewise.
* gcc.dg/c2x-floatn-7.c: Likewise.
* gcc.dg/c2x-floatn-8.c: Likewise.
* gcc.dg/c2x-fordecl-1.c: Likewise.
* gcc.dg/c2x-fordecl-2.c: Likewise.
* gcc.dg/c2x-fordecl-3.c: Likewise.
* gcc.dg/c2x-fordecl-4.c: Likewise.
* gcc.dg/c2x-has-c-attribute-1.c: Likewise.
* gcc.dg/c2x-has-c-attribute-2.c: Likewise.
* gcc.dg/c2x-has-c-attribute-3.c: Likewise.
* gcc.dg/c2x-has-c-attribute-4.c: Likewise.
* gcc.dg/c2x-labels-1.c: Likewise.
* gcc.dg/c2x-labels-2.c: Likewise.
* gcc.dg/c2x-labels-3.c: Likewise.
* gcc.dg/c2x-limits-1.c: Likewise.
* gcc.dg/c2x-no-dfp-1.c: Likewise.
* gcc.dg/c2x-nullptr-1.c: Likewise.
* gcc.dg/c2x-nullptr-2.c: Likewise.
* gcc.dg/c2x-nullptr-3.c: Likewise.
* gcc.dg/c2x-nullptr-4.c: Likewise.
* gcc.dg/c2x-nullptr-5.c: Likewise.
* gcc.dg/c2x-nullptr-6.c: Likewise.
* gcc.dg/c2x-old-style-definition-1.c: Likewise.
* gcc.dg/c2x-old-style-definition-2.c: Likewise.
* gcc.dg/c2x-old-style-definition-3.c: Likewise.
* gcc.dg/c2x-old-style-definition-4.c: Likewise.
* gcc.dg/c2x-old-style-definition-5.c: Likewise.
* gcc.dg/c2x-old-style-definition-6.c: Likewise.
* gcc.dg/c2x-parm-omit-1.c: Likewise.
* gcc.dg/c2x-parm-omit-2.c: Likewise.
* gcc.dg/c2x-parm-omit-3.c: Likewise.
* gcc.dg/c2x-parm-omit-4.c: Likewise.
* gcc.dg/c2x-qual-1.c: Likewise.
* gcc.dg/c2x-qual-2.c: Likewise.
* gcc.dg/c2x-qual-3.c: Likewise.
* gcc.dg/c2x-qual-4.c: Likewise.
* gcc.dg/c2x-qual-5.c: Likewise.
* gcc.dg/c2x-qual-6.c: Likewise.
* gcc.dg/c2x-qual-7.c: Likewise.
* gcc.dg/c2x-static-assert-1.c: Likewise.
* gcc.dg/c2x-static-assert-2.c: Likewise.
* gcc.dg/c2x-static-assert-3.c: Likewise.
* gcc.dg/c2x-static-assert-4.c: Likewise.
* gcc.dg/c2x-stdarg-1.c: Likewise.
* gcc.dg/c2x-stdarg-2.c: Likewise.
* gcc.dg/c2x-stdarg-3.c: Likewise.
* gcc.dg/c2x-stdarg-4.c: Likewise.
* gcc.dg/c2x-stdarg-5.c: Likewise.
* gcc.dg/c2x-stdatomic-1.c: Likewise.
* gcc.dg/c2x-stddef-1.c: Likewise.
* gcc.dg/c2x-stdint-1.c: Likewise.
* gcc.dg/c2x-thread-local-1.c: Likewise.
* gcc.dg/c2x-thread-local-2.c: Likewise.
* gcc.dg/c2x-typeof-1.c: Likewise.
* gcc.dg/c2x-typeof-2.c: Likewise.
* gcc.dg/c2x-typeof-3.c: Likewise.
* gcc.dg/c2x-unproto-1.c: Likewise.
* gcc.dg/c2x-unproto-2.c: Likewise.
* gcc.dg/c2x-unproto-3.c: Likewise.
* gcc.dg/c2x-unproto-4.c: Likewise.
* gcc.dg/c2x-unreachable-1.c: Likewise.
* gcc.dg/c2x-utf8char-1.c: Likewise.
* gcc.dg/c2x-utf8char-2.c: Likewise.
* gcc.dg/c2x-utf8char-3.c: Likewise.
* gcc.dg/c2x-utf8str-type.c: Likewise.
* gcc.dg/c2x-utf8str.c: Likewise.
* gcc.dg/c90-auto-1.c: Likewise.
* gcc.dg/c90-complit-2.c: Likewise.
* gcc.dg/cpp/c11-warning-3.c: Likewise.
* gcc.dg/cpp/c2x-elifdef-1.c: Likewise.
* gcc.dg/cpp/c2x-elifdef-2.c: Likewise.
* gcc.dg/cpp/c2x-scope-1.c: Likewise.
* gcc.dg/cpp/c2x-scope-2.c: Likewise.
* gcc.dg/cpp/c2x-trigraphs-1.c: Likewise.
* gcc.dg/cpp/c2x-trigraphs-2.c: Likewise.
* gcc.dg/cpp/c2x-ucn-1.c: Likewise.
* gcc.dg/cpp/c2x-ucnid-1-utf8.c: Likewise.
* gcc.dg/cpp/c2x-ucnid-1.c: Likewise.
* gcc.dg/cpp/c2x-va-opt-1.c: Likewise.
* gcc.dg/cpp/c2x-warning-1.c: Likewise.
* gcc.dg/cpp/c2x-warning-2.c: Likewise.
* gcc.dg/cpp/gnu11-warning-3.c: Likewise.
* gcc.dg/cpp/gnu2x-warning-1.c: Likewise.
* gcc.dg/cpp/gnu2x-warning-2.c: Likewise.
* gcc.dg/cr-decimal-dig-2.c: Likewise.
* gcc.dg/cr-decimal-dig-3.c: Likewise.
* gcc.dg/dfp/bid-non-canonical-d128-1.c: Likewise.
* gcc.dg/dfp/bid-non-canonical-d128-2.c: Likewise.
* gcc.dg/dfp/bid-non-canonical-d128-3.c: Likewise.
* gcc.dg/dfp/bid-non-canonical-d128-4.c: Likewise.
* gcc.dg/dfp/bid-non-canonical-d32-1.c: Likewise.
* gcc.dg/dfp/bid-non-canonical-d32-2.c: Likewise.
* gcc.dg/dfp/bid-non-canonical-d64-1.c: Likewise.
* gcc.dg/dfp/bid-non-canonical-d64-2.c: Likewise.
* gcc.dg/dfp/bitint-1.c: Likewise.
* gcc.dg/dfp/bitint-2.c: Likewise.
* gcc.dg/dfp/bitint-3.c: Likewise.
* gcc.dg/dfp/bitint-4.c: Likewise.
* gcc.dg/dfp/bitint-5.c: Likewise.
* gcc.dg/dfp/bitint-6.c: Likewise.
* gcc.dg/dfp/bitint-7.c: Likewise.
* gcc.dg/dfp/bitint-8.c: Likewise.
* gcc.dg/dfp/c2x-builtins-dfp-1.c: Likewise.
* gcc.dg/dfp/c2x-constants-1.c: Likewise.
* gcc.dg/dfp/c2x-constants-2.c: Likewise.
* gcc.dg/dfp/c2x-constexpr-dfp-1.c: Likewise.
* gcc.dg/dfp/c2x-constexpr-dfp-2.c: Likewise.
* gcc.dg/dfp/c2x-float-dfp-1.c: Likewise.
* gcc.dg/dfp/c2x-float-dfp-2.c: Likewise.
* gcc.dg/dfp/c2x-float-dfp-3.c: Likewise.
* gcc.dg/dfp/c2x-float-dfp-4.c: Likewise.
* gcc.dg/dfp/c2x-float-dfp-5.c: Likewise.
* gcc.dg/dfp/c2x-float-dfp-6.c: Likewise.
* gcc.dg/dfp/c2x-float-dfp-7.c: Likewise.
* gcc.dg/dfp/c2x-float-dfp-8.c: Likewise.
* gcc.dg/dfp/c2x-keywords-1.c: Likewise.
* gcc.dg/dfp/c2x-keywords-2.c: Likewise.
* gcc.dg/dfp/tr24732-float-dfp-1.c: Likewise.
* gcc.dg/dfp/ts18661-2-float-dfp-1.c: Likewise.
* gcc.dg/fixed-point/bitint-1.c: Likewise.
* gcc.dg/format/c11-printf-1.c: Likewise.
* gcc.dg/format/c11-scanf-1.c: Likewise.
* gcc.dg/format/c2x-dfp-printf-1.c: Likewise.
* gcc.dg/format/c2x-dfp-scanf-1.c: Likewise.
* gcc.dg/format/c2x-printf-1.c: Likewise.
* gcc.dg/format/c2x-scanf-1.c: Likewise.
* gcc.dg/format/c2x-strftime-1.c: Likewise.
* gcc.dg/format/ext-10.c: Likewise.
* gcc.dg/format/ext-9.c: Likewise.
* gcc.dg/gnu11-typeof-2.c: Likewise.
* gcc.dg/gnu2x-attr-syntax-1.c: Likewise.
* gcc.dg/gnu2x-attr-syntax-2.c: Likewise.
* gcc.dg/gnu2x-attrs-1.c: Likewise.
* gcc.dg/gnu2x-attrs-2.c: Likewise.
* gcc.dg/gnu2x-auto-1.c: Likewise.
* gcc.dg/gnu2x-builtins-no-dfp-1.c: Likewise.
* gcc.dg/gnu2x-complit-1.c: Likewise.
* gcc.dg/gnu2x-complit-2.c: Likewise.
* gcc.dg/gnu2x-constexpr-1.c: Likewise.
* gcc.dg/gnu2x-empty-init-1.c: Likewise.
* gcc.dg/gnu2x-empty-init-2.c: Likewise.
* gcc.dg/gnu2x-enum-1.c: Likewise.
* gcc.dg/gnu2x-static-assert-1.c: Likewise.
* gcc.dg/gnu2x-stdarg-1.c: Likewise.
* gcc.dg/gnu2x-typeof-1.c: Likewise.
* gcc.dg/gnu2x-utf8char-1.c: Likewise.
* gcc.dg/gnu2x-utf8str-type.c: Likewise.
* gcc.dg/gnu2x-utf8str.c: Likewise.
* gcc.dg/gomp/attrs-1.c: Likewise.
* gcc.dg/gomp/attrs-10.c: Likewise.
* gcc.dg/gomp/attrs-11.c: Likewise.
* gcc.dg/gomp/attrs-12.c: Likewise.
* gcc.dg/gomp/attrs-13.c: Likewise.
* gcc.dg/gomp/attrs-14.c: Likewise.
* gcc.dg/gomp/attrs-15.c: Likewise.
* gcc.dg/gomp/attrs-16.c: Likewise.
* gcc.dg/gomp/attrs-17.c: Likewise.
* gcc.dg/gomp/attrs-18.c: Likewise.
* gcc.dg/gomp/attrs-19.c: Likewise.
* gcc.dg/gomp/attrs-2.c: Likewise.
* gcc.dg/gomp/attrs-20.c: Likewise.
* gcc.dg/gomp/attrs-21.c: Likewise.
* gcc.dg/gomp/attrs-3.c: Likewise.
* gcc.dg/gomp/attrs-4.c: Likewise.
* gcc.dg/gomp/attrs-5.c: Likewise.
* gcc.dg/gomp/attrs-6.c: Likewise.
* gcc.dg/gomp/attrs-7.c: Likewise.
* gcc.dg/gomp/attrs-8.c: Likewise.
* gcc.dg/gomp/attrs-9.c: Likewise.
* gcc.dg/limits-width-2.c: Likewise.
* gcc.dg/qual-return-10.c: Likewise.
* gcc.dg/qual-return-9.c: Likewise.
* gcc.dg/sso-19.c: Likewise.
* gcc.dg/stdckdint-1.c: Likewise.
* gcc.dg/stdckdint-2.c: Likewise.
* gcc.dg/stdint-width-2.c: Likewise.
* gcc.dg/tm/attrs-1.c: Likewise.
* gcc.dg/torture/bitint-1.c: Likewise.
* gcc.dg/torture/bitint-10.c: Likewise.
* gcc.dg/torture/bitint-11.c: Likewise.
* gcc.dg/torture/bitint-12.c: Likewise.
* gcc.dg/torture/bitint-13.c: Likewise.
* gcc.dg/torture/bitint-14.c: Likewise.
* gcc.dg/torture/bitint-15.c: Likewise.
* gcc.dg/torture/bitint-16.c: Likewise.
* gcc.dg/torture/bitint-17.c: Likewise.
* gcc.dg/torture/bitint-18.c: Likewise.
* gcc.dg/torture/bitint-19.c: Likewise.
* gcc.dg/torture/bitint-2.c: Likewise.
* gcc.dg/torture/bitint-20.c: Likewise.
* gcc.dg/torture/bitint-21.c: Likewise.
* gcc.dg/torture/bitint-22.c: Likewise.
* gcc.dg/torture/bitint-23.c: Likewise.
* gcc.dg/torture/bitint-24.c: Likewise.
* gcc.dg/torture/bitint-25.c: Likewise.
* gcc.dg/torture/bitint-26.c: Likewise.
* gcc.dg/torture/bitint-27.c: Likewise.
* gcc.dg/torture/bitint-28.c: Likewise.
* gcc.dg/torture/bitint-29.c: Likewise.
* gcc.dg/torture/bitint-3.c: Likewise.
* gcc.dg/torture/bitint-30.c: Likewise.
* gcc.dg/torture/bitint-31.c: Likewise.
* gcc.dg/torture/bitint-32.c: Likewise.
* gcc.dg/torture/bitint-33.c: Likewise.
* gcc.dg/torture/bitint-34.c: Likewise.
* gcc.dg/torture/bitint-35.c: Likewise.
* gcc.dg/torture/bitint-36.c: Likewise.
* gcc.dg/torture/bitint-37.c: Likewise.
* gcc.dg/torture/bitint-38.c: Likewise.
* gcc.dg/torture/bitint-39.c: Likewise.
* gcc.dg/torture/bitint-4.c: Likewise.
* gcc.dg/torture/bitint-40.c: Likewise.
* gcc.dg/torture/bitint-41.c: Likewise.
* gcc.dg/torture/bitint-42.c: Likewise.
* gcc.dg/torture/bitint-5.c: Likewise.
* gcc.dg/torture/bitint-6.c: Likewise.
* gcc.dg/torture/bitint-7.c: Likewise.
* gcc.dg/torture/bitint-8.c: Likewise.
* gcc.dg/torture/bitint-9.c: Likewise.
* gcc.dg/torture/builtin-fp-int-inexact-c2x.c: Likewise.
* gcc.dg/torture/c2x-stdarg-split-1a.c: Likewise.
* gcc.dg/torture/c2x-stdarg-split-1b.c: Likewise.
* gcc.dg/torture/float128-nan-floath.c: Likewise.
* gcc.dg/torture/float128x-nan-floath.c: Likewise.
* gcc.dg/torture/float16-nan-floath.c: Likewise.
* gcc.dg/torture/float32-nan-floath.c: Likewise.
* gcc.dg/torture/float32x-nan-floath.c: Likewise.
* gcc.dg/torture/float64-nan-floath.c: Likewise.
* gcc.dg/torture/float64x-nan-floath.c: Likewise.
* gcc.target/i386/excess-precision-11.c: Likewise.
* gcc.target/i386/excess-precision-12.c: Likewise.
* lib/target-supports.exp: Likewise.
* objc.dg/attributes/gnu2x-attr-syntax-1.m: Likewise.

6 months agotest: Recover sdiv_pow2 check and remove test of RISC-V
Juzhe-Zhong [Tue, 7 Nov 2023 14:45:05 +0000 (22:45 +0800)] 
test: Recover sdiv_pow2 check and remove test of RISC-V

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-sdiv-pow2-1.c: Recover scan check.
* lib/target-supports.exp: Remove riscv.

6 months agovect/ifcvt: Add vec_cond fallback and check for vector versioning.
Robin Dapp [Mon, 6 Nov 2023 10:24:37 +0000 (11:24 +0100)] 
vect/ifcvt: Add vec_cond fallback and check for vector versioning.

This restricts tree-ifcvt to only create COND_OPs when we versioned the
loop for vectorization.  Apart from that it re-creates a VEC_COND_EXPR
in vect_expand_fold_left if we emitted a COND_OP.

gcc/ChangeLog:

PR tree-optimization/112361
PR target/112359
PR middle-end/112406

* tree-if-conv.cc (convert_scalar_cond_reduction): Remember if
loop was versioned and only then create COND_OPs.
(predicate_scalar_phi): Do not create COND_OP when not
vectorizing.
* tree-vect-loop.cc (vect_expand_fold_left): Re-create
VEC_COND_EXPR.
(vectorize_fold_left_reduction): Pass mask to
vect_expand_fold_left.

gcc/testsuite/ChangeLog:

* gcc.dg/pr112359.c: New test.

6 months agolibstdc++: [_Hashtable] Add missing node destructor call
François Dumont [Mon, 6 Nov 2023 18:34:50 +0000 (19:34 +0100)] 
libstdc++: [_Hashtable] Add missing node destructor call

libstdc++-v3/ChangeLog:

* include/bits/hashtable_policy.h
(_Hashtable_alloc<>::_M_allocate_node): Add missing call to node destructor
on construct exception.

6 months agoc: Change T2X_* format checking macros to T23_*
Joseph Myers [Tue, 7 Nov 2023 20:03:37 +0000 (20:03 +0000)] 
c: Change T2X_* format checking macros to T23_*

Analogous to previous changes to code that matched "c2x"
(case-insensitive), also update T2X_* macros used in format checking
tables to be named T23_*.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/c-family/
* c-format.h (T2X_UI): Rename to T23_UI.
(T2X_UL): Rename to T23_UL.
(T2X_ULL): Rename to T23_ULL.
(T2X_US): Rename to T23_US.
(T2X_UC): Rename to T23_UC.
(T2X_ST): Rename to T23_ST.
(T2X_UPD): Rename to T23_UPD.
(T2X_UIM): Rename to T23_UIM.
(T2X_D32): Rename to T23_D32.
(T2X_D64): Rename to T23_D64.
(T2X_D128): Rename to T23_D128.
(T2X_I8): Rename to T23_I8.
(T2X_I16): Rename to T23_I16.
(T2X_I32): Rename to T23_I32.
(T2X_I64): Rename to T23_I64.
(T2X_U8): Rename to T23_U8.
(T2X_U16): Rename to T23_U16.
(T2X_U32): Rename to T23_U32.
(T2X_U64): Rename to T23_U64.
(T2X_IF8): Rename to T23_IF8.
(T2X_IF16): Rename to T23_IF16.
(T2X_IF32): Rename to T23_IF32.
(T2X_IF64): Rename to T23_IF64.
(T2X_UF8): Rename to T23_UF8.
(T2X_UF16): Rename to T23_UF16.
(T2X_UF32): Rename to T23_UF32.
(T2X_UF64): Rename to T23_UF64.
* c-format.cc: Update all uses of T2X_* macros to use T23_*.

6 months agoi386: Make flags_reg_operand a special predicate
Uros Bizjak [Tue, 7 Nov 2023 18:32:14 +0000 (19:32 +0100)] 
i386: Make flags_reg_operand a special predicate

There is no need to check the mode in flags_reg_operand predicate. The
mode in flags setting instructions is checked with ix86_match_ccmode.

The patch avoids "warning: operand X missing mode?" warnings with
VOIDmode flags_reg_operand predicate.

gcc/ChangeLog:

* config/i386/predicates.md ("flags_reg_operand"):
Make predicate special to avoid automatic mode checks.

6 months agogcc/configure: Regenerate
Martin Jambor [Tue, 7 Nov 2023 17:47:09 +0000 (18:47 +0100)] 
gcc/configure: Regenerate

Probabaly because of a re-base of changes to gcc/configure there are
line comment mismatches in between what we have and what would be
generated. This patch brings them in line so that consitency
checkers are happy.

gcc/ChangeLog:

2023-11-07  Martin Jambor  <mjambor@suse.cz>

* configure: Regenerate.

6 months agotestsuite: nodiscard-reason-nonstring.C FAIL in C++26
Marek Polacek [Tue, 7 Nov 2023 15:41:41 +0000 (10:41 -0500)] 
testsuite: nodiscard-reason-nonstring.C FAIL in C++26

Since r14-5071, we emit an extra error for this test (the first one):

nodiscard-reason-nonstring.C:5:13: error: expected string-literal before numeric constant
nodiscard-reason-nonstring.C:5:36: error: 'nodiscard' attribute argument must be a string constant

so the test needs adjusting.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nodiscard-reason-nonstring.C: Adjust dg-error.

6 months agoopenmp: Add support for the 'indirect' clause in C/C++
Kwok Cheung Yeung [Tue, 7 Nov 2023 15:18:29 +0000 (15:18 +0000)] 
openmp: Add support for the 'indirect' clause in C/C++

This adds support for the 'indirect' clause in the 'declare target'
directive.  Functions declared as indirect may be called via function
pointers passed from the host in offloaded code.

Virtual calls to member functions via the object pointer in C++ are
currently not supported in target regions.

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

gcc/c-family/
* c-attribs.cc (c_common_attribute_table): Add attribute for
indirect functions.
* c-pragma.h (enum parma_omp_clause): Add entry for indirect clause.

gcc/c/
* c-decl.cc (c_decl_attributes): Add attribute for indirect
functions.
* c-lang.h (c_omp_declare_target_attr): Add indirect field.
* c-parser.cc (c_parser_omp_clause_name): Handle indirect clause.
(c_parser_omp_clause_indirect): New.
(c_parser_omp_all_clauses): Handle indirect clause.
(OMP_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
(c_parser_omp_declare_target): Handle indirect clause.  Emit error
message if device_type or indirect clauses used alone.  Emit error
if indirect clause used with device_type that is not 'any'.
(OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
(c_parser_omp_begin): Handle indirect clause.
* c-typeck.cc (c_finish_omp_clauses): Handle indirect clause.

gcc/cp/
* cp-tree.h (cp_omp_declare_target_attr): Add indirect field.
* decl2.cc (cplus_decl_attributes): Add attribute for indirect
functions.
* parser.cc (cp_parser_omp_clause_name): Handle indirect clause.
(cp_parser_omp_clause_indirect): New.
(cp_parser_omp_all_clauses): Handle indirect clause.
(handle_omp_declare_target_clause): Add extra parameter.  Add
indirect attribute for indirect functions.
(OMP_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
(cp_parser_omp_declare_target): Handle indirect clause.  Emit error
message if device_type or indirect clauses used alone.  Emit error
if indirect clause used with device_type that is not 'any'.
(OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
(cp_parser_omp_begin): Handle indirect clause.
* semantics.cc (finish_omp_clauses): Handle indirect clause.

gcc/
* lto-cgraph.cc (enum LTO_symtab_tags): Add tag for indirect
functions.
(output_offload_tables): Write indirect functions.
(input_offload_tables): read indirect functions.
* lto-section-names.h (OFFLOAD_IND_FUNC_TABLE_SECTION_NAME): New.
* omp-builtins.def (BUILT_IN_GOMP_TARGET_MAP_INDIRECT_PTR): New.
* omp-offload.cc (offload_ind_funcs): New.
(omp_discover_implicit_declare_target): Add functions marked with
'omp declare target indirect' to indirect functions list.
(omp_finish_file): Add indirect functions to section for offload
indirect functions.
(execute_omp_device_lower): Redirect indirect calls on target by
passing function pointer to BUILT_IN_GOMP_TARGET_MAP_INDIRECT_PTR.
(pass_omp_device_lower::gate): Run pass_omp_device_lower if
indirect functions are present on an accelerator device.
* omp-offload.h (offload_ind_funcs): New.
* tree-core.h (omp_clause_code): Add OMP_CLAUSE_INDIRECT.
* tree.cc (omp_clause_num_ops): Add entry for OMP_CLAUSE_INDIRECT.
(omp_clause_code_name): Likewise.
* tree.h (OMP_CLAUSE_INDIRECT_EXPR): New.
* config/gcn/mkoffload.cc (process_asm): Process offload_ind_funcs
section.  Count number of indirect functions.
(process_obj): Emit number of indirect functions.
* config/nvptx/mkoffload.cc (ind_func_ids, ind_funcs_tail): New.
(process): Emit offload_ind_func_table in PTX code.  Emit indirect
function names and count in image.
* config/nvptx/nvptx.cc (nvptx_record_offload_symbol): Mark
indirect functions in PTX code with IND_FUNC_MAP.

gcc/testsuite/
* c-c++-common/gomp/declare-target-7.c: Update expected error message.
* c-c++-common/gomp/declare-target-indirect-1.c: New.
* c-c++-common/gomp/declare-target-indirect-2.c: New.
* g++.dg/gomp/attrs-21.C (v12): Update expected error message.
* g++.dg/gomp/declare-target-indirect-1.C: New.
* gcc.dg/gomp/attrs-21.c (v12): Update expected error message.

include/
* gomp-constants.h (GOMP_VERSION): Increment to 3.
(GOMP_VERSION_SUPPORTS_INDIRECT_FUNCS): New.

libgcc/
* offloadstuff.c (OFFLOAD_IND_FUNC_TABLE_SECTION_NAME): New.
(__offload_ind_func_table): New.
(__offload_ind_funcs_end): New.
(__OFFLOAD_TABLE__): Add entries for indirect functions.

libgomp/
* Makefile.am (libgomp_la_SOURCES): Add target-indirect.c.
* Makefile.in: Regenerate.
* libgomp-plugin.h (GOMP_INDIRECT_ADDR_MAP): New define.
(GOMP_OFFLOAD_load_image): Add extra argument.
* libgomp.h (struct indirect_splay_tree_key_s): New.
(indirect_splay_tree_node, indirect_splay_tree,
indirect_splay_tree_key): New.
(indirect_splay_compare): New.
* libgomp.map (GOMP_5.1.1): Add GOMP_target_map_indirect_ptr.
* libgomp.texi (OpenMP 5.1): Update documentation on indirect
calls in target region and on indirect clause.
(Other new OpenMP 5.2 features): Add entry for virtual function calls.
* libgomp_g.h (GOMP_target_map_indirect_ptr): Add prototype.
* oacc-host.c (host_load_image): Add extra argument.
* target.c (gomp_load_image_to_device): If the GOMP_VERSION is high
enough, read host indirect functions table and pass to
load_image_func.
* config/accel/target-indirect.c: New.
* config/linux/target-indirect.c: New.
* config/gcn/team.c (build_indirect_map): Add prototype.
(gomp_gcn_enter_kernel): Initialize support for indirect
function calls on GCN target.
* config/nvptx/team.c (build_indirect_map): Add prototype.
(gomp_nvptx_main): Initialize support for indirect function
calls on NVPTX target.
* plugin/plugin-gcn.c (struct gcn_image_desc): Add field for
indirect functions count.
(GOMP_OFFLOAD_load_image): Add extra argument.  If the GOMP_VERSION
is high enough, build address translation table and copy it to target
memory.
* plugin/plugin-nvptx.c (nvptx_tdata): Add field for indirect
functions count.
(GOMP_OFFLOAD_load_image): Add extra argument.  If the GOMP_VERSION
is high enough, Build address translation table and copy it to target
memory.
* testsuite/libgomp.c-c++-common/declare-target-indirect-1.c: New.
* testsuite/libgomp.c-c++-common/declare-target-indirect-2.c: New.
* testsuite/libgomp.c++/declare-target-indirect-1.C: New.

6 months agoOpenMP: invoke.texi - mention C attribute syntax for -fopenmp(-simd)
Tobias Burnus [Tue, 7 Nov 2023 15:23:45 +0000 (16:23 +0100)] 
OpenMP: invoke.texi - mention C attribute syntax for -fopenmp(-simd)

gcc/ChangeLog:

* doc/invoke.texi (-fopenmp, -fopenmp-simd): Adjust wording for
attribute syntax supported also in C.

6 months agoaarch64: Add a %Z operand modifier for SVE registers
Richard Sandiford [Tue, 7 Nov 2023 15:22:57 +0000 (15:22 +0000)] 
aarch64: Add a %Z operand modifier for SVE registers

This patch adds a %Z operand modifier that prints registers as SVE z
registers.  The SME patches need this, but so do Tamar's patches.
I'm separating this out to unblock those.

We should probably document the [wxbhsdqZ] modifiers as
user-facing, but doing that for all of them is a separate patch.

gcc/
* config/aarch64/aarch64.cc (aarch64_print_operand): Add a %Z
modifier for SVE registers.

6 months agoc: Refer more consistently to C23 not C2X
Joseph Myers [Tue, 7 Nov 2023 14:19:36 +0000 (14:19 +0000)] 
c: Refer more consistently to C23 not C2X

Continuing the move to refer to C23 in place of C2X throughout the
source tree, update documentation, diagnostics, comments, variable and
function names, etc., to use the C23 name.

Testsuite updates are left for a future patch, except for testcases
that test diagnostics that previously mentioned C2X (but in those
testcases, sometimes other comments are updated, not just the
diagnostic expectations).

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/
* builtins.def (DEF_C2X_BUILTIN): Rename to DEF_C23_BUILTIN and
use flag_isoc23 and function_c23_misc.
* config/rl78/rl78.cc (rl78_option_override): Compare
lang_hooks.name with "GNU C23" not "GNU C2X".
* coretypes.h (function_c2x_misc): Rename to function_c23_misc.
* doc/cpp.texi (@code{__has_attribute}): Refer to C23 instead of
C2x.
* doc/extend.texi: Likewise.
* doc/invoke.texi: Likewise.
* dwarf2out.cc (highest_c_language, gen_compile_unit_die): Compare
against and return "GNU C23" language string instead of "GNU C2X".
* ginclude/float.h: Refer to C23 instead of C2X in comments.
* ginclude/stdint-gcc.h: Likewise.
* glimits.h: Likewise.
* tree.h: Likewise.

gcc/ada/
* gcc-interface/utils.cc (flag_isoc2x): Rename to flag_isoc23.

gcc/c-family/
* c-common.cc (flag_isoc2x): Rename to flag_isoc23.
(c_common_reswords): Use D_C23 instead of D_C2X.
* c-common.h: Refer throughout to C23 instead of C2X in comments.
(D_C2X): Rename to D_C23.
(flag_isoc2x): Rename to flag_isoc23.
* c-cppbuiltin.cc (builtin_define_float_constants): Use
flag_isoc23 instead of flag_isoc2x.  Refer to C23 instead of C2x
in comments.
* c-format.cc: Use STD_C23 instead of STD_C2X and flag_isoc23
instead of flag_isoc2x.  Refer to C23 instead of C2X in comments.
* c-format.h: Use STD_C23 instead of STD_C2X.
* c-lex.cc: Use warn_c11_c23_compat instead of warn_c11_c2x_compat
and flag_isoc23 instead of flag_isoc2x.  Refer to C23 instead of
C2X in diagnostics.
* c-opts.cc: Use flag_isoc23 instead of flag_isoc2x.  Refer to C23
instead of C2X in comments.
(set_std_c2x): Rename to set_std_c23.
* c.opt (Wc11-c23-compat): Use CPP(cpp_warn_c11_c23_compat)
CppReason(CPP_W_C11_C23_COMPAT) Var(warn_c11_c23_compat) instead
of CPP(cpp_warn_c11_c2x_compat) CppReason(CPP_W_C11_C2X_COMPAT)
Var(warn_c11_c2x_compat).

gcc/c/
* c-decl.cc: Use flag_isoc23 instead of flag_isoc2x and c23_auto_p
instead of c2x_auto_p.  Refer to C23 instead of C2X in diagnostics
and comments.
* c-errors.cc: Use flag_isoc23 instead of flag_isoc2x and
warn_c11_c23_compat instead of warn_c11_c2x_compat.  Refer to C23
instead of C2X in comments.
* c-parser.cc: Use flag_isoc23 instead of flag_isoc2x,
warn_c11_c23_compat instead of warn_c11_c2x_compat, c23_auto_p
instead of c2x_auto_p and D_C23 instead of D_C2X.  Refer to C23
instead of C2X in diagnostics and comments.
* c-tree.h: Refer to C23 instead of C2X in comments.
(struct c_declspecs): Rename c2x_auto_p to c23_auto_p.
* c-typeck.cc: Use flag_isoc23 instead of flag_isoc2x and
warn_c11_c23_compat instead of warn_c11_c2x_compat.  Refer to C23
instead of C2X in diagnostics and comments.

gcc/fortran/
* gfortran.h (gfc_real_info): Refer to C23 instead of C2X in
comment.

gcc/lto/
* lto-lang.cc (flag_isoc2x): Rename to flag_isoc23.

gcc/testsuite/
* gcc.dg/binary-constants-2.c: Refer to C23 instead of C2X.
* gcc.dg/binary-constants-3.c: Likewise.
* gcc.dg/bitint-23.c: Likewise.
* gcc.dg/bitint-26.c: Likewise.
* gcc.dg/bitint-27.c: Likewise.
* gcc.dg/c11-attr-syntax-1.c: Likewise.
* gcc.dg/c11-attr-syntax-2.c: Likewise.
* gcc.dg/c11-floatn-1.c: Likewise.
* gcc.dg/c11-floatn-2.c: Likewise.
* gcc.dg/c11-floatn-3.c: Likewise.
* gcc.dg/c11-floatn-4.c: Likewise.
* gcc.dg/c11-floatn-5.c: Likewise.
* gcc.dg/c11-floatn-6.c: Likewise.
* gcc.dg/c11-floatn-7.c: Likewise.
* gcc.dg/c11-floatn-8.c: Likewise.
* gcc.dg/c2x-attr-syntax-4.c: Likewise.
* gcc.dg/c2x-attr-syntax-6.c: Likewise.
* gcc.dg/c2x-attr-syntax-7.c: Likewise.
* gcc.dg/c2x-binary-constants-2.c: Likewise.
* gcc.dg/c2x-floatn-5.c: Likewise.
* gcc.dg/c2x-floatn-6.c: Likewise.
* gcc.dg/c2x-floatn-7.c: Likewise.
* gcc.dg/c2x-floatn-8.c: Likewise.
* gcc.dg/c2x-nullptr-4.c: Likewise.
* gcc.dg/c2x-qual-2.c: Likewise.
* gcc.dg/c2x-qual-3.c: Likewise.
* gcc.dg/c2x-qual-6.c: Likewise.
* gcc.dg/cpp/c11-warning-1.c: Likewise.
* gcc.dg/cpp/c11-warning-2.c: Likewise.
* gcc.dg/cpp/c11-warning-3.c: Likewise.
* gcc.dg/cpp/c2x-warning-2.c: Likewise.
* gcc.dg/cpp/gnu11-elifdef-3.c: Likewise.
* gcc.dg/cpp/gnu11-elifdef-4.c: Likewise.
* gcc.dg/cpp/gnu11-warning-1.c: Likewise.
* gcc.dg/cpp/gnu11-warning-2.c: Likewise.
* gcc.dg/cpp/gnu11-warning-3.c: Likewise.
* gcc.dg/cpp/gnu2x-warning-2.c: Likewise.
* gcc.dg/dfp/c11-constants-1.c: Likewise.
* gcc.dg/dfp/c11-constants-2.c: Likewise.
* gcc.dg/dfp/c2x-constants-2.c: Likewise.
* gcc.dg/dfp/constants-pedantic.c: Likewise.
* gcc.dg/pr30260.c: Likewise.
* gcc.dg/system-binary-constants-1.c: Likewise.

libcpp/
* directives.cc: Refer to C23 instead of C2X in diagnostics and
comments.
(STDC2X): Rename to STDC23.
* expr.cc: Use cpp_warn_c11_c23_compat instead of
cpp_warn_c11_c2x_compat and CPP_W_C11_C23_COMPAT instead of
CPP_W_C11_C2X_COMPAT.  Refer to C23 instead of C2X in diagnostics
and comments.
* include/cpplib.h: Refer to C23 instead of C2X in diagnostics and
comments.
(CLK_GNUC2X): Rename to CLK_GNUC23.
(CLK_STDC2X): Rename to CLK_STDC23.
(CPP_W_C11_C2X_COMPAT): Rename to CPP_W_C11_C23_COMPAT.
* init.cc: Use GNUC23 instead of GNUC2X, STDC23 instead of STDC2X
and cpp_warn_c11_c23_compat instead of cpp_warn_c11_c2x_compat.
* lex.cc (maybe_va_opt_error): Refer to C23 instead of C2X in
diagnostic.
* macro.cc (_cpp_arguments_ok): Refer to C23 instead of C2X in
comment.

6 months agotest: Fix FAIL of pr65518.c for RVV[PR112420]
Juzhe-Zhong [Tue, 7 Nov 2023 13:30:14 +0000 (21:30 +0800)] 
test: Fix FAIL of pr65518.c for RVV[PR112420]

PR target/112420

gcc/testsuite/ChangeLog:

* gcc.dg/vect/pr65518.c: Fix check for RVV.

6 months agolibstdc++/112351 - deal with __gthread_once failure during locale init
Richard Biener [Mon, 6 Nov 2023 10:31:40 +0000 (11:31 +0100)] 
libstdc++/112351 - deal with __gthread_once failure during locale init

The following makes the C++98 locale init path follow the way the
C++11 performs initialization.  This way we deal with pthread_once
failing, falling back to non-threadsafe initialization which, given we
initialize from the library, should be serialized by the dynamic
loader already.

PR libstdc++/112351
libstdc++-v3/
* src/c++98/locale.cc (locale::facet::_S_initialize_once):
Check whether _S_c_locale is already initialized.
(locale::facet::_S_get_c_locale): Always perform non-threadsafe
init when threadsafe init failed.

6 months agotestsuite/vect: Make check more accurate.
Robin Dapp [Tue, 7 Nov 2023 08:15:02 +0000 (09:15 +0100)] 
testsuite/vect: Make check more accurate.

Similar to before this modifies a check so we do only match a
vectorization attempt if it succeeded.  On riscv we potentially try
several modes if which some may fail.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-cond-reduc-4.c: Make check more accurate.

6 months agotestsuite: Change expectation for bb-slp-over-widen-n.c
Robin Dapp [Tue, 7 Nov 2023 07:58:07 +0000 (08:58 +0100)] 
testsuite: Change expectation for bb-slp-over-widen-n.c

This patch makes sure we check for
  note: Basic block will be vectorized using SLP
instead of
  optimized: basic block
which will also match
  optimized: basic block part
of which there are many more in an RVV dump.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/bb-slp-over-widen-1.c: Change test expectation.
* gcc.dg/vect/bb-slp-over-widen-2.c: Ditto.

6 months agoRISC-V: Add RISC-V into vect_cmdline_needed
Juzhe-Zhong [Tue, 7 Nov 2023 11:46:34 +0000 (19:46 +0800)] 
RISC-V: Add RISC-V into vect_cmdline_needed

Like all other targets, we add RISC-V into vect_cmdline_needed.

This patch fixes following FAILs:

FAIL: gcc.dg/tree-ssa/gen-vect-11b.c scan-tree-dump-times vect "vectorized 0 loops" 1
FAIL: gcc.dg/tree-ssa/gen-vect-11c.c scan-tree-dump-times vect "vectorized 0 loops" 1
FAIL: gcc.dg/tree-ssa/gen-vect-26.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
FAIL: gcc.dg/tree-ssa/gen-vect-28.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1

gcc/testsuite/ChangeLog:

* lib/target-supports.exp: Add RISC-V.

6 months agotestsuite: check for and use -mno-strict-align where needed
Alexandre Oliva [Tue, 7 Nov 2023 11:02:03 +0000 (08:02 -0300)] 
testsuite: check for and use -mno-strict-align where needed

Various tests fail on powerpc if the toolchain is configured to enable
-mstrict-align by default.  This patch introduces -mno-strict-align on
tests found to fail that way, when the target supports this option.

I suppose !non_strict_align could be used to skip tests, instead of or
in addition to this tweak, and that might be desirable if they still
fail on targets that do no support -mno-strict-align, but I haven't
observed such scenarios.

The p9-vec-length tests expect vectorization on loop bodies and
epilogues that reference arrays that are not known to be more aligned
than their small element types.

Though VSX vectors work best with 32- or 64-bit alignment, unaligned
vector loads and stores are expected by the tests.  However, with
-mstrict-align by default, vector loads and stores not known to be
aligned end up open coded, which doesn't match the asm output
expectations coded in the tests.

for  gcc/ChangeLog

* doc/sourcebuild.texi (opt_mstrict_align): New target.

for  gcc/testsuite/ChangeLog

* lib/target-supports.exp
(check_effective_target_opt_mstrict_align): New.
* gcc.dg/strlenopt-80.c: Add -mno-strict-align if supported.
* gcc.target/powerpc/prefix-ds-dq.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-1.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-2.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-3.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-4.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-5.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-6.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-7.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-8.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-1.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-2.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-3.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-4.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-5.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-6.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-7.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-8.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-1.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-2.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-3.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-4.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-5.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-6.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-7.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-8.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-1.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-2.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-3.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-4.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-5.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-6.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-7.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-8.c: Likewise.

6 months agoRISC-V: Use stdint-gcc.h in xtheadmemidx-helpers.h
Christoph Müllner [Tue, 7 Nov 2023 09:43:08 +0000 (10:43 +0100)] 
RISC-V: Use stdint-gcc.h in xtheadmemidx-helpers.h

stdint.h can be replaced with stdint-gcc.h to resolve some missing
system headers in non-multilib installations.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
gcc/testsuite/ChangeLog:

* gcc.target/riscv/xtheadmemidx-helpers.h:
Replace stdint.h with stdint-gcc.h.

6 months agoRISC-V: Add ABI requirement for XTheadFMemIdx tests
Christoph Müllner [Mon, 6 Nov 2023 07:56:17 +0000 (08:56 +0100)] 
RISC-V: Add ABI requirement for XTheadFMemIdx tests

The XTheadFMemIdx tests set the required ABI for RV32, but not
for RV64, which has the effect that the tests are expected to
succeed for RV64/LP64.  Let's set the ABI to LP64D in these
tests to clarify the requirements.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
gcc/testsuite/ChangeLog:

* gcc.target/riscv/xtheadfmemidx-index-update.c: Add ABI.
* gcc.target/riscv/xtheadfmemidx-index-xtheadbb-update.c: Likewise.
* gcc.target/riscv/xtheadfmemidx-index-xtheadbb.c: Likewise.
* gcc.target/riscv/xtheadfmemidx-index.c: Likewise.
* gcc.target/riscv/xtheadfmemidx-uindex-update.c: Likewise.
* gcc.target/riscv/xtheadfmemidx-uindex-xtheadbb-update.c: Likewise.
* gcc.target/riscv/xtheadfmemidx-uindex-xtheadbb.c: Likewise.
* gcc.target/riscv/xtheadfmemidx-uindex.c: Likewise.

6 months agoada: Fix debug info for aliased packed array with unconstrained nominal subtype
Eric Botcazou [Tue, 17 Oct 2023 17:20:26 +0000 (19:20 +0200)] 
ada: Fix debug info for aliased packed array with unconstrained nominal subtype

The front-end now rewrites it as a renaming when it is initialized with a
function call and the same processing must be applied in the renaming case
as in the regular case for this kind of special objects.

gcc/ada/

* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Apply the
specific rewriting done for an aliased object with an unconstrained
array nominal subtype in the renaming case too.

6 months agoada: Fix spurious -Wstringop-overflow with link time optimization
Eric Botcazou [Thu, 12 Oct 2023 12:26:46 +0000 (14:26 +0200)] 
ada: Fix spurious -Wstringop-overflow with link time optimization

It comes from an incomplete optimization performed by LTO that is caused by
an obsolete transformation done in Gigi, which is redundant with the common
uniquization of constant CONSTRUCTORs now performed during gimplification.

gcc/ada/

* gcc-interface/trans.cc (gnat_gimplify_expr) <CALL_EXPR>: Delete.

6 months agoada: Compiler crash on early alignment clause
Bob Duff [Wed, 18 Oct 2023 13:54:06 +0000 (09:54 -0400)] 
ada: Compiler crash on early alignment clause

This patch fixes a bug: if "for T'Alignment use..." is followed
by "for T use (<enum rep>);" the compiler crashes. A workaround is
to move the alignment clause after the enumeration rep clause.

gcc/ada/

* sem_ch13.ads (Set_Enum_Esize): Do not set alignment.
* sem_ch13.adb (Set_Enum_Esize): Do not set alignment. Archaeology
seems to show that this line of code dates from when "Alignment =
0" meant "the Alignment is not known at compile time" and "the
Alignment is not yet known at compile time" as well as "the
Alignment is zero". In any case, it seems to be unnecessary, and
in this case harmful, because gigi would crash. Alignment_Clause
is set (because there is one), so gigi would query the Alignment,
but Alignment was destroyed.