[llvm-commits] [PATCH] Smarter unaligned stores of constant values.
Lang Hames
lhames at gmail.com
Fri Nov 4 16:33:29 PDT 2011
Postscript: Output with patch is exactly what you'd expect:
_foo: @ @foo
@ BB#0: @ %entry
mvn r1, #0
strb r1, [r0, #3]
strb r1, [r0, #2]
strb r1, [r0, #1]
strb r1, [r0]
mov pc, lr
Cheers,
Lang.
On Fri, Nov 4, 2011 at 4:30 PM, Lang Hames <lhames at gmail.com> wrote:
> Encountered the following when I tried outputting an unaligned store of -1
> on ARM:
>
> _foo: @ @foo
> @ BB#0: @ %entry
> mov r1, #255
> mov r2, #255
> strb r1, [r0, #3]
> orr r1, r2, #65280
> strb r1, [r0, #2]
> mvn r1, #-16777216
> strb r1, [r0, #1]
> mvn r1, #0
> strb r1, [r0]
> mov pc, lr
>
> The strange constants are coming out of the legalizer, which tries to
> legalize the unaligned store by repeatedly splitting it into two half-sized
> stores, and shifting the constant around. This results in several new and
> confusing constants being introduced.
>
> This patch checks for constant value stores, and if the two halves of the
> constant have the same bit-pattern it avoids creating new constants.
>
> Could someone who's more familiar with the legalizer take a look and let
> me know if this is Ok to commit? (I'm also planning to enable unaligned
> stores on supported subtargets, but that's a different issue)
>
> Cheers,
> Lang.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111104/1f59633e/attachment.html>
More information about the llvm-commits
mailing list