summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-04-28 05:33:16 +0000
committerChris Lattner <sabre@nondot.org>2011-04-28 05:33:16 +0000
commit2a75c72e1c2494d45a30b904256f3abcf6d1f260 (patch)
tree97dd4aa1b4d2c086ca378775ff10e2e767201f23 /llvm/lib
parentfc15ae466c7effcbeeba92cd964431705c9f5dfb (diff)
downloadbcm5719-llvm-2a75c72e1c2494d45a30b904256f3abcf6d1f260.tar.gz
bcm5719-llvm-2a75c72e1c2494d45a30b904256f3abcf6d1f260.zip
move PR9803 to this readme.
llvm-svn: 130385
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/README.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/README.txt b/llvm/lib/Target/X86/README.txt
index 1902485c182..8237fbd0942 100644
--- a/llvm/lib/Target/X86/README.txt
+++ b/llvm/lib/Target/X86/README.txt
@@ -2032,3 +2032,31 @@ clamp_float: # @clamp_float
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.
+
+//===---------------------------------------------------------------------===//
OpenPOWER on IntegriCloud