summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/2012-08-28-UnsafeMathCrash.ll
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-08-28 07:36:46 +0000
committerBill Wendling <isanbard@gmail.com>2012-08-28 07:36:46 +0000
commiteeba6e83175d7835f3648c30a44c2ca12116d40b (patch)
treef1531a2ee627e4c94d8a41218643befa2e37cc05 /test/CodeGen/X86/2012-08-28-UnsafeMathCrash.ll
parentd90219463154cafb5d626b7964bf20e572a186df (diff)
downloadllvm-eeba6e83175d7835f3648c30a44c2ca12116d40b.tar.gz
llvm-eeba6e83175d7835f3648c30a44c2ca12116d40b.tar.bz2
llvm-eeba6e83175d7835f3648c30a44c2ca12116d40b.tar.xz
The commutative flag is already correctly set within the multiclass. If we set
it here, then a 'register-memory' version would wrongly get the commutative flag. <rdar://problem/12180135> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162741 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/2012-08-28-UnsafeMathCrash.ll')
-rw-r--r--test/CodeGen/X86/2012-08-28-UnsafeMathCrash.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/CodeGen/X86/2012-08-28-UnsafeMathCrash.ll b/test/CodeGen/X86/2012-08-28-UnsafeMathCrash.ll
new file mode 100644
index 0000000000..6ebbb2e97d
--- /dev/null
+++ b/test/CodeGen/X86/2012-08-28-UnsafeMathCrash.ll
@@ -0,0 +1,20 @@
+; RUN: llc < %s -enable-unsafe-fp-math
+; <rdar://problem/12180135>
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"
+target triple = "i386-apple-macosx10.8.0"
+
+define i32 @foo(float %mean) nounwind readnone ssp align 2 {
+entry:
+ %cmp = fcmp olt float %mean, -3.000000e+00
+ %f.0 = select i1 %cmp, float -3.000000e+00, float %mean
+ %cmp2 = fcmp ult float %f.0, 3.000000e+00
+ %f.1 = select i1 %cmp2, float %f.0, float 0x4007EB8520000000
+ %add = fadd float %f.1, 3.000000e+00
+ %div = fdiv float %add, 2.343750e-02
+ %0 = fpext float %div to double
+ %conv = select i1 undef, double 2.550000e+02, double %0
+ %add8 = fadd double %conv, 5.000000e-01
+ %conv9 = fptosi double %add8 to i32
+ %.conv9 = select i1 undef, i32 255, i32 %conv9
+ ret i32 %.conv9
+}