1 //===-- X86ShuffleDecode.h - X86 shuffle decode logic -----------*-C++-*---===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Define several functions to decode x86 specific shuffle semantics into a
11 // generic vector mask.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_X86_UTILS_X86SHUFFLEDECODE_H
16 #define LLVM_LIB_TARGET_X86_UTILS_X86SHUFFLEDECODE_H
18 #include "llvm/ADT/SmallVector.h"
19 #include "llvm/ADT/ArrayRef.h"
21 //===----------------------------------------------------------------------===//
22 // Vector Mask Decoding
23 //===----------------------------------------------------------------------===//
26 class ConstantDataSequential;
33 void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
36 void DecodeMOVHLPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask);
39 void DecodeMOVLHPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask);
41 void DecodeMOVSLDUPMask(MVT VT, SmallVectorImpl<int> &ShuffleMask);
43 void DecodeMOVSHDUPMask(MVT VT, SmallVectorImpl<int> &ShuffleMask);
45 void DecodePALIGNRMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
47 void DecodePSHUFMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
49 void DecodePSHUFHWMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
51 void DecodePSHUFLWMask(MVT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
53 /// DecodeSHUFPMask - This decodes the shuffle masks for shufp*. VT indicates
54 /// the type of the vector allowing it to handle different datatypes and vector
56 void DecodeSHUFPMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
58 /// DecodeUNPCKHMask - This decodes the shuffle masks for unpckhps/unpckhpd
59 /// and punpckh*. VT indicates the type of the vector allowing it to handle
60 /// different datatypes and vector widths.
61 void DecodeUNPCKHMask(MVT VT, SmallVectorImpl<int> &ShuffleMask);
63 /// DecodeUNPCKLMask - This decodes the shuffle masks for unpcklps/unpcklpd
64 /// and punpckl*. VT indicates the type of the vector allowing it to handle
65 /// different datatypes and vector widths.
66 void DecodeUNPCKLMask(MVT VT, SmallVectorImpl<int> &ShuffleMask);
68 /// \brief Decode a PSHUFB mask from an IR-level vector constant.
69 void DecodePSHUFBMask(const ConstantDataSequential *C,
70 SmallVectorImpl<int> &ShuffleMask);
72 /// \brief Decode a PSHUFB mask from a raw array of constants such as from
74 void DecodePSHUFBMask(ArrayRef<uint64_t> RawMask,
75 SmallVectorImpl<int> &ShuffleMask);
77 /// \brief Decode a BLEND immediate mask into a shuffle mask.
78 void DecodeBLENDMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
80 void DecodeVPERM2X128Mask(MVT VT, unsigned Imm,
81 SmallVectorImpl<int> &ShuffleMask);
83 /// DecodeVPERMMask - this decodes the shuffle masks for VPERMQ/VPERMPD.
84 /// No VT provided since it only works on 256-bit, 4 element vectors.
85 void DecodeVPERMMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask);