[X86] getFauxShuffleMask - use std::iota for insert_subvector shuffle mask population. NFC.

This commit is contained in:
Simon Pilgrim 2025-04-09 12:51:39 +01:00
parent a6edaeb824
commit 2896bbe148

View File

@ -6180,7 +6180,7 @@ static bool getFauxShuffleMask(SDValue N, const APInt &DemandedElts,
uint64_t InsertIdx = N.getConstantOperandVal(2); uint64_t InsertIdx = N.getConstantOperandVal(2);
// Subvector isn't demanded - just return the base vector. // Subvector isn't demanded - just return the base vector.
if (DemandedElts.extractBits(NumSubElts, InsertIdx) == 0) { if (DemandedElts.extractBits(NumSubElts, InsertIdx) == 0) {
Mask.resize(NumElts, SM_SentinelUndef); Mask.resize(NumElts);
std::iota(Mask.begin(), Mask.end(), 0); std::iota(Mask.begin(), Mask.end(), 0);
Ops.push_back(Src); Ops.push_back(Src);
return true; return true;
@ -6194,10 +6194,9 @@ static bool getFauxShuffleMask(SDValue N, const APInt &DemandedElts,
Src.getConstantOperandVal(2) == 0 && Src.getConstantOperandVal(2) == 0 &&
(NumBitsPerElt == 64 || Src.getOperand(1) == Sub) && (NumBitsPerElt == 64 || Src.getOperand(1) == Sub) &&
SDNode::areOnlyUsersOf({N.getNode(), Src.getNode()}, Sub.getNode())) { SDNode::areOnlyUsersOf({N.getNode(), Src.getNode()}, Sub.getNode())) {
for (int i = 0; i != (int)NumSubElts; ++i) Mask.resize(NumElts);
Mask.push_back(i); std::iota(Mask.begin(), Mask.begin() + NumSubElts, 0);
for (int i = 0; i != (int)NumSubElts; ++i) std::iota(Mask.begin() + NumSubElts, Mask.end(), NumElts);
Mask.push_back(i + NumElts);
Ops.push_back(Src.getOperand(1)); Ops.push_back(Src.getOperand(1));
Ops.push_back(Sub); Ops.push_back(Sub);
return true; return true;