arm: Improve immediate generation for thumb-1 with -mpurecode [PR96769]
This patch moves the move-immediate splitter after the regular ones so
that it has lower precedence, and updates its constraints.
For
int f3 (void) { return 0x11000000; }
int f3_2 (void) { return 0x12345678; }
we now generate:
* with -O2 -mcpu=cortex-m0 -mpure-code:
f3:
movs r0, #136
lsls r0, r0, #21
bx lr
f3_2:
movs r0, #18
lsls r0, r0, #8
adds r0, r0, #52
lsls r0, r0, #8
adds r0, r0, #86
lsls r0, r0, #8
adds r0, r0, #121
bx lr
* with -O2 -mcpu=cortex-m23 -mpure-code:
f3:
movs r0, #136
lsls r0, r0, #21
bx lr
f3_2:
movw r0, #22136
movt r0, 4660
bx lr
2020-09-04 Christophe Lyon <christophe.lyon@linaro.org>
PR target/96769
gcc/
* config/arm/thumb1.md: Move movsi splitter for
arm_disable_literal_pool after the other movsi splitters.
gcc/testsuite/
* gcc.target/arm/pure-code/pr96769.c: New test.