Skip to content

Commit

Permalink
[clang] Emit constraint intrinsics for arc and hyperbolic trig clang …
Browse files Browse the repository at this point in the history
…builtins (#98949)

## Change(s)
- `Builtins.td` - Add f16 support for libm arc and hyperbolic trig
functions
- `CGBuiltin.cpp` - Emit constraint intrinsics for trig clang builtins

## History
This change is part of an implementation of
#87367 investigation on
supporting IEEE math operations as intrinsics. Which was discussed in
this RFC:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

This change adds wasm lowering cases for `acos`, `asin`, `atan`, `cosh`,
`sinh`, and `tanh`.

#70079
#70080
#70081
#70083
#70084
#95966

## Precursor PR(s)

Note this PR needs Merge after:
- #98937
- #98755
  • Loading branch information
farzonl authored Jul 19, 2024
1 parent def3944 commit a14baec
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 82 deletions.
36 changes: 18 additions & 18 deletions clang/include/clang/Basic/Builtins.td
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ class BitInt_Long_LongLongTemplate :
// - _Constant: Argument has to constant-fold to an integer constant expression

// __fp16 and __float128 builtin variants of libc/libm functions.
def AcosF128 : Builtin {
let Spellings = ["__builtin_acosf128"];
def AcosF16F128 : Builtin, F16F128MathTemplate {
let Spellings = ["__builtin_acos"];
let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
ConstIgnoringErrnoAndExceptions];
let Prototype = "__float128(__float128)";
let Prototype = "T(T)";
}

def AcoshF128 : Builtin {
Expand All @@ -97,11 +97,11 @@ def AcoshF128 : Builtin {
let Prototype = "__float128(__float128)";
}

def AsinF128 : Builtin {
let Spellings = ["__builtin_asinf128"];
def AsinF16F128 : Builtin, F16F128MathTemplate {
let Spellings = ["__builtin_asin"];
let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
ConstIgnoringErrnoAndExceptions];
let Prototype = "__float128(__float128)";
let Prototype = "T(T)";
}

def AsinhF128 : Builtin {
Expand All @@ -111,11 +111,11 @@ def AsinhF128 : Builtin {
let Prototype = "__float128(__float128)";
}

def AtanF128 : Builtin {
let Spellings = ["__builtin_atanf128"];
def AtanF16F128 : Builtin, F16F128MathTemplate {
let Spellings = ["__builtin_atan"];
let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
ConstIgnoringErrnoAndExceptions];
let Prototype = "__float128(__float128)";
let Prototype = "T(T)";
}

def AtanhF128 : Builtin {
Expand Down Expand Up @@ -143,10 +143,10 @@ def CosF16F128 : Builtin, F16F128MathTemplate {
let Prototype = "T(T)";
}

def CoshF128 : Builtin {
let Spellings = ["__builtin_coshf128"];
def CoshF16F128 : Builtin, F16F128MathTemplate {
let Spellings = ["__builtin_cosh"];
let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "__float128(__float128)";
let Prototype = "T(T)";
}

def ErfF128 : Builtin {
Expand Down Expand Up @@ -468,11 +468,11 @@ def SinF16F128 : Builtin, F16F128MathTemplate {
let Prototype = "T(T)";
}

def SinhF128 : Builtin {
let Spellings = ["__builtin_sinhf128"];
def SinhF16F128 : Builtin, F16F128MathTemplate {
let Spellings = ["__builtin_sinh"];
let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
ConstIgnoringErrnoAndExceptions];
let Prototype = "__float128(__float128)";
let Prototype = "T(T)";
}

def SqrtF16F128 : Builtin, F16F128MathTemplate {
Expand All @@ -489,11 +489,11 @@ def TanF16F128 : Builtin, F16F128MathTemplate {
let Prototype = "T(T)";
}

def TanhF128 : Builtin {
let Spellings = ["__builtin_tanhf128"];
def TanhF16F128 : Builtin, F16F128MathTemplate {
let Spellings = ["__builtin_tanh"];
let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
ConstIgnoringErrnoAndExceptions];
let Prototype = "__float128(__float128)";
let Prototype = "T(T)";
}

def TgammaF128 : Builtin {
Expand Down
66 changes: 66 additions & 0 deletions clang/lib/CodeGen/CGBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2667,6 +2667,39 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
}
if (GenerateIntrinsics) {
switch (BuiltinIDIfNoAsmLabel) {
case Builtin::BIacos:
case Builtin::BIacosf:
case Builtin::BIacosl:
case Builtin::BI__builtin_acos:
case Builtin::BI__builtin_acosf:
case Builtin::BI__builtin_acosf16:
case Builtin::BI__builtin_acosl:
case Builtin::BI__builtin_acosf128:
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
*this, E, Intrinsic::acos, Intrinsic::experimental_constrained_acos));

case Builtin::BIasin:
case Builtin::BIasinf:
case Builtin::BIasinl:
case Builtin::BI__builtin_asin:
case Builtin::BI__builtin_asinf:
case Builtin::BI__builtin_asinf16:
case Builtin::BI__builtin_asinl:
case Builtin::BI__builtin_asinf128:
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
*this, E, Intrinsic::asin, Intrinsic::experimental_constrained_asin));

case Builtin::BIatan:
case Builtin::BIatanf:
case Builtin::BIatanl:
case Builtin::BI__builtin_atan:
case Builtin::BI__builtin_atanf:
case Builtin::BI__builtin_atanf16:
case Builtin::BI__builtin_atanl:
case Builtin::BI__builtin_atanf128:
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
*this, E, Intrinsic::atan, Intrinsic::experimental_constrained_atan));

case Builtin::BIceil:
case Builtin::BIceilf:
case Builtin::BIceill:
Expand Down Expand Up @@ -2702,6 +2735,17 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
Intrinsic::cos,
Intrinsic::experimental_constrained_cos));

case Builtin::BIcosh:
case Builtin::BIcoshf:
case Builtin::BIcoshl:
case Builtin::BI__builtin_cosh:
case Builtin::BI__builtin_coshf:
case Builtin::BI__builtin_coshf16:
case Builtin::BI__builtin_coshl:
case Builtin::BI__builtin_coshf128:
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
*this, E, Intrinsic::cosh, Intrinsic::experimental_constrained_cosh));

