[thumb2, size] allocate local variables with fewer instructions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro GCC |
New
|
Undecided
|
Unassigned |
Bug Description
GCC PR40657 is about this kind of problem, and was fixed. However, we can find similar problem when build toolchain with hard float.
Compiled test case like this,
$ arm-none-
fno-common -c -mthumb -mcpu=cortex-a9 -mfpu=neon -Os -fno-common -mfloat-abi=hard -S extral_sp_sub.c,
GCC generates code like this,
00000000 <diffmeasure>:
0: b570 push {r4, r5, r6, lr}
2: 2400 movs r4, #0
4: ed2d 8b04 vpush {d8-d9}
8: b082 sub sp, #8
...
b0: b002 add sp, #8
b2: ecbd 8b04 vpop {d8-d9}
b6: bd70 pop {r4, r5, r6, pc}
This code sequence can be improved like this,
push {r2, r3, r4, r5, lr}
movs r4, #0
vpush {d8-d9}
...
vpop {d8-d9}
pop {r2, r3, r4, r5, pc}
so, sub and add instruction to sp can be removed.
tags: | added: size task |