[PATCH 1/3] RISC-V: Improve codegen for negative repeating large constants
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.
Loading
Please register or sign in to comment