LLVM API Documentation
00001 //===-- X86ShuffleDecode.h - X86 shuffle decode logic -----------*-C++-*---===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // Define several functions to decode x86 specific shuffle semantics into a 00011 // generic vector mask. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_LIB_TARGET_X86_UTILS_X86SHUFFLEDECODE_H 00016 #define LLVM_LIB_TARGET_X86_UTILS_X86SHUFFLEDECODE_H 00017 00018 #include "llvm/ADT/SmallVector.h" 00019 #include "llvm/ADT/ArrayRef.h" 00020 00021 //===----------------------------------------------------------------------===// 00022 // Vector Mask Decoding 00023 //===----------------------------------------------------------------------===// 00024 00025 namespace llvm { 00026 class ConstantDataSequential; 00027 class MVT; 00028 00029 enum { 00030 SM_SentinelZero = -1 00031 }; 00032 00033 void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask); 00034 00035 // <3,1> or <6,7,2,3> 00036 void DecodeMOVHLPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask); 00037 00038 // <0,2> or <0,1,4,5> 00039 void DecodeMOVLHPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask); 00040 00041 void DecodeMOVSLDUPMask(MVT VT, SmallVectorImpl<int> &ShuffleMask); 00042 00043 void DecodeMOVSHDUPMask(MVT VT, SmallVectorImpl<int> &ShuffleMask); 00044 00045 void DecodePALIGNRMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask); 00046 00047 void DecodePSHUFMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask); 00048 00049 void DecodePSHUFHWMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask); 00050 00051 void DecodePSHUFLWMask(MVT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask); 00052 00053 /// DecodeSHUFPMask - This decodes the shuffle masks for shufp*. VT indicates 00054 /// the type of the vector allowing it to handle different datatypes and vector 00055 /// widths. 00056 void DecodeSHUFPMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask); 00057 00058 /// DecodeUNPCKHMask - This decodes the shuffle masks for unpckhps/unpckhpd 00059 /// and punpckh*. VT indicates the type of the vector allowing it to handle 00060 /// different datatypes and vector widths. 00061 void DecodeUNPCKHMask(MVT VT, SmallVectorImpl<int> &ShuffleMask); 00062 00063 /// DecodeUNPCKLMask - This decodes the shuffle masks for unpcklps/unpcklpd 00064 /// and punpckl*. VT indicates the type of the vector allowing it to handle 00065 /// different datatypes and vector widths. 00066 void DecodeUNPCKLMask(MVT VT, SmallVectorImpl<int> &ShuffleMask); 00067 00068 /// \brief Decode a PSHUFB mask from an IR-level vector constant. 00069 void DecodePSHUFBMask(const ConstantDataSequential *C, 00070 SmallVectorImpl<int> &ShuffleMask); 00071 00072 /// \brief Decode a PSHUFB mask from a raw array of constants such as from 00073 /// BUILD_VECTOR. 00074 void DecodePSHUFBMask(ArrayRef<uint64_t> RawMask, 00075 SmallVectorImpl<int> &ShuffleMask); 00076 00077 /// \brief Decode a BLEND immediate mask into a shuffle mask. 00078 void DecodeBLENDMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask); 00079 00080 void DecodeVPERM2X128Mask(MVT VT, unsigned Imm, 00081 SmallVectorImpl<int> &ShuffleMask); 00082 00083 /// DecodeVPERMMask - this decodes the shuffle masks for VPERMQ/VPERMPD. 00084 /// No VT provided since it only works on 256-bit, 4 element vectors. 00085 void DecodeVPERMMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask); 00086 00087 } // llvm namespace 00088 00089 #endif