aboutsummaryrefslogtreecommitdiffstats
path: root/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
commit9d2051f7fa1b10c4c768e02948365fbc5d80422a (patch)
tree28eb0762ea541ad608dff888161117687b89c24a /test/CodeGen/X86/clz.ll
parente0c643d5031c746f112db29a291178754304c477 (diff)
downloadexternal_llvm-9d2051f7fa1b10c4c768e02948365fbc5d80422a.zip
external_llvm-9d2051f7fa1b10c4c768e02948365fbc5d80422a.tar.gz
external_llvm-9d2051f7fa1b10c4c768e02948365fbc5d80422a.tar.bz2
Add i8 and i64 testing for ctlz on x86. Also simplify the i16 test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147249 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/clz.ll')
-rw-r--r--test/CodeGen/X86/clz.ll30
1 files changed, 26 insertions, 4 deletions
diff --git a/test/CodeGen/X86/clz.ll b/test/CodeGen/X86/clz.ll
index c16842a..bcba9da 100644
--- a/test/CodeGen/X86/clz.ll
+++ b/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.