Skip to content

Commit 3c31554

Browse files
committed
[clang] Emit constraint intrinsics for arc and hyperbolic trig clang builtins
- `Builtins.td` - Add f16 support for libm arc and hyperbolic trig functions - `CGBuiltin.cpp` - Emit constraint intrinsics for trig clang builtins This change is part of an implementation of llvm#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`. llvm#70079 llvm#70080 llvm#70081 llvm#70083 llvm#70084 llvm#95966 Note this PR needs Merge after: - llvm#98937 - llvm#98755
1 parent 2905372 commit 3c31554

6 files changed

Lines changed: 204 additions & 78 deletions

File tree

clang/include/clang/Basic/Builtins.td

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ class BitInt_Long_LongLongTemplate :
8383
// - _Constant: Argument has to constant-fold to an integer constant expression
8484

8585
// __fp16 and __float128 builtin variants of libc/libm functions.
86-
def AcosF128 : Builtin {
87-
let Spellings = ["__builtin_acosf128"];
86+
def AcosF16F128 : Builtin, F16F128MathTemplate {
87+
let Spellings = ["__builtin_acos"];
8888
let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
8989
ConstIgnoringErrnoAndExceptions];
90-
let Prototype = "__float128(__float128)";
90+
let Prototype = "T(T)";
9191
}
9292

9393
def AcoshF128 : Builtin {
@@ -97,11 +97,11 @@ def AcoshF128 : Builtin {
9797
let Prototype = "__float128(__float128)";
9898
}
9999

100-
def AsinF128 : Builtin {
101-
let Spellings = ["__builtin_asinf128"];
100+
def AsinF16F128 : Builtin, F16F128MathTemplate {
101+
let Spellings = ["__builtin_asin"];
102102
let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
103103
ConstIgnoringErrnoAndExceptions];
104-
let Prototype = "__float128(__float128)";
104+
let Prototype = "T(T)";
105105
}
106106

107107
def AsinhF128 : Builtin {
@@ -111,11 +111,11 @@ def AsinhF128 : Builtin {
111111
let Prototype = "__float128(__float128)";
112112
}
113113

114-
def AtanF128 : Builtin {
115-
let Spellings = ["__builtin_atanf128"];
114+
def AtanF16F128 : Builtin, F16F128MathTemplate {
115+
let Spellings = ["__builtin_atan"];
116116
let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
117117
ConstIgnoringErrnoAndExceptions];
118-
let Prototype = "__float128(__float128)";
118+
let Prototype = "T(T)";
119119
}
120120

121121
def AtanhF128 : Builtin {
@@ -143,10 +143,10 @@ def CosF16F128 : Builtin, F16F128MathTemplate {
143143
let Prototype = "T(T)";
144144
}
145145

146-
def CoshF128 : Builtin {
147-
let Spellings = ["__builtin_coshf128"];
146+
def CoshF16F128 : Builtin, F16F128MathTemplate {
147+
let Spellings = ["__builtin_cosh"];
148148
let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
149-
let Prototype = "__float128(__float128)";
149+
let Prototype = "T(T)";
150150
}
151151

152152
def ErfF128 : Builtin {
@@ -468,11 +468,11 @@ def SinF16F128 : Builtin, F16F128MathTemplate {
468468
let Prototype = "T(T)";
469469
}
470470

471-
def SinhF128 : Builtin {
472-
let Spellings = ["__builtin_sinhf128"];
471+
def SinhF16F128 : Builtin, F16F128MathTemplate {
472+
let Spellings = ["__builtin_sinh"];
473473
let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
474474
ConstIgnoringErrnoAndExceptions];
475-
let Prototype = "__float128(__float128)";
475+
let Prototype = "T(T)";
476476
}
477477

478478
def SqrtF16F128 : Builtin, F16F128MathTemplate {
@@ -489,11 +489,11 @@ def TanF16F128 : Builtin, F16F128MathTemplate {
489489
let Prototype = "T(T)";
490490
}
491491

492-
def TanhF128 : Builtin {
493-
let Spellings = ["__builtin_tanhf128"];
492+
def TanhF16F128 : Builtin, F16F128MathTemplate {
493+
let Spellings = ["__builtin_tanh"];
494494
let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
495495
ConstIgnoringErrnoAndExceptions];
496-
let Prototype = "__float128(__float128)";
496+
let Prototype = "T(T)";
497497
}
498498

499499
def TgammaF128 : Builtin {

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2640,6 +2640,39 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
26402640
}
26412641
if (GenerateIntrinsics) {
26422642
switch (BuiltinIDIfNoAsmLabel) {
2643+
case Builtin::BIacos:
2644+
case Builtin::BIacosf:
2645+
case Builtin::BIacosl:
2646+
case Builtin::BI__builtin_acos:
2647+
case Builtin::BI__builtin_acosf:
2648+
case Builtin::BI__builtin_acosf16:
2649+
case Builtin::BI__builtin_acosl:
2650+
case Builtin::BI__builtin_acosf128:
2651+
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
2652+
*this, E, Intrinsic::acos, Intrinsic::experimental_constrained_acos));
2653+
2654+
case Builtin::BIasin:
2655+
case Builtin::BIasinf:
2656+
case Builtin::BIasinl:
2657+
case Builtin::BI__builtin_asin:
2658+
case Builtin::BI__builtin_asinf:
2659+
case Builtin::BI__builtin_asinf16:
2660+
case Builtin::BI__builtin_asinl:
2661+
case Builtin::BI__builtin_asinf128:
2662+
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
2663+
*this, E, Intrinsic::asin, Intrinsic::experimental_constrained_asin));
2664+
2665+
case Builtin::BIatan:
2666+
case Builtin::BIatanf:
2667+
case Builtin::BIatanl:
2668+
case Builtin::BI__builtin_atan:
2669+
case Builtin::BI__builtin_atanf:
2670+
case Builtin::BI__builtin_atanf16:
2671+
case Builtin::BI__builtin_atanl:
2672+
case Builtin::BI__builtin_atanf128:
2673+
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
2674+
*this, E, Intrinsic::atan, Intrinsic::experimental_constrained_atan));
2675+
26432676
case Builtin::BIceil:
26442677
case Builtin::BIceilf:
26452678
case Builtin::BIceill:
@@ -2675,6 +2708,17 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
26752708
Intrinsic::cos,
26762709
Intrinsic::experimental_constrained_cos));
26772710

