================ @@ -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:
The comment is incorrect. The _actual_ AIX library function `frexpl` has (some version of) `PPCDoubleDouble` type. Because of that, Clang (which only supports 64-bit `long double` on AIX) has to map calls to `__builtin_frexpl` to `frexp`. For compile-time evaluation, the `APFloat`s associated with `long double` on AIX have the IEEE double format (and the evaluation works fine). The solution to the failing test is to change it. The problem with the test is that the first input argument is a constant; changing it to refer to a global variable should work. https://github.com/llvm/llvm-project/blob/566fbb450092bf8c9f966a6ab1b0381626e3e535/clang/test/CodeGen/aix-builtin-mapping.c#L16 https://github.com/llvm/llvm-project/pull/88978 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits