From: Simon Pilgrim Date: Sun, 29 Mar 2020 17:48:02 +0000 (+0100) Subject: [X86] Add isAnyZero shuffle mask helper X-Git-Tag: llvmorg-12-init~10795 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8206c50cdec1551cf6e51da2bc492b8daaf80e1d;p=platform%2Fupstream%2Fllvm.git [X86] Add isAnyZero shuffle mask helper --- diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index dff1318..9735f85 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -5435,6 +5435,11 @@ static bool isAnyInRange(ArrayRef Mask, int Low, int Hi) { return llvm::any_of(Mask, [Low, Hi](int M) { return isInRange(M, Low, Hi); }); } +/// Return true if the value of any element in Mask is the zero sentinel value. +static bool isAnyZero(ArrayRef Mask) { + return llvm::any_of(Mask, [](int M) { return M == SM_SentinelZero; }); +} + /// Return true if Val is undef or if its value falls within the /// specified range (L, H]. static bool isUndefOrInRange(int Val, int Low, int Hi) { @@ -34231,8 +34236,7 @@ static SDValue combineX86ShuffleChain(ArrayRef Inputs, SDValue Root, int VariableShuffleDepth = Subtarget.hasFastVariableShuffle() ? 1 : 2; AllowVariableMask &= (Depth >= VariableShuffleDepth) || HasVariableMask; - bool MaskContainsZeros = - any_of(Mask, [](int M) { return M == SM_SentinelZero; }); + bool MaskContainsZeros = isAnyZero(Mask); if (is128BitLaneCrossingShuffleMask(MaskVT, Mask)) { // If we have a single input lane-crossing shuffle then lower to VPERMV.