move PR9803 to this readme.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130385 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2011-04-28 05:33:16 +00:00
parent e6b693db8c
commit 4c19b17a17

View File

@ -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.
//===---------------------------------------------------------------------===//