================
@@ -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: {
----------------
zahiraam wrote:

I see. I was referring to 
https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGBuiltin.cpp#L3543.
@AaronBallman I am not sure how to get to the runtime value. `godbolt` doesn't 
seem to offer output for powerpc clang?

With this change (special casing frexpl for AIX) the IR produced is:
`call { double, i32 } @llvm.frexp.f64.i32(double 1.234500e+02)`

without this change the IR is:
`store double 0.000000e+00, ptr %returnValue, align 8`

This doesn't seem correct to me. 

Making the change in the test as @hubert-reinterpretcast is suggesting would 
give this IR (which also seems correct to me:
`@input = global double 0.000000e+00, align 8`
`load double, ptr @input, align 8
`%0 = load double, ptr @input, align 8`
`call { double, i32 } @llvm.frexp.f64.i32(double %0)`







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