]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
9 months agoarm: [MVE intrinsics] Add support for predicated contiguous loads and stores
Alfie Richards [Wed, 11 Sep 2024 12:56:28 +0000 (14:56 +0200)] 
arm: [MVE intrinsics] Add support for predicated contiguous loads and stores

This patch extends
function_expander::use_contiguous_load_insn and
function_expander::use_contiguous_store_insn functions to
support predicated versions.

2024-09-11  Alfie Richards  <Alfie.Richards@arm.com>
    Christophe Lyon  <christophe.lyon@arm.com>

gcc/

* config/arm/arm-mve-builtins.cc
(function_expander::use_contiguous_load_insn): Add support for
PRED_z.
(function_expander::use_contiguous_store_insn): Add support for
PRED_p.

9 months agoarm: [MVE intrinsics] Add load_extending and store_truncating function bases
Alfie Richards [Wed, 11 Sep 2024 12:55:24 +0000 (14:55 +0200)] 
arm: [MVE intrinsics] Add load_extending and store_truncating function bases

This patch adds the load_extending and store_truncating function bases
for MVE intrinsics.

The constructors have parameters describing the memory element
type/width which is part of the function base name (e.g. "h" in
vldrhq).

2024-09-11  Alfie Richards <Alfie.Richards@arm.com>

gcc/

* config/arm/arm-mve-builtins-functions.h
(load_extending): New class.
(store_truncating): New class.
* config/arm/arm-protos.h (arm_mve_data_mode): New helper function.
* config/arm/arm.cc (arm_mve_data_mode): New helper function.

9 months agoarm: [MVE intrinsics] Add load_ext intrinsic shape
Alfie Richards [Wed, 11 Sep 2024 10:32:06 +0000 (12:32 +0200)] 
arm: [MVE intrinsics] Add load_ext intrinsic shape

This patch adds the extending load shape.
It also adds/fixes comments for the load and store shapes.

2024-09-11  Alfie Richards <Alfie.Richards@arm.com>
    Christophe Lyon  <christophe.lyon@arm.com>

gcc/
* config/arm/arm-mve-builtins-shapes.cc:
(load_ext): New.
* config/arm/arm-mve-builtins-shapes.h:
(load_ext): New.

9 months agoarm: [MVE intrinsics] fix vst tests
Alfie Richards [Wed, 11 Sep 2024 16:02:01 +0000 (18:02 +0200)] 
arm: [MVE intrinsics] fix vst tests

The tests for vst* instrinsics use functions which return a void
expression which can generate a warning. This hasn't come up previously
as the inlining presumably prevents the warning.

This change removed the uneccessary and incorrect returns.

2024-09-11  Alfie Richards <Alfie.Richards@arm.com>

gcc/testsuite/
* gcc.target/arm/mve/intrinsics/vst1q_p_f16.c: Remove `return`.
* gcc.target/arm/mve/intrinsics/vst1q_p_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst1q_p_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst1q_p_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst1q_p_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst1q_p_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst1q_p_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst1q_p_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst2q_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst2q_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst2q_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst2q_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst2q_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst2q_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst2q_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst2q_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst4q_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst4q_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst4q_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst4q_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst4q_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst4q_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst4q_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vst4q_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_p_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_p_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_p_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_p_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_p_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_p_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_scatter_offset_p_s16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_scatter_offset_p_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_scatter_offset_p_s8.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_scatter_offset_p_u16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_scatter_offset_p_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_scatter_offset_p_u8.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_scatter_offset_s16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_scatter_offset_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_scatter_offset_s8.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_scatter_offset_u16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_scatter_offset_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_scatter_offset_u8.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrbq_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_p_s64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_p_u64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_s64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_u64.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_s64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_u64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_s64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_u64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_offset_p_s64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_offset_p_u64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_offset_s64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_offset_u64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_shifted_offset_p_s64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_shifted_offset_p_u64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_shifted_offset_s64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrdq_scatter_shifted_offset_u64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_p_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_p_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_p_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_p_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_p_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_offset_f16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_offset_p_f16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_offset_p_s16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_offset_p_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_offset_p_u16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_offset_p_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_offset_s16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_offset_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_offset_u16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_offset_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_shifted_offset_f16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_shifted_offset_p_f16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_shifted_offset_p_s16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_shifted_offset_p_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_shifted_offset_p_u16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_shifted_offset_p_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_shifted_offset_s16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_shifted_offset_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_shifted_offset_u16.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_scatter_shifted_offset_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrhq_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_p_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_p_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_p_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_f32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_p_f32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_p_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_p_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_f32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_f32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_offset_f32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_offset_p_f32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_offset_p_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_offset_p_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_offset_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_offset_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_shifted_offset_f32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_shifted_offset_p_f32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_shifted_offset_p_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_shifted_offset_p_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_shifted_offset_s32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_scatter_shifted_offset_u32.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vstrwq_u32.c: Likewise.

9 months agoc: Add __builtin_stdc_rotate_{left,right} builtins [PR117030]
Jakub Jelinek [Tue, 29 Oct 2024 08:06:25 +0000 (09:06 +0100)] 
c: Add __builtin_stdc_rotate_{left,right} builtins [PR117030]

I believe the new C2Y <stdbit.h> type-generic functions
stdc_rotate_{left,right} have the same problems the other stdc_*
type-generic functions had.  If we want to support arbitrary
unsigned _BitInt(N), don't want to use statement expressions
(so that one can actually use them in static variable initializers),
don't want to evaluate the arguments multiple times and don't want
to expand the arguments multiple times during preprocessing to avoid the
old tgmath preprocessing bloat, we need a built-in for those.

The following patch adds those.  And as we need to support rotations by 0
and tree-ssa-forwprop.cc is only able to pattern recognize with BIT_AND_EXPR
for that case (i.e. for power of two widths), the patch just constructs
LROTATE_EXPR/RROTATE_EXPR right away.  Negative second arguments are
considered UB, while positive ones are modulo precision.

2024-10-29  Jakub Jelinek  <jakub@redhat.com>

PR c/117030
gcc/
* doc/extend.texi (__builtin_stdc_rotate_left,
__builtin_stdc_rotate_right): Document.
gcc/c-family/
* c-common.cc (c_common_reswords): Add __builtin_stdc_rotate_left
and __builtin_stdc_rotate_right.
* c-ubsan.cc (ubsan_instrument_shift): For {L,R}ROTATE_EXPR
just check if op1 is negative.
gcc/c/
* c-parser.cc: Include asan.h and c-family/c-ubsan.h.
(c_parser_postfix_expression): Handle __builtin_stdc_rotate_left
and __builtin_stdc_rotate_right.
* c-fold.cc (c_fully_fold_internal): Handle LROTATE_EXPR and
RROTATE_EXPR.
gcc/testsuite/
* gcc.dg/builtin-stdc-rotate-1.c: New test.
* gcc.dg/builtin-stdc-rotate-2.c: New test.
* gcc.dg/ubsan/builtin-stdc-rotate-1.c: New test.
* gcc.dg/ubsan/builtin-stdc-rotate-2.c: New test.

9 months agoDaily bump.
GCC Administrator [Tue, 29 Oct 2024 00:18:25 +0000 (00:18 +0000)] 
Daily bump.

9 months agotestsuite: drop the "test-" prefix from sarif-output python scripts
David Malcolm [Mon, 28 Oct 2024 22:43:11 +0000 (18:43 -0400)] 
testsuite: drop the "test-" prefix from sarif-output python scripts

Drop the "text-" prefix from the various gcc.dg/sarif-output/test-*.py
scripts so that the scripts are close to the .c files they are used by
when the files are sorted by name.

gcc/testsuite/ChangeLog:
* gcc.dg/sarif-output/test-bad-pragma.py: Rename to...
* gcc.dg/sarif-output/bad-pragma.py: ...this.
* gcc.dg/sarif-output/bad-pragma.c: Update for script renaming.
* gcc.dg/sarif-output/test-include-chain-1.py: Rename to...
* gcc.dg/sarif-output/include-chain-1.py: ...this.
* gcc.dg/sarif-output/include-chain-1.c: Update for script renaming.
* gcc.dg/sarif-output/test-include-chain-2.py: Rename to...
* gcc.dg/sarif-output/include-chain-2.py: ...this.
* gcc.dg/sarif-output/include-chain-2.c: Update for script renaming.
* gcc.dg/sarif-output/test-missing-semicolon.py: Rename to...
* gcc.dg/sarif-output/missing-semicolon.py: ...this.
* gcc.dg/sarif-output/missing-semicolon.c: Update for script renaming.
* gcc.dg/sarif-output/test-no-diagnostics.py: Rename to...
* gcc.dg/sarif-output/no-diagnostics.py: ...this.
* gcc.dg/sarif-output/no-diagnostics.c: Update for script renaming.
* gcc.dg/sarif-output/test-werror.py: Rename to...
* gcc.dg/sarif-output/werror.py: ...this.
* gcc.dg/sarif-output/werror.c: Update for script renaming.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
9 months agotestcase: Add testcase for PR 117330 [PR117330]
Andrew Pinski [Mon, 28 Oct 2024 20:29:58 +0000 (13:29 -0700)] 
testcase: Add testcase for PR 117330 [PR117330]

This testcase was causing an ICE during vectorization
due to r15-4695-gd17e672ce82e69 but was fixed with
r15-4713-g0942bb85fc5573.

Pushed as obvious after a quick test on x86_64-linux-gnu to
make sure the testcase passes.

PR tree-optimization/117330

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr117330-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
9 months agotestsuite: Require atomic operations for pr47333_0
Dimitar Dimitrov [Sun, 27 Oct 2024 07:49:49 +0000 (09:49 +0200)] 
testsuite: Require atomic operations for pr47333_0

Since the test uses __sync_fetch_and_add, add a requirement for
target to support atomic operations on int and long types.

This fixes a spurious test failure on pru-unknown-elf, which lacks
atomic ops. The test still passes on x86_64-linux-gnu.

gcc/testsuite/ChangeLog:

* g++.dg/lto/pr47333_0.C: Require target that supports atomic
operations on int and long types.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
9 months agogcc: fix 'statements' comment typo
Sam James [Mon, 28 Oct 2024 18:24:14 +0000 (18:24 +0000)] 
gcc: fix 'statements' comment typo

gcc/ChangeLog:

* opts-common.cc (prune_options): Fix typo.

9 months agotestsuite: add testcase for fixed PR107467
Sam James [Mon, 21 Oct 2024 11:11:42 +0000 (12:11 +0100)] 
testsuite: add testcase for fixed PR107467

PR107467 ended up being fixed by the fix for PR115110, but let's
add the testcase on top.

gcc/testsuite/ChangeLog:
PR tree-optimization/107467
PR middle-end/115110

* g++.dg/lto/pr107467_0.C: New test.

9 months agoFix bitwise_or logic for prange.
Andrew MacLeod [Mon, 28 Oct 2024 13:47:03 +0000 (09:47 -0400)] 
Fix bitwise_or logic for prange.

Set non-zero only if at least one of the two operands does not contain zero.

* range-op-ptr.cc (operator_bitwise_or::fold_range): Fix logic
for setting nonzero.

9 months agoaarch64: Use implementation namespace for vxarq_u64 immediate argument
Kyrylo Tkachov [Mon, 28 Oct 2024 14:19:07 +0000 (15:19 +0100)] 
aarch64: Use implementation namespace for vxarq_u64 immediate argument

Looks like this immediate variable was missed out when I last fixed the
namespace issues in arm_neon.h.  Fixed in the obvious manner.

Bootstrapped and tested on aarch64-none-linux-gnu.

Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>
* config/aarch64/arm_neon.h (vxarq_u64): Rename imm6 to __imm6.

9 months agolibstdc++: Fix tests for std::vector range operations
Jonathan Wakely [Mon, 28 Oct 2024 13:05:53 +0000 (13:05 +0000)] 
libstdc++: Fix tests for std::vector range operations

The commit I pushed was not the one I'd tested, so it had older versions
of the tests, with bugs that I'd already fixed locally. This commit has
the fixed tests that I'd intended to push in the first place.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/vector/bool/cons/from_range.cc: Use
dg-do run instead of compile.
(test_ranges): Use do_test instead of do_test_a for rvalue
range.
(test_constexpr): Call function template instead of just
instantiating it.
* testsuite/23_containers/vector/bool/modifiers/assign/assign_range.cc:
Use dg-do run instead of compile.
(do_test): Use same test logic for vector<bool> as for primary
template.
(test_constexpr): Call function template instead of just
instantiating it.
* testsuite/23_containers/vector/bool/modifiers/insert/append_range.cc:
Use dg-do run instead of compile.
(test_ranges): Use do_test instead of do_test_a for rvalue
range.
(test_constexpr): Call function template instead of just
instantiating it.
* testsuite/23_containers/vector/bool/modifiers/insert/insert_range.cc:
Use dg-do run instead of compile.
(do_test): Fix incorrect function arguments to match intended
results.
(test_ranges): Use do_test instead of do_test_a for rvalue
range.
(test_constexpr): Call function template instead of just
instantiating it.
* testsuite/23_containers/vector/cons/from_range.cc: Use dg-do
run instead of compile.
(test_ranges): Fix ill-formed call to do_test.
(test_constexpr): Call function template instead of just
instantiating it.
* testsuite/23_containers/vector/modifiers/append_range.cc:
Use dg-do run instead of compile.
(test_constexpr): Likewise.
* testsuite/23_containers/vector/modifiers/assign/assign_range.cc:
Use dg-do run instead of compile.
(do_test): Do not reuse input ranges.
(test_constexpr): Call function template instead of just
instantiating it.
* testsuite/23_containers/vector/modifiers/insert/insert_range.cc:
Use dg-do run instead of compile.
(do_test): Fix incorrect function arguments to match intended
results.
(test_constexpr): Call function template instead of just
instantiating it.

9 months agobuild: update bootstrap req to C++14
Jason Merrill [Tue, 17 Sep 2024 21:38:35 +0000 (17:38 -0400)] 
build: update bootstrap req to C++14

We moved to a bootstrap requirement of C++11 in GCC 11, 8 years after
support was stable in GCC 4.8.

It is now 8 years since C++14 was the default mode in GCC 6 (and 9 years
since support was complete in GCC 5), and we have a few bits of optional
C++14 code in the compiler, so it seems a good time to update the bootstrap
requirement again.

The big benefit of the change is the greater constexpr power, but C++14 also
added variable templates, generic lambdas, lambda init-capture, binary
literals, and numeric literal digit separators.

C++14 was feature-complete in GCC 5, and became the default in GCC 6.  5.4.0
bootstraps trunk correctly; trunk stage1 built with 5.3.0 breaks in
eh_data_format_name due to PR69995.

gcc/ChangeLog:

* doc/install.texi (Prerequisites): Update to C++14.

ChangeLog:

* configure.ac: Update requirement to C++14.
* configure: Regenerate.

9 months ago[target/117316] Fix initializer for riscv code alignment handling
Jeff Law [Mon, 28 Oct 2024 11:39:24 +0000 (05:39 -0600)] 
[target/117316] Fix initializer for riscv code alignment handling

The construct used for initializing the code alignments in a recent change is
causing bootstrap problems on riscv64 as seen in the referenced bugzilla.

This patch adjusts the initializer by pushing the NULL down into each uarch
clause.  Bootstrapped on riscv64, regression test in flight, but given
bootstrap is broken it seemed advisable to move this forward now.

I'm so much looking forward to the day when we have performant hardware for
bootstrap testing...  Sigh.

Anyway, bootstrapped and installing on the trunk.

PR target/117316
gcc/
* config/riscv/riscv.cc (riscv_tune_param): Drop initializer.
(*_tune_info): Add initializers for code alignments.

9 months agotree-optimization/117307 - STMT_VINFO_SLP_VECT_ONLY mis-computation
Richard Biener [Mon, 28 Oct 2024 08:52:08 +0000 (09:52 +0100)] 
tree-optimization/117307 - STMT_VINFO_SLP_VECT_ONLY mis-computation

STMT_VINFO_SLP_VECT_ONLY isn't properly computed as union of all
group members and when the group is later split due to duplicates
not all sub-groups inherit the flag.

PR tree-optimization/117307
* tree-vect-data-refs.cc (vect_analyze_data_ref_accesses):
Properly compute STMT_VINFO_SLP_VECT_ONLY.  Set it on all
parts of a split group.

* gcc.dg/vect/pr117307.c: New testcase.

9 months agotree-core.h (omp_clause_code): Comments regarding range checks for OMP_CLAUSE_...
Tobias Burnus [Mon, 28 Oct 2024 09:00:08 +0000 (10:00 +0100)] 
tree-core.h (omp_clause_code): Comments regarding range checks for OMP_CLAUSE_...

gcc/ChangeLog:

* tree-core.h (enum omp_clause_code): Add comments to cross ref to
OMP_CLAUSE_DECL etc. and mark the ranges used in the range checks.

9 months agovec-lowering: Fix ABSU lowering [PR111285]
Andrew Pinski [Sun, 27 Oct 2024 20:16:22 +0000 (13:16 -0700)] 
vec-lowering: Fix ABSU lowering [PR111285]

ABSU_EXPR lowering incorrectly used the resulting type
for the new expression but in the case of ABSU the resulting
type is an unsigned type and with ABSU is folded away. The fix
is to use a signed type for the expression instead.

Bootstrapped and tested on x86_64-linux-gnu.

PR middle-end/111285

gcc/ChangeLog:

* tree-vect-generic.cc (do_unop): Use a signed type for the
operand if the operation was ABSU_EXPR.

gcc/testsuite/ChangeLog:

* g++.dg/torture/vect-absu-1.C: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
9 months agophiopt: Move check for maybe_undef_p slightly earlier
Andrew Pinski [Sun, 27 Oct 2024 03:37:36 +0000 (20:37 -0700)] 
phiopt: Move check for maybe_undef_p slightly earlier

This moves the check for maybe_undef_p in match_simplify_replacement
slightly earlier before figuring out the true/false arg using arg0/arg1
instead.
In most cases this is no difference in compile time; just in the case
there is an undef in the args there would be a slight compile time
improvement as there is no reason to figure out which arg corresponds
to the true/false side of the conditional.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-phiopt.cc (match_simplify_replacement): Move
check for maybe_undef_p earlier.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
9 months agoRemove code in vectorizer pattern recog relying on vec_cond{u,eq,}
Richard Biener [Sat, 26 Oct 2024 12:18:37 +0000 (14:18 +0200)] 
Remove code in vectorizer pattern recog relying on vec_cond{u,eq,}

With the intent to rely on vec_cond_mask and vec_cmp patterns
comparisons do not need rewriting into COND_EXPRs that eventually
combine to vec_cond{u,eq,}.

* tree-vect-patterns.cc (check_bool_pattern): For comparisons
we do nothing if we can expand them or we can't replace them
with a ? -1 : 0 condition - but the latter would require
expanding the comparison which we proved we can't.  So do
nothing, aka not think vec_cond{u,eq,} will save us.

9 months agoRISC-V:Bugfix for vlmul_ext and vlmul_trunc with NULL return value[pr117286]
xuli [Mon, 28 Oct 2024 04:41:09 +0000 (04:41 +0000)] 
RISC-V:Bugfix for vlmul_ext and vlmul_trunc with NULL return value[pr117286]

This patch fixes following ICE:

test.c: In function 'func':
test.c:37:24: internal compiler error: Segmentation fault
   37 |     vfloat16mf2_t vc = __riscv_vlmul_trunc_v_f16m1_f16mf2(vb);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The root cause is that vlmul_trunc has a null return value.
gimple_call <__riscv_vlmul_trunc_v_f16m1_f16mf2, NULL, vb_13>
                                                 ^^^

Passed the rv64gcv_zvfh regression test.

Singed-off-by: Li Xu <xuli1@eswincomputing.com>
PR target/117286

gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc: Do not expand NULL return.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/pr117286.c: New test.

9 months agogcc.target/i386/pr53533-[13].c: Adjust assembly scan
H.J. Lu [Fri, 11 Oct 2024 21:53:49 +0000 (05:53 +0800)] 
gcc.target/i386/pr53533-[13].c: Adjust assembly scan

Before

1089d083117 Simplify (B * v + C) * D -> BD* v + CD when B,C,D are all INTEGER_CST.

the loop was

.L2:
movl (%rdi,%rdx), %eax
addl $12345, %eax
imull $-1564285888, %eax, %eax
leal -333519936(%rax), %eax
movl %eax, (%rsi,%rdx)
addq $4, %rdx
cmpq $1024, %rdx
jne .L2

There were 1 addl and 1 leal. 1 addq was to update the loop counter.  The
optimized loop is

.L2:
imull $-1564285888, (%rdi,%rax), %edx
subl $1269844480, %edx
movl %edx, (%rsi,%rax)
addq $4, %rax
cmpq $1024, %rax
jne .L2

1 addl is changed to subl and leal is removed. Adjust assembly scan to
check for 1 subl and 1 addl/addq as well as lea removal.

