[PATCH] DAGCombiner: Add another rotate pattern.

David Majnemer david.majnemer at gmail.com
Thu Jul 18 05:50:37 PDT 2013


On Thu, Jul 18, 2013 at 4:40 AM, Jay Foad <jay.foad at gmail.com> wrote:

> > +    // fold (or (shl x, (*ext y)), (srl x, (*ext (and (sub 32, y),
> 31)))) ->
> > +    //   (rotl x, y)
> > +    // fold (or (shl x, (*ext y)), (srl x, (*ext (and (sub 32, y),
> 31)))) ->
> > +    //   (rotr x, (sub 32, y))
>
> "and (sub 32, y), 31" should be "and (sub 0, y), 31". There are four
> occurrences of this in the whole patch.
>

Sorry about that, the comment is fixed in the attached patch.


>
> > +          if (SUBC->getAPIntValue() == 0 &&
> > +              ANDC->getAPIntValue() == OpSizeInBits - 1 &&
> > +              RExtOp0.getOperand(0).getOperand(1) == LExtOp0)
>
> Do you need an explicit check that OpSizeInBits is a power of two?
>

Good catch, we do indeed need such a check, fixed in the attached patch.


>
> Jay.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130718/56969df2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rotatev2.diff
Type: application/octet-stream
Size: 5017 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130718/56969df2/attachment.obj>


More information about the llvm-commits mailing list