Skip to content

Commit ca259ca

Browse files
committed
Add math-libcalls test
1 parent d6f7858 commit ca259ca

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3385,6 +3385,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
33853385
case Builtin::BI__builtin_sincosf16:
33863386
case Builtin::BI__builtin_sincosl:
33873387
case Builtin::BI__builtin_sincosf128:
3388+
if (Builder.getIsFPConstrained())
3389+
break; // TODO: Emit constrained sincos intrinsic once one exists.
33883390
emitSincosBuiltin(*this, E, Intrinsic::sincos);
33893391
return RValue::get(nullptr);
33903392

clang/test/CodeGen/math-libcalls.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,17 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
660660
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.sinh.f32(
661661
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.sinh.f80(
662662

663+
sincos(f, d, d); sincosf(f, fp, fp); sincosl(f, l, l);
664+
665+
// NO__ERRNO: declare { double, double } @llvm.sincos.f64(double) [[READNONE_INTRINSIC]]
666+
// NO__ERRNO: declare { float, float } @llvm.sincos.f32(float) [[READNONE_INTRINSIC]]
667+
// NO__ERRNO: declare { x86_fp80, x86_fp80 } @llvm.sincos.f80(x86_fp80) [[READNONE_INTRINSIC]]
668+
// HAS_ERRNO: declare void @sincos(double noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
669+
// HAS_ERRNO: declare void @sincosf(float noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
670+
// HAS_ERRNO: declare void @sincosl(x86_fp80 noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
671+
// HAS_MAYTRAP: declare void @sincos(double noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
672+
// HAS_MAYTRAP: declare void @sincosf(float noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
673+
// HAS_MAYTRAP: declare void @sincosl(x86_fp80 noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
663674

664675
sqrt(f); sqrtf(f); sqrtl(f);
665676

0 commit comments

Comments
 (0)