]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
8 months agoReport the section name in case of section type conflicts
Florian Weimer [Fri, 15 Nov 2024 11:00:47 +0000 (12:00 +0100)] 
Report the section name in case of section type conflicts

The section name might the user a hint of what is going on.

gcc/

* varasm.cc (get_section): Include name of section in
diagnostic messages.

8 months agoRISC-V: Remove unnecessary option for scalar SAT_ADD testcase
Pan Li [Fri, 15 Nov 2024 07:05:58 +0000 (15:05 +0800)] 
RISC-V: Remove unnecessary option for scalar SAT_ADD testcase

After we create a isolated folder to hold all SAT scalar test,
we have fully control of what optimization options passing to
the testcase.  Thus, it is better to remove the unnecessary
work around for flto option, as well as the -O3 option for
each cases.  The riscv.exp will pass sorts of different optimization
options for each case.

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

It is test only patch and obvious up to a point, will commit it
directly if no comments in next 48H.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/sat/sat_s_add-1-i16.c: Remove flto
dg-skip workaround and -O3 option.
* gcc.target/riscv/sat/sat_s_add-1-i32.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-1-i64.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-1-i8.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-2-i16.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-2-i32.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-2-i64.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-2-i8.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-3-i16.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-3-i32.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-3-i64.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-3-i8.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-4-i16.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-4-i32.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-4-i64.c: Ditto.
* gcc.target/riscv/sat/sat_s_add-4-i8.c: Ditto.
* gcc.target/riscv/sat/sat_s_add_imm-1-1.c: Ditto.
* gcc.target/riscv/sat/sat_s_add_imm-1.c: Ditto.
* gcc.target/riscv/sat/sat_s_add_imm-2-1.c: Ditto.
* gcc.target/riscv/sat/sat_s_add_imm-2.c: Ditto.
* gcc.target/riscv/sat/sat_s_add_imm-3-1.c: Ditto.
* gcc.target/riscv/sat/sat_s_add_imm-3.c: Ditto.
* gcc.target/riscv/sat/sat_s_add_imm-4.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-1-u16.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-1-u32.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-1-u64.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-1-u8.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-2-u16.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-2-u32.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-2-u64.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-2-u8.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-3-u16.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-3-u32.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-3-u64.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-3-u8.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-4-u16.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-4-u32.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-4-u64.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-4-u8.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-5-u16.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-5-u32.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-5-u64.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-5-u8.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-6-u16.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-6-u32.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-6-u64.c: Ditto.
* gcc.target/riscv/sat/sat_u_add-6-u8.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-1-u16.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-1-u32.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-1-u64.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-1-u8.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-2-u16.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-2-u32.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-2-u64.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-2-u8.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-3-u16.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-3-u32.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-3-u64.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-3-u8.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-4-u16.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-4-u32.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-4-u64.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm-4-u8.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-1.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-10.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-11.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-12.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-13.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-14.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-15.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-16.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-17.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-18.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-19.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-2.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-20.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-21.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-22.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-23.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-24.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-25.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-26.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-27.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-28.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-29.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-3.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-30.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-31.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-32.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-33.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-34.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-35.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-36.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-37.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-38.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-39.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-4.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-40.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-41.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-42.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-43.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-44.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-45.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-46.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-47.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-48.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-49.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-5.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-50.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-51.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-52.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-53.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-54.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-55.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-56.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-57.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-58.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-59.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-6.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-60.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-7.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-8.c: Ditto.
* gcc.target/riscv/sat/sat_u_add_imm_type_check-9.c: Ditto.

Signed-off-by: Pan Li <pan2.li@intel.com>
Signed-off-by: Pan Li <pan2.li@intel.com>
8 months agotestsuite: Change 3 tests from c++14 to c++11
Jakub Jelinek [Fri, 15 Nov 2024 08:05:25 +0000 (09:05 +0100)] 
testsuite: Change 3 tests from c++14 to c++11

These tests are valid C++11, so we can run them in C++11 too.

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

* g++.dg/tree-ssa/pr116868.C: Change effective target from c++14 to
c++11.
* g++.dg/tree-ssa/pr96945.C: Likewise.
* g++.dg/tree-ssa/pr110819.C: Likewise.

8 months agoc: Add _Decimal64x support
Jakub Jelinek [Fri, 15 Nov 2024 07:43:48 +0000 (08:43 +0100)] 
c: Add _Decimal64x support

The following patch adds _Decimal64x type support.  Our dfp libraries (dpd &
libbid) can only handle decimal32, decimal64 and decimal128 formats and I
don't see that changing any time soon, so the following patch just hardcodes
that _Decimal64x has the same mode as _Decimal128 (but is a distinct type).
In the unlikely event some target would introduce something different that
can be of course changed with target hooks but would be an ABI change.
_Decimal128x is optional and we don't have a wider decimal type, so that
type isn't added.

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

gcc/
* tree-core.h (enum tree_index): Add TI_DFLOAT64X_TYPE.
* tree.h (dfloat64x_type_node): Define.
* tree.cc (build_common_tree_nodes): Initialize dfloat64x_type_node.
* builtin-types.def (BT_DFLOAT64X): New DEF_PRIMITIVE_TYPE.
(BT_FN_DFLOAT64X): New DEF_FUNCTION_TYPE_0.
(BT_FN_DFLOAT64X_CONST_STRING, BT_FN_DFLOAT64X_DFLOAT64X): New
DEF_FUNCTION_TYPE_1.
* builtins.def (BUILT_IN_FABSD64X, BUILT_IN_INFD64X, BUILT_IN_NAND64X,
BUILT_IN_NANSD64X): New builtins.
* builtins.cc (expand_builtin): Handle BUILT_IN_FABSD64X.
(fold_builtin_0): Handle BUILT_IN_INFD64X.
(fold_builtin_1): Handle BUILT_IN_FABSD64X.
* fold-const-call.cc (fold_const_call): Handle CFN_BUILT_IN_NAND64X
and CFN_BUILT_IN_NANSD64X.
* ginclude/float.h (DEC64X_MANT_DIG, DEC64X_MIN_EXP, DEC64X_MAX_EXP,
DEC64X_MAX, DEC64X_EPSILON, DEC64X_MIN, DEC64X_TRUE_MIN,
DEC64X_SNAN): Redefine.
gcc/c-family/
* c-common.h (enum rid): Add RID_DFLOAT64X.
* c-common.cc (c_global_trees): Fix comment typo.  Add
dfloat64x_type_node.
(c_common_nodes_and_builtins): Handle RID_DFLOAT64X.
* c-cppbuiltin.cc (c_cpp_builtins): Call
builtin_define_decimal_float_constants also for dfloat64x_type_node
if non-NULL.
* c-lex.cc (interpret_float): Handle d64x suffixes.
* c-pretty-print.cc (pp_c_floating_constant): Print d64x suffixes
on dfloat64x_type_node typed constants.
gcc/c/
* c-tree.h (enum c_typespec_keyword): Add cts_dfloat64x and adjust
comment.
* c-parser.cc (c_keyword_starts_typename, c_token_starts_declspecs,
c_parser_declspecs, c_parser_gnu_attribute_any_word): Handle
RID_DFLOAT64X.
(c_parser_postfix_expression): Handle _Decimal64x arguments in
__builtin_tgmath.
(warn_for_abs): Handle BUILT_IN_FABSD64X.
* c-decl.cc (declspecs_add_type): Handle cts_dfloat64x and
RID_DFLOAT64X.
(finish_declspecs): Handle cts_dfloat64x.
* c-typeck.cc (c_common_type): Handle dfloat64x_type_node.
gcc/testsuite/
* gcc.dg/dfp/c11-decimal64x-1.c: New test.
* gcc.dg/dfp/c11-decimal64x-2.c: New test.
* gcc.dg/dfp/c23-decimal64x-1.c: New test.
* gcc.dg/dfp/c23-decimal64x-2.c: New test.
* gcc.dg/dfp/c23-decimal64x-3.c: New test.
* gcc.dg/dfp/c23-decimal64x-4.c: New test.
libcpp/
* expr.cc (interpret_float_suffix): Handle d64x and D64x
suffixes, adjust comment.

8 months agotestsuite: fix g++.dg/tree-ssa/pr58483.C
Marek Polacek [Fri, 15 Nov 2024 05:02:44 +0000 (00:02 -0500)] 
testsuite: fix g++.dg/tree-ssa/pr58483.C

This test mistakenly used two dg-do compile.  Since it passes
in C++11 as well, we can run it in C++11 and up.

gcc/testsuite/ChangeLog:

* g++.dg/tree-ssa/pr58483.C: Run in C++11 and up.

8 months agoRISC-V: Move scalar SAT_ADD test cases to a isolated folder
Pan Li [Fri, 15 Nov 2024 03:42:13 +0000 (11:42 +0800)] 
RISC-V: Move scalar SAT_ADD test cases to a isolated folder

Move the scalar SAT_ADD includes both the signed and unsigned
integer to the folder gcc.target/riscv/sat.  According to the
implementation the below options will be appended for each
test cases.

* -O2
* -O3
* -Ofast
* -Os
* -Oz

Then we can see the test log similar as below:

Executing on host: .../sat_s_add-1-i8.c ...  -O2 -march=rv64gc -S -o sat_s_add-1-i8.s
Executing on host: .../sat_s_add-1-i8.c ...  -O3 -march=rv64gc -S -o sat_s_add-1-i8.s
Executing on host: .../sat_s_add-1-i8.c ...  -Ofast -march=rv64gc -S -o sat_s_add-1-i8.s
Executing on host: .../sat_s_add-1-i8.c ...  -Oz -march=rv64gc -S -o sat_s_add-1-i8.s
Executing on host: .../sat_s_add-1-i8.c ...  -Os -march=rv64gc -S -o sat_s_add-1-i8.s

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

