move PR9661 out to here.

llvm-svn: 129527
This commit is contained in:
Chris Lattner 2011-04-14 18:47:18 +00:00
parent f7b6202e6c
commit 6f195469b1
1 changed files with 24 additions and 0 deletions

View File

@ -2016,3 +2016,27 @@ We currently generate:
We could save an instruction here by commuting the addss.
//===---------------------------------------------------------------------===//
This (from PR9661):
float clamp_float(float a) {
if (a > 1.0f)
return 1.0f;
else if (a < 0.0f)
return 0.0f;
else
return a;
}
Could compile to:
clamp_float: # @clamp_float
movss .LCPI0_0(%rip), %xmm1
minss %xmm1, %xmm0
pxor %xmm1, %xmm1
maxss %xmm1, %xmm0
ret
with -ffast-math.
//===---------------------------------------------------------------------===//