================
@@ -14547,6 +14547,20 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr 
*E) {
   default:
     return false;
 
+  case Builtin::BI__builtin_frexp:
+  case Builtin::BI__builtin_frexpf:
+  case Builtin::BI__builtin_frexpl: {
+    LValue Pointer;
+    if (!EvaluateFloat(E->getArg(0), Result, Info) ||
+        !EvaluatePointer(E->getArg(1), Pointer, Info))
+      return false;
+    llvm::RoundingMode RM = getActiveRoundingMode(Info, E);
+    int FrexpExp;
+    FrexpExp = ilogb(Result);
+    FrexpExp = FrexpExp == llvm::detail::IEEEFloat::IEK_Zero ? 0 : FrexpExp + 
1;
+    Result =  scalbn(Result, -FrexpExp, RM);
----------------
hubert-reinterpretcast wrote:

This is not an improvement over
https://github.com/llvm/llvm-project/blob/d7050b53a75a23024502a9e4f56b385256c4722f/clang/lib/AST/ExprConstant.cpp#L14558

It is still the case that no attempt is made to store the value of `FrexpExp` 
via `Pointer`.

Additionally, (although potentially "better" than the status quo of 
`llvm::frexp`) this adds yet another place where the calculation for IBM 
double-double would potentially need special maintenance. See 
https://github.com/llvm/llvm-project/issues/90287.


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