[clang] [C++23] [CLANG] Adding C++23 constexpr math functions: fmin and frexp. (PR #88978)
Zahira Ammarguellat via cfe-commits
cfe-commits at lists.llvm.org
Wed May 8 10:32:03 PDT 2024
================
@@ -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);
----------------
zahiraam wrote:
Added function` StoreExponent`.
https://github.com/llvm/llvm-project/pull/88978
More information about the cfe-commits
mailing list