* gcc.target/i386/pr53533-1.c: Adjust assembly scan.
* gcc.target/i386/pr53533-3.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
9 months agoDaily bump.
GCC Administrator [Mon, 28 Oct 2024 00:17:33 +0000 (00:17 +0000)] 
Daily bump.

9 months agolibstdc++: Add P1206R7 from_range members to std::vector [PR111055]
Jonathan Wakely [Tue, 8 Oct 2024 20:15:18 +0000 (21:15 +0100)] 
libstdc++: Add P1206R7 from_range members to std::vector [PR111055]

This is another piece of P1206R7, adding new members to std::vector and
std::vector<bool>.

The __uninitialized_copy_a extension needs to be enhanced to support
passing non-common ranges (i.e. a sentinel that is a different type from
the iterator) and move-only input iterators.

libstdc++-v3/ChangeLog:

PR libstdc++/111055
* include/bits/ranges_base.h (__container_compatible_range): New
concept.
* include/bits/stl_bvector.h (vector(from_range, R&&, const Alloc&))
(assign_range, insert_range, append_range): Define.
* include/bits/stl_uninitialized.h (__do_uninit_copy): Support
non-common ranges.
(__uninitialized_copy_a): Likewise.
* include/bits/stl_vector.h (_Vector_base::_M_append_range_to):
New function.
(_Vector_base::_M_append_range): Likewise.
(vector(from_range, R&&, const Alloc&), assign_range): Define.
(append_range): Define.
(insert_range): Declare.
* include/debug/vector (vector(from_range, R&&, const Alloc&))
(assign_range, insert_range, append_range): Define.
* include/bits/vector.tcc (insert_range): Define.
* testsuite/util/testsuite_iterators.h (input_iterator_wrapper_rval):
New class template.
* testsuite/23_containers/vector/bool/cons/from_range.cc: New test.
* testsuite/23_containers/vector/bool/modifiers/assign/assign_range.cc:
New test.
* testsuite/23_containers/vector/bool/modifiers/insert/append_range.cc:
New test.
* testsuite/23_containers/vector/bool/modifiers/insert/insert_range.cc:
New test.
* testsuite/23_containers/vector/cons/from_range.cc: New test.
* testsuite/23_containers/vector/modifiers/append_range.cc: New test.
* testsuite/23_containers/vector/modifiers/assign/assign_range.cc:
New test.
* testsuite/23_containers/vector/modifiers/insert/insert_range.cc:
New test.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
9 months agolibstdc++: Fix std::vector<bool>::emplace to forward parameter
Jonathan Wakely [Sat, 26 Oct 2024 20:24:58 +0000 (21:24 +0100)] 
libstdc++: Fix std::vector<bool>::emplace to forward parameter

If the parameter is not lvalue-convertible to bool then the current code
will fail to compile. The parameter should be forwarded to restore the
original value category.

libstdc++-v3/ChangeLog:

* include/bits/stl_bvector.h (emplace_back, emplace): Forward
parameter pack to preserve value category.
* testsuite/23_containers/vector/bool/emplace_rvalue.cc: New
test.

9 months agoarm: Support -mfdpic for more targets
Fangrui Song [Sun, 27 Oct 2024 19:37:21 +0000 (12:37 -0700)] 
arm: Support -mfdpic for more targets

Targets that are not arm*-*-uclinuxfdpiceabi can use -S -mfdpic, but -c
-mfdpic does not pass --fdpic to gas.  This is an unnecessary
restriction.  Just define the ASM_SPEC in bpabi.h.

Additionally, use armelf[b]_linux_fdpiceabi emulations for -mfdpic in
linux-eabi.h.  This will allow a future musl fdpic port to use the
desired BFD emulation.

gcc/ChangeLog:

* config/arm/bpabi.h (TARGET_FDPIC_ASM_SPEC): Transform -mfdpic.
* config/arm/linux-eabi.h (TARGET_FDPIC_LINKER_EMULATION): Define.
(SUBTARGET_EXTRA_LINK_SPEC): Use TARGET_FDPIC_LINKER_EMULATION
if -mfdpic.

9 months agoxtensa: Define TARGET_DIFFERENT_ADDR_DISPLACEMENT_P target hook
Takayuki 'January June' Suwa [Wed, 23 Oct 2024 02:31:15 +0000 (11:31 +0900)] 
xtensa: Define TARGET_DIFFERENT_ADDR_DISPLACEMENT_P target hook

In commit bc5a9dab55d13f888a3cdd150c8cf5c2244f35e0 ("gcc: xtensa: reorder
movsi_internal patterns for better code generation during LRA"),  the
instruction order in "movsi_internal" MD definition was changed to make LRA
use load/store instructions with larger memory address displacements, but as
a side effect, it now uses the larger displacements (ie., the larger
instructions) even outside of reload operations.

The underlying problem is that LRA assumes by default that there is only one
maximal legitimate displacement for the same address structure, meaning that
it has no choice but to use the first load/store instruction it finds.

To fix this, define TARGET_DIFFERENT_ADDR_DISPLACEMENT_P hook to always
return true.

gcc/ChangeLog:

* config/xtensa/xtensa.cc (TARGET_DIFFERENT_ADDR_DISPLACEMENT_P):
Add new target hook to always return true.
* config/xtensa/xtensa.md (movsi_internal):
Revert the previous changes.

9 months agogenmatch: Add selftests to genmatch for diag_vfprintf
Jakub Jelinek [Sun, 27 Oct 2024 15:44:35 +0000 (16:44 +0100)] 
genmatch: Add selftests to genmatch for diag_vfprintf

The following patch adds selftests to genmatch to verify the new printing
routine there.
So that I can rely on HAVE_DECL_FMEMOPEN (host test), the tests are done
solely in stage2+ where we link the host libcpp etc. to genmatch.
The tests have been adjusted from pretty-print.cc (test_pp_format),
and I've added to that function two new tests because I've noticed nothing
was testing the %M$.*N$s etc. format specifiers.

2024-10-27  Jakub Jelinek  <jakub@redhat.com>

* configure.ac (gcc_AC_CHECK_DECLS): Add fmemopen.
* configure: Regenerate.
* config.in: Regenerate.
* Makefile.in (build/genmatch.o): Add -DGENMATCH_SELFTESTS to
BUILD_CPPFLAGS for stage2+ genmatch.
* genmatch.cc (test_diag_vfprintf, genmatch_diag_selftests): New
functions.
(main): Call genmatch_diag_selftests.
* pretty-print.cc (test_pp_format): Add two tests, one for %M$.*N$s
and one for %M$.Ns.

9 months agoc-family: -Wleading-whitespace= argument spelling
Jakub Jelinek [Sun, 27 Oct 2024 15:42:53 +0000 (16:42 +0100)] 
c-family: -Wleading-whitespace= argument spelling

On Thu, Oct 24, 2024 at 03:33:25PM -0400, Eric Gallager wrote:
> On Thu, Oct 24, 2024 at 4:17 AM Jakub Jelinek <jakub@redhat.com> wrote:
> > I've tried to build stage3 with
> > -Wleading-whitespace=blanks -Wtrailing-whitespace=blank -Wno-error=leading-whitespace=blanks -Wno-error=trailing-whitespace=blank
>
> So wait, it's "blanks" (plural) when it's leading, but "blank"
> (singular) when it's trailing? That inconsistency bothers me...

I've mentioned it already in
https://gcc.gnu.org/pipermail/gcc-patches/2024-October/664664.html
Citing that here:
    Not sure about the kinds for the option, given -Wleading-whitespace=
    uses plural and this option singular and -Wleading-whitespace= spaces
    means literally just ' ' characters, while space in
    -Wtrailing-whitespace= was ' ', '\t', '\v' and '\f'; so category;
    perhaps just use any and blanks?
Other preferences?

Here is a patch to do the blank->blanks and space->any changes.

2024-10-27  Jakub Jelinek  <jakub@redhat.com>

gcc/
* doc/invoke.texi (Wtrailing-whitespace=): Change
blank argument to blanks and space argument to any.
gcc/c-family/
* c.opt (warn_trailing_whitespace_kind): Change blank
to blanks and space to any.
gcc/testsuite/
* c-c++-common/cpp/Wtrailing-whitespace-2.c: Use
-Wtrailing-whitespace=blanks rather than -Wtrailing-whitespace=blank.
* c-c++-common/cpp/Wtrailing-whitespace-3.c: Use
-Wtrailing-whitespace=any rather than -Wtrailing-whitespace=space.
* c-c++-common/cpp/Wtrailing-whitespace-7.c: Use
-Wtrailing-whitespace=blanks rather than -Wtrailing-whitespace=blank.
* c-c++-common/cpp/Wtrailing-whitespace-8.c: Use
-Wtrailing-whitespace=any rather than -Wtrailing-whitespace=space.

9 months agotestsuite: Fix up gcc.dg/vec-perm-lower.c test
Jakub Jelinek [Sun, 27 Oct 2024 15:41:28 +0000 (16:41 +0100)] 
testsuite: Fix up gcc.dg/vec-perm-lower.c test

On Tue, Oct 15, 2024 at 12:45:35PM +0000, Tamar Christina wrote:
> I'll write a gimple one and commit with this then.

The new test FAILs on i686-linux, with the usual

FAIL: gcc.dg/vec-perm-lower.c (test for excess errors)
Excess errors:
.../gcc/testsuite/gcc.dg/vec-perm-lower.c:9:1: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi]
.../gcc/testsuite/gcc.dg/vec-perm-lower.c:8:1: warning: MMX vector argument without MMX enabled changes the ABI [-Wpsabi]

The following patch fixes that.
Tested on x86_64-linux with
make check-gcc RUNTESTFLAGS='--target_board=unix/\{-m32,-m32/-mno-sse/-mno-mmx,-m64\} dg.exp=vec-perm-lower.c'
which previously FAILed, now PASSes, ok for trunk?

2024-10-27  Jakub Jelinek  <jakub@redhat.com>

* gcc.dg/vec-perm-lower.c: Add -Wno-psabi to dg-options.

9 months agoFortran: Fix regressions with intent(out) class[PR115070, PR115348].
Paul Thomas [Sun, 27 Oct 2024 12:40:42 +0000 (12:40 +0000)] 
Fortran: Fix regressions with intent(out) class[PR115070, PR115348].

2024-10-27  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/115070
PR fortran/115348
* trans-expr.cc (gfc_trans_class_init_assign): If all the
components of the default initializer are null for a scalar,
build an empty statement to prevent prior declarations from
disappearing.

gcc/testsuite/
PR fortran/115070
* gfortran.dg/pr115070.f90: New test.

PR fortran/115348
* gfortran.dg/pr115348.f90: New test.

9 months agotestsuite: Sanitize pacbti test cases for Cortex-M
Torbjörn SVENSSON [Tue, 3 Sep 2024 09:23:57 +0000 (11:23 +0200)] 
testsuite: Sanitize pacbti test cases for Cortex-M

Some of the test cases were scanning for "bti", but it would,
incorrectly, match the ".arch_extenssion pacbti".

gcc/testsuite/ChangeLog:

* gcc.target/arm/bti-1.c: Check for asm instructions starting
with a tab.
* gcc.target/arm/bti-2.c: Likewise.
* gcc.target/arm/pac-1.c: Likewise.
* gcc.target/arm/pac-2.c: Likewise.
* gcc.target/arm/pac-3.c: Likewise.
* gcc.target/arm/pac-4.c: Likewise.
* gcc.target/arm/pac-6.c: Likewise.
* gcc.target/arm/pac-7.c: Likewise.
* gcc.target/arm/pac-8.c: Likewise.
* gcc.target/arm/pac-9.c: Likewise.
* gcc.target/arm/pac-10.c: Likewise.
* gcc.target/arm/pac-11.c: Likewise.
* gcc.target/arm/pac-15.c: Likewise.
* gcc.target/arm/pac-sibcall.c: Likewise.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Co-authored-by: Yvan ROUX <yvan.roux@foss.st.com>
9 months agoDaily bump.
GCC Administrator [Sun, 27 Oct 2024 00:17:28 +0000 (00:17 +0000)] 
Daily bump.

9 months agodoc, fortran: Add a missing menu item.
Iain Sandoe [Sat, 26 Oct 2024 22:06:09 +0000 (23:06 +0100)] 
doc, fortran: Add a missing menu item.

The changes in r15-4697-g4727bfb37701 omit a menu entry which causes a
bootstrap fail when Frotran is included for at least makeinfo 6.7.
Fixed thus.

gcc/fortran/ChangeLog:

* intrinsic.texi: Add menu item for UINT.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
9 months agotree: Mark PAREN_EXPR and VEC_DUPLICATE_EXPR as non-trapping [PR117234]
Andrew Pinski [Sat, 26 Oct 2024 09:14:18 +0000 (02:14 -0700)] 
tree: Mark PAREN_EXPR and VEC_DUPLICATE_EXPR as non-trapping [PR117234]

While looking to fix a possible trapping issue in PHI-OPT's factor,
I noticed that some tree codes could be marked as trapping even
though they don't have a possibility to trap. In the case of PAREN_EXPR,
it is basically a nop except when it comes to association across it so
it can't trap.
In the case of VEC_DUPLICATE_EXPR, it is similar to a CONSTRUCTOR, so it
can't trap.

This fixes those 2 issues and adds 4 testcases, 2 which are specific to aarch64
since the only way to get a VEC_DUPLICATE_EXPR is to use intrinsics currently.

Build and tested for aarch64-linux-gnu.

PR tree-optimization/117234

gcc/ChangeLog:

* tree-eh.cc (operation_could_trap_helper_p): Treat
PAREN_EXPR and VEC_DUPLICATE_EXPR like constructing
expressions.

gcc/testsuite/ChangeLog:

* g++.dg/eh/noncall-fp-1.C: New test.
* g++.target/aarch64/sve/noncall-eh-fp-1.C: New test.
* gcc.dg/tree-ssa/trapping-1.c: New test.
* gcc.target/aarch64/sve/trapping-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
9 months agoAdd UNSIGNED for intrinsics.
Thomas Koenig [Sat, 26 Oct 2024 17:20:14 +0000 (19:20 +0200)] 
Add UNSIGNED for intrinsics.

gcc/fortran/ChangeLog:

* gfortran.texi: Correct reference to make clear that UNSIGNED
will not be part of F202Y.
Other clarifications.
Extend table of intrinsics, add links.
* intrinsic.texi: Add descriptions for UNSIGNED arguments.
* invoke.texi: Add anchor for -funsigned.

9 months agoFix old glitch in the GNAT Reference Manual
Eric Botcazou [Sat, 26 Oct 2024 13:16:57 +0000 (15:16 +0200)] 
Fix old glitch in the GNAT Reference Manual

gcc/ada
PR ada/62122
* doc/gnat_rm/implementation_defined_attributes.rst
(Unrestricted_Access): Remove null exclusion.
* gnat_rm.texi: Regenerate.

9 months agoAssert finished vectorizer pattern COND_EXPR transition
Richard Biener [Fri, 25 Oct 2024 12:27:37 +0000 (14:27 +0200)] 
Assert finished vectorizer pattern COND_EXPR transition

The following places a few strathegic asserts so we do not end up
with COND_EXPRs with a comparison as the first operand during
vectorization.

* tree-vect-slp.cc (vect_get_operand_map): Mark
COMPARISON_CLASS_P COND_EXPR condition path unreachable.
* tree-vect-stmts.cc (vect_is_simple_use): Likewise.
(vectorizable_condition): Assert the COND_EXPR condition isn't
COMPARISON_CLASS_P.

9 months agoFinish vectorizer pattern proper COND_EXPR transition
Richard Biener [Fri, 25 Oct 2024 12:20:23 +0000 (14:20 +0200)] 
Finish vectorizer pattern proper COND_EXPR transition

This fixes up vect_recog_ctz_ffs_pattern.

* tree-vect-patterns.cc (vect_recog_ctz_ffs_pattern): Create
a separate pattern stmt for the comparison in the generated
COND_EXPR.

9 months agoFinish vectorizer pattern proper COND_EXPR transition
Richard Biener [Fri, 25 Oct 2024 11:42:08 +0000 (13:42 +0200)] 
Finish vectorizer pattern proper COND_EXPR transition

The following tries to finish building proper GIMPLE COND_EXPRs
in vectorizer pattern recognition.

* tree-vect-patterns.cc (vect_recog_divmod_pattern): Build
separate comparion pattern for the condition of a COND_EXPR
pattern.

9 months agotestsuite: fixup tbaa test again
Sam James [Sat, 26 Oct 2024 01:03:43 +0000 (02:03 +0100)] 
testsuite: fixup tbaa test again

Test was broken until r15-4684-g2d1d6be00257c5 which made it actually
run and r15-4685-g091e45b4e97d1e which applied fixes other than the
trivial rename.

