From c27baa54b78478ace01cd81abbdbbf47e3f8c54a Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sun, 16 Aug 2020 11:51:44 +0100 Subject: [PATCH] [X86] isRepeatedTargetShuffleMask - don't require specific MVT type. NFC. Split the isRepeatedTargetShuffleMask into a wrapper variant that takes a MVT describing the mask width, and an internal version that just needs the raw mask element bit size. This will be necessary for an upcoming change where the horizontal ops element width might not match the shuffle mask element width. --- llvm/lib/Target/X86/X86ISelLowering.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 25f157d..e72d089 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -10720,10 +10720,11 @@ is256BitLaneRepeatedShuffleMask(MVT VT, ArrayRef Mask, /// Test whether a target shuffle mask is equivalent within each sub-lane. /// Unlike isRepeatedShuffleMask we must respect SM_SentinelZero. -static bool isRepeatedTargetShuffleMask(unsigned LaneSizeInBits, MVT VT, +static bool isRepeatedTargetShuffleMask(unsigned LaneSizeInBits, + unsigned EltSizeInBits, ArrayRef Mask, SmallVectorImpl &RepeatedMask) { - int LaneSize = LaneSizeInBits / VT.getScalarSizeInBits(); + int LaneSize = LaneSizeInBits / EltSizeInBits; RepeatedMask.assign(LaneSize, SM_SentinelUndef); int Size = Mask.size(); for (int i = 0; i < Size; ++i) { @@ -10754,6 +10755,15 @@ static bool isRepeatedTargetShuffleMask(unsigned LaneSizeInBits, MVT VT, return true; } +/// Test whether a target shuffle mask is equivalent within each sub-lane. +/// Unlike isRepeatedShuffleMask we must respect SM_SentinelZero. +static bool isRepeatedTargetShuffleMask(unsigned LaneSizeInBits, MVT VT, + ArrayRef Mask, + SmallVectorImpl &RepeatedMask) { + return isRepeatedTargetShuffleMask(LaneSizeInBits, VT.getScalarSizeInBits(), + Mask, RepeatedMask); +} + /// Checks whether the vector elements referenced by two shuffle masks are /// equivalent. static bool IsElementEquivalent(int MaskSize, SDValue Op, SDValue ExpectedOp, -- 2.7.4