================
@@ -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:

> Does the evaluation produce the same results as would happen at runtime 
> despite the different format?

There is no different format. The default format for the `long double` type on 
AIX (and the only one supported by Clang for AIX) is IEEE double.

The IR generated for basic `long double` operations might clarify: 
https://godbolt.org/z/W4jqr6Kva

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

Reply via email to