Committed as pre-approved by kito.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/riscv.exp: Add new folder sat under riscv
and add 5 options for each sat test.
* gcc.target/riscv/sat_s_add-1-i16.c: Move to...
* gcc.target/riscv/sat/sat_s_add-1-i16.c: ...here.
* gcc.target/riscv/sat_s_add-1-i32.c: Move to...
* gcc.target/riscv/sat/sat_s_add-1-i32.c: ...here.
* gcc.target/riscv/sat_s_add-1-i64.c: Move to...
* gcc.target/riscv/sat/sat_s_add-1-i64.c: ...here.
* gcc.target/riscv/sat_s_add-1-i8.c: Move to...
* gcc.target/riscv/sat/sat_s_add-1-i8.c: ...here.
* gcc.target/riscv/sat_s_add-2-i16.c: Move to...
* gcc.target/riscv/sat/sat_s_add-2-i16.c: ...here.
* gcc.target/riscv/sat_s_add-2-i32.c: Move to...
* gcc.target/riscv/sat/sat_s_add-2-i32.c: ...here.
* gcc.target/riscv/sat_s_add-2-i64.c: Move to...
* gcc.target/riscv/sat/sat_s_add-2-i64.c: ...here.
* gcc.target/riscv/sat_s_add-2-i8.c: Move to...
* gcc.target/riscv/sat/sat_s_add-2-i8.c: ...here.
* gcc.target/riscv/sat_s_add-3-i16.c: Move to...
* gcc.target/riscv/sat/sat_s_add-3-i16.c: ...here.
* gcc.target/riscv/sat_s_add-3-i32.c: Move to...
* gcc.target/riscv/sat/sat_s_add-3-i32.c: ...here.
* gcc.target/riscv/sat_s_add-3-i64.c: Move to...
* gcc.target/riscv/sat/sat_s_add-3-i64.c: ...here.
* gcc.target/riscv/sat_s_add-3-i8.c: Move to...
* gcc.target/riscv/sat/sat_s_add-3-i8.c: ...here.
* gcc.target/riscv/sat_s_add-4-i16.c: Move to...
* gcc.target/riscv/sat/sat_s_add-4-i16.c: ...here.
* gcc.target/riscv/sat_s_add-4-i32.c: Move to...
* gcc.target/riscv/sat/sat_s_add-4-i32.c: ...here.
* gcc.target/riscv/sat_s_add-4-i64.c: Move to...
* gcc.target/riscv/sat/sat_s_add-4-i64.c: ...here.
* gcc.target/riscv/sat_s_add-4-i8.c: Move to...
* gcc.target/riscv/sat/sat_s_add-4-i8.c: ...here.
* gcc.target/riscv/sat_s_add-run-1-i16.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-1-i16.c: ...here.
* gcc.target/riscv/sat_s_add-run-1-i32.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-1-i32.c: ...here.
* gcc.target/riscv/sat_s_add-run-1-i64.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-1-i64.c: ...here.
* gcc.target/riscv/sat_s_add-run-1-i8.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-1-i8.c: ...here.
* gcc.target/riscv/sat_s_add-run-2-i16.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-2-i16.c: ...here.
* gcc.target/riscv/sat_s_add-run-2-i32.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-2-i32.c: ...here.
* gcc.target/riscv/sat_s_add-run-2-i64.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-2-i64.c: ...here.
* gcc.target/riscv/sat_s_add-run-2-i8.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-2-i8.c: ...here.
* gcc.target/riscv/sat_s_add-run-3-i16.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-3-i16.c: ...here.
* gcc.target/riscv/sat_s_add-run-3-i32.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-3-i32.c: ...here.
* gcc.target/riscv/sat_s_add-run-3-i64.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-3-i64.c: ...here.
* gcc.target/riscv/sat_s_add-run-3-i8.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-3-i8.c: ...here.
* gcc.target/riscv/sat_s_add-run-4-i16.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-4-i16.c: ...here.
* gcc.target/riscv/sat_s_add-run-4-i32.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-4-i32.c: ...here.
* gcc.target/riscv/sat_s_add-run-4-i64.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-4-i64.c: ...here.
* gcc.target/riscv/sat_s_add-run-4-i8.c: Move to...
* gcc.target/riscv/sat/sat_s_add-run-4-i8.c: ...here.
* gcc.target/riscv/sat_s_add_imm-1-1.c: Move to...
* gcc.target/riscv/sat/sat_s_add_imm-1-1.c: ...here.
* gcc.target/riscv/sat_s_add_imm-1.c: Move to...
* gcc.target/riscv/sat/sat_s_add_imm-1.c: ...here.
* gcc.target/riscv/sat_s_add_imm-2-1.c: Move to...
* gcc.target/riscv/sat/sat_s_add_imm-2-1.c: ...here.
* gcc.target/riscv/sat_s_add_imm-2.c: Move to...
* gcc.target/riscv/sat/sat_s_add_imm-2.c: ...here.
* gcc.target/riscv/sat_s_add_imm-3-1.c: Move to...
* gcc.target/riscv/sat/sat_s_add_imm-3-1.c: ...here.
* gcc.target/riscv/sat_s_add_imm-3.c: Move to...
* gcc.target/riscv/sat/sat_s_add_imm-3.c: ...here.
* gcc.target/riscv/sat_s_add_imm-4.c: Move to...
* gcc.target/riscv/sat/sat_s_add_imm-4.c: ...here.
* gcc.target/riscv/sat_s_add_imm-run-1.c: Move to...
* gcc.target/riscv/sat/sat_s_add_imm-run-1.c: ...here.
* gcc.target/riscv/sat_s_add_imm-run-2.c: Move to...
* gcc.target/riscv/sat/sat_s_add_imm-run-2.c: ...here.
* gcc.target/riscv/sat_s_add_imm-run-3.c: Move to...
* gcc.target/riscv/sat/sat_s_add_imm-run-3.c: ...here.
* gcc.target/riscv/sat_s_add_imm-run-4.c: Move to...
* gcc.target/riscv/sat/sat_s_add_imm-run-4.c: ...here.
* gcc.target/riscv/sat_u_add-1-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add-1-u16.c: ...here.
* gcc.target/riscv/sat_u_add-1-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add-1-u32.c: ...here.
* gcc.target/riscv/sat_u_add-1-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add-1-u64.c: ...here.
* gcc.target/riscv/sat_u_add-1-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add-1-u8.c: ...here.
* gcc.target/riscv/sat_u_add-2-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add-2-u16.c: ...here.
* gcc.target/riscv/sat_u_add-2-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add-2-u32.c: ...here.
* gcc.target/riscv/sat_u_add-2-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add-2-u64.c: ...here.
* gcc.target/riscv/sat_u_add-2-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add-2-u8.c: ...here.
* gcc.target/riscv/sat_u_add-3-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add-3-u16.c: ...here.
* gcc.target/riscv/sat_u_add-3-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add-3-u32.c: ...here.
* gcc.target/riscv/sat_u_add-3-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add-3-u64.c: ...here.
* gcc.target/riscv/sat_u_add-3-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add-3-u8.c: ...here.
* gcc.target/riscv/sat_u_add-4-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add-4-u16.c: ...here.
* gcc.target/riscv/sat_u_add-4-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add-4-u32.c: ...here.
* gcc.target/riscv/sat_u_add-4-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add-4-u64.c: ...here.
* gcc.target/riscv/sat_u_add-4-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add-4-u8.c: ...here.
* gcc.target/riscv/sat_u_add-5-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add-5-u16.c: ...here.
* gcc.target/riscv/sat_u_add-5-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add-5-u32.c: ...here.
* gcc.target/riscv/sat_u_add-5-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add-5-u64.c: ...here.
* gcc.target/riscv/sat_u_add-5-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add-5-u8.c: ...here.
* gcc.target/riscv/sat_u_add-6-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add-6-u16.c: ...here.
* gcc.target/riscv/sat_u_add-6-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add-6-u32.c: ...here.
* gcc.target/riscv/sat_u_add-6-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add-6-u64.c: ...here.
* gcc.target/riscv/sat_u_add-6-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add-6-u8.c: ...here.
* gcc.target/riscv/sat_u_add-run-1-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-1-u16.c: ...here.
* gcc.target/riscv/sat_u_add-run-1-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-1-u32.c: ...here.
* gcc.target/riscv/sat_u_add-run-1-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-1-u64.c: ...here.
* gcc.target/riscv/sat_u_add-run-1-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-1-u8.c: ...here.
* gcc.target/riscv/sat_u_add-run-2-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-2-u16.c: ...here.
* gcc.target/riscv/sat_u_add-run-2-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-2-u32.c: ...here.
* gcc.target/riscv/sat_u_add-run-2-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-2-u64.c: ...here.
* gcc.target/riscv/sat_u_add-run-2-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-2-u8.c: ...here.
* gcc.target/riscv/sat_u_add-run-3-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-3-u16.c: ...here.
* gcc.target/riscv/sat_u_add-run-3-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-3-u32.c: ...here.
* gcc.target/riscv/sat_u_add-run-3-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-3-u64.c: ...here.
* gcc.target/riscv/sat_u_add-run-3-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-3-u8.c: ...here.
* gcc.target/riscv/sat_u_add-run-4-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-4-u16.c: ...here.
* gcc.target/riscv/sat_u_add-run-4-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-4-u32.c: ...here.
* gcc.target/riscv/sat_u_add-run-4-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-4-u64.c: ...here.
* gcc.target/riscv/sat_u_add-run-4-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-4-u8.c: ...here.
* gcc.target/riscv/sat_u_add-run-5-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-5-u16.c: ...here.
* gcc.target/riscv/sat_u_add-run-5-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-5-u32.c: ...here.
* gcc.target/riscv/sat_u_add-run-5-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-5-u64.c: ...here.
* gcc.target/riscv/sat_u_add-run-5-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-5-u8.c: ...here.
* gcc.target/riscv/sat_u_add-run-6-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-6-u16.c: ...here.
* gcc.target/riscv/sat_u_add-run-6-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-6-u32.c: ...here.
* gcc.target/riscv/sat_u_add-run-6-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-6-u64.c: ...here.
* gcc.target/riscv/sat_u_add-run-6-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add-run-6-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-1-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-1-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-1-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-1-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-1-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-1-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-1-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-1-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-2-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-2-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-2-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-2-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-2-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-2-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-2-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-2-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-3-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-3-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-3-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-3-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-3-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-3-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-3-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-3-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-4-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-4-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-4-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-4-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-4-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-4-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-4-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-4-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-1-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-1-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-1-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-1-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-1-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-1-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-1-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-1-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-2-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-2-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-2-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-2-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-2-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-2-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-2-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-2-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-3-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-3-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-3-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-3-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-3-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-3-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-3-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-3-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-4-u16.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-4-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-4-u32.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-4-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-4-u64.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-4-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-4-u8.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm-run-4-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-1.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-1.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-10.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-10.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-11.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-11.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-12.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-12.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-13.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-13.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-14.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-14.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-15.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-15.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-16.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-16.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-17.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-17.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-18.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-18.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-19.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-19.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-2.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-2.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-20.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-20.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-21.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-21.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-22.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-22.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-23.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-23.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-24.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-24.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-25.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-25.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-26.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-26.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-27.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-27.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-28.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-28.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-29.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-29.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-3.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-3.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-30.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-30.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-31.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-31.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-32.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-32.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-33.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-33.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-34.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-34.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-35.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-35.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-36.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-36.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-37.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-37.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-38.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-38.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-39.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-39.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-4.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-4.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-40.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-40.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-41.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-41.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-42.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-42.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-43.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-43.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-44.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-44.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-45.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-45.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-46.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-46.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-47.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-47.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-48.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-48.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-49.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-49.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-5.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-5.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-50.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-50.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-51.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-51.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-52.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-52.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-53.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-53.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-54.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-54.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-55.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-55.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-56.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-56.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-57.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-57.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-58.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-58.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-59.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-59.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-6.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-6.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-60.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-60.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-7.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-7.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-8.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-8.c: ...here.
* gcc.target/riscv/sat_u_add_imm_type_check-9.c: Move to...
* gcc.target/riscv/sat/sat_u_add_imm_type_check-9.c: ...here.
* gcc.target/riscv/sat/sat_arith.h: New test.
* gcc.target/riscv/sat/sat_arith_data.h: New test.
* gcc.target/riscv/sat/scalar_sat_binary.h: New test.
* gcc.target/riscv/sat/scalar_sat_binary_run_xxx.h: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
8 months agors6000: Rework vector integer comparison in rs6000_emit_vector_compare - p5
Kewen Lin [Fri, 15 Nov 2024 03:46:33 +0000 (03:46 +0000)] 
rs6000: Rework vector integer comparison in rs6000_emit_vector_compare - p5

The current handlings in rs6000_emit_vector_compare is a bit
complicated to me, especially after we emit vector float
comparison insn with the given code directly.  So it's better
to refactor the handlings of vector integer comparison here.

This is part 5, it's to refactor all the handlings of vector
integer comparison to make it neat.  This patch doesn't
introduce any functionality change.

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_emit_vector_compare): Refactor the
handlings of vector integer comparison.

8 months agors6000: Rework vector integer comparison in rs6000_emit_vector_compare - p4
Kewen Lin [Fri, 15 Nov 2024 03:46:33 +0000 (03:46 +0000)] 
rs6000: Rework vector integer comparison in rs6000_emit_vector_compare - p4

The current handlings in rs6000_emit_vector_compare is a bit
complicated to me, especially after we emit vector float
comparison insn with the given code directly.  So it's better
to refactor the handlings of vector integer comparison here.

This is part 4, it's to rework the handlings on GE/GEU/LE/LEU,
also make the function not recursive any more.  This patch
doesn't introduce any functionality change.

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_emit_vector_compare): Refine the
handlings for operators GE/GEU/LE/LEU.

8 months agors6000: Rework vector integer comparison in rs6000_emit_vector_compare - p3
Kewen Lin [Fri, 15 Nov 2024 03:46:33 +0000 (03:46 +0000)] 
rs6000: Rework vector integer comparison in rs6000_emit_vector_compare - p3

The current handlings in rs6000_emit_vector_compare is a bit
complicated to me, especially after we emit vector float
comparison insn with the given code directly.  So it's better
to refactor the handlings of vector integer comparison here.

This is part 3, it's to refactor the handlings on NE.
This patch doesn't introduce any functionality change.

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_emit_vector_compare): Refactor the
handlings for operator NE.

8 months agors6000: Rework vector integer comparison in rs6000_emit_vector_compare - p2
Kewen Lin [Fri, 15 Nov 2024 03:46:33 +0000 (03:46 +0000)] 
rs6000: Rework vector integer comparison in rs6000_emit_vector_compare - p2

The current handlings in rs6000_emit_vector_compare is a bit
complicated to me, especially after we emit vector float
comparison insn with the given code directly.  So it's better
to refactor the handlings of vector integer comparison here.

This is part 2, it's to refactor the handlings on LT and LTU.
This patch doesn't introduce any functionality change.

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_emit_vector_compare): Refine the
handlings for operators LT and LTU.

8 months agors6000: Rework vector integer comparison in rs6000_emit_vector_compare - p1
Kewen Lin [Fri, 15 Nov 2024 03:46:33 +0000 (03:46 +0000)] 
rs6000: Rework vector integer comparison in rs6000_emit_vector_compare - p1

The current handlings in rs6000_emit_vector_compare is a bit
complicated to me, especially after we emit vector float
comparison insn with the given code directly.  So it's better
to refactor the handlings of vector integer comparison here.

This is part 1, it's to remove the helper function
rs6000_emit_vector_compare_inner and move the logics into
rs6000_emit_vector_compare.  This patch doesn't introduce any
functionality change.

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_emit_vector_compare_inner): Remove.
(rs6000_emit_vector_compare): Emit rtx comparison for operators EQ/
GT/GTU directly.

8 months agors6000: Rework vector float comparison in rs6000_emit_vector_compare - p4
Kewen Lin [Fri, 15 Nov 2024 03:46:33 +0000 (03:46 +0000)] 
rs6000: Rework vector float comparison in rs6000_emit_vector_compare - p4

All kinds of vector float comparison operators have been
supported in a rtl comparison pattern as vector.md, we can
just emit an rtx comparison insn with the given comparison
operator in function rs6000_emit_vector_compare instead of
checking and handling the reverse condition cases.

This is part 4, it further checks for comparison opeators
LT/UNGE.  In rs6000_emit_vector_compare, for the handling
of LT, it switches to use code GT, swaps operands and try
again, it's exactly the same as what we have in vector.md:

; lt(a,b)   = gt(b,a)

As to UNGE, in rs6000_emit_vector_compare, it uses reversed
code LT and further operates on the result with one_cmpl,
it's also the same as what's in vector.md:

; unge(a,b) = ~lt(a,b)

This patch should not have any functionality change too.

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_emit_vector_compare_inner): Emit rtx
comparison for operators LT/UNGE of MODE_VECTOR_FLOAT directly.
(rs6000_emit_vector_compare): Move assertion of no MODE_VECTOR_FLOAT to
function beginning.

8 months agors6000: Rework vector float comparison in rs6000_emit_vector_compare - p3
Kewen Lin [Fri, 15 Nov 2024 03:46:32 +0000 (03:46 +0000)] 
rs6000: Rework vector float comparison in rs6000_emit_vector_compare - p3

All kinds of vector float comparison operators have been
supported in a rtl comparison pattern as vector.md, we can
just emit an rtx comparison insn with the given comparison
operator in function rs6000_emit_vector_compare instead of
checking and handling the reverse condition cases.

This is part 3, it further checks for comparison opeators
LE/UNGT.  In rs6000_emit_vector_compare, UNGT is handled
with reversed code LE and inverting with one_cmpl_optab,
LE is handled with LT ior EQ, while in vector.md, we have
the support:

; le(a,b)   = ge(b,a)
; ungt(a,b) = ~le(a,b)

The associated test case shows it's an improvement.

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_emit_vector_compare): Emit rtx
comparison for operators LE/UNGT of MODE_VECTOR_FLOAT directly.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/vcond-fp.c: New test.

8 months agors6000: Rework vector float comparison in rs6000_emit_vector_compare - p2
Kewen Lin [Fri, 15 Nov 2024 03:46:32 +0000 (03:46 +0000)] 
rs6000: Rework vector float comparison in rs6000_emit_vector_compare - p2

All kinds of vector float comparison operators have been
supported in a rtl comparison pattern as vector.md, we can
just emit an rtx comparison insn with the given comparison
operator in function rs6000_emit_vector_compare instead of
checking and handling the reverse condition cases.

This is part 2, it further checks for comparison opeators
NE/UNLE/UNLT.  In rs6000_emit_vector_compare, they are
handled with reversed code which is queried from function
reverse_condition_maybe_unordered and inverting with
one_cmpl_optab.  It's the same as what we have in vector.md:

; ne(a,b)   = ~eq(a,b)
; unle(a,b) = ~gt(a,b)
; unlt(a,b) = ~ge(a,b)

The operators on the right side have been supported in part 1.
This patch should not have any functionality change too.

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_emit_vector_compare): Emit rtx
comparison for operators NE/UNLE/UNLT of MODE_VECTOR_FLOAT directly.