2711+
case Builtin::BIcosh:
2712+
case Builtin::BIcoshf:
2713+
case Builtin::BIcoshl:
2714+
case Builtin::BI__builtin_cosh:
2715+
case Builtin::BI__builtin_coshf:
2716+
case Builtin::BI__builtin_coshf16:
2717+
case Builtin::BI__builtin_coshl:
2718+
case Builtin::BI__builtin_coshf128:
2719+
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
2720+
*this, E, Intrinsic::cosh, Intrinsic::experimental_constrained_cosh));
2721+
26782722
case Builtin::BIexp:
26792723
case Builtin::BIexpf:
26802724
case Builtin::BIexpl:
@@ -2891,6 +2935,17 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
28912935
Intrinsic::sin,
28922936
Intrinsic::experimental_constrained_sin));
28932937

2938+
case Builtin::BIsinh:
2939+
case Builtin::BIsinhf:
2940+
case Builtin::BIsinhl:
2941+
case Builtin::BI__builtin_sinh:
2942+
case Builtin::BI__builtin_sinhf:
2943+
case Builtin::BI__builtin_sinhf16:
2944+
case Builtin::BI__builtin_sinhl:
2945+
case Builtin::BI__builtin_sinhf128:
2946+
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
2947+
*this, E, Intrinsic::sinh, Intrinsic::experimental_constrained_sinh));
2948+
28942949
case Builtin::BIsqrt:
28952950
case Builtin::BIsqrtf:
28962951
case Builtin::BIsqrtl:
@@ -2917,6 +2972,17 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
29172972
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
29182973
*this, E, Intrinsic::tan, Intrinsic::experimental_constrained_tan));
29192974

