This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/43471] Unnecessary reload of asm "m" operand address
- From: "mirq-gccboogs at rere dot qmqm dot pl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Mar 2010 05:43:34 -0000
- Subject: [Bug rtl-optimization/43471] Unnecessary reload of asm "m" operand address
- References: <bug-43471-18939@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from mirq-gccboogs at rere dot qmqm dot pl 2010-03-23 05:43 -------
Hmm. I must have missed something while cutting down the test case as this
simple example works now...
Here is bigger test that might be related:
code:
struct a {
int f1, f2;
};
struct b {
unsigned f3;
struct a s1, s2;
};
register struct b *const reg asm("r4");
static int diff(struct a *ptr)
{
return ptr->f1 > ptr->f2 ? ptr->f1 - ptr->f2 : 100 - ptr->f1;
}
void c(void);
void d(void)
{
while (diff(®->s2))
c();
}
compiles to:
d:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r5, lr}
mov r5, r4
b .L2
.L5:
bl c
.L2:
ldr r3, [r5, #12]
ldr r1, [r5, #16]
rsb r2, r3, #100
cmp r3, r1
it gt
subgt r2, r3, r1
cmp r2, #0
bne .L5
pop {r5, pc}
with:
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -O3 -S a.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43471