[clang] [libc] [llvm] [clang] Make __builtin_exp and __builtin_expf constexpr. (PR #199808)

via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 19 21:38:09 PDT 2026


================
@@ -710,6 +711,26 @@ static bool interp__builtin_fpclassify(InterpState &S, CodePtr OpPC,
   return true;
 }
 
+static bool interp__builtin_exp(InterpState &S, CodePtr OpPC,
+                                const InterpFrame *Frame,
+                                const CallExpr *Call) {
+  const Floating &Arg = S.Stk.pop<Floating>();
+  FPOptions FPO = Call->getFPFeaturesInEffect(S.Ctx.getLangOpts());
+  llvm::RoundingMode RM = getRoundingMode(FPO);
+  APFloat::opStatus Status = APFloat::opStatus::opOK;
+  std::optional<APFloat> Result = exp(Arg.getAPFloat(), RM, &Status);
----------------
lntue wrote:

@hubert-reinterpretcast I have updated the conditions and the tests.  Can you see if it matches with the expectations?

https://github.com/llvm/llvm-project/pull/199808


More information about the cfe-commits mailing list