[clang] [clang] Enable constexpr handling for __builtin_elementwise_fma (PR #152919)

Chaitanya Koparkar via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 11 10:37:49 PDT 2025


================
@@ -141,6 +141,16 @@ static void diagnoseNonConstexprBuiltin(InterpState &S, CodePtr OpPC,
     S.CCEDiag(Loc, diag::note_invalid_subexpr_in_const_expr);
 }
 
+// Same implementation as Compiler::getRoundingMode.
+static llvm::RoundingMode getRoundingMode(const InterpState &S, const Expr *E) {
+  FPOptions FPO = E->getFPFeaturesInEffect(S.Ctx.getLangOpts());
+
+  if (FPO.getRoundingMode() == llvm::RoundingMode::Dynamic)
+    return llvm::RoundingMode::NearestTiesToEven;
+
+  return FPO.getRoundingMode();
+}
+
----------------
ckoparkar wrote:

Done.

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


More information about the cfe-commits mailing list