[llvm-commits] [llvm] r130385 - /llvm/trunk/lib/Target/X86/README.txt
Chris Lattner
sabre at nondot.org
Wed Apr 27 22:33:16 PDT 2011
Author: lattner
Date: Thu Apr 28 00:33:16 2011
New Revision: 130385
URL: http://llvm.org/viewvc/llvm-project?rev=130385&view=rev
Log:
move PR9803 to this readme.
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=130385&r1=130384&r2=130385&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Thu Apr 28 00:33:16 2011
@@ -2032,3 +2032,31 @@
with -ffast-math.
//===---------------------------------------------------------------------===//
+
+This function (from PR9803):
+
+int clamp2(int a) {
+ if (a > 5)
+ a = 5;
+ if (a < 0)
+ return 0;
+ return a;
+}
+
+Compiles to:
+
+_clamp2: ## @clamp2
+ pushq %rbp
+ movq %rsp, %rbp
+ cmpl $5, %edi
+ movl $5, %ecx
+ cmovlel %edi, %ecx
+ testl %ecx, %ecx
+ movl $0, %eax
+ cmovnsl %ecx, %eax
+ popq %rbp
+ ret
+
+The move of 0 could be scheduled above the test to make it is xor reg,reg.
+
+//===---------------------------------------------------------------------===//
More information about the llvm-commits
mailing list