blob: 2f8ae1b1fcbf06496f4d49f10ef2a2b003d383c5 [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
Craig Toppercbc96a62012-03-20 06:42:26 +000030void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
David Greene3a2b5082011-02-17 19:18:59 +000031
32// <3,1> or <6,7,2,3>
Craig Toppercbc96a62012-03-20 06:42:26 +000033void DecodeMOVHLPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask);
David Greene3a2b5082011-02-17 19:18:59 +000034
35// <0,2> or <0,1,4,5>
Craig Toppercbc96a62012-03-20 06:42:26 +000036void DecodeMOVLHPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask);
David Greene3a2b5082011-02-17 19:18:59 +000037
Craig Toppercbc96a62012-03-20 06:42:26 +000038void DecodePSHUFMask(EVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
David Greene3a2b5082011-02-17 19:18:59 +000039
Craig Toppercbc96a62012-03-20 06:42:26 +000040void DecodePSHUFHWMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
David Greene3a2b5082011-02-17 19:18:59 +000041
Craig Toppercbc96a62012-03-20 06:42:26 +000042void DecodePSHUFLWMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
David Greene3a2b5082011-02-17 19:18:59 +000043
Craig Topper1f710572012-02-06 07:17:51 +000044/// DecodeSHUFPMask - This decodes the shuffle masks for shufp*. VT indicates
45/// the type of the vector allowing it to handle different datatypes and vector
46/// widths.
Craig Toppercbc96a62012-03-20 06:42:26 +000047void DecodeSHUFPMask(EVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
David Greene3a2b5082011-02-17 19:18:59 +000048
Craig Topper3cb802c2011-12-06 05:31:16 +000049/// DecodeUNPCKHMask - This decodes the shuffle masks for unpckhps/unpckhpd
Craig Topper1f710572012-02-06 07:17:51 +000050/// and punpckh*. VT indicates the type of the vector allowing it to handle
51/// different datatypes and vector widths.
Craig Toppercbc96a62012-03-20 06:42:26 +000052void DecodeUNPCKHMask(EVT VT, SmallVectorImpl<int> &ShuffleMask);
David Greene3a2b5082011-02-17 19:18:59 +000053
Craig Topper3cb802c2011-12-06 05:31:16 +000054/// DecodeUNPCKLMask - This decodes the shuffle masks for unpcklps/unpcklpd
Craig Topper1f710572012-02-06 07:17:51 +000055/// and punpckl*. VT indicates the type of the vector allowing it to handle
56/// different datatypes and vector widths.
Craig Toppercbc96a62012-03-20 06:42:26 +000057void DecodeUNPCKLMask(EVT VT, SmallVectorImpl<int> &ShuffleMask);
David Greene3a2b5082011-02-17 19:18:59 +000058
Bruno Cardoso Lopesb878caa2011-07-21 01:55:47 +000059
Craig Topper1f710572012-02-06 07:17:51 +000060void DecodeVPERM2X128Mask(EVT VT, unsigned Imm,
Craig Toppercbc96a62012-03-20 06:42:26 +000061 SmallVectorImpl<int> &ShuffleMask);
Bruno Cardoso Lopesf15dfe52011-08-12 21:48:26 +000062
David Greene3a2b5082011-02-17 19:18:59 +000063} // llvm namespace
64
65#endif