From 6f195469b1cc02d3818947e8c8fe5f3b0cd9ad14 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 14 Apr 2011 18:47:18 +0000 Subject: [PATCH] move PR9661 out to here. llvm-svn: 129527 --- llvm/lib/Target/X86/README.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/llvm/lib/Target/X86/README.txt b/llvm/lib/Target/X86/README.txt index 1ac2305e82b1..07722f44ec39 100644 --- a/llvm/lib/Target/X86/README.txt +++ b/llvm/lib/Target/X86/README.txt @@ -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. + +//===---------------------------------------------------------------------===//