[llvm] [X86] Narrow the mask when folding (vselect mask, (v16i8 (vtrunc (v8i64 x))), 0). (PR #228270)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 1 23:47:47 PDT 2026
================
@@ -49145,7 +49145,11 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG,
SDValue TruncSrc = LHS.getOperand(0);
EVT TruncSrcVT = TruncSrc.getValueType();
if (VT == MVT::v16i8 && TruncSrcVT == MVT::v8i64) {
- return DAG.getNode(X86ISD::VMTRUNC, DL, VT, TruncSrc, RHS, Cond);
+ // VMTRUNC's mask operand must have the same number of elements as
+ // the truncation source (v8i64), not the (wider) v16i8 result.
+ EVT MaskVT = EVT::getVectorVT(*DAG.getContext(), MVT::i1, 8);
----------------
RKSimon wrote:
Either use TruncSrcVT.changleVectorElementType() or hardcode to MVT::v8i1 ?
https://github.com/llvm/llvm-project/pull/228270
More information about the llvm-commits
mailing list