[llvm-commits] [llvm] r41021 - /llvm/trunk/lib/Target/X86/README.txt

Chris Lattner sabre at nondot.org
Sat Aug 11 11:19:08 PDT 2007


Author: lattner
Date: Sat Aug 11 13:19:07 2007
New Revision: 41021

URL: http://llvm.org/viewvc/llvm-project?rev=41021&view=rev
Log:
expand a note


Modified:
    llvm/trunk/lib/Target/X86/README.txt

Modified: llvm/trunk/lib/Target/X86/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=41021&r1=41020&r2=41021&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Sat Aug 11 13:19:07 2007
@@ -559,7 +559,25 @@
 
 //===---------------------------------------------------------------------===//
 
-Implement CTTZ, CTLZ with bsf and bsr.
+Implement CTTZ, CTLZ with bsf and bsr. GCC produces:
+
+int ctz_(unsigned X) { return __builtin_ctz(X); }
+int clz_(unsigned X) { return __builtin_clz(X); }
+int ffs_(unsigned X) { return __builtin_ffs(X); }
+
+_ctz_:
+        bsfl    4(%esp), %eax
+        ret
+_clz_:
+        bsrl    4(%esp), %eax
+        xorl    $31, %eax
+        ret
+_ffs_:
+        movl    $-1, %edx
+        bsfl    4(%esp), %eax
+        cmove   %edx, %eax
+        addl    $1, %eax
+        ret
 
 //===---------------------------------------------------------------------===//
 
@@ -1077,8 +1095,9 @@
 
 define <4 x float> @test1(<4 x float> %V) {
 entry:
-        %tmp8 = shufflevector <4 x float> %V, <4 x float> undef, <4 x i32> < i32 3, i32 2, i32 1, i32 0 >               ; <<4 x float>> [#uses=1]
-        %add = add <4 x float> %tmp8, %V                ; <<4 x float>> [#uses=1]
+        %tmp8 = shufflevector <4 x float> %V, <4 x float> undef,
+                                        <4 x i32> < i32 3, i32 2, i32 1, i32 0 >
+        %add = add <4 x float> %tmp8, %V
         ret <4 x float> %add
 }
 





More information about the llvm-commits mailing list