diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 07f53bedc776..ccb56631b846 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -1282,24 +1282,30 @@ bool llvm::canConstantFoldCallTo(const Function *F) { // return true for a name like "cos\0blah" which strcmp would return equal to // "cos", but has length 8. switch (Name[0]) { - default: return false; + default: + return false; case 'a': - return Name == "acos" || Name == "asin" || Name == "atan" || Name =="atan2"; + return Name == "acos" || Name == "asin" || Name == "atan" || + Name == "atan2" || Name == "acosf" || Name == "asinf" || + Name == "atanf" || Name == "atan2f"; case 'c': - return Name == "cos" || Name == "ceil" || Name == "cosf" || Name == "cosh"; + return Name == "ceil" || Name == "cos" || Name == "cosh" || + Name == "ceilf" || Name == "cosf" || Name == "coshf"; case 'e': - return Name == "exp" || Name == "exp2"; + return Name == "exp" || Name == "exp2" || Name == "expf" || Name == "exp2f"; case 'f': - return Name == "fabs" || Name == "fmod" || Name == "floor"; + return Name == "fabs" || Name == "floor" || Name == "fmod" || + Name == "fabsf" || Name == "floorf" || Name == "fmodf"; case 'l': - return Name == "log" || Name == "log10"; + return Name == "log" || Name == "log10" || Name == "logf" || + Name == "log10f"; case 'p': - return Name == "pow"; + return Name == "pow" || Name == "powf"; case 's': return Name == "sin" || Name == "sinh" || Name == "sqrt" || - Name == "sinf" || Name == "sqrtf"; + Name == "sinf" || Name == "sinhf" || Name == "sqrtf"; case 't': - return Name == "tan" || Name == "tanh"; + return Name == "tan" || Name == "tanh" || Name == "tanf" || Name == "tanhf"; } } @@ -1495,43 +1501,51 @@ static Constant *ConstantFoldScalarCall(StringRef Name, unsigned IntrinsicID, switch (Name[0]) { case 'a': - if (Name == "acos" && TLI->has(LibFunc::acos)) + if ((Name == "acos" && TLI->has(LibFunc::acos)) || + (Name == "acosf" && TLI->has(LibFunc::acosf))) return ConstantFoldFP(acos, V, Ty); - else if (Name == "asin" && TLI->has(LibFunc::asin)) + else if ((Name == "asin" && TLI->has(LibFunc::asin)) || + (Name == "asinf" && TLI->has(LibFunc::asinf))) return ConstantFoldFP(asin, V, Ty); - else if (Name == "atan" && TLI->has(LibFunc::atan)) + else if ((Name == "atan" && TLI->has(LibFunc::atan)) || + (Name == "atanf" && TLI->has(LibFunc::atanf))) return ConstantFoldFP(atan, V, Ty); break; case 'c': - if (Name == "ceil" && TLI->has(LibFunc::ceil)) + if ((Name == "ceil" && TLI->has(LibFunc::ceil)) || + (Name == "ceilf" && TLI->has(LibFunc::ceilf))) return ConstantFoldFP(ceil, V, Ty); - else if (Name == "cos" && TLI->has(LibFunc::cos)) + else if ((Name == "cos" && TLI->has(LibFunc::cos)) || + (Name == "cosf" && TLI->has(LibFunc::cosf))) return ConstantFoldFP(cos, V, Ty); - else if (Name == "cosh" && TLI->has(LibFunc::cosh)) + else if ((Name == "cosh" && TLI->has(LibFunc::cosh)) || + (Name == "coshf" && TLI->has(LibFunc::coshf))) return ConstantFoldFP(cosh, V, Ty); - else if (Name == "cosf" && TLI->has(LibFunc::cosf)) - return ConstantFoldFP(cos, V, Ty); break; case 'e': - if (Name == "exp" && TLI->has(LibFunc::exp)) + if ((Name == "exp" && TLI->has(LibFunc::exp)) || + (Name == "expf" && TLI->has(LibFunc::expf))) return ConstantFoldFP(exp, V, Ty); - - if (Name == "exp2" && TLI->has(LibFunc::exp2)) { + if ((Name == "exp2" && TLI->has(LibFunc::exp2)) || + (Name == "exp2f" && TLI->has(LibFunc::exp2f))) // Constant fold exp2(x) as pow(2,x) in case the host doesn't have a // C99 library. return ConstantFoldBinaryFP(pow, 2.0, V, Ty); - } break; case 'f': - if (Name == "fabs" && TLI->has(LibFunc::fabs)) + if ((Name == "fabs" && TLI->has(LibFunc::fabs)) || + (Name == "fabsf" && TLI->has(LibFunc::fabsf))) return ConstantFoldFP(fabs, V, Ty); - else if (Name == "floor" && TLI->has(LibFunc::floor)) + else if ((Name == "floor" && TLI->has(LibFunc::floor)) || + (Name == "floorf" && TLI->has(LibFunc::floorf))) return ConstantFoldFP(floor, V, Ty); break; case 'l': - if (Name == "log" && V > 0 && TLI->has(LibFunc::log)) + if ((Name == "log" && V > 0 && TLI->has(LibFunc::log)) || + (Name == "logf" && V > 0 && TLI->has(LibFunc::logf))) return ConstantFoldFP(log, V, Ty); - else if (Name == "log10" && V > 0 && TLI->has(LibFunc::log10)) + else if ((Name == "log10" && V > 0 && TLI->has(LibFunc::log10)) || + (Name == "log10f" && V > 0 && TLI->has(LibFunc::log10f))) return ConstantFoldFP(log10, V, Ty); else if (IntrinsicID == Intrinsic::sqrt && (Ty->isHalfTy() || Ty->isFloatTy() || Ty->isDoubleTy())) { @@ -1548,21 +1562,22 @@ static Constant *ConstantFoldScalarCall(StringRef Name, unsigned IntrinsicID, } break; case 's': - if (Name == "sin" && TLI->has(LibFunc::sin)) + if ((Name == "sin" && TLI->has(LibFunc::sin)) || + (Name == "sinf" && TLI->has(LibFunc::sinf))) return ConstantFoldFP(sin, V, Ty); - else if (Name == "sinh" && TLI->has(LibFunc::sinh)) + else if ((Name == "sinh" && TLI->has(LibFunc::sinh)) || + (Name == "sinhf" && TLI->has(LibFunc::sinhf))) return ConstantFoldFP(sinh, V, Ty); - else if (Name == "sqrt" && V >= 0 && TLI->has(LibFunc::sqrt)) + else if ((Name == "sqrt" && V >= 0 && TLI->has(LibFunc::sqrt)) || + (Name == "sqrtf" && V >= 0 && TLI->has(LibFunc::sqrtf))) return ConstantFoldFP(sqrt, V, Ty); - else if (Name == "sqrtf" && V >= 0 && TLI->has(LibFunc::sqrtf)) - return ConstantFoldFP(sqrt, V, Ty); - else if (Name == "sinf" && TLI->has(LibFunc::sinf)) - return ConstantFoldFP(sin, V, Ty); break; case 't': - if (Name == "tan" && TLI->has(LibFunc::tan)) + if ((Name == "tan" && TLI->has(LibFunc::tan)) || + (Name == "tanf" && TLI->has(LibFunc::tanf))) return ConstantFoldFP(tan, V, Ty); - else if (Name == "tanh" && TLI->has(LibFunc::tanh)) + else if ((Name == "tanh" && TLI->has(LibFunc::tanh)) || + (Name == "tanhf" && TLI->has(LibFunc::tanhf))) return ConstantFoldFP(tanh, V, Ty); break; default: @@ -1665,11 +1680,14 @@ static Constant *ConstantFoldScalarCall(StringRef Name, unsigned IntrinsicID, if (!TLI) return nullptr; - if (Name == "pow" && TLI->has(LibFunc::pow)) + if ((Name == "pow" && TLI->has(LibFunc::pow)) || + (Name == "powf" && TLI->has(LibFunc::powf))) return ConstantFoldBinaryFP(pow, Op1V, Op2V, Ty); - if (Name == "fmod" && TLI->has(LibFunc::fmod)) + if ((Name == "fmod" && TLI->has(LibFunc::fmod)) || + (Name == "fmodf" && TLI->has(LibFunc::fmodf))) return ConstantFoldBinaryFP(fmod, Op1V, Op2V, Ty); - if (Name == "atan2" && TLI->has(LibFunc::atan2)) + if ((Name == "atan2" && TLI->has(LibFunc::atan2)) || + (Name == "atan2f" && TLI->has(LibFunc::atan2f))) return ConstantFoldBinaryFP(atan2, Op1V, Op2V, Ty); } else if (ConstantInt *Op2C = dyn_cast(Operands[1])) { if (IntrinsicID == Intrinsic::powi && Ty->isHalfTy()) diff --git a/llvm/test/Transforms/ConstProp/calls.ll b/llvm/test/Transforms/ConstProp/calls.ll index 7541418b06ec..f1b0e59e9c7b 100644 --- a/llvm/test/Transforms/ConstProp/calls.ll +++ b/llvm/test/Transforms/ConstProp/calls.ll @@ -1,14 +1,47 @@ ; RUN: opt < %s -constprop -S | FileCheck %s ; RUN: opt < %s -constprop -disable-simplify-libcalls -S | FileCheck %s --check-prefix=FNOBUILTIN +declare double @acos(double) +declare double @asin(double) +declare double @atan(double) +declare double @atan2(double, double) +declare double @ceil(double) declare double @cos(double) - -declare double @sin(double) - -declare double @tan(double) - -declare double @sqrt(double) +declare double @cosh(double) +declare double @exp(double) declare double @exp2(double) +declare double @fabs(double) +declare double @floor(double) +declare double @fmod(double, double) +declare double @log(double) +declare double @log10(double) +declare double @pow(double, double) +declare double @sin(double) +declare double @sinh(double) +declare double @sqrt(double) +declare double @tan(double) +declare double @tanh(double) + +declare float @acosf(float) +declare float @asinf(float) +declare float @atanf(float) +declare float @atan2f(float, float) +declare float @ceilf(float) +declare float @cosf(float) +declare float @coshf(float) +declare float @expf(float) +declare float @exp2f(float) +declare float @fabsf(float) +declare float @floorf(float) +declare float @fmodf(float, float) +declare float @logf(float) +declare float @log10f(float) +declare float @powf(float, float) +declare float @sinf(float) +declare float @sinhf(float) +declare float @sqrtf(float) +declare float @tanf(float) +declare float @tanhf(float) define double @T() { ; CHECK-LABEL: @T( @@ -70,6 +103,446 @@ entry: } declare double @llvm.pow.f64(double, double) nounwind readonly +define double @test_acos() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_acos( +; CHECK-NOT: call + %0 = call double @acos(double 3.000000e+00) + ret double %0 +} + +define double @test_asin() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_asin( +; CHECK-NOT: call + %0 = call double @asin(double 3.000000e+00) + ret double %0 +} + +define double @test_atan() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_atan( +; CHECK-NOT: call + %0 = call double @atan(double 3.000000e+00) + ret double %0 +} + +define double @test_atan2() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_atan2( +; CHECK-NOT: call + %0 = call double @atan2(double 3.000000e+00, double 4.000000e+00) + ret double %0 +} + +define double @test_ceil() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_ceil( +; CHECK-NOT: call + %0 = call double @ceil(double 3.000000e+00) + ret double %0 +} + +define double @test_cos() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_cos( +; CHECK-NOT: call + %0 = call double @cos(double 3.000000e+00) + ret double %0 +} + +define double @test_cosh() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_cosh( +; CHECK-NOT: call + %0 = call double @cosh(double 3.000000e+00) + ret double %0 +} + +define double @test_exp() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_exp( +; CHECK-NOT: call + %0 = call double @exp(double 3.000000e+00) + ret double %0 +} + +define double @test_exp2() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_exp2( +; CHECK-NOT: call + %0 = call double @exp2(double 3.000000e+00) + ret double %0 +} + +define double @test_fabs() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_fabs( +; CHECK-NOT: call + %0 = call double @fabs(double 3.000000e+00) + ret double %0 +} + +define double @test_floor() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_floor( +; CHECK-NOT: call + %0 = call double @floor(double 3.000000e+00) + ret double %0 +} + +define double @test_fmod() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_fmod( +; CHECK-NOT: call + %0 = call double @fmod(double 3.000000e+00, double 4.000000e+00) + ret double %0 +} + +define double @test_log() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_log( +; CHECK-NOT: call + %0 = call double @log(double 3.000000e+00) + ret double %0 +} + +define double @test_log10() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_log10( +; CHECK-NOT: call + %0 = call double @log10(double 3.000000e+00) + ret double %0 +} + +define double @test_pow() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_pow( +; CHECK-NOT: call + %0 = call double @pow(double 3.000000e+00, double 4.000000e+00) + ret double %0 +} + +define double @test_sin() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_sin( +; CHECK-NOT: call + %0 = call double @sin(double 3.000000e+00) + ret double %0 +} + +define double @test_sinh() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_sinh( +; CHECK-NOT: call + %0 = call double @sinh(double 3.000000e+00) + ret double %0 +} + +define double @test_sqrt() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_sqrt( +; CHECK-NOT: call + %0 = call double @sqrt(double 3.000000e+00) + ret double %0 +} + +define double @test_tan() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_tan( +; CHECK-NOT: call + %0 = call double @tan(double 3.000000e+00) + ret double %0 +} + +define double @test_tanh() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_tanh( +; CHECK-NOT: call + %0 = call double @tanh(double 3.000000e+00) + ret double %0 +} + +define float @test_acosf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_acosf( +; CHECK-NOT: call + %0 = call float @acosf(float 3.000000e+00) + ret float %0 +} + +define float @test_asinf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_asinf( +; CHECK-NOT: call + %0 = call float @asinf(float 3.000000e+00) + ret float %0 +} + +define float @test_atanf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_atanf( +; CHECK-NOT: call + %0 = call float @atanf(float 3.000000e+00) + ret float %0 +} + +define float @test_atan2f() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_atan2f( +; CHECK-NOT: call + %0 = call float @atan2f(float 3.000000e+00, float 4.000000e+00) + ret float %0 +} + +define float @test_ceilf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_ceilf( +; CHECK-NOT: call + %0 = call float @ceilf(float 3.000000e+00) + ret float %0 +} + +define float @test_cosf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_cosf( +; CHECK-NOT: call + %0 = call float @cosf(float 3.000000e+00) + ret float %0 +} + +define float @test_coshf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_coshf( +; CHECK-NOT: call + %0 = call float @coshf(float 3.000000e+00) + ret float %0 +} + +define float @test_expf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_expf( +; CHECK-NOT: call + %0 = call float @expf(float 3.000000e+00) + ret float %0 +} + +define float @test_exp2f() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_exp2f( +; CHECK-NOT: call + %0 = call float @exp2f(float 3.000000e+00) + ret float %0 +} + +define float @test_fabsf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_fabsf( +; CHECK-NOT: call + %0 = call float @fabsf(float 3.000000e+00) + ret float %0 +} + +define float @test_floorf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_floorf( +; CHECK-NOT: call + %0 = call float @floorf(float 3.000000e+00) + ret float %0 +} + +define float @test_fmodf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_fmodf( +; CHECK-NOT: call + %0 = call float @fmodf(float 3.000000e+00, float 4.000000e+00) + ret float %0 +} + +define float @test_logf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_logf( +; CHECK-NOT: call + %0 = call float @logf(float 3.000000e+00) + ret float %0 +} + +define float @test_log10f() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_log10f( +; CHECK-NOT: call + %0 = call float @log10f(float 3.000000e+00) + ret float %0 +} + +define float @test_powf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_powf( +; CHECK-NOT: call + %0 = call float @powf(float 3.000000e+00, float 4.000000e+00) + ret float %0 +} + +define float @test_sinf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_sinf( +; CHECK-NOT: call + %0 = call float @sinf(float 3.000000e+00) + ret float %0 +} + +define float @test_sinhf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_sinhf( +; CHECK-NOT: call + %0 = call float @sinhf(float 3.000000e+00) + ret float %0 +} + +define float @test_sqrtf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_sqrtf( +; CHECK-NOT: call + %0 = call float @sqrtf(float 3.000000e+00) + ret float %0 +} + +define float @test_tanf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_tanf( +; CHECK-NOT: call + %0 = call float @tanf(float 3.000000e+00) + ret float %0 +} + +define float @test_tanhf() nounwind uwtable ssp { +entry: +; CHECK-LABEL: @test_tanhf( +; CHECK-NOT: call + %0 = call float @tanhf(float 3.000000e+00) + ret float %0 +} + +; Shouldn't fold because of -fno-builtin +define double @acos_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @acos_( +; FNOBUILTIN: %1 = call double @acos(double 3.000000e+00) + %1 = call double @acos(double 3.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @asin_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @asin_( +; FNOBUILTIN: %1 = call double @asin(double 3.000000e+00) + %1 = call double @asin(double 3.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @atan_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @atan_( +; FNOBUILTIN: %1 = call double @atan(double 3.000000e+00) + %1 = call double @atan(double 3.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @atan2_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @atan2_( +; FNOBUILTIN: %1 = call double @atan2(double 3.000000e+00, double 4.000000e+00) + %1 = call double @atan2(double 3.000000e+00, double 4.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @ceil_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @ceil_( +; FNOBUILTIN: %1 = call double @ceil(double 3.000000e+00) + %1 = call double @ceil(double 3.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @cos_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @cos_( +; FNOBUILTIN: %1 = call double @cos(double 3.000000e+00) + %1 = call double @cos(double 3.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @cosh_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @cosh_( +; FNOBUILTIN: %1 = call double @cosh(double 3.000000e+00) + %1 = call double @cosh(double 3.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @exp_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @exp_( +; FNOBUILTIN: %1 = call double @exp(double 3.000000e+00) + %1 = call double @exp(double 3.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @exp2_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @exp2_( +; FNOBUILTIN: %1 = call double @exp2(double 3.000000e+00) + %1 = call double @exp2(double 3.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @fabs_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @fabs_( +; FNOBUILTIN: %1 = call double @fabs(double 3.000000e+00) + %1 = call double @fabs(double 3.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @floor_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @floor_( +; FNOBUILTIN: %1 = call double @floor(double 3.000000e+00) + %1 = call double @floor(double 3.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @fmod_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @fmod_( +; FNOBUILTIN: %1 = call double @fmod(double 3.000000e+00, double 4.000000e+00) + %1 = call double @fmod(double 3.000000e+00, double 4.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @log_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @log_( +; FNOBUILTIN: %1 = call double @log(double 3.000000e+00) + %1 = call double @log(double 3.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @log10_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @log10_( +; FNOBUILTIN: %1 = call double @log10(double 3.000000e+00) + %1 = call double @log10(double 3.000000e+00) + ret double %1 +} + +; Shouldn't fold because of -fno-builtin +define double @pow_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @pow_( +; FNOBUILTIN: %1 = call double @pow(double 3.000000e+00, double 4.000000e+00) + %1 = call double @pow(double 3.000000e+00, double 4.000000e+00) + ret double %1 +} + ; Shouldn't fold because of -fno-builtin define double @sin_() nounwind uwtable ssp { ; FNOBUILTIN-LABEL: @sin_( @@ -78,6 +551,14 @@ define double @sin_() nounwind uwtable ssp { ret double %1 } +; Shouldn't fold because of -fno-builtin +define double @sinh_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @sinh_( +; FNOBUILTIN: %1 = call double @sinh(double 3.000000e+00) + %1 = call double @sinh(double 3.000000e+00) + ret double %1 +} + ; Shouldn't fold because of -fno-builtin define double @sqrt_() nounwind uwtable ssp { ; FNOBUILTIN-LABEL: @sqrt_( @@ -86,24 +567,6 @@ define double @sqrt_() nounwind uwtable ssp { ret double %1 } -; Shouldn't fold because of -fno-builtin -define float @sqrtf_() nounwind uwtable ssp { -; FNOBUILTIN-LABEL: @sqrtf_( -; FNOBUILTIN: %1 = call float @sqrtf(float 3.000000e+00) - %1 = call float @sqrtf(float 3.000000e+00) - ret float %1 -} -declare float @sqrtf(float) - -; Shouldn't fold because of -fno-builtin -define float @sinf_() nounwind uwtable ssp { -; FNOBUILTIN-LABEL: @sinf_( -; FNOBUILTIN: %1 = call float @sinf(float 3.000000e+00) - %1 = call float @sinf(float 3.000000e+00) - ret float %1 -} -declare float @sinf(float) - ; Shouldn't fold because of -fno-builtin define double @tan_() nounwind uwtable ssp { ; FNOBUILTIN-LABEL: @tan_( @@ -119,31 +582,163 @@ define double @tanh_() nounwind uwtable ssp { %1 = call double @tanh(double 3.000000e+00) ret double %1 } -declare double @tanh(double) ; Shouldn't fold because of -fno-builtin -define double @pow_() nounwind uwtable ssp { -; FNOBUILTIN-LABEL: @pow_( -; FNOBUILTIN: %1 = call double @pow(double 3.000000e+00, double 3.000000e+00) - %1 = call double @pow(double 3.000000e+00, double 3.000000e+00) - ret double %1 +define float @acosf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @acosf_( +; FNOBUILTIN: %1 = call float @acosf(float 3.000000e+00) + %1 = call float @acosf(float 3.000000e+00) + ret float %1 } -declare double @pow(double, double) ; Shouldn't fold because of -fno-builtin -define double @fmod_() nounwind uwtable ssp { -; FNOBUILTIN-LABEL: @fmod_( -; FNOBUILTIN: %1 = call double @fmod(double 3.000000e+00, double 3.000000e+00) - %1 = call double @fmod(double 3.000000e+00, double 3.000000e+00) - ret double %1 +define float @asinf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @asinf_( +; FNOBUILTIN: %1 = call float @asinf(float 3.000000e+00) + %1 = call float @asinf(float 3.000000e+00) + ret float %1 } -declare double @fmod(double, double) ; Shouldn't fold because of -fno-builtin -define double @atan2_() nounwind uwtable ssp { -; FNOBUILTIN-LABEL: @atan2_( -; FNOBUILTIN: %1 = call double @atan2(double 3.000000e+00, double 3.000000e+00) - %1 = call double @atan2(double 3.000000e+00, double 3.000000e+00) - ret double %1 +define float @atanf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @atanf_( +; FNOBUILTIN: %1 = call float @atanf(float 3.000000e+00) + %1 = call float @atanf(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @atan2f_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @atan2f_( +; FNOBUILTIN: %1 = call float @atan2f(float 3.000000e+00, float 4.000000e+00) + %1 = call float @atan2f(float 3.000000e+00, float 4.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @ceilf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @ceilf_( +; FNOBUILTIN: %1 = call float @ceilf(float 3.000000e+00) + %1 = call float @ceilf(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @cosf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @cosf_( +; FNOBUILTIN: %1 = call float @cosf(float 3.000000e+00) + %1 = call float @cosf(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @coshf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @coshf_( +; FNOBUILTIN: %1 = call float @coshf(float 3.000000e+00) + %1 = call float @coshf(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @expf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @expf_( +; FNOBUILTIN: %1 = call float @expf(float 3.000000e+00) + %1 = call float @expf(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @exp2f_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @exp2f_( +; FNOBUILTIN: %1 = call float @exp2f(float 3.000000e+00) + %1 = call float @exp2f(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @fabsf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @fabsf_( +; FNOBUILTIN: %1 = call float @fabsf(float 3.000000e+00) + %1 = call float @fabsf(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @floorf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @floorf_( +; FNOBUILTIN: %1 = call float @floorf(float 3.000000e+00) + %1 = call float @floorf(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @fmodf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @fmodf_( +; FNOBUILTIN: %1 = call float @fmodf(float 3.000000e+00, float 4.000000e+00) + %1 = call float @fmodf(float 3.000000e+00, float 4.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @logf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @logf_( +; FNOBUILTIN: %1 = call float @logf(float 3.000000e+00) + %1 = call float @logf(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @log10f_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @log10f_( +; FNOBUILTIN: %1 = call float @log10f(float 3.000000e+00) + %1 = call float @log10f(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @powf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @powf_( +; FNOBUILTIN: %1 = call float @powf(float 3.000000e+00, float 4.000000e+00) + %1 = call float @powf(float 3.000000e+00, float 4.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @sinf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @sinf_( +; FNOBUILTIN: %1 = call float @sinf(float 3.000000e+00) + %1 = call float @sinf(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @sinhf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @sinhf_( +; FNOBUILTIN: %1 = call float @sinhf(float 3.000000e+00) + %1 = call float @sinhf(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @sqrtf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @sqrtf_( +; FNOBUILTIN: %1 = call float @sqrtf(float 3.000000e+00) + %1 = call float @sqrtf(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @tanf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @tanf_( +; FNOBUILTIN: %1 = call float @tanf(float 3.000000e+00) + %1 = call float @tanf(float 3.000000e+00) + ret float %1 +} + +; Shouldn't fold because of -fno-builtin +define float @tanhf_() nounwind uwtable ssp { +; FNOBUILTIN-LABEL: @tanhf_( +; FNOBUILTIN: %1 = call float @tanhf(float 3.000000e+00) + %1 = call float @tanhf(float 3.000000e+00) + ret float %1 } -declare double @atan2(double, double)