]> granicus.if.org Git - llvm/commit
DAGCombiner: fold (xor (shl 1, x), -1) -> (rotl ~1, x)
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 18 Mar 2015 00:03:36 +0000 (00:03 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 18 Mar 2015 00:03:36 +0000 (00:03 +0000)
commit8f01b96d93b557de0c860be4f5512bde3c31ed64
treebf7db0b8eeec3c01181eb0db9312b80e41a0fa1f
parent7605cdd6e4926a0f0f15ebb81e21f41b8a378488
DAGCombiner: fold (xor (shl 1, x), -1) -> (rotl ~1, x)

Targets which provide a rotate make it possible to replace a sequence of
(XOR (SHL 1, x), -1) with (ROTL ~1, x).  This saves an instruction on
architectures like X86 and POWER(64).

Differential Revision: http://reviews.llvm.org/D8350

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