8 months agors6000: Rework vector float comparison in rs6000_emit_vector_compare - p1
Kewen Lin [Fri, 15 Nov 2024 03:46:32 +0000 (03:46 +0000)] 
rs6000: Rework vector float comparison in rs6000_emit_vector_compare - p1

All kinds of vector float comparison operators have been
supported in a rtl comparison pattern as vector.md, we can
just emit an rtx comparison insn with the given comparison
operator in function rs6000_emit_vector_compare instead of
checking and handling the reverse condition cases.

This is part 1, it only handles the operators which are
already emitted with an rtx comparison previously in function
rs6000_emit_vector_compare_inner, they are EQ/GT/GE/ORDERED/
UNORDERED/UNEQ/LTGT.  There is no functionality change.

With this change, rs6000_emit_vector_compare_inner would
only work for vector integer comparison handling, it would
be cleaned up later in vector integer comparison rework.

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_emit_vector_compare_inner): Move
MODE_VECTOR_FLOAT handlings out.
(rs6000_emit_vector_compare): Emit rtx comparison for operators EQ/GT/
GE/UNORDERED/ORDERED/UNEQ/LTGT of MODE_VECTOR_FLOAT directly, and
adjust one call site of rs6000_emit_vector_compare_inner to
rs6000_emit_vector_compare.

8 months agoDaily bump.
GCC Administrator [Fri, 15 Nov 2024 00:16:23 +0000 (00:16 +0000)] 
Daily bump.

8 months agolibstdc++: Fix indentation in std::list::emplace_back
Jonathan Wakely [Fri, 15 Nov 2024 00:00:38 +0000 (00:00 +0000)] 
libstdc++: Fix indentation in std::list::emplace_back

libstdc++-v3/ChangeLog:

* include/bits/stl_list.h (list::emplace_back): Fix indentation.

8 months ago[RISC-V][V2] Fix type on vector move patterns
Jeff Law [Thu, 14 Nov 2024 23:57:50 +0000 (16:57 -0700)] 
[RISC-V][V2] Fix type on vector move patterns

Updated version of my prior patch to fix type attributes on the
pre-allocation vector move pattern.  This version just adds a suitable
set of attributes to a second pattern that was obviously wrong.

Passed on my tester for rv64 and rv32 crosses.  Bootstrapped and
regression tested on riscv64-linux-gnu as well.

--

So I was looking into a horrific schedule for SAD a week or so ago and
came across this gem.

Basically we were treating a vector load as a vector move from a
scheduling standpoint during sched1.  Naturally we didn't expose much
ILP during sched1.  That in turn caused the register allocator to pack
the pseudos onto the physical vector registers tightly.  regrename
didn't do anything useful and the resulting code had too many false
dependencies for sched2 to do anything useful.

As a result we were taking many load->use stalls in x264's SAD routine.

I'm confident the types are fine, but I'm a lot less sure about the
other attributes (mode, avl_type_index, mode_idx).  If someone could
take a look at that, it'd be greatly appreciated.

There's other cases that may need similar treatment.  But I didn't want
to muck with them until I understood those other attributes and how they
need adjustments.

In particular mov<VLS_AVL_REG:mode><P:mode>_lra appears to have the same
problem.

--

gcc/
* config/riscv/vector.md (mov<mode> pattern/splitter): Fix type and
other attributes.
(mov<VLS_AVL_REG:mode><P:mode>_lra): Likewise.

8 months agoFortran: fix passing of NULL() actual argument to character dummy [PR104819]
Harald Anlauf [Thu, 14 Nov 2024 20:38:04 +0000 (21:38 +0100)] 
Fortran: fix passing of NULL() actual argument to character dummy [PR104819]

Ensure that character length is set and passed by the call to a procedure
when its dummy argument is NULL() with MOLD argument present, or set length
to either 0 or the callee's expected character length.  For assumed-rank
dummies, use the rank of the MOLD argument.  Generate temporaries for
passed arguments when needed.

PR fortran/104819

gcc/fortran/ChangeLog:

* trans-expr.cc (conv_null_actual): Helper function to handle
passing of NULL() to non-optional dummy arguments of non-bind(c)
procedures.
(gfc_conv_procedure_call): Use it for character dummies.

gcc/testsuite/ChangeLog:

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

8 months agogcc: regenerate configure
Sam James [Thu, 14 Nov 2024 20:52:43 +0000 (20:52 +0000)] 
gcc: regenerate configure

r15-5257-g56ded80b96b0f6 didn't regenerate configure correctly.

See https://inbox.sourceware.org/gcc-patches/ZzZf69gORVPRo6Ct@zen.kayari.org/.

gcc/ChangeLog:

* configure: Regenerate.

8 months agoThe fix for PR117191
Denis Chertykov [Thu, 14 Nov 2024 20:50:36 +0000 (00:50 +0400)] 
The fix for PR117191

Wrong code appears after dse2 pass because it removes necessary insns.
(ie insn 554 - store to frame spill slot)
This happened because LRA pass doesn't cleanup the code exactly like reload does.
The reload1.c has a special pass for such cleanup.
The reload removes CLOBBER insns with spill slots like this:
(insn 202 184 186 7 (clobber (mem/c:TI (plus:HI (reg/f:HI 28 r28)
                (const_int 1 [0x1])) [3 %sfp+1 S16 A8])) -1
     (nil))

Fragment from reload1.c:
--------------------------------------------------------------------------------
  reload_completed = 1;

  /* Make a pass over all the insns and delete all USEs which we inserted
     only to tag a REG_EQUAL note on them.  Remove all REG_DEAD and REG_UNUSED
     notes.  Delete all CLOBBER insns, except those that refer to the return
     value and the special mem:BLK CLOBBERs added to prevent the scheduler
     from misarranging variable-array code, and simplify (subreg (reg))
     operands.  Strip and regenerate REG_INC notes that may have been moved
     around.  */

  for (insn = first; insn; insn = NEXT_INSN (insn))
    if (INSN_P (insn))
      {
rtx *pnote;

if (CALL_P (insn))
  replace_pseudos_in (& CALL_INSN_FUNCTION_USAGE (insn),
      VOIDmode, CALL_INSN_FUNCTION_USAGE (insn));

if ((GET_CODE (PATTERN (insn)) == USE
     /* We mark with QImode USEs introduced by reload itself.  */
     && (GET_MODE (insn) == QImode
 || find_reg_note (insn, REG_EQUAL, NULL_RTX)))
    || (GET_CODE (PATTERN (insn)) == CLOBBER
&& (!MEM_P (XEXP (PATTERN (insn), 0))
    || GET_MODE (XEXP (PATTERN (insn), 0)) != BLKmode
    || (GET_CODE (XEXP (XEXP (PATTERN (insn), 0), 0)) != SCRATCH
&& XEXP (XEXP (PATTERN (insn), 0), 0)
!= stack_pointer_rtx))
&& (!REG_P (XEXP (PATTERN (insn), 0))
    || ! REG_FUNCTION_VALUE_P (XEXP (PATTERN (insn), 0)))))
  {
    delete_insn (insn);
    continue;
  }
--------------------------------------------------------------------------------

LRA have a similar place where it removes unnecessary insns, but not CLOBBER insns with
memory spill slots. It's `lra_final_code_change' function.

I just mark a CLOBBER insn with pseudo spilled to memory for removing it later together
with LRA temporary CLOBBER insns.

PR rtl-optimization/117191
gcc/
* lra-spills.cc (spill_pseudos): Mark a CLOBBER insn with pseudo
spilled to memory for removing it later together with LRA temporary
CLOBBER insns.

8 months agolibstdc++: Make equal and is_permutation short-circuit (LWG 3560)
Jonathan Wakely [Thu, 14 Nov 2024 16:57:17 +0000 (16:57 +0000)] 
libstdc++: Make equal and is_permutation short-circuit (LWG 3560)

We already implement short-circuiting for random access iterators, but
we also need to do so for ranges::equal and ranges::is_permutation when
given sized ranges that are not random access ranges (e.g. std::list).

libstdc++-v3/ChangeLog:

* include/bits/ranges_algo.h (__is_permutation_fn::operator()):
Short-circuit for sized ranges with different sizes, as per LWG
3560.
* include/bits/ranges_algobase.h (__equal_fn::operator()):
Likewise.
* include/bits/stl_algo.h (__is_permutation): Use if-constexpr
for random access iterator branches.
* include/bits/stl_algobase.h (__equal4): Likewise.
* testsuite/25_algorithms/equal/lwg3560.cc: New test.
* testsuite/25_algorithms/is_permutation/lwg3560.cc: New test.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
8 months agoipa: Rationalize IPA-VR computations across pass-through jump functions
Martin Jambor [Thu, 14 Nov 2024 19:55:06 +0000 (20:55 +0100)] 
ipa: Rationalize IPA-VR computations across pass-through jump functions

Currently ipa_value_range_from_jfunc and
propagate_vr_across_jump_function contain similar but not same code
for dealing with pass-through jump functions.  This patch puts these
common bits into one function which can also handle comparison
operations.

gcc/ChangeLog:

2024-11-01  Martin Jambor  <mjambor@suse.cz>

PR ipa/114985
* ipa-cp.cc (ipa_vr_intersect_with_arith_jfunc): New function.
(ipa_value_range_from_jfunc): Move the common functionality to the
above new function, adjust the rest so that it works with it well.
(propagate_vr_across_jump_function): Likewise.

8 months agolibstdc++: Implement LWG 3563 changes to keys_view and values_view
Patrick Palka [Thu, 14 Nov 2024 18:27:41 +0000 (13:27 -0500)] 
libstdc++: Implement LWG 3563 changes to keys_view and values_view

This LWG issue corrects the definition of these alias templates to make
them suitable for alias CTAD.

libstdc++-v3/ChangeLog:

* include/std/ranges (keys_view): Adjust as per LWG 3563.
(values_view): Likewise.
* testsuite/std/ranges/adaptors/elements.cc (test08): New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
8 months agolibstdc++: Fix get<0> constraint for lvalue ranges::subrange (LWG 3589)
Jonathan Wakely [Thu, 14 Nov 2024 17:31:43 +0000 (17:31 +0000)] 
libstdc++: Fix get<0> constraint for lvalue ranges::subrange (LWG 3589)

Apprived at October 2021 plenary.

libstdc++-v3/ChangeLog:

* include/bits/ranges_util.h (subrange::begin): Fix constraint,
as per LWG 3589.
* testsuite/std/ranges/subrange/lwg3589.cc: New test.

8 months agoDaily bump.
GCC Administrator [Thu, 14 Nov 2024 17:20:15 +0000 (17:20 +0000)] 
Daily bump.

8 months agocontrib: Add another ignored commit
Jeff Law [Thu, 14 Nov 2024 17:14:53 +0000 (10:14 -0700)] 
contrib: Add another ignored commit

* gcc-changelog/git_update_version.py (ignored_commits): Add
another ignored commit.

8 months agolibstdc++: Make _GLIBCXX_NODISCARD work for C++11 and C++14
Jonathan Wakely [Mon, 26 Feb 2024 11:40:46 +0000 (11:40 +0000)] 
libstdc++: Make _GLIBCXX_NODISCARD work for C++11 and C++14

The _GLIBCXX_NODISCARD macro only expands to [[__nodiscard__]] for C++17
and later, but all supported compilers will allow us to use that for
C++11 and C++14 too. Enable it for those older standards, to give
improved diagnostics for users of those older standards.

libstdc++-v3/ChangeLog:

* include/bits/c++config (_GLIBCXX_NODISCARD): Expand for C++11
and C++14.
* testsuite/22_locale/locale/cons/12438.cc: Adjust dg-warning to
expect nodiscard warnings for C++11 and C++14 as well.
* testsuite/22_locale/locale/operations/2.cc: Likewise.
* testsuite/25_algorithms/equal/debug/1_neg.cc: Likewise.
* testsuite/25_algorithms/equal/debug/2_neg.cc: Likewise.
* testsuite/25_algorithms/equal/debug/3_neg.cc: Likewise.
* testsuite/25_algorithms/find_first_of/concept_check_1.cc:
Likewise.
* testsuite/25_algorithms/is_permutation/2.cc: Likewise.
* testsuite/25_algorithms/lexicographical_compare/71545.cc:
Likewise.
* testsuite/25_algorithms/lower_bound/33613.cc: Likewise.
* testsuite/25_algorithms/lower_bound/debug/irreflexive.cc:
Likewise.
* testsuite/25_algorithms/lower_bound/debug/partitioned_neg.cc:
Likewise.
* testsuite/25_algorithms/lower_bound/debug/partitioned_pred_neg.cc: Likewise.
* testsuite/25_algorithms/minmax/3.cc: Likewise.
* testsuite/25_algorithms/search/78346.cc: Likewise.
* testsuite/25_algorithms/search_n/58358.cc: Likewise.
* testsuite/25_algorithms/unique/1.cc: Likewise.
* testsuite/25_algorithms/unique/11480.cc: Likewise.
* testsuite/25_algorithms/upper_bound/33613.cc: Likewise.
* testsuite/25_algorithms/upper_bound/debug/partitioned_neg.cc:
Likewise.
* testsuite/25_algorithms/upper_bound/debug/partitioned_pred_neg.cc: Likewise.
* testsuite/27_io/ios_base/types/fmtflags/bitmask_operators.cc:
Likewise.
* testsuite/27_io/ios_base/types/iostate/bitmask_operators.cc:
Likewise.
* testsuite/27_io/ios_base/types/openmode/bitmask_operators.cc:
Likewise.
* testsuite/ext/concept_checks.cc: Likewise.
* testsuite/ext/is_heap/47709.cc: Likewise.
* testsuite/ext/is_sorted/cxx0x.cc: Likewise.

8 months agocontrib: Add 2 further ignored commits
Jeff Law [Thu, 14 Nov 2024 16:43:37 +0000 (09:43 -0700)] 
contrib: Add 2 further ignored commits

I goof'd and double-reverted a change.  Add those to the ignore
list, leaving the final reversion as-is.

* gcc-changelog/git_update_version.py (ignored_commits): Add 2
further commits.

8 months agolibstdc++: stdc++.h and <coroutine>
Jason Merrill [Thu, 14 Nov 2024 04:39:53 +0000 (23:39 -0500)] 
libstdc++: stdc++.h and <coroutine>

r13-3036 moved #include <coroutine> into the new freestanding section, but
also moved it from a C++20 section to a C++23 section.  This patch moves it
back.

Incidentally, I'm curious why a few headers were removed from the hosted
section (including <coroutine>), but most were left in place, so we have
redundant includes of most hosted headers.

libstdc++-v3/ChangeLog:

* include/precompiled/stdc++.h: <coroutine> is C++20.

8 months agoc++: fix namespace alias export
Jason Merrill [Tue, 12 Nov 2024 21:04:52 +0000 (16:04 -0500)] 
c++: fix namespace alias export

This affected std::views in module std.

gcc/cp/ChangeLog:

* name-lookup.cc (do_namespace_alias): set_originating_module after
pushdecl.

gcc/testsuite/ChangeLog:

* g++.dg/modules/namespace-7_a.C: New test.
* g++.dg/modules/namespace-7_b.C: New test.

8 months agoc++: module dialect tweak
Jason Merrill [Tue, 12 Nov 2024 00:27:52 +0000 (19:27 -0500)] 
c++: module dialect tweak

Coroutines have been enabled by -std=c++20 since GCC 11.

gcc/cp/ChangeLog:

* module.cc (module_state_config::get_dialect): Expect coroutines in
C++20.

8 months agoFix common.opt.urls
Jan Hubicka [Thu, 14 Nov 2024 16:29:14 +0000 (17:29 +0100)] 
Fix common.opt.urls

gcc/ChangeLog:

* common.opt.urls: Fix.

8 months agoRevert "Reapply "[PATCH v2] RISC-V: zero_extend(not) -> xor optimization [PR112398]""
Jeff Law [Thu, 14 Nov 2024 16:26:11 +0000 (09:26 -0700)] 
Revert "Reapply "[PATCH v2] RISC-V: zero_extend(not) -> xor optimization [PR112398]""

This reverts commit 10d76b7f1e5b63ad6d2b92940c39007913ced037.

8 months agoaarch64: Fix nonlocal goto tests incompatible with GCS
Yury Khrustalev [Thu, 14 Nov 2024 16:15:14 +0000 (16:15 +0000)] 
aarch64: Fix nonlocal goto tests incompatible with GCS

gcc/testsuite/ChangeLog:
* gcc.target/aarch64/gcs-nonlocal-3.c: New test.
* gcc.target/aarch64/sme/nonlocal_goto_4.c: Update.
* gcc.target/aarch64/sme/nonlocal_goto_5.c: Update.
* gcc.target/aarch64/sme/nonlocal_goto_6.c: Update.

8 months agoaarch64: Fix tests incompatible with GCS
Matthieu Longo [Thu, 14 Nov 2024 16:15:14 +0000 (16:15 +0000)] 
aarch64: Fix tests incompatible with GCS

gcc/testsuite/ChangeLog:

* g++.target/aarch64/return_address_sign_ab_exception.C: Update.
* gcc.target/aarch64/eh_return.c: Update.

8 months agoaarch64: Add tests and docs for indirect_return attribute
Richard Ball [Thu, 14 Nov 2024 16:15:13 +0000 (16:15 +0000)] 
aarch64: Add tests and docs for indirect_return attribute

This patch adds a new testcase and docs for indirect_return
attribute.

gcc/ChangeLog:

* doc/extend.texi: Add AArch64 docs for indirect_return
attribute.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/indirect_return-1.c: New test.
* gcc.target/aarch64/indirect_return-2.c: New test.
* gcc.target/aarch64/indirect_return-3.c: New test.

Co-authored-by: Yury Khrustalev <yury.khrustalev@arm.com>
8 months agoaarch64: Introduce indirect_return attribute
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:13 +0000 (16:15 +0000)] 
aarch64: Introduce indirect_return attribute

