summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-06-16 06:11:35 +0000
committerChris Lattner <sabre@nondot.org>2009-06-16 06:11:35 +0000
commitaba55a69b159048a9c698dd4a81e520ecfa03df6 (patch)
treed90bd9a7daafcd31128b2fc9c1354df464329d22
parent06310bf1781b135a0acc519c4d072377987e3c0f (diff)
downloadbcm5719-llvm-aba55a69b159048a9c698dd4a81e520ecfa03df6.tar.gz
bcm5719-llvm-aba55a69b159048a9c698dd4a81e520ecfa03df6.zip
I think instcombine should unconditionally do this xform.
llvm-svn: 73471
-rw-r--r--llvm/lib/Target/X86/README.txt19
1 files changed, 17 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/README.txt b/llvm/lib/Target/X86/README.txt
index 3796aac57cb..767771f082a 100644
--- a/llvm/lib/Target/X86/README.txt
+++ b/llvm/lib/Target/X86/README.txt
@@ -1858,8 +1858,23 @@ Ideal output:
setne %al
ret
-We could do this transformation in instcombine, but it's only clearly
-beneficial on platforms with a test instruction.
+This should definitely be done in instcombine, canonicalizing the range
+condition into a != condition. We get this IR:
+
+define i32 @a(i32 %x) nounwind readnone {
+entry:
+ %0 = and i32 %x, 127 ; <i32> [#uses=1]
+ %1 = icmp ugt i32 %0, 31 ; <i1> [#uses=1]
+ %2 = zext i1 %1 to i32 ; <i32> [#uses=1]
+ ret i32 %2
+}
+
+Instcombine prefers to strength reduce relational comparisons to equality
+comparisons when possible, this should be another case of that. This could
+be handled pretty easily in InstCombiner::visitICmpInstWithInstAndIntCst, but it
+looks like InstCombiner::visitICmpInstWithInstAndIntCst should really already
+be redesigned to use ComputeMaskedBits and friends.
+
//===---------------------------------------------------------------------===//
Testcase:
OpenPOWER on IntegriCloud