[llvm] 8206c50 - [X86] Add isAnyZero shuffle mask helper
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 29 11:51:57 PDT 2020
Author: Simon Pilgrim
Date: 2020-03-29T19:51:37+01:00
New Revision: 8206c50cdec1551cf6e51da2bc492b8daaf80e1d
URL: https://github.com/llvm/llvm-project/commit/8206c50cdec1551cf6e51da2bc492b8daaf80e1d
DIFF: https://github.com/llvm/llvm-project/commit/8206c50cdec1551cf6e51da2bc492b8daaf80e1d.diff
LOG: [X86] Add isAnyZero shuffle mask helper
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index dff13183aab2..9735f8578409 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -5435,6 +5435,11 @@ static bool isAnyInRange(ArrayRef<int> 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<int> 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<SDValue> 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.
More information about the llvm-commits
mailing list