case Builtin::BIexp:
case Builtin::BIexpf:
case Builtin::BIexpl:
Expand Down Expand Up @@ -2918,6 +2962,17 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
Intrinsic::sin,
Intrinsic::experimental_constrained_sin));

case Builtin::BIsinh:
case Builtin::BIsinhf:
case Builtin::BIsinhl:
case Builtin::BI__builtin_sinh:
case Builtin::BI__builtin_sinhf:
case Builtin::BI__builtin_sinhf16:
case Builtin::BI__builtin_sinhl:
case Builtin::BI__builtin_sinhf128:
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
*this, E, Intrinsic::sinh, Intrinsic::experimental_constrained_sinh));

case Builtin::BIsqrt:
case Builtin::BIsqrtf:
case Builtin::BIsqrtl:
Expand All @@ -2944,6 +2999,17 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
*this, E, Intrinsic::tan, Intrinsic::experimental_constrained_tan));

case Builtin::BItanh:
case Builtin::BItanhf:
case Builtin::BItanhl:
case Builtin::BI__builtin_tanh:
case Builtin::BI__builtin_tanhf:
case Builtin::BI__builtin_tanhf16:
case Builtin::BI__builtin_tanhl:
case Builtin::BI__builtin_tanhf128:
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
*this, E, Intrinsic::tanh, Intrinsic::experimental_constrained_tanh));

case Builtin::BItrunc:
case Builtin::BItruncf:
case Builtin::BItruncl:
Expand Down
48 changes: 24 additions & 24 deletions clang/test/CodeGen/X86/math-builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
/* math */
__builtin_acos(f); __builtin_acosf(f); __builtin_acosl(f); __builtin_acosf128(f);

