Index: cfe/trunk/lib/CodeGen/CGBuiltin.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp @@ -854,6 +854,179 @@ Result.Val.getFloat())); } + // Math builtins have the same semantics as their math library twins. + // There are LLVM math intrinsics corresponding to math library functions + // except the intrinsic will never set errno while the math library might. + // Thus, we can transform math library and builtin calls to their + // semantically-equivalent LLVM intrinsic counterparts if the call is marked + // 'const' (it is known to never set errno). + if (FD->hasAttr()) { + switch (BuiltinID) { + case Builtin::BIceil: + case Builtin::BIceilf: + case Builtin::BIceill: + case Builtin::BI__builtin_ceil: + case Builtin::BI__builtin_ceilf: + case Builtin::BI__builtin_ceill: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::ceil)); + + case Builtin::BIcopysign: + case Builtin::BIcopysignf: + case Builtin::BIcopysignl: + case Builtin::BI__builtin_copysign: + case Builtin::BI__builtin_copysignf: + case Builtin::BI__builtin_copysignl: + return RValue::get(emitBinaryBuiltin(*this, E, Intrinsic::copysign)); + + case Builtin::BIcos: + case Builtin::BIcosf: + case Builtin::BIcosl: + case Builtin::BI__builtin_cos: + case Builtin::BI__builtin_cosf: + case Builtin::BI__builtin_cosl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::cos)); + + case Builtin::BIexp: + case Builtin::BIexpf: + case Builtin::BIexpl: + case Builtin::BI__builtin_exp: + case Builtin::BI__builtin_expf: + case Builtin::BI__builtin_expl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::exp)); + + case Builtin::BIexp2: + case Builtin::BIexp2f: + case Builtin::BIexp2l: + case Builtin::BI__builtin_exp2: + case Builtin::BI__builtin_exp2f: + case Builtin::BI__builtin_exp2l: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::exp2)); + + case Builtin::BIfabs: + case Builtin::BIfabsf: + case Builtin::BIfabsl: + case Builtin::BI__builtin_fabs: + case Builtin::BI__builtin_fabsf: + case Builtin::BI__builtin_fabsl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::fabs)); + + case Builtin::BIfloor: + case Builtin::BIfloorf: + case Builtin::BIfloorl: + case Builtin::BI__builtin_floor: + case Builtin::BI__builtin_floorf: + case Builtin::BI__builtin_floorl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::floor)); + + case Builtin::BIfma: + case Builtin::BIfmaf: + case Builtin::BIfmal: + case Builtin::BI__builtin_fma: + case Builtin::BI__builtin_fmaf: + case Builtin::BI__builtin_fmal: + return RValue::get(emitTernaryBuiltin(*this, E, Intrinsic::fma)); + + case Builtin::BIfmax: + case Builtin::BIfmaxf: + case Builtin::BIfmaxl: + case Builtin::BI__builtin_fmax: + case Builtin::BI__builtin_fmaxf: + case Builtin::BI__builtin_fmaxl: + return RValue::get(emitBinaryBuiltin(*this, E, Intrinsic::maxnum)); + + case Builtin::BIfmin: + case Builtin::BIfminf: + case Builtin::BIfminl: + case Builtin::BI__builtin_fmin: + case Builtin::BI__builtin_fminf: + case Builtin::BI__builtin_fminl: + return RValue::get(emitBinaryBuiltin(*this, E, Intrinsic::minnum)); + + case Builtin::BIlog: + case Builtin::BIlogf: + case Builtin::BIlogl: + case Builtin::BI__builtin_log: + case Builtin::BI__builtin_logf: + case Builtin::BI__builtin_logl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::log)); + + case Builtin::BIlog10: + case Builtin::BIlog10f: + case Builtin::BIlog10l: + case Builtin::BI__builtin_log10: + case Builtin::BI__builtin_log10f: + case Builtin::BI__builtin_log10l: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::log10)); + + case Builtin::BIlog2: + case Builtin::BIlog2f: + case Builtin::BIlog2l: + case Builtin::BI__builtin_log2: + case Builtin::BI__builtin_log2f: + case Builtin::BI__builtin_log2l: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::log2)); + + case Builtin::BInearbyint: + case Builtin::BInearbyintf: + case Builtin::BInearbyintl: + case Builtin::BI__builtin_nearbyint: + case Builtin::BI__builtin_nearbyintf: + case Builtin::BI__builtin_nearbyintl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::nearbyint)); + + case Builtin::BIpow: + case Builtin::BIpowf: + case Builtin::BIpowl: + case Builtin::BI__builtin_pow: + case Builtin::BI__builtin_powf: + case Builtin::BI__builtin_powl: + return RValue::get(emitBinaryBuiltin(*this, E, Intrinsic::pow)); + + case Builtin::BIrint: + case Builtin::BIrintf: + case Builtin::BIrintl: + case Builtin::BI__builtin_rint: + case Builtin::BI__builtin_rintf: + case Builtin::BI__builtin_rintl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::rint)); + + case Builtin::BIround: + case Builtin::BIroundf: + case Builtin::BIroundl: + case Builtin::BI__builtin_round: + case Builtin::BI__builtin_roundf: + case Builtin::BI__builtin_roundl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::round)); + + case Builtin::BIsin: + case Builtin::BIsinf: + case Builtin::BIsinl: + case Builtin::BI__builtin_sin: + case Builtin::BI__builtin_sinf: + case Builtin::BI__builtin_sinl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::sin)); + + case Builtin::BIsqrt: + case Builtin::BIsqrtf: + case Builtin::BIsqrtl: + case Builtin::BI__builtin_sqrt: + case Builtin::BI__builtin_sqrtf: + case Builtin::BI__builtin_sqrtl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::sqrt)); + + case Builtin::BItrunc: + case Builtin::BItruncf: + case Builtin::BItruncl: + case Builtin::BI__builtin_trunc: + case Builtin::BI__builtin_truncf: + case Builtin::BI__builtin_truncl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::trunc)); + + default: + break; + } + } + switch (BuiltinID) { default: break; // Handle intrinsics and libm functions below. case Builtin::BI__builtin___CFStringMakeConstantString: @@ -894,11 +1067,6 @@ return RValue::get(Result); } - case Builtin::BI__builtin_fabs: - case Builtin::BI__builtin_fabsf: - case Builtin::BI__builtin_fabsl: { - return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::fabs)); - } case Builtin::BI__builtin_fmod: case Builtin::BI__builtin_fmodf: case Builtin::BI__builtin_fmodl: { @@ -907,51 +1075,6 @@ Value *Result = Builder.CreateFRem(Arg1, Arg2, "fmod"); return RValue::get(Result); } - case Builtin::BI__builtin_copysign: - case Builtin::BI__builtin_copysignf: - case Builtin::BI__builtin_copysignl: { - return RValue::get(emitBinaryBuiltin(*this, E, Intrinsic::copysign)); - } - case Builtin::BI__builtin_ceil: - case Builtin::BI__builtin_ceilf: - case Builtin::BI__builtin_ceill: { - return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::ceil)); - } - case Builtin::BI__builtin_floor: - case Builtin::BI__builtin_floorf: - case Builtin::BI__builtin_floorl: { - return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::floor)); - } - case Builtin::BI__builtin_trunc: - case Builtin::BI__builtin_truncf: - case Builtin::BI__builtin_truncl: { - return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::trunc)); - } - case Builtin::BI__builtin_rint: - case Builtin::BI__builtin_rintf: - case Builtin::BI__builtin_rintl: { - return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::rint)); - } - case Builtin::BI__builtin_nearbyint: - case Builtin::BI__builtin_nearbyintf: - case Builtin::BI__builtin_nearbyintl: { - return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::nearbyint)); - } - case Builtin::BI__builtin_round: - case Builtin::BI__builtin_roundf: - case Builtin::BI__builtin_roundl: { - return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::round)); - } - case Builtin::BI__builtin_fmin: - case Builtin::BI__builtin_fminf: - case Builtin::BI__builtin_fminl: { - return RValue::get(emitBinaryBuiltin(*this, E, Intrinsic::minnum)); - } - case Builtin::BI__builtin_fmax: - case Builtin::BI__builtin_fmaxf: - case Builtin::BI__builtin_fmaxl: { - return RValue::get(emitBinaryBuiltin(*this, E, Intrinsic::maxnum)); - } case Builtin::BI__builtin_conj: case Builtin::BI__builtin_conjf: case Builtin::BI__builtin_conjl: { @@ -2073,49 +2196,6 @@ return RValue::get(nullptr); } - case Builtin::BIsqrt: - case Builtin::BIsqrtf: - case Builtin::BIsqrtl: - // Builtins have the same semantics as library functions. The LLVM intrinsic - // has the same semantics as the library function except it does not set - // errno. Thus, we can transform either sqrt or __builtin_sqrt to @llvm.sqrt - // if the call is 'const' (the call must not set errno). - // - // FIXME: The builtin cases are not here because they are marked 'const' in - // Builtins.def. So that means they are wrongly defined to have different - // semantics than the library functions. If we included them here, we would - // turn them into LLVM intrinsics regardless of whether -fmath-errno was on. - if (FD->hasAttr()) - return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::sqrt)); - break; - - case Builtin::BI__builtin_pow: - case Builtin::BI__builtin_powf: - case Builtin::BI__builtin_powl: - case Builtin::BIpow: - case Builtin::BIpowf: - case Builtin::BIpowl: { - // Transform a call to pow* into a @llvm.pow.* intrinsic call. - if (!FD->hasAttr()) - break; - Value *Base = EmitScalarExpr(E->getArg(0)); - Value *Exponent = EmitScalarExpr(E->getArg(1)); - llvm::Type *ArgType = Base->getType(); - Value *F = CGM.getIntrinsic(Intrinsic::pow, ArgType); - return RValue::get(Builder.CreateCall(F, {Base, Exponent})); - } - - case Builtin::BIfma: - case Builtin::BIfmaf: - case Builtin::BIfmal: - case Builtin::BI__builtin_fma: - case Builtin::BI__builtin_fmaf: - case Builtin::BI__builtin_fmal: - // A constant libcall or builtin is equivalent to the LLVM intrinsic. - if (FD->hasAttr()) - return RValue::get(emitTernaryBuiltin(*this, E, Intrinsic::fma)); - break; - case Builtin::BI__builtin_signbit: case Builtin::BI__builtin_signbitf: case Builtin::BI__builtin_signbitl: { Index: cfe/trunk/test/CodeGen/builtin-sqrt.c =================================================================== --- cfe/trunk/test/CodeGen/builtin-sqrt.c +++ cfe/trunk/test/CodeGen/builtin-sqrt.c @@ -1,17 +1,15 @@ // RUN: %clang_cc1 -fmath-errno -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s --check-prefix=HAS_ERRNO // RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s --check-prefix=NO_ERRNO -// FIXME: If the builtin does not set errno, it should be converted to an LLVM intrinsic. - float foo(float X) { // HAS_ERRNO: call float @sqrtf(float - // NO_ERRNO: call float @sqrtf(float + // NO_ERRNO: call float @llvm.sqrt.f32(float return __builtin_sqrtf(X); } // HAS_ERRNO: declare float @sqrtf(float) [[ATTR:#[0-9]+]] // HAS_ERRNO-NOT: attributes [[ATTR]] = {{{.*}} readnone -// NO_ERRNO: declare float @sqrtf(float) [[ATTR:#[0-9]+]] +// NO_ERRNO: declare float @llvm.sqrt.f32(float) [[ATTR:#[0-9]+]] // NO_ERRNO: attributes [[ATTR]] = { nounwind readnone {{.*}}} Index: cfe/trunk/test/CodeGen/builtins.c =================================================================== --- cfe/trunk/test/CodeGen/builtins.c +++ cfe/trunk/test/CodeGen/builtins.c @@ -331,13 +331,13 @@ // CHECK: call x86_fp80 @llvm.floor.f80 resf = __builtin_sqrtf(F); - // CHECK: call float @sqrtf( + // CHECK: call float @llvm.sqrt.f32( resd = __builtin_sqrt(D); - // CHECK: call double @sqrt( + // CHECK: call double @llvm.sqrt.f64( resld = __builtin_sqrtl(LD); - // CHECK: call x86_fp80 @sqrtl( + // CHECK: call x86_fp80 @llvm.sqrt.f80 resf = __builtin_truncf(F); // CHECK: call float @llvm.trunc.f32 Index: cfe/trunk/test/CodeGen/libcalls.c =================================================================== --- cfe/trunk/test/CodeGen/libcalls.c +++ cfe/trunk/test/CodeGen/libcalls.c @@ -105,9 +105,9 @@ double exp_ = exp(d); long double expl_ = expl(ld); float expf_ = expf(f); -// CHECK-NO: declare double @exp(double) [[NUW_RN]] -// CHECK-NO: declare x86_fp80 @expl(x86_fp80) [[NUW_RN]] -// CHECK-NO: declare float @expf(float) [[NUW_RN]] +// CHECK-NO: declare double @llvm.exp.f64(double) [[NUW_RNI]] +// CHECK-NO: declare x86_fp80 @llvm.exp.f80(x86_fp80) [[NUW_RNI]] +// CHECK-NO: declare float @llvm.exp.f32(float) [[NUW_RNI]] // CHECK-YES-NOT: declare double @exp(double) [[NUW_RN]] // CHECK-YES-NOT: declare x86_fp80 @expl(x86_fp80) [[NUW_RN]] // CHECK-YES-NOT: declare float @expf(float) [[NUW_RN]] @@ -115,9 +115,9 @@ double log_ = log(d); long double logl_ = logl(ld); float logf_ = logf(f); -// CHECK-NO: declare double @log(double) [[NUW_RN]] -// CHECK-NO: declare x86_fp80 @logl(x86_fp80) [[NUW_RN]] -// CHECK-NO: declare float @logf(float) [[NUW_RN]] +// CHECK-NO: declare double @llvm.log.f64(double) [[NUW_RNI]] +// CHECK-NO: declare x86_fp80 @llvm.log.f80(x86_fp80) [[NUW_RNI]] +// CHECK-NO: declare float @llvm.log.f32(float) [[NUW_RNI]] // CHECK-YES-NOT: declare double @log(double) [[NUW_RN]] // CHECK-YES-NOT: declare x86_fp80 @logl(x86_fp80) [[NUW_RN]] // CHECK-YES-NOT: declare float @logf(float) [[NUW_RN]] Index: cfe/trunk/test/CodeGen/math-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/math-builtins.c +++ cfe/trunk/test/CodeGen/math-builtins.c @@ -192,9 +192,9 @@ __builtin_cos(f); __builtin_cosf(f); __builtin_cosl(f); -// NO__ERRNO: declare double @cos(double) [[READNONE]] -// NO__ERRNO: declare float @cosf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @cosl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.cos.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.cos.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.cos.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @cos(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @cosf(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @cosl(x86_fp80) [[NOT_READNONE]] @@ -228,18 +228,18 @@ __builtin_exp(f); __builtin_expf(f); __builtin_expl(f); -// NO__ERRNO: declare double @exp(double) [[READNONE]] -// NO__ERRNO: declare float @expf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @expl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.exp.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.exp.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.exp.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @exp(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @expf(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @expl(x86_fp80) [[NOT_READNONE]] __builtin_exp2(f); __builtin_exp2f(f); __builtin_exp2l(f); -// NO__ERRNO: declare double @exp2(double) [[READNONE]] -// NO__ERRNO: declare float @exp2f(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.exp2.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.exp2.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.exp2.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @exp2(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @exp2f(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[NOT_READNONE]] @@ -356,18 +356,18 @@ __builtin_log(f); __builtin_logf(f); __builtin_logl(f); -// NO__ERRNO: declare double @log(double) [[READNONE]] -// NO__ERRNO: declare float @logf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @logl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.log.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.log.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.log.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @log(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @logf(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @logl(x86_fp80) [[NOT_READNONE]] __builtin_log10(f); __builtin_log10f(f); __builtin_log10l(f); -// NO__ERRNO: declare double @log10(double) [[READNONE]] -// NO__ERRNO: declare float @log10f(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @log10l(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.log10.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.log10.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.log10.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @log10(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @log10f(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @log10l(x86_fp80) [[NOT_READNONE]] @@ -383,9 +383,9 @@ __builtin_log2(f); __builtin_log2f(f); __builtin_log2l(f); -// NO__ERRNO: declare double @log2(double) [[READNONE]] -// NO__ERRNO: declare float @log2f(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @log2l(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.log2.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.log2.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.log2.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @log2(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @log2f(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @log2l(x86_fp80) [[NOT_READNONE]] @@ -500,9 +500,9 @@ __builtin_sin(f); __builtin_sinf(f); __builtin_sinl(f); -// NO__ERRNO: declare double @sin(double) [[READNONE]] -// NO__ERRNO: declare float @sinf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @sinl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.sin.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.sin.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.sin.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @sin(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @sinf(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @sinl(x86_fp80) [[NOT_READNONE]] @@ -518,9 +518,9 @@ __builtin_sqrt(f); __builtin_sqrtf(f); __builtin_sqrtl(f); -// NO__ERRNO: declare double @sqrt(double) [[READNONE]] -// NO__ERRNO: declare float @sqrtf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @sqrtl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.sqrt.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.sqrt.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.sqrt.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @sqrt(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @sqrtf(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @sqrtl(x86_fp80) [[NOT_READNONE]] Index: cfe/trunk/test/CodeGen/math-libcalls.c =================================================================== --- cfe/trunk/test/CodeGen/math-libcalls.c +++ cfe/trunk/test/CodeGen/math-libcalls.c @@ -17,21 +17,21 @@ copysign(f,f); copysignf(f,f);copysignl(f,f); -// NO__ERRNO: declare double @copysign(double, double) [[READNONE]] -// NO__ERRNO: declare float @copysignf(float, float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @copysignl(x86_fp80, x86_fp80) [[READNONE]] -// HAS_ERRNO: declare double @copysign(double, double) [[READNONE:#[0-9]+]] -// HAS_ERRNO: declare float @copysignf(float, float) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @copysignl(x86_fp80, x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]] +// NO__ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]] +// HAS_ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] fabs(f); fabsf(f); fabsl(f); -// NO__ERRNO: declare double @fabs(double) [[READNONE]] -// NO__ERRNO: declare float @fabsf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @fabsl(x86_fp80) [[READNONE]] -// HAS_ERRNO: declare double @fabs(double) [[READNONE]] -// HAS_ERRNO: declare float @fabsf(float) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @fabsl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]] fmod(f,f); fmodf(f,f); fmodl(f,f); @@ -80,7 +80,7 @@ pow(f,f); powf(f,f); powl(f,f); -// NO__ERRNO: declare double @llvm.pow.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]] +// NO__ERRNO: declare double @llvm.pow.f64(double, double) [[READNONE_INTRINSIC]] // NO__ERRNO: declare float @llvm.pow.f32(float, float) [[READNONE_INTRINSIC]] // NO__ERRNO: declare x86_fp80 @llvm.pow.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @pow(double, double) [[NOT_READNONE]] @@ -147,24 +147,24 @@ // NO__ERRNO: declare double @cbrt(double) [[READNONE]] // NO__ERRNO: declare float @cbrtf(float) [[READNONE]] // NO__ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]] -// HAS_ERRNO: declare double @cbrt(double) [[READNONE]] +// HAS_ERRNO: declare double @cbrt(double) [[READNONE:#[0-9]+]] // HAS_ERRNO: declare float @cbrtf(float) [[READNONE]] // HAS_ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]] ceil(f); ceilf(f); ceill(f); -// NO__ERRNO: declare double @ceil(double) [[READNONE]] -// NO__ERRNO: declare float @ceilf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @ceill(x86_fp80) [[READNONE]] -// HAS_ERRNO: declare double @ceil(double) [[READNONE]] -// HAS_ERRNO: declare float @ceilf(float) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @ceill(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]] cos(f); cosf(f); cosl(f); -// NO__ERRNO: declare double @cos(double) [[READNONE]] -// NO__ERRNO: declare float @cosf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @cosl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.cos.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.cos.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.cos.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @cos(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @cosf(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @cosl(x86_fp80) [[NOT_READNONE]] @@ -198,18 +198,18 @@ exp(f); expf(f); expl(f); -// NO__ERRNO: declare double @exp(double) [[READNONE]] -// NO__ERRNO: declare float @expf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @expl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.exp.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.exp.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.exp.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @exp(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @expf(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @expl(x86_fp80) [[NOT_READNONE]] exp2(f); exp2f(f); exp2l(f); -// NO__ERRNO: declare double @exp2(double) [[READNONE]] -// NO__ERRNO: declare float @exp2f(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.exp2.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.exp2.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.exp2.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @exp2(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @exp2f(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[NOT_READNONE]] @@ -234,12 +234,12 @@ floor(f); floorf(f); floorl(f); -// NO__ERRNO: declare double @floor(double) [[READNONE]] -// NO__ERRNO: declare float @floorf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @floorl(x86_fp80) [[READNONE]] -// HAS_ERRNO: declare double @floor(double) [[READNONE]] -// HAS_ERRNO: declare float @floorf(float) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @floorl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]] fma(f,f,f); fmaf(f,f,f); fmal(f,f,f); @@ -263,21 +263,21 @@ fmax(f,f); fmaxf(f,f); fmaxl(f,f); -// NO__ERRNO: declare double @fmax(double, double) [[READNONE]] -// NO__ERRNO: declare float @fmaxf(float, float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @fmaxl(x86_fp80, x86_fp80) [[READNONE]] -// HAS_ERRNO: declare double @fmax(double, double) [[READNONE]] -// HAS_ERRNO: declare float @fmaxf(float, float) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @fmaxl(x86_fp80, x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] fmin(f,f); fminf(f,f); fminl(f,f); -// NO__ERRNO: declare double @fmin(double, double) [[READNONE]] -// NO__ERRNO: declare float @fminf(float, float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @fminl(x86_fp80, x86_fp80) [[READNONE]] -// HAS_ERRNO: declare double @fmin(double, double) [[READNONE]] -// HAS_ERRNO: declare float @fminf(float, float) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @fminl(x86_fp80, x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] hypot(f,f); hypotf(f,f); hypotl(f,f); @@ -326,18 +326,18 @@ log(f); logf(f); logl(f); -// NO__ERRNO: declare double @log(double) [[READNONE]] -// NO__ERRNO: declare float @logf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @logl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.log.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.log.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.log.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @log(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @logf(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @logl(x86_fp80) [[NOT_READNONE]] log10(f); log10f(f); log10l(f); -// NO__ERRNO: declare double @log10(double) [[READNONE]] -// NO__ERRNO: declare float @log10f(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @log10l(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.log10.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.log10.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.log10.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @log10(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @log10f(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @log10l(x86_fp80) [[NOT_READNONE]] @@ -353,9 +353,9 @@ log2(f); log2f(f); log2l(f); -// NO__ERRNO: declare double @log2(double) [[READNONE]] -// NO__ERRNO: declare float @log2f(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @log2l(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.log2.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.log2.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.log2.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @log2(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @log2f(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @log2l(x86_fp80) [[NOT_READNONE]] @@ -389,12 +389,12 @@ nearbyint(f); nearbyintf(f); nearbyintl(f); -// NO__ERRNO: declare double @nearbyint(double) [[READNONE]] -// NO__ERRNO: declare float @nearbyintf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @nearbyintl(x86_fp80) [[READNONE]] -// HAS_ERRNO: declare double @nearbyint(double) [[READNONE]] -// HAS_ERRNO: declare float @nearbyintf(float) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @nearbyintl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]] nextafter(f,f); nextafterf(f,f); nextafterl(f,f); @@ -434,21 +434,21 @@ rint(f); rintf(f); rintl(f); -// NO__ERRNO: declare double @rint(double) [[READNONE]] -// NO__ERRNO: declare float @rintf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @rintl(x86_fp80) [[READNONE]] -// HAS_ERRNO: declare double @rint(double) [[READNONE]] -// HAS_ERRNO: declare float @rintf(float) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @rintl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]] round(f); roundf(f); roundl(f); -// NO__ERRNO: declare double @round(double) [[READNONE]] -// NO__ERRNO: declare float @roundf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @roundl(x86_fp80) [[READNONE]] -// HAS_ERRNO: declare double @round(double) [[READNONE]] -// HAS_ERRNO: declare float @roundf(float) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @roundl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]] scalbln(f,f); scalblnf(f,f); scalblnl(f,f); @@ -470,9 +470,9 @@ sin(f); sinf(f); sinl(f); -// NO__ERRNO: declare double @sin(double) [[READNONE]] -// NO__ERRNO: declare float @sinf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @sinl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.sin.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.sin.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.sin.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare double @sin(double) [[NOT_READNONE]] // HAS_ERRNO: declare float @sinf(float) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @sinl(x86_fp80) [[NOT_READNONE]] @@ -524,23 +524,24 @@ trunc(f); truncf(f); truncl(f); -// NO__ERRNO: declare double @trunc(double) [[READNONE]] -// NO__ERRNO: declare float @truncf(float) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @truncl(x86_fp80) [[READNONE]] -// HAS_ERRNO: declare double @trunc(double) [[READNONE]] -// HAS_ERRNO: declare float @truncf(float) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @truncl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]] }; // NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } +// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} } // NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} } // NO__ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} } -// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} } // HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} } -// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } +// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} } // HAS_ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} } +// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} } // HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }