]> git.ipfire.org Git - thirdparty/gcc.git/commit
[PATCH][RISC-V][PR target/70557] Improve storing 0 to memory on rv32
authorSiarhei Volkau <lis8215@gmail.com>
Thu, 22 May 2025 14:52:17 +0000 (08:52 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Thu, 22 May 2025 14:53:04 +0000 (08:53 -0600)
commitc77085970ec98916e12e079a5a9d9530b86aae71
tree2e77d0722b47f26a69204b4062f75afd98a29c71
parentbb7b6d9ad7f89ebc68c9d1eff16bec95f6e81cd9
[PATCH][RISC-V][PR target/70557] Improve storing 0 to memory on rv32

Patch is originally from Siarhei Volkau <lis8215@gmail.com>.

RISC-V has a zero register (x0) which we can use to store zero into memory
without loading the constant into a distinct register. Adjust the constraints
of the 32-bit movdi_32bit pattern to recognize that we can store 0.0 into
memory using x0 as the source register.

This patch only affects RISC-V. It has been regression tested on riscv64-elf.
Jeff has also tested this in his tester (riscv64-elf and riscv32-elf) with no
regressions.

PR target/70557
gcc/
* config/riscv/riscv.md (movdi_32bit): Add "J" constraint to allow storing 0
directly to memory.
gcc/config/riscv/riscv.md