Skip to content

Commit 7b1f5cc

Browse files
committed
Don't use intrinsic in constrained mode
1 parent 0c5a3a6 commit 7b1f5cc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4120,6 +4120,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
41204120
case Builtin::BI__builtin_modf:
41214121
case Builtin::BI__builtin_modff:
41224122
case Builtin::BI__builtin_modfl:
4123+
if (Builder.getIsFPConstrained())
4124+
break;
41234125
return RValue::get(emitModfBuiltin(*this, E, Intrinsic::modf));
41244126
case Builtin::BI__builtin_isgreater:
41254127
case Builtin::BI__builtin_isgreaterequal:

clang/test/CodeGen/math-libcalls.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
8989
// HAS_ERRNO: declare { double, double } @llvm.modf.f64(double) [[READNONE_INTRINSIC]]
9090
// HAS_ERRNO: declare { float, float } @llvm.modf.f32(float) [[READNONE_INTRINSIC]]
9191
// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @llvm.modf.f80(x86_fp80) [[READNONE_INTRINSIC]]
92-
// HAS_MAYTRAP: declare { double, double } @llvm.modf.f64(double) [[READNONE_INTRINSIC]]
93-
// HAS_MAYTRAP: declare { float, float } @llvm.modf.f32(float) [[READNONE_INTRINSIC]]
94-
// HAS_MAYTRAP: declare { x86_fp80, x86_fp80 } @llvm.modf.f80(x86_fp80) [[READNONE_INTRINSIC]]
92+
// HAS_MAYTRAP: declare double @modf(double noundef, ptr noundef) [[NOT_READNONE]]
93+
// HAS_MAYTRAP: declare float @modff(float noundef, ptr noundef) [[NOT_READNONE]]
94+
// HAS_MAYTRAP: declare x86_fp80 @modfl(x86_fp80 noundef, ptr noundef) [[NOT_READNONE]]
9595

9696
nan(c); nanf(c); nanl(c);
9797

0 commit comments

Comments
 (0)