2975+
case Builtin::BItanh:
2976+
case Builtin::BItanhf:
2977+
case Builtin::BItanhl:
2978+
case Builtin::BI__builtin_tanh:
2979+
case Builtin::BI__builtin_tanhf:
2980+
case Builtin::BI__builtin_tanhf16:
2981+
case Builtin::BI__builtin_tanhl:
2982+
case Builtin::BI__builtin_tanhf128:
2983+
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
2984+
*this, E, Intrinsic::tanh, Intrinsic::experimental_constrained_tanh));
2985+
29202986
case Builtin::BItrunc:
29212987
case Builtin::BItruncf:
29222988
case Builtin::BItruncl:

clang/test/CodeGen/X86/math-builtins.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
168168
/* math */
169169
__builtin_acos(f); __builtin_acosf(f); __builtin_acosl(f); __builtin_acosf128(f);
170170

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

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

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

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

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

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

270-
// NO__ERRNO: declare double @cosh(double noundef) [[READNONE]]
271-
// NO__ERRNO: declare float @coshf(float noundef) [[READNONE]]
272-
// NO__ERRNO: declare x86_fp80 @coshl(x86_fp80 noundef) [[READNONE]]
273-
// NO__ERRNO: declare fp128 @coshf128(fp128 noundef) [[READNONE]]
270+
// NO__ERRNO: declare double @llvm.cosh.f64(double) [[READNONE_INTRINSIC]]
271+
// NO__ERRNO: declare float @llvm.cosh.f32(float) [[READNONE_INTRINSIC]]
272+
// NO__ERRNO: declare x86_fp80 @llvm.cosh.f80(x86_fp80) [[READNONE_INTRINSIC]]
273+
// NO__ERRNO: declare fp128 @llvm.cosh.f128(fp128) [[READNONE_INTRINSIC]]
274274
// HAS_ERRNO: declare double @cosh(double noundef) [[NOT_READNONE]]
275275
// HAS_ERRNO: declare float @coshf(float noundef) [[NOT_READNONE]]
276276
// HAS_ERRNO: declare x86_fp80 @coshl(x86_fp80 noundef) [[NOT_READNONE]]
@@ -656,10 +656,10 @@ __builtin_sin(f); __builtin_sinf(f); __builtin_sinl(f); __builtin_s
656656

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

659-
// NO__ERRNO: declare double @sinh(double noundef) [[READNONE]]
660-
// NO__ERRNO: declare float @sinhf(float noundef) [[READNONE]]
661-
// NO__ERRNO: declare x86_fp80 @sinhl(x86_fp80 noundef) [[READNONE]]
662-
// NO__ERRNO: declare fp128 @sinhf128(fp128 noundef) [[READNONE]]
659+
// NO__ERRNO: declare double @llvm.sinh.f64(double) [[READNONE_INTRINSIC]]
660+
// NO__ERRNO: declare float @llvm.sinh.f32(float) [[READNONE_INTRINSIC]]
661+
// NO__ERRNO: declare x86_fp80 @llvm.sinh.f80(x86_fp80) [[READNONE_INTRINSIC]]
662+
// NO__ERRNO: declare fp128 @llvm.sinh.f128(fp128) [[READNONE_INTRINSIC]]
663663
// HAS_ERRNO: declare double @sinh(double noundef) [[NOT_READNONE]]
664664
// HAS_ERRNO: declare float @sinhf(float noundef) [[NOT_READNONE]]
665665
// HAS_ERRNO: declare x86_fp80 @sinhl(x86_fp80 noundef) [[NOT_READNONE]]
@@ -689,10 +689,10 @@ __builtin_tan(f); __builtin_tanf(f); __builtin_tanl(f); __builtin_t
689689

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

692-
// NO__ERRNO: declare double @tanh(double noundef) [[READNONE]]
693-
// NO__ERRNO: declare float @tanhf(float noundef) [[READNONE]]
694-
// NO__ERRNO: declare x86_fp80 @tanhl(x86_fp80 noundef) [[READNONE]]
695-
// NO__ERRNO: declare fp128 @tanhf128(fp128 noundef) [[READNONE]]
692+
// NO__ERRNO: declare double @llvm.tanh.f64(double) [[READNONE_INTRINSIC]]
693+
// NO__ERRNO: declare float @llvm.tanh.f32(float) [[READNONE_INTRINSIC]]
694+
// NO__ERRNO: declare x86_fp80 @llvm.tanh.f80(x86_fp80) [[READNONE_INTRINSIC]]
695+
// NO__ERRNO: declare fp128 @llvm.tanh.f128(fp128) [[READNONE_INTRINSIC]]
696696
// HAS_ERRNO: declare double @tanh(double noundef) [[NOT_READNONE]]
697697
// HAS_ERRNO: declare float @tanhf(float noundef) [[NOT_READNONE]]
698698
// HAS_ERRNO: declare x86_fp80 @tanhl(x86_fp80 noundef) [[NOT_READNONE]]

