Avoid emitting multiple stores to consecutive addresses
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro GCC |
Triaged
|
Low
|
Unassigned |
Bug Description
The following code, inspired from hot code in DENbecnch mp2decoddata1/
The code was compiled with Linaro GCC 4.6-2011.03-dev1 with flags -mcpu=cortex-a9 -mtune=cortex-a9 -mthumb -S -c -O3
foo:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
ldrsh r3, [r0, #0]
lsls r3, r3, #3
uxth r3, r3
strh r3, [r0, #14] @ movhi
strh r3, [r0, #12] @ movhi
strh r3, [r0, #10] @ movhi
strh r3, [r0, #8] @ movhi
strh r3, [r0, #6] @ movhi
strh r3, [r0, #4] @ movhi
strh r3, [r0, #2] @ movhi
strh r3, [r0, #0] @ movhi
bx lr
the program:
void
foo (short *arr)
{
arr[0] = arr[1] = arr[2] = arr[3] = arr[4] = arr[5] = arr[6] = arr[7] =
(short) arr[0] << 3;
}
summary: |
- Avoid emitting consecutive stores + Avoid emitting stores to consecutive addresses |
summary: |
- Avoid emitting stores to consecutive addresses + Avoid emitting multiply stores to consecutive addresses |
tags: | added: size speed task |
summary: |
- Avoid emitting multiply stores to consecutive addresses + Avoid emitting multiple stores to consecutive addresses |
Changed in gcc-linaro: | |
status: | New → Triaged |
importance: | Undecided → Low |
Note that ARMv7 supports unaligned access so a inline block set using 32 bit stores might be better than a call to memset().