https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122415
Bug ID: 122415
Summary: pru: Inefficient addressing mode emitted with
immediate addresses
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: dimitar at gcc dot gnu.org
Target Milestone: ---
Using immediate addresses (common for memory-mapped I/O) generates inefficient
code for pru-unknown-elf. Example:
$ cat test.c
void test(void)
{
(*(unsigned *)0x11223344) = 1;
(*(unsigned *)0x11223364) = 2;
}
$ pru-gcc -S -O2 test.c -o test.s
$ cat test.s
test:
ldi32 r0, 287454020
ldi r1, 1
sbbo r1.b0, r0, 0, 4
add r0, r0, 32
ldi r1, 2
sbbo r1.b0, r0, 0, 4
ret
The "add" is not needed, and the second store should have used a constant
offset:
sbbo r1.b0, r0, 32, 4