1 ; RUN: opt -S -inline -mtriple=arm-eabi -pass-remarks=.* -pass-remarks-missed=.* < %s 2>&1 | FileCheck %s -check-prefix=NOFP
2 ; RUN: opt -S -inline -mtriple=arm-eabi -mattr=+vfp2 -pass-remarks=.* -pass-remarks-missed=.* < %s 2>&1 | FileCheck %s -check-prefix=FULLFP
3 ; RUN: opt -S -inline -mtriple=arm-eabi -mattr=+vfp2,-fp64 -pass-remarks=.* -pass-remarks-missed=.* < %s 2>&1 | FileCheck %s -check-prefix=SINGLEFP
4 ; Make sure that soft float implementations are calculated as being more expensive
7 ; NOFP-DAG: single not inlined into test_single because too costly to inline (cost=125, threshold=75)
8 ; NOFP-DAG: single not inlined into test_single because too costly to inline (cost=125, threshold=75)
9 ; NOFP-DAG: single_cheap inlined into test_single_cheap with (cost=-15, threshold=75)
10 ; NOFP-DAG: single_cheap inlined into test_single_cheap with (cost=-15015, threshold=75)
11 ; NOFP-DAG: double not inlined into test_double because too costly to inline (cost=125, threshold=75)
12 ; NOFP-DAG: double not inlined into test_double because too costly to inline (cost=125, threshold=75)
13 ; NOFP-DAG: single_force_soft not inlined into test_single_force_soft because too costly to inline (cost=125, threshold=75)
14 ; NOFP-DAG: single_force_soft not inlined into test_single_force_soft because too costly to inline (cost=125, threshold=75)
15 ; NOFP-DAG: single_force_soft_fneg not inlined into test_single_force_soft_fneg because too costly to inline (cost=100, threshold=75)
16 ; NOFP-DAG: single_force_soft_fneg not inlined into test_single_force_soft_fneg because too costly to inline (cost=100, threshold=75)
18 ; FULLFP-DAG: single inlined into test_single with (cost=0, threshold=75)
19 ; FULLFP-DAG: single inlined into test_single with (cost=-15000, threshold=75)
20 ; FULLFP-DAG: single_cheap inlined into test_single_cheap with (cost=-15, threshold=75)
21 ; FULLFP-DAG: single_cheap inlined into test_single_cheap with (cost=-15015, threshold=75)
22 ; FULLFP-DAG: double inlined into test_double with (cost=0, threshold=75)
23 ; FULLFP-DAG: double inlined into test_double with (cost=-15000, threshold=75)
24 ; FULLFP-DAG: single_force_soft not inlined into test_single_force_soft because too costly to inline (cost=125, threshold=75)
25 ; FULLFP-DAG: single_force_soft not inlined into test_single_force_soft because too costly to inline (cost=125, threshold=75)
26 ; FULLFP-DAG: single_force_soft_fneg not inlined into test_single_force_soft_fneg because too costly to inline (cost=100, threshold=75)
27 ; FULLFP-DAG: single_force_soft_fneg not inlined into test_single_force_soft_fneg because too costly to inline (cost=100, threshold=75)
29 ; SINGLEFP-DAG: single inlined into test_single with (cost=0, threshold=75)
30 ; SINGLEFP-DAG: single inlined into test_single with (cost=-15000, threshold=75)
31 ; SINGLEFP-DAG: single_cheap inlined into test_single_cheap with (cost=-15, threshold=75)
32 ; SINGLEFP-DAG: single_cheap inlined into test_single_cheap with (cost=-15015, threshold=75)
33 ; SINGLEFP-DAG: double not inlined into test_double because too costly to inline (cost=125, threshold=75)
34 ; SINGLEFP-DAG: double not inlined into test_double because too costly to inline (cost=125, threshold=75)
35 ; SINGLEFP-DAG: single_force_soft not inlined into test_single_force_soft because too costly to inline (cost=125, threshold=75)
36 ; SINGLEFP-DAG: single_force_soft not inlined into test_single_force_soft because too costly to inline (cost=125, threshold=75)
37 ; SINGLEFP-DAG: single_force_soft_fneg not inlined into test_single_force_soft_fneg because too costly to inline (cost=100, threshold=75)
38 ; SINGLEFP-DAG: single_force_soft_fneg not inlined into test_single_force_soft_fneg because too costly to inline (cost=100, threshold=75)
40 define i32 @test_single(i32 %a, i8 %b, i32 %c, i8 %d) #0 {
41 %call = call float @single(i32 %a, i8 zeroext %b)
42 %call2 = call float @single(i32 %c, i8 zeroext %d)
46 define i32 @test_single_cheap(i32 %a, i8 %b, i32 %c, i8 %d) #0 {
47 %call = call float @single_cheap(i32 %a, i8 zeroext %b)
48 %call2 = call float @single_cheap(i32 %c, i8 zeroext %d)
52 define i32 @test_double(i32 %a, i8 %b, i32 %c, i8 %d) #0 {
53 %call = call double @double(i32 %a, i8 zeroext %b)
54 %call2 = call double @double(i32 %c, i8 zeroext %d)
58 define i32 @test_single_force_soft(i32 %a, i8 %b, i32 %c, i8 %d) #1 {
59 %call = call float @single_force_soft(i32 %a, i8 zeroext %b) #1
60 %call2 = call float @single_force_soft(i32 %c, i8 zeroext %d) #1
64 define i32 @test_single_force_soft_fneg(i32 %a, i8 %b, i32 %c, i8 %d) #1 {
65 %call = call float @single_force_soft_fneg(i32 %a, i8 zeroext %b) #1
66 %call2 = call float @single_force_soft_fneg(i32 %c, i8 zeroext %d) #1
70 define internal float @single(i32 %response, i8 zeroext %value1) #0 {
72 %conv = zext i8 %value1 to i32
73 %sub = add nsw i32 %conv, -1
74 %conv1 = sitofp i32 %sub to float
75 %0 = tail call float @llvm.pow.f32(float 0x3FF028F5C0000000, float %conv1)
76 %mul = fmul float %0, 2.620000e+03
77 %conv2 = sitofp i32 %response to float
78 %sub3 = fsub float %conv2, %mul
79 %div = fdiv float %sub3, %mul
83 define internal float @single_cheap(i32 %response, i8 zeroext %value1) #0 {
85 %conv = zext i8 %value1 to i32
86 %sub = add nsw i32 %conv, -1
87 %conv1 = bitcast i32 %sub to float
88 %conv2 = bitcast i32 %response to float
89 %0 = tail call float @llvm.pow.f32(float %conv2, float %conv1)
90 %1 = tail call float @llvm.pow.f32(float %0, float %0)
91 %2 = tail call float @llvm.pow.f32(float %1, float %1)
95 define internal double @double(i32 %response, i8 zeroext %value1) #0 {
97 %conv = zext i8 %value1 to i32
98 %sub = add nsw i32 %conv, -1
99 %conv1 = sitofp i32 %sub to double
100 %0 = tail call double @llvm.pow.f64(double 0x3FF028F5C0000000, double %conv1)
101 %mul = fmul double %0, 2.620000e+03
102 %conv2 = sitofp i32 %response to double
103 %sub3 = fsub double %conv2, %mul
104 %div = fdiv double %sub3, %mul
108 define internal float @single_force_soft(i32 %response, i8 zeroext %value1) #1 {
110 %conv = zext i8 %value1 to i32
111 %sub = add nsw i32 %conv, -1
112 %conv1 = sitofp i32 %sub to float
113 %0 = tail call float @llvm.pow.f32(float 0x3FF028F5C0000000, float %conv1)
114 %mul = fmul float %0, 2.620000e+03
115 %conv2 = sitofp i32 %response to float
116 %sub3 = fsub float %conv2, %mul
117 %div = fdiv float %sub3, %mul
121 define internal float @single_force_soft_fneg(i32 %response, i8 zeroext %value1) #1 {
123 %conv = zext i8 %value1 to i32
124 %sub = add nsw i32 %conv, -1
125 %conv1 = sitofp i32 %sub to float
126 %0 = tail call float @llvm.pow.f32(float 0x3FF028F5C0000000, float %conv1)
127 %mul = fsub float -0.0, %0
128 %conv2 = sitofp i32 %response to float
129 %sub3 = fsub float %conv2, %mul
130 %div = fdiv float %sub3, %mul
134 declare float @llvm.pow.f32(float, float) optsize minsize
135 declare double @llvm.pow.f64(double, double) optsize minsize
137 attributes #0 = { optsize }
138 attributes #1 = { optsize "use-soft-float"="true" "target-features"="+soft-float" }