[clang] [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow AVX512 mask predicate intrinsics to be used in constexpr (PR #165054)
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 18 10:28:50 PST 2025
================
@@ -3361,6 +3361,57 @@ static bool interp__builtin_ia32_vpconflict(InterpState &S, CodePtr OpPC,
return true;
}
+static bool interp__builtin_ia32_cvt_mask(InterpState &S, CodePtr OpPC,
+ const CallExpr *Call, unsigned ID) {
+ assert(Call->getNumArgs() == 1);
+
+ const Pointer &Vec = S.Stk.pop<Pointer>();
+ APInt RetMask(Vec.getNumElems(), 0);
+ unsigned VectorLen = Vec.getNumElems();
+ PrimType ElemT = Vec.getFieldDesc()->getPrimType();
+
+ for (unsigned ElemNum = 0; ElemNum < VectorLen; ++ElemNum) {
+ APSInt A;
+ INT_TYPE_SWITCH_NO_BOOL(ElemT, { A = Vec.elem<T>(ElemNum).toAPSInt(); });
+ unsigned MSB = A[A.getBitWidth() - 1];
+ RetMask.setBitVal(ElemNum, MSB);
+ }
+ pushInteger(S, RetMask, Call->getType());
+ return true;
+}
+
+static bool interp__builtin_x86_byteshift(
----------------
RKSimon wrote:
get rid of this - we recently replaced interp__builtin_x86_byteshift with the generic shuffle handler and this is now redundant
https://github.com/llvm/llvm-project/pull/165054
More information about the cfe-commits
mailing list