But more is needed: this gets the test working properly in terms of scanning
the dump and handling the interaction w/ LTO with not producing an executable
(did try ltrans scan but that didn't work either).

Unfortunately, the test seems to fail for me on godbolt even going back to
GCC 7.1 or thereabouts, hence XFAIL. However, if I revert r9-3870-g2a98b4bfc3d952,
I do get an ICE in fld_incomplete_type_of -- because we do far more checking
with LTO now on (in)complete types. And reverting it on releases/gcc-9 actually
makes it give 0.

In summary: fix the test fully so it really does run and we get a check
for ICEing at least, and mark the dg-final scan as XFAIL so Honza can
comment on that.

gcc/testsuite/ChangeLog:
PR testsuite/117299

* gcc.dg/lto/tbaa_0.c: Move to...
* gcc.dg/tbaa.c: ...here.

9 months agoDaily bump.
GCC Administrator [Sat, 26 Oct 2024 00:19:39 +0000 (00:19 +0000)] 
Daily bump.

9 months agolibbacktrace: recognize new Mach-O DWARF sections
Ian Lance Taylor [Fri, 25 Oct 2024 22:17:15 +0000 (15:17 -0700)] 
libbacktrace: recognize new Mach-O DWARF sections

Patch from Pavel Safonov.

These sections are used on macOS Sequoia.

Fixes https://github.com/ianlancetaylor/libbacktrace/issues/136

* macho.c (dwarf_section_names): Add __debug_addr and
__debug_line_str.

9 months agosimplify-rtx: Handle `a != 0 ? -a : 0` [PR58195]
Andrew Pinski [Sun, 20 Oct 2024 17:44:14 +0000 (10:44 -0700)] 
simplify-rtx: Handle `a != 0 ? -a : 0` [PR58195]

The gimple (and generic) levels have this optmization since r12-2041-g7d6979197274a662da7bdc5.
It seems like a good idea to add a similar one to rtl just in case it is not caught at the
gimple level.

Note the loop case in csel-neg-1.c is not handled at the gimple level (even with phiopt turned back on),
this is because of casts to avoid signed integer overflow; a patch to fix this at the gimple level will be
submitted seperately.

Changes since v1:
* v2: Use `CONST0_RTX (mode)` instead of const0_rtx. Add csel-neg-2.c for float testcase which now passes.

Build and tested for aarch64-linux-gnu.

PR rtl-optimization/58195

gcc/ChangeLog:

* simplify-rtx.cc (simplify_context::simplify_ternary_operation): Handle
`a != 0 ? -a : 0` and `a == 0 ? 0 : -a`.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/csel-neg-1.c: New test.
* gcc.target/aarch64/csel-neg-2.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
9 months agotestsuite: lto: fix pr47333 test
Sam James [Fri, 25 Oct 2024 20:12:21 +0000 (21:12 +0100)] 
testsuite: lto: fix pr47333 test

This failure was hidden until we started to run the test by fixing
the filename earlier: ignore -Wtemplate-body using a pragma like
e.g. g++.dg/lto/20101010-1_0.C does because lto.exp doesn't support
dg-additional-options.

gcc/testsuite/ChangeLog:
PR lto/47333

* g++.dg/lto/pr47333_0.C: Ignore -Wtemplate-body.

9 months agotestsuite: lto: fix pr62026 test
Sam James [Fri, 25 Oct 2024 19:55:39 +0000 (20:55 +0100)] 
testsuite: lto: fix pr62026 test

This failure was hidden until we started to run the test by fixing
the filename earlier: pass -Wno-return-type.

gcc/testsuite/ChangeLog:
PR lto/62026

* g++.dg/lto/pr62026_0.C: Pass -Wno-return-type.

9 months agotestsuite: lto: fix pr95677 test
Sam James [Fri, 25 Oct 2024 17:02:06 +0000 (18:02 +0100)] 
testsuite: lto: fix pr95677 test

These failures were hidden until we started to run the test by fixing
the filename earlier: use dg-lto directives.

gcc/testsuite/ChangeLog:
PR c++/95677

* g++.dg/lto/pr95677_0.C: Use dg-lto-*.

9 months agotestsuite: lto: fix tbaa_0 test
Sam James [Fri, 25 Oct 2024 16:59:31 +0000 (17:59 +0100)] 
testsuite: lto: fix tbaa_0 test

These failures were hidden until we started to run the test by fixing
the filename earlier: use dg-lto directives, pass -std=gnu89 for
implicit-int, and use -flto-partition=none like c-c++-common/hwasan/builtin-special-handling.c.

gcc/testsuite/ChangeLog:

* gcc.dg/lto/tbaa_0.c: Use dg-lto directives, pass -std=gnu89, and
use -flto-partition=none.

9 months agotestsuite: lto: rename tbaa-1 test
Sam James [Fri, 25 Oct 2024 15:31:32 +0000 (16:31 +0100)] 
testsuite: lto: rename tbaa-1 test

This was being ignored previously. Rename it per README.

gcc/testsuite/ChangeLog:

* gcc.dg/lto/tbaa-1.c: Move to...
* gcc.dg/lto/tbaa_0.c: ...here.

9 months agotestsuite: lto: rename pr47333 test
Sam James [Fri, 25 Oct 2024 15:31:01 +0000 (16:31 +0100)] 
testsuite: lto: rename pr47333 test

This was being ignored previously. Rename it per README.

gcc/testsuite/ChangeLog:
PR target/47333

* g++.dg/lto/pr47333.C: Move to...
* g++.dg/lto/pr47333_0.C: ...here.

9 months agotestsuite: lto: rename pr62026 test
Sam James [Fri, 25 Oct 2024 15:30:49 +0000 (16:30 +0100)] 
testsuite: lto: rename pr62026 test

This was being ignored previously. Rename it per README.

gcc/testsuite/ChangeLog:
PR lto/62026

* g++.dg/lto/pr62026.C: Move to...
* g++.dg/lto/pr62026_0.C: ...here.

9 months agotestsuite: lto: rename pr95677 test
Sam James [Mon, 21 Oct 2024 11:13:34 +0000 (12:13 +0100)] 
testsuite: lto: rename pr95677 test

This was being ignored previously. Rename it per README.

gcc/testsuite/ChangeLog:
PR c++/95677

* g++.dg/lto/pr95677.C: Move to...
* g++.dg/lto/pr95677_0.C: ...here.

9 months agotoplevel: Error out if using --disable-libstdcxx with bootstrap [PR105474]
Andrew Pinski [Thu, 22 Aug 2024 21:34:03 +0000 (14:34 -0700)] 
toplevel: Error out if using --disable-libstdcxx with bootstrap [PR105474]

Bootstrapping and using --disable-libstdcxx will cause a build failure deep in compiling
stage2 so instead error out early in the toplevel configure so it is more user friendly.

Bootstrapped and tested on x86_64-linux-gnu.
Also made sure --disable-libstdcxx without --disable-bootstrap failed.

PR bootstrap/105474

ChangeLog:

* configure: Regenerate.
* configure.ac: Error out if libstdc++ is not enabled
with bootstrapping.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
9 months agoaarch64: Support multiple variants including up to 3
Andrew Pinski [Sat, 4 May 2024 09:03:16 +0000 (02:03 -0700)] 
aarch64: Support multiple variants including up to 3

On some of the Qualcomm's SoC that includes oryon-1 core, the variant
will be different on the cores due to big.little config. Though
the difference between big and little is not significant enough
to have seperate cost/scheduling models for them and the feature set
is the same across all variants.

Also on some SoCs, there are 3 variants of the core, big.middle.little
so this increases the support there for up to 3 cores and 3 variants
in the original parsing loop but it does not change the support for max
of 2 different cores.

After this patch and the patch that adds oryon-1, -mcpu=native works
on the SoCs I am working with.

Bootstrapped and tested on aarch64-linux-gnu with no regressions.

gcc/ChangeLog:

* config/aarch64/driver-aarch64.cc (host_detect_local_cpu): Support
3 cores and 3 variants. If there is one core but multiple variant,
then treat the variant as being all.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/cpunative/info_25: New file.
* gcc.target/aarch64/cpunative/info_26: New file.
* gcc.target/aarch64/cpunative/native_cpu_25.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_26.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
9 months agoAArch64: Add more accurate constraint [PR117292]
Wilco Dijkstra [Fri, 25 Oct 2024 14:53:58 +0000 (14:53 +0000)] 
AArch64: Add more accurate constraint [PR117292]

As shown in the PR, reload may only check the constraint in some cases and
and not check the predicate is still valid for the resulting instruction.
To fix the issue, add a new constraint which matches the predicate exactly.

gcc/ChangeLog:
PR target/117292
* config/aarch64/aarch64-simd.md (xor<mode>3<vczle><vczbe>): Use
'De' constraint.
* config/aarch64/constraints.md (De): Add new constraint.

gcc/testsuite/ChangeLog:
PR target/117292
* gcc.target/aarch64/sve/single_5.c: Remove xfails.
* gcc.target/aarch64/pr117292.c: New test.

9 months agoFortran: Fix ICE with structure constructor in data statement [PR79685]
Paul Thomas [Fri, 25 Oct 2024 16:59:03 +0000 (17:59 +0100)] 
Fortran: Fix ICE with structure constructor in data statement [PR79685]

2024-10-25  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/79685
* decl.cc (match_data_constant): Find the symtree instead of
the symbol so the use renamed symbols are found. Pass this and
the derived type to gfc_match_structure_constructor.
* match.h: Update prototype of gfc_match_structure_contructor.
* primary.cc (gfc_match_structure_constructor): Remove call to
gfc_get_ha_sym_tree and use caller supplied symtree instead.

gcc/testsuite/
PR fortran/79685
* gfortran.dg/use_rename_13.f90: New test.

9 months agotestsuite: add testcase for fixed PR115933
Sam James [Sun, 20 Oct 2024 07:28:59 +0000 (08:28 +0100)] 
testsuite: add testcase for fixed PR115933

gcc/testsuite/ChangeLog:
PR rtl-optimization/115933

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

9 months agoaarch64: Add mfloat vreinterpret intrinsics
Andrew Carlotti [Mon, 21 Oct 2024 15:22:43 +0000 (16:22 +0100)] 
aarch64: Add mfloat vreinterpret intrinsics

gcc/ChangeLog:

* config/aarch64/aarch64-builtins.cc (MODE_d_mf8): New.
(MODE_q_mf8): New.
(QUAL_mf8): New.
(VREINTERPRET_BUILTINS1): Add mf8 entry.
(VREINTERPRET_BUILTINS): Ditto.
(VREINTERPRETQ_BUILTINS1): Ditto.
(VREINTERPRETQ_BUILTINS): Ditto.
(aarch64_lookup_simd_type_in_table): Match modal_float bit

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/advsimd-intrinsics/mf8-reinterpret.c: New test.

9 months agoaarch64: Add support for mfloat8x{8|16}_t types
Andrew Carlotti [Mon, 21 Oct 2024 15:22:09 +0000 (16:22 +0100)] 
aarch64: Add support for mfloat8x{8|16}_t types

gcc/ChangeLog:

* config/aarch64/aarch64-builtins.cc
(aarch64_init_simd_builtin_types): Initialise FP8 simd types.
* config/aarch64/aarch64-builtins.h
(enum aarch64_type_qualifiers): Add qualifier_modal_float bit.
* config/aarch64/aarch64-simd-builtin-types.def:
Add Mfloat8x{8|16}_t types.
* config/aarch64/arm_neon.h: Add mfloat8x{8|16}_t typedefs.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/movv16qi_2.c: Test mfloat as well.
* gcc.target/aarch64/movv16qi_3.c: Ditto.
* gcc.target/aarch64/movv2x16qi_1.c: Ditto.
* gcc.target/aarch64/movv3x16qi_1.c: Ditto.
* gcc.target/aarch64/movv4x16qi_1.c: Ditto.
* gcc.target/aarch64/movv8qi_2.c: Ditto.
* gcc.target/aarch64/movv8qi_3.c: Ditto.
* gcc.target/aarch64/mfloat-init-1.c: New test.

9 months agomatch.pd: Add std::pow folding optimizations.
Jennifer Schmitz [Thu, 17 Oct 2024 15:40:34 +0000 (08:40 -0700)] 
match.pd: Add std::pow folding optimizations.

This patch adds the following two simplifications in match.pd for
POW_ALL and POWI:
- pow (1.0/x, y) to pow (x, -y), avoiding the division
- pow (0.0, x) to 0.0, avoiding the call to pow.
The patterns are guarded by flag_unsafe_math_optimizations,
!flag_trapping_math, and !HONOR_INFINITIES.
The POW_ALL patterns are also gated under !flag_errno_math.
The second pattern is also guarded by !HONOR_NANS and
!HONOR_SIGNED_ZEROS.

Tests were added to confirm the application of the transform for
builtins pow, powf, powl, powi, powif, powil, and powf16.

The patch was bootstrapped and regtested on aarch64-linux-gnu and
x86_64-linux-gnu, no regression.
OK for mainline?

Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com>
gcc/
* match.pd: Fold pow (1.0/x, y) -> pow (x, -y) and
pow (0.0, x) -> 0.0.

gcc/testsuite/
* gcc.dg/tree-ssa/pow_fold_1.c: New test.

9 months agoMatch: Simplify branch form 3 of unsigned SAT_ADD into branchless
Pan Li [Thu, 24 Oct 2024 13:57:04 +0000 (21:57 +0800)] 
Match: Simplify branch form 3 of unsigned SAT_ADD into branchless

There are sorts of forms for the unsigned SAT_ADD.  Some of them are
complicated while others are cheap.  This patch would like to simplify
the complicated form into the cheap ones.  For example as below:

From the form 3 (branch):
  SAT_U_ADD = (X + Y) >= x ? (X + Y) : -1.

To (branchless):
  SAT_U_ADD = (X + Y) | - ((X + Y) < X).

  #define T uint8_t

  T sat_add_u_1 (T x, T y)
  {
    return (T)(x + y) >= x ? (x + y) : -1;
  }

Before this patch:
   1   │ uint8_t sat_add_u_1 (uint8_t x, uint8_t y)
   2   │ {
   3   │   uint8_t D.2809;
   4   │
   5   │   _1 = x + y;
   6   │   if (x <= _1) goto <D.2810>; else goto <D.2811>;
   7   │   <D.2810>:
   8   │   D.2809 = x + y;
   9   │   goto <D.2812>;
  10   │   <D.2811>:
  11   │   D.2809 = 255;
  12   │   <D.2812>:
  13   │   return D.2809;
  14   │ }

After this patch:
   1   │ uint8_t sat_add_u_1 (uint8_t x, uint8_t y)
   2   │ {
   3   │   uint8_t D.2809;
   4   │
   5   │   _1 = x + y;
   6   │   _2 = x + y;
   7   │   _3 = x > _2;
   8   │   _4 = (unsigned char) _3;
   9   │   _5 = -_4;
  10   │   D.2809 = _1 | _5;
  11   │   return D.2809;
  12   │ }

The simplify doesn't need to check if target support the SAT_ADD, it
is somehow the optimization in gimple level.

The below test suites are passed for this patch.
* The rv64gcv fully regression test.
* The x86 bootstrap test.
* The x86 fully regression test.

gcc/ChangeLog:

* match.pd: Remove unsigned branch form 3 for SAT_ADD, and
add simplify to branchless instead.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/sat_u_add-simplify-1-u16.c: New test.
* gcc.dg/tree-ssa/sat_u_add-simplify-1-u32.c: New test.
* gcc.dg/tree-ssa/sat_u_add-simplify-1-u64.c: New test.
* gcc.dg/tree-ssa/sat_u_add-simplify-1-u8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
9 months agoAssorted --disable-checking fixes [PR117249]
Jakub Jelinek [Fri, 25 Oct 2024 12:09:42 +0000 (14:09 +0200)] 
Assorted --disable-checking fixes [PR117249]

We have currently 3 different definitions of gcc_assert macro, one used most
of the time (unless --disable-checking) which evaluates the condition at
runtime and also checks it at runtime, then one for --disable-checking GCC 4.5+
which looks like
((void)(UNLIKELY (!(EXPR)) ? __builtin_unreachable (), 0 : 0))
and a fallback one
((void)(0 && (EXPR)))
Now, the last one actually doesn't evaluate any of the side-effects in the
argument, just quiets up unused var/parameter warnings.
I've tried to replace the middle definition with
({ [[assume (EXPR)]]; (void) 0; })
for compilers which support assume attribute and statement expressions
(surprisingly quite a few spots use gcc_assert inside of comma expressions),
but ran into PR117287, so for now such a change isn't being proposed.

The following patch attempts to move important side-effects from gcc_assert
arguments.

Bootstrapped/regtested on x86_64-linux and i686-linux with normal
--enable-checking=yes,rtl,extra, plus additionally I've attempted to do
x86_64-linux bootstrap with --disable-checking and gcc_assert changed to the
((void)(0 && (EXPR)))
version when --disable-checking.  That version ran into spurious middle-end
warnings
../../gcc/../include/libiberty.h:733:36: error: argument to ‘alloca’ is too large [-Werror=alloca-larger-than=]
../../gcc/tree-ssa-reassoc.cc:5659:20: note: in expansion of macro ‘XALLOCAVEC’
  int op_num = ops.length ();
  int op_normal_num = op_num;
  gcc_assert (op_num > 0);
  int stmt_num = op_num - 1;
  gimple **stmts = XALLOCAVEC (gimple *, stmt_num);
where we have gcc_assert exactly to work-around middle-end warnings.
Guess I'd need to also disable -Werror for this experiment, which actually
isn't a problem with unmodified system.h, because even for
--disable-checking we use the __builtin_unreachable at least in
stage2/stage3 and so the warnings aren't emitted, and even if it used
[[assume ()]]; it would work too because in stage2/stage3 we could again
rely on assume and statement expression support.

2024-10-25  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/117249
* tree-ssa-structalias.cc (insert_vi_for_tree): Move put calls out of
gcc_assert.
* lto-cgraph.cc (lto_symtab_encoder_delete_node): Likewise.
* gimple-ssa-strength-reduction.cc (get_alternative_base,
add_cand_for_stmt): Likewise.
* tree-eh.cc (add_stmt_to_eh_lp_fn): Likewise.
* except.cc (duplicate_eh_regions_1): Likewise.
* tree-ssa-reassoc.cc (insert_operand_rank): Likewise.
* config/nvptx/nvptx.cc (nvptx_expand_call): Use == rather than = in
gcc_assert.
* opts-common.cc (jobserver_info::disconnect): Call close outside of
gcc_assert and only check result in it.
(jobserver_info::return_token): Call write outside of gcc_assert and
only check result in it.
* genautomata.cc (output_default_latencies): Move j++ side-effect
outside of gcc_assert.
* tree-ssa-loop-ivopts.cc (get_alias_ptr_type_for_ptr_address): Use
== rather than = in gcc_assert.
* cgraph.cc (symbol_table::create_edge): Move ++edges_max_uid
side-effect outside of gcc_assert.

9 months agolto: Handle RAW_DATA_CST in compare_tree_sccs_1 [PR117201]
Jakub Jelinek [Fri, 25 Oct 2024 12:05:37 +0000 (14:05 +0200)] 
lto: Handle RAW_DATA_CST in compare_tree_sccs_1 [PR117201]

I've missed I need to add RAW_DATA_CST support in compare_tree_sccs_1,
because without that it considers all RAW_DATA_CSTs to be equivalent,
regardless of their length or content.

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

PR lto/117201
PR lto/117288
* lto-common.cc (compare_tree_sccs_1): Handle RAW_DATA_CST.

* gcc.dg/lto/pr117201_0.c: New test.
* gcc.dg/lto/pr117288_0.c: New test.

9 months agoDefault expand_vec_cond_expr_p code to ERROR_MARK
Richard Biener [Fri, 25 Oct 2024 10:38:24 +0000 (12:38 +0200)] 
Default expand_vec_cond_expr_p code to ERROR_MARK

As we want to transition to only vcond_mask expanders the following
makes it possible to easier distinguish queries that rely on
vcond queries for expand_vec_cond_expr_p from those of vcond_mask
by for the latter having the comparison code defaulted to ERROR_MARK.

* optabs-tree.h (expand_vec_cond_expr_p): Default the
comparison code to ERROR_MARK.
* match.pd: Remove unneded expand_vec_cond_expr_p args.
* tree-vect-generic.cc (expand_vector_condition): Likewise.
* tree-vect-loop.cc (vect_reduction_update_partial_vector_usage):
Likewise.
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Likewise.
(scan_store_can_perm_p): Likewise.
(vectorizable_condition): Likewise.

9 months agotestsuite: Generalise tree-ssa/shifts-3.c regexp
Richard Sandiford [Fri, 25 Oct 2024 11:25:42 +0000 (12:25 +0100)] 
testsuite: Generalise tree-ssa/shifts-3.c regexp

My recent gcc.dg/tree-ssa/shifts-3.c test failed on arm-linux-gnu
because it used widen_mult_expr to do a multiplication on chars.
This patch generalises the regexp in the same way as for f3.

gcc/testsuite/
* gcc.dg/tree-ssa/shifts-3.c: Accept widen_mult for f2 too.

9 months agoAdd regression test
Eric Botcazou [Fri, 25 Oct 2024 11:14:22 +0000 (13:14 +0200)] 
Add regression test

gcc/testsuite
PR ada/116551
* gnat.dg/specs/vfa3.ads: New test.

9 months agolibstdc++: Disable parts of new test that depend on constexpr std::string
Jonathan Wakely [Thu, 24 Oct 2024 19:12:08 +0000 (20:12 +0100)] 
libstdc++: Disable parts of new test that depend on constexpr std::string

The compile-time assertions don't work with -D_GLIBCXX_USE_CXX11_ABI=0.

libstdc++-v3/ChangeLog:

* testsuite/21_strings/basic_string/operators/char/op_plus_string_view.cc:
Check __cpp_lib_constexpr_string.

9 months agolibstdc++: implement concatenation of strings and string_views
Giuseppe D'Angelo [Tue, 30 Jul 2024 18:09:12 +0000 (20:09 +0200)] 
libstdc++: implement concatenation of strings and string_views

This adds support for P2591R5, merged for C++26.

libstdc++-v3/ChangeLog:

* include/bits/basic_string.h: Implement the four operator+
overloads between basic_string and (types convertible to)
basic_string_view.
* include/bits/version.def: Bump the feature-testing macro.
* include/bits/version.h: Regenerate.
* testsuite/21_strings/basic_string/operators/char/op_plus_fspath_neg.cc: New test.
* testsuite/21_strings/basic_string/operators/char/op_plus_string_view.cc: New test.
* testsuite/21_strings/basic_string/operators/char/op_plus_string_view_compat.cc:
New test.

Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
9 months agoRestrict :c to commutative ops as intended
Richard Biener [Thu, 24 Oct 2024 15:06:29 +0000 (17:06 +0200)] 
Restrict :c to commutative ops as intended

genmatch was supposed to restrict :c to verifiable commutative
operations while leaving :C to the "I know what I'm doing" case.
The following enforces this, cleaning up parsing and amending
the commutative_op helper.  There's one pattern that needs adjustment,
the pattern optimizing fmax (x, NaN) or fmax (NaN, x) to x since
fmax isn't commutative.

* genmatch.cc (commutative_op): Add paramter to indicate whether
all compares should be considered commutative.  Handle
hypot, add_overflow and mul_overflow.
(parser::parse_expr): Simplify 'c' handling by using
commutative_op and error out when the operation is not.
* match.pd ((minmax:c @0 NaN@1) -> @0): Use :C, we know
what we are doing.

9 months agotree-optimization/117277 - remove CLOBBERs before SLP code generation
Richard Biener [Thu, 24 Oct 2024 14:15:43 +0000 (16:15 +0200)] 
tree-optimization/117277 - remove CLOBBERs before SLP code generation

We have to remove CLOBBERs before SLP is code generated since for
store-lanes we are inserting our own CLOBBERs that we want to survive.
So the following refactors vect_transform_loop to remove unwanted
stmts first.

This resolves the gcc.target/aarch64/sve/store_lane_spill_1.c FAIL.

PR tree-optimization/117277
* tree-vect-loop.cc (vect_transform_loop): Remove CLOBBERs
and prefetches before doing any code generation.

9 months agotree-optimization/116575 - SLP masked load-lanes discovery
Richard Biener [Wed, 23 Oct 2024 11:56:55 +0000 (13:56 +0200)] 
tree-optimization/116575 - SLP masked load-lanes discovery

The following implements masked load-lane discovery for SLP.  The
challenge here is that a masked load has a full-width mask with
group-size number of elements when this becomes a masked load-lanes
instruction one mask element gates all group members.  We already
have some discovery hints in place, namely STMT_VINFO_SLP_VECT_ONLY
to guard non-uniform masks, but we need to choose a way for SLP
discovery to handle possible masked load-lanes SLP trees.

I have this time chosen to handle load-lanes discovery where we
have performed permute optimization already and conveniently got
the graph with predecessor edges built.  This is because unlike
non-masked loads masked loads with a load_permutation are never
produced by SLP discovery (because load permutation handling doesn't
handle un-permuting the mask) and thus the load-permutation lowering
which handles non-masked load-lanes discovery doesn't trigger.

With this SLP discovery for a possible masked load-lanes, thus
a masked load with uniform mask, produces a splat of a single-lane
sub-graph as the mask SLP operand.  This is a representation that
shouldn't pessimize the mask load case and allows the masked load-lanes
transform to simply elide this splat.

This fixes the aarch64-sve.exp mask_struct_load*.c testcases with
--param vect-force-slp=1

PR tree-optimization/116575
* tree-vect-slp.cc (vect_get_and_check_slp_defs): Handle
gaps, aka NULL scalar stmt.
(vect_build_slp_tree_2): Allow gaps in the middle of a
grouped mask load.  When the mask of a grouped mask load
is uniform do single-lane discovery for the mask and
insert a splat VEC_PERM_EXPR node.
(vect_optimize_slp_pass::decide_masked_load_lanes): New
function.
(vect_optimize_slp_pass::run): Call it.

9 months agoRelax vect_check_scalar_mask check
Richard Biener [Wed, 23 Oct 2024 09:55:31 +0000 (11:55 +0200)] 
Relax vect_check_scalar_mask check

When the mask is not a constant or external def there's no need to
check the scalar type, in particular with SLP and the mask being
a VEC_PERM_EXPR there isn't a scalar operand ready to check
(not one vect_is_simple_use will get you).  We later check the
vector type and reject non-mask types there.

* tree-vect-stmts.cc (vect_check_scalar_mask): Only check
the scalar type for constant or extern defs.

9 months agoada: Change scope of XUB type
Tom Tromey [Wed, 31 Jul 2024 15:01:45 +0000 (09:01 -0600)] 
ada: Change scope of XUB type

An earlier patch in the "nameless" series caused a regression with
-fgnat-encodings=all.  Previously, all artificial types were emitted
in the CU scope in the DWARF, but with the patch, an "XUB" type is
emitted in the function scope.  This causes gdb lookups to erroneously
find the XUB type rather than the type that gdb expects to find.

Note that I don't know why the earlier code worked, because decl.cc
clearly sets the XUB type's context to be the current function.

This patch changes the type's context so that it is nested in a type
that is conveniently available.

gcc/ada/ChangeLog:

* gcc-interface/decl.cc (gnat_to_gnu_entity): Use gnu_fat_type as the type
context for a XUB type.

9 months agoada: Set DECL_NAMELESS in create_type_decl
Tom Tromey [Tue, 9 Jul 2024 15:36:26 +0000 (09:36 -0600)] 
ada: Set DECL_NAMELESS in create_type_decl

When using minimal encodings, most artificial types do not need to
have their names emitted in the DWARF.  This patch changes the
compiler to generally omit these names.

However, a subset of names are needed: when the compiler creates an
artificial type for certain kinds of arrays, the name is needed by
gdb.  So, a new parameter is added to create_type_decl to allow this
omission to be disabled.

Note that simply passing 'false' as the artificial_p argument to
create_type_decl doesn't work properly -- other parts of the compiler
seem to rely on this flag being set, and so making this change causes
ICEs.

gcc/ada/ChangeLog:

* gcc-interface/decl.cc (gnat_to_gnu_entity): Update some calls to
create_type_decl.
* gcc-interface/gigi.h (create_type_decl): Add can_be_nameless parameter.
* gcc-interface/utils.cc (create_type_decl): Add can_be_nameless
parameter.  Set DECL_NAMELESS on type decl.

9 months agoada: Mark some type decls as nameless
Tom Tromey [Wed, 10 Jul 2024 17:54:25 +0000 (11:54 -0600)] 
ada: Mark some type decls as nameless

The types created by record_builtin_type and create_type_stub_decl can
be marked as nameless when using minimal encodings.  In this
situation, gdb does not need these type names.

gcc/ada/ChangeLog:

* gcc-interface/utils.cc (record_builtin_type, create_type_stub_decl):
Set DECL_NAMELESS on type decls.

9 months agoada: Mark XUA types as artificial
Tom Tromey [Wed, 10 Jul 2024 17:52:17 +0000 (11:52 -0600)] 
ada: Mark XUA types as artificial

gdb does not need the name of XUA types.  This patch changes the
compiler to unconditionally mark these as artificial; a subsequent
patch will arrange for the name to be omitted.

gcc/ada/ChangeLog:

* gcc-interface/decl.cc (gnat_to_gnu_entity): Pass 'true' to
create_type_decl when creating XUA type.

9 months agoada: Mark XUB types as nameless
Tom Tromey [Wed, 10 Jul 2024 17:38:55 +0000 (11:38 -0600)] 
ada: Mark XUB types as nameless

gdb does not need the name of XUB types.  This patch changes the
compiler to omit these names from the DWARF when minimal encodings are
in use.

gcc/ada/ChangeLog:

* gcc-interface/decl.cc (gnat_to_gnu_entity): Set TYPE_NAMELESS on
XUB types.

9 months agoada: Add 'artificial_p' parameter to build_unc_object_type
Tom Tromey [Wed, 10 Jul 2024 17:46:57 +0000 (11:46 -0600)] 
ada: Add 'artificial_p' parameter to build_unc_object_type

This adds an 'artificial_p' parameter to build_unc_object_type, so
that the artificiality of the type can be propagated to
create_type_decl.  This will affect the namelessness of the type in a
subsequent patch.

gcc/ada/ChangeLog:

* gcc-interface/decl.cc (gnat_to_gnu_entity): Pass artificial_p to
build_unc_object_type.
* gcc-interface/gigi.h (build_unc_object_type): Update.
* gcc-interface/utils.cc (build_unc_object_type) Add artificial_p
parameter.
(build_unc_object_type_from_ptr): Update.

9 months agoada: Standard types are not artificial
Tom Tromey [Wed, 10 Jul 2024 17:29:11 +0000 (11:29 -0600)] 
ada: Standard types are not artificial

This changes gigi so that standard types are no longer marked
artificial.  This change is needed to prevent subsequent patches from
causing standard types to have their names elided.  Also, although
DWARF says that DW_AT_artificial is used for "the declaration of an
object or type artificially generated by a compiler and not explicitly
declared by the source program", it seems to me that types provided by
the language should not be marked as such; and this is what the C and
C++ compilers do.

gcc/ada/ChangeLog:

* gcc-interface/decl.cc (is_artificial): New function.
(gnat_to_gnu_entity): Use it.

9 months agoada: Fix fallout of change in parameter passing out of aliasing considerations
Eric Botcazou [Wed, 18 Sep 2024 06:24:32 +0000 (08:24 +0200)] 
ada: Fix fallout of change in parameter passing out of aliasing considerations

If an actual parameter that is a type conversion is passed by reference but
not addressable, the temporary that is created and whose address is passed
instead may need to be in the target type of the conversion to fulfill the
requirements of strict aliasing.

gcc/ada/ChangeLog:

* gcc-interface/trans.cc (Call_to_gnu): If the formal is passed by
reference and the actual is a type conversion but not addressable,
create the temporary in the target type of the conversion if this
is needed to enforce strict aliasing.

9 months agoada: Fix internal error on bit-packed array type with Volatile_Full_Access
Eric Botcazou [Wed, 11 Sep 2024 17:53:12 +0000 (19:53 +0200)] 
ada: Fix internal error on bit-packed array type with Volatile_Full_Access

The problem occurs when the component type is a record type with default
values for the initialization procedure of the (base) array type, because
the compiler is trying to generate a full access for a parameter of the
base array type, which does not make sense.

gcc/ada/ChangeLog:

PR ada/116551
* gcc-interface/trans.cc (node_is_atomic) <N_Identifier>: Return
false if the type of the entity is an unconstrained array type.
(node_is_volatile_full_access) <N_Identifier>: Likewise.

9 months agoada: Back out part of previous change -- disable warning
Bob Duff [Tue, 1 Oct 2024 20:31:10 +0000 (16:31 -0400)] 
ada: Back out part of previous change -- disable warning

Temporarily disable the warning, because it breaks
SPARK continuous builder

gcc/ada/ChangeLog:

* sem_ch10.adb (Analyze_With_Clause): Temporarily disable warning.

9 months agoada: Disable self-referential with_clauses
Bob Duff [Tue, 1 Oct 2024 15:29:34 +0000 (11:29 -0400)] 
ada: Disable self-referential with_clauses

Self-referential with_clauses (as in package body X says "with X;")
cause trouble, such as duplicate nested instantiations when using
container packages. This patch disables most of the processing by
setting the Is_Implicit_With flag. It's not really implicit, but the
subsequent processing behaves as if it is, and coming up with a more
accurate (and much longer) name for the flag doesn't seem beneficial for
such an obscure case. Note that the spec of X will be processed later,
rather than upon seeing "with X;".

Other cleanups, such as renaming Implicit_With to be Is_Implicit_With.

gcc/ada/ChangeLog:

* sem_ch10.adb: (Analyze_With_Clause): Check for self-referential
with clause. Give a warning, and set Is_Implicit_With, which we
are reusing in this obscure case even though it's not really
implicit.
(Analyze_Context): Remove check for self-referential with clause.
It wasn't correct -- it only triggered for Acts_As_Spec
subprograms. Corrected check is now in Analyze_With_Clause.
(Implicit_With): Rename to be Is_Implicit_With. Misc cleanup,
comment fixes.
(Process_Spec_Clauses): Remove default for Exit_On_Self parameter.
Use "exit when" instead of if statement.
* sinfo.ads (Implicit_With): Rename to be Is_Implicit_With.
Document new use for self-referential withs.
* ali.adb (Scan_ALI): Use an aggregate to initialize Withs entry.
* exp_put_image.adb (Preload_Root_Buffer_Type): Make this a
once-only procedure.
* sem_util.ads (Is_Ancestor_Package): Fix comment -- a libraryunit
is an ancestor of itself, but this doesn't return True in that
case.
* sem_util.adb (Is_Ancestor_Package): Better to initialize things
on their declaration.
* lib-load.adb: Minor comment fix.
* sem_prag.adb: Implicit_With --> Is_Implicit_With. Minor comment
fix.
* gen_il-fields.ads: Implicit_With --> Is_Implicit_With.
* gen_il-gen-gen_nodes.adb: Likewise
* lib.adb: Likewise
* lib-writ.adb: Likewise
* rtsfind.adb: Likewise
* sem_cat.adb: Likewise
* sem_ch12.adb: Likewise
* sem_ch8.adb: Likewise
* sem_elab.adb: Likewise
* sem_warn.adb: Likewise
* gcc-interface/trans.cc: (Implicit_With): Rename to be
Is_Implicit_With.

9 months agoada: Emit DWARF for Ada 'with' and 'use' clauses
Tom Tromey [Wed, 24 Apr 2024 19:13:08 +0000 (13:13 -0600)] 
ada: Emit DWARF for Ada 'with' and 'use' clauses

This changes the Ada compiler to emit DWARF information for Ada 'with'
and 'use' clauses.  In particular, code like:

    with Pck; use Pck;

will be emitted as:

 <1><146a>: Abbrev Number: 23 (DW_TAG_module)
    <146b>   DW_AT_name        : pck
    <146f>   DW_AT_decl_file   : 1
    <1470>   DW_AT_decl_line   : 16
    <1471>   DW_AT_decl_column : 6
 <1><1472>: Abbrev Number: 24 (DW_TAG_imported_module)
    <1473>   DW_AT_decl_file   : 1
    <1474>   DW_AT_decl_line   : 16
    <1475>   DW_AT_decl_column : 11
    <1476>   DW_AT_import      : <0x146a>

That is, DW_TAG_module is used to represent a 'with' clause, and
DW_TAG_imported_module is used to represent 'use'.

gcc/ada/ChangeLog:

* gcc-interface/trans.cc (namespace_map): New global.
(Compilation_Unit_to_gnu): Also handle N_With_Clause and
N_Use_Package_Clause.
(get_or_create_namespace, get_namespace): New functions.
(gnat_to_gnu) <N_Package_Renaming_Declaration>: Call
get_namespace.
<N_Use_Package_Clause, N_With_Clause>: Likewise.

9 months agoada: Small adjustments to commentary after latest change
Eric Botcazou [Tue, 1 Oct 2024 07:19:36 +0000 (09:19 +0200)] 
ada: Small adjustments to commentary after latest change

This removes the enumeration of the various cases in the comment associated
with the declaration of In_Expanded_Body to prevent synchronization issues.

gcc/ada/ChangeLog:

* freeze.adb (Freeze_Expression.In_Expanded_Body): Tweak comments.

9 months agoada: Pragma Pre_Class and Post_Class have no effect at runtime
Javier Miranda [Mon, 30 Sep 2024 09:08:04 +0000 (09:08 +0000)] 
ada: Pragma Pre_Class and Post_Class have no effect at runtime

The pragmas Pre_Class and Post_Class are accepted by the compiler
but have no effect at runtime.

gcc/ada/ChangeLog:

* freeze.adb (Freeze_Entity): If the entity is an access-to-subprogram
type declaration that pre/postcondition contracts, build the
wrapper
(if not previously done as part of processing aspects).
* sem_ch3.adb (Build_Access_Subprogram_Wrapper): Add missing support
for building the wrapper when the access type has pragmas
Pre_Class/Post_Class.
(Build_Access_Subprogram_Wrapper_Declaration): New subprogram.
* sem_ch3.ads (Build_Access_Subprogram_Wrapper): Spec moved to the
public part of the package.
* sem_prag.adb (Analyze_Pre_Post_Condition): Store in the tree copy of
class-wide pre/postcondition expression; required to merge it with
inherited conditions.
(Is_Valid_Assertion_Kind): Added Pre_Class and Post_Class.

9 months agoada: Update GNAT UG
Richard Kenner [Thu, 5 Sep 2024 17:37:33 +0000 (13:37 -0400)] 
ada: Update GNAT UG

Also add some LLVM-specific information.

gcc/ada/ChangeLog:

* doc/gnat_ugn/about_this_guide.rst: Numerous changes to language
and style and add some LLVM-specific information.
* doc/gnat_ugn/elaboration_order_handling_in_gnat.rst: Likewise.
* doc/gnat_ugn/example_of_binder_output.rst: Likewise.
* doc/gnat_ugn/getting_started_with_gnat.rst: Likewise.
* doc/gnat_ugn/gnat_and_program_execution.rst: Likewise.
* doc/gnat_ugn/gnat_utility_programs.rst: Likewise.
* doc/gnat_ugn/inline_assembler.rst: Likewise.
* doc/gnat_ugn/platform_specific_information.rst: Likewise.
* doc/gnat_ugn/the_gnat_compilation_model.rst: Likewise.
* gnat_ugn.texi: Regenerate.

9 months agoada: Fix ATC with timed delay from Ada.Real_Time
Eric Botcazou [Fri, 27 Sep 2024 07:36:17 +0000 (09:36 +0200)] 
ada: Fix ATC with timed delay from Ada.Real_Time

An Asynchronous Transfer of Control blocks with a timed delay that is
computed by means of the Ada.Real_Time unit (instead of the default
Ada.Calendar unit) because of a missing abort deferral in the unit.

gcc/ada/ChangeLog:

PR ada/43485
* libgnarl/a-retide.adb: Add with clause for System.Soft_Links.
(Delay_Until): Defer and undefer abort around the call to the
Timed_Delay routine of System.Task_Primitives.Operations.

9 months agoada: Fix internal error on function call in class-wide precondition
Eric Botcazou [Fri, 27 Sep 2024 10:19:14 +0000 (12:19 +0200)] 
ada: Fix internal error on function call in class-wide precondition

This occurs when the call is to a function that is declared in a package
that is nested in the scope where the type declaration is located.

gcc/ada/ChangeLog:

* freeze.adb (Freeze_Expression.In_Expanded_Body): Also return True
for the body of a helper/wrapper built for class-wide preconditions.

9 months agoada: Pragmas Pre_Class/Post_Class rejected for abstract subprograms
Javier Miranda [Thu, 26 Sep 2024 10:14:10 +0000 (10:14 +0000)] 
ada: Pragmas Pre_Class/Post_Class rejected for abstract subprograms

The Pre_Class/Post_Class pragmas are rejected at compile time
for abstract subprograms.

gcc/ada/ChangeLog:

* sem_prag.adb (Analyze_Pre_Post_Condition): Allow the use of
pragma Pre_Class/Post_Class with abstract subprograms.

9 months agoada: Spurious error when compiling in Syntax and Semantics Only mode
Javier Miranda [Thu, 26 Sep 2024 09:18:48 +0000 (09:18 +0000)] 
ada: Spurious error when compiling in Syntax and Semantics Only mode

Compiling under switch -gnatc, the frontend reports spurious errors
accessing components of class-wide tagged types.

gcc/ada/ChangeLog:

* sem_ch3.adb (Record_Type_Definition): For tagged types, add
the missing decoration to the First_Entity in the corresponding
class-wide type entity.

9 months agoada: Adjust documentation of External_Initialization
Ronan Desplanques [Mon, 23 Sep 2024 08:36:29 +0000 (10:36 +0200)] 
ada: Adjust documentation of External_Initialization

The parameters Maximum_Size and If_Empty were mentioned during the
request for comments phase but are not implemented, at least for now.
This patch changes the GNAT reference manual accordingly. It also makes
a minor punctuation change.

gcc/ada/ChangeLog:

* doc/gnat_rm/gnat_language_extensions.rst: Adjust documentation.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

9 months agoada: Update Compiler_Error documentation
Richard Kenner [Mon, 27 May 2024 15:52:16 +0000 (11:52 -0400)] 
ada: Update Compiler_Error documentation

Since we usually build without assertions, we force a bugbox by
raising Program_Error, not an always-false assertion.

gcc/ada/ChangeLog:

* comperr.ads (Compiler_Error): Update documentation.

9 months agoada: Add Type_Size_For function to Uintp package
Eric Botcazou [Fri, 13 Sep 2024 09:53:00 +0000 (11:53 +0200)] 
ada: Add Type_Size_For function to Uintp package

It computes the size of an integer type that can accommodate the input.

gcc/ada/ChangeLog:

* uintp.ads (Type_Size_For): New function declaration.
* uintp.adb (Type_Size_For): New function body.
* exp_imgv.adb (Rewrite_Object_Image): Call Type_Size_For to get
the size of a narrower integer type.

9 months agoada: Update simpler accessibility model doc
Tonu Naks [Fri, 13 Sep 2024 14:59:55 +0000 (14:59 +0000)] 
ada: Update simpler accessibility model doc

gcc/ada/ChangeLog:

* doc/gnat_rm/gnat_language_extensions.rst: update
simpler accessibility model
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

9 months agoada: Misc improvements to gnat RM
Bob Duff [Wed, 18 Sep 2024 20:28:34 +0000 (16:28 -0400)] 
ada: Misc improvements to gnat RM

...in the "GNAT language extensions" section.

gcc/ada/ChangeLog:

* doc/gnat_rm/gnat_language_extensions.rst:
Minor wording improvments.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

9 months agoada: Increase stack size for Windows tasking programs
squirek [Thu, 12 Sep 2024 14:37:49 +0000 (14:37 +0000)] 
ada: Increase stack size for Windows tasking programs

This patch increases the default tasking stack size for Windows tasking
program to 8 mb to avoid use of pragma Linker_Options in the general case.

gcc/ada/ChangeLog:

* libgnarl/s-taprop__mingw.adb: Modify stack size and update
documentation.

9 months agoada: Constraint error not raised in ACATS test c413007
Javier Miranda [Tue, 17 Sep 2024 11:53:06 +0000 (11:53 +0000)] 
ada: Constraint error not raised in ACATS test c413007

The Constraint_Error exception is not raised when a subprogram
is called using prefix notation, and the prefix of the call is
an access-to-subprogram type with a null value. This new check
is enabled by switch -gnatd_P

gcc/ada/ChangeLog:

* gen_il-fields.ads: New node field (Is_Expanded_Prefixed_Call).
* gen_il-gen-gen_nodes.adb: New semantic field for N_Function_Call
and N_Procedure_Call_Statement nodes.
* sem_ch4.adb (Complete_Object_Operation): Mark the rewritten node
with the Is_Expanded_Prefixed_Call flag.
* sem_res.adb (Check_Prefixed_Call): Code cleanup and addition of
documentation.
(Resolve_Actuals): Add a null-exclusion check on the
prefix of the call when it is an access-type.
* sinfo.ads: Adding new semantic flag (Is_Expanded_Prefixed_Call)
to N_Function_Call and N_Procedure_Call_Statement nodes.
* debug.adb: Adding documentation for switch d_P.

9 months agoada: Put Finalizable aspect in -gnatX
Raphaël AMIARD [Fri, 13 Sep 2024 13:30:03 +0000 (15:30 +0200)] 
ada: Put Finalizable aspect in -gnatX

gcc/ada/ChangeLog:

* sem_ch13.adb (Analyze_One_Aspect): change the call to
`Error_Msg_GNAT_Extension` to allow this aspect in core
extensions. Put the code path in core extensions.
* exp_util.adb (Name_Of_Controlled_Prim_Op): Put the code path
in core extensions