summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/clz.ll
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-05-24 01:48:22 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-05-24 01:48:22 +0000
commit88f9137fd770e4a5a1586e696cbb3eeb869408e8 (patch)
tree932b3e4c6f8e5e1eb5c5e5f755fb2ac93301673f /llvm/test/CodeGen/X86/clz.ll
parenta3b4203cbcdb3862ea3cc1ba94499e148c4c9b46 (diff)
downloadbcm5719-llvm-88f9137fd770e4a5a1586e696cbb3eeb869408e8.tar.gz
bcm5719-llvm-88f9137fd770e4a5a1586e696cbb3eeb869408e8.zip
- Teach SelectionDAG::isKnownNeverZero to return true (op x, c) when c is
non-zero. - Teach X86 cmov optimization to eliminate the cmov from ctlz, cttz extension when the source of X86ISD::BSR / X86ISD::BSF is proven to be non-zero. rdar://9490949 llvm-svn: 131948
Diffstat (limited to 'llvm/test/CodeGen/X86/clz.ll')
-rw-r--r--llvm/test/CodeGen/X86/clz.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/clz.ll b/llvm/test/CodeGen/X86/clz.ll
index 623ac75b529..d76fab4123b 100644
--- a/llvm/test/CodeGen/X86/clz.ll
+++ b/llvm/test/CodeGen/X86/clz.ll
@@ -31,3 +31,18 @@ entry:
}
declare i16 @llvm.ctlz.i16(i16) nounwind readnone
+
+; Don't generate the cmovne when the source is known non-zero (and bsr would
+; not set ZF).
+; rdar://9490949
+
+define i32 @t4(i32 %n) nounwind {
+entry:
+; CHECK: t4:
+; CHECK: bsrl
+; CHECK-NOT: cmov
+; CHECK: ret
+ %or = or i32 %n, 1
+ %tmp1 = tail call i32 @llvm.ctlz.i32(i32 %or)
+ ret i32 %tmp1
+}
OpenPOWER on IntegriCloud