[DAGCombiner] Recognize another rotation idiom

Adam Nemet anemet at apple.com
Mon Mar 3 12:25:20 PST 2014


Sorry, forgot to copy Richard.

On Mar 3, 2014, at 12:19 PM, Adam Nemet <anemet at apple.com> wrote:

> 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
> 
> <0001-DAGCombiner-Slightly-improve-readability-of-matchRot.patch><0002-DAGCombiner-Recognize-another-rotation-idiom.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- 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/185dd059/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/185dd059/attachment-0001.obj>


More information about the llvm-commits mailing list