[llvm-commits] CVS: llvm/lib/Target/X86/README.txt

Chris Lattner sabre at nondot.org
Tue Apr 10 14:14:29 PDT 2007



Changes in directory llvm/lib/Target/X86:

README.txt updated: 1.162 -> 1.163
---
Log message:

new micro optzn


---
Diffs of the changes:  (+30 -0)

 README.txt |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+)


Index: llvm/lib/Target/X86/README.txt
diff -u llvm/lib/Target/X86/README.txt:1.162 llvm/lib/Target/X86/README.txt:1.163
--- llvm/lib/Target/X86/README.txt:1.162	Tue Apr  3 18:41:34 2007
+++ llvm/lib/Target/X86/README.txt	Tue Apr 10 16:14:01 2007
@@ -1047,3 +1047,33 @@
 }
 
 
+//===---------------------------------------------------------------------===//
+
+Consider:
+
+int isnegative(unsigned int X) {
+   return !(X < 2147483648U);
+}
+
+We current compile this to:
+
+define i32 @isnegative(i32 %X) {
+        icmp slt i32 %X, 0              ; <i1>:0 [#uses=1]
+        %retval = zext i1 %0 to i32             ; <i32> [#uses=1]
+        ret i32 %retval
+}
+
+and:
+
+_isnegative:
+        cmpl $0, 4(%esp)
+        sets %al
+        movzbl %al, %eax
+        ret
+
+We should produce:
+
+	movl	4(%esp), %eax
+	shrl	$31, %eax
+        ret
+






More information about the llvm-commits mailing list