[Bug rtl-optimization/43471] Unnecessary reload of asm m operand address
--- Comment #6 from kkojima at gcc dot gnu dot org 2010-04-15 21:51 --- Subject: Bug 43471 Author: kkojima Date: Thu Apr 15 21:51:14 2010 New Revision: 158393 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=158393 Log: PR target/43471 * config/sh/sh.c (sh_legitimize_reload_address): Use MAYBE_BASE_REGISTER_RTX_P instead of BASE_REGISTER_RTX_P. Remove a unneeded check for offset_base. Modified: trunk/gcc/ChangeLog trunk/gcc/config/sh/sh.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43471
[Bug rtl-optimization/43471] Unnecessary reload of asm m operand address
--- Comment #4 from rearnsha at gcc dot gnu dot org 2010-03-23 13:18 --- This second example clearly has nothing to do with the stated bug report summary line (there's no m constraint anywhere in the test case), and you make no attempt to explain what you think is wrong. Please see the pages on reporting bugs and make sure you provide sufficient details for a developer to both *understand* and *replicate* the problem you are having. -- rearnsha at gcc dot gnu dot org changed: What|Removed |Added Status|WAITING |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43471
[Bug rtl-optimization/43471] Unnecessary reload of asm m operand address
--- Comment #5 from mirq-gccboogs at rere dot qmqm dot pl 2010-03-23 14:04 --- The problem is that gcc sometimes emits instructions that are copying the global r4 (even when it's marked as const) into temporary. Originally I thought that the simplies case was this asm statememt, but it looks like it depends on having adress of a structure field taken as a parameter for a function that's later inlined. I'll file a new report with the second example and this explanation. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43471
[Bug rtl-optimization/43471] Unnecessary reload of asm m operand address
--- Comment #1 from ramana at gcc dot gnu dot org 2010-03-22 23:04 --- Are you using any optimization at all ? With -O2 I see just a bx lr for Thumb2, Thumb1 and ARM. a: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. bx lr What flags are you using ? -- ramana at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |WAITING http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43471
[Bug rtl-optimization/43471] Unnecessary reload of asm m operand address
--- 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(reg-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
[Bug rtl-optimization/43471] Unnecessary reload of asm m operand address
--- Comment #3 from mirq-gccboogs at rere dot qmqm dot pl 2010-03-23 05:52 --- I checked some more variants of the simple asm() example - looks like I mixed up compiler output files when preparing that one. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43471