https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121213
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jeff Law <[email protected]>: https://gcc.gnu.org/g:b790606e492d33e0cdb8159e38cb148d3526071b commit r16-3549-gb790606e492d33e0cdb8159e38cb148d3526071b Author: Austin Law <[email protected]> Date: Wed Sep 3 10:41:17 2025 -0600 [RISC-V][PR target/121213] Avoid unnecessary sign extension in amoswap sequence This is Austin's work to remove the redundant sign extension seen in pr121213. -- The .w form of amoswap will sign extend its result from 32 to 64 bits, thus any explicit sign extension insn doing the same is redundant. This uses Jivan's approach of allocating a DI temporary for an extended result and using a promoted subreg extraction to get that result into the final destination. Tested with no regressions on riscv32-elf and riscv64-elf and bootstrapped on the BPI and pioneer systems. PR target/121213 gcc/ * config/riscv/sync.md (amo_atomic_exchange_extended<mode>): Separate insn with sign extension for 64 bit targets. gcc/testsuite * gcc.target/riscv/amo/pr121213.c: Remove xfail.
