summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/clz.ll
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-12-14 02:13:44 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-12-14 02:13:44 +0000
commite9fbc3f014c82ebed8cb1fad28ae48811272c225 (patch)
treec5be4347306adad5128c25e33cb763cbf56e6380 /llvm/test/CodeGen/X86/clz.ll
parentd4d8c3c71785f89f4970b41c0c27f8f553099382 (diff)
downloadbcm5719-llvm-e9fbc3f014c82ebed8cb1fad28ae48811272c225.tar.gz
bcm5719-llvm-e9fbc3f014c82ebed8cb1fad28ae48811272c225.zip
Implement ctlz and cttz with bsr and bsf.
llvm-svn: 45024
Diffstat (limited to 'llvm/test/CodeGen/X86/clz.ll')
-rw-r--r--llvm/test/CodeGen/X86/clz.ll16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/clz.ll b/llvm/test/CodeGen/X86/clz.ll
new file mode 100644
index 00000000000..0505529cc48
--- /dev/null
+++ b/llvm/test/CodeGen/X86/clz.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -march=x86 | grep bsr
+; RUN: llvm-as < %s | llc -march=x86 | grep bsf
+
+define i32 @t1(i32 %x) nounwind {
+ %tmp = tail call i32 @llvm.ctlz.i32( i32 %x )
+ ret i32 %tmp
+}
+
+declare i32 @llvm.ctlz.i32(i32) nounwind readnone
+
+define i32 @t2(i32 %x) nounwind {
+ %tmp = tail call i32 @llvm.cttz.i32( i32 %x )
+ ret i32 %tmp
+}
+
+declare i32 @llvm.cttz.i32(i32) nounwind readnone
OpenPOWER on IntegriCloud