summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/clz.ll
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-12-24 11:26:59 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-12-24 11:26:59 +0000
commit103ca80f59cb2c8edf62150185e507d70420e441 (patch)
treec8e62dbd3a71501b924b00d933b2dbe1cc27a421 /llvm/test/CodeGen/X86/clz.ll
parent44cf07228bf6e957cf43dab703f9c0aada25a30c (diff)
downloadbcm5719-llvm-103ca80f59cb2c8edf62150185e507d70420e441.tar.gz
bcm5719-llvm-103ca80f59cb2c8edf62150185e507d70420e441.zip
Add i8 and i64 testing for ctlz on x86. Also simplify the i16 test.
llvm-svn: 147249
Diffstat (limited to 'llvm/test/CodeGen/X86/clz.ll')
-rw-r--r--llvm/test/CodeGen/X86/clz.ll30
1 files changed, 26 insertions, 4 deletions
diff --git a/llvm/test/CodeGen/X86/clz.ll b/llvm/test/CodeGen/X86/clz.ll
index c16842a97ba..bcba9da1150 100644
--- a/llvm/test/CodeGen/X86/clz.ll
+++ b/llvm/test/CodeGen/X86/clz.ll
@@ -1,8 +1,10 @@
-; RUN: llc < %s -march=x86 -mcpu=yonah | FileCheck %s
+; RUN: llc < %s -march=x86-64 -mcpu=yonah | FileCheck %s
declare i32 @llvm.cttz.i32(i32, 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 i32 @cttz_i32(i32 %x) {
%tmp = call i32 @llvm.cttz.i32( i32 %x, i1 true )
@@ -13,10 +15,20 @@ define i32 @cttz_i32(i32 %x) {
; CHECK: ret
}
-define i16 @ctlz_i16(i16 %x, i16 %y) {
+define i8 @ctlz_i8(i8 %x) {
entry:
- %tmp1 = add i16 %x, %y
- %tmp2 = call i16 @llvm.ctlz.i16( i16 %tmp1, i1 true )
+ %tmp2 = call i8 @llvm.ctlz.i8( i8 %x, i1 true )
+ ret i8 %tmp2
+; CHECK: ctlz_i8:
+; CHECK: bsrl
+; CHECK-NOT: cmov
+; CHECK: xorl $7,
+; CHECK: ret
+}
+
+define i16 @ctlz_i16(i16 %x) {
+entry:
+ %tmp2 = call i16 @llvm.ctlz.i16( i16 %x, i1 true )
ret i16 %tmp2
; CHECK: ctlz_i16:
; CHECK: bsrw
@@ -35,6 +47,16 @@ define i32 @ctlz_i32(i32 %x) {
; CHECK: ret
}
+define i64 @ctlz_i64(i64 %x) {
+ %tmp = call i64 @llvm.ctlz.i64( i64 %x, i1 true )
+ ret i64 %tmp
+; CHECK: ctlz_i64:
+; CHECK: bsrq
+; CHECK-NOT: cmov
+; CHECK: xorq $63,
+; CHECK: ret
+}
+
define i32 @ctlz_i32_cmov(i32 %n) {
entry:
; Generate a cmov to handle zero inputs when necessary.
OpenPOWER on IntegriCloud