Pan Li [Tue, 23 Jun 2026 13:04:44 +0000 (21:04 +0800)]
Match: Support unsigned scalar SAT_MUL form 14
This patch would like to try to match the the unsigned
SAT_MUL form 14, aka below
#define DEF_SAT_U_MUL_FMT_14(NT, WT) \
NT __attribute__((noinline)) \
sat_u_mul_##NT##_from_##WT##_fmt_14 (NT a, NT b) \
{ \
WT x = (WT)a * (WT)b; \
NT hi = x >> (sizeof(NT) * 8); \
NT lo = (NT)x; \
return hi == 0 ? lo : -1; \
}
while WT is uint128_t, uint64_t, uint32_t and uint16_t, and
NT is uint64_t, uint32_t, uint16_t or uint8_t.
gcc/ChangeLog:
* match-sat-alu.pd: Add pattern for unsigned scalar
SAT_MUL form 14.
* configure: Regenerate.
* configure.ac: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
Replace AC_TRY_LINK with AC_LINK_IFELSE.
c++tools/ChangeLog:
* configure: Regenerate.
* configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.
config/ChangeLog:
* acx.m4: Remove uses of AC_CHECK_TOOL_PREFIX. Replace AC_TRY_COMPILE
with AC_COMPILE_IFELSE.
* asmcfi.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
* bitfields.m4: Likewise.
* cet.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE. Replace AC_TRY_RUN
with AC_RUN_IFELSE.
* codeset.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.
* enable.m4: Replace AC_HELP_STRING with AS_HELP_STRING.
* gcc-plugin.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.
* hwcaps.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE. Replace
AC_TRY_LINK with AC_LINK_IFELSE.
* isl.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.
* lcmessage.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.
* no-executables.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
Replace AC_TRY_LINK with AC_LINK_IFELSE.
* po.m4: Replace AC_OUTPUT_COMMANDS with AC_CONFIG_COMMANDS.
* tls.m4: Add explicit 4th argument to AC_LINK_IFELSE.
fixincludes/ChangeLog:
* configure: Regenerate.
* configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.
gcc/ChangeLog:
* acinclude.m4: Replace AC_FOREACH with m4_foreach_w. Replace
AC_TRY_LINK with AC_LINK_IFELSE.
* configure: Regenerate.
* configure.ac: Replace AC_HELP_STRING with AS_HELP_STRING. Replace
AC_PROG_LIBTOOL with LT_INIT.
gnattools/ChangeLog:
* configure: Regenerate.
* configure.ac: Replace AC_HELP_STRING with AS_HELP_STRING.
gotools/ChangeLog:
* configure: Regenerate.
* configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.
libada/ChangeLog:
* configure.ac: Replace AC_HELP_STRING with AS_HELP_STRING.
libatomic/ChangeLog:
* acinclude.m4: Replace AC_ERROR with AS_MSG_ERROR. Replace AC_TRY_LINK
with AC_LINK_IFELSE. Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
Replace AC_HELP_STRING with AS_HELP_STRING. Replace
AC_TRY_RUN with AC_RUN_IFELSE.
* configure.ac: Replace AM_PROG_LIBTOOL with LT_INIT. Replace
AC_STDC_HEADERS with AC_HEADER_STDC.
* acinclude.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
* configure.ac: Replace AC_LANG_C with AC_LANG([C]). Replace
AM_PROG_LIBTOOL with LT_INIT.
libgm2/ChangeLog:
* acinclude.m4: Replace AC_HELP_STRING with AS_HELP_STRING. Replace
AC_LANG_SAVE AC_LANG_CPLUSPLUS (...) AC_LANG_RESTORE with
AC_LANG_PUSH([C++]) (...) AC_LANG_POP([C++]). Replace AC_TRY_LINK with
AC_LINK_IFELSE. Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
* configure: Regenerate.
* configure.ac: Replace AC_HELP_STRING AS_HELP_STRING. Remove redundant
AM_PROG_LIBTOOL. Replace AC_LANG_C with AC_LANG([C]). Replace
AC_FOREACH with m4_foreach_w.
libgomp/ChangeLog:
* acinclude.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE. Replace
AC_TRY_COMPILE with AC_COMPILE_IFELSE. Replace AC_HELP_STRING with
AS_HELP_STRING. Replace AC_TRY_RUN with AC_RUN_IFELSE.
* configure: Regenerate.
* configure.ac: Replace AM_PROG_LIBTOOL with LT_INIT. Replace
AC_STDC_HEADERS with AC_HEADER_STDC. Replace _AC_COMPUTE_INT with
AC_COMPUTE_INT.
libgrust/ChangeLog:
* configure.ac: Replace AC_FOREACH with m4_foreach_w.
libiberty/ChangeLog:
* acinclude.m4: Replace AC_TRY_RUN with AC_RUN_IFELSE. Replace
AC_TRY_COMPILE with AC_COMPILE_IFELSE.
* configure.ac: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE. Replace
AC_ISC_POSIX with AC_SEARCH_LIBS([strerror],[cposix]).
libitm/ChangeLog:
* acinclude.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE. Replace
AC_TRY_COMPILE with AC_COMPILE_IFELSE. Replace AC_HELP_STRING with
AS_HELP_STRING. Replace AC_TRY_RUN with AC_RUN_IFELSE.
* configure.ac: Replace AM_PROG_LIBTOOL with LT_INIT. Replace
AC_STDC_HEADERS with AC_HEADER_STDC.
libobjc/ChangeLog:
* configure: Regenerate.
* configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.
Replace AM_PROG_LIBTOOL with LT_INIT. Remove unnecessary escape in
double quoted string.
libphobos/ChangeLog:
* configure: Regenerate.
* configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.
Remove redundant AM_PROG_LIBTOOL. Replace AC_FOREACH with m4_foreach_w.
* m4/druntime.m4: Replace AC_HELP_STRING AS_HELP_STRING. Replace
AC_TRY_COMPILE with AC_COMPILE_IFELSE.
* m4/druntime/cpu.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.
* m4/druntime/os.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
libquadmath/ChangeLog:
* configure.ac: Replace AM_PROG_LIBTOOL with LT_INIT. Replace
AC_LANG_C with AC_LANG([C]). Replace AC_TRY_COMPILE with
AC_COMPILE_IFELSE. Replace AC_TRY_LINK with AC_LINK_IFELSE.
libsanitizer/ChangeLog:
* configure.ac: Replace AM_PROG_LIBTOOL with LT_INIT. Replace
AC_TRY_COMPILE with AC_COMPILE_IFELSE. Replace AC_FOREACH with
m4_foreach_w.
libssp/ChangeLog:
* configure.ac: Replace AC_LANG_C with AC_LANG([C]). Replace
AC_TRY_COMPILE with AC_COMPILE_IFELSE. Replace AC_TRY_LINK with
AC_LINK_IFELSE. Replace AM_PROG_LIBTOOL with LT_INIT.
libvtv/ChangeLog:
* configure.ac: Replace AC_GNU_SOURCE with AC_USE_SYSTEM_EXTENSIONS.
Replace AM_PROG_LIBTOOL with LT_INIT. Replace AC_FOREACH with
m4_foreach_w.
lto-plugin/ChangeLog:
* configure: Regenerate.
* configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.
Replace AC_TRY_LINK with AC_LINK_IFELSE. Replace AM_PROG_LIBTOOL with
LT_INIT.
Georg-Johann Lay [Sun, 28 Jun 2026 10:08:04 +0000 (12:08 +0200)]
AVR: ad target/125752 - Simplify double -> 64-bit fixed conversions.
When converting a fixed-point value to double, there is no need to
use ldexp to adjust for FBIT of the result. Instead, FBIT can be
added to the double exponent without any further ado. When the
input is +/-0.0 then the outcome of adding FBIT to the exponent
is a small number that __fix[uns]dfdi converts to 0.
Andrew Pinski [Tue, 12 May 2026 00:23:10 +0000 (17:23 -0700)]
match: Canonicalize `(float)(a CMP b)` into `(a CMP b) ? 1.0 : 0.0` [PR115571]
Canonicalize `(type) (a CMP b)` to `(a CMP b) ? (type) true : (type) false` for
floating point types. fold-const already does this so it makes sense to do it on
the gimple level too. This also improves vectorization because a conversion
from a comparison to a float does not need to implemented and also if it is
implemented then selection of 1.0/0.0 is easier than the conversion would be.
Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR tree-optimization/115571
gcc/ChangeLog:
* match.pd (`(float)(a CMP b)`): New pattern.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/float-conv-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Jakub Jelinek [Sat, 27 Jun 2026 19:33:00 +0000 (21:33 +0200)]
s390: Fix up *brx_stage1_<GPR:mode> [PR125992]
The following testcase is miscompiled since r16-3301 but the problem is much
older.
The *brx_stage1_<GPR:mode> define_insn_and_split pattern doesn't describe
that it clobbers CC_REGNUM, but splits (before reload) into something which
does clobber CC_REGNUM unconditionally.
Since r16-3301 on this testcase the late_combine1 pass figures it can extend
the lifetime of CC_REGNUM across such an instruction, but when it is in
split1 pass split into something that does clobber CC_REGNUM, the value from
earlier comparison till later use is not preserved anymore.
The following patch fixes it by adding clobber for CC_REGNUM even to the
*brx_stage1_<GPR:mode> pattern, so that df/late_combine etc. know that it is
CC_REGNUM is clobbered by it.
I had to put the clobber before the match_scratch clobber, otherwise there
is endless loop trying to split this insn in split1 pass, the insn it is
split into matches the pattern again and is split again etc. forever.
Even with this patch combine can match this insn, we have code to add the
missing clobbers if the register isn't live across it.
Filip Kastl [Sat, 27 Jun 2026 06:48:58 +0000 (08:48 +0200)]
fixincl.c: Fix my previous patch for (const) char *
In my previous patch I changed a parameter of extract_quoted_files
from const char * to just char *. I believe that's still the right call
but I overlooked that a string literal gets assigned to that variable
inside the function body. That means we throw away constness of that
string literal and produce a warning during compilation of fixincl.c.
This patch fixes this by using a helper const char * variable.
fixincludes/ChangeLog:
* fixincl.c (extract_quoted_files): Add a const char * helper
variable.
Ian Lance Taylor [Sat, 27 Jun 2026 15:46:14 +0000 (08:46 -0700)]
libbacktrace: support window size in zstd decompression
Reportedly this occurs on AerynOS.
Patch from Ivan Molodetskikh.
* elf.c (elf_zstd_decompress_frame): Support a compressed block
that does not set the single segment flag.
* zstdtest.c (tests): Add tests without single segment.
Thomas Koenig [Fri, 19 Jun 2026 15:35:37 +0000 (17:35 +0200)]
Remove some wrong unused warnings, do not issue warnings if there are errors.
This patch fixes to omissions when variables were not set as referenced
and removes the warnings if errors have previously been issued.
gcc/fortran/ChangeLog:
PR fortran/30438
PR fortran/125801
* io.cc (gfc_resolve_dt): Set internal unit as used on read.o
* resolve.cc (resolve_transfer): Move setting value as used
before possible early return.
(gfc_resolve): Only call warn_unused_vs_set if there are no
pending errors.
gcc/testsuite/ChangeLog:
PR fortran/30438
PR fortran/125801
* gfortran.dg/warn_unused_but_set_error_1.f90: New test.
* gfortran.dg/warn_unused_intent_out_2.f90: New test.
Eikansh Gupta [Fri, 26 Jun 2026 05:40:43 +0000 (11:10 +0530)]
tree-optimization: Use ranges for int-float comparisons [PR125385]
When integer operands are converted to a floating-point type before a
comparison, the existing fold only checks whether the whole integer type
is exactly representable. Use SSA range information as a fallback so
range-limited values, such as those masked to [0, 255], can be compared
directly as integers. Apply the same range-aware exactness check to
integer-to-float comparisons against real constants.
PR tree-optimization/125385
gcc/ChangeLog:
* match.pd ((FTYPE) N CMP (FTYPE) M): Use range information
to decide whether integer operands are exactly representable.
((FTYPE) N CMP CST): Likewise.
* real.cc: Include backend.h and vr-values.h.
(format_helper::can_represent_range_value_p): New function.
* real.h (format_helper::can_represent_range_value_p): Declare.
* tree-core.h (class irange): Forward declare.
But the number of operands isn't fixed and may be less than 7. Replace
the min size rtx with GEN_INT (min_size) to support different numbers of
operands.
PR middle-end/125977
* expr.cc (emit_block_move_via_pattern): Replace ops[6].value
in assert with GEN_INT (min_size).
x86: Improve vector_loop/unrolled_loop for memset/memcpy
uses move_by_pieces and store_by_pieces for memcpy and memset epilogues
with the fixed epilogue size. Since move_by_pieces and store_by_pieces
don't use the maximum size info, they generate extra branches and moves
for bounded memcpy and memset. Commit
x86-64: Inline memmove with overlapping unaligned loads and stores.
inlines memmove with overlapping unaligned and stores which reduces the
numbers of branches as well as moves when the maximum size is known.
Rename ix86_expand_movmem to ix86_expand_set_or_movmem and extend it to
inline bounded memcpy and memset. Update ix86_expand_set_or_cpymem to
call ix86_expand_set_or_movmem for bounded memset and memcpy as memmove
if misaligned moves are preferred.
In addition to reduce 727.cppcheck_r O2 code size by ~9%, there're
another ~8 benchmarks whose code sizes are reduced >2% across spec2026
and spec2017 with march=x86-64-v3 O2, no big code size impact for Ofast,
performance impact is negligible(slightly better, but all under noise
range) for both O2 and Ofast.
gcc/
PR target/125856
PR target/125865
* config/i386/i386-expand.cc (ix86_expand_set_or_cpymem):
Call ix86_expand_set_or_movmem for
TARGET_MISALIGNED_MOVE_STRING_PRO_EPILOGUES.
(ix86_expand_memset_val): New.
(ix86_expand_n_move_movmem): Renamed to ...
(ix86_expand_n_move_set_or_movmem): This. Add a pointer to rtx
argument for memset. Also expand memset.
(ix86_expand_n_overlapping_move_movmem): Renamed to ...
(ix86_expand_n_overlapping_move_set_or_movmem): This. Add a
pointer to rtx argument for memset. Also expand memset.
(ix86_expand_less_move_movmem): Renamed to ...
(ix86_expand_less_move_set_or_movmem): This. Add a pointer to
rtx argument for memset. Also expand memset.
(ix86_expand_movmem): Renamed to ...
(ix86_expand_set_or_movmem): This. Add bool arguments for memcpy
and memset. Also expand memcpy and memset.
* config/i386/i386-protos.h (ix86_expand_movmem): Renamed to ...
(ix86_expand_set_or_movmem): This. Add bool arguments for memcpy
and memset.
* config/i386/i386.md (movmem<mode>): Replace ix86_expand_movmem
with ix86_expand_set_or_movmem.
Andi Kleen [Thu, 25 Jun 2026 20:28:49 +0000 (13:28 -0700)]
Support overriding of CREATE_GCOV for test suite
create_gcov use is currently hard coded in the test suite. Allow to
override it with a environment variable similar to what the
autoprofiled bootstrap allows.
gcc/testsuite/ChangeLog:
* lib/profopt.exp (profopt-execute): Check if CREATE_GCOV env
variable exists and use it when there.
line provokes a bogus "consteval-only expressions are only allowed
in a constant-evaluated context" error. (Not the line before
because there we have an OVERLOAD because the second argument's
type isn't obvious, and so the whole thing is considered type-dep.)
A splice-specifier is [: constant-expression :], and [expr.const.defns]:
an expression or conversion is manifestly constant-evaluated if it is
a constant-expression.
So I think we shouldn't walk SPLICE_EXPRs in
check_out_of_consteval_use_r.
PR c++/125900
gcc/cp/ChangeLog:
* reflect.cc (check_out_of_consteval_use_r): Don't walk
SPLICE_EXPR.
Harald Anlauf [Thu, 25 Jun 2026 20:55:47 +0000 (22:55 +0200)]
Fortran: -fc-prototypes, deferred shape and deferred length dummies [PR125902]
Commit r17-1785 fixed the C prototypes emitted by -fc-prototypes for
procedure interfaces with deferred shape and deferred length dummies, but
did not consistently detect when "#include <ISO_Fortran_binding.h>" was
needed. Use common helper function to handle this.
PR fortran/125902
gcc/fortran/ChangeLog:
* dump-parse-tree.cc (needs_CFI_cdesc): New helper function to
determine when struct CFI_cdesc_t is used.
(has_cfi_cdesc): Use it here...
(get_c_type_name): ... and here.
Roger Sayle [Fri, 26 Jun 2026 15:20:05 +0000 (16:20 +0100)]
i386: ix86_expand_sse_movcc improvements
This patch implements Alexander Monakov's suggestion from PR 123238.
Traditionally, the x86_64 backend implements VCOND_MASK using a three
instruction sequence of pand, pandn and por (requiring three registers),
however when op_true and op_false are both constant vectors, this can
be done using just two instructions, pand and pxor (requiring only two
registers). This requires delaying forcing const_vector operands to
memory (the constant pool) as late as possible, including changing the
predicates on the define_expand patterns that call ix86_expand_sse_movcc
to (consistently) accept vector_or_const_vector_operand.
void f(char c[])
{
for (int i = 0; i < 8; i++)
c[i] = c[i] ? 'a' : 'c';
}
2026-06-26 Roger Sayle <roger@nextmovesoftware.com>
Hongtao Liu <hongtao.liu@intel.com>
gcc/ChangeLog
PR target/123238
* config/i386/i386-expand.cc: Delay calling force_reg on
op_true and op_false. Generate an AND then XOR sequence
if op_true and op_false are both CONST_VECTOR_P.
* config/i386/mmx.md (vcond_mask_<mode>v4hi): Allow operands
1 and 2 to be vector_or_const_vector_operand.
(vcond_mask_<mode>v2hi): Likewise.
(vcond_mask_<mode><mmxintvecmodelower>): Likewise.
(vcond_mask_<mode><mode>): Likewise.
* config/i386/sse.md (vcond_mask_<mode><sseintvecmodelower>):
Likewise.
(vcond_mask_<mode><sseintvecmodelower>): Likewise.
(vcond_mask_v1tiv1ti): Likewise.
(vcond_mask_<mode><sseintvecmodelower>): Likewise.
(vcond_mask_<mode><sseintvecmodelower>): Likewise.
* config/i386/predicates.md (vector_or_0_or_1s_operand): Delete
predicate with no remaining uses.
gcc/testsuite/ChangeLog
PR target/123238
* gcc.target/i386/pr123238-2.c: New test case.
vekumar [Thu, 25 Jun 2026 05:03:55 +0000 (10:33 +0530)]
i386: Restrict AVX-VNNI-INT8 insns to VEX encoding [PR125949]
The vpdpb{ss,su,uu}d[s] instructions from AVX-VNNI-INT8 only have a VEX
encoding; the EVEX form of these operations is provided by AVX10.2. A
target such as -march=znver6 enables AVX-VNNI-INT8 together with the
AVX-512 xmm/ymm16-31 register file but does not have AVX10.2. The
vpdp<vpdotprodtype>_<mode> pattern used a single "v" alternative with a
"maybe_evex" prefix, so under register pressure the allocator could pick
xmm/ymm16-31 and the instruction was promoted to its EVEX form, which is
not available on such targets.
Add a VEX-only alternative that keeps the operands in xmm/ymm0-15
(enabled for AVX-VNNI-INT8) and gate the existing EVEX alternative on
AVX10.2. When AVX10.2 is not available only the VEX alternative is
enabled, so the high registers are no longer used and the EVEX form is
never emitted.
gcc/ChangeLog:
PR target/125949
* config/i386/i386.md ("isa"): Add avxvnniint8.
("enabled"): Adjust for avxvnniint8.
* config/i386/sse.md (vpdp<vpdotprodtype>_<mode>): Adjust for
AVXVNNIINT8.
gcc/testsuite/ChangeLog:
PR target/125949
* gcc.target/i386/pr125949.c: New test.
Richard Biener [Fri, 26 Jun 2026 08:55:29 +0000 (10:55 +0200)]
middle-end/125875 - incomplete guards on VEC_PERM_EXPR folding
This fixes up match.pd patterns using can_vec_perm_const_p on
existing permutations to indicate whether we are before or
after vector lowering. For this to be correct we have to use
the new vec_perm_indices CTOR taking the actual permuted inputs
so can_vec_perm_const_p can also handle the vec_shl/vec_shr
expansion path.
PR middle-end/125875
* match.pd: When checking for !can_vec_perm_const_p also
allow variable permutes and use the vec_perm_indices CTOR
with the original tree operands.
Richard Biener [Fri, 19 Dec 2025 08:15:58 +0000 (09:15 +0100)]
Add tree_to_vec_perm_indices
The following adds a function like tree_to_vec_perm_builder but
for building vec_perm_indices directly from all operands of a
VEC_PERM_EXPR. This avoids errors such as shown in PR123175
and allows us to extract information from the permuted inputs
to implement vec_shl/vec_shr recognition in can_vec_perm_const_p,
making that fully cover what vector lowering will assess.
* vec-perm-indices.h (vec_perm_indices::new_vector): New overload.
(vec_perm_indices::input_bitwise_zero_p): New method.
(vec_perm_indices::m_input0_bitwise_zero_p,
vec_perm_indices::m_input1_bitwise_zero_p): New members.
(vec_perm_indices::vec_perm_indices): Adjust.
(tree_to_vec_perm_indices): Declare.
* vec-perm-indices.cc (vec_perm_indices::new_vector): New overload.
(vec_perm_indices::new_expanded_vector): Adjust.
(tree_to_vec_perm_indices): New function.
* optabs-query.cc (can_vec_perm_const_p): Handle permute
patterns mapping to vec_shl/vec_shr.
* tree-vect-generic.cc (lower_vec_perm): Move vec_shl/vec_shr
detection to can_vec_perm_const_p and simplify.
H.J. Lu [Fri, 26 Jun 2026 00:43:20 +0000 (08:43 +0800)]
determine_block_size: Set len_rtx to min size if min size == max size
Update determine_block_size to set len_rtx to min size if min size ==
max size.
gcc/
PR middle-end/125977
* builtins.cc (determine_block_size): Change len_rtx to reference
and set it to min size if min size == max size.
* expr.cc (emit_block_move_via_pattern): Assert count == min_size
if min_size == max_size.
(set_storage_via_setmem): Likewise.
gcc/testsuite/
PR middle-end/125977
* g++.dg/pr125977.C: New test.
Pengfei Li [Sun, 21 Jun 2026 14:42:12 +0000 (14:42 +0000)]
AArch64: Make dispatch scheduling reachable on multi-issue cores
Commit r16-4079-gc8bd7b2d550 added dispatch scheduling for AArch64.
However, in choose_ready(), the dispatch scheduling path was only
reachable when dfa_lookahead <= 0, or when the first ready insn was a
SCHED_GROUP_P insn. Commit r16-6155-g40d0f79577e then made SCHED_GROUP_P
insns bypass dispatch scheduling to prevent fusion pairs from being
split. As a result, the DFA lookahead path is preferred and dispatch
scheduling is effectively disabled for AArch64 multi-issue cores.
dfa_lookahead comes from the hook first_cycle_multipass_dfa_lookahead.
In current AArch64 implementation, it returns a positive issue rate
value for multi-issue cores unless sched_fusion is true. This patch adds
an IS_DISPATCH_ON check to that hook implementation so that the dispatch
scheduling path is reachable on dispatch-enabled AArch64 cores.
Bootstrapped and tested on aarch64-linux-gnu.
gcc/ChangeLog:
* config/aarch64/aarch64.cc
(aarch64_sched_first_cycle_multipass_dfa_lookahead): Return 0
when dispatch scheduling is enabled.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/dispatch_sched_1.c: New test.
Jonathan Wakely [Fri, 26 Jun 2026 11:30:57 +0000 (12:30 +0100)]
libstdc++: Test fs::status and fs::symlink_status with dir symlink
I realized that we didn't test that filesystem::status and
filesystem::symlink_status work correctly for directory symlinks.
For POSIX there's no reason it wouldn't Just Work, but for Windows
symlinks to directories and symlinks to regular files require different
handling. These tests will ensure that we get it right when Windows
symlinks are supported.
libstdc++-v3/ChangeLog:
* testsuite/27_io/filesystem/operations/status.cc: Check
handling of directory symlink.
* testsuite/27_io/filesystem/operations/symlink_status.cc:
Likewise.
Rainer Orth [Fri, 26 Jun 2026 08:37:07 +0000 (10:37 +0200)]
Remove HAVE_AS_IX86_QUAD
Every supported version of the Solaris/x86 assembler supports the .quad
directive, so HAVE_AS_IX86_QUAD is always defined with both as and gas.
This patch removes the configure check and guarded code.
Bootstrapped without regressions on i386-pc-solaris2.11,
amd64-pc-solaris2.11 with both the original Solaris 11.4 as and the
current one, and x86_64-pc-linux-gnu.
Rainer Orth [Fri, 26 Jun 2026 08:24:57 +0000 (10:24 +0200)]
Remove HAVE_AS_IX86_DIFF_SECT_DELTA
Every supported version of the Solaris/x86 assembler supports
subtraction of symbols in different sections. Therefore the
HAVE_AS_IX86_DIFF_SECT_DELTA is always defined with both as and gas and
can be removed.
Bootstrapped without regressions on i386-pc-solaris2.11,
amd64-pc-solaris2.11 with both the original Solaris 11.4 as and the
current one, and x86_64-pc-linux-gnu.
Tomasz Kamiński [Thu, 25 Jun 2026 11:28:04 +0000 (13:28 +0200)]
libstdc++: Make bitset::reference a proper range proxy.
This implements remaining changes from P3612R1 Harmonize proxy-reference
operations (LWG 3638 and 4187).
As the const-assignment operator in bitset::reference (from LWG4187)
is used by range concepts (std::indirectly_writable) to recognize
iterator returning it by value as proxy iterator (see range_proxy.cc) test,
this change is backported to C++23. This puts it inline with vector<bool>
reference and other proxy type, for which the corresponding assignment
operator where added by P2321 in C++23 and implemented in r13-2159-g72886f.
Similary, a swap overloads accepting bitset::reference by value and bool&,
are necessary for ranges::swap and ranges::iter_swap to work correctly,
so they should also be backported. This patch follows the approach from
resolution of LWG3638 from r12-5311-g59434931fb658f, and backports the
overloads to C++11. This harmonizes the operations on this two proxy
types (per paper title). Corresponding test are added for both classes.
The deprecation warning for static vector<bool>::swap is added since C++26.
The text in _GLIBCXX26_DEPRECATED_SUGGEST leads to following message:
'static constexpr void std::vector<bool, _Alloc>::swap(reference, reference)
[with... ]' is deprecated: use 'swap' invoked via ADL or 'std::ranges::swap'
instead
libstdc++-v3/ChangeLog:
* include/bits/stl_bvector.h: Add _GLIBCXX_RESOLVE_LIB_DEFECTS
comment for 3638.
(vector<bool, _Alloc>::operator=(bool) const)
[__glibcxx_ranges_zip]: Adjust guard.
(vector<bool, _Alloc>::swap): Add deprected attribute via
_GLIBCXX26_DEPRECATED_SUGGEST.
* include/std/bitset (bitset::operator=(bool) const)
[__glibcxx_ranges_zip]: Define.
(bistset::reference::swap) [__cplusplus >= 201103L]: Define.
* testsuite/20_util/bitset/access/range_proxy.cc: New test.
* testsuite/20_util/bitset/access/ref_swap.cc: New test.
* testsuite/23_containers/vector/bool/element_access/range_proxy.cc:
New test.
* testsuite/23_containers/vector/bool/element_access/ref_swap.cc:
New test.
* testsuite/23_containers/vector/bool/modifiers/swap/constexpr.cc:
Check for deprecated warning on static swap.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Jiahao Xu [Fri, 26 Jun 2026 07:16:58 +0000 (15:16 +0800)]
LoongArch: Fix parameter type for loongarch_sched_reassociation_width
Follow up to r17-1827-g92d206fab98, which changed the reassociation_width
target hook to use tree_code instead of unsigned int. This patch updates
loongarch_sched_reassociation_width to use the correct tree_code parameter
type to match the target hook definition.
gcc/ChangeLog:
* config/loongarch/loongarch.cc (loongarch_sched_reassociation_width):
Get a tree_code instead of unsigned int.
Jerry DeLisle [Wed, 24 Jun 2026 01:17:27 +0000 (18:17 -0700)]
fortran: [PR118793] Provide expanded diagnostics for namelist read
The change implements additional diagnostic information for namelist
read. In particular, error messages provide line number, column
position, the specific file name, and a portion of the input line
where the error ocurred.
PR libfortran/118793
libgfortran/ChangeLog:
* io/file_pos.c (st_rewind): Reset line and column numbers.
* io/io.h: Add line and column number to the gfc_unit
structure.
* io/list_read.c (next_char_default): Increment the column
position and line number as needed.
(next_char_internal): Likewise.
(next_char_utf8): Likewise.
(nml_err_ret): Build the expanded diagnostic message.
* io/unit.c (insert_unit): Initialize the line_number.
Iain Sandoe [Fri, 26 Jun 2026 10:41:38 +0000 (11:41 +0100)]
testsuite, c, Darwin: Fix Mach-O issues in toplevel asm tests.
Current Darwin no longer supports non-pie executables, leading to spurious
fails because of linker warnings; skip these cases.
Several of the tests also needed updates for Mach-O ABI (e.g asm directive
spellings or USER_LABEL_PREFIX). This fixes the UNRESOLVED cases but not
the actual fail of toplevel-simple-asm-2.
Jonathan Wakely [Thu, 25 Jun 2026 11:59:04 +0000 (12:59 +0100)]
libstdc++: Update feature test macros and tests for C++29
With r17-1595-g0c5c6249a2e9a7 G++ supports -std=c++29 so update our
feature test macro generation and testsuite to know about it.
For the stds map in bits/version.def we can just use '> 20YYMM' for the
date of the previous standard, instead of '>= 20YYMM' with some
arbitrary value that's greater than the previous standard. For example
for C++23 we can use '> 202002L' instead of '>= 202100L'. This means we
won't need to update the values again in future, we can just add new
rows to the end.
For the testsuite, we bump the v3_max_std value to 29 which means that
tests that require c++23 or c++26 will be run with that standard and
also c++29.
libstdc++-v3/ChangeLog:
* include/bits/version.def (stds): Add C++29 value and adjust
C++23 and C++26 values.
* include/bits/version.h: Regenerate.
* testsuite/lib/libstdc++.exp (v3_max_std): Update to 29.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Enes Cevik [Wed, 17 Jun 2026 08:53:08 +0000 (11:53 +0300)]
gccrs: intrinsic: Enforce intrinsic signatures during the type checking
This patch adds a validation mechanism to the typechecker. This mechanism
verifies intrinsic declarations against predefined signature rules. If
a signature is incorrect, the compiler emits the proper diagnostic and
prevents the malformed intrinsic from reaching the backend.
gcc/rust/ChangeLog:
* Make-lang.in: Add rust-hir-type-check-intrinsic.o.
* typecheck/rust-hir-type-check-implitem.cc
(TypeCheckTopLevelExternItem::visit): Check intrinsic signature.
* typecheck/rust-hir-type-check-intrinsic.cc: New file.
* typecheck/rust-hir-type-check-intrinsic.h: New file.
Enes Cevik [Wed, 17 Jun 2026 08:44:14 +0000 (11:44 +0300)]
gccrs: intrinsic: Use Values::Intrinsics instead of raw strings in builtin map
This patch adds builtin intrinsic names to Values::Intrinsics class and
updates the BuiltinContext mappings to use these constants instead of
hardcoded raw strings.
gcc/rust/ChangeLog:
* backend/rust-builtins.cc
(BuiltinsContext::register_rust_mappings): Use Values::Intrinsics
constants instead of raw strings.
* util/rust-intrinsic-values.h (class Intrinsics): Add missing
builtin intrinsics.
Enes Cevik [Mon, 8 Jun 2026 15:05:22 +0000 (18:05 +0300)]
gccrs: intrinsic: Add min_align_of
This patch implements the 'min_align_of' compiler intrinsic. It
resolves the minimum alignment of a given compile-time sized type
and returns it as a size_type_node integer constant expression.
gcc/rust/ChangeLog:
* backend/rust-compile-intrinsic.cc (generic_intrinsics): Add
min_align_of to map.
* backend/rust-intrinsic-handlers.cc (min_align_of_handler):
New function.
* backend/rust-intrinsic-handlers.h (min_align_of_handler):
New declaration.
Arthur Cohen [Wed, 10 Jun 2026 15:49:03 +0000 (17:49 +0200)]
gccrs: typecheck: Special case builtin types when typechecking types.
Type definition conflicts are allowed in the case of builtin types. This is used in the
`core` crate to add some more functionality to the builtin types. The consequence of this
is that we need to special case the resolution of types in the case that their name could
refer to a module or to a builtin type.
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Add
special casing for resolving to the builtin type definition if the found type
has the same name and is a module.
gcc/testsuite/ChangeLog:
* rust/compile/type-with-builtin-type-name.rs: New test.
Arthur Cohen [Fri, 29 May 2026 13:37:48 +0000 (15:37 +0200)]
gccrs: nr: Remove hack around resolving modules
Remove the previous hack that was used for resolver module names in the Types NS. Modules now
get properly inserted, and this hack causes conflicts when a module and value share the same
name.
Arthur Cohen [Wed, 21 Jan 2026 18:00:17 +0000 (19:00 +0100)]
gccrs: nr: Add modules to types NS
gcc/rust/ChangeLog:
* util/rust-hir-map.cc (Mappings::insert_module_id): New function.
(Mappings::is_module): Likewise.
* util/rust-hir-map.h: Store a set of AST modules, declare functions for adding and
retrieving them.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Insert modules in the type
namespace and store them in mappings.
* resolve/rust-late-name-resolver-2.0.cc (resolve_type_path_like): Error out when an
expected type resolves to a module.
* resolve/rust-name-resolution.h: Add empty Definition constructor.
* resolve/rust-resolve-builtins.cc (find_builtin_node_id): New function.
* resolve/rust-resolve-builtins.h: Declare it.
gcc/testsuite/ChangeLog:
* rust/compile/mod_in_types_ns.rs: New test.
* rust/compile/mod_in_types_ns2.rs: New test.
gccrs: Search lang_prelude when reaching module boundary during name resolution
gcc/rust/ChangeLog:
* resolve/rust-name-resolution-context.h (NameResolutionContext): Add new function
definition for `should_search_prelude`.
* resolve/rust-name-resolution-context.hxx (NameResolutionContext::should_search_prelude):
Add implementation.
(NameResolutionContext::resolve_segments): Update the check to trigger lang_prelude search
during name resolution in modules.
Lishin [Thu, 11 Jun 2026 09:24:45 +0000 (09:24 +0000)]
gccrs: Clean up drop compile headers
Move DropCandidate into a small drop-specific header and fix the
include sturcture.
Also add missing copyright headers, fix the include guard name, and
assert that Drop lookup returns a single function candidate.
gcc/rust/ChangeLog:
* backend/rust-compile-context.h: Include
rust-compile-drop-candidate.h instead of rust-compile-drop.h.
* backend/rust-compile-drop.cc: Add copyright header.
(CompileDrop::compile_drop_call): Assert that Drop lookup returns a
single function candidate.
* backend/rust-compile-drop.h: Add copyright header. Include
rust-compile-context.h.
(RUST_COMPILE_DROP): Rename to...
(RUST_COMPILE_DROP_H): ...this.
(DropCandidate): Move to...
* backend/rust-compile-drop-candidate.h: ...this new file.
Lishin [Fri, 5 Jun 2026 09:48:25 +0000 (09:48 +0000)]
gccrs: move Drop helpers to separate files
Refactor helper code into separate rust-compile-drop files.
This keeps the Drop-related logic in one place.
gcc/rust/ChangeLog:
* Make-lang.in: Add rust-compile-drop.o.
* backend/rust-compile-block.cc (compile_drop_call): Move to CompileDrop.
(CompileBlock::visit): Use CompileDrop to emit scope drop calls.
* backend/rust-compile-context.h (struct DropCandidate): Move to rust-compile-drop.h.
* backend/rust-compile-pattern.cc (type_has_drop_impl): Move to CompileDrop.
(CompilePatternLet::visit): Use CompileDrop to check Drop impls.
* backend/rust-compile-drop.cc: New file.
* backend/rust-compile-drop.h: New file.
lishin [Fri, 29 May 2026 17:59:00 +0000 (17:59 +0000)]
gccrs: add block-exit Drop calls
Add a helper for building Drop calls, and use it when leaving a block.
Add a block-exit test case.
gcc/rust/ChangeLog:
* backend/rust-compile-block.cc (compile_drop_call): New helper to
build a drop call.
(CompileBlock::visit): Add drop calls for candidates.
* backend/rust-compile-pattern.cc (type_has_drop_impl): New helper to
check whether a type implements Drop.
(CompilePatternLet::visit): Save initialized simple drop candidates.
Enes Cevik [Mon, 25 May 2026 16:00:08 +0000 (19:00 +0300)]
gccrs: attr: Add attributes rustc_allocator and rustc_allocator_nounwind
This patch introduces the `rustc_allocator` and `rustc_allocator_nounwind`
attributes.
These attributes instruct the GCC backend to apply `malloc` and `nothrow`.
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc (HIRCompileBase::setup_fndecl): Dispatch the new
attributes.
(HIRCompileBase::handle_rustc_allocator_on_fndecl): New function.
(HIRCompileBase::handle_rustc_allocator_nounwind_on_fndecl): New function.
* backend/rust-compile-base.h (handle_rustc_allocator_on_fndecl): New declaration.
(handle_rustc_allocator_nounwind_on_fndecl): Likewise.
* util/rust-attribute-values.h (Attributes): Add RUSTC_ALLOCATOR and
RUSTC_ALLOCATOR_NOUNWIND constexprs.
* util/rust-attributes.cc (__definitions): Register rustc_allocator and
rustc_allocator_nounwind in the BuiltinAttributes list.
* checks/errors/rust-builtin-attribute-checker.cc (rustc_allocator): New function.
(rustc_allocator_nounwind): New function.
(attribute_checking_handlers): Add rustc_allocator and rustc_allocator_nounwind
functions.
gcc/testsuite/ChangeLog:
* rust/compile/attr-allocator1.rs: New test.
* rust/compile/attr-allocator2.rs: New test.
* rust/compile/attr-allocator3.rs: New test.
This patch introduces the `rustc_std_internal_symbol` attribute.
This attribute is required by the Rust standard library to prevent
name mangling for internal runtime symbols.
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc (should_mangle_item): Bypass
mangling for rustc_std_internal_symbol.
(HIRCompileBase::setup_fndecl): Dispatch the new attribute.
(HIRCompileBase::handle_rustc_std_internal_symbol_attribute_on_fndecl):
New function.
* backend/rust-compile-base.h:
(handle_rustc_std_internal_symbol_attribute_on_fndecl): New declaration.
* util/rust-attribute-values.h (Attributes): Add
RUSTC_STD_INTERNAL_SYMBOL constexpr.
* util/rust-attributes.cc (__definitions): Register
rustc_std_internal_symbol in the BuiltinAttributes list.
* checks/errors/rust-builtin-attribute-checker.cc (rustc_std_internal_symbol):
New function.
(attribute_checking_handlers): Add rustc_std_internal_symbol function.
gcc/testsuite/ChangeLog:
* rust/compile/rustc_std_internal_symbol1.rs: New test.
* rust/compile/rustc_std_internal_symbol2.rs: New test.
utf8_identifiers test has been changed to narrow it's scope. This change
means the test does not cover the unsuffixed float anymore and we aim to
fix that with a new separate test.
The str variable was left in an unspecified but valid state after the
prior move on the same line. This lead to a value of zero on some
platforms and the prefix was considered empty.
gcc/rust/ChangeLog:
* lex/rust-lex.cc (Lexer::parse_decimal_int_or_float): Prevent use
after move.
Arthur Cohen [Wed, 3 Jun 2026 09:28:38 +0000 (11:28 +0200)]
gccrs: privacy-reporter: Check for resolved nodes in more namespaces
And improve code factoring to reduce the complexity of the check_for_privacy_violation function.
gcc/rust/ChangeLog:
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::check_for_privacy_violation): Add new overload for two namespaces.
(PrivacyReporter::visit): Call it.
(PrivacyReporter::check_violation_inner): New function.
* checks/errors/privacy/rust-privacy-reporter.h: Declare it.
Arthur Cohen [Wed, 3 Jun 2026 09:25:11 +0000 (11:25 +0200)]
gccrs: nr: Add lookup(ns1, ns2, ns3)
Which enables looking up resolved nodes in three different namespaces.
This is used in select cases but still important.
gcc/rust/ChangeLog:
* resolve/rust-finalized-name-resolution-context.cc
(FinalizedNameResolutionContext::lookup): New function.
* resolve/rust-finalized-name-resolution-context.h: Declare it.
* resolve/rust-name-resolution-context.cc (NameResolutionContext::lookup): New function.
* resolve/rust-name-resolution-context.h: Declare it.
Enes Cevik [Sun, 3 May 2026 12:02:08 +0000 (15:02 +0300)]
gccrs: resolve: Use definition IDs directly and fix ICEs
This patch fixes multiple ICEs and test failures in the Name Resolution 2.0
- Map directly to definition IDs instead of intermediate import IDs.
- Remove redundant `flatten()` calls. Flattening stripped generic arguments
from aliases like `Self`, causing typecheck errors.
- Prevent ICEs on invalid `use self;` imports by adding early returns.
- Add `Namespace::Types` to pattern lookups to correctly emit E0532 instead
of crashing.
- Remove an unsafe debug loop in `Rib::get` that caused ICEs on ambiguous names.
- Use `value_or` for safe optional unwrapping in module resolution.
gcc/rust/ChangeLog:
* checks/lints/rust-lint-marklive.cc (MarkLive::visit_path_segment): Add Types namespace
lookup.
* checks/lints/unused/rust-unused-checker.cc (UnusedChecker::visit): Use safe optional
unwrapping.
* checks/lints/unused/rust-unused-collector.cc (UnusedCollector::visit): Likewise.
* checks/lints/unused/rust-unused-collector.h: Use helper for multiple namespace lookups.
* resolve/rust-early-name-resolver-2.0.cc (Early::finalize_simple_import): Prevent ICE on
single self imports.
(Early::finalize_rebind_import): Return early to prevent ICE.
* resolve/rust-name-resolution-context.hxx: Use value_or for safe leaf module lookup.
* rust-session-manager.cc (Session::compile_crate): Remove obsolete flatten() calls.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Look up enum variants
in Types namespace.
Arthur Cohen [Fri, 24 Apr 2026 16:14:07 +0000 (18:14 +0200)]
gccrs: nr: Separate APIs properly for flattening.
Namespaces, flattening and resolved_nodes are all properly separated now and in the files
where they should be.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::try_insert_once): Use new
Usage -> Definition map for macros.
* resolve/rust-finalized-name-resolution-context.cc
(FinalizedNameResolutionContext::map_usage): Dispatch to proper resolution map.
* resolve/rust-forever-stack.h (enum class LookupFinalizeError): Move here.
* resolve/rust-forever-stack.hxx: Make resolution take a resolve_segment lambda with
an extra namespace parameter.
* resolve/rust-name-resolution-context.hxx: Likewise.
* resolve/rust-name-resolution-context.cc (find_leaf_definition_inner): Move here...
(NameResolutionContext::find_leaf_definition): Likewise.
(NameResolutionContext::flatten): Likewise.
* resolve/rust-name-resolution-context.h: ...from here.
Arthur Cohen [Thu, 21 May 2026 13:25:22 +0000 (15:25 +0200)]
gccrs: nr: Create new APIs to specify namespaces in which usages should be looked-up.
This fundamentally changes the way that NR works for later pipeline - instead of having one
singular Usage -> Definition map like it was before, the consumers of finalized NRCtx need to
specify in which namespace(s) they expect usages to be looked-up. We now have one usage map
for each namespace, and add new APIs for looking up usages in one or multiple namespaces.
Arthur Cohen [Fri, 3 Apr 2026 15:16:14 +0000 (17:16 +0200)]
gccrs: nr: Improve Macro Def/Invoc mappings
This now uses find_leaf_definition to better resolve macro definitions
to their actual definitions instead of a possible import, and likewise for
invocations. This also improves the robustness and error checking for
resolving definitions.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::insert_once): Rename...
(Early::try_insert_once): ...to this, and improve logic.
(Early::go): Use new API.
(Early::visit): Likewise.
(Early::finalize_simple_import): Likewise.
(Early::finalize_rebind_import): Likewise.
* resolve/rust-early-name-resolver-2.0.h: Declare the new API.
Arthur Cohen [Wed, 25 Mar 2026 13:57:57 +0000 (14:57 +0100)]
gccrs: nr: Rename ImmutableNameResolutionContext to FinalizedNameResolutionContext.
The ImmutableNRCtx was actually very mutable, as part of the pipeline needs to still map
usages later down the line deep within the backend and typecheckers. Instead, add a
new `map_usage` method which maps to the leafmost definition possible.
Arthur Cohen [Tue, 24 Mar 2026 13:34:15 +0000 (14:34 +0100)]
gccrs: nr: Properly resolve imports and modules in segments
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::finalize_rebind_import): Insert imports
as possible glob containers.
* resolve/rust-name-resolution-context.cc (NameResolutionContext::map_usage): Allow
multiple mappings of the same usage.
* resolve/rust-name-resolution-context.hxx: Properly handle imports and modules in segments.
gcc/testsuite/ChangeLog:
* rust/compile/import_in_type_ns6.rs: New test.
* rust/compile/import_in_type_ns7.rs: New test.
gccrs: Make `extern crate self` resolve to current crate
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.h (DefaultResolver): Add new visited_crates
member for recursion protection.
* resolve/rust-default-resolver.cc (DefaultResolver::visit(ExternCrate)):
Make references of `self` resolve to the current crate.
Enes Cevik [Tue, 26 May 2026 12:07:10 +0000 (15:07 +0300)]
gccrs: lang: Add lang item exchange_malloc
This patch introduces the `exchange_malloc` lang item to compiler.
This lang item is a strict prerequisite for the `owned_box` lang item
and box expressions.
Owen Avery [Tue, 2 Jun 2026 02:51:45 +0000 (22:51 -0400)]
gccrs: Limit globbing visitor
The globbing visitor would previously descend into some kinds of rust
item, instead of registering them as glob imports or ignoring them. This
would cause items nested in those items to be glob imported, despite
them not being top level items inside the glob container.
gcc/rust/ChangeLog:
* resolve/rust-finalize-imports-2.0.cc (GlobbingVisitor::visit):
Add overrides for more items.
* resolve/rust-finalize-imports-2.0.h (GlobbingVisitor::visit):
Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/name_resolution27.rs: New test.
Reported-by: Arthur Cohen <arthur.cohen@embecosm.com> Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Jakub Jelinek [Thu, 25 Jun 2026 17:11:32 +0000 (19:11 +0200)]
c++: Add tests for C++29 P3847R1 - Lexical order for lambdas [PR125832]
I believe we already implement the P3847R1 - Lexical order for lambdas
paper, after all it is part of the ABI.
So, this patch just adds tests to verify that, so that we can mark this
as implemented (I'd say just Yes, even GCC 4.6 passes the second test
with -std=c++0x and GCC 4.8 with -std=c++1y the first test).
2026-06-25 Jakub Jelinek <jakub@redhat.com>
PR c++/125832
* g++.dg/cpp29/lambda-order1.C: New test.
* g++.dg/cpp29/lambda-order2.C: New test.
Jakub Jelinek [Thu, 25 Jun 2026 16:15:00 +0000 (18:15 +0200)]
c++: Add tests for C++29 P3899R3 - Clarify the behavior of floating-point overflow [PR125824]
As the P3899R3 paper says, it standardizes the GCC 15 behavior.
The following patch adds tests from the paper.
On the second test it seems to report the expected diagnostics
starting with PR104389 fix, so I think in cxx-status.html we should
say it is supported since GCC 12. The first test obviously needs
at least GCC 13 because it uses the extended floating point types.
2026-06-25 Jakub Jelinek <jakub@redhat.com>
PR c++/125824
* lib/target-supports.exp
(check_effective_target_flt_dbl_ldbl_inf_nan): New.
* g++.dg/cpp29/ext-floating1.C: New test.
* g++.dg/cpp29/std-floating1.C: New test.
Jeff Law [Thu, 25 Jun 2026 15:37:13 +0000 (09:37 -0600)]
[RISC-V] Avoid multiply defined insn name
When adding a ChangeLog entry for a recent change I realized the
define_insn_and_split didn't have a name. So I added the name, but didn't
account for the iterator and thus we have the same name appearing multiple
times.
Anyway, this just adds the '*' prefix so that the name is considered for
debugging purposes only.
Pushing as obvious.
Jeff
ps. Yes, you could argue that I should have written the ChangeLog when I wrote
the patch.
gcc/
* config/riscv/riscv.md (seq_sne_qi): Mark name for debugging purposes
only.
Iain Sandoe [Tue, 23 Jun 2026 09:53:18 +0000 (10:53 +0100)]
Objective-C++: Parallelize the tests.
Although this is a small testsuite, waiting for it to complete
when debugging Objective-C issues is unproductive. Keep the number
of parallel tests to 6, as per Objective-C.
gcc/objcp/ChangeLog:
* Make-lang.in: Test in parallel with up to 6 instances.
rs6000: Builtins for ECC cryptography instructions [RFC02669]
This patch implements builtin support for 21 new ECC (Elliptic Curve
Cryptography) acceleration instructions defined in RFC02669 for Power
future ISA. These instructions are designed to accelerate P-256 and
P-384 elliptic curve operations on POWER future processors. These
instructions may or may not be supported in a future processor. Note,
the names of the builtins may change in future.
The instructions are organized into five categories:
1. Multiply-Multiply operations (3 instructions):
- xxmulmul: Multiply-multiply with scaling (scale values 0-6)
- xxmulmulhiadd: Multiply-multiply with high add and accumulator
- xxmulmulloadd: Multiply-multiply low add with accumulator
2. Scaled Multiply-Sum operations (3 instructions):
- xxssumudm: Scaled sum unsigned doubleword modulo
- xxssumudmc: Scaled sum unsigned doubleword modulo carry
- xxssumudmcext: Extended version with separate accumulator
(prefixed)
5. Rebase operations (7 instructions):
- xsrebase2t1uqm through xsrebase2t4uqm: 2-operand rebase
- xsrebase3t1uqm through xsrebase3t3uqm: 3-operand rebase with
accumulator
All instructions operate on 128-bit unsigned integers
(vector unsigned __int128) and use VSX registers.
The xxssumudmcext instruction is a prefixed instruction (8 bytes),
while all others use the standard XX3 form (4 bytes).
Milan Tripkovic [Thu, 25 Jun 2026 13:34:14 +0000 (07:34 -0600)]
[RISC-V][PR target/123884] Generate more Zbs instructions for RISC-V
So between Milan's work and my own realization earlier this week, we can
finally get resolution on pr123884 and pr106585.
The core issue is for what appear to be natural looking single bit
manipulations we often struggle to generate the bset, bclr or binv on riscv64.
A few items get in the way. First, rv64 (of course) promotes sub-word objects
(ie ints) into word sized objects. Second, we do have *some* instructions that
work on sub-objects (such as shifts which sign extend out to 64 bits). Third,
a 32-bit object on rv64 is supposed to be sign extended out to 64 bits when it
"escapes" or gets used in a comparison. Finally, the Zbs instructions do not
have forms which sign extend out to 64 bits if the SI sign bit is changed.
Consider this reduced fragment from x264:
int x264_macroblock_encode_p8x8(int dst, int a)
{
dst &= ~(1 << a);
return dst;
}
That seems almost tailor made for bclr. Except for the possibility that we're
clearing bit 31. THe RTL above would clear bits 31..63. bclr just clears one
bit.
ext-dce comes along and realizes that insn 13 is redundant and removes it. But
we still have the problem that the RTL would clear bits 31..63 if shift count
in (reg:DI 138) is 31 and thus trying to combine the result and generate a bclr
is wrong.
We had the idea that we could follow the bclr with a sign extension. That
works for this testcase, but is wrong in general.
The insight from earlier this week is the semantics of bclr+sext work when
(reg:DI 137) has 33 or more sign bit copies. In that limited, but common, case
the semantics of bclr+sext match the RTL exactly. Just as important the output
is 2 insns, so we can model it as a simple define_split rather than a
define_insn_and_split.
So I've adjusted Milan's patch to check the number of sign bit copies in the
object where we want to clear a single bit. If the number of sign bit copies
is 33 or more, then we allow the splitter to trigger. The net is we get:
This has been bootstrapped and regression tested on both the c920 (where it
should do nothing, no Zbs extension) and the K3 (where I turn on Zbs by
default). It's also been regression tested on riscv32-elf and riscv64-elf.
I'll obviously wait for pre-commit CI to run before moving forward. But I
think we've finally got this issue nailed down.
PR target/123884
PR target/106585
gcc/
* config/riscv/bitmanip.md: Add new splits for single bit manipulation
cases followed by a sign extension.
gcc/testsuite
* gcc.target/riscv/pr123884-a.c: New test.
* gcc.target/riscv/pr123884-b.c: New test.
* gcc.target/riscv/pr123884-c.c: New test.
Co-authored-by: Jeff Law <jeffrey.law@oss.qualcomm.com>
Jeff Law [Thu, 25 Jun 2026 13:24:49 +0000 (07:24 -0600)]
[RISC-V][PR target/124019] Add pattern to improve QI comparisons on RISC-V
So after much head-banging from Daniel and myself I think it's time to
acknowledge this issue isn't great for solving in match.pd.
Depending on the target's properties it may be advantageous to handle
generating code for this kind of idiom in different ways:
It may be better to mask off the irrelevant bits first, then compare to an
adjusted constant. It may also be better to do a simpler direct approach of
shifting, the comparing to the constant. Worse yet, the desired approach may
vary for a given architecture depending on the type of the object (it's related
to what bits need to be masked off and the constant we have to generate).
While I was able to convince myself we could canonicalize in match.pd, then
recover the regressed cases with target work, it'd be a lot of target testing &
hacking. The effort is likely equivalent to leaving match.pd alone and
adjusting the target patterns to generate good code for the poorly handled
cases. ie, in both scenarios we're likely doing significant target work.
Some quick evaluation against 502.gcc showed this never shows up in that
benchmark. However, it does show up in a trunk bootstrap on RISC-V (given an
earlier version with a code generation bug triggered a bootstrap failure).
While it's far from wide coverage, I suspect if we were to do wider testing it
rarely hits.
So I'm taking the conservative approach here. Leave match.pd alone, add a
pattern to the RISC-V port to capture this oddball case, then move on.
Regression tested on riscv32-elf and riscv64-elf and bootstrap and regression
tested on the c920 and K3 designs. Waiting on pre-commit CI before moving
forward.
PR target/124019
gcc/
* config/riscv/riscv.md (seq_sne_qi): New define_insn_and_split.
gcc/testsuite
* gcc.target/riscv/pr124019.c: New test.
Co-authored-by: Daniel Barboza <daniel.barboza@oss.qualcomm.com>