From df5fc4504b8625d683ebcaa02e3559d2f5336096 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sun, 15 Jan 2023 15:43:19 +0000 Subject: [PATCH] [X86] Move isShuffleMaskInputInPlace to allow additional uses in a future patch. NFCI. A future patch needs isShuffleMaskInputInPlace defined earlier in the source file. --- llvm/lib/Target/X86/X86ISelLowering.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 9b98f90..049700c 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -14648,6 +14648,21 @@ static bool isSingleSHUFPSMask(ArrayRef Mask) { return true; } +/// Test whether the specified input (0 or 1) is in-place blended by the +/// given mask. +/// +/// This returns true if the elements from a particular input are already in the +/// slot required by the given mask and require no permutation. +static bool isShuffleMaskInputInPlace(int Input, ArrayRef Mask) { + assert((Input == 0 || Input == 1) && "Only two inputs to shuffles."); + int Size = Mask.size(); + for (int i = 0; i < Size; ++i) + if (Mask[i] >= 0 && Mask[i] / Size == Input && Mask[i] % Size != i) + return false; + + return true; +} + /// If we are extracting two 128-bit halves of a vector and shuffling the /// result, match that to a 256-bit AVX2 vperm* instruction to avoid a /// multi-shuffle lowering. @@ -17566,21 +17581,6 @@ static SDValue lowerShuffleWithUndefHalf(const SDLoc &DL, MVT VT, SDValue V1, return SDValue(); } -/// Test whether the specified input (0 or 1) is in-place blended by the -/// given mask. -/// -/// This returns true if the elements from a particular input are already in the -/// slot required by the given mask and require no permutation. -static bool isShuffleMaskInputInPlace(int Input, ArrayRef Mask) { - assert((Input == 0 || Input == 1) && "Only two inputs to shuffles."); - int Size = Mask.size(); - for (int i = 0; i < Size; ++i) - if (Mask[i] >= 0 && Mask[i] / Size == Input && Mask[i] % Size != i) - return false; - - return true; -} - /// Handle case where shuffle sources are coming from the same 128-bit lane and /// every lane can be represented as the same repeating mask - allowing us to /// shuffle the sources with the repeating shuffle and then permute the result -- 2.7.4