Haochen Jiang [Tue, 18 Nov 2025 07:05:15 +0000 (15:05 +0800)]
i386: Add AVX10.1, AVX10.2, APX_F and MOVRS to Nova Lake
Nova Lake will enable AVX10.1, AVX10.2, APX_F and MOVRS according to the
latest documentation.
Due to PTA_XXX would not maintain imply relationships, we need to add
all PTA_AVX512XXX which AVX10 enabled to enable AVX10.1 ISAs. It is not
a redundant addition in i386.h.
gcc/ChangeLog:
* common/config/i386/i386-common.cc: Adjust to P_PROC_AVX10_1.
* config/i386/driver-i386.cc (host_detect_local_cpu):
Move Nova Lake to under AVX512 part.
* config/i386/i386.h (PTA_NOVALAKE): Add AVX10.1, AVX10.2,
APX_F and MOVRS.
* config/i386/x86-tune-sched.cc (ix86_issue_rate): Set to 8.
* config/i386/x86-tune.def (X86_TUNE_AVX256_OPTIMAL): Add Nova
Lake.
* doc/invoke.texi: Adjust documentation.
Mike Crowe [Tue, 18 Nov 2025 13:06:53 +0000 (13:06 +0000)]
libstdc++: shared_mutex: Respond consistently to errors and deadlock
Make the shared_mutex::try_lock(), shared_timed_mutex::try_lock_until()
and shared_timed_mutex::try_lock_shared_until() all handle errors from
pthread functions consistently by returning false to indicate that the
lock could not be taken. If _GLIBCXX_ASSERTIONS is defined then
unexpected errors, such as EDEADLK and EINVAL will cause an assertion
failure. If _GLIBCXX_ASSERTIONS is not defined then these functions no
longer ever return true incorrectly indicating that they have taken the
lock.
This removes the previous behaviour of looping on EDEADLK in
try_lock_shared_until() and no longer returns true on EINVAL in all of
these functions. (In theory at least it should not be possible to
trigger EINVAL since 5dba17a3e709859968f939354e6e5e8d796012d3.)
Unfortunately my reading of POSIX is that pthread_rwlock_clockrdlock[1],
pthread_rwlock_timedrdlock pthread_rwlock_clockwrlock[2] and
pthread_rwlock_timedwrlock are allowed to deadlock rather than return
EDEADLK when trying to take a lock a second time from the same
thread. This means that the deadlock tests cannot be enabled by
default. I believe that the tests do work with glibc (2.31 & 2.36) and
with the __shared_mutex_cv implementation though.
* include/std/shared_mutex (try_lock, try_lock_until)
(try_lock_shared_until): Respond consistently to errors and
deadlocks.
* testsuite/30_threads/shared_timed_mutex/try_lock_until/116586.cc:
Test deadlock behaviour if possible.
Jonathan Wakely [Tue, 18 Nov 2025 13:19:53 +0000 (13:19 +0000)]
c++: Handle absolute path for CMI output directory [PR122677]
When trying to create each directory component of an absolute path, the
first call to mkdir uses a path of "" which gives an ENOENT error. This
causes the create_dirs function to return without creating anything.
This commit skips past the leading slashes of an absolute path, so that
the first call to mkdir is for an actual directory name, not an empty
string.
gcc/cp/ChangeLog:
PR c++/122677
* module.cc (create_dirs): Skip past any leading slashes.
Implement vuninitialized using the new MVE builtins framework.
This patch is a bit more intrusive than other similar patches because
the two vuninitialized variants use different signatures.
To handle this situation, the patch makes the inherent shape derive
from overloaded_base instead of nonoverloaded_base, and adds a new
parameter to add_unique_function so that we can choose between adding
only the nonoverloaded version, only the overloaded ones, or both (the
default).
The patch introduces pop_and_resolve_to, which pops an argument (the
only one in this case), and calls resolve_to, like many other shapes:
this is because the overloaded version takes an argument (used to
resolve which nonoverloaded version to call), which is not present in
the nonoverloaded version prototype.
gcc/ChangeLog:
* config/arm/arm-mve-builtins-shapes.cc (build_one): Add
which_overload parameter.
(inherent): Derive from overloaded_base<0>. Add support for
overloaded version.
* config/arm/arm-mve-builtins-shapes.h (inherent): Update comment.
* config/arm/arm-mve-builtins.cc (add_unique_function): Add
support for new which_overload parameter.
(pop_and_resolve_to): New.
* config/arm/arm-mve-builtins.h (NONOVERLOADED_FORM)
(OVERLOADED_FORM): New.
(add_unique_function): Update prototype.
(pop_and_resolve_to): New prototype.
* config/arm/arm_mve.h (vuninitializedq): Delete.
(vuninitializedq_u8): Delete.
(vuninitializedq_u16): Delete.
(vuninitializedq_u32): Delete.
(vuninitializedq_u64): Delete.
(vuninitializedq_s8): Delete.
(vuninitializedq_s16): Delete.
(vuninitializedq_s32): Delete.
(vuninitializedq_s64): Delete.
(vuninitializedq_f16): Delete.
(vuninitializedq_f32): Delete.
(__arm_vuninitializedq): Delete.
Implement vgetq_lane and vsetq_lane using the new MVE builtins
framework.
Although MVE intrinsics are not supported in big-endian mode, we keep
the code to convert lane indices into GCC's vector indices, so that
it's already in place in case we want to support big-endian in the
future.
The patch adds new tests, to check that we emit an error when the lane
number is not in the expected range.
* gcc.target/arm/mve/intrinsics/vsetq_lane_f16_bounds.c: New test.
* gcc.target/arm/mve/intrinsics/vsetq_lane_f32_bounds.c: New test.
* gcc.target/arm/mve/intrinsics/vsetq_lane_s16_bounds.c: New test.
* gcc.target/arm/mve/intrinsics/vsetq_lane_s32_bounds.c: New test.
* gcc.target/arm/mve/intrinsics/vsetq_lane_s64_bounds.c: New test.
* gcc.target/arm/mve/intrinsics/vsetq_lane_s8_bounds.c: New test.
* gcc.target/arm/mve/intrinsics/vsetq_lane_u16_bounds.c: New test.
* gcc.target/arm/mve/intrinsics/vsetq_lane_u32_bounds.c: New test.
* gcc.target/arm/mve/intrinsics/vsetq_lane_u64_bounds.c: New test.
* gcc.target/arm/mve/intrinsics/vsetq_lane_u8_bounds.c: New test.
Christophe Lyon [Tue, 18 Nov 2025 16:25:40 +0000 (16:25 +0000)]
arm: doc: Update documentation on half-precision support
The previous patch makes __fp16 always available on arm (using
-mfp16-format is no longer needed), so the documentation needs an
update.
In the process, clarify the peculiarities of __fp16 on arm, and
reorder information to make it easier to understand.
gcc/ChangeLog:
* doc/extend.texi (Half-precision Floating-point): __fp16 is now
always available on arm. Move x86 paragraph closer to the rest of
the x86 information, and make it use present tense.
arm: [MVE intrinsics] Avoid warnings when floating-point is not supported [PR 117814]
If the target does not support floating-point, we register FP vector
types as 'void' (see register_vector_type).
This leads to warnings about 'pure attribute on function returning
void' when we declare the various load intrinsics because their
call_properties say CP_READ_MEMORY (thus giving them the 'pure'
attribute), but their return type is void. This happens for instance
in gcc.target/arm/pr112337.c, depending on how GCC is built (I didn't
notice the warnings because arm_mve.h is considered as a system
include in my environment, and the warning is not emitted, but CI
reported it).
To avoid such warnings, declare floating-point scalar and vector types
even if the target does not have an FPU.
Note that since an FPU can be activated via #pragma GCC target
("arch=armv8.1-m.main+mve.fp" for instance), it means that such types
cannot appear and disappear withing a single TU, they have to be
available in all contexts. This implies a noteworthy change for
__fp16: it not longer depends on using -mfp16-format=ieee or
alternative. Also note that if the target ISA has the fp16 bit set,
we already silently activate -mfp16-format=ieee (with an error if
-mfp16-format=alternative was supplied). The patch now enforces
-mfp16-format=none if the option was used.
In arm-mve-builtins.cc (register_builtin_types, register_vector_type,
register_builtin_tuple_types), this means simply removing the early
exits. However, for this to work, we need to update
arm_vector_mode_supported_p, so that vector floating-point types are
always defined, and __fp16 must always be registered by
arm_init_fp16_builtins (as it is the base type for vectors of
float16_t. Another side effect is that the declaration of float16_t
and float32_t typedefs is now unconditional.
The new tests verify that:
- we emit an error if the code tries to use floating-point intrinsics
and the target does not have the floating-point extension
- we emit the expected code when activating the floating-point
expected via a pragma
- we emit the expected code when the target supports floating-point
(no pragma needed)
- we apply -mfp16-format=none where we used to default to ieee
An update is needed in g++.target/arm/mve/general-c++/nomve_fp_1.c,
because the error message now correctly uses float16x8_t instead of
void as return type.
The patch removes gcc.target/arm/fp16-compile-none-1.c which tests
that using __fp16 produces an error with -mfp16-format=none, since it
is no longer the case.
gcc/ChangeLog:
PR target/117814
* config/arm/arm-builtins.cc (arm_init_fp16_builtins): Always
register __fp16 type.
* config/arm/arm-mve-builtins.cc (register_builtin_tuple_types):
Remove special handling when TARGET_HAVE_MVE_FLOAT is false.
(register_vector_type): Likewise.
(register_builtin_tuple_types): Likewise.
* config/arm/arm-opts.h (arm_fp16_format_type): Add
ARM_FP16_FORMAT_DEFAULT.
* config/arm/arm.cc (arm_vector_mode_supported_p): Accept
floating-point vector modes even if TARGET_HAVE_MVE_FLOAT is
false.
(arm_option_reconfigure_globals): Apply ARM_FP16_FORMAT_NONE if
requested.
* config/arm/arm.opt (mfp16-format): Default to
ARM_FP16_FORMAT_DEFAULT.
* config/arm/arm_mve_types.h (float16_t, float32_t): Define
unconditionally.
* doc/sourcebuild.texi (ARM-specific attributes): Document
arm_v8_1m_mve_nofp_ok.
gcc/testsuite/ChangeLog:
PR target/117814
* gcc.target/arm/mve/intrinsics/pr117814-f16.c: New test.
* gcc.target/arm/mve/intrinsics/pr117814-2-f16.c: New test.
* gcc.target/arm/mve/intrinsics/pr117814-3-f16.c: New test.
* gcc.target/arm/mve/intrinsics/pr117814-4-f16.c: New test.
* gcc.target/arm/mve/intrinsics/pr117814-f32.c: New test.
* gcc.target/arm/mve/intrinsics/pr117814-2-f32.c: New test.
* gcc.target/arm/mve/intrinsics/pr117814-3-f32.c: New test.
* gcc.target/arm/fp16-compile-none-1.c: Delete.
* g++.target/arm/mve/general-c++/nomve_fp_1.c: Fix expected error
message.
* lib/target-supports.exp
(check_effective_target_arm_v8_1m_mve_nofp_ok_nocache): New.
(check_effective_target_arm_v8_1m_mve_nofp_ok): New.
(add_options_for_arm_v8_1m_mve_nofp): New.
* parse.cc (parse_executable): Reject declaration/OpenMP
specification statements seen after executable code
unconditionally, keeping the legacy DATA diagnostic as
a warning.
Eric Botcazou [Sun, 9 Nov 2025 10:01:29 +0000 (11:01 +0100)]
ada: Fix assertion failure on prefixed call with access to class-wide interface
The assertion failure shows that the 'Access reference implicitly introduced
for calls written in object notation whose controlling first parameter is an
access to class-wide interface is not later expanded in the cases where the
pointer to the interface needs to be retrieved.
gcc/ada/ChangeLog:
PR ada/34290
* sem_ch4.adb (Try_Object_Operation.Complete_Object_Operation): Call
Preserve_Comes_From_Source to preserve the flag on nodes. Relocate
the Obj node consistently. Preserve the Comes_From_Source flag for
the case of an implicit 'Access reference and post the local errors
on the rewritten prefix consistently.
* sem_util.adb (Is_Aliased_View): Also return true for a generalized
reference to the result of a function call.
Javier Miranda [Thu, 2 Oct 2025 06:41:32 +0000 (06:41 +0000)]
ada: Enforce checks on access to interface type conversions
The patch enforces checks on access to interface type conversions
internally generated by the frontend to displace the pointer to
a tagged type object (pointer named "this" in the C++ terminology)
from a dispatch table to a another dispatch table.
gcc/ada/ChangeLog:
* exp_util.ads (Flag_Interface_Pointer_Displacement): New subprogram.
* exp_util.adb (Flag_Interface_Pointer_Displacement): Ditto.
* exp_attr.adb (Add_Implicit_Interface_Type_Conversion): Flag type
conversions internally added to displace the pointer to the object.
(Expand_N_Attribute_Reference): Ditto.
* exp_ch4.adb (Displace_Allocator_Pointer): Ditto.
* exp_ch6.adb (Expand_Simple_Function_Return): Ditto.
(Make_Build_In_Place_Call_In_Allocator): Ditto.
(Make_CPP_Constructor_Call_In_Allocator): Ditto.
* exp_disp.adb (Expand_Interface_Actuals): Ditto.
* exp_intr.adb (Expand_Dispatching_Constructor_Call): Ditto.
* sem_ch6.adb (Analyze_Function_Return): Ditto.
* sem_disp.adb (Propagate_Tag): Ditto.
* sem_res.adb (Resolve_Actuals): Ditto.
(Valid_Conversion): Rely on the new flag to handle the type conversion
as a conversion added to displace the pointer to the object. Factorize
code handling general and anonymous access types.
* sem_type.adb (Interface_Present_In_Ancestor): For concurrent types
add missing handling of class-wide types. Noticed working on this
issue.
* sinfo.ads (Is_Interface_Pointer_Displacement): Document this new flag.
* gen_il-fields.ads (Is_Interface_Pointer_Displacement): New flag.
* gen_il-gen-gen_nodes.adb (Is_Interface_Pointer_Displacement): New
flag on N_Type_Conversion nodes.
* gen_il-internals.adb (Image): Add Is_Interface_Pointer_Displacement
flag image.
Eric Botcazou [Fri, 7 Nov 2025 11:32:11 +0000 (12:32 +0100)]
ada: Small cleanup in analysis of package instantiation
This cleans up some ancient code computing whether the instantiation of the
body is needed and moves remnants to the Needs_Body_Instantiated predicate.
gcc/ada/ChangeLog:
* sem_ch12.adb (Analyze_Package_Instantiation): Streamline and move
code clearing Needs_Body after it is computed to ...
(Needs_Body_Instantiated): ...here. Chain if-then constructs.
Eric Botcazou [Fri, 7 Nov 2025 12:10:00 +0000 (13:10 +0100)]
ada: Fix bogus error about null exclusion for designated type with multiple views
It comes from the new legality check retroactively introduced by AI12-0289,
but the implementation is fooled by the presence of both an incomplete and
a partial view for a tagged type.
gcc/ada/ChangeLog:
PR ada/111433
* sem_util.ads (Incomplete_Or_Partial_View): Add Partial_Only formal
parameter.
* sem_util.adb (Incomplete_Or_Partial_View): Likewise. Do not look
for an incomplete view if it is set to True.
* sem_ch6.adb (Check_Conformance.Null_Exclusions_Match): Pass True
for Partial_Only in the call to Incomplete_Or_Partial_View.
If an assignment to a part of a ghost variable occurs in a ghost entity,
then the variable should be assertion-level-dependent on this entity.
[This includes both assignment statements and passing a ghost variable as an
out or in out mode actual parameter.]
gcc/ada/ChangeLog:
* ghost.adb (Check_Procedure_Call_Levels): New function for
implementing the check.
* ghost.ads (Check_Procedure_Call_Levels): Likewise.
* sem_ch6.adb (Analyze_Procedure_Call): Check the levels after
the call has been resolved and the previous ghost region has
been restored.
Steve Baird [Tue, 4 Nov 2025 23:01:14 +0000 (15:01 -0800)]
ada: Avoid duplicate streaming and Put_Image subprograms (part2).
Follow up fixes for earlier changes made for this issue.
gcc/ada/ChangeLog:
* exp_attr.adb (Expand_N_Attribute_Reference): Ensure that
Build_Record_Or_Elementary_Input_Function and
Build_Record_Or_Elementary_Output_Procedure are only called
from within an instance of Build_And_Insert_Type_Attr_Subp.
In particular, the results returned by those 2 functions should
not be passed directly to Insert_Action. This is needed to
ensure that the newly-built subprogram is inserted at the correct
point in the tree.
Bob Duff [Wed, 5 Nov 2025 14:14:35 +0000 (09:14 -0500)]
ada: Improve warning on abstract equality
In many cases, we warn if an abstract equality function
is called implicitly. In the case of record equality,
this patch adds a mention of the particular component_declaration
for which an abstract "=" is invoked; otherwise it is hard to
understand the warning for record types with many components.
gcc/ada/ChangeLog:
* exp_ch4.adb (Warn_On_Abstract_Equality_For_Component):
Add additional information in the record-component case.
Viljar Indus [Mon, 3 Nov 2025 11:10:32 +0000 (13:10 +0200)]
ada: Update implementation for ghost entities inside ignored regions
gcc/ada/ChangeLog:
* ghost.adb (Check_Valid_Ghost_Policy): Remove function.
(Ghost_Policy_In_Effect): Force the ghost policy to be always be
ignore inside ignored regions.
(Mark_And_Set_Ghost_Declaration): Likewise.
Steve Baird [Thu, 30 Oct 2025 21:40:06 +0000 (14:40 -0700)]
ada: Don't generate function that violates No_Dynamic_Sized_Objects restriction
In some cases, the compiler implicitly generates a hash function for an
enumeration type. If a No_Dynamic_Sized_Objects restriction is in effect then
that hash function violates the restriction, resulting in a compilation
failure. Therefore, do not generate the hash function in that case.
gcc/ada/ChangeLog:
* exp_imgv.adb (Build_Enumeration_Image_Tables): If a
No_Dynamic_Sized_Objects restriction is in effect, then choose a large
value for Threshold so that no Lit_Hash function is generated.
This patch makes suspension objects receptive to asynchronous transfers
of control, i.e. aborts. It also replaces the multiple platform-dependent
implementations of suspension objects with a single implementation
relying on the existing abstractions RTS_Lock, Sleep and Wakeup.
The only reason Suspension_Object was a tagged type before this patch was
to have finalization. This patch makes it use the Finalizable aspect,
which is more lightweight.
gcc/ada/ChangeLog:
* libgnarl/a-sytaco.ads (Suspension_Object): Use Finalizable aspect.
When recording the mask for loop masking of OMP SIMD calls we
currently fail to provide the correct vector type and number of
copies in all cases. The following tries to correct this.
PR tree-optimization/122736
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Compute
num_mask_args for all mask modes. Pass the mask vector
type to vect_record_loop_mask and adjust ncopies according
to the number of mask arguments.
Austin Law [Tue, 18 Nov 2025 13:51:12 +0000 (06:51 -0700)]
[RISC-V] Add cpu and tuning structures for spacemit-x60 design
Per the discussion a couple weeks ago in the patchwork call, I'm submitting the
spacemit-x60 basic core and tuning info on Austin's behalf.
I know everyone would like to have performance data, but with 8%+ run to run
variation with the same binary and ~10hr cycle times for spec2017 (integer ref
only), getting data with any degree of confidence is exceedingly hard when the
improvements are expected to be in the low single digits. It just takes so
many runs to get a reasonable confidence interval.
This also does not include the vector pipeline model. I think we know how we
want to model it, but it's not really started yet. Per our discussion this
(and further twiddles to the tuning/pipeline model) can be made during
stage3/stage4 given the low risk of breaking anything.
We're also likely going to want to make adjustments to the vector cost
structure. Right now it's using the generic cost structure. Overall it looks
like the spacemit-x60 has better than expected segment support, but worse than
expected stride support. So the trick of using strides to avoid the permute in
SATD likely isn't viable (setting aside the unaligned vector element issues).
Anyway, the goal is to get the basics in place so that the -mcpu/-mtune options
work and we can iterate on finer details.
I'll wait for pre-commit CI to do its thing. There's no rush to commit, just
to get it submitted. I have no plans to work in Pago Pago tonight to
get anything else submitted before the stage1 close deadline.
* config/riscv/riscv-cores.def: Add RISCV_TUNE and RISCV_CORE entries
for the spacemit-x60 design.
* config/riscv/riscv-opts.h (riscv_microarchitecture_type): Add entry
for spacemit-x60 design.
* config/riscv/riscv.cc (spacemit_x60_tune_info): New tune structure
for the spacemit-x60 design.
* config/riscv/riscv.md (tune): Add spacemit_x60.
Include spacemit-x60.md.
* config/riscv/spacemit-x60.md: New file
* doc/riscv-mtune.texi: Regenerate.
* doc/riscv-mcpu.texi: Regenerate.
Richard Biener [Tue, 18 Nov 2025 08:59:54 +0000 (09:59 +0100)]
tree-optimization/122723 - masking of .COND_ADD reductions
The following fixes loop masking of .COND_ADD reductions when
we decide to reduce multiple lanes to one, thus go through
vect_transform_reduction. The first issue is in
vect_reduction_update_partial_vector_usage which does not handle
incoming .COND_ADD well and fails to compute 'cond_fn' in this
case, disabling masking. The second issue is that
vect_transform_reduction does not implement the masked but
not mask-by-cond case for any .COND_* operation. The following
should fix both.
The testcases verify runtime in vect.exp and vectorization support
in the i386 target section for the combinations of -O3, -Ofast
plus masked vs. non-masked epilogues.
PR tree-optimization/122723
* tree-vect-loop.cc (vect_reduction_update_partial_vector_usage):
Handle incoming .COND_* operation.
(vect_transform_reduction): Likewise. Handle .COND_*
operation when not using COND_EXPR masking in a masked loop.
* gcc.dg/vect/vect-reduc-cond-add-1.c: New generic functional
testcase.
* gcc.target/i386/vect-epilogues-6.c: New testcase.
* gcc.target/i386/vect-epilogues-7.c: Likewise.
* gcc.target/i386/vect-epilogues-8.c: Likewise.
* gcc.target/i386/vect-epilogues-9.c: Likewise.
The following fixes the logic in multi-step mask conversions with
respect to the case where we need to resort to the sbool variant
of the unpack optabs. We were testing a wrong condition on when
that would apply in the multi-step case.
PR tree-optimization/122723
* tree-vect-stmts.cc (supportable_widening_operation):
Correct optab to query in the multi-step case when it is
supposed to hit the sbool case.
Tomasz Kamiński [Fri, 24 Oct 2025 14:45:59 +0000 (16:45 +0200)]
libstdc++: Fix construction function_ref from nontype<&S::x> and reference_wrapper [PR121858]
To reduce instantiation count, function_ref(nontype<&S::x>, r) previously
reused the invoker from function_ref(nontype<&S::x>, &r). This assumed r was
always a reference to S or a derived class. However, this constructor is also
valid for lvalues (but not rvalues) of reference_wrapper specializations.
This patch fixes this by limiting above optimization only to situations,
when argument is not specialization of reference_wrapper. This is achieved
bu comparing __inv_unwrap<_Td>::type with _Td. We use __inv_unwrap because
unwrap_reference_t does not handle cv-qualified types.
PR libstdc++/121858
libstdc++-v3/ChangeLog:
* include/bits/funcref_impl.h
(function_ref::function_ref(nontype<__fn>, _Up&&)): Handle.
reference_wrapper.
* testsuite/20_util/function_ref/call.cc: Call and update
test05(). Add new test06() for reference_wrapper.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
liuhongt [Fri, 14 Nov 2025 03:59:08 +0000 (19:59 -0800)]
Also handle vptestnm + and15/and3 to just vptestnm.
r16-1298-gcdfa5fe03512f7 optimizes vpcmp + and15/and3 to vpcmp when VF
is 2 or 4. vptestnm is a variant of vpcmpeq which accepts
nonimm_or_0_operand. The patch handles that.
gcc/ChangeLog:
PR target/103750
* config/i386/sse.md (*<avx512>_eq<mode>3_and15): New
define_insn.
(*avx512vl_eqv2di_and3): Ditto.
* config/i386/i386.md (*ior<mode>_ccz_1): Fix the typo in the
comments above.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512vl-pr103750-2.c: New test.
James K. Lowden [Mon, 17 Nov 2025 23:17:00 +0000 (18:17 -0500)]
cobol: Correct libgcobol install directory and add components.
Set libgcobol/Makefile.am to define libdir and libsubdir the way libada does.
Reorganize libgcobol/compat directory to group by emulation, not component.
Move orphan gcc/udf/stored-char-length.cbl to the compat directory.
Introduce new POSIX bindings.
gcc/cobol/ChangeLog:
PR cobol/122702
* Make-lang.in: Move stored-char-length.cbl to libgcobol.
libgcobol/ChangeLog:
PR cobol/122702
* Makefile.am: Set libdir and libsubdir per libada example.
* Makefile.in: Regenerate.
* compat/README.md: Revise per new directory structure.
* compat/gnu/lib/CBL_ALLOC_MEM.cbl: Moved from compat/lib/gnu.
* compat/gnu/lib/CBL_CHECK_FILE_EXIST.cbl: Moved from compat/lib/gnu.
* compat/gnu/lib/CBL_DELETE_FILE.cbl: Moved from compat/lib/gnu.
* compat/gnu/lib/CBL_FREE_MEM.cbl: Moved from compat/lib/gnu.
* compat/gnu/udf/stored-char-length.cbl: New file.
* compat/lib/gnu/CBL_ALLOC_MEM.cbl: Moved to compat/gnu/lib.
* compat/lib/gnu/CBL_CHECK_FILE_EXIST.cbl: Moved to compat/gnu/lib.
* compat/lib/gnu/CBL_DELETE_FILE.cbl: Moved to compat/gnu/lib.
* compat/lib/gnu/CBL_FREE_MEM.cbl: Moved to compat/gnu/lib.
* posix/cpy/psx-open.cpy: New file.
* posix/shim/open.cc: New file.
* posix/shim/stat.h: Add mode & flag bits for open.cc
* posix/udf/posix-lseek.cbl: New file.
* posix/udf/posix-open.cbl: New file.
* posix/udf/posix-read.cbl: New file.
* posix/udf/posix-write.cbl: New file.
* xmlparse.cc: Quell context_t initialization-order warning.
Jonathan Wakely [Mon, 17 Nov 2025 21:01:33 +0000 (21:01 +0000)]
libstdc++: Fix error reporting for filesystem::rename on Windows [PR122726]
Use the __last_system_error() function and the system_category to
convert the Windows error to a generic one.
libstdc++-v3/ChangeLog:
PR libstdc++/122726
* src/filesystem/ops-common.h [_GLIBCXX_FILESYSTEM_IS_WINDOWS]
(rename): Use __last_system_error to set errno accurately.
* testsuite/27_io/filesystem/operations/rename.cc: Test
error_code matches errc::no_such_file_or_directory.
Thomas Koenig [Sun, 16 Nov 2025 12:34:32 +0000 (13:34 +0100)]
Update UNSIGNED documentation.
As UNSIGNED will not be in F202Y, this patch removes the
corresponding section and documents -funsigned as a straight
extension. I have also added a note that this is compatible
with -flang.
gcc/fortran/ChangeLog:
* gfortran.texi: Remove section "Experimental features for future
Fortran revisions". Move documentation of UNSIGNED into Extensions.
Mention flang compatibility.
David Malcolm [Mon, 17 Nov 2025 19:08:59 +0000 (14:08 -0500)]
SARIF output: fix diagnostics within C++ member fns [PR122626]
When building hierarchical logical locations, we were stopping traveral
upwards before any TRANSLATION_UNIT_DECL for decls, but not for types,
leading to an assertion failure when producing SARIF output for
diagnostics within C++ member fns.
Fixed thusly.
gcc/testsuite/ChangeLog:
PR analyzer/122626
* g++.dg/analyzer/malloc.C: Add sarif output to verify the fix for
PR analyzer/122626.
gcc/ChangeLog:
PR analyzer/122626
* tree-logical-location.cc
(tree_logical_location_manager::get_parent): Return null when
TYPE_CONTEXT is a TRANSLATION_UNIT_DECL so that we don't fail
the assertion in assert_valid_tree.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
introduces a regression when building the toolchain for the
aarch64-w64-mingw32 host, at least. It is most likely the same for
*-*-mingw32 targets.
This patch resolves the issue when using sockets for SARIF JSON-RPC
notifications on MinGW host and adds the required socket library to the
host file for *-*-mingw.
Signed-off-by: Evgeny Karpov <evgeny@kmaps.co>
gcc/ChangeLog:
PR diagnostics/122666
* config/i386/x-mingw32 (LIBS): Add -lws2_32
* diagnostics/sarif-sink.cc: Move sockets includes to before
config.h and support __MINGW32__.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Andrew Pinski [Mon, 17 Nov 2025 01:33:00 +0000 (17:33 -0800)]
fnspec: constify methods [PR97894]
Since these methods don't write to the this, let's mark them as const methods
saying this is not written to.
This warning is from cppcheck and added the other methods as I noticed too.
Andrew Pinski [Sun, 16 Nov 2025 06:06:16 +0000 (22:06 -0800)]
cfgcleanup: Move cheaper checks earlier
This moves 2 checks dealing with abnormal and phis earlier
before going through the walk of the bb stmts. This should provide
a small compile time performance improvement when doing cfgcleanup in a
few (maybe not so many) cases.
gcc/ChangeLog:
* tree-cfgcleanup.cc (maybe_remove_forwarder_block): Move a few
checks earlier.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Andrew Pinski [Sun, 16 Nov 2025 05:55:08 +0000 (21:55 -0800)]
cfgcleanup: merge tree_forwarder_block_p and remove_forwarder_block into maybe_remove_forwarder_block
remove_forwarder_block is never called without calling tree_forwarder_block_p
before hand so this merges the two functions and simplifies the code slightly.
tree_forwarder_block_p was only returning true at the very end (except for one
location in the code checking the loop which is fixed here) so this nature to
merge the two functions even.
move_debug_stmts_from_forwarder and phi_alternatives_equal definitions were moved
to before maybe_remove_forwarder_block.
Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
* tree-cfgcleanup.cc (tree_forwarder_block_p): Merge this and ...
(remove_forwarder_block): This into ...
(maybe_remove_forwarder_block): Here.
(cleanup_tree_cfg_bb): Call only maybe_remove_forwarder_block.
(pass_merge_phi::execute): Likewise.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Jonathan Wakely [Mon, 17 Nov 2025 14:33:50 +0000 (14:33 +0000)]
libstdc++: Fix std module for gcc4-compatible ABI
Add preprocessor checks to std.cc.in for features which are not
supported with the old string ABI.
The COW std::string doesn't properly support C++11 allocators, so the
aliases such as std::pmr::string, std::pmr::u8string etc. are not
defined for the old string ABI.
The std::syncbuf type uses std::string and is not defined for the old
string ABI.
libstdc++-v3/ChangeLog:
* src/c++23/std.cc.in [!__cpp_lib_syncbuf]: Disable exports for
<syncstream> contents when not defined.
[!_GLIBCXX_USE_CXX11_ABI]: Disable exports for pmr aliases in
<string> when not defined.
Jeff Law [Mon, 17 Nov 2025 17:40:46 +0000 (10:40 -0700)]
[PR rtl-optimization/122575] Fix mode on optimized IOR comparison
As Andrew P recognized, we were using the wrong mode when simplifying certain
equality tests like (eq (ior (ne x 0 (y)). Sam took Andrew's suggestion and
verified it fixed the problem he was stumbling over.
So even though I haven't recreated the problem, I'm reasonably confident we've
got the right fix. I've bootstrapped and regression tested on x86.
PR rtl-optimization/122575
gcc/
* simplify-rtx.cc (simplify_context::simplify_relational_operation_1):
Use correct mode for simplified IOR expression inside equality
conditional.
Jason Merrill [Mon, 17 Nov 2025 15:56:40 +0000 (21:26 +0530)]
libstdc++: testsuite/util adjustments for import std
In my import std testing patch, to work around c++/99000 (include after
import) I move #includes of the util/ headers above the import. And so I
made some adjustments to those headers to support this: adding some missing
dependencies, making sure that in headers that include both importable and
non-importable headers, at least one importable header comes first to work
with my patch to translate e.g. #include <vector> to import <bits/stdc++.h>.
The testsuite_iterators.h avoids a failure in
20_util/specialized_algorithms/uninitialized_copy/constrained.cc from
including <memory> after this header, with a mysterious "no match for
operator<" between long and difference_type.
Xi Ruoyao [Sun, 16 Nov 2025 13:52:38 +0000 (21:52 +0800)]
simplify-rtx: Simplify VEC_CONCAT of two CONST_VECTOR
The code for simplify the VEC_CONCAT of two CONST_VECTOR is already
there, but it's guarded by CONST_SCALAR_INT_P || CONST_FIXED_P ||
CONST_DOUBLE_AS_FLOAT_P. I don't think this logic makes sense.
Either we should allow CONST_VECTOR here or we should remove the dead
code handling CONST_VECTOR in this if statement. I cannot see anything
wrong to just allow CONST_VECTOR.
gcc/
* simplify-rtx.cc (simplify_const_binary_operation): Simplify
VEC_CONCAT two constant vectors.
Philip Herron [Sun, 9 Nov 2025 22:05:58 +0000 (22:05 +0000)]
gccrs: Fix segv in errors in type checking an impl item
When we typecheck a trait impl block item, at the end we validate it
against the trait definition by doing a final unify but if the type check
fails on the the impl item it returns NULL here. The other issue was that
if we fail to resolve the specified lifetime we return error early, this
changes the typechecking to default to an anon lifetime so we can continue
typechecking.
This is a normal type parameter but in order to setup the generics we need to
create a synthetic TyTy::FnType so we can bind the parent's impl generics to
the type system and it just works like any other generic item at that point.
Then for example we have:
Again we consistently bind the this const generic parameter the same way so
the lazy evaluation of the generic can take place.
gcc/rust/ChangeLog:
* backend/rust-compile-item.cc (CompileItem::visit): support the synthetic function consts
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::Resolve): likewise
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): create the synth
* typecheck/rust-tyty.h: new flag for synthetic constant
gcc/testsuite/ChangeLog:
* rust/execute/torture/const-generics-5.rs: New test.
* rust/execute/torture/const-generics-6.rs: New test.
* rust/execute/torture/const-generics-7.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
* rust/compile/const_generics_18.rs: New test.
* rust/compile/const_generics_19.rs: New test.
* rust/execute/torture/const-generics-3.rs: New test.
* rust/execute/torture/const-generics-4.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Philip Herron [Mon, 3 Nov 2025 16:48:56 +0000 (16:48 +0000)]
gccrs: Add support for binding const generic values to paths
Const generics bind values which can be accessed like a normal path but the difference
is that they can be true expression values not just type paths. This patch adds support
to resolving a method inference which passes a generic value into the method and fixes
some missed bugs along the way. The tricky part was that there is a case where in the
return position of a method returning a const param type vs the type of the method
there is a special case in the unify rules so that we unify the specified type of the
const param type not the const param itself.
gcc/rust/ChangeLog:
* backend/rust-compile-resolve-path.cc: handle const param values
* typecheck/rust-hir-type-check-item.cc: generate const infer vars when required
* typecheck/rust-type-util.cc (unify_site_and): handle a null param cleanup
* typecheck/rust-tyty-util.cc (TyVar::get_implicit_const_infer_var): helper interface
* typecheck/rust-tyty-util.h: update header prototypes
* typecheck/rust-tyty.cc (BaseType::is_concrete): correctly handle const types
(ConstParamType::get_name): emit the specified type
(ConstParamType::is_equal): fix recursion loop
* typecheck/rust-unify.cc (UnifyRules::go): const infer vars need cleanup too
* typecheck/rust-unify.h: support base generics
gcc/testsuite/ChangeLog:
* rust/execute/torture/const-generics-2.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gccrs: Implement E0579 error checking in RangePattern compilation
Checks whether upper bound of range is not lower or equal to the lower bound.
gcc/rust/ChangeLog:
* backend/rust-compile-pattern.cc(compilePatternCheckExpr::visit(RangePattern)):
Add E0579 check to ensure that lower bound is always below upper bound.
* backend/rust-compile-pattern.cc (compile_range_pattern_bound): Set litexpr
to negative if has_minus is present in the RangePatternBoundLiteral param.
* parse/rust-parse-impl.h (parse_literal_or_range_pattern): Parse minus sign
properly for LiteralPattern.
* ast/rust-pattern.h (LiteralPattern): Add has_minus boolean for LiteralPattern.
* hir/tree/rust-hir-pattern.h (LiteralPattern): Ditto.
* ast/rust-pattern.cc (LiteralPattern::as_string): Update to include minus sign
if present.
* hir/tree/rust-hir.cc (LiteralPattern::as_string): Ditto.
* hir/rust-ast-lower-pattern.cc (visit(LiteralPattern)): Pass has_minus boolean
from AST to HIR.
* backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit(LiteralPattern)):
Compile litexpr as negative if minus sign is present.
Richard Biener [Mon, 17 Nov 2025 10:29:46 +0000 (11:29 +0100)]
Improve LIM dump and some testcases
The following avoids the newline between 'Moving statement' and the
actual stmt in dumps to make specific scanning easier.
* tree-ssa-loop-im.cc (move_computations_worker): Avoid newline
between 'Moving statement' and actual statement dump in dumpfile.
* gcc.dg/vect/slp-9.c: Use noipa function attribute, drop
-fno-early-inlining option.
* c-c++-common/restrict-2.c: Explicitly look for hoisted loads.
* gfortran.dg/pr104466.f90: Adjust.
cfgloop: Modify loop_exits_{to,from}_bb_p return type to edge
Given that when finding whether the predicate in question is satisfied
or not we already do the heavy-lifting of identifying the specific
edge that matches the particular criterion, it is wasteful to throw
the edge information away, only to potentially have to recalculate it
when true is returned.
Rather, given the ability of treating a valid pointer as true and,
conversely, the NULL pointer as false, we can return the edge for
should we wish to use it, while keeping the function's existing calls
in the code as is.
That is, rather than keeping two 128-bit loads and using the usubl2
instruction designed to operate on upper halves of 128-bit vector
registers, we are doing four 64-bit scalar loads and operate on 64-bit
values, which leads to increased register pressure.
What happens here is the aforementioned commit lowers the vget_half_* ()
intrinsics to BIT_FIELD_REFs, at which point the logic in
tree-ssa-forwprop.cc::optimize_vector_load () kicks in, breaking down
vector loads into scalar loads as long as all uses are through
BIT_FIELD_REFs. AFAICT, this function (or before it existed, the code
comprising it) handles the following scenarios:
(1) Introduced in r10-135-ga7eb97ad269b65 in response to PR88983, this
code broke down vector loads into smaller loads whenever the target
doesn't natively support wider loads, fixing code quality issues. This
should always be a win since the original loads weren't even available in
the first place.
(2) Since r12-2728-g2724d1bba6b364, it is now also handling loads that
feed into VEC_UNPACK expressions to prefer extending scalar loads to
vector loads + vector unpack, which is beneficial at least on some
microarchitectures.
This patch restricts the optimization to those scenarios explicitly, while
adding another one on top:
(3) If any of the BIT_FIELD_REFs have scalar type, prefer scalar loads to
vector loads to reduce possible traffic between scalar and vector register
files. IOW, only if all BIT_FIELD_REFs are used as subvectors, assume
there might be other instructions operating on those subvectors that do
not leave the vector register file, and do not perform the transformation.
To summarize, after this patch, if either (1), (2), or (3) holds, narrow
loads are preferred, otherwise vector loads are left intact.
Bootstrapped and regtested on aarch64 and x86_64, no regressions on
SPEC2017, the code snippet above added as an aarch64-specific test.
gcc/ChangeLog:
* tree-ssa-forwprop.cc (optimize_vector_load): Inhibit
optimization when all uses are through subvectors without
extension.
Jakub Jelinek [Mon, 17 Nov 2025 08:44:05 +0000 (09:44 +0100)]
GCC, meet C++20
I've tried to test a patch to switch -std=gnu++17 C++ default
to -std=gnu++20 (will post momentarily), but ran into various problems
during GCC bootstraps, our codebase isn't fully C++20 ready.
The most common problems are arithmetic or bitwise operations
between enumerators of different enum types (or between enumerator
and floating point in the testsuite), ambiguous overloaded
operator == because of forgotten const qualification of const inside
of the argument and then libcody being largely stuck in C++ and incompatible
with C++20 which introduced char8_t type and uses it for u8 literals.
The following patch fixes various issues I've run into, for libcody
this patch just makes sure code including cody.hh can be compiled
with -std=gnu++20, libcody itself I have a tweak in the other patch.
Nothing in this patch will make the code invalid for C++14.
2025-11-17 Jakub Jelinek <jakub@redhat.com>
gcc/
* tree-core.h (enum built_in_function): Avoid arithmetics or
bitwise operations between enumerators from different enums.
* lto-streamer.h (lto_tag_is_gimple_code_p): Likewise.
* gimple.h (gimple_omp_atomic_set_memory_order): Likewise.
* common/config/i386/i386-cpuinfo.h (M_CPU_SUBTYPE_START,
M_CPU_TYPE): Likewise.
* tree-complex.cc (expand_complex_libcall): Likewise.
* ipa-modref-tree.h (modref_access_node::operator ==): Change
argument type from modref_access_node & to
const modref_access_node &.
* ipa-modref-tree.cc (modref_access_node::operator ==): Likewise.
gcc/cobol/
* symbols.cc (symbol_table_init): Avoid arithmetics or
bitwise operations between enumerators from different enums.
gcc/fortran/
* parse.cc (gfc_parse_file): Avoid arithmetics or
bitwise operations between enumerators from different enums.
libcody/
* cody.hh (MessageBuffer::Space): For C++14 or newer use
(char) u8' ' instead of Detail::S2C(u8" ").
Jakub Jelinek [Mon, 17 Nov 2025 08:42:56 +0000 (09:42 +0100)]
OpenMP/OpenACC tests. vs C++26
OpenMP/OpenACC array sections, generally expr[expr:expr] or
expr[expr:expr:expr] can have any of the exprs between [ and ]
omitted, low-bound (first defaults to 0, last (stride) defaults to
1 and the middle (length) for some arrays defaults to
ceil((size − lower_bound)/stride).
People have been writing this for years without spaces between [ and :
and : and ] when that expr has been omitted, but guess for C++26
one needs to add a space. I think [ :: ] isn't going to be parsed
as the same as [ : : ] either.
Richard Biener [Thu, 6 Nov 2025 12:19:35 +0000 (13:19 +0100)]
[x86] avoid using masked vector epilogues when no scalar epilog is needed
The following arranges for avoiding masked vector epilogues when we'll
eventually arrive at a vector epilogue with VF == 1 which implies no
scalar epilog will be necessary.
This avoids regressing performance in OpenColorIO when the
avx512_masked_epilogues tuning is enabled. A testcase for one
example case is shown in PR122573.
PR tree-optimization/122573
* config/i386/i386.cc (ix86_vector_costs::finish_cost): Avoid
using masked epilogues when an SSE epilogue would have a VF of one.
* gcc.dg/vect/costmodel/x86_64/costmodel-pr122573.c: New testcase.
Andrew MacLeod [Fri, 14 Nov 2025 21:11:30 +0000 (16:11 -0500)]
Allow single PHI initial values.
There are some single PHI groups that can benefit from an initial
value. Also improve the iteration calculation by bounding each
iteration with the known global value.
PR tree-optimization/121345
gcc/
* gimple-range-phi.cc (phi_group::phi_group): Add modifier name.
(phi_group::is_modifier_p): Set modifier stmt operand name.
(phi_group::calculate_using_modifier): Bound the iteration range
by known global range.
(phi_analyzer::process_phi): Allow single PHIS if they meet certain
criteria.
* gimple-range-phi.h (m_modifier_name): New member.
(is_modifier_p): Adjust prototype.
Andrew MacLeod [Fri, 14 Nov 2025 21:06:42 +0000 (16:06 -0500)]
Turn PHI analyzer to a simple pre-pass
Rather than having a dynamic analyzer around that is handcuffed by
only global values, invoke it as a prepass in VRP and put all values it finds
in the query's global cache via update_range_info.
gcc/
* gimple-range-fold.cc (fold_using_range::range_of_phi): Remove
the PHI analysis query.
* gimple-range-phi.cc (phi_analysis_object): Delete.
(phi_analysis_initialize): Delete.
(phi_analysis_finalize): Delete.
(phi_analysis_available_p): Delete.
(phi_analysis): Invoke a phi analyzer.
(phi_analyzer::phi_analyzer): Preprocess all phi nodes and set
global values for them in a query.
(phi_analyzer::process_phi): Use query, and export any inital
values found to the query.
* gimple-range-phi.h (m_global): Delete.
(phi_analysis_initialize): Delete.
(phi_analysis_finalize): Delete.
(phi_analysis_available_p): Delete.
(phi_analysis): Change prototype.
* tree-vrp.cc (execute_ranger_vrp): Call phi_analysis.
gcc/testsuite/
* gcc.dg/pr102983.c: Adjust final check.
Andrew MacLeod [Fri, 14 Nov 2025 20:39:18 +0000 (15:39 -0500)]
Update current query global when system global changes.
This ensures a the current range_query's internal tracking of a global value
matches anything another entity sets.
* gimple-range.cc (gimple_ranger::update_range_info): New.
* gimple-range.h (update_range_info): New prototype.
* tree-ssanames.cc (set_range_info): Update the range info for
the current range query.
* value-query.h (update_range_info): New prototype.
* value-query.cc (update_range_info): New default stub.
Andrew Pinski [Sat, 15 Nov 2025 22:51:32 +0000 (14:51 -0800)]
cfglceanup: Fix check for preheaders
I had messed up the check in r16-5258-g1d8e2d51e5c5cb for preheaders
where return to remvoe the forwarder preheader block even if LOOPS_HAVE_PREHEADERS
was set. I am not sure how often this happens because most of the time the pre-header
will have an incoming phi block anyways but it is safer not to remove it in this case.
Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
* tree-cfgcleanup.cc (tree_forwarder_block_p): Restore check on
LOOPS_HAVE_PREHEADERS.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Jonathan Wakely [Sun, 16 Nov 2025 13:57:25 +0000 (13:57 +0000)]
libstdc++: Include <mutex> in syncbuf.cc [PR122698]
For most configurations bits/std_mutex.h would already be included by
<syncstream>, but not if configured with _GLIBCXX_USE_CXX11_ABI=0 as the
default, because syncbuf is disabled in that case.
libstdc++-v3/ChangeLog:
PR libstdc++/122698
* src/c++20/syncbuf.cc (__syncbuf_get_mutex): Include <mutex>.
Fix indentation of function body.
Nathaniel Shead [Sat, 15 Nov 2025 04:11:55 +0000 (15:11 +1100)]
c++/modules: Keep tracking instantiations of static class variable templates [PR122625]
r16-4930-gfd5c057c2d01 ensured that we noted all class-scope variables.
But I also added a clause to 'read_var_def' to skip all class-scope
instantiations, under the mistaken belief that this would be handled in
read_class_def.
But as the testcase shows, read_class_def cannot (and should not)
register instantiations of member variable templates, as when reading
the class it just sees the template declaration. So this patch
re-enables tracking instantiations of class-scope variable templates.
PR c++/122625
gcc/cp/ChangeLog:
* module.cc (trees_in::read_var_def): Also track class-scope
primary template specialisations.
gcc/testsuite/ChangeLog:
* g++.dg/modules/inst-7_a.C: New test.
* g++.dg/modules/inst-7_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
Richard Biener [Fri, 14 Nov 2025 12:40:50 +0000 (13:40 +0100)]
Always analyze possible partial vector usage
The following makes us always start with LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P
as true and only makes vect_determine_partial_vectors_and_peeling
honor --param vect-partial-vector-usage or explicit requests from the
target for epilog vectorization. This exposes whether we could have
used partial vectors to the target at costing time as even when the
main loop is never supposed to get masked the value is useful to
determine possible epilog loop masking.
* tree-vect-loop.cc (_loop_vec_info::_loop_vec_info):
Initialize can_use_partial_vectors_p to true.
(vect_determine_partial_vectors_and_peeling): Add masked_p
parameter and honor it.
(vect_analyze_loop_2): Pass through masked_p.
(vect_analyze_loop_1): Pass down masked_p.
(vect_analyze_loop): Simplify check on possible masking of
the epilog when there's no .WHILE_ULT.
Richard Biener [Fri, 14 Nov 2025 13:07:01 +0000 (14:07 +0100)]
Decide on LOOP_VINFO_USING_SELECT_VL_P after determining partial vectors
The following makes us decide on partial vectors first so we can
use LOOP_VINFO_USING_PARTIAL_VECTORS_P to decide on a decrementing IV
and LOOP_VINFO_USING_SELECT_VL_P as followup.
* tree-vect-loop.cc (vect_determine_partial_vectors_and_peeling):
Remove resetting of LOOP_VINFO_USING_SELECT_VL_P.
(vect_analyze_loop_2): Decide on partial vectors before
deciding on decrementing IV or .SELECT_VL usage.
Richard Biener [Fri, 14 Nov 2025 13:10:24 +0000 (14:10 +0100)]
Do not call vect_determine_partial_vectors_and_peeling from transform
It gets more difficult to maintain this doesn't do any changes late
(see followups), so kill it. We do have to retain re-setting of
LOOP_VINFO_PEELING_FOR_NITER though, since
vect_need_peeling_or_partial_vectors_p is incorrect for epilogues
when done during analysis. We should fix this of course.
* tree-vectorizer.h (vect_determine_partial_vectors_and_peeling):
Remove.
(vect_need_peeling_or_partial_vectors_p): Declare.
* tree-vect-loop.cc (vect_determine_partial_vectors_and_peeling):
Make static.
(vect_need_peeling_or_partial_vectors_p): Export.
* tree-vect-loop-manip.cc (vect_do_peeling): Do not call
vect_determine_partial_vectors_and_peeling but instead
re-compute LOOP_VINFO_PEELING_FOR_NITER using
vect_need_peeling_or_partial_vectors_p.
Richard Biener [Fri, 14 Nov 2025 12:54:20 +0000 (13:54 +0100)]
Remove LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P
This is a write-only parameter, it cannot be relied upon either.
So remove it.
* tree-vectorizer.h (_loop_vec_info::epil_using_partial_vectors_p):
Remove.
(LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P): Likewise.
* tree-vect-loop.cc (_loop_vec_info::_loop_vec_info):
Do not initialize epil_using_partial_vectors_p.
(vect_determine_partial_vectors_and_peeling): Do not set it.
Lewis Hyatt [Sun, 16 Nov 2025 04:10:52 +0000 (23:10 -0500)]
diagnostics: Fix -fdump-internal-locations for 64-bit location_t
When adding support for 64-bit location_t in GCC 15, I missed a couple
changes needed for the internal debugging tool -fdump-internal-locations to
work properly. This would previously ICE on a location_t large enough to
overflow a signed 32-bit int.
gcc/ChangeLog:
* diagnostics/context.cc (num_digits): Change argument type from
`int' to `uint64_t'.
(test_num_digits): Add test for 64-bit argument.
* diagnostic.h (num_digits): Adjust prototype.
* input.cc (write_digit): Accept argument in range 0-9 instead of
an arbitrary int.
(write_digit_row): Adjust to change in write_digit().
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/location-overflow-test-3.c: New test.
* gcc.dg/plugin/plugin.exp: Add the new test.
Andrew Pinski [Sun, 16 Nov 2025 04:13:45 +0000 (20:13 -0800)]
aarch64: unxfail pr117123.C
This testcase now passes for aarch64 after r16-5258-1d8e2d51e5c5.
The keeping around the loop pre-header helped to better thread the jumps
and fix the issue at hand.
Pushed as obvious.
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/pr117123.C: un-xfail.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Jason Xu [Sun, 3 Aug 2025 22:19:04 +0000 (18:19 -0400)]
gcc: Make aarch64-mingw32 target install wrap stdint.h
Wrapped stdint.h for AArch64 MinGW32 is useful for bare-matal PE
target e.g. UEFI, as those platform does not provide a system
stdint.h, this would align with x86_64 mingw32 target which provides a
wrapped stdint.h
I have tested this by compiling a AArch64 UEFI Application using gcc's
stdint.h, with -ffreestanding flag, and execute the application with
AAVMF(edk2) inside QEMU.
gcc/ChangeLog:
* config.gcc (aarch64-*-mingw*): Set use_gcc_stdint to wrap.