blob: 877c9bd54374de859b317ea03b78ce3000931bc3 [file] [log] [blame]
David Greene3a2b5082011-02-17 19:18:59 +00001//===-- 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"
David Greene20a1cbe2011-02-28 19:06:56 +000019#include "llvm/CodeGen/ValueTypes.h"
David Greene3a2b5082011-02-17 19:18:59 +000020
21//===----------------------------------------------------------------------===//
22// Vector Mask Decoding
23//===----------------------------------------------------------------------===//
24
25namespace llvm {
26enum {
27 SM_SentinelZero = ~0U
28};
29
30void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl<unsigned> &ShuffleMask);
31
32// <3,1> or <6,7,2,3>
33void DecodeMOVHLPSMask(unsigned NElts,
34 SmallVectorImpl<unsigned> &ShuffleMask);
35
36// <0,2> or <0,1,4,5>
37void DecodeMOVLHPSMask(unsigned NElts,
38 SmallVectorImpl<unsigned> &ShuffleMask);
39
Craig Topper1f710572012-02-06 07:17:51 +000040void DecodePSHUFMask(EVT VT, unsigned Imm,
David Greene3a2b5082011-02-17 19:18:59 +000041 SmallVectorImpl<unsigned> &ShuffleMask);
42
43void DecodePSHUFHWMask(unsigned Imm,
44 SmallVectorImpl<unsigned> &ShuffleMask);
45
46void DecodePSHUFLWMask(unsigned Imm,
47 SmallVectorImpl<unsigned> &ShuffleMask);
48
Craig Topper1f710572012-02-06 07:17:51 +000049/// 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.
Craig Topperc16db842011-11-29 07:49:05 +000052void DecodeSHUFPMask(EVT VT, unsigned Imm,
53 SmallVectorImpl<unsigned> &ShuffleMask);
David Greene3a2b5082011-02-17 19:18:59 +000054
Craig Topper3cb802c2011-12-06 05:31:16 +000055/// DecodeUNPCKHMask - This decodes the shuffle masks for unpckhps/unpckhpd
Craig Topper1f710572012-02-06 07:17:51 +000056/// and punpckh*. VT indicates the type of the vector allowing it to handle
57/// different datatypes and vector widths.
Craig Topper3cb802c2011-12-06 05:31:16 +000058void DecodeUNPCKHMask(EVT VT, SmallVectorImpl<unsigned> &ShuffleMask);
David Greene3a2b5082011-02-17 19:18:59 +000059
Craig Topper3cb802c2011-12-06 05:31:16 +000060/// DecodeUNPCKLMask - This decodes the shuffle masks for unpcklps/unpcklpd
Craig Topper1f710572012-02-06 07:17:51 +000061/// and punpckl*. VT indicates the type of the vector allowing it to handle
62/// different datatypes and vector widths.
Craig Topper3cb802c2011-12-06 05:31:16 +000063void DecodeUNPCKLMask(EVT VT, SmallVectorImpl<unsigned> &ShuffleMask);
David Greene3a2b5082011-02-17 19:18:59 +000064
Bruno Cardoso Lopesb878caa2011-07-21 01:55:47 +000065
Craig Topper1f710572012-02-06 07:17:51 +000066void DecodeVPERM2X128Mask(EVT VT, unsigned Imm,
Bruno Cardoso Lopesf15dfe52011-08-12 21:48:26 +000067 SmallVectorImpl<unsigned> &ShuffleMask);
68
David Greene3a2b5082011-02-17 19:18:59 +000069} // llvm namespace
70
71#endif