Remove some patterns for matching vector_shuffle instructions since vector_shuffles...
[oota-llvm.git] / 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 = ~0U
28 };
29
30 void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl<unsigned> &ShuffleMask);
31
32 // <3,1> or <6,7,2,3>
33 void DecodeMOVHLPSMask(unsigned NElts,
34                        SmallVectorImpl<unsigned> &ShuffleMask);
35
36 // <0,2> or <0,1,4,5>
37 void DecodeMOVLHPSMask(unsigned NElts,
38                        SmallVectorImpl<unsigned> &ShuffleMask);
39
40 void DecodePSHUFMask(EVT VT, unsigned Imm,
41                      SmallVectorImpl<unsigned> &ShuffleMask);
42
43 void DecodePSHUFHWMask(unsigned Imm,
44                        SmallVectorImpl<unsigned> &ShuffleMask);
45
46 void DecodePSHUFLWMask(unsigned Imm,
47                        SmallVectorImpl<unsigned> &ShuffleMask);
48
49 /// DecodeSHUFPMask - This decodes the shuffle masks for shufp*. VT indicates
50 /// the type of the vector allowing it to handle different datatypes and vector
51 /// widths.
52 void DecodeSHUFPMask(EVT VT, unsigned Imm,
53                      SmallVectorImpl<unsigned> &ShuffleMask);
54
55 /// DecodeUNPCKHMask - This decodes the shuffle masks for unpckhps/unpckhpd
56 /// and punpckh*. VT indicates the type of the vector allowing it to handle
57 /// different datatypes and vector widths.
58 void DecodeUNPCKHMask(EVT VT, SmallVectorImpl<unsigned> &ShuffleMask);
59
60 /// DecodeUNPCKLMask - This decodes the shuffle masks for unpcklps/unpcklpd
61 /// and punpckl*. VT indicates the type of the vector allowing it to handle
62 /// different datatypes and vector widths.
63 void DecodeUNPCKLMask(EVT VT, SmallVectorImpl<unsigned> &ShuffleMask);
64
65
66 void DecodeVPERM2X128Mask(EVT VT, unsigned Imm,
67                           SmallVectorImpl<unsigned> &ShuffleMask);
68
69 } // llvm namespace
70
71 #endif