diff options
author | Chris Lattner <sabre@nondot.org> | 2011-04-28 05:33:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-04-28 05:33:16 +0000 |
commit | 4c19b17a17ee1379b455f8dc4796af518dcb45e3 (patch) | |
tree | cbefdbf4649530f6a5a7b8380e4c24074c1075af /lib/Target/X86/README.txt | |
parent | e6b693db8cc07be91229bef0d8577ce8b5caf34b (diff) | |
download | external_llvm-4c19b17a17ee1379b455f8dc4796af518dcb45e3.zip external_llvm-4c19b17a17ee1379b455f8dc4796af518dcb45e3.tar.gz external_llvm-4c19b17a17ee1379b455f8dc4796af518dcb45e3.tar.bz2 |
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.txt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt index 1902485..8237fbd 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. + +//===---------------------------------------------------------------------===// |