[clang] [clang] constexpr built-in fma function. (PR #113020)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 30 06:14:30 PDT 2024


================
@@ -549,6 +562,22 @@ static bool interp__builtin_fpclassify(InterpState &S, CodePtr OpPC,
   return true;
 }
 
+static bool interp__builtin_fma(InterpState &S, CodePtr OpPC,
+                                const InterpFrame *Frame, const Function *Func,
+                                const CallExpr *Call) {
+  const Floating &X = getParam<Floating>(Frame, 0);
+  const Floating &Y = getParam<Floating>(Frame, 1);
+  const Floating &Z = getParam<Floating>(Frame, 2);
+  Floating Result;
+
+  llvm::RoundingMode RM = getActiveRoundingMode(S, Call);
----------------
c8ef wrote:

https://github.com/llvm/llvm-project/blob/61a456bd5ae88eeccc39b28a30be4eb03289446d/clang/lib/AST/ExprConstant.cpp#L2776-L2782

I actually obtained this from the old constant evaluator, but I'm not sure if it has the same rounding issue.

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


More information about the cfe-commits mailing list