[clang] [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow SSE/AVX COMI/UCOMI/CMPS/CMPP fp comparison intrinsics to be used in constexpr (PR #182589)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 14 05:15:12 PDT 2026


================
@@ -4378,6 +4379,69 @@ static bool interp__builtin_ia32_gfni_mul(InterpState &S, CodePtr OpPC,
   return true;
 }
 
+static bool interp__builtin_x86_comi(InterpState &S, CodePtr OpPC,
+                                     const InterpFrame *Frame,
+                                     const CallExpr *Call, unsigned ID,
+                                     uint64_t Predicate) {
+  const Pointer &VectorB = S.Stk.pop<Pointer>();
+  const Pointer &VectorA = S.Stk.pop<Pointer>();
+
+  if (VectorA.getNumElems() == 0 ||
----------------
tbaederr wrote:

It's complicated but it can happen because of C casts and once `__builtin_constant_p` is involved, everything is possible anyway.

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


More information about the cfe-commits mailing list