Artemiy Volkov [Mon, 27 Oct 2025 14:47:31 +0000 (14:47 +0000)]
match.pd: simplify (view_convert (BIT_FIELD_REF))
This patch adds a match.pd transformation to strip unnecessary
view_converts of BIT_FIELD_REFs. This is only valid when the type of the
view_convert is a register type, and no loss of precision is involved when
casting to an integer type; both of these conditions are checked for in
the if clause of the new pattern.
The change survives bootstrap + regtest on aarch64 and x86_64, and one
additional test case has been added to gcc.dg/tree-ssa.
Changes since v1:
- Require is_gimple_reg_type (type) and remove conditions on @0
- Reword the commit message to reflect code changes
gcc/ChangeLog:
* match.pd: Add pattern to simplify view_convert (BIT_FIELD_REF).
Eric Botcazou [Tue, 28 Oct 2025 09:13:35 +0000 (10:13 +0100)]
Ada: Fix instantiation failure for package with formal package parameters
The problem occurs for a generic package with a formal package parameter
that contains a nested generic package used in the instantiation of another
generic package with two formal package parameters.
It turns out that the mapping between formals and actuals for the latter two
formal package parameters done by Map_Formal_Package_Entities is blocked by
the presence of the first formal package parameter, more precisely by the
special name built for the formal in the parent of a child unit. The fix
is just to set the Is_Internal flag on this special name.
gcc/ada/
PR ada/59234
* sem_ch12.adb (Analyze_Formal_Package_Declaration): Mark the
special name built for the formal in the parent of a child unit
as internal.
gcc/testsuite/
* gnat.dg/specs/generic_inst5.ads: New test.
* gnat.dg/specs/generic_inst5_pkg1.ads: New helper.
* gnat.dg/specs/generic_inst5_pkg2.ads: Likewise.
Eric Botcazou [Tue, 28 Oct 2025 08:56:33 +0000 (09:56 +0100)]
Ada: Fix generic formal subprogram with implicit default wrongly rejected
It's another issue with a formal subprogram parameter of a generic unit,
whose default is specified by a box and the actual is omitted, so an
implicit actual with the name of the formal is used instead and resolved
in the context of the instance.
The problem is that, for a child generic unit, the parent unit needs to be
loaded during the instantiation, but it cannot be used to resolve implicit
actuals, which must be resolved in the context of the instance. So an
ad-hoc mechanism is implemented to prune references to the parent unit(s)
for this resolution, but that's wrong if the parent unit was loaded at an
earlier point in the context of the instance.
The fix disables this ad-hoc mechanism in the case where the parent unit
has not been loaded during the instantiation by propagating the boolean
Parent_Installed flag through the call chain.
gcc/ada/
PR ada/34511
* sem_ch12.adb (Analyze_Associations): Add Parent_Installed formal
parameter and pass it in call to Analyze_One_Association.
(Analyze_One_Association): Add Parent_Installed formal parameter
and pass it in call to Instantiate_Formal_Subprogram.
(Analyze_Formal_Package_Declaration): Pass Parent_Installed in call
to Analyze_Associations.
(Analyze_Package_Instantiation): Likewise.
(Analyze_Subprogram_Instantiation): Likewise.
(Instantiate_Formal_Subprogram): Add Parent_Installed formal
parameter and prune references to the parent unit(s) only if
it is true.
gcc/testsuite/
* gnat.dg/specs/generic_inst4-child2.ads: New test.
* gnat.dg/specs/generic_inst4.ads: New helper.
* gnat.dg/specs/generic_inst4-child1.ads: Likewise.
Thomas Schwinge [Fri, 24 Oct 2025 07:59:53 +0000 (09:59 +0200)]
libgomp: Simplify 'parse_stacksize' call in 'libgomp/env.c:initialize_env'
Minor fix-up for commit r13-2545-g9f2fca56593a2b87026b399d26adcdca90705685
"OpenMP, libgomp: Environment variable syntax extension". Supplying an array
of three elements is misleading: 'parse_stacksize' only looks at 'params[0]'.
Just let the compiler figure out the array size (..., as done elsewhere, too).
Avinash Jayakar [Tue, 28 Oct 2025 04:19:21 +0000 (09:49 +0530)]
vect: Add vector lowering for MULT_EXPR for constant pow2 multiplication.
Use logic similar to lowering the vector operation for MULT_EXPR as done in
expand_mult in expmed.cc, but in this commit only bare bones version of what
is done in vect_synth_mult_by_constant is implemented that only works if
constant is a positive power of 2 constant.
Previously, if the source code is written in a vector dialect, for example the
vector types of altivec.h, the vectorizer would lower the MULT_EXPR to scalar
variant if the target did not support the vector insn for that type. But better
code could be generated had it recognized the pattern and transformed it to
shifts.
For example, this code
vector unsigned long long
lshift1_64_altivec (vector unsigned long long a)
{
return a * (vector unsigned long long) { 4, 4 };
}
gcc/ChangeLog:
PR tree-optimization/122065
* tree-vect-generic.cc (add_rshift): Update name and add code parameter.
(add_shift): Update name.
(expand_vector_mult): New lowering for MULT_EXPR.
(expand_vector_divmod): Use updated function name.
(expand_vector_operation): Use updated function name.
Nathaniel Shead [Sat, 18 Oct 2025 12:43:14 +0000 (23:43 +1100)]
c++/modules: Use containing type as key for all member lambdas [PR122310]
The ICE in the linked PR occurs because we first stream the lambda type
before its keyed decl has been streamed, but the key decl's type depends
on the lambda. And so when streaming the key decl to check for an
existing decl to merge with, merging the key decl itself crashes because
its type has only been partially streamed.
This patch fixes the issue by generalising the existing FIELD_DECL
handling to any class member using the outermost containing TYPE_DECL as
its key type. This way we can guarantee that the key decl has been
streamed before the lambda type is otherwise needed.
PR c++/122310
gcc/cp/ChangeLog:
* module.cc (get_keyed_decl_scope): New function.
(trees_out::get_merge_kind): Use it.
(trees_out::key_mergeable): Use it.
(maybe_key_decl): Key to the containing type for all members.
gcc/testsuite/ChangeLog:
* g++.dg/modules/lambda-12.h: New test.
* g++.dg/modules/lambda-12_a.H: New test.
* g++.dg/modules/lambda-12_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
Andrew Pinski [Sun, 26 Oct 2025 19:21:08 +0000 (12:21 -0700)]
expand: Move the [0,1] detection for a*b to use the ranger
In r14-6418-gacbfb8b9495b, the detection of boolean range was moved
over to use gimple_zero_one_valued_p but now that we can use the full ranger
during expand, let's use that instead. Adds a new helper function called
expr_has_boolean_range. This calls ssa_name_has_boolean_range when there
is an ssa name; otherwise checks the constant value for boolean[0,1].
An example is:
```
unsigned f(unsigned b, unsigned c, unsigned d)
{
if (b <= 1)
return b * c;
return d;
}
```
Where before this would not try to expand as `c & -b` but we know that b has [0,1] range,
this will expand as `c & -b` for many targets.
Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
* expr.cc (expr_has_boolean_range): New function.
(expand_expr_real_2): Use expr_has_boolean_range instead of
gimple_zero_one_valued_p.
* tree-ssanames.cc (ssa_name_has_boolean_range): Update to take
a gimple STMT.
* tree-ssanames.h (ssa_name_has_boolean_range): Update for the new
argument and default to nullptr.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
SRA likes to create VCE<bool>(a) when it comes to bool. This confuses
a few different passes including jump threading and uninitialization
warning. This removes the VCE in one case where it will help and when it
is known not to have any undefined behavior since the ranges of a is known
to be 0/1.
This implements similar was done for PR 80635 but without VRP's help; ccp
provides enough on the range/non-zeroness to implement this in match.
This will fix many of the std::optional reported warnings at -O1 too.
pr80635-[34].C are the same as pr80635-[12].C but compiled at -O1 rather
than just -O2.
H.J. Lu [Sun, 26 Oct 2025 00:42:20 +0000 (08:42 +0800)]
c: Try the type with the previous function attributes
When there are 2 conflicting function declarations, try the new type
with the previous TYPE_ATTRIBUTES if the current declaration has no
TYPE_ATTRIBUTES to support
$ gcc -O2 -fcf-protection -S x.c
x.c:4:1: error: conflicting types for ‘foo’; have ‘void(void)’
4 | foo (void)
| ^~~
x.c:1:13: note: previous declaration of ‘foo’ with type ‘void(void)’
1 | extern void foo (void) __attribute__((nocf_check));
| ^~~
The resulting function definition is compatible with the previous
declaration.
gcc/c/
PR c/122427
* c-decl.cc (diagnose_mismatched_decls): For FUNCTION_DECL, if
OLDDECL has TYPE_ATTRIBUTES and NEWDECL doesn't, try the type
with the OLDDECL attributes.
Eric Botcazou [Mon, 27 Oct 2025 18:10:49 +0000 (19:10 +0100)]
Ada: Fix visibility problem for implicit actual of formal subprogram
If an actual parameter for a formal subprogram parameter of a generic unit,
whose default is specified by a box, is omitted then an implicit actual with
the name of the formal is used and resolved in the context of the instance.
If this context is a generic unit, and these implicit actuals are resolved
to global references, then these implicit actuals need to be retrofitted
into the unanalyzed copy of the generic unit, so that instances of this
generic unit do not resolve again the implicit actuals but inherit the
global references instead.
This works fine for instances whose name is a direct name but not for those
whose name is an expanded name (in GNAT parlance). The patch also contains
a small cleanup for a related procedure.
gcc/ada/
PR ada/25988
* sem_ch12.adb (Save_Global_References.Reset_Entity): Also call
Save_Global_Defaults for instances with an expanded name.
(Save_Global_References.Save_References): Minor code cleanup.
gcc/testsuite/
* gnat.dg/specs/generic_inst3.ads: New test.
* gnat.dg/specs/generic_inst3_pkg1.ads: New helper.
* gnat.dg/specs/generic_inst3_pkg1.adb: New helper.
* gnat.dg/specs/generic_inst3_pkg2.ads: Likewise.
* gnat.dg/specs/generic_inst3_pkg3.ads: Likewise.
* gnat.dg/specs/generic_inst3_pkg3-child.ads: Likewise.
Tamar Christina [Mon, 27 Oct 2025 17:55:38 +0000 (17:55 +0000)]
vect: Fix operand swapping on complex multiplication detection [PR122408]
For
SUBROUTINE a( j, b, c, d )
!GCC$ ATTRIBUTES noinline :: a
COMPLEX*16 b
COMPLEX*16 c( * ), d( * )
DO k = 1, j
c( k ) = - b * CONJG( d( k ) )
END DO
END
we incorrectly generate .IFN_COMPLEX_MUL instead of .IFN_COMPLEX_MUL_CONJ.
The issue happens because in the call to vect_validate_multiplication the
operand vectors are passed by reference and so the stripping of the NEGATE_EXPR
after matching modifies the input vector. If validation fail we flip the
operands and try again. But we've already stipped the negates and so if we
match we would match a normal multiply.
This fixes the API by marking the operands as const and instead pass an explicit
output vec that's to be used. This also reduces the number of copies we were
doing.
With this we now correctly detect .IFN_COMPLEX_MUL_CONJ. Weirdly enough I
couldn't reproduce this with any C example because they get reassociated
differently and always succeed on the first attempt. Fortran is easy to
trigger though so new fortran tests added.
gcc/ChangeLog:
PR tree-optimization/122408
* tree-vect-slp-patterns.cc (vect_validate_multiplication): Cleanup and
document interface.
(complex_mul_pattern::matches, complex_fms_pattern::matches): Update to
new interface.
gcc/testsuite/ChangeLog:
PR tree-optimization/122408
* gfortran.target/aarch64/pr122408_1.f90: New test.
* gfortran.target/aarch64/pr122408_2.f90: New test.
James K. Lowden [Mon, 27 Oct 2025 17:36:10 +0000 (13:36 -0400)]
Various fixes for XML PARSE.
Annotate unused parameters. Do not compile some functions that might
not be needed. Consistent with libgcobol, log errors via syslog(3).
Introduce push-parser as experiment.
libgcobol/ChangeLog: Correct warnings and errors in xmlparse.cc.
* xmlparse.cc (CTX): Macro for unused user-context parameter.
(attributeDecl): Mark unused parameters.
(cdataBlock): Same.
(characters): Same.
(comment): Same.
(elementDecl): Same.
(endDocument): Same.
(endElementNs): Same.
(endElement): Same.
(entityDecl): Same.
(error): Same.
(externalSubset): Same.
(fatalError): Same.
(getEntity): Eliminate via preprocessor until needed.
(getParameterEntity): Same.
(hasExternalSubset): Mark unused parameters.
(hasInternalSubset): Same.
(ignorableWhitespace): Same.
(internalSubset): Same.
(isStandalone): Eliminate via preprocessor until needed.
(notationDecl): Mark unused parameters.
(processingInstruction): Same.
(reference): Same.
(resolveEntity): Eliminate via preprocessor until needed.
(setDocumentLocator): Mark unused parameters.
(startDocument): Same.
(startElementNs): Same.
(startElement): Same.
(unparsedEntityDecl): Same.
(warning): Same.
(xmlchar_of): Utility cast function.
(xmlParserErrors_str): Message string for libxml2 errors.
(xmlerror_str): Macro to include textual form of libxml2 error.
(context_t): Push-parser context class.
(xml_push_parse): Use push-parser.
(__gg__xml_parse_done): Signify end-of-input to XML push-parser.
(__gg__xml_parse): Mark unused parameters.
Jakub Jelinek [Mon, 27 Oct 2025 16:40:47 +0000 (17:40 +0100)]
phiopt: Fix up DEBUG_EXPR_DECL creation in spaceship_replacement [PR122394]
The following testcase ICEs in gcc 15 (and is at least latent in 12-14 too),
because the DEBUG_EXPR_DECL has incorrect mode. It has
TREE_TYPE (orig_use_lhs) type, but TYPE_MODE (type) rather than
TYPE_MODE (TREE_TYPE (orig_use_lhs)) where the two types are sometimes
the same, but sometimes different (same if !has_cast_debug_uses, different
otherwise).
Though, there wouldn't be the this issue if it used the proper API to create
the DEBUG_EXPR_DECL which takes care of everything. This is the sole
spot that doesn't use that API.
Doesn't affect the trunk because the code has been removed and replaced with
different stuff after the libstdc++ ABI change in r16-3474.
Before r15-5557 the mode has been always wrong because this was done only
for has_cast_debug_uses. And the bug has been introduced with r12-5490.
Enough archeology, while it could be fixed by changing the second
SET_DECL_MODE argument, I think it is better to use build_debug_expr_decl.
On the trunk only the testcase is being added.
2025-10-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/122394
* g++.dg/opt/pr122394.C: New test.
OpenMP/C++: Fix label mangling in metadirective body [PR122378]
Testcase c-c++-common/gomp/attrs-metadirective-2.c failed in C++ when
OFFLOAD_TARGET_NAMES=nvptx-none. That was caused by label mangling being applied
to the use but not to the declaration.
This is now fixed by mangling the declaration as well.
PR c++/122378
gcc/cp/ChangeLog:
* parser.cc (cp_parser_label_declaration): Mangle label declaration in a
metadirective region.
Paul Thomas [Mon, 27 Oct 2025 14:19:33 +0000 (14:19 +0000)]
Fortran: Fix ICE due to PDT selector expression in ASSOCIATE [PR95541]
2025-10-27 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/922290
* resolve.cc (resolve_typebound_intrinsic_op): Add pdt_template
to the list of preemted specifics.
PR fortran/95541
* trans-stmt.cc (trans_associate_var): PDT array and string
components are separately allocated for each element of a PDT
array, so copy in and copy out the selector expression.
gcc/testsuite/
PR fortran/95541
* gfortran.dg/pdt_61.f03: New test.
Richard Biener [Mon, 20 Oct 2025 08:20:18 +0000 (10:20 +0200)]
Cleanup flag_complex_method further
PR122325 reports that -ffast-math no longer enables -fcx-limited-range.
This is due to the weird handling of flag_default_complex_method which
the following simply removes. Frontends that wish to impose a default
evaluation method that is not -fcx-fortran-rules (the current default
of flag_default_complex_method) need to imposed that in ther
init_options_struct langhook which those requesting C std rules already
do and I'm adding that for the fortran frontend, explicitly requesting
fortran rules.
PR middle-end/122325
gcc/
* common.opt (flag_default_complex_method): Remove.
* opts.cc (init_options_struct): Default to fortran rules
for complex evaluations.
(finish_options): Remove (re-)instantiating of the frontend
default of the complex evaluation method.
gcc/c-family/
* c-opts.cc (c_common_init_options_struct): Remove set of
flag_default_complex_method.
gcc/go/
* go-lang.cc (go_langhook_init_options_struct): Remove set of
flag_default_complex_method.
gcc/lto/
* lto-lang.cc (lto_init_options_struct): Remove set of
flag_default_complex_method.
gcc/fortran/
* options.cc (gfc_init_options_struct): Set flag_complex_method
to fortran rules.
gcc/testsuite/
* gcc.dg/complex-8.c: New testcase.
* gcc.dg/complex-9.c: Likewise.
Add comprehensive testsuite for VLS calling convention covering various
ABI_VLEN (32, 64, 128, 256, 512) and XLEN (32, 64) combinations. Tests
include single vectors, structs, unions, register exhaustion, and mixed
type scenarios.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_128bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_256bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_32bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_64bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_all_mixed.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_call_mixed_function.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_different_vector_elements.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_different_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_different_width_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_equivalent_struct.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_four_registers.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_fp_vs_int_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_large_vector_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_mixed_args.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_mixed_float_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_mixed_int_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_mixed_struct.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_mixed_struct_advanced.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_mixed_vector_types_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_multiple_unions.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_multiple_vectors.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_multiple_with_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_register_exhaustion.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_register_exhaustion_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_register_pressure_scenarios.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_same_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_simple_union.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_single_register.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_single_vector_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_struct_different_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_struct_eight_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_struct_five_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_struct_four_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_struct_nine_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_two_registers.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_vector_array_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_128bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_256bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_32bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_64bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_all_mixed.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_call_mixed_function.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_different_vector_elements.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_different_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_different_width_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_equivalent_struct.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_four_registers.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_fp_vs_int_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_large_vector_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_mixed_args.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_mixed_float_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_mixed_int_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_mixed_struct.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_mixed_struct_advanced.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_mixed_vector_types_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_multiple_unions.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_multiple_vectors.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_multiple_with_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_register_exhaustion.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_register_exhaustion_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_register_pressure_scenarios.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_same_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_simple_union.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_single_register.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_single_vector_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_struct_different_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_struct_eight_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_struct_five_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_struct_four_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_struct_nine_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_two_registers.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_vector_array_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_128bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_256bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_32bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_64bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_all_mixed.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_call_mixed_function.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_different_vector_elements.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_different_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_different_width_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_equivalent_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_four_registers.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_fp_vs_int_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_large_vector_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_mixed_args.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_mixed_float_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_mixed_int_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_mixed_struct.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_mixed_struct_advanced.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_mixed_vector_types_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_multiple_unions.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_multiple_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_multiple_with_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_register_exhaustion.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_register_exhaustion_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_register_pressure_scenarios.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_same_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_simple_union.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_single_register.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_single_vector_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_struct_different_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_struct_eight_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_struct_five_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_struct_four_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_struct_nine_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_two_registers.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_vector_array_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_128bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_256bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_32bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_64bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_all_mixed.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_call_mixed_function.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_different_vector_elements.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_different_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_different_width_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_equivalent_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_four_registers.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_fp_vs_int_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_large_vector_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_mixed_args.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_mixed_float_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_mixed_int_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_mixed_struct.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_mixed_struct_advanced.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_mixed_vector_types_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_multiple_unions.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_multiple_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_multiple_with_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_register_exhaustion.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_register_exhaustion_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_register_pressure_scenarios.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_same_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_simple_union.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_single_register.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_single_vector_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_struct_different_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_struct_eight_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_struct_five_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_struct_four_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_struct_nine_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_two_registers.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_vector_array_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_128bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_256bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_32bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_64bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_all_mixed.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_call_mixed_function.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_different_vector_elements.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_different_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_different_width_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_equivalent_struct.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_four_registers.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_fp_vs_int_vectors.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_large_vector_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_mixed_args.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_mixed_float_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_mixed_int_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_mixed_struct.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_mixed_struct_advanced.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_mixed_vector_types_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_multiple_unions.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_multiple_vectors.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_multiple_with_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_register_exhaustion.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_register_exhaustion_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_register_pressure_scenarios.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_same_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_simple_union.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_single_register.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_single_vector_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_struct_different_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_struct_eight_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_struct_five_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_struct_four_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_struct_nine_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_two_registers.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_vector_array_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_128bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_256bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_32bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_64bit_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_all_mixed.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_call_mixed_function.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_different_vector_elements.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_different_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_different_width_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_equivalent_struct.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_four_registers.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_fp_vs_int_vectors.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_large_vector_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_mixed_args.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_mixed_float_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_mixed_int_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_mixed_struct.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_mixed_struct_advanced.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_mixed_vector_types_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_multiple_unions.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_multiple_vectors.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_multiple_with_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_register_exhaustion.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_register_exhaustion_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_register_pressure_scenarios.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_same_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_simple_union.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_single_register.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_single_vector_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_struct_different_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_struct_eight_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_struct_five_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_struct_four_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_struct_nine_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_two_registers.c: New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_vector_array_struct.c:
New test.
Add comprehensive testsuite for VLS calling convention covering various
ABI_VLEN (128, 256) and XLEN (32, 64) combinations. Tests include single
vectors, structs, unions, register exhaustion, and mixed type scenarios.
This patch adds the test infrastructure and tests for ABI_VLEN 128 and 256.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_128bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_256bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_32bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_64bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_all_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_call_mixed_function.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_different_vector_elements.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_different_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_different_width_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_equivalent_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_four_registers.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_fp_vs_int_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_large_vector_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_mixed_args.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_mixed_float_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_mixed_int_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_mixed_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_mixed_struct_advanced.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_mixed_vector_types_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_multiple_unions.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_multiple_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_multiple_with_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_register_exhaustion.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_register_exhaustion_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_register_pressure_scenarios.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_same_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_simple_union.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_single_register.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_single_vector_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_struct_different_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_struct_eight_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_struct_five_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_struct_four_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_struct_nine_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_two_registers.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_vector_array_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_128bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_256bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_32bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_64bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_all_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_call_mixed_function.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_different_vector_elements.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_different_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_different_width_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_equivalent_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_four_registers.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_fp_vs_int_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_large_vector_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_mixed_args.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_mixed_float_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_mixed_int_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_mixed_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_mixed_struct_advanced.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_mixed_vector_types_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_multiple_unions.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_multiple_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_multiple_with_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_register_exhaustion.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_register_exhaustion_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_register_pressure_scenarios.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_same_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_simple_union.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_single_register.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_single_vector_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_struct_different_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_struct_eight_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_struct_five_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_struct_four_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_struct_nine_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_two_registers.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_vector_array_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_128bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_256bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_32bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_64bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_all_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_call_mixed_function.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_different_vector_elements.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_different_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_different_width_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_equivalent_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_four_registers.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_fp_vs_int_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_large_vector_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_mixed_args.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_mixed_float_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_mixed_int_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_mixed_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_mixed_struct_advanced.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_mixed_vector_types_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_multiple_unions.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_multiple_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_multiple_with_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_register_exhaustion.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_register_exhaustion_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_register_pressure_scenarios.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_same_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_simple_union.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_single_register.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_single_vector_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_struct_different_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_struct_eight_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_struct_five_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_struct_four_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_struct_nine_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_two_registers.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_vector_array_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_128bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_256bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_32bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_64bit_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_all_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_call_mixed_function.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_different_vector_elements.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_different_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_different_width_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_equivalent_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_four_registers.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_fp_vs_int_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_large_vector_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_mixed_args.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_mixed_float_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_mixed_int_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_mixed_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_mixed_struct_advanced.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_mixed_vector_types_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_multiple_unions.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_multiple_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_multiple_with_small_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_register_exhaustion.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_register_exhaustion_mixed.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_register_pressure_scenarios.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_same_vectors_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_simple_union.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_single_register.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_single_vector_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_struct_different_abi_vlen.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_struct_eight_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_struct_five_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_struct_four_256bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_struct_nine_128bit_vectors.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_two_registers.c:
New test.
* gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_vector_array_struct.c:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_128bit_vector.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_256bit_vector.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_32bit_vector.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_64bit_vector.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_all_mixed.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_call_mixed_function.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_different_vector_elements.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_different_vectors_struct.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_different_width_vectors_struct.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_equivalent_struct.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_four_registers.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_fp_vs_int_vectors.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_large_vector_small_abi_vlen.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_mixed_args.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_mixed_float_vector.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_mixed_int_vector.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_mixed_struct.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_mixed_struct_advanced.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_mixed_vector_types_struct.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_multiple_unions.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_multiple_vectors.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_multiple_with_small_abi_vlen.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_register_exhaustion.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_register_exhaustion_mixed.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_register_pressure_scenarios.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_same_vectors_struct.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_simple_union.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_single_register.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_single_vector_struct.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_struct_different_abi_vlen.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_struct_eight_128bit_vectors.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_struct_five_256bit_vectors.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_struct_four_256bit_vectors.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_struct_nine_128bit_vectors.h:
New test.
* gcc.target/riscv/rvv/vls-cc/common/test_two_registers.h: New test.
* gcc.target/riscv/rvv/vls-cc/common/test_vector_array_struct.h: New test.
* gcc.target/riscv/rvv/vls-cc/riscv-vls-cc.exp: New test.
* gcc.target/riscv/rvv/vls-cc/test_128_abi_vlen_large_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/test_128_abi_vlen_medium_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/test_256_abi_vlen_large_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/test_256_abi_vlen_very_large_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/test_32_abi_vlen_medium_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/test_32_abi_vlen_small_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/test_64_abi_vlen_medium_vector.c:
New test.
* gcc.target/riscv/rvv/vls-cc/test_64_abi_vlen_small_vector.c: New test.
* gcc.target/riscv/rvv/vls-cc/vls-cc-common.h: New test.
Kito Cheng [Fri, 8 Aug 2025 01:10:56 +0000 (09:10 +0800)]
RISC-V: Implement standard fixed-length vector calling convention variant
This patch implements the standard fixed-length vector calling convention
variant as specified in the RISC-V ELF psABI document. The implementation
introduces ABI_VLEN to serve as the minimal VLEN for fixed-length vectors.
For example, int32x8_t is a 256-bit vector type. If ABI_VLEN is 128, it
will be passed in two vector registers as LMUL 2. If ABI_VLEN is larger
than 256, it will be passed in one vector register as LMUL 1.
This differs from the minimal VLEN (defined by ZVL*B extension) to ensure
ABI stability when the program compiles with different VLEN/ZVL*B settings.
Change since v1:
- Adding check_only parameter for several functions to make sure we
won't emit warnings during checking function ABI.
We can't split it because the result would be 2 insns and it was already 2
insns from combine's standpoint (the little while lie shows up in insn 10 which
is really 2 instructions, but just one insn).
I looked at the wacky possibility of making the problem pattern only available
after reload in the hopes that late-combine could generate it, but late-combine
doesn't handle scratches/clobbers like that.
I consider the cases where the lie helps code generation very much on the
margins and realized that we could turn it into a peephole2. That way we don't
regress on those marginal cases, but the problem pattern doesn't get in the way
of combine's work.
So that's a good first step. But not entirely sufficient to get the best
possible code for those tests. In particular, given equal costs this patch
also steers towards AND which has the advantage that on an OoO core the
constant load in that case can sometimes issue for free or it might be
encodable directly as well. On an in-order core it gives the scheduler more
freedom.
There's a bit of tension on that topic and some issues I'm not trying to tackle
at this time. Essentially in the sign-bit-splat path, depending on the
constants different paths might be preferred (particularly when there's a NOT
in the sequence). It's on the margins and touched on by a different BZ.
The net is we can fix the various extraction problems on RISC-V exposed by the
testcases in PR64345 without regressing the minor and-not cases the
define_insn_and_split was handling with one less define_insn_and_split in the
port. It likely improves pr80770 as well, though I haven't checked that.
Bootstrapped and regression tested on both the Pioneer and BPI. Also
regression tested on riscv64-elf and riscv32-elf. And since this touched
ifcvt.cc, bootstrapped and regression tested on x86_64 as well 🙂 It's also
regression tested across all the embedded targets in my tester.
PR target/64345
PR tree-optimization/80770
gcc/
* config/riscv/bitmanip.md (<optab>_not_const<mode>): Turn into a
peephole2 to avoid matching prior to combine.
* ifcvt.cc (noce_try_sign_bit_splat): When costs are equal steer
towards an AND based sequence.
gcc/testsuite/
* gcc.target/riscv/pr120553-2.c: Update expected output.
* gcc.target/riscv/pr64345.c: New test.
* gcc.target/riscv/zbb-andn-orn-01.c: Skip when peephole2 isn't run.
* gcc.target/riscv/zbb-andn-orn-02.c: Likewise.
Richard Biener [Mon, 27 Oct 2025 10:31:32 +0000 (11:31 +0100)]
tree-optimization/122419 - reduction chain with conversion as op
The following deals with reduction detection handling a non-noop
conversion as reduction operation and makes the reduction chain
chain re-discovery handle this situation the same.
PR tree-optimization/122419
* tree-vect-slp.cc (vect_analyze_slp_reduc_chain): Only
skip noop conversions.
Matthias Kretz [Fri, 24 Oct 2025 11:28:29 +0000 (13:28 +0200)]
libstdc++: New _IotaArray utility to simplify index pack creation
This patch introduces the internal helper type _IotaArray to simplify
defining a pack of indices via a structured binding declaration:
constexpr auto [...__is] = _IotaArray<N>;
_IotaArray is a C-array for lowest overhead in terms of template
instantiations. Non-GCC compilers that do not implement
__integer_pack have a slightly higher overhead.
libstdc++-v3/ChangeLog:
* include/bits/utility.h (_IotaArray): Define.
* testsuite/ext/iotaarray.cc: New test.
Jonathan Wakely [Fri, 24 Oct 2025 11:56:04 +0000 (12:56 +0100)]
libstdc++: Make std::valarray support overaligned types [PR108951]
Switch std::valarray<T> memory allocation to use std::__new_allocator<T>
to allocate and deallocate memory. This adds support for extended
alignment types without needing to duplicate all the logic from
__new_allocator::allocate and __new_allocator::dellocate.
std::__new_allocator is used instead of std::allocator because we want
to ensure that the memory is still allocated with operator new, so we
don't want to use any possible program-defined specialization of
std::allocator<T> which the user might have provided.
To make using an allocator possible, __valarray_release_memory needs to
become a function template so that it knows the type T. It also needs an
additional parameter specifying the size of the allocation.
This change doesn't cause an ABI change for types with fundamental
alignment, because __new_allocator still uses the same operator delete
function (or the sized version, which is ABI compatible) to free the
memory. So if memory for a valarray is allocated in one translation unit
and deallocated in another, and those TUs are compiled with different
versions of GCC, we still get memory from the same operator new and
release it with the same operator delete (or the compatibled sized
version). For types with extended alignment this does potentially cause
an ABI change on targets where the aligned version of operator delete
doesn't just call free(p), but support for extended alignment types was
previously just broken and had undefined behaviour.
libstdc++-v3/ChangeLog:
PR libstdc++/108951
* include/bits/valarray_array.h( __valarray_get_storage): Use
std::__new_allocator.
(__valarray_release_memory): Likewise.
* include/std/valarray: Pass _M_size to
__valarray_release_memory.
* testsuite/26_numerics/valarray/108951.cc: New test.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Guo Jie [Sat, 25 Oct 2025 02:43:36 +0000 (10:43 +0800)]
LoongArch: Adjust widen-mul rtx cost
Equalize the rtx cost of mulw.d.w[u] with mul.d.
There are two main benefits:
1. Reducing the number of instructions.
- lu32i.d $r12,0
- bstrpick.d $r4,$r4,31,0
- mul.d $r4,$r4,$r12
- srli.d $r4,$r4,33
---
+ mulh.wu $r4,$r4,$r12
+ bstrpick.d $r4,$r4,31,1
2. Help with the replacement of the high-latency div.w.
- addi.w $r12,$r0,3
- div.w $r4,$r4,$r12
---
+ lu12i.w $r13,349525
+ ori $r13,$r13,1366
+ mulw.d.w $r12,$r4,$r13
+ srai.w $r4,$r4,31
+ srli.d $r12,$r12,32
+ sub.w $r4,$r12,$r4
gcc/ChangeLog:
* config/loongarch/loongarch.cc (loongarch_rtx_costs):
Ignore the cost impact of SIGN_EXTEND/ZERO_EXTEND.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/widen-mul-rtx-cost-signed.c: New test.
* gcc.target/loongarch/widen-mul-rtx-cost-unsigned.c: New test.
Guo Jie [Sat, 25 Oct 2025 02:33:49 +0000 (10:33 +0800)]
LoongArch: Add a combiner to eliminate redundant extension
When the bit width of the data type before extension plus
the bit count of the left-shift operation equals 32,
optimizations similar to the following can from:
ext.w.b $r4,$r5
slli.d $r4,$r4,24
to:
slli.w $r4,$r5,24
gcc/ChangeLog:
* config/loongarch/loongarch.md
(sign_extend_ashift<GPR:mode><SHORT:mode>): New combiner.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/sign_extend_ashift.c: New test.
Kito Cheng [Fri, 8 Aug 2025 01:00:59 +0000 (09:00 +0800)]
Increase NUM_ABI_IDS to support RISC-V VLS calling convention variants
The RISC-V fixed-length vector calling convention introduces multiple ABI
variants based on different ABI_VLEN values. Each variant requires a
separate ABI ID to maintain proper ABI compatibility tracking in GCC.
Increase NUM_ABI_IDS from 8 to 12 to accommodate these additional ABI
variants.
gcc/ChangeLog:
* function-abi.h (NUM_ABI_IDS): Increase from 8 to 12.
Eric Botcazou [Mon, 27 Oct 2025 08:53:57 +0000 (09:53 +0100)]
Ada: Fix segfault on mutually recursive record type declarations
This was reported a long time ago and is again a fairly pathological case,
but it turns out to be unfixable with the current model of type freezing
in GNAT (which is the second one suggested in the AARM 13.14(19.i) clause).
The code is legal but, as the declaration of any object of the types will
exhaust the heap and eventually raise Storage_Error, it is totally useless.
The patch contains a small cleanup in a related area as well as the addition
of a commented assertion in gigi, so that the compiler shuts down properly.
gcc/ada/
PR ada/15800
* freeze.adb (Freeze_Entity.Freeze_Record_Type): Small cleanup
in code and comments.
* gcc-interface/utils.cc (create_field_decl): Assert that the type
of the field is frozen at this point.
Almost the only reason we committed that was because some optimizers in the
RTL ifcvt pass needed '(set (reg) (not (reg)))' RTX, however, in recent
versions of gcc, the equivalent optimizations are performed before RTL
passes, so the need for that commit has all but disappeared.
/* example 1 */
int test0(int a) {
return a < 0 ? ~a : a;
}
Instead, expanding it to an XOR with a pseudo whose value of -1 early in
the RTL passes will take advantage of CSE, forward propagation, or loop-
invariant hoisting.
/* example 2 */
long long test1(long long a) {
return ~a;
}
void test2(int a[]) {
int i;
for (i = 0; i < 16; ++i)
a[i] = ~a[i];
}
Another concern with reverting that commit is the impact on complex insns
that have '(not)' as part of them, but also nothing to worry about; because
the RTL insn combiner can correctly recognize an XOR with a register value
of -1 as a one's complement operation even without such RTX, and apply the
result to subsequent combine operations.
gcc/ChangeLog:
* config/xtensa/xtensa.md (one_cmplsi2):
Rearrange back as an expand pattern.
Andrew Pinski [Sat, 25 Oct 2025 00:13:26 +0000 (17:13 -0700)]
forwprop: Fix copy prop for alignment after the final folding [PR122086]
After r16-4081-g966cdec2b2 which added folding of __builtin_assume_aligned,
forwprop would propagate pointers that lower alignment replacing ones with
greater alignment. This causes us to lose alignment information that
__builtin_assume_aligned provided to expand. Normally this just loses some
optimizations except in the s390 case where the alignment is specifically
checked and was for inlining of the atomics; without this patch an infininite
loop would happen.
Note this was previously broken for -Og before r16-4081-g966cdec2b2. This
fixes -Og case as forwprop is used instead of copyprop.
This moves the testcase for pr107389.c to torture to get a generic testcase.
pr107389.c was originally for -O0 case but we should test for other
optimization levels so this is not lost again.
align-5.c is xfailed because __builtin_assume_aligned is not instrumented for ubsan
alignment and ubsan check to see pointer is aligned before emitting a check for the
load (based on the known alignment in compiling). See PR 122038 too. I had mentioned
this issue previously in r16-4081-g966cdec2b2 too.
* tree-ssa-forwprop.cc (forwprop_may_propagate_copy): New function.
(pass_forwprop::execute): Use forwprop_may_propagate_copy
instead of may_propagate_copy.
gcc/testsuite/ChangeLog:
* gcc.dg/pr107389.c: Move to...
* gcc.dg/torture/pr107389.c: ...here. Skip for lto.
Use dg-additional-options rather than dg-options.
* c-c++-common/ubsan/align-5.c: xfail.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Andrew Pinski [Wed, 15 Oct 2025 16:59:25 +0000 (09:59 -0700)]
riscv: Fix gimple folding of the vset* intrinsics [PR122270]
The problem here is that when the backend folds the vset intrinsics,
it tries to keep the lhs of the new statement to be the same as the old statement
due to the check in gsi_replace. The problem is with a MEM_REF vset::fold was
unsharing the new lhs here and using the original lhs in the other new statement.
This meant the check in gsi_replace would fail.
This fixes that oversight by switching around which statement gets the unshared
version.
Note the comment in vset::fold was already correct just not matching the code:
/* Replace the call with two statements: a copy of the full tuple
to the call result, followed by an update of the individual vector.
The fold routines expect the replacement statement to have the
same lhs as the original call, so return the copy statement
rather than the field update. */
Changes since v1:
* v2: Fix testcase.
PR target/122270
gcc/ChangeLog:
* config/riscv/riscv-vector-builtins-bases.cc (vset::fold): Use the
unshare_expr for the statement that will be added seperately rather
the one which will be used for the replacement.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/pr122270-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Gerald Pfeifer [Sun, 26 Oct 2025 17:01:02 +0000 (18:01 +0100)]
poly-int: Fix struct vs class confusion
We currently issue a good deal of warnings of the following kind:
In file included from /scratch/tmp/gerald/GCC-HEAD/gcc/coretypes.h:500:
.../GCC-HEAD/gcc/poly-int.h:378:1: warning: 'poly_int' defined as a
struct template here but previously declared as a class template; this
is valid, but may result in linker errors under the Microsoft C++ ABI
[-Wmismatched-tags]
378 | struct poly_int
| ^
.../GCC-HEAD/gcc/poly-int.h:32:38: note: did you mean struct here?
32 | template<unsigned int N, typename T> class poly_int;
| ^~~~~
| struct
A `grep "'poly_int' defined as a struct template" | cut -d: -f1 | uniq -c`
shows 749 issue for a typical bootstrap.
Addressing this brings down the bootstrap log by 8.5% - from 80454 lines
down to 73613.
gcc:
* poly-int.h: Change struct poly_int to class poly_int.
LIU Hao [Sat, 25 Oct 2025 09:19:34 +0000 (17:19 +0800)]
x86-64: Use `movsxd` to perform SI-to-DI extension in Intel syntax
Although there's no possibility of ambiguity, Intel manual says the mnemonic
for DWORD-to-QWORD sign-extension operation should be MOVSXD. Some assemblers
(GNU AS, NASM) also overload MOVSX, but some others don't accept MOVSX (LLVM,
MASM, YASM in NASM mode) and require MOVSXD.
This mnemonic was introduced in r0-34259-g123bf9e3f4056d in 2001, and has not
been updated ever since.
gcc/ChangeLog:
PR target/119079
* config/i386/i386.md: Use `movsxd` to perform SI-to-DI extension in Intel
syntax.
Kuan-Lin Chen [Sun, 26 Oct 2025 15:09:03 +0000 (09:09 -0600)]
[PATCH v2] RISC-V: Fix moving data from V_REGS to GR_REGS by scalar move.
When the ELEN is 32 in rv64, it can move a V2SI vector register into a DI GPR.
But the extract result in low-part must be zero-extended.
The following gimples are from pr111391-2.c:
_25 = (char) d.1_23;
_17 = {_25, _25, _25, _25, _25, _25, _25, _25};
a_26 = VIEW_CONVERT_EXPR<long int>(_17);
The final assembly:
vsetivli zero,2,e32,m1,ta,ma
vslidedown.vi v2,v4,1
vmv.x.s s1,v4 -> s1 must be zero-extended to prevent the bit 31 of v4[0] is 1
vmv.x.s a4,v2
slli a5,a4,32
or s1,a5,s1
Osama Abdelkader [Sun, 26 Oct 2025 14:38:06 +0000 (08:38 -0600)]
[PATCH] middle-end: Fix typos in comments
This patch fixes spelling errors in comments:
- "accomodate" -> "accommodate" in wide-int.h and value-range-storage.h
- "the the" -> "the" in tree-vectorizer.h
gcc/ChangeLog:
* wide-int.h: Fix typo "accomodate" to "accommodate" in comment.
* value-range-storage.h: Likewise.
* tree-vectorizer.h (dr_set_safe_speculative_read_required):
Fix duplicate "the the" to "the" in comment.
Eric Botcazou [Sun, 26 Oct 2025 09:21:31 +0000 (10:21 +0100)]
Ada: Fix internal error on pragma Machine_Attribute with string constant
This was reported a long time ago and is a fairly pathological case,
so the fix is purposely ad hoc: when the attribute name of a pragma
Machine_Attribute is not a string literal, its processing needs to
be delayed for the back-end.
gcc/ada/
PR ada/13370
* sem_prag.adb (Analyze_Pragma) <Pragma_Machine_Attribute>: Set the
Has_Delayed_Freeze flag if the argument is not a literal.
gcc/testsuite/
* gnat.dg/machine_attr3.ads, gnat.dg/machine_attr3.adb: New test.
Paul Thomas [Sun, 26 Oct 2025 07:49:09 +0000 (07:49 +0000)]
Fortran: Fix generic user operators in PDTs [PR122290]
2025-10-26 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/122290
* decl.cc (variable_decl): Matching component initializer
expressions in PDT templates should be done with gfc_match_expr
to avoid reduction too early. If the expression type is unknown
copy the component typespec.
(gfc_get_pdt_instance): Change comment from a TODO to an
explanation. Insert parameter values in initializers. For
components that are not marked with PDT attributes, do the
full reduction for init expressions.
* primary.cc (gfc_match_actual_arglist): Convert PDT kind exprs
using the component initializer.
* resolve.cc (resolve_typebound_intrinsic_op): Preempt
gfc_check_new_interface for pdt_types as well as entities used
in submodules.
* simplify.cc (get_kind): Remove PDT kind conversion.
gcc/testsuite/
PR fortran/122290
* gfortran.dg/pdt_60.f03: New test.
Rainer Orth [Sat, 25 Oct 2025 19:15:41 +0000 (20:15 +0100)]
libgccjit: Fix bootstrap fail from format specifiers.
The changes in r16-4527-gc11d9eaa8ac9ee caused format mismatches
in jit-recording.cc because Darwin’s uint64_t == long long unsigned int
(and the format specifiers were %ld and %li).
gcc/jit/ChangeLog:
* jit-recording.cc (recording::array_type::make_debug_string,
recording::array_type::write_reproducer): Use PRIu64 format
specifier for uint64_t.
Harald Anlauf [Fri, 24 Oct 2025 19:33:08 +0000 (21:33 +0200)]
Fortran: IS_CONTIGUOUS and pointers to non-contiguous targets [PR114023]
PR fortran/114023
gcc/fortran/ChangeLog:
* trans-expr.cc (gfc_trans_pointer_assignment): Always set dtype
when remapping a pointer. For unlimited polymorphic LHS use
elem_len from RHS.
* trans-intrinsic.cc (gfc_conv_is_contiguous_expr): Extend inline
generated code for IS_CONTIGUOUS for pointer arguments to detect
when span differs from the element size.
Olivier Hainque [Fri, 17 Oct 2025 17:53:02 +0000 (17:53 +0000)]
Replace VSB_DIR by sysroot refs in VxWorks LIBGCC2_INCLUDES
This matches what VXWORKS_ADDITIONAL_CPP_SPEC does, allowing libgcc to
build without VSB_DIR defined in the environment as soon as the configure
switches featured a proper --with-build-sysroot was provided.
Tested with a successful build for --target=powerpc-wrs-vxworks7r2
using mainline sources.
2025-10-23 Olivier Hainque <hainque@adacore.com>
libgcc/
* config/t-vxworks (LIBGCC2_INCLUDES): Replace $(VSB_DIR)
by sysroot references.
Jiahao Xu [Thu, 23 Oct 2025 06:29:06 +0000 (14:29 +0800)]
LoongArch: Implement vector reduction from 256-bit to 128-bit
gcc/ChangeLog:
* config/loongarch/lasx.md (vec_extract<mode><lasxhalf>): New define_expand.
(vec_extract_lo_<mode>): New define_insn_and_split.
(vec_extract_hi_<mode>): New define_insn.
* config/loongarch/loongarch-protos.h (loongarch_check_vect_par_cnst_half)
New function prototype.
* config/loongarch/loongarch.cc (loongarch_split_reduction):
Implement TARGET_VECTORIZE_SPLIT_REDUCTION.
(loongarch_check_vect_par_cnst_half): New function.
* config/loongarch/predicates.md
(vect_par_cnst_low_half): New predicate.
(vect_par_cnst_high_half): New predicate.
Adjust the range of ssa_name to reflect the conditional value of ssa_name
relative to whether its in the TRUE or FALSE part of the COND_EXPR.
PR tree-optimization/114025
gcc/
* gimple-range-fold.cc (fold_using_range::condexpr_adjust): Handle
the same ssa_name in the condition and the COND_EXPR better.
Gaius Mulley [Fri, 24 Oct 2025 20:51:36 +0000 (21:51 +0100)]
PR modula2/122407: Followup to spell check remaining intrinsics
This followup patch ensures that any unknown symbol spell check
error in the instrinsics uses the parameter token rather than the
procedure name token. In turn this allows the filter module to
detect and remove multiple unknowns at the same token.
The patch also adds spell checking to the instrinsic parameters.
PR modula2/122407
* gm2.dg/spell/iso/fail/badspellabs.mod: New test.
* gm2.dg/spell/iso/fail/badspelladr.mod: New test.
* gm2.dg/spell/iso/fail/badspellcap.mod: New test.
* gm2.dg/spell/iso/fail/badspellchr.mod: New test.
* gm2.dg/spell/iso/fail/badspellchr2.mod: New test.
* gm2.dg/spell/iso/fail/badspelldec.mod: New test.
* gm2.dg/spell/iso/fail/badspellexcl.mod: New test.
* gm2.dg/spell/iso/fail/badspellinc.mod: New test.
* gm2.dg/spell/iso/fail/badspellincl.mod: New test.
* gm2.dg/spell/iso/fail/badspellnew.mod: New test.
* gm2.dg/spell/iso/fail/badspellsize.mod: New test.
* gm2.dg/spell/iso/fail/dg-spell-iso-fail.exp: New test.
After r16-3956-gf613fdc6920c83, these 2 testcases start to fail as
now SRA will fully scalarize the structs and only provide with the piece
that was used. But the testcase is testing about the padding so turning
off SRA is correct in this case.
Pushed as obvious after testing the testcases now pass.
PR target/122402
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/auto-init-padding-2.c: Turn off SRA.
* gcc.target/aarch64/auto-init-padding-4.c: Likewise.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
When exporting declarations in a namespace with using declarations, the
name must be fully qualified. Recently introduced std::full_extent{,_t},
std:strided_slice, and std::submdspan_mapping_result broke module std
and module std.compat.
Harald Anlauf [Thu, 23 Oct 2025 19:21:04 +0000 (21:21 +0200)]
Fortran: fix TRANSFER of subarray component references [PR122386]
Commit r16-518 introduced a change that fixed inquiry references of complex
arrays as argument to the TRANSFER intrinsic by forcing a temporary. The
solution taken however turned out not to be generalizable to component
references of nested derived-type arrays. A better way is the revert that
patch and force the generation of a temporary when the SOURCE expression is
a not simply-contiguous array.
PR fortran/122386
gcc/fortran/ChangeLog:
* dependency.cc (gfc_ref_needs_temporary_p): Revert r16-518.
* trans-intrinsic.cc (gfc_conv_intrinsic_transfer): Force temporary
for SOURCE not being a simply-contiguous array.
gcc/testsuite/ChangeLog:
* gfortran.dg/transfer_array_subref_2.f90: New test.
Ada: Fix other instances of incorrect String lower bound in gnatlink
This also reverts an unintentional change introduced by the initial fix.
gcc/ada/
PR ada/81087
* gnatlink.adb (Is_Prefix): Move around, streamline and return false
when the prefix is not strict.
(Gnatlink): Fix other instances of incorrect lower bound assumption.
Andrew MacLeod [Thu, 23 Oct 2025 21:19:02 +0000 (17:19 -0400)]
Split signed bitwise AND operations.
The algorithm for bitwise AND struggles with complex signed operations
which cross the signed/unsigned barrier. When this happens, process it
as 2 seperate ranges [LB, -1] and [0, UB], and combine the results.
PR tree-optimization/114725.c
gcc/
* range-op.cc (operator_bitwise_and::wi_fold): Split signed
operations crossing zero into 2 operations.
Andrew MacLeod [Tue, 21 Oct 2025 20:05:22 +0000 (16:05 -0400)]
Create and apply bitmasks for truncating casts.
When folding a cast, we were not applying the bitmask if we reached
a VARYING result.
We were also not creating a bitmask to represent the lower bits of a
truncating cast in op1_range. So GORI was losing bits.
PR tree-optimization/118254
PR tree-optimization/114331
gcc/
* range-op.cc (operator_cast::fold_range): When VARYING is
reached, update the bitmask if we reach VARYING.
(operator_cast::op1_range): For truncating casts, create a
bitmask bit in LHS.
Tomasz Kamiński [Fri, 24 Oct 2025 07:37:13 +0000 (09:37 +0200)]
libstdc++: Forward arguments for bind_front<f>,bind_back<f>,nttp<f> [PR122022]
This patch fixes a missing forwarding-reference (&&) in _Bind_fn_t::operator()
and lambda returned from not_fn<f>.
The bind_front<f>/bind_back<f> tests were updated to use a structure similar
to r16-3398-g250dd5b5604fbc to cover cases involving zero, one, and many bound
arguments.
PR libstdc++/122022
libstdc++-v3/ChangeLog:
* include/std/functional (_Bind_fn_t): Use forwarding reference as
paremeter.
(std::not_fn<f>): Use forwarding reference as lambda parameter.
* testsuite/20_util/function_objects/bind_back/nttp.cc: Rework tests.
* testsuite/20_util/function_objects/bind_front/nttp.cc: Likewise.
* testsuite/20_util/function_objects/not_fn/nttp.cc: Add test for
argument forwarding.
Because it is redundant to specify 'i'-constraints on operands in single-
alternative match templates whose predicates are "const_int_operand" itself
or those that imply CONST_INT_P().
This patch also removes the 'i'-constraints on the next argument of the
callee (the number of bytes of arguments) in the four "call_internal"
patterns, since we are not interested in these arguments.
Gaius Mulley [Fri, 24 Oct 2025 12:04:10 +0000 (13:04 +0100)]
PR modula2/122407: similar error messages are emitted for an unknown symbol
This followup to PR modula2/122241 reduces error message clutter by
filtering unknown symbol error ensuring that only one error message
is emitted for an unknown symbol at a particular location.
The filter is implemented using two binary trees. A new generic
(based on the address type) binary dictionary module is added to
the base libraries.
gcc/m2/ChangeLog:
PR modula2/122407
* Make-lang.in (GM2-LIBS-BOOT-DEFS): Add BinDict.def.
(GM2-LIBS-BOOT-MODS): Add BinDict.mod.
(GM2-COMP-BOOT-DEFS): Add FilterError.def.
(GM2-COMP-BOOT-MODS): Add FilterError.mod.
(GM2-LIBS-DEFS): Add BinDict.def.
(GM2-LIBS-MODS): Add BinDict.mod.
* gm2-compiler/M2Error.def (KillError): New procedure.
* gm2-compiler/M2Error.mod (WriteFormat3): Reformat.
(NewError): Rewrite and call AddToList.
(AddToList): New procedure.
(SubFromList): Ditto.
(WipeReferences): Ditto.
(KillError): Ditto.
* gm2-compiler/M2LexBuf.mod (MakeVirtualTok): Return
caret if all token positions are identical.
* gm2-compiler/M2MetaError.mod (KillError): Import.
(FilterError): Import.
(FilterUnknown): New global.
(initErrorBlock): Initialize symcause and token.
(push): Capitalize comments.
(pop): Copy symcause to toblock if discovered.
(doError): Add parameter sym.
(defaultError): Assign token if discovered.
Pass NulSym to doError.
(updateTokSym): New procedure.
(chooseError): Call updateTokSym.
(doErrorScopeModule): Pass sym to doError.
(doErrorScopeForward): Ditto.
(doErrorScopeMod): Ditto.
(doErrorScopeFor): Ditto.
(doErrorScopeDefinition): Ditto.
(doErrorScopeDef): Ditto.
(doErrorScopeProc): Ditto.
(used): Pass sym[bol] to doError.
(op): Assign symcause when encountering
an error, warning or note.
(MetaErrorStringT1): Rewrite.
(MetaErrorStringT2): Ditto.
(MetaErrorStringT3): Ditto.
(MetaErrorStringT4): Ditto.
(isUniqueError): New procedure function.
(wrapErrors): Rewrite.
(FilterUnknown): Initialize.
* gm2-compiler/M2Quads.mod (BuildTSizeFunction): Add spell check
hint specifier.
* gm2-compiler/FilterError.def: New file.
* gm2-compiler/FilterError.mod: New file.
* gm2-libs/BinDict.def: New file.
* gm2-libs/BinDict.mod: New file.
Thomas Schwinge [Tue, 21 Oct 2025 07:46:32 +0000 (09:46 +0200)]
Simplify 'Makefile' dependencies for libatomic [PR81358]
I noticed that commit r16-4315-ge63cf4b130b86dd7dde1bf499d3d40faca10ea2e
"PR81358: Enable automatic linking of libatomic" had introduced a lot of
repeated 'Makefile' dependencies for libatomic, including some nonsensical
ones, like 'configure-stage1-target-libada: maybe-all-stage1-target-libatomic'
(libada isn't bootstrapped). That's because the code for generation of
dependencies had been put into inside an existing loop over 'target_modules'.
PR driver/81358
* Makefile.tpl: Move generation of dependencies for libatomic out
of loop over 'target_modules'.
* Makefile.in: Regenerate.
Hi,
this patch remvoes the annotation which causes the build to fail when
configured with --enable-gather-detailed-mem-stats. I am very familiar
with the mem stat system yet, so I'd leave annotating these functions
for a future patch.
Richard Biener [Fri, 24 Oct 2025 08:13:14 +0000 (10:13 +0200)]
Fix reduction validation for associated reduction chains
The code checking whether we have a single cycle and tracking the
reduction chain was not transitioned to full SLP which now shows
when having a SLP reduction chain built after associating the
reduction operation.
* tree-vect-loop.cc (vectorizable_reduction): SLP-ify reduction
operation processing a bit more.
Richard Biener [Fri, 24 Oct 2025 07:07:56 +0000 (09:07 +0200)]
tree-optimization/122406 - incomplete handling of reduction chain with conversion
The following fixes the mixup between reduction operation and conversion
wrapping a reduction chain. This also exposes a missed optimization
but I'm going to fix that in a followup.
PR tree-optimization/122406
* tree-vect-slp.cc (vect_analyze_slp_reduc_chain): Create
the SLP nodes for the conversions around the reduction
operation if required.
* gcc.dg/vect/vect-pr122406-1.c: New testcase.
* gcc.dg/vect/vect-pr122406-2.c: Likewise.
OpenMP: Fix bogus diagnostics with intervening code [PR121452]
The introduction in r14-3488-ga62c8324e7e31a of OMP_STRUCTURED_BLOCK (to
diagnose invalid intervening code) caused a regression rejecting the valid use
of the Fortran CONTINUE statement to end a collapsed loop.
This patch fixes the incorrect error checking in the OMP lowering pass. It also
fixes a check in the Fortran front end that erroneously rejects a similar
statement in an ordered loop.
* openmp.cc (resolve_omp_do): Allow CONTINUE as end statement of a
perfectly nested loop.
gcc/ChangeLog:
* omp-low.cc (check_omp_nesting_restrictions): Accept an
OMP_STRUCTURED_BLOCK in a collapsed simd region and in an ordered loop.
gcc/testsuite/ChangeLog:
* c-c++-common/gomp/pr121452-1.c: New test.
* c-c++-common/gomp/pr121452-2.c: New test.
* gfortran.dg/gomp/pr121452-1.f90: New test.
* gfortran.dg/gomp/pr121452-2.f90: New test.
* gfortran.dg/gomp/pr121452-3.f90: New test.
GCC builds three VEC_PERM_EXPRs for the intrinsic calls. The first two
implement vector shifts and the final one implements the blend, but they
use different vector modes. The forward propagation fails to optimize
this case because VIEW_CONVERT_EXPRs in between block the folding.
This patch adds a match.pd pattern to recognize the concat-and-extract
idiom and folds the VEC_PERM_EXPR chain, even when VIEW_CONVERT_EXPRs
split the chain.
Bootstrapped and tested on aarch64-linux-gnu and x86_64-linux-gnu.
Olivier Hainque [Tue, 3 Jun 2025 21:10:38 +0000 (18:10 -0300)]
Adjust VxWorks special case in testsuite check_weak_available
check_weak_available was reporting weak symbols unsupported
for vxworks unconditionally while they are actually supported
vxworks 7 now (assumed >= r2). This change adjusts the
predicate to reflect that.
We used to believe we should distinguish kernel and rtp modes,
and experiments showed that this distinction is actually
counterproductive for the testsuite's purposes.
This allows a few extra tests to run (and pass :), in particular
in g++.dg/modules.
2021-02-03 Olivier Hainque <hainque@adacore.com>
gcc/testsuite/
* lib/target-supports.exp (check_weak_available):
Return 1 for VxWorks7.
Joseph Myers [Fri, 24 Oct 2025 00:47:54 +0000 (00:47 +0000)]
c: Implement C2y static assertions in expressions
C2y has added support for static assertions as void expressions, in
addition to use as declarations (N3715 was accepted in an online vote
between meetings).
Implement the feature in GCC. There is a syntactic ambiguity between
a static assertion as a declaration and one as an expression
statement, which the accepted feature resolves by making such a usage
a declaration (this only affects the sequence of syntax productions by
which the code is parsed, not the actual semantics of the assertion);
I've raised the similar ambiguity in for loops on the WG14 reflector.
If just concerned with C2y, and not with diagnosing the use of a
feature not supported in older standard versions, the feature might be
simpler to implement by defaulting to treating static assertions in
ambiguous contexts as expressions rather than declarations, but that
would make it hard to diagnose exactly the cases that are new in C2y
(those depend on the static assertion either not being the whole
expression statement, or being in a context where an expression
statement is allowed but a declaration is not, e.g. the body of an if
statement). Instead, to support such diagnostics, the implementation
follows the standard in what is considered a declaration and what is
considered an expression, by looking ahead to what follows the closing
parenthesis when a static assertion starts in a context where a
declaration is permitted.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
gcc/c/
* c-parser.cc (c_parser_next_tokens_start_typename)
(c_parser_next_tokens_start_declaration): Add argument for token
to start from
(c_parser_next_tokens_start_declaration): Check for whether static
assertion followed by semicolon.
(c_parser_check_balanced_raw_token_sequence): Declare earlier.
(c_parser_compound_statement_nostart, c_parser_for_statement): Use
c_parser_next_tokens_start_declaration not
c_token_starts_declaration on second token.
(c_parser_unary_expression): Handle static assertions.
* c-parser.h (c_parser_next_tokens_start_declaration): Add
argument.
Robert Dubner [Thu, 23 Oct 2025 18:18:41 +0000 (14:18 -0400)]
cobol: Corrected FUNCTION CHAR and FUNCTION ORD.
The functions CHAR and ORD have been changed to correctly report on
character positions within the collation sequence.
The use of the LOW-VALUE and HIGH-VALUE figurative constants has been
corrected.
Some establishment of DISPLAY and NATIONAL encodings has been done
in anticipation of changes soon to come.
Some new testsuite tests have been added.
gcc/cobol/ChangeLog:
* genapi.cc (parser_alphabet): Alphabet encoding.
(parser_alphabet_use): Likewise.
(parser_xml_parse): Use correct debugging macro; encoding.
(parser_xml_on_exception): Likewise.
(parser_xml_not_exception): Likewise.
(parser_xml_end): Likewise.
(initialize_the_data): Encoding.
(parser_label_label): Debugging macros.
(parser_label_goto): Likewise.
(parser_file_add): Encoding.
(parser_intrinsic_call_1): Special handling for __gg__char.
(parser_intrinsic_call_2): Formatting.
* parse.y: Response from FUNCTION ORD is flagged "unsigned".
* symbols.cc (cbl_alphabet_t::reencode): Establish
low_char & high_char.
* symbols.h (struct cbl_alphabet_t): Likewise.
libgcobol/ChangeLog:
* charmaps.cc: Encoding.
* charmaps.h (class charmap_t): Encoding.
* intrinsic.cc (__gg__char): Report the character at the
collation position.
(__gg__ord): Report the collation position of a character.
* libgcobol.cc (struct program_state): Add encodings;
Remove obsolete defines.
(__gg__current_collation): New function for encoding/collation.
(__gg__pop_program_state): Encoding.
(__gg__init_program_state): Encoding.
(format_for_display_internal): Handle LOW-VALUE and HIGH-VALUE.
(__gg__compare_2): Encoding.
(__gg__alphabet_use): Likewise.
* libgcobol.h (__gg__current_collation): New declaration.
* xmlparse.cc (__gg__xml_parse): Make a parameter const.
gcc/testsuite/ChangeLog:
* cobol.dg/group2/Length_overflow__2_.out: Updated test result.
* cobol.dg/group2/Length_overflow_with_offset__1_.out: Likewise.
* cobol.dg/group2/Offset_overflow.out: Likewise.
* cobol.dg/group2/CALL_with_OCCURS_DEPENDING_ON.cob: New test.
* cobol.dg/group2/CALL_with_OCCURS_DEPENDING_ON.out: New test.
* cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_ASCII.cob: New test.
* cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_ASCII.out: New test.
* cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_EBCDIC.cob: New test.
* cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_EBCDIC.out: New test.
* cobol.dg/group2/EC-BOUND-REF-MOD_checking_process_termination.cob: New test.
* cobol.dg/group2/EC-BOUND-REF-MOD_checking_process_termination.out: New test.
* cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__3_.cob: New test.
* cobol.dg/group2/Occurs_DEPENDING_ON__source_and_dest.cob: New test.
* cobol.dg/group2/Occurs_DEPENDING_ON__source_and_dest.out: New test.
* cobol.dg/group2/Recursive_subscripts.cob: New test.
* cobol.dg/group2/Recursive_subscripts.out: New test.
* cobol.dg/group2/SEARCH_ALL_with_OCCURS_DEPENDING_ON.cob: New test.
* cobol.dg/group2/SEARCH_ALL_with_OCCURS_DEPENDING_ON.out: New test.
* cobol.dg/group2/Subscript_by_arithmetic_expression.cob: New test.
* cobol.dg/group2/Subscript_out_of_bounds__1_.cob: New test.
* cobol.dg/group2/Subscript_out_of_bounds__1_.out: New test.
* cobol.dg/group2/Subscript_out_of_bounds__2_.cob: New test.
* cobol.dg/group2/Subscript_out_of_bounds__2_.out: New test.
* cobol.dg/group2/Subscripted_refmods.cob: New test.
* cobol.dg/group2/Subscripted_refmods.out: New test.
* cobol.dg/group2/length_of_ODO_Rules_7__8A__and_8B.cob: New test.
* cobol.dg/group2/length_of_ODO_Rules_7__8A__and_8B.out: New test.
* cobol.dg/group2/length_of_ODO_w_-_reference_modification.cob: New test.
Andrew Pinski [Wed, 22 Oct 2025 22:46:03 +0000 (15:46 -0700)]
match: improve handling of `((signed)x) < 0` to `x >= (unsigned)SIGNED_TYPE_MIN` in `(type1)x CMP CST1 ? (type2)x : CST2` pattern.
This is a follow on r16-4534-g07800a565abd20 based on the review of
the other pattern (https://gcc.gnu.org/pipermail/gcc-patches/2025-October/698336.html)
as the same issue mentioned in that review apply here.
This changes to use the new version of minmax_from_comparison so we don't need to create
a tree for the constant. and use wi::mask instead of TYPE_MIN_VALUE.
Andrew Pinski [Tue, 21 Oct 2025 05:59:51 +0000 (22:59 -0700)]
phiopt: Remove minmax_replacement [PR101024]
Now all of the optimizations are done in match from
minmax_replacement. We can now remove minmax_replacement. :)
This keeps around the special case for fp `a CMP b ? a : b` that was
added with r14-2699-g9f8f37f5490076 (PR 88540) and moves it to
match_simplify_replacement.
Bootsrapped and tested on x86_64-linux-gnu.
Note bool-12.c needed to be updated since phiopt1 rejecting the
BIT_AND/BIT_IOR with a cast and not getting MIN/MAX any more.
gcc/ChangeLog:
PR tree-optimization/101024
* tree-ssa-phiopt.cc (match_simplify_replacement): Special
case fp `a CMP b ? a : b` when not creating a min/max.
(strip_bit_not): Remove.
(invert_minmax_code): Remove.
(minmax_replacement): Remove.
(pass_phiopt::execute): Update pass comment.
Don't call minmax_replacement.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/bool-12.c: Update based on when BIT_AND/BIT_IOR
is created and no longer MIN/MAX.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Andrew Pinski [Tue, 21 Oct 2025 05:45:47 +0000 (22:45 -0700)]
match: Add support for `((signed)a </>= 0) ? min/max (a, c) : b` [PR101024]
This is the last patch that is needed to support to remove minmax_replacement.
This fixes pr101024-1.c which is failing when minmax_replacement is removed.
This next patch will remove it.
Changes since v1:
* v2: Add new version of minmax_from_comparison that takes widest_int.
Constraint the pattern to constant integers in some cases.
Use mask to create the SIGNED_MAX and use GT/LE instead.
Use wi::le_p/wi::ge_p instead of fold_build to do the comparison.
gcc/ChangeLog:
PR tree-optimization/101024
* fold-const.cc (minmax_from_comparison): New version that takes widest_int
instead of tree.
(minmax_from_comparison): Call minmax_from_comparison for integer cst case.
* fold-const.h (minmax_from_comparison): New declaration.
* match.pd (`((signed)a </>= 0) ? min/max (a, c) : b`): New pattern.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>