1 ; RUN: opt < %s -simplifycfg -instcombine -S | grep 0x3FB99999A0000000 | count 2
2 ; RUN: opt < %s -simplifycfg -instcombine -S | grep 0xBFB99999A0000000 | count 2
3 ; check constant folding for 'frem'. PR 3316.
6 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"
7 target triple = "i386-apple-darwin9.6"
9 define float @test1() nounwind {
11 %retval = alloca float ; <float*> [#uses=2]
12 %0 = alloca float ; <float*> [#uses=2]
13 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
14 %1 = frem double 1.000000e-01, 1.000000e+00 ; <double> [#uses=1]
15 %2 = fptrunc double %1 to float ; <float> [#uses=1]
16 store float %2, float* %0, align 4
17 %3 = load float, float* %0, align 4 ; <float> [#uses=1]
18 store float %3, float* %retval, align 4
21 return: ; preds = %entry
22 %retval1 = load float, float* %retval ; <float> [#uses=1]
26 define float @test2() nounwind {
28 %retval = alloca float ; <float*> [#uses=2]
29 %0 = alloca float ; <float*> [#uses=2]
30 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
31 %1 = frem double -1.000000e-01, 1.000000e+00 ; <double> [#uses=1]
32 %2 = fptrunc double %1 to float ; <float> [#uses=1]
33 store float %2, float* %0, align 4
34 %3 = load float, float* %0, align 4 ; <float> [#uses=1]
35 store float %3, float* %retval, align 4
38 return: ; preds = %entry
39 %retval1 = load float, float* %retval ; <float> [#uses=1]
43 define float @test3() nounwind {
45 %retval = alloca float ; <float*> [#uses=2]
46 %0 = alloca float ; <float*> [#uses=2]
47 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
48 %1 = frem double 1.000000e-01, -1.000000e+00 ; <double> [#uses=1]
49 %2 = fptrunc double %1 to float ; <float> [#uses=1]
50 store float %2, float* %0, align 4
51 %3 = load float, float* %0, align 4 ; <float> [#uses=1]
52 store float %3, float* %retval, align 4
55 return: ; preds = %entry
56 %retval1 = load float, float* %retval ; <float> [#uses=1]
60 define float @test4() nounwind {
62 %retval = alloca float ; <float*> [#uses=2]
63 %0 = alloca float ; <float*> [#uses=2]
64 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
65 %1 = frem double -1.000000e-01, -1.000000e+00 ; <double> [#uses=1]
66 %2 = fptrunc double %1 to float ; <float> [#uses=1]
67 store float %2, float* %0, align 4
68 %3 = load float, float* %0, align 4 ; <float> [#uses=1]
69 store float %3, float* %retval, align 4
72 return: ; preds = %entry
73 %retval1 = load float, float* %retval ; <float> [#uses=1]