diff options
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index dfffd19dd62..c658363f8d6 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 |