]> gcc.gnu.org Git - gcc.git/commit
RISC-V: bitmanip: improve constant-loading for (1ULL << 31) in DImode
authorPhilipp Tomsich <philipp.tomsich@vrull.eu>
Mon, 29 Jun 2020 13:15:10 +0000 (15:15 +0200)
committerPhilipp Tomsich <philipp.tomsich@vrull.eu>
Thu, 2 Jun 2022 19:23:27 +0000 (21:23 +0200)
commit4e72ccad80d69a76d149fba59603b8173fffe8fe
treeb193e4ea2c8998dcad4abac4439fd2d6f0200731
parentd19b4342c19e5a7fd84888aa06ebc106438d0c46
RISC-V: bitmanip: improve constant-loading for (1ULL << 31) in DImode

The SINGLE_BIT_MASK_OPERAND() is overly restrictive, triggering for
bits above 31 only (to side-step any issues with the negative SImode
value 0x80000000/(-1ull << 31)/(1 << 31)).  This moves the special
handling of this SImode value (i.e. the check for (-1ull << 31) to
riscv.cc and relaxes the SINGLE_BIT_MASK_OPERAND() test.

With this, the code-generation for loading (1ULL << 31) from:
li a0,1
slli a0,a0,31
to:
bseti a0,zero,31

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_build_integer_1): Rewrite value as
(-1 << 31) for the single-bit case, when operating on (1 << 31)
in SImode.
* config/riscv/riscv.h (SINGLE_BIT_MASK_OPERAND): Allow for
any single-bit value, moving the special case for (1 << 31) to
riscv_build_integer_1 (in riscv.c).

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
gcc/config/riscv/riscv.cc
gcc/config/riscv/riscv.h
This page took 0.052861 seconds and 5 git commands to generate.