blob: 29634151757957f8e006f140d94eb4133ecebc50 [file] [log] [blame]
Craig Topper69653af2015-12-31 22:40:45 +00001//===-- X86ShuffleDecodeConstantPool.h - X86 shuffle decode -----*-C++-*---===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Craig Topper69653af2015-12-31 22:40:45 +00006//
7//===----------------------------------------------------------------------===//
8//
9// Define several functions to decode x86 specific shuffle semantics using
10// constants from the constant pool.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_X86_X86SHUFFLEDECODECONSTANTPOOL_H
15#define LLVM_LIB_TARGET_X86_X86SHUFFLEDECODECONSTANTPOOL_H
16
17#include "llvm/ADT/SmallVector.h"
18
19//===----------------------------------------------------------------------===//
20// Vector Mask Decoding
21//===----------------------------------------------------------------------===//
22
23namespace llvm {
24class Constant;
25class MVT;
26
Simon Pilgrim47617032016-04-08 14:17:07 +000027/// Decode a PSHUFB mask from an IR-level vector constant.
Craig Topperc8e183f2018-10-22 22:14:05 +000028void DecodePSHUFBMask(const Constant *C, unsigned Width,
29 SmallVectorImpl<int> &ShuffleMask);
Craig Topper69653af2015-12-31 22:40:45 +000030
Simon Pilgrim47617032016-04-08 14:17:07 +000031/// Decode a VPERMILP variable mask from an IR-level vector constant.
Craig Topperc8e183f2018-10-22 22:14:05 +000032void DecodeVPERMILPMask(const Constant *C, unsigned ElSize, unsigned Width,
Craig Topper69653af2015-12-31 22:40:45 +000033 SmallVectorImpl<int> &ShuffleMask);
34
Simon Pilgrim2ead8612016-06-04 21:44:28 +000035/// Decode a VPERMILP2 variable mask from an IR-level vector constant.
36void DecodeVPERMIL2PMask(const Constant *C, unsigned MatchImm, unsigned ElSize,
Craig Topperc8e183f2018-10-22 22:14:05 +000037 unsigned Width,
Simon Pilgrim2ead8612016-06-04 21:44:28 +000038 SmallVectorImpl<int> &ShuffleMask);
39
Simon Pilgrim1cc57122016-04-09 14:51:26 +000040/// Decode a VPPERM variable mask from an IR-level vector constant.
Craig Topperc8e183f2018-10-22 22:14:05 +000041void DecodeVPPERMMask(const Constant *C, unsigned Width,
42 SmallVectorImpl<int> &ShuffleMask);
Simon Pilgrim1cc57122016-04-09 14:51:26 +000043
Simon Pilgrim47617032016-04-08 14:17:07 +000044/// Decode a VPERM W/D/Q/PS/PD mask from an IR-level vector constant.
Craig Topperc8e183f2018-10-22 22:14:05 +000045void DecodeVPERMVMask(const Constant *C, unsigned ElSize, unsigned Width,
Craig Topper69653af2015-12-31 22:40:45 +000046 SmallVectorImpl<int> &ShuffleMask);
47
Simon Pilgrim47617032016-04-08 14:17:07 +000048/// Decode a VPERMT2 W/D/Q/PS/PD mask from an IR-level vector constant.
Craig Topperc8e183f2018-10-22 22:14:05 +000049void DecodeVPERMV3Mask(const Constant *C, unsigned ElSize, unsigned Width,
Craig Topper69653af2015-12-31 22:40:45 +000050 SmallVectorImpl<int> &ShuffleMask);
51
52} // llvm namespace
53
54#endif