139 lines · plain
1; RUN: opt -S -passes=inline -mtriple=arm-eabi -pass-remarks=.* -pass-remarks-missed=.* < %s 2>&1 | FileCheck %s -check-prefix=NOFP2; RUN: opt -S -passes=inline -mtriple=arm-eabi -mattr=+vfp2 -pass-remarks=.* -pass-remarks-missed=.* < %s 2>&1 | FileCheck %s -check-prefix=FULLFP3; RUN: opt -S -passes=inline -mtriple=arm-eabi -mattr=+vfp2,-fp64 -pass-remarks=.* -pass-remarks-missed=.* < %s 2>&1 | FileCheck %s -check-prefix=SINGLEFP4; Make sure that soft float implementations are calculated as being more expensive5; to the inliner.6 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)17 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)28 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)39 40define 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)43 ret i32 044}45 46define 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)49 ret i32 050}51 52define 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)55 ret i32 056}57 58define 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) #160 %call2 = call float @single_force_soft(i32 %c, i8 zeroext %d) #161 ret i32 062}63 64define 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) #166 %call2 = call float @single_force_soft_fneg(i32 %c, i8 zeroext %d) #167 ret i32 068}69 70define internal float @single(i32 %response, i8 zeroext %value1) #0 {71entry:72 %conv = zext i8 %value1 to i3273 %sub = add nsw i32 %conv, -174 %conv1 = sitofp i32 %sub to float75 %0 = tail call float @llvm.pow.f32(float 0x3FF028F5C0000000, float %conv1)76 %mul = fmul float %0, 2.620000e+0377 %conv2 = sitofp i32 %response to float78 %sub3 = fsub float %conv2, %mul79 %div = fdiv float %sub3, %mul80 ret float %div81}82 83define internal float @single_cheap(i32 %response, i8 zeroext %value1) #0 {84entry:85 %conv = zext i8 %value1 to i3286 %sub = add nsw i32 %conv, -187 %conv1 = bitcast i32 %sub to float88 %conv2 = bitcast i32 %response to float89 %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)92 ret float %293}94 95define internal double @double(i32 %response, i8 zeroext %value1) #0 {96entry:97 %conv = zext i8 %value1 to i3298 %sub = add nsw i32 %conv, -199 %conv1 = sitofp i32 %sub to double100 %0 = tail call double @llvm.pow.f64(double 0x3FF028F5C0000000, double %conv1)101 %mul = fmul double %0, 2.620000e+03102 %conv2 = sitofp i32 %response to double103 %sub3 = fsub double %conv2, %mul104 %div = fdiv double %sub3, %mul105 ret double %div106}107 108define internal float @single_force_soft(i32 %response, i8 zeroext %value1) #1 {109entry:110 %conv = zext i8 %value1 to i32111 %sub = add nsw i32 %conv, -1112 %conv1 = sitofp i32 %sub to float113 %0 = tail call float @llvm.pow.f32(float 0x3FF028F5C0000000, float %conv1)114 %mul = fmul float %0, 2.620000e+03115 %conv2 = sitofp i32 %response to float116 %sub3 = fsub float %conv2, %mul117 %div = fdiv float %sub3, %mul118 ret float %div119}120 121define internal float @single_force_soft_fneg(i32 %response, i8 zeroext %value1) #1 {122entry:123 %conv = zext i8 %value1 to i32124 %sub = add nsw i32 %conv, -1125 %conv1 = sitofp i32 %sub to float126 %0 = tail call float @llvm.pow.f32(float 0x3FF028F5C0000000, float %conv1)127 %mul = fsub float -0.0, %0128 %conv2 = sitofp i32 %response to float129 %sub3 = fsub float %conv2, %mul130 %div = fdiv float %sub3, %mul131 ret float %div132}133 134declare float @llvm.pow.f32(float, float) optsize minsize135declare double @llvm.pow.f64(double, double) optsize minsize136 137attributes #0 = { optsize }138attributes #1 = { optsize "use-soft-float"="true" "target-features"="+soft-float" }139