diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-12-24 11:46:10 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-12-24 11:46:10 +0000 |
commit | 38ce24455df1800496d11f6d809c56a8f1feb307 (patch) | |
tree | f43c5f6dcec2f682a1619352652913583e56c978 /llvm/test/CodeGen/X86/clz.ll | |
parent | 103ca80f59cb2c8edf62150185e507d70420e441 (diff) | |
download | bcm5719-llvm-38ce24455df1800496d11f6d809c56a8f1feb307.tar.gz bcm5719-llvm-38ce24455df1800496d11f6d809c56a8f1feb307.zip |
Add systematic testing for cttz as well, and fix the bug I spotted by
inspection earlier.
llvm-svn: 147250
Diffstat (limited to 'llvm/test/CodeGen/X86/clz.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/clz.ll | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/clz.ll b/llvm/test/CodeGen/X86/clz.ll index bcba9da1150..6f4d305385b 100644 --- a/llvm/test/CodeGen/X86/clz.ll +++ b/llvm/test/CodeGen/X86/clz.ll @@ -1,11 +1,32 @@ ; RUN: llc < %s -march=x86-64 -mcpu=yonah | FileCheck %s +declare i8 @llvm.cttz.i8(i8, i1) +declare i16 @llvm.cttz.i16(i16, i1) declare i32 @llvm.cttz.i32(i32, i1) +declare i64 @llvm.cttz.i64(i64, i1) declare i8 @llvm.ctlz.i8(i8, i1) declare i16 @llvm.ctlz.i16(i16, i1) declare i32 @llvm.ctlz.i32(i32, i1) declare i64 @llvm.ctlz.i64(i64, i1) +define i8 @cttz_i8(i8 %x) { + %tmp = call i8 @llvm.cttz.i8( i8 %x, i1 true ) + ret i8 %tmp +; CHECK: cttz_i8: +; CHECK: bsfw +; CHECK-NOT: cmov +; CHECK: ret +} + +define i16 @cttz_i16(i16 %x) { + %tmp = call i16 @llvm.cttz.i16( i16 %x, i1 true ) + ret i16 %tmp +; CHECK: cttz_i16: +; CHECK: bsfw +; CHECK-NOT: cmov +; CHECK: ret +} + define i32 @cttz_i32(i32 %x) { %tmp = call i32 @llvm.cttz.i32( i32 %x, i1 true ) ret i32 %tmp @@ -15,6 +36,15 @@ define i32 @cttz_i32(i32 %x) { ; CHECK: ret } +define i64 @cttz_i64(i64 %x) { + %tmp = call i64 @llvm.cttz.i64( i64 %x, i1 true ) + ret i64 %tmp +; CHECK: cttz_i64: +; CHECK: bsfq +; CHECK-NOT: cmov +; CHECK: ret +} + define i8 @ctlz_i8(i8 %x) { entry: %tmp2 = call i8 @llvm.ctlz.i8( i8 %x, i1 true ) |