xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/2012-08-28-UnsafeMathCrash.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -enable-unsafe-fp-math
2*9880d681SAndroid Build Coastguard Worker; <rdar://problem/12180135>
3*9880d681SAndroid Build Coastguard Workertarget 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"
4*9880d681SAndroid Build Coastguard Workertarget triple = "i386-apple-macosx10.8.0"
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine i32 @foo(float %mean) nounwind readnone ssp align 2 {
7*9880d681SAndroid Build Coastguard Workerentry:
8*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp olt float %mean, -3.000000e+00
9*9880d681SAndroid Build Coastguard Worker  %f.0 = select i1 %cmp, float -3.000000e+00, float %mean
10*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp ult float %f.0, 3.000000e+00
11*9880d681SAndroid Build Coastguard Worker  %f.1 = select i1 %cmp2, float %f.0, float 0x4007EB8520000000
12*9880d681SAndroid Build Coastguard Worker  %add = fadd float %f.1, 3.000000e+00
13*9880d681SAndroid Build Coastguard Worker  %div = fdiv float %add, 2.343750e-02
14*9880d681SAndroid Build Coastguard Worker  %0 = fpext float %div to double
15*9880d681SAndroid Build Coastguard Worker  %conv = select i1 undef, double 2.550000e+02, double %0
16*9880d681SAndroid Build Coastguard Worker  %add8 = fadd double %conv, 5.000000e-01
17*9880d681SAndroid Build Coastguard Worker  %conv9 = fptosi double %add8 to i32
18*9880d681SAndroid Build Coastguard Worker  %.conv9 = select i1 undef, i32 255, i32 %conv9
19*9880d681SAndroid Build Coastguard Worker  ret i32 %.conv9
20*9880d681SAndroid Build Coastguard Worker}
21