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

Chris Lattner sabre at nondot.org
Thu Oct 4 08:47:28 PDT 2007


Author: lattner
Date: Thu Oct  4 10:47:27 2007
New Revision: 42607

URL: http://llvm.org/viewvc/llvm-project?rev=42607&view=rev
Log:
add 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=42607&r1=42606&r2=42607&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Thu Oct  4 10:47:27 2007
@@ -1362,3 +1362,43 @@
 
 //===---------------------------------------------------------------------===//
 
+We compile this:
+
+void compare (long long foo) {
+  if (foo < 4294967297LL)
+    abort();
+}
+
+to:
+
+_compare:
+        subl    $12, %esp
+        cmpl    $0, 16(%esp)
+        setne   %al
+        movzbw  %al, %ax
+        cmpl    $1, 20(%esp)
+        setg    %cl
+        movzbw  %cl, %cx
+        cmove   %ax, %cx
+        movw    %cx, %ax
+        testb   $1, %al
+        je      LBB1_2  # cond_true
+
+(also really horrible code on ppc).  This is due to the expand code for 64-bit
+compares.  GCC produces multiple branches, which is much nicer:
+
+_compare:
+        pushl   %ebp
+        movl    %esp, %ebp
+        subl    $8, %esp
+        movl    8(%ebp), %eax
+        movl    12(%ebp), %edx
+        subl    $1, %edx
+        jg     L5
+L7:
+        jl      L4
+        cmpl    $0, %eax
+        jbe      L4
+L5:
+
+//===---------------------------------------------------------------------===//





More information about the llvm-commits mailing list