clang/test/CodeGen/constrained-math-builtins.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,27 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c, _
3636
// CHECK: call float @llvm.experimental.constrained.ldexp.f32.i32(float %{{.*}}, i32 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
3737
// CHECK: call x86_fp80 @llvm.experimental.constrained.ldexp.f80.i32(x86_fp80 %{{.*}}, i32 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
3838

39+
__builtin_acos(f); __builtin_acosf(f); __builtin_acosl(f); __builtin_acosf128(f);
40+
41+
// CHECK: call double @llvm.experimental.constrained.acos.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
42+
// CHECK: call float @llvm.experimental.constrained.acos.f32(float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
43+
// CHECK: call x86_fp80 @llvm.experimental.constrained.acos.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
44+
// CHECK: call fp128 @llvm.experimental.constrained.acos.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
45+
46+
__builtin_asin(f); __builtin_asinf(f); __builtin_asinl(f); __builtin_asinf128(f);
47+
48+
// CHECK: call double @llvm.experimental.constrained.asin.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
49+
// CHECK: call float @llvm.experimental.constrained.asin.f32(float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
50+
// CHECK: call x86_fp80 @llvm.experimental.constrained.asin.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
51+
// CHECK: call fp128 @llvm.experimental.constrained.asin.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
52+
53+
__builtin_atan(f); __builtin_atanf(f); __builtin_atanl(f); __builtin_atanf128(f);
54+
55+
// CHECK: call double @llvm.experimental.constrained.atan.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
56+
// CHECK: call float @llvm.experimental.constrained.atan.f32(float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
57+
// CHECK: call x86_fp80 @llvm.experimental.constrained.atan.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
58+
// CHECK: call fp128 @llvm.experimental.constrained.atan.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
59+
3960
__builtin_ceil(f); __builtin_ceilf(f); __builtin_ceill(f); __builtin_ceilf128(f);
4061

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

74+
__builtin_cosh(f); __builtin_coshf(f); __builtin_coshl(f); __builtin_coshf128(f);
75+
76+
// CHECK: call double @llvm.experimental.constrained.cosh.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
77+
// CHECK: call float @llvm.experimental.constrained.cosh.f32(float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
78+
// CHECK: call x86_fp80 @llvm.experimental.constrained.cosh.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
79+
// CHECK: call fp128 @llvm.experimental.constrained.cosh.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
80+
5381
__builtin_exp(f); __builtin_expf(f); __builtin_expl(f); __builtin_expf128(f);
5482

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

208+
__builtin_sinh(f); __builtin_sinhf(f); __builtin_sinhl(f); __builtin_sinhf128(f);
209+
210+
// CHECK: call double @llvm.experimental.constrained.sinh.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
211+
// CHECK: call float @llvm.experimental.constrained.sinh.f32(float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
212+
// CHECK: call x86_fp80 @llvm.experimental.constrained.sinh.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
213+
// CHECK: call fp128 @llvm.experimental.constrained.sinh.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
214+
180215
__builtin_sqrt(f); __builtin_sqrtf(f); __builtin_sqrtl(f); __builtin_sqrtf128(f);
181216

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

229+
__builtin_tanh(f); __builtin_tanhf(f); __builtin_tanhl(f); __builtin_tanhf128(f);
230+
231+
// CHECK: call double @llvm.experimental.constrained.tanh.f64(double %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
232+
// CHECK: call float @llvm.experimental.constrained.tanh.f32(float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
233+
// CHECK: call x86_fp80 @llvm.experimental.constrained.tanh.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
234+
// CHECK: call fp128 @llvm.experimental.constrained.tanh.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
194235

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

0 commit comments

Comments
 (0)