aboutsummaryrefslogtreecommitdiff
path: root/libcpp/directives.c
diff options
context:
space:
mode:
authorRichard Earnshaw <rearnsha@arm.com>2019-10-31 16:07:09 +0000
committerRichard Earnshaw <rearnsha@gcc.gnu.org>2019-10-31 16:07:09 +0000
commita2f9e6e3d98efadc420e0b8327a3f45c3f65689b (patch)
treef67c73040697b238524982807f04a014984b094e /libcpp/directives.c
parentd84b9ad53fed75590c3ebc6e38bd49db3b201128 (diff)
downloadgcc-a2f9e6e3d98efadc420e0b8327a3f45c3f65689b.zip
gcc-a2f9e6e3d98efadc420e0b8327a3f45c3f65689b.tar.gz
gcc-a2f9e6e3d98efadc420e0b8327a3f45c3f65689b.tar.bz2
[arm] Avoid using negative offsets for 'immediate' addresses when compiling for Thumb2
Thumb2 code now uses the Arm implementation of legitimize_address. That code has a case to handle addresses that are absolute CONST_INT values, which is a common use case in deeply embedded targets (eg: void *p = (void*)0x12345678). Since thumb has very limited negative offsets from a constant, we want to avoid forming a CSE base that will then be used with a negative value. This was reported upstream originally in https://gcc.gnu.org/ml/gcc-help/2019-10/msg00122.html For example, void test1(void) { volatile uint32_t * const p = (uint32_t *) 0x43fe1800; p[3] = 1; p[4] = 2; p[1] = 3; p[7] = 4; p[0] = 6; } With the new code, instead of ldr r3, .L2 subw r2, r3, #2035 movs r1, #1 str r1, [r2] subw r2, r3, #2031 movs r1, #2 str r1, [r2] subw r2, r3, #2043 movs r1, #3 str r1, [r2] subw r2, r3, #2019 movs r1, #4 subw r3, r3, #2047 str r1, [r2] movs r2, #6 str r2, [r3] bx lr We now get ldr r3, .L2 movs r2, #1 str r2, [r3, #2060] movs r2, #2 str r2, [r3, #2064] movs r2, #3 str r2, [r3, #2052] movs r2, #4 str r2, [r3, #2076] movs r2, #6 str r2, [r3, #2048] bx lr * config/arm/arm.c (arm_legitimize_address): Don't form negative offsets from a CONST_INT address when TARGET_THUMB2. From-SVN: r277677
Diffstat (limited to 'libcpp/directives.c')
0 files changed, 0 insertions, 0 deletions