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 X86_SHUFFLE_DECODE_H
16 #define X86_SHUFFLE_DECODE_H
18 #include "llvm/ADT/SmallVector.h"
19 #include "llvm/CodeGen/ValueTypes.h"
21 //===----------------------------------------------------------------------===//
22 // Vector Mask Decoding
23 //===----------------------------------------------------------------------===//
30 void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
33 void DecodeMOVHLPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask);
36 void DecodeMOVLHPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask);
38 void DecodePSHUFMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
40 void DecodePSHUFHWMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
42 void DecodePSHUFLWMask(MVT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
44 /// DecodeSHUFPMask - This decodes the shuffle masks for shufp*. VT indicates
45 /// the type of the vector allowing it to handle different datatypes and vector
47 void DecodeSHUFPMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
49 /// DecodeUNPCKHMask - This decodes the shuffle masks for unpckhps/unpckhpd
50 /// and punpckh*. VT indicates the type of the vector allowing it to handle
51 /// different datatypes and vector widths.
52 void DecodeUNPCKHMask(MVT VT, SmallVectorImpl<int> &ShuffleMask);
54 /// DecodeUNPCKLMask - This decodes the shuffle masks for unpcklps/unpcklpd
55 /// and punpckl*. VT indicates the type of the vector allowing it to handle
56 /// different datatypes and vector widths.
57 void DecodeUNPCKLMask(MVT VT, SmallVectorImpl<int> &ShuffleMask);
60 void DecodeVPERM2X128Mask(MVT VT, unsigned Imm,
61 SmallVectorImpl<int> &ShuffleMask);
63 /// DecodeVPERMMask - this decodes the shuffle masks for VPERMQ/VPERMPD.
64 /// No VT provided since it only works on 256-bit, 4 element vectors.
65 void DecodeVPERMMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask);