summaryrefslogtreecommitdiff
path: root/lib/Target/X86/README.txt
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
commit4c19b17a17ee1379b455f8dc4796af518dcb45e3 (patch)
treecbefdbf4649530f6a5a7b8380e4c24074c1075af /lib/Target/X86/README.txt
parente6b693db8cc07be91229bef0d8577ce8b5caf34b (diff)
downloadllvm-4c19b17a17ee1379b455f8dc4796af518dcb45e3.tar.gz
llvm-4c19b17a17ee1379b455f8dc4796af518dcb45e3.tar.bz2
llvm-4c19b17a17ee1379b455f8dc4796af518dcb45e3.tar.xz
move PR9803 to this readme.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130385 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/README.txt')
-rw-r--r--lib/Target/X86/README.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt
index 1902485c18..8237fbd094 100644
--- a/lib/Target/X86/README.txt
+++ b/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.
+
+//===---------------------------------------------------------------------===//