[DAGCombiner] Use computeKnownBits to match rotate patterns that have had their amoun...
authorCraig Topper <craig.topper@intel.com>
Mon, 21 May 2018 21:09:18 +0000 (21:09 +0000)
committerCraig Topper <craig.topper@intel.com>
Mon, 21 May 2018 21:09:18 +0000 (21:09 +0000)
commit25444c852a329d98015d697dceeaaa9bfa1e51f6
treee2ed95883c88278d4ead31056531a7cf0c649cc6
parentec50effbd65ebf433bafead6d1e0b015855ea521
[DAGCombiner] Use computeKnownBits to match rotate patterns that have had their amount masking modified by simplifyDemandedBits

SimplifyDemandedBits can remove bits from the masks for the shift amounts we need to see to detect rotates.

This patch uses zeroes from computeKnownBits to fill in some of these mask bits to make the match work.

As currently written this calls computeKnownBits even when the mask hasn't been simplified because it made the code simpler. If we're worried about compile time performance we can improve this.

I know we're talking about making a rotate intrinsic, but hopefully we can go ahead and do this change and just make sure the rotate intrinsic also handles it.

Differential Revision: https://reviews.llvm.org/D47116

llvm-svn: 332895
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/combine-rotates.ll
llvm/test/CodeGen/X86/rotate4.ll