[DAGCombiner] Recognize another rotation idiom
authorAdam Nemet <anemet@apple.com>
Fri, 7 Mar 2014 23:56:28 +0000 (23:56 +0000)
committerAdam Nemet <anemet@apple.com>
Fri, 7 Mar 2014 23:56:28 +0000 (23:56 +0000)
commit316d3e308530cfa1abdf3e75bbf24640b1beb3c3
treec8210be923c8566448b2ecc6510f9a295d37f3d4
parent622f350944ce4cba63f58754ef4f83d0c16f0338
[DAGCombiner] Recognize another rotation idiom

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203315 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/rotate4.ll [new file with mode: 0644]