Tail calls of indirect_return functions from non-indirect_return
functions are disallowed even if BTI is disabled, since the call
site may have BTI enabled.

Needed for swapcontext within the same function when GCS is enabled.

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_gnu_attributes): Add
indirect_return.
(aarch64_gen_callee_cookie): Use indirect_return attribute.
(aarch64_callee_indirect_return): New.
(aarch_fun_is_indirect_return): New.
(aarch64_function_ok_for_sibcall): Disallow tail calls if caller
is non-indirect_return but callee is indirect_return.
(aarch64_function_arg): Add indirect_return to cookie.
(aarch64_init_cumulative_args): Record indirect_return in
CUMULATIVE_ARGS.
(aarch64_comp_type_attributes): Check indirect_return attribute.
(aarch64_output_mi_thunk): Add indirect_return to cookie.
* config/aarch64/aarch64.h (CUMULATIVE_ARGS): Add new field
indirect_return.
* config/aarch64/aarch64.md (tlsdesc_small_<mode>): Update.
* config/aarch64/aarch64-opts.h (AARCH64_NUM_ABI_ATTRIBUTES): New.
* config/aarch64/aarch64-protos.h (aarch64_gen_callee_cookie): Update.
* config/arm/aarch-bti-insert.cc (call_needs_bti_j): New.
(rest_of_insert_bti): Use call_needs_bti_j.
* config/arm/aarch-common-protos.h
(aarch_fun_is_indirect_return): New.
* config/arm/arm.cc
(aarch_fun_is_indirect_return): New.

Co-authored-by: Yury Khrustalev <yury.khrustalev@arm.com>
8 months agoaarch64: libatomic: add GCS marking to asm
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:12 +0000 (16:15 +0000)] 
aarch64: libatomic: add GCS marking to asm

libatomic/ChangeLog:

* config/linux/aarch64/atomic_16.S (FEATURE_1_GCS): Define.
(GCS_FLAG): Define if GCS is enabled.
(GNU_PROPERTY): Add GCS_FLAG.

8 months agoaarch64: libgcc: add GCS marking to asm
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:12 +0000 (16:15 +0000)] 
aarch64: libgcc: add GCS marking to asm

libgcc/ChangeLog:

* config/aarch64/aarch64-asm.h (FEATURE_1_GCS): Define.
(GCS_FLAG): Define if GCS is enabled.
(GNU_PROPERTY): Add GCS_FLAG.

8 months agoaarch64: Emit GNU property NOTE for GCS
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:11 +0000 (16:15 +0000)] 
aarch64: Emit GNU property NOTE for GCS

gcc/ChangeLog:

* config/aarch64/aarch64.cc (GNU_PROPERTY_AARCH64_FEATURE_1_GCS):
Define.
(aarch64_file_end_indicate_exec_stack): Set GCS property bit.

8 months agoaarch64: Add GCS support to the unwinder
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:11 +0000 (16:15 +0000)] 
aarch64: Add GCS support to the unwinder

Follows the current linux ABI that uses single signal entry token
and shared shadow stack between thread and alt stack.
Could be behind __ARM_FEATURE_GCS_DEFAULT ifdef (only do anything
special with gcs compat codegen) but there is a runtime check anyway.

Change affected tests to be compatible with -mbranch-protection=standard

libgcc/ChangeLog:

* config/aarch64/aarch64-unwind.h (_Unwind_Frames_Extra): Update.
(_Unwind_Frames_Increment): Define.

8 months agoaarch64: Add target pragma tests for gcs
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:10 +0000 (16:15 +0000)] 
aarch64: Add target pragma tests for gcs

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pragma_cpp_predefs_4.c: Add gcs specific
tests.

8 months agoaarch64: Add test for GCS ACLE defs
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:10 +0000 (16:15 +0000)] 
aarch64: Add test for GCS ACLE defs

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pragma_cpp_predefs_1.c: GCS test.

8 months agoaarch64: Add ACLE feature macros for GCS
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:09 +0000 (16:15 +0000)] 
aarch64: Add ACLE feature macros for GCS

gcc/ChangeLog:

* config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Define
macros for GCS.

8 months agoaarch64: Add non-local goto and jump tests for GCS
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:09 +0000 (16:15 +0000)] 
aarch64: Add non-local goto and jump tests for GCS

These are scan asm tests only, relying on existing execution tests
for runtime coverage.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/gcs-nonlocal-1.c: New test.
* gcc.target/aarch64/gcs-nonlocal-1-track-speculation.c: New test.
* gcc.target/aarch64/gcs-nonlocal-2.c: New test.
* gcc.target/aarch64/gcs-nonlocal-2-track-speculation.c: New test.
* gcc.target/aarch64/gcs-nonlocal-1.h: New header file.
* gcc.target/aarch64/gcs-nonlocal-2.h: New header file.

8 months agoaarch64: Add GCS support for nonlocal stack save
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:08 +0000 (16:15 +0000)] 
aarch64: Add GCS support for nonlocal stack save

Nonlocal stack save and restore has to also save and restore the GCS
pointer. This is used in __builtin_setjmp/longjmp and nonlocal goto.

The GCS specific code is only emitted if GCS branch-protection is
enabled and the code always checks at runtime if GCS is enabled.

The new -mbranch-protection=gcs and old -mbranch-protection=none code
are ABI compatible: jmpbuf for __builtin_setjmp has space for 5
pointers, the layout is

  old layout: fp, pc, sp, unused, unused
  new layout: fp, pc, sp, gcsp, unused

Note: the ILP32 code generation is wrong as it saves the pointers with
Pmode (i.e. 8 bytes per pointer), but the user supplied buffer size is
for 5 pointers (4 bytes per pointer), this is not fixed.

The nonlocal goto has no ABI compatibility issues as the goto and its
destination are in the same translation unit.

We use CDImode to allow extra space for GCS without the effect of 16-byte
alignment.

gcc/ChangeLog:

* config/aarch64/aarch64.h (STACK_SAVEAREA_MODE): Make space for gcs.
* config/aarch64/aarch64.md (save_stack_nonlocal): New.
(restore_stack_nonlocal): New.
* tree-nested.cc (get_nl_goto_field): Updated.

8 months agoaarch64: Add __builtin_aarch64_gcs* and __gcs* tests
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:08 +0000 (16:15 +0000)] 
aarch64: Add __builtin_aarch64_gcs* and __gcs* tests

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/acle/gcs-1.c: New test.
* gcc.target/aarch64/gcspopm-1.c: New test.
* gcc.target/aarch64/gcspr-1.c: New test.
* gcc.target/aarch64/gcsss-1.c: New test.

Co-authored-by: Yury Khrustalev <yury.khrustalev@arm.com>
8 months agoaarch64: Add ACLE __gcs* intrinsics
Yury Khrustalev [Thu, 14 Nov 2024 16:15:07 +0000 (16:15 +0000)] 
aarch64: Add ACLE __gcs* intrinsics

Add the following ACLE intrinsics:

 - void *__gcspr(void);
 - uint64_t __gcspopm(void);
 - void *__gcsss(void *);

gcc/ChangeLog:
* config/aarch64/arm_acle.h (__gcspr): New.
(__gcspopm): New.
(__gcsss): New.

8 months agoaarch64: Add GCS builtins
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:07 +0000 (16:15 +0000)] 
aarch64: Add GCS builtins

Add new builtins for GCS:

  void *__builtin_aarch64_gcspr (void)
  uint64_t __builtin_aarch64_gcspopm (void)
  void *__builtin_aarch64_gcsss (void *)

The builtins are always enabled, but should be used behind runtime
checks in case the target does not support GCS. They are thin
wrappers around the corresponding instructions.

The GCS pointer is modelled with void * type (normal stores do not
work on GCS memory, but it is writable via the gcsss operation or
via GCSSTR if enabled so not const) and an entry on the GCS is
modelled with uint64_t (since it has fixed size and can be a token
that's not a pointer).

gcc/ChangeLog:

* config/aarch64/aarch64-builtins.cc (enum aarch64_builtins): Add
AARCH64_BUILTIN_GCSPR, AARCH64_BUILTIN_GCSPOPM, AARCH64_BUILTIN_GCSSS.
(aarch64_init_gcs_builtins): New.
(aarch64_general_init_builtins): Call aarch64_init_gcs_builtins.
(aarch64_expand_gcs_builtin): New.
(aarch64_general_expand_builtin): Call aarch64_expand_gcs_builtin.

Co-authored-by: Richard Sandiford <richard.sandiford@arm.com>
8 months agoaarch64: Add GCS instructions
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:06 +0000 (16:15 +0000)] 
aarch64: Add GCS instructions

Add instructions for the Guarded Control Stack extension.

GCSSS1 and GCSSS2 are always used together in the compiler and an extra
"mov xn, 0" should be always added before GCSSS2 to clear the output
register. This is needed to get reasonable result when GCS is disabled,
when these instructions are NOPs. Since the instructions are expected
to be used behind runtime feature checks, this is mainly relevant if
GCS can be disabled asynchronously.

GCSPOPM does not have embedded move and code code that emits this
instruction must first emit a zeroing of operand 1 to get a reasonable
result when GCS is not enabled.

The output of GCSPOPM is usually not needed, so a separate gcspopm_xzr
was added to model that. Did not do the same for GCSSS as it is a less
common operation.

The used mnemonics do not depend on updated assembler since these
instructions can be used without new -march setting behind a runtime
check.

Reading the GCSPR is modelled as unspec_volatile so it does not get
reordered wrt the other instructions changing the GCSPR.

gcc/ChangeLog:

* config/aarch64/aarch64.md (aarch64_load_gcspr): New.
(aarch64_gcspopm): New.
(aarch64_gcspopm_xzr): New.
(aarch64_gcsss1): New.
(aarch64_gcsss2): New.
Co-authored-by: Richard Sandiford <richard.sandiford@arm.com>
8 months agoaarch64: Add __builtin_aarch64_chkfeat and __chkfeat tests
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:06 +0000 (16:15 +0000)] 
aarch64: Add __builtin_aarch64_chkfeat and __chkfeat tests

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/acle/chkfeat-1.c: New test.
* gcc.target/aarch64/chkfeat-1.c: New test.
* gcc.target/aarch64/chkfeat-2.c: New test.

Co-authored-by: Yury Khrustalev <yury.khrustalev@arm.com>
Co-authored-by: Richard Sandiford <richard.sandiford@arm.com>
8 months agoaarch64: Add ACLE __chkfeat intrinsic
Yury Khrustalev [Thu, 14 Nov 2024 16:15:05 +0000 (16:15 +0000)] 
aarch64: Add ACLE __chkfeat intrinsic

Note that compared to __builtin_aarch64_chkfeat (x) the ACLE __chkfeat(x)
flips the bits to be more intuitive (xor the input to output).

gcc/ChangeLog:
* config/aarch64/arm_acle.h (__chkfeat): New.

8 months agoaarch64: Add __builtin_aarch64_chkfeat
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:05 +0000 (16:15 +0000)] 
aarch64: Add __builtin_aarch64_chkfeat

