]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/llvm/lib/Target/X86/Utils/X86ShuffleDecode.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / llvm / lib / Target / X86 / Utils / X86ShuffleDecode.h
1 //===-- X86ShuffleDecode.h - X86 shuffle decode logic -----------*-C++-*---===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Define several functions to decode x86 specific shuffle semantics into a
11 // generic vector mask.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef X86_SHUFFLE_DECODE_H
16 #define X86_SHUFFLE_DECODE_H
17
18 #include "llvm/ADT/SmallVector.h"
19 #include "llvm/CodeGen/ValueTypes.h"
20
21 //===----------------------------------------------------------------------===//
22 //  Vector Mask Decoding
23 //===----------------------------------------------------------------------===//
24
25 namespace llvm {
26 enum {
27   SM_SentinelZero = -1
28 };
29
30 void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
31
32 // <3,1> or <6,7,2,3>
33 void DecodeMOVHLPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask);
34
35 // <0,2> or <0,1,4,5>
36 void DecodeMOVLHPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask);
37
38 void DecodePALIGNRMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
39
40 void DecodePSHUFMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
41
42 void DecodePSHUFHWMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
43
44 void DecodePSHUFLWMask(MVT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
45
46 /// DecodeSHUFPMask - This decodes the shuffle masks for shufp*. VT indicates
47 /// the type of the vector allowing it to handle different datatypes and vector
48 /// widths.
49 void DecodeSHUFPMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
50
51 /// DecodeUNPCKHMask - This decodes the shuffle masks for unpckhps/unpckhpd
52 /// and punpckh*. VT indicates the type of the vector allowing it to handle
53 /// different datatypes and vector widths.
54 void DecodeUNPCKHMask(MVT VT, SmallVectorImpl<int> &ShuffleMask);
55
56 /// DecodeUNPCKLMask - This decodes the shuffle masks for unpcklps/unpcklpd
57 /// and punpckl*. VT indicates the type of the vector allowing it to handle
58 /// different datatypes and vector widths.
59 void DecodeUNPCKLMask(MVT VT, SmallVectorImpl<int> &ShuffleMask);
60
61
62 void DecodeVPERM2X128Mask(MVT VT, unsigned Imm,
63                           SmallVectorImpl<int> &ShuffleMask);
64
65 /// DecodeVPERMMask - this decodes the shuffle masks for VPERMQ/VPERMPD.
66 /// No VT provided since it only works on 256-bit, 4 element vectors.
67 void DecodeVPERMMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
68
69 } // llvm namespace
70
71 #endif