1; RUN: opt < %s -libcalls-shrinkwrap -S | FileCheck %s 2; New PM 3; RUN: opt < %s -passes=libcalls-shrinkwrap -S | FileCheck %s 4 5target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 6target triple = "x86_64-unknown-linux-gnu" 7 8define void @test_range_error(float %value) { 9entry: 10 %call_0 = call float @coshf(float %value) 11; CHECK: [[COND1:%[0-9]+]] = fcmp olt float %value, -8.900000e+01 12; CHECK: [[COND2:%[0-9]+]] = fcmp ogt float %value, 8.900000e+01 13; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]] 14; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT:[0-9]+]] 15; CHECK: [[CALL_LABEL]]: 16; CHECK-NEXT: %call_0 = call float @coshf(float %value) 17; CHECK-NEXT: br label %[[END_LABEL]] 18; CHECK: [[END_LABEL]]: 19 20 %call_1 = call float @expf(float %value) 21; CHECK: [[COND1:%[0-9]+]] = fcmp olt float %value, -1.030000e+02 22; CHECK: [[COND2:%[0-9]+]] = fcmp ogt float %value, 8.800000e+01 23; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]] 24; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 25; CHECK: [[CALL_LABEL]]: 26; CHECK-NEXT: %call_1 = call float @expf(float %value) 27; CHECK-NEXT: br label %[[END_LABEL]] 28; CHECK: [[END_LABEL]]: 29 30 %call_3 = call float @exp2f(float %value) 31; CHECK: [[COND1:%[0-9]+]] = fcmp olt float %value, -1.490000e+02 32; CHECK: [[COND2:%[0-9]+]] = fcmp ogt float %value, 1.270000e+02 33; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]] 34; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 35; CHECK: [[CALL_LABEL]]: 36; CHECK-NEXT: %call_3 = call float @exp2f(float %value) 37; CHECK-NEXT: br label %[[END_LABEL]] 38; CHECK: [[END_LABEL]]: 39 40 %call_4 = call float @sinhf(float %value) 41; CHECK: [[COND1:%[0-9]+]] = fcmp olt float %value, -8.900000e+01 42; CHECK: [[COND2:%[0-9]+]] = fcmp ogt float %value, 8.900000e+01 43; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]] 44; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 45; CHECK: [[CALL_LABEL]]: 46; CHECK-NEXT: %call_4 = call float @sinhf(float %value) 47; CHECK-NEXT: br label %[[END_LABEL]] 48; CHECK: [[END_LABEL]]: 49 50 %call_5 = call float @expm1f(float %value) 51; CHECK: [[COND:%[0-9]+]] = fcmp ogt float %value, 8.800000e+01 52; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 53; CHECK: [[CALL_LABEL]]: 54; CHECK-NEXT: %call_5 = call float @expm1f(float %value) 55; CHECK-NEXT: br label %[[END_LABEL]] 56; CHECK: [[END_LABEL]]: 57 58 ret void 59} 60 61declare float @coshf(float) 62declare float @expf(float) 63declare float @exp2f(float) 64declare float @sinhf(float) 65declare float @expm1f(float) 66 67define void @test_domain_error(float %value) { 68entry: 69 70 %call_00 = call float @acosf(float %value) 71; CHECK: [[COND1:%[0-9]+]] = fcmp ogt float %value, 1.000000e+00 72; CHECK: [[COND2:%[0-9]+]] = fcmp olt float %value, -1.000000e+00 73; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]] 74; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 75; CHECK: [[CALL_LABEL]]: 76; CHECK-NEXT: %call_00 = call float @acosf(float %value) 77; CHECK-NEXT: br label %[[END_LABEL]] 78; CHECK: [[END_LABEL]]: 79 80 %call_01 = call float @asinf(float %value) 81; CHECK: [[COND1:%[0-9]+]] = fcmp ogt float %value, 1.000000e+00 82; CHECK: [[COND2:%[0-9]+]] = fcmp olt float %value, -1.000000e+00 83; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]] 84; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 85; CHECK: [[CALL_LABEL]]: 86; CHECK-NEXT: %call_01 = call float @asinf(float %value) 87; CHECK-NEXT: br label %[[END_LABEL]] 88; CHECK: [[END_LABEL]]: 89 90 %call_02 = call float @cosf(float %value) 91; CHECK: [[COND1:%[0-9]+]] = fcmp oeq float %value, 0xFFF0000000000000 92; CHECK: [[COND2:%[0-9]+]] = fcmp oeq float %value, 0x7FF0000000000000 93; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]] 94; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 95; CHECK: [[CALL_LABEL]]: 96; CHECK-NEXT: %call_02 = call float @cosf(float %value) 97; CHECK-NEXT: br label %[[END_LABEL]] 98; CHECK: [[END_LABEL]]: 99 100 %call_03 = call float @sinf(float %value) 101; CHECK: [[COND1:%[0-9]+]] = fcmp oeq float %value, 0xFFF0000000000000 102; CHECK: [[COND2:%[0-9]+]] = fcmp oeq float %value, 0x7FF0000000000000 103; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]] 104; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 105; CHECK: [[CALL_LABEL]]: 106; CHECK-NEXT: %call_03 = call float @sinf(float %value) 107; CHECK-NEXT: br label %[[END_LABEL]] 108; CHECK: [[END_LABEL]]: 109 110 %call_04 = call float @acoshf(float %value) 111; CHECK: [[COND:%[0-9]+]] = fcmp olt float %value, 1.000000e+00 112; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 113; CHECK: [[CALL_LABEL]]: 114; CHECK-NEXT: %call_04 = call float @acoshf(float %value) 115; CHECK-NEXT: br label %[[END_LABEL]] 116; CHECK: [[END_LABEL]]: 117 118 %call_05 = call float @sqrtf(float %value) 119; CHECK: [[COND:%[0-9]+]] = fcmp olt float %value, 0.000000e+00 120; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 121; CHECK: [[CALL_LABEL]]: 122; CHECK-NEXT: %call_05 = call float @sqrtf(float %value) 123; CHECK-NEXT: br label %[[END_LABEL]] 124; CHECK: [[END_LABEL]]: 125 126 %call_06 = call float @atanhf(float %value) 127; CHECK: [[COND1:%[0-9]+]] = fcmp oge float %value, 1.000000e+00 128; CHECK: [[COND2:%[0-9]+]] = fcmp ole float %value, -1.000000e+00 129; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]] 130; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 131; CHECK: [[CALL_LABEL]]: 132; CHECK-NEXT: %call_06 = call float @atanhf(float %value) 133; CHECK-NEXT: br label %[[END_LABEL]] 134; CHECK: [[END_LABEL]]: 135 136 %call_07 = call float @logf(float %value) 137; CHECK: [[COND:%[0-9]+]] = fcmp ole float %value, 0.000000e+00 138; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 139; CHECK: [[CALL_LABEL]]: 140; CHECK-NEXT: %call_07 = call float @logf(float %value) 141; CHECK-NEXT: br label %[[END_LABEL]] 142; CHECK: [[END_LABEL]]: 143 144 %call_08 = call float @log10f(float %value) 145; CHECK: [[COND:%[0-9]+]] = fcmp ole float %value, 0.000000e+00 146; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 147; CHECK: [[CALL_LABEL]]: 148; CHECK-NEXT: %call_08 = call float @log10f(float %value) 149; CHECK-NEXT: br label %[[END_LABEL]] 150; CHECK: [[END_LABEL]]: 151 152 %call_09 = call float @log2f(float %value) 153; CHECK: [[COND:%[0-9]+]] = fcmp ole float %value, 0.000000e+00 154; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 155; CHECK: [[CALL_LABEL]]: 156; CHECK-NEXT: %call_09 = call float @log2f(float %value) 157; CHECK-NEXT: br label %[[END_LABEL]] 158; CHECK: [[END_LABEL]]: 159 160 %call_10 = call float @logbf(float %value) 161; CHECK: [[COND:%[0-9]+]] = fcmp ole float %value, 0.000000e+00 162; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 163; CHECK: [[CALL_LABEL]]: 164; CHECK-NEXT: %call_10 = call float @logbf(float %value) 165; CHECK-NEXT: br label %[[END_LABEL]] 166; CHECK: [[END_LABEL]]: 167 168 %call_11 = call float @log1pf(float %value) 169; CHECK: [[COND:%[0-9]+]] = fcmp ole float %value, -1.000000e+00 170; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]] 171; CHECK: [[CALL_LABEL]]: 172; CHECK-NEXT: %call_11 = call float @log1pf(float %value) 173; CHECK-NEXT: br label %[[END_LABEL]] 174; CHECK: [[END_LABEL]]: 175 ret void 176} 177 178declare float @acosf(float) 179declare float @asinf(float) 180declare float @cosf(float) 181declare float @sinf(float) 182declare float @acoshf(float) 183declare float @sqrtf(float) 184declare float @atanhf(float) 185declare float @logf(float) 186declare float @log10f(float) 187declare float @log2f(float) 188declare float @logbf(float) 189declare float @log1pf(float) 190 191; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 2000} 192