[CostModel] Cleanup isSingleSourceVectorMask to match other shuffle matchers. NFCI.

llvm-svn: 334699
This commit is contained in:
Simon Pilgrim 2018-06-14 09:48:19 +00:00
parent 32702cc86a
commit c0d53aba7b
1 changed files with 12 additions and 10 deletions

View File

@ -645,17 +645,19 @@ static bool isReverseVectorMask(ArrayRef<int> Mask) {
}
static bool isSingleSourceVectorMask(ArrayRef<int> Mask) {
bool Vec0 = false;
bool Vec1 = false;
for (unsigned i = 0, NumVecElts = Mask.size(); i < NumVecElts; ++i) {
if (Mask[i] >= 0) {
if ((unsigned)Mask[i] >= NumVecElts)
Vec1 = true;
else
Vec0 = true;
}
bool ShuffleLHS = false;
bool ShuffleRHS = false;
unsigned MaskSize = Mask.size();
for (unsigned i = 0; i < MaskSize && !(ShuffleLHS && ShuffleRHS); ++i) {
if (Mask[i] < 0)
continue;
if ((unsigned)Mask[i] >= MaskSize)
ShuffleRHS = true;
else
ShuffleLHS = true;
}
return !(Vec0 && Vec1);
return !(ShuffleLHS && ShuffleRHS);
}
static bool isZeroEltBroadcastVectorMask(ArrayRef<int> Mask) {