[llvm] 5d9a259 - [X86][SSE] Split off generic isLaneCrossingShuffleMask helper. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 23 04:41:53 PST 2019
Author: Simon Pilgrim
Date: 2019-11-23T12:41:03Z
New Revision: 5d9a259ad592576571625b9eb6649acbebc85f30
URL: https://github.com/llvm/llvm-project/commit/5d9a259ad592576571625b9eb6649acbebc85f30
DIFF: https://github.com/llvm/llvm-project/commit/5d9a259ad592576571625b9eb6649acbebc85f30.diff
LOG: [X86][SSE] Split off generic isLaneCrossingShuffleMask helper. NFC.
Avoid MVT dependency which will be needed in a future patch.
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 dfffd19dd628..c658363f8d6a 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -10251,13 +10251,18 @@ static bool isNoopShuffleMask(ArrayRef<int> Mask) {
return true;
}
-/// Test whether there are elements crossing 128-bit lanes in this
+/// Test whether there are elements crossing LaneSizeInBits lanes in this
/// shuffle mask.
///
/// X86 divides up its shuffles into in-lane and cross-lane shuffle operations
/// and we routinely test for these.
-static bool is128BitLaneCrossingShuffleMask(MVT VT, ArrayRef<int> Mask) {
- int LaneSize = 128 / VT.getScalarSizeInBits();
+static bool isLaneCrossingShuffleMask(unsigned LaneSizeInBits,
+ unsigned ScalarSizeInBits,
+ ArrayRef<int> Mask) {
+ assert(LaneSizeInBits && ScalarSizeInBits &&
+ (LaneSizeInBits % ScalarSizeInBits) == 0 &&
+ "Illegal shuffle lane size");
+ int LaneSize = LaneSizeInBits / ScalarSizeInBits;
int Size = Mask.size();
for (int i = 0; i < Size; ++i)
if (Mask[i] >= 0 && (Mask[i] % Size) / LaneSize != i / LaneSize)
@@ -10265,6 +10270,12 @@ static bool is128BitLaneCrossingShuffleMask(MVT VT, ArrayRef<int> Mask) {
return false;
}
+/// Test whether there are elements crossing 128-bit lanes in this
+/// shuffle mask.
+static bool is128BitLaneCrossingShuffleMask(MVT VT, ArrayRef<int> Mask) {
+ return isLaneCrossingShuffleMask(128, VT.getScalarSizeInBits(), Mask);
+}
+
/// Test whether a shuffle mask is equivalent within each sub-lane.
///
/// This checks a shuffle mask to see if it is performing the same
More information about the llvm-commits
mailing list