[DAGCombiner] Distribute TRUNC through AND in rotation amount
authorAdam Nemet <anemet@apple.com>
Fri, 7 Mar 2014 23:56:30 +0000 (23:56 +0000)
committerAdam Nemet <anemet@apple.com>
Fri, 7 Mar 2014 23:56:30 +0000 (23:56 +0000)
commitd07494f1022c01a51abaad6802900fa3e6068a60
tree309a4791cca6403cd198e4e6c385a4f2026da93d
parent316d3e308530cfa1abdf3e75bbf24640b1beb3c3
[DAGCombiner] Distribute TRUNC through AND in rotation amount

This is already done for shifts.  Allow it for rotations as well. E.g.:

   (rotl:i32 x, (trunc (and y, 31))) -> (rotl:i32 x, (and (trunc y), 31))

Use the newly factored-out distributeTruncateThroughAnd.

With this patch and some X86.td tweaks we should be able to remove redundant
masking of the rotation amount like in the example above.  HW implicitly
performs this masking.

The testcase will be added as part of the X86 patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203316 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp