[LLVMbugs] [Bug 9370] [arm] unnecessary MOVW not optimized
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Mar 2 11:05:34 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=9370
skoe <skoe at directbox.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |
--- Comment #2 from skoe <skoe at directbox.com> 2011-03-02 13:05:34 CST ---
Please have a closer look again:
movw r0, #32796 @ r0 = 0x0000801c
mov.w r1, #-1
movt r0, #20480 @ r0 = 0x5000801c
str r1, [r0]
movw r0, #32796 @ r0 = 0x0000801c
movt r0, #20482 @ r0 = 0x5002801c
str r1, [r0]
If you remove the second MOVW you have exactly the same result, because the
lower 16 bits of r0 were correct already:
movw r0, #32796 @ r0 = 0x0000801c
mov.w r1, #-1
movt r0, #20480 @ r0 = 0x5000801c
str r1, [r0]
movt r0, #20482 @ r0 = 0x5002801c
str r1, [r0]
Remember:
MOVW: Rd[15:0] := imm16, Rd[31:16] = 0, imm16 range 0-65535
MOVT: Rd[31:16] := imm16, Rd[15:0] unaffected, imm16 range 0-65535
The optimize could check if the lower 16 bits have the correct value already
and replace the upper 16 bits only in this case.
I know, it's only one instruction difference. But if it is in an often called
interrupt handler it makes a different already :)
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list