[clang] [llvm] [C++23] [CLANG] Adding C++23 constexpr math functions: fmin, fmax and frexp. (PR #88978)
Hubert Tong via cfe-commits
cfe-commits at lists.llvm.org
Thu May 16 15:59:12 PDT 2024
================
@@ -14574,9 +14574,17 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) {
default:
return false;
+ case Builtin::BI__builtin_frexpl:
+ // AIX library function `frexpl` has 'long double' type and not
+ // PPCDoubleDouble type. To make sure we generate the right value, don't
+ // constant evaluate it and instead defer to a libcall.
+ if (Info.Ctx.getTargetInfo().getTriple().isPPC() &&
+ (&Info.Ctx.getTargetInfo().getLongDoubleFormat() !=
+ &llvm::APFloat::PPCDoubleDouble()))
+ return false;
+ LLVM_FALLTHROUGH;
case Builtin::BI__builtin_frexp:
- case Builtin::BI__builtin_frexpf:
- case Builtin::BI__builtin_frexpl: {
+ case Builtin::BI__builtin_frexpf: {
----------------
hubert-reinterpretcast wrote:
> I was referring to https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGBuiltin.cpp#L3543.
That affects the IR generated by Clang when Clang _does not_ constant-evaluate (and was motivated by backend issues).
https://github.com/llvm/llvm-project/pull/88978
More information about the cfe-commits
mailing list