[llvm-commits] patch: go crazy, compute bits for an entire add instruction

Nick Lewycky nlewycky at google.com
Tue Jul 12 15:46:18 PDT 2011


Ping!

Let's start with one piece, what if we just added the calls to
ComputeMaskedBits from InstructionSimplify?

Nick

On 5 July 2011 23:26, Nick Lewycky <nicholas at mxc.ca> wrote:

> This is a patch to ComputeMaskedBits primarily, though it's hard to observe
> the effect in a small testcase without also adding more smarts someplace
> else, which this patch does for instsimplify.
>
> When faced with an add instruction, ComputeMaskedBits will look at the
> leading bits and the trailing bits to attempt to establish a pattern -- and
> it does a decent job. However, there may be bits we could calculate in the
> middle, which we currently don't. Go wild, try to compute every bit in an
> add.
>
> This requires a new loop that is O(n) in the number of bits, which I think
> is sensible enough given that most values will be either 32 or 64 bits,
> making this effectively a constant-time operation.
>
> Please review!
>
> If this patch is okay, I'm going to do it for sub as well obviously, but
> eventually for multiply. Currently if we transform some things to mul (using
> mul as a bit-spreading operation, basically) we lose optimization power
> because we can no longer analyze it as well as the equivalent series of
> shifts with add's/or's.
>
> Nick
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110712/ea94924e/attachment.html>


More information about the llvm-commits mailing list