On 9/2/24 2:01 PM, Raphael Moreira Zinsly wrote:
Improve handling of constants where its upper and lower 32-bit
halves are the same and have negative values.
e.g. for:
unsigned long f (void) { return 0xf0f0f0f0f0f0f0f0UL; }
Without the patch:
li a0,-252645376
addi a0,a0,240
li a5,-252645376
addi a5,a5,241
slli a5,a5,32
add a0,a5,a0
With the patch:
li a5,252645376
addi a5,a5,-241
slli a0,a5,32
add a0,a0,a5
xori a0,a0,-1
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_split_integer_cost): Adjust the
cost of negative repeating constants.
(riscv_split_integer): Handle negative repeating constants.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/synthesis-11.c: New test.
Thanks. I fixed one whitespace nit caught by the pre-commit tester and
pushed this to the trunk.
Jeff