Builtin for chkfeat: the input argument is used to initialize x16 then
execute chkfeat and return the updated x16.

Note: the ACLE __chkfeat(x) will flip the bits to be more intuitive
(xor the input to output), but for the builtin that seems unnecessary
complication.

gcc/ChangeLog:

* config/aarch64/aarch64-builtins.cc (enum aarch64_builtins):
Define AARCH64_BUILTIN_CHKFEAT.
(aarch64_general_init_builtins): Handle chkfeat.
(aarch64_general_expand_builtin): Handle chkfeat.
Co-authored-by: Richard Sandiford <richard.sandiford@arm.com>
8 months agoaarch64: Add support for chkfeat insn
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:04 +0000 (16:15 +0000)] 
aarch64: Add support for chkfeat insn

This is a hint space instruction to check for enabled HW features and
update the x16 register accordingly.

Use unspec_volatile to prevent reordering it around calls since calls
can enable or disable HW features.

gcc/ChangeLog:

* config/aarch64/aarch64.md (aarch64_chkfeat): New.

8 months agoaarch64: Add branch-protection target pragma tests
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:04 +0000 (16:15 +0000)] 
aarch64: Add branch-protection target pragma tests

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pragma_cpp_predefs_4.c: Add branch-protection
tests.

8 months agoaarch64: Add -mbranch-protection=gcs option
Szabolcs Nagy [Thu, 14 Nov 2024 16:15:03 +0000 (16:15 +0000)] 
aarch64: Add -mbranch-protection=gcs option

This enables Guarded Control Stack (GCS) compatible code generation.

The "standard" branch-protection type enables it, and the default
depends on the compiler default.

gcc/ChangeLog:

* config/aarch64/aarch64-protos.h (aarch_gcs_enabled): Declare.
* config/aarch64/aarch64.cc (aarch_gcs_enabled): Define.
(aarch_handle_no_branch_protection): Handle gcs.
(aarch_handle_standard_branch_protection): Handle gcs.
(aarch_handle_gcs_protection): New.
* config/aarch64/aarch64.opt: Add aarch_enable_gcs.
* configure: Regenerate.
* configure.ac: Handle gcs in --enable-standard-branch-protection.
* doc/invoke.texi: Document -mbranch-protection=gcs.

8 months agoNew testcase for operator new/delete removal.
Jan Hubicka [Thu, 14 Nov 2024 16:08:03 +0000 (17:08 +0100)] 
New testcase for operator new/delete removal.

* g++.dg/tree-ssa/dce-1.C: New test.

8 months agoRemove allocations which are used only for NULL pointer check and free
Jan Hubicka [Thu, 14 Nov 2024 16:01:12 +0000 (17:01 +0100)] 
Remove allocations which are used only for NULL pointer check and free

Extend tree-ssa-dse to remove memory allocations that are used only
to check that return value is non-NULL and freed.

New -fmalloc-dce flag can be used to control malloc/free removal.  I
ended up copying what -fallocation-dse does so -fmalloc-dce=1 enables
malloc/free removal provided return value is unused otherwise and
-fmalloc-dce=2 allows additional NULL pointer checks which it folds to
non-NULL direction.

I also added compensation for the gcc.dg/analyzer/pr101837.c testcase and
added testcase that std::nothrow variant of operator new is now optimized way.

With the -fmalloc-dce=n I can also add a level which emits runtime check for half
of address space and calloc overflow if it seems useful, but perhaps
incrementally.  Adding size parameter tracking is not that hard (I posted WIP
patch for that).

gcc/ChangeLog:

PR tree-optimization/117370
* common.opt: Add -fmalloc-dce.
* common.opt.urls: Update.
* doc/invoke.texi: Document it; also add missing -flifetime-dse entry.
* tree-ssa-dce.cc (is_removable_allocation_p): Break out from
...
(mark_stmt_if_obviously_necessary): ... here; also check that
operator new satisfies gimple_call_from_new_or_delete.
(checks_return_value_of_removable_allocation_p): New Function.
(mark_all_reaching_defs_necessary_1): add missing case for
STRDUP and STRNDUP
(propagate_necessity): Use is_removable_allocation_p and
checks_return_value_of_removable_allocation_p.
(eliminate_unnecessary_stmts): Update conditionals that use
removed allocation; use is_removable_allocation_p.

gcc/testsuite/ChangeLog:

* g++.dg/cdce3.C: Disable allocation dce.
* g++.dg/tree-ssa/pr19476-1.C: Likewise.
* g++.dg/tree-ssa/pr19476-2.C: Likewise.
* g++.dg/tree-ssa/pr19476-3.C: Likewise.
* g++.dg/tree-ssa/pr19476-4.C: Likewise.
* gcc.dg/analyzer/pr101837.c: Disable malloc dce.
* gcc.dg/tree-ssa/pr19831-3.c: Update.
* gfortran.dg/pr68078.f90: Disable malloc DCE.

8 months agolibstdc++: Add missing constraint to operator+ for std::move_iterator
Jonathan Wakely [Thu, 14 Nov 2024 10:50:34 +0000 (10:50 +0000)] 
libstdc++: Add missing constraint to operator+ for std::move_iterator

This constraint was added by the One Ranges proposal (P0896R4) and
then fixed by LWG 3293, but it was missing from libstdc++.

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (operator+): Add constraint to
move_iterator operator.
* testsuite/24_iterators/move_iterator/rel_ops_c++20.cc:

8 months agolibstdc++: Use requires-clause for __normal_iterator constructor
Jonathan Wakely [Thu, 14 Nov 2024 14:54:57 +0000 (14:54 +0000)] 
libstdc++: Use requires-clause for __normal_iterator constructor

This is a very minor throughput optimization, to avoid instantiating
std::enable_if and std::is_convertible when concepts are available.

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (__normal_iterator): Replace
enable_if constraint with requires-clause.

8 months agolibstdc++: Use feature test macros consistently in <bits/stl_iterator.h>
Jonathan Wakely [Thu, 14 Nov 2024 09:58:41 +0000 (09:58 +0000)] 
libstdc++: Use feature test macros consistently in <bits/stl_iterator.h>

Remove __cplusplus > 201703L checks that are redundant when used
alongside __glibcxx_concepts checks, because <version> already
guarantees that __glibcxx_concepts is only defined for C++20 and later.

Prefer to check __glibcxx_ranges for features such as move_sentinel that
were added by the One Ranges proposal (P0896R4), or for features which
depend on other components introduced by that proposal.

But prefer to check __glibcxx_concepts for constraints that only depend
on requires-clauses and concepts defined in <concepts>, even if those
constraints were added by the Ranges proposal (e.g. the constraints on
non-member operators for move_iterator).

Prefer #ifdef to #if when just testing for the presence of __glibcxx_foo
macros with caring about their value.

Also add/tweak some Doxygen comments.

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h: Make use of feature test macros
more consistent. Improve doxygen comments.

8 months agolibgomp.texi: Impl. Status - change TR13 to OpenMP 6.0 + fix routine typo
Tobias Burnus [Thu, 14 Nov 2024 15:28:20 +0000 (16:28 +0100)] 
libgomp.texi: Impl. Status - change TR13 to OpenMP 6.0 + fix routine typo

libgomp/
* libgomp.texi (OpenMP Implementation Status): Change TR13 to
OpenMP 6.0, now released. Fix a typo in the omp_target_memset_async
routine name.

8 months agoFix another thinko in peeling for gap compute of get_group_load_store_type
Richard Biener [Thu, 14 Nov 2024 13:22:01 +0000 (14:22 +0100)] 
Fix another thinko in peeling for gap compute of get_group_load_store_type

There's inconsistent handling of the cpart_size == cnunits which
currently avoids reporting peeling for gaps being insufficient, but
the following condition which is enough to trigger it,
cremain + group_size < cpart_size with cpart_size == cnunits is
equal to the condition that brings us here in the first place,
maybe_lt (remain + group_size, nunits).  The following fixes this
by not checking cpart_size against special values.

* tree-vect-stmts.cc (get_group_load_store_type): Do not
exempt cpart_size == cnunits from failing.

8 months agoFix typo in peeling for gap compute of get_group_load_store_type
Richard Biener [Thu, 14 Nov 2024 12:28:48 +0000 (13:28 +0100)] 
Fix typo in peeling for gap compute of get_group_load_store_type

When fixing a maybe-uninit diagnostic in r15-1309-ge575b5c56137b1 by
re-computing remain I failed to add braces, effectively now computing
garbage.

* tree-vect-stmts.cc (get_group_load_store_type): Add missing
braces.

8 months agoada: Avoid doing unnecessary work in elaborate_expression_2
Eric Botcazou [Mon, 4 Nov 2024 11:14:52 +0000 (12:14 +0100)] 
ada: Avoid doing unnecessary work in elaborate_expression_2

This prevents the expression from being tweaked by the match.pd machinery
in the process, which can damage the readability of the -gnatR3 output.

gcc/ada/ChangeLog:

* gcc-interface/decl.cc (elaborate_expression_2): Do not divide and
multiply back if the alignment factor is already explicit.

8 months agoada: Improved legality checking for deep delta aggregates.
Steve Baird [Wed, 30 Oct 2024 23:20:51 +0000 (16:20 -0700)] 
ada: Improved legality checking for deep delta aggregates.

Enforce deep delta legality rules about nonoverlapping choices. For example,
do not allow both Aaa.Bbb and Aaa.Bbb.Ccc as choices in one delta aggregate.
One special case impacts "regular" Ada2022 delta aggregates - the rule
preventing a record component from occurring twice as a choice in a delta
aggregate was previously not being enforced.

gcc/ada/ChangeLog:

* sem_aggr.adb (Resolve_Delta_Aggregate): The rule about
discriminant dependent component references in choices applies to
both array and record delta aggregates, so check for violations in
Resolve_Delta_Aggregate. Call a new procedure,
Check_For_Bad_Dd_Component_Choice, for each choice.
(Resolve_Delta_Record_Aggregate): Call a new procedure,
Check_For_Bad_Overlap, for each pair of choices.

8 months agoada: Tweak test for predefined units in binder
Ronan Desplanques [Mon, 4 Nov 2024 14:24:29 +0000 (15:24 +0100)] 
ada: Tweak test for predefined units in binder

The new way makes better use of the existing abstractions.

gcc/ada/ChangeLog:

* bindgen.adb (Gen_Elab_Calls): Tweak test.
(Gen_Elab_Externals): Likewise.

8 months agoada: Adapt proofs of light runtime to current version of SPARK
Claire Dross [Fri, 18 Oct 2024 09:45:29 +0000 (11:45 +0200)] 
ada: Adapt proofs of light runtime to current version of SPARK

gcc/ada/ChangeLog:

* libgnat/a-strmap.adb: Add assert to regain proofs.
* libgnat/a-strsup.adb: Likewise.
* libgnat/s-aridou.adb: Add assertions to regain proofs.
* libgnat/s-arit32.adb: Use Exceptional_Cases to specify Raise.
* libgnat/s-arit64.adb: Use Round_Quatient from Impl instead of
redefining it.
* libgnat/s-arit64.ads: Likewise.
* libgnat/s-expmod.adb: Regain proof of lemma.
* libgnat/s-exponn.adb: Likewise.
* libgnat/s-expont.adb: Likewise.
* libgnat/s-imgboo.adb: Add local lemma to regain proof.
* libgnat/s-valuti.ads: Add Always_Terminates on Bad_Value.

8 months agoada: Another small fix to the description of run-time library routines
Eric Botcazou [Thu, 31 Oct 2024 17:58:30 +0000 (18:58 +0100)] 
ada: Another small fix to the description of run-time library routines

gcc/ada/ChangeLog:

* libgnat/s-imagef.ads (Image_Fixed): Adjust outdated sentence.

8 months agoada: Fix spurious warning on representation clause for private discriminated type
Eric Botcazou [Fri, 1 Nov 2024 19:47:57 +0000 (20:47 +0100)] 
ada: Fix spurious warning on representation clause for private discriminated type

This is the warning enabled by -gnatw.h for holes in record types that are
declared with a representation clause for their components.

When a discriminated type has a private declaration that also declares its
discriminants, the sibling discriminants present on the full declaration
are essentially ignored and, therefore, cannot be used in the computation
performed to give the warning.

gcc/ada/ChangeLog:

* sem_ch13.adb (Record_Hole_Check): Deal consistently with the base
type throughout the processing.  Return if its declaration is not a
full type declaration.  Assert that its record definition is either
a derived type definition or a record definition.  If the type has a
private declaration that does not specify unknown discriminants, use
it as the source of discriminant specifications, if any.
(Check_Component_List): Process every N_Discriminant_Specification
but assert that its defining identifier is really a discriminant.

8 months agoada: Fix outdated description in System.Arith_* units
Eric Botcazou [Thu, 31 Oct 2024 08:12:48 +0000 (09:12 +0100)] 
ada: Fix outdated description in System.Arith_* units

Mainly System.Arith_Double, which has left-overs from its original version.

gcc/ada/ChangeLog:

* libgnat/s-aridou.ads (Add_With_Ovflo_Check): Adjust description.
(Subtract_With_Ovflo_Check): Likewise.
(Multiply_With_Ovflo_Check): Likewise.
(Scaled_Divide): Likewise.
(Double_Divide): Likewise.
* libgnat/s-arit64.ads (Multiply_With_Ovflo_Check64): Likewise.
* libgnat/s-arit128.ads (Multiply_With_Ovflo_Check128): Likewise.

8 months agoada: Fix internal error on misplaced iterated component association
Eric Botcazou [Mon, 28 Oct 2024 10:19:10 +0000 (11:19 +0100)] 
ada: Fix internal error on misplaced iterated component association

This happens for example in the others choice of a 1-dimensional array:

   A : array (1 .. Length) of Integer
         := (others => for Each in 1 .. Length => Each);

or when it is used without parentheses for the array component of a record.

gcc/ada/ChangeLog:

PR ada/112524
PR ada/113781
* par-ch4.adb (P_Primary) <Tok_For>: Give an error about missing
parentheses in the (purported) iterated component case too.
(P_Unparen_Cond_Expr_Etc): Likewise.
* sem.adb (Analyze): Raise PE on N_Iterated_Component_Association.
* sem_util.ads (Diagnose_Iterated_Component_Association): Delete.
* sem_util.adb (Diagnose_Iterated_Component_Association): Likewise.

8 months agoipa: Introduce a one jump function dumping function
Martin Jambor [Thu, 14 Nov 2024 13:42:27 +0000 (14:42 +0100)] 
ipa: Introduce a one jump function dumping function

