[llvm-commits] [llvm] r147249 - /llvm/trunk/test/CodeGen/X86/clz.ll

Chandler Carruth chandlerc at gmail.com
Sat Dec 24 03:27:00 PST 2011


Author: chandlerc
Date: Sat Dec 24 05:26:59 2011
New Revision: 147249

URL: http://llvm.org/viewvc/llvm-project?rev=147249&view=rev
Log:
Add i8 and i64 testing for ctlz on x86. Also simplify the i16 test.

Modified:
    llvm/trunk/test/CodeGen/X86/clz.ll

Modified: llvm/trunk/test/CodeGen/X86/clz.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/clz.ll?rev=147249&r1=147248&r2=147249&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/clz.ll (original)
+++ llvm/trunk/test/CodeGen/X86/clz.ll Sat Dec 24 05:26:59 2011
@@ -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 @@
 ; 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 @@
 ; 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.





More information about the llvm-commits mailing list