[DAGCombiner] Recognize another rotation idiom

Adam Nemet anemet at apple.com
Mon Mar 3 12:19:42 PST 2014


Hi Richard,

How are you?  It’s been a long time ;-).

I thought you’d be the best to review these patches since I am modifying the rotation infrastructure you added recently.  Thanks in advance!

This is the new idiom:

  x<<(y&31) | x>>((0-y)&31)

which is recognized as:

  x ROTL (y&31)

The change refines matchRotateSub.  In
Neg & (OpSize - 1) == (OpSize - Pos) & (OpSize - 1), if Pos is
Pos' & (OpSize - 1) we can just use Pos' instead of Pos.

There are two patches attached.  I cover the actual functional change in the second.  In the first I tried to fix two minor issues that confused me somewhat while trying to understand matchRotateSub:

1. Slightly change the wording in the function comment. Originally, it can be
understood as if we turned the input into two subsequent rotates.

2. Better connect the comment which talks about Mask and the code which used
LoBits.  Renamed variable to MaskLoBits.

Thanks,
Adam

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-DAGCombiner-Slightly-improve-readability-of-matchRot.patch
Type: application/octet-stream
Size: 2244 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140303/4f0a9b2c/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-DAGCombiner-Recognize-another-rotation-idiom.patch
Type: application/octet-stream
Size: 3868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140303/4f0a9b2c/attachment-0001.obj>


More information about the llvm-commits mailing list