// NO__ERRNO: declare double @acos(double noundef) [[READNONE]]
// NO__ERRNO: declare float @acosf(float noundef) [[READNONE]]
// NO__ERRNO: declare x86_fp80 @acosl(x86_fp80 noundef) [[READNONE]]
// NO__ERRNO: declare fp128 @acosf128(fp128 noundef) [[READNONE]]
// NO__ERRNO: declare double @llvm.acos.f64(double) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare float @llvm.acos.f32(float) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare x86_fp80 @llvm.acos.f80(x86_fp80) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare fp128 @llvm.acos.f128(fp128) [[READNONE_INTRINSIC]]
// HAS_ERRNO: declare double @acos(double noundef) [[NOT_READNONE]]
// HAS_ERRNO: declare float @acosf(float noundef) [[NOT_READNONE]]
// HAS_ERRNO: declare x86_fp80 @acosl(x86_fp80 noundef) [[NOT_READNONE]]
Expand All @@ -190,10 +190,10 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {

__builtin_asin(f); __builtin_asinf(f); __builtin_asinl(f); __builtin_asinf128(f);

// NO__ERRNO: declare double @asin(double noundef) [[READNONE]]
// NO__ERRNO: declare float @asinf(float noundef) [[READNONE]]
// NO__ERRNO: declare x86_fp80 @asinl(x86_fp80 noundef) [[READNONE]]
// NO__ERRNO: declare fp128 @asinf128(fp128 noundef) [[READNONE]]
// NO__ERRNO: declare double @llvm.asin.f64(double) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare float @llvm.asin.f32(float) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare x86_fp80 @llvm.asin.f80(x86_fp80) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare fp128 @llvm.asin.f128(fp128) [[READNONE_INTRINSIC]]
// HAS_ERRNO: declare double @asin(double noundef) [[NOT_READNONE]]
// HAS_ERRNO: declare float @asinf(float noundef) [[NOT_READNONE]]
// HAS_ERRNO: declare x86_fp80 @asinl(x86_fp80 noundef) [[NOT_READNONE]]
Expand All @@ -212,10 +212,10 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {

__builtin_atan(f); __builtin_atanf(f); __builtin_atanl(f); __builtin_atanf128(f);

// NO__ERRNO: declare double @atan(double noundef) [[READNONE]]
// NO__ERRNO: declare float @atanf(float noundef) [[READNONE]]
// NO__ERRNO: declare x86_fp80 @atanl(x86_fp80 noundef) [[READNONE]]
// NO__ERRNO: declare fp128 @atanf128(fp128 noundef) [[READNONE]]
// NO__ERRNO: declare double @llvm.atan.f64(double) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare float @llvm.atan.f32(float) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare x86_fp80 @llvm.atan.f80(x86_fp80) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare fp128 @llvm.atan.f128(fp128) [[READNONE_INTRINSIC]]
// HAS_ERRNO: declare double @atan(double noundef) [[NOT_READNONE]]
// HAS_ERRNO: declare float @atanf(float noundef) [[NOT_READNONE]]
// HAS_ERRNO: declare x86_fp80 @atanl(x86_fp80 noundef) [[NOT_READNONE]]
Expand Down Expand Up @@ -267,10 +267,10 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {

__builtin_cosh(f); __builtin_coshf(f); __builtin_coshl(f); __builtin_coshf128(f);

// NO__ERRNO: declare double @cosh(double noundef) [[READNONE]]
// NO__ERRNO: declare float @coshf(float noundef) [[READNONE]]
// NO__ERRNO: declare x86_fp80 @coshl(x86_fp80 noundef) [[READNONE]]
// NO__ERRNO: declare fp128 @coshf128(fp128 noundef) [[READNONE]]
// NO__ERRNO: declare double @llvm.cosh.f64(double) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare float @llvm.cosh.f32(float) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare x86_fp80 @llvm.cosh.f80(x86_fp80) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare fp128 @llvm.cosh.f128(fp128) [[READNONE_INTRINSIC]]
// HAS_ERRNO: declare double @cosh(double noundef) [[NOT_READNONE]]
// HAS_ERRNO: declare float @coshf(float noundef) [[NOT_READNONE]]
// HAS_ERRNO: declare x86_fp80 @coshl(x86_fp80 noundef) [[NOT_READNONE]]
Expand Down Expand Up @@ -656,10 +656,10 @@ __builtin_sin(f); __builtin_sinf(f); __builtin_sinl(f); __builtin_s

__builtin_sinh(f); __builtin_sinhf(f); __builtin_sinhl(f); __builtin_sinhf128(f);

// NO__ERRNO: declare double @sinh(double noundef) [[READNONE]]
// NO__ERRNO: declare float @sinhf(float noundef) [[READNONE]]
// NO__ERRNO: declare x86_fp80 @sinhl(x86_fp80 noundef) [[READNONE]]
// NO__ERRNO: declare fp128 @sinhf128(fp128 noundef) [[READNONE]]
// NO__ERRNO: declare double @llvm.sinh.f64(double) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare float @llvm.sinh.f32(float) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare x86_fp80 @llvm.sinh.f80(x86_fp80) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare fp128 @llvm.sinh.f128(fp128) [[READNONE_INTRINSIC]]
// HAS_ERRNO: declare double @sinh(double noundef) [[NOT_READNONE]]
// HAS_ERRNO: declare float @sinhf(float noundef) [[NOT_READNONE]]
// HAS_ERRNO: declare x86_fp80 @sinhl(x86_fp80 noundef) [[NOT_READNONE]]
Expand Down Expand Up @@ -689,10 +689,10 @@ __builtin_tan(f); __builtin_tanf(f); __builtin_tanl(f); __builtin_t

__builtin_tanh(f); __builtin_tanhf(f); __builtin_tanhl(f); __builtin_tanhf128(f);

// NO__ERRNO: declare double @tanh(double noundef) [[READNONE]]
// NO__ERRNO: declare float @tanhf(float noundef) [[READNONE]]
// NO__ERRNO: declare x86_fp80 @tanhl(x86_fp80 noundef) [[READNONE]]
// NO__ERRNO: declare fp128 @tanhf128(fp128 noundef) [[READNONE]]
// NO__ERRNO: declare double @llvm.tanh.f64(double) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare float @llvm.tanh.f32(float) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare x86_fp80 @llvm.tanh.f80(x86_fp80) [[READNONE_INTRINSIC]]
// NO__ERRNO: declare fp128 @llvm.tanh.f128(fp128) [[READNONE_INTRINSIC]]
// HAS_ERRNO: declare double @tanh(double noundef) [[NOT_READNONE]]
// HAS_ERRNO: declare float @tanhf(float noundef) [[NOT_READNONE]]
// HAS_ERRNO: declare x86_fp80 @tanhl(x86_fp80 noundef) [[NOT_READNONE]]
Expand Down
41 changes: 41 additions & 0 deletions clang/test/CodeGen/constrained-math-builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,27 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c, _
// CHECK: call float @llvm.experimental.constrained.ldexp.f32.i32(float %{{.*}}, i32 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call x86_fp80 @llvm.experimental.constrained.ldexp.f80.i32(x86_fp80 %{{.*}}, i32 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")

__builtin_acos(f); __builtin_acosf(f); __builtin_acosl(f); __builtin_acosf128(f);

// CHECK: call double @llvm.experimental.constrained.acos.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call float @llvm.experimental.constrained.acos.f32(float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call x86_fp80 @llvm.experimental.constrained.acos.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call fp128 @llvm.experimental.constrained.acos.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")

__builtin_asin(f); __builtin_asinf(f); __builtin_asinl(f); __builtin_asinf128(f);

// CHECK: call double @llvm.experimental.constrained.asin.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call float @llvm.experimental.constrained.asin.f32(float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call x86_fp80 @llvm.experimental.constrained.asin.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call fp128 @llvm.experimental.constrained.asin.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")

__builtin_atan(f); __builtin_atanf(f); __builtin_atanl(f); __builtin_atanf128(f);

// CHECK: call double @llvm.experimental.constrained.atan.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call float @llvm.experimental.constrained.atan.f32(float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call x86_fp80 @llvm.experimental.constrained.atan.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call fp128 @llvm.experimental.constrained.atan.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")

__builtin_ceil(f); __builtin_ceilf(f); __builtin_ceill(f); __builtin_ceilf128(f);

// CHECK: call double @llvm.experimental.constrained.ceil.f64(double %{{.*}}, metadata !"fpexcept.strict")
Expand All @@ -50,6 +71,13 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c, _
// CHECK: call x86_fp80 @llvm.experimental.constrained.cos.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call fp128 @llvm.experimental.constrained.cos.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")

__builtin_cosh(f); __builtin_coshf(f); __builtin_coshl(f); __builtin_coshf128(f);

// CHECK: call double @llvm.experimental.constrained.cosh.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call float @llvm.experimental.constrained.cosh.f32(float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call x86_fp80 @llvm.experimental.constrained.cosh.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call fp128 @llvm.experimental.constrained.cosh.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")

__builtin_exp(f); __builtin_expf(f); __builtin_expl(f); __builtin_expf128(f);

// CHECK: call double @llvm.experimental.constrained.exp.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
Expand Down Expand Up @@ -177,6 +205,13 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c, _
// CHECK: call x86_fp80 @llvm.experimental.constrained.sin.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call fp128 @llvm.experimental.constrained.sin.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")

__builtin_sinh(f); __builtin_sinhf(f); __builtin_sinhl(f); __builtin_sinhf128(f);

// CHECK: call double @llvm.experimental.constrained.sinh.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call float @llvm.experimental.constrained.sinh.f32(float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call x86_fp80 @llvm.experimental.constrained.sinh.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call fp128 @llvm.experimental.constrained.sinh.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")

__builtin_sqrt(f); __builtin_sqrtf(f); __builtin_sqrtl(f); __builtin_sqrtf128(f);

// CHECK: call double @llvm.experimental.constrained.sqrt.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
Expand All @@ -191,6 +226,12 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c, _
// CHECK: call x86_fp80 @llvm.experimental.constrained.tan.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call fp128 @llvm.experimental.constrained.tan.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")

__builtin_tanh(f); __builtin_tanhf(f); __builtin_tanhl(f); __builtin_tanhf128(f);

// CHECK: call double @llvm.experimental.constrained.tanh.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call float @llvm.experimental.constrained.tanh.f32(float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call x86_fp80 @llvm.experimental.constrained.tanh.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// CHECK: call fp128 @llvm.experimental.constrained.tanh.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")

__builtin_trunc(f); __builtin_truncf(f); __builtin_truncl(f); __builtin_truncf128(f);

Expand Down
8 changes: 4 additions & 4 deletions clang/test/CodeGen/libcalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ void test_builtins(double d, float f, long double ld) {
double atan_ = atan(d);
long double atanl_ = atanl(ld);
float atanf_ = atanf(f);
// CHECK-NO: declare double @atan(double noundef) [[NUW_RN:#[0-9]+]]
// CHECK-NO: declare x86_fp80 @atanl(x86_fp80 noundef) [[NUW_RN]]
// CHECK-NO: declare float @atanf(float noundef) [[NUW_RN]]
// CHECK-NO: declare double @llvm.atan.f64(double) [[NUW_RNI:#[0-9]+]]
// CHECK-NO: declare x86_fp80 @llvm.atan.f80(x86_fp80) [[NUW_RNI]]
// CHECK-NO: declare float @llvm.atan.f32(float) [[NUW_RNI]]
// CHECK-YES: declare double @atan(double noundef) [[NUW:#[0-9]+]]
// CHECK-YES: declare x86_fp80 @atanl(x86_fp80 noundef) [[NUW]]
// CHECK-YES: declare float @atanf(float noundef) [[NUW]]

double atan2_ = atan2(d, 2);
long double atan2l_ = atan2l(ld, ld);
float atan2f_ = atan2f(f, f);
// CHECK-NO: declare double @atan2(double noundef, double noundef) [[NUW_RN]]
// CHECK-NO: declare double @atan2(double noundef, double noundef) [[NUW_RN:#[0-9]+]]
// CHECK-NO: declare x86_fp80 @atan2l(x86_fp80 noundef, x86_fp80 noundef) [[NUW_RN]]
// CHECK-NO: declare float @atan2f(float noundef, float noundef) [[NUW_RN]]
// CHECK-YES: declare double @atan2(double noundef, double noundef) [[NUW]]
Expand Down
Loading

0 comments on commit a14baec

Please sign in to comment.