I plan to introduce a verifier that prints a single jump function when
it fails with the function introduced in this one.  Because it is a
verifier, the risk that it would need to e reverted are non-zero and
because the function can be useful on its own, this is a special patch
to introduce it.

gcc/ChangeLog:

2024-11-01  Martin Jambor  <mjambor@suse.cz>

* ipa-prop.h (ipa_dump_jump_function): Declare.
* ipa-prop.cc (ipa_dump_jump_function): New function.
(ipa_print_node_jump_functions_for_edge): Move printing of
individual jump functions to the new function.

8 months agoipa-cp: Fix constant dumping
Martin Jambor [Thu, 14 Nov 2024 13:42:27 +0000 (14:42 +0100)] 
ipa-cp: Fix constant dumping

Commit gcc-14-5368-ge0787da2633 removed an overloaded variant of
function print_ipcp_constant_value for tree constants.  That did not
break build because the other overloaded variant for polymorphic
contexts-has a parameter which is constructible from a tree, but it
prints polymorphic contexts, not tree constants, so we in dumps we got
things like:

  param [0]: VARIABLE
       ctxs: VARIABLE
       Bits: value = 0x0, mask = 0xfffffffffffffffc
       [prange] struct S * [1, +INF] MASK 0xfffffffffffffffc VALUE 0x0
      ref offset 0:     nothing known [scc: 1, from: 1(1.000000)] [loc_time: 0, loc_size: 0, prop_time: 0, prop_size: 0]
      ref offset 32:     nothing known [scc: 2, from: 1(1.000000)] [loc_time: 0, loc_size: 0, prop_time: 0, prop_size: 0]
      ref offset 64:     nothing known [scc: 3, from: 1(1.000000)] [loc_time: 0, loc_size: 0, prop_time: 0, prop_size: 0]

instead of:

  param [0]: VARIABLE
       ctxs: VARIABLE
       Bits: value = 0x0, mask = 0xfffffffffffffffc
       [prange] struct S * [1, +INF] MASK 0xfffffffffffffffc VALUE 0x0
      ref offset 0: 1 [scc: 1, from: 1(1.000000)] [loc_time: 0, loc_size: 0, prop_time: 0, prop_size: 0]
      ref offset 32: 64 [scc: 2, from: 1(1.000000)] [loc_time: 0, loc_size: 0, prop_time: 0, prop_size: 0]
      ref offset 64: 32 [scc: 3, from: 1(1.000000)] [loc_time: 0, loc_size: 0, prop_time: 0, prop_size: 0]

This commit re-adds the needed overloaded variant though it uses the
printing function added in the aforementioned commit instead of
printing it itself.

gcc/ChangeLog:

2024-11-13  Martin Jambor  <mjambor@suse.cz>

* ipa-prop.h (ipa_print_constant_value): Declare.
* ipa-prop.cc (ipa_print_constant_value): Make public.
* ipa-cp.cc (print_ipcp_constant_value): Re-add this overloaded
function for printing tree constants.

gcc/testsuite/ChangeLog:

2024-11-14  Martin Jambor  <mjambor@suse.cz>

* gcc.dg/ipa/ipcp-agg-1.c: Add a scan dump for a constant value in
the latice dump.

8 months agoAdd testcases for std::vector optimization
Jan Hubicka [Thu, 14 Nov 2024 13:19:04 +0000 (14:19 +0100)] 
Add testcases for std::vector optimization

gcc/testsuite/ChangeLog:

PR tree-optimization/110819
PR tree-optimization/116868
PR tree-optimization/58483

* g++.dg/tree-ssa/pr96945.C: cleanup
* g++.dg/tree-ssa/pr110819.C: New test.
* g++.dg/tree-ssa/pr116868.C: New test.
* g++.dg/tree-ssa/pr58483.C: New test.

8 months agolibstdc++: Add missing parts of LWG 3480 for directory iterators [PR117560]
Jonathan Wakely [Thu, 14 Nov 2024 01:14:44 +0000 (01:14 +0000)] 
libstdc++: Add missing parts of LWG 3480 for directory iterators [PR117560]

It looks like I only read half the resolution of LWG 3480 and decided we
already supported it. As well as making the non-member overloads of end
take their parameters by value, we need some specializations of the
enable_borrowed_range and enable_view variable templates.

libstdc++-v3/ChangeLog:

PR libstdc++/117560
* include/bits/fs_dir.h (enable_borrowed_range, enable_view):
Define specializations for directory iterators, as per LWG 3480.
* testsuite/27_io/filesystem/iterators/lwg3480.cc: New test.

8 months agoAvoid expand_vec_cond_expr_p with comparison code
Richard Biener [Tue, 12 Nov 2024 13:45:02 +0000 (14:45 +0100)] 
Avoid expand_vec_cond_expr_p with comparison code

This removes the obsolete API use by vector divmod lowering.

* tree-vect-generic.cc (expand_vector_divmod): Query vector
comparison and vec_cond_mask capability.

8 months agoRemove last comparison-code expand_vec_cond_expr_p call from vectorizer
Richard Biener [Tue, 12 Nov 2024 12:55:14 +0000 (13:55 +0100)] 
Remove last comparison-code expand_vec_cond_expr_p call from vectorizer

The following refactors the check with the last remaininig
expand_vec_cond_expr_p call with a comparison code to make it
obvious we are not relying on those anymore.

* tree-vect-stmts.cc (vectorizable_condition): Refactor
target support check.

8 months agotree-optimization/117567 - make SLP reassoc resilent against NULL lanes
Richard Biener [Thu, 14 Nov 2024 09:17:23 +0000 (10:17 +0100)] 
tree-optimization/117567 - make SLP reassoc resilent against NULL lanes

The following tries to make the SLP chain association code resilent
against not present lanes (the other option would have been to disable
it in this case).  Not present lanes can now more widely appear as
part of mask load SLP discovery when there is gaps involved.  Requiring
a present first lane shouldn't be a restriction since in unpermuted
state all DR groups have their first lane not a gap.

PR tree-optimization/117567
* tree-vect-slp.cc (vect_build_slp_tree_2): Handle not present
lanes when doing re-association.

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

8 months agolibgcc: Fix COPY_ARG_VAL initializer (PR 117537)
Christophe Lyon [Wed, 13 Nov 2024 21:20:13 +0000 (21:20 +0000)] 
libgcc: Fix COPY_ARG_VAL initializer (PR 117537)

We recently forced -Werror when building libgcc for aarch64, to make
sure we'd catch and fix the kind of problem described in the PR.

In this case, when building for aarch64_be (so, big endian), gcc emits
this warning/error:
libgcc/config/libbid/bid_conf.h:847:25: error: missing braces around initializer [-Werror=missing-braces]
  847 |        UINT128 arg_name={ bid_##arg_name.w[1], bid_##arg_name.w[0]};
libgcc/config/libbid/bid_conf.h:871:8: note: in expansion of macro 'COPY_ARG_VAL'
  871 |        COPY_ARG_VAL(arg_name)

This patch fixes the problem by adding curly braces around the
initializer for COPY_ARG_VAL in the big endian case.

It seems that COPY_ARG_REF (just above COPY_ARG_VAL) has a similar
issue, but DECIMAL_CALL_BY_REFERENCE seems always defined to 0, so
COPY_ARG_REF is never used.  The patch fixes it too, though.

libgcc/config/libbid/ChangeLog:

PR libgcc/117537
* bid_conf.h (COPY_ARG_REF): Fix initializer.
(COPY_ARG_VAL): Likewise.

8 months agocfgexpand: Skip doing conflicts if there is only 1 variable
Andrew Pinski [Wed, 13 Nov 2024 06:13:35 +0000 (22:13 -0800)] 
cfgexpand: Skip doing conflicts if there is only 1 variable

This is a small speed up. If there is only one know stack variable, there
is no reason figure out the scope conflicts as there are none. So don't
go through all the live range calculations just to see there are none.

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

gcc/ChangeLog:

* cfgexpand.cc (add_scope_conflicts): Return right away
if there are only one stack variable.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
8 months agoMATCH: Simplify `a rrotate (32-b) -> a lrotate b` [PR109906]
Eikansh Gupta [Mon, 11 Nov 2024 11:36:04 +0000 (17:06 +0530)] 
MATCH: Simplify `a rrotate (32-b) -> a lrotate b` [PR109906]

The pattern `a rrotate (32-b)` should be optimized to `a lrotate b`.
The same is also true for `a lrotate (32-b)`. It can be optimized to
`a rrotate b`.

This patch adds following patterns:
a rrotate (32-b) -> a lrotate b
a lrotate (32-b) -> a rrotate b

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

PR tree-optimization/109906

gcc/ChangeLog:

* match.pd (a rrotate (32-b) -> a lrotate b): New pattern
(a lrotate (32-b) -> a rrotate b): New pattern

gcc/testsuite/ChangeLog:

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

Signed-off-by: Eikansh Gupta <quic_eikagupt@quicinc.com>
8 months agoDo not consider overrun for VMAT_ELEMENTWISE
Richard Biener [Wed, 13 Nov 2024 10:32:13 +0000 (11:32 +0100)] 
Do not consider overrun for VMAT_ELEMENTWISE

When we classify an SLP access as VMAT_ELEMENTWISE we still consider
overrun - the reset of it is later overwritten.  The following fixes
this, resolving a few RISC-V FAILs with --param vect-force-slp=1.

* tree-vect-stmts.cc (get_group_load_store_type): For
VMAT_ELEMENTWISE there's no overrun.

8 months agotree-optimization/117554 - correct single-element interleaving check
Richard Biener [Wed, 13 Nov 2024 14:05:00 +0000 (15:05 +0100)] 
tree-optimization/117554 - correct single-element interleaving check

In addition to a single DR we also require a single lane, not a splat.

PR tree-optimization/117554
* tree-vect-stmts.cc (get_group_load_store_type): We can
use gather/scatter only for a single-lane single element group
access.

8 months agotree-optimization/117559 - avoid hybrid SLP for masked load/store lanes
Richard Biener [Wed, 13 Nov 2024 12:56:13 +0000 (13:56 +0100)] 
tree-optimization/117559 - avoid hybrid SLP for masked load/store lanes

Hybrid analysis is confused by the mask_conversion pattern making a
uniform mask non-uniform.  As load/store lanes only uses a single
lane to mask all data lanes the SLP graph doesn't cover the alternate
(redundant) mask lanes and thus their pattern defs.  The following adds
a hack to mark them covered.

Fixes gcc.target/aarch64/sve/mask_struct_store_?.c with forced SLP.

PR tree-optimization/117559
* tree-vect-slp.cc (vect_mark_slp_stmts): Pass in vinfo,
mark all mask defs of a load/store-lane .MASK_LOAD/STORE
as pure.
(vect_make_slp_decision): Adjust.
(vect_slp_analyze_bb_1): Likewise.

8 months agotree-optimization/117556 - SLP of live stmts from load-lanes
Richard Biener [Wed, 13 Nov 2024 13:43:27 +0000 (14:43 +0100)] 
tree-optimization/117556 - SLP of live stmts from load-lanes

The following fixes SLP live lane generation for load-lanes which
fails to analyze for gcc.dg/vect/vect-live-slp-3.c because the
VLA division doesn't work out but it would also wrongly use the
transposed vector defs I think.  The following properly disables
the actual load-lanes SLP node from live lane processing and instead
relies on the SLP permute node representing the live lane where we
can use extract-last to extract the last lane.  This also fixes
the reported Ada miscompile.

PR tree-optimization/117556
PR tree-optimization/117553
* tree-vect-stmts.cc (vect_analyze_stmt): Do not analyze
the SLP load-lanes node for live lanes, but only the
permute node.
(vect_transform_stmt): Likewise for the transform.

* gcc.dg/vect/vect-live-slp-3.c: Expect us to SLP even for
VLA vectors (in single-lane mode).

8 months agoRISC-V: Rearrange the test files for scalar SAT_ADD [NFC]
Pan Li [Thu, 14 Nov 2024 06:16:15 +0000 (14:16 +0800)] 
RISC-V: Rearrange the test files for scalar SAT_ADD [NFC]

The test files of scalar SAT_ADD only has numbers as the suffix.
Rearrange the file name to -{form number}-{target-type}.  For example,
test form 3 for uint32_t SAT_ADD will have -3-u32.c for asm check and
-run-3-u32.c for the run test.

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

gcc/testsuite/ChangeLog:

* gcc.target/riscv/sat_s_add-2.c: Move to...
* gcc.target/riscv/sat_s_add-1-i16.c: ...here.
* gcc.target/riscv/sat_s_add-3.c: Move to...
* gcc.target/riscv/sat_s_add-1-i32.c: ...here.
* gcc.target/riscv/sat_s_add-4.c: Move to...
* gcc.target/riscv/sat_s_add-1-i64.c: ...here.
* gcc.target/riscv/sat_s_add-1.c: Move to...
* gcc.target/riscv/sat_s_add-1-i8.c: ...here.
* gcc.target/riscv/sat_s_add-6.c: Move to...
* gcc.target/riscv/sat_s_add-2-i16.c: ...here.
* gcc.target/riscv/sat_s_add-7.c: Move to...
* gcc.target/riscv/sat_s_add-2-i32.c: ...here.
* gcc.target/riscv/sat_s_add-8.c: Move to...
* gcc.target/riscv/sat_s_add-2-i64.c: ...here.
* gcc.target/riscv/sat_s_add-5.c: Move to...
* gcc.target/riscv/sat_s_add-2-i8.c: ...here.
* gcc.target/riscv/sat_s_add-10.c: Move to...
* gcc.target/riscv/sat_s_add-3-i16.c: ...here.
* gcc.target/riscv/sat_s_add-11.c: Move to...
* gcc.target/riscv/sat_s_add-3-i32.c: ...here.
* gcc.target/riscv/sat_s_add-12.c: Move to...
* gcc.target/riscv/sat_s_add-3-i64.c: ...here.
* gcc.target/riscv/sat_s_add-9.c: Move to...
* gcc.target/riscv/sat_s_add-3-i8.c: ...here.
* gcc.target/riscv/sat_s_add-14.c: Move to...
* gcc.target/riscv/sat_s_add-4-i16.c: ...here.
* gcc.target/riscv/sat_s_add-15.c: Move to...
* gcc.target/riscv/sat_s_add-4-i32.c: ...here.
* gcc.target/riscv/sat_s_add-16.c: Move to...
* gcc.target/riscv/sat_s_add-4-i64.c: ...here.
* gcc.target/riscv/sat_s_add-13.c: Move to...
* gcc.target/riscv/sat_s_add-4-i8.c: ...here.
* gcc.target/riscv/sat_s_add-run-2.c: Move to...
* gcc.target/riscv/sat_s_add-run-1-i16.c: ...here.
* gcc.target/riscv/sat_s_add-run-3.c: Move to...
* gcc.target/riscv/sat_s_add-run-1-i32.c: ...here.
* gcc.target/riscv/sat_s_add-run-4.c: Move to...
* gcc.target/riscv/sat_s_add-run-1-i64.c: ...here.
* gcc.target/riscv/sat_s_add-run-1.c: Move to...
* gcc.target/riscv/sat_s_add-run-1-i8.c: ...here.
* gcc.target/riscv/sat_s_add-run-6.c: Move to...
* gcc.target/riscv/sat_s_add-run-2-i16.c: ...here.
* gcc.target/riscv/sat_s_add-run-7.c: Move to...
* gcc.target/riscv/sat_s_add-run-2-i32.c: ...here.
* gcc.target/riscv/sat_s_add-run-8.c: Move to...
* gcc.target/riscv/sat_s_add-run-2-i64.c: ...here.
* gcc.target/riscv/sat_s_add-run-5.c: Move to...
* gcc.target/riscv/sat_s_add-run-2-i8.c: ...here.
* gcc.target/riscv/sat_s_add-run-10.c: Move to...
* gcc.target/riscv/sat_s_add-run-3-i16.c: ...here.
* gcc.target/riscv/sat_s_add-run-11.c: Move to...
* gcc.target/riscv/sat_s_add-run-3-i32.c: ...here.
* gcc.target/riscv/sat_s_add-run-12.c: Move to...
* gcc.target/riscv/sat_s_add-run-3-i64.c: ...here.
* gcc.target/riscv/sat_s_add-run-9.c: Move to...
* gcc.target/riscv/sat_s_add-run-3-i8.c: ...here.
* gcc.target/riscv/sat_s_add-run-14.c: Move to...
* gcc.target/riscv/sat_s_add-run-4-i16.c: ...here.
* gcc.target/riscv/sat_s_add-run-15.c: Move to...
* gcc.target/riscv/sat_s_add-run-4-i32.c: ...here.
* gcc.target/riscv/sat_s_add-run-16.c: Move to...
* gcc.target/riscv/sat_s_add-run-4-i64.c: ...here.
* gcc.target/riscv/sat_s_add-run-13.c: Move to...
* gcc.target/riscv/sat_s_add-run-4-i8.c: ...here.
* gcc.target/riscv/sat_u_add-2.c: Move to...
* gcc.target/riscv/sat_u_add-1-u16.c: ...here.
* gcc.target/riscv/sat_u_add-3.c: Move to...
* gcc.target/riscv/sat_u_add-1-u32.c: ...here.
* gcc.target/riscv/sat_u_add-4.c: Move to...
* gcc.target/riscv/sat_u_add-1-u64.c: ...here.
* gcc.target/riscv/sat_u_add-1.c: Move to...
* gcc.target/riscv/sat_u_add-1-u8.c: ...here.
* gcc.target/riscv/sat_u_add-6.c: Move to...
* gcc.target/riscv/sat_u_add-2-u16.c: ...here.
* gcc.target/riscv/sat_u_add-7.c: Move to...
* gcc.target/riscv/sat_u_add-2-u32.c: ...here.
* gcc.target/riscv/sat_u_add-8.c: Move to...
* gcc.target/riscv/sat_u_add-2-u64.c: ...here.
* gcc.target/riscv/sat_u_add-5.c: Move to...
* gcc.target/riscv/sat_u_add-2-u8.c: ...here.
* gcc.target/riscv/sat_u_add-10.c: Move to...
* gcc.target/riscv/sat_u_add-3-u16.c: ...here.
* gcc.target/riscv/sat_u_add-11.c: Move to...
* gcc.target/riscv/sat_u_add-3-u32.c: ...here.
* gcc.target/riscv/sat_u_add-12.c: Move to...
* gcc.target/riscv/sat_u_add-3-u64.c: ...here.
* gcc.target/riscv/sat_u_add-9.c: Move to...
* gcc.target/riscv/sat_u_add-3-u8.c: ...here.
* gcc.target/riscv/sat_u_add-14.c: Move to...
* gcc.target/riscv/sat_u_add-4-u16.c: ...here.
* gcc.target/riscv/sat_u_add-15.c: Move to...
* gcc.target/riscv/sat_u_add-4-u32.c: ...here.
* gcc.target/riscv/sat_u_add-16.c: Move to...
* gcc.target/riscv/sat_u_add-4-u64.c: ...here.
* gcc.target/riscv/sat_u_add-13.c: Move to...
* gcc.target/riscv/sat_u_add-4-u8.c: ...here.
* gcc.target/riscv/sat_u_add-18.c: Move to...
* gcc.target/riscv/sat_u_add-5-u16.c: ...here.
* gcc.target/riscv/sat_u_add-19.c: Move to...
* gcc.target/riscv/sat_u_add-5-u32.c: ...here.
* gcc.target/riscv/sat_u_add-20.c: Move to...
* gcc.target/riscv/sat_u_add-5-u64.c: ...here.
* gcc.target/riscv/sat_u_add-17.c: Move to...
* gcc.target/riscv/sat_u_add-5-u8.c: ...here.
* gcc.target/riscv/sat_u_add-22.c: Move to...
* gcc.target/riscv/sat_u_add-6-u16.c: ...here.
* gcc.target/riscv/sat_u_add-23.c: Move to...
* gcc.target/riscv/sat_u_add-6-u32.c: ...here.
* gcc.target/riscv/sat_u_add-24.c: Move to...
* gcc.target/riscv/sat_u_add-6-u64.c: ...here.
* gcc.target/riscv/sat_u_add-21.c: Move to...
* gcc.target/riscv/sat_u_add-6-u8.c: ...here.
* gcc.target/riscv/sat_u_add-run-2.c: Move to...
* gcc.target/riscv/sat_u_add-run-1-u16.c: ...here.
* gcc.target/riscv/sat_u_add-run-3.c: Move to...
* gcc.target/riscv/sat_u_add-run-1-u32.c: ...here.
* gcc.target/riscv/sat_u_add-run-4.c: Move to...
* gcc.target/riscv/sat_u_add-run-1-u64.c: ...here.
* gcc.target/riscv/sat_u_add-run-1.c: Move to...
* gcc.target/riscv/sat_u_add-run-1-u8.c: ...here.
* gcc.target/riscv/sat_u_add-run-6.c: Move to...
* gcc.target/riscv/sat_u_add-run-2-u16.c: ...here.
* gcc.target/riscv/sat_u_add-run-7.c: Move to...
* gcc.target/riscv/sat_u_add-run-2-u32.c: ...here.
* gcc.target/riscv/sat_u_add-run-8.c: Move to...
* gcc.target/riscv/sat_u_add-run-2-u64.c: ...here.
* gcc.target/riscv/sat_u_add-run-5.c: Move to...
* gcc.target/riscv/sat_u_add-run-2-u8.c: ...here.
* gcc.target/riscv/sat_u_add-run-10.c: Move to...
* gcc.target/riscv/sat_u_add-run-3-u16.c: ...here.
* gcc.target/riscv/sat_u_add-run-11.c: Move to...
* gcc.target/riscv/sat_u_add-run-3-u32.c: ...here.
* gcc.target/riscv/sat_u_add-run-12.c: Move to...
* gcc.target/riscv/sat_u_add-run-3-u64.c: ...here.
* gcc.target/riscv/sat_u_add-run-9.c: Move to...
* gcc.target/riscv/sat_u_add-run-3-u8.c: ...here.
* gcc.target/riscv/sat_u_add-run-14.c: Move to...
* gcc.target/riscv/sat_u_add-run-4-u16.c: ...here.
* gcc.target/riscv/sat_u_add-run-15.c: Move to...
* gcc.target/riscv/sat_u_add-run-4-u32.c: ...here.
* gcc.target/riscv/sat_u_add-run-16.c: Move to...
* gcc.target/riscv/sat_u_add-run-4-u64.c: ...here.
* gcc.target/riscv/sat_u_add-run-13.c: Move to...
* gcc.target/riscv/sat_u_add-run-4-u8.c: ...here.
* gcc.target/riscv/sat_u_add-run-18.c: Move to...
* gcc.target/riscv/sat_u_add-run-5-u16.c: ...here.
* gcc.target/riscv/sat_u_add-run-19.c: Move to...
* gcc.target/riscv/sat_u_add-run-5-u32.c: ...here.
* gcc.target/riscv/sat_u_add-run-20.c: Move to...
* gcc.target/riscv/sat_u_add-run-5-u64.c: ...here.
* gcc.target/riscv/sat_u_add-run-17.c: Move to...
* gcc.target/riscv/sat_u_add-run-5-u8.c: ...here.
* gcc.target/riscv/sat_u_add-run-22.c: Move to...
* gcc.target/riscv/sat_u_add-run-6-u16.c: ...here.
* gcc.target/riscv/sat_u_add-run-23.c: Move to...
* gcc.target/riscv/sat_u_add-run-6-u32.c: ...here.
* gcc.target/riscv/sat_u_add-run-24.c: Move to...
* gcc.target/riscv/sat_u_add-run-6-u64.c: ...here.
* gcc.target/riscv/sat_u_add-run-21.c: Move to...
* gcc.target/riscv/sat_u_add-run-6-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-2.c: Move to...
* gcc.target/riscv/sat_u_add_imm-1-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-3.c: Move to...
* gcc.target/riscv/sat_u_add_imm-1-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-4.c: Move to...
* gcc.target/riscv/sat_u_add_imm-1-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-1.c: Move to...
* gcc.target/riscv/sat_u_add_imm-1-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-6.c: Move to...
* gcc.target/riscv/sat_u_add_imm-2-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-7.c: Move to...
* gcc.target/riscv/sat_u_add_imm-2-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-8.c: Move to...
* gcc.target/riscv/sat_u_add_imm-2-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-5.c: Move to...
* gcc.target/riscv/sat_u_add_imm-2-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-10.c: Move to...
* gcc.target/riscv/sat_u_add_imm-3-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-11.c: Move to...
* gcc.target/riscv/sat_u_add_imm-3-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-12.c: Move to...
* gcc.target/riscv/sat_u_add_imm-3-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-9.c: Move to...
* gcc.target/riscv/sat_u_add_imm-3-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-14.c: Move to...
* gcc.target/riscv/sat_u_add_imm-4-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-15.c: Move to...
* gcc.target/riscv/sat_u_add_imm-4-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-16.c: Move to...
* gcc.target/riscv/sat_u_add_imm-4-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-13.c: Move to...
* gcc.target/riscv/sat_u_add_imm-4-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-2.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-1-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-3.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-1-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-4.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-1-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-1.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-1-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-6.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-2-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-7.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-2-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-8.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-2-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-5.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-2-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-10.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-3-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-11.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-3-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-12.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-3-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-9.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-3-u8.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-14.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-4-u16.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-15.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-4-u32.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-16.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-4-u64.c: ...here.
* gcc.target/riscv/sat_u_add_imm-run-13.c: Move to...
* gcc.target/riscv/sat_u_add_imm-run-4-u8.c: ...here.

Signed-off-by: Pan Li <pan2.li@intel.com>
8 months agoi386: Fix cstorebf4 fp comparison operand [PR117495]
Hongyu Wang [Tue, 12 Nov 2024 05:04:46 +0000 (13:04 +0800)] 
i386: Fix cstorebf4 fp comparison operand [PR117495]

For cstorebf4 it uses comparison_operator for BFmode compare, which is
incorrect when directly uses ix86_expand_setcc as it does not canonicalize
the input comparison to correct the compare code by swapping operands.
The original code without AVX10.2 calls emit_store_flag_force, who
actually calls to emit_store_flags_1 and recurisive calls to this expander
again with swapped operand and flag.
Therefore, we can avoid do the redundant recurisive call by adjusting
the comparison_operator to ix86_fp_comparison_operator, and calls
ix86_expand_setcc directly.

gcc/ChangeLog:

PR target/117495
* config/i386/i386.md (cstorebf4): Use ix86_fp_comparison_operator
and calls ix86_expand_setcc directly.

gcc/testsuite/ChangeLog:

PR target/117495
* gcc.target/i386/pr117495.c: New test.

8 months ago[PATCH] RISC-V: Bugfix for unrecognizable insn for XTheadVector
Jin Ma [Wed, 13 Nov 2024 22:19:29 +0000 (15:19 -0700)] 
[PATCH] RISC-V: Bugfix for unrecognizable insn for XTheadVector

error: unrecognizable insn:

(insn 35 34 36 2 (set (subreg:RVVM1SF (reg/v:RVVM1x4SF 142 [ _r ]) 0)
        (unspec:RVVM1SF [
                (const_vector:RVVM1SF repeat [
                        (const_double:SF 0.0 [0x0.0p+0])
                    ])
                (reg:DI 0 zero)
                (const_int 1 [0x1])
                (reg:SI 66 vl)
                (reg:SI 67 vtype)
            ] UNSPEC_TH_VWLDST)) -1
     (nil))
during RTL pass: mode_sw

PR target/116591

gcc/ChangeLog:

* config/riscv/vector.md: Add restriction to call pred_th_whole_mov.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/xtheadvector/pr116591.c: New test.

8 months agolibstdc++: Refactor std::hash specializations
Jonathan Wakely [Thu, 31 Oct 2024 16:29:18 +0000 (16:29 +0000)] 
libstdc++: Refactor std::hash specializations

This attempts to simplify and clean up our std::hash code. The primary
benefit is improved diagnostics for users when they do something wrong
involving std::hash or unordered containers. An additional benefit is
that for the unstable ABI (--enable-symvers=gnu-versioned-namespace) we
can reduce the memory footprint of several std::hash specializations.

In the current design, __hash_enum is a base class of the std::hash
primary template, but the partial specialization of __hash_enum for
non-enum types is disabled.  This means that if a user forgets to
specialize std::hash for their class type (or forgets to use a custom
hash function for unordered containers) they get error messages about
std::__hash_enum not being constructible.  This is confusing when there
is no enum type involved: why should users care about __hash_enum not
being constructible if they're not trying to hash enums?

This change makes the std::hash primary template only derive from
__hash_enum when the template argument type is an enum. Otherwise, it
derives directly from a new class template, __hash_not_enabled. This new
class template defines the deleted members that cause a given std::hash
specialization to be a disabled specialization (as per P0513R0). Now
when users try to use a disabled specialization, they get more
descriptive errors that mention __hash_not_enabled instead of
__hash_enum.

Additionally, adjust __hash_base to remove the deprecated result_type
and argument_type typedefs for C++20 and later.

In the current code we use a __poison_hash base class in the std::hash
specializations for std::unique_ptr, std::optional, and std::variant.
The primary template of __poison_hash has deleted special members, which
is used to conditionally disable the derived std::hash specialization.
This can also result in confusing diagnostics, because seeing "poison"
in an enabled specialization is misleading. Only some uses of
__poison_hash actually "poison" anything, i.e. cause a specialization to
be disabled. In other cases it's just an empty base class that does
nothing.

This change removes __poison_hash and changes the std::hash
specializations that were using it to conditionally derive from
__hash_not_enabled instead. When the std::hash specialization is
enabled, there is no more __poison_hash base class. However, to preserve
the ABI properties of those std::hash specializations, we need to
replace __poison_hash with some other empty base class. This is needed
because in the current code std::hash<std::variant<int, const int>> has
two __poison_hash<int> base classes, which must have unique addresses,
so sizeof(std::hash<std::variant<int, const int>>) == 2. To preserve
this unfortunate property, a new __hash_empty_base class is used as a
base class to re-introduce du0plicate base classes that increase the
class size. For the unstable ABI we don't use __hash_empty_base so the
std::hash<std::variant<T...>> specializations are always size 1, and
the class hierarchy is much simpler so will compile faster.

Additionally, remove the result_type and argument_type typedefs from all
disabled specializations of std::hash for std::unique_ptr,
std::optional, and std::variant. Those typedefs are useless for disabled
specializations, and although the standard doesn't say they must *not*
be present for disabled specializations, it certainly only requires them
for enabled specializations. Finally, for C++20 the typedefs are also
removed from enabled specializations of std::hash for std::unique_ptr,
std::optional, and std::variant.

libstdc++-v3/ChangeLog:

* doc/xml/manual/evolution.xml: Document removal of nested types
from std::hash specializations.
* doc/html/manual/api.html: Regenerate.
* include/bits/functional_hash.h (__hash_base): Remove
deprecated nested types for C++20.
(__hash_empty_base): Define new class template.
(__is_hash_enabled_for): Define new variable template.
(__poison_hash): Remove.
(__hash_not_enabled): Define new class template.
(__hash_enum): Remove partial specialization for non-enums.
(hash): Derive from __hash_not_enabled for non-enums, instead of
__hash_enum.
* include/bits/unique_ptr.h (__uniq_ptr_hash): Derive from
__hash_base. Conditionally derive from __hash_empty_base.
(__uniq_ptr_hash<>): Remove disabled specialization.
(hash): Do not derive from __hash_base unconditionally.
Conditionally derive from either __uniq_ptr_hash or
__hash_not_enabled.
* include/std/optional (__optional_hash_call_base): Remove.
(__optional_hash): Define new class template.
(hash): Derive from either
(hash): Conditionally derive from either __optional_hash or
__hash_not_enabled. Remove nested typedefs.
* include/std/variant (_Base_dedup): Replace __poison_hash with
__hash_empty_base.
(__variant_hash_call_base_impl): Remove.
(__variant_hash): Define new class template.
(hash): Conditionally derive from either __variant_hash or
__hash_not_enabled. Remove nested typedefs.
* testsuite/20_util/optional/hash.cc: Check whether nested types
are present.
* testsuite/20_util/variant/hash.cc: Likewise.
* testsuite/20_util/optional/hash_abi.cc: New test.
* testsuite/20_util/unique_ptr/hash/abi.cc: New test.
* testsuite/20_util/unique_ptr/hash/types.cc: New test.
* testsuite/20_util/variant/hash_abi.cc: New test.

8 months agolibstdc++: Add _Hashtable::_M_locate(const key_type&)
Jonathan Wakely [Thu, 7 Nov 2024 11:49:41 +0000 (11:49 +0000)] 
libstdc++: Add _Hashtable::_M_locate(const key_type&)

We have two overloads of _M_find_before_node but they have quite
different performance characteristics, which isn't necessarily obvious.

The original version, _M_find_before_node(bucket, key, hash_code), looks
only in the specified bucket, doing a linear search within that bucket
for an element that compares equal to the key. This is the typical fast
lookup for hash containers, assuming the load factor is low so that each
bucket isn't too large.

The newer _M_find_before_node(key) was added in r12-6272-ge3ef832a9e8d6a
and could be naively assumed to calculate the hash code and bucket for
key and then call the efficient _M_find_before_node(bkt, key, code)
function. But in fact it does a linear search of the entire container.
This is potentially very slow and should only be used for a suitably
small container, as determined by the __small_size_threshold() function.
We don't even have a comment pointing out this O(N) performance of the
newer overload.

Additionally, the newer overload is only ever used in exactly one place,
which would suggest it could just be removed. However there are several
places that do the linear search of the whole container with an explicit
loop each time.

This adds a new member function, _M_locate, and uses it to replace most
uses of _M_find_node and the loops doing linear searches. This new
member function does both forms of lookup, the linear search for small
sizes and the _M_find_node(bkt, key, code) lookup within a single
bucket. The new function returns a __location_type which is a struct
that contains a pointer to the first node matching the key (if such a
node is present), or the hash code and bucket index for the key. The
hash code and bucket index allow the caller to know where a new node
with that key should be inserted, for the cases where the lookup didn't
find a matching node.

The result struct actually contains a pointer to the node *before* the
one that was located, as that is needed for it to be useful in erase and
extract members. There is a member function that returns the found node,
i.e. _M_before->_M_nxt downcast to __node_ptr, which should be used in
most cases.

This new function greatly simplifies the functions that currently have
to do two kinds of lookup and explicitly check the current size against
the small size threshold.

Additionally, now that try_emplace is defined directly in _Hashtable
(not in _Insert_base) we can use _M_locate in there too, to speed up
some try_emplace calls. Previously it did not do the small-size linear
search.

It would be possible to add a function to get a __location_type from an
iterator, and then rewrite some functions like _M_erase and
_M_extract_node to take a __location_type parameter. While that might be
conceptually nice, it wouldn't really make the code any simpler or more
readable than it is now. That isn't done in this change.

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (__location_type): New struct.
(_M_locate): New member function.
(_M_find_before_node(const key_type&)): Remove.
(_M_find_node): Move variable initialization into condition.
(_M_find_node_tr): Likewise.
(operator=(initializer_list<T>), try_emplace, _M_reinsert_node)
(_M_merge_unique, find, erase(const key_type&)): Use _M_locate
for lookup.

8 months agolibstdc++: Simplify _Hashtable merge functions
Jonathan Wakely [Thu, 7 Nov 2024 17:04:49 +0000 (17:04 +0000)] 
libstdc++: Simplify _Hashtable merge functions

I realised that _M_merge_unique and _M_merge_multi call extract(iter)
which then has to call _M_get_previous_node to iterate through the
bucket to find the node before the one iter points to. Since the merge
function is already iterating over the entire container, we had the
previous node a moment ago. Walking the whole bucket to find it again is
wasteful. We could just rewrite the loop in terms of node pointers
instead of iterators, and then call _M_extract_node directly. However,
this is only possible when the source container is the same type as the
destination, because otherwise we can't access the source's private
members (_M_before_begin, _M_begin, _M_extract_node etc.)

Add overloads of _M_merge_unique and _M_merge_multi that work with
source containers of the same type, to enable this optimization.

For both overloads of _M_merge_unique we can also remove the conditional
modifications to __n_elt and just consistently decrement it for every
element processed. Use a multiplier of one or zero that dictates whether
__n_elt is passed to _M_insert_unique_node or not. We can also remove
the repeated calls to size() and just keep track of the size in a local
variable.

Although _M_merge_unique and _M_merge_multi should be safe for
"self-merge", i.e. when doing c.merge(c), it's wasteful to search/insert
every element when we don't need to do anything. Add 'this == &source'
checks to the overloads taking an lvalue of the container's own type.
Because those checks aren't needed for the rvalue overloads, change
those to call the underlying _M_merge_xxx function directly instead of
going through the lvalue overload that checks the address.

I've also added more extensive tests for better coverage of the new
overloads added in this commit.

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (_M_merge_unique): Add overload for
merging from same type.
(_M_merge_unique<Compatible>): Simplify size tracking. Add
comment.
(_M_merge_multi): Add overload for merging from same type.
(_M_merge_multi<Compatible>): Add comment.
* include/bits/unordered_map.h (unordered_map::merge): Check for
self-merge in the lvalue overload. Call _M_merge_unique directly
for the rvalue overload.
(unordered_multimap::merge): Likewise.
* include/bits/unordered_set.h (unordered_set::merge): Likewise.
(unordered_multiset::merge): Likewise.
* testsuite/23_containers/unordered_map/modifiers/merge.cc:
Add more tests.
* testsuite/23_containers/unordered_multimap/modifiers/merge.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/modifiers/merge.cc:
Likewise.
* testsuite/23_containers/unordered_set/modifiers/merge.cc:
Likewise.

8 months agolibstdc++: Remove _Hashtable_base::_S_equals
Jonathan Wakely [Wed, 6 Nov 2024 18:48:07 +0000 (18:48 +0000)] 
libstdc++: Remove _Hashtable_base::_S_equals

This removes the overloaded _S_equals and _S_node_equals functions,
replacing them with 'if constexpr' in the handful of places they're
used.

libstdc++-v3/ChangeLog:

* include/bits/hashtable_policy.h (_Hashtable_base::_S_equals):
Remove.
(_Hashtable_base::_S_node_equals): Remove.
(_Hashtable_base::_M_key_equals_tr): Fix inaccurate
static_assert string.
(_Hashtable_base::_M_equals, _Hashtable_base::_M_equals_tr): Use
'if constexpr' instead of _S_equals.
(_Hashtable_base::_M_node_equals): Use 'if constexpr' instead of
_S_node_equals.

8 months agolibstdc++: Remove _Equality base class from _Hashtable
Jonathan Wakely [Tue, 5 Nov 2024 22:39:43 +0000 (22:39 +0000)] 
libstdc++: Remove _Equality base class from _Hashtable

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (_Hashtable): Remove _Equality base
class.
(_Hashtable::_M_equal): Define equality comparison here instead
of in _Equality::_M_equal.
* include/bits/hashtable_policy.h (_Equality): Remove.

8 months agolibstdc++: Remove _Insert base class from _Hashtable
Jonathan Wakely [Fri, 1 Nov 2024 23:53:52 +0000 (23:53 +0000)] 
libstdc++: Remove _Insert base class from _Hashtable

There's no reason to have a separate base class defining the insert
member functions now. They can all be moved into the _Hashtable class,
which simplifies them slightly.

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (_Hashtable): Remove inheritance from
__detail::_Insert and move its members into _Hashtable.
* include/bits/hashtable_policy.h (__detail::_Insert): Remove.

Reviewed-by: François Dumont <fdumont@gcc.gnu.org>
8 months agolibstdc++: Use RAII in _Hashtable
Jonathan Wakely [Fri, 1 Nov 2024 22:20:22 +0000 (22:20 +0000)] 
libstdc++: Use RAII in _Hashtable

Use scoped guard types to clean up if an exception is thrown. This
allows some try-catch blocks to be removed.

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (operator=(const _Hashtable&)): Use
RAII instead of try-catch.
(_M_assign(_Ht&&, _NodeGenerator&)): Likewise.

Reviewed-by: François Dumont <fdumont@gcc.gnu.org>
8 months agolibstdc++: Replace _Hashtable::__fwd_value_for with cast
Jonathan Wakely [Fri, 1 Nov 2024 21:52:37 +0000 (21:52 +0000)] 
libstdc++: Replace _Hashtable::__fwd_value_for with cast

We can just use a cast to the appropriate type instead of calling a
function to do it. This gives the compiler less work to compile and
optimize, and at -O0 avoids a function call per element.

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (_Hashtable::__fwd_value_for):
Remove.
(_Hashtable::_M_assign): Use static_cast instead of
__fwd_value_for.

Reviewed-by: François Dumont <fdumont@gcc.gnu.org>
8 months agolibstdc++: Add _Hashtable::_M_assign for the common case
Jonathan Wakely [Fri, 1 Nov 2024 14:17:38 +0000 (14:17 +0000)] 
libstdc++: Add _Hashtable::_M_assign for the common case

This adds a convenient _M_assign overload for the common case where the
node generator is the _AllocNode type. Only two places need to call
_M_assign with a _ReuseOrAllocNode node generator, so all the other
calls to _M_assign can use the new overload instead of manually
constructing a node generator.

The _AllocNode::operator(Args&&...) function doesn't need to be a
variadic template. It is only ever called with a single argument of type
const value_type& or value_type&&, so could be simplified. That isn't
done in this commit.

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (_Hashtable): Remove typedefs for
node generators.
(_Hashtable::_M_assign(_Ht&&)): Add new overload.
(_Hashtable::operator=(initializer_list<value_type>)): Add local
typedef for node generator.
(_Hashtable::_M_assign_elements): Likewise.
(_Hashtable::operator=(const _Hashtable&)): Use new _M_assign
overload.
(_Hashtable(const _Hashtable&)): Likewise.
(_Hashtable(const _Hashtable&, const allocator_type&)):
Likewise.
(_Hashtable(_Hashtable&&, __node_alloc_type&&, false_type)):
Likewise.
* include/bits/hashtable_policy.h (_Insert): Remove typedef for
node generator.

Reviewed-by: François Dumont <fdumont@gcc.gnu.org>
8 months agolibstdc++: Refactor Hashtable erasure
Jonathan Wakely [Thu, 31 Oct 2024 19:53:55 +0000 (19:53 +0000)] 
libstdc++: Refactor Hashtable erasure

This reworks the internal member functions for erasure from
unordered containers, similarly to the earlier commit doing it for
insertion.

Instead of multiple overloads of _M_erase which are selected via tag
dispatching, the erase(const key_type&) member can use 'if constexpr' to
choose an appropriate implementation (returning after erasing a single
element for unique keys, or continuing to erase all equivalent elements
for non-unique keys).

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (_Hashtable::_M_erase): Remove
overloads for erasing by key, moving logic to ...
(_Hashtable::erase): ... here.

Reviewed-by: François Dumont <fdumont@gcc.gnu.org>