blob: bfcbf71d252f363f09f553fc19e4218297fe7f0a [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- X86InstrFormats.td - X86 Instruction Formats -------*- tablegen -*-===//
2//
Evan Cheng12c6be82007-07-31 08:04:03 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Jia Liub22310f2012-02-18 12:03:15 +00007//
Evan Cheng12c6be82007-07-31 08:04:03 +00008//===----------------------------------------------------------------------===//
9
10//===----------------------------------------------------------------------===//
11// X86 Instruction Format Definitions.
12//
13
14// Format specifies the encoding used by the instruction. This is part of the
15// ad-hoc solution used to emit machine instruction encodings by our machine
16// code emitter.
Craig Topper56f0ed812014-02-19 08:25:02 +000017class Format<bits<7> val> {
18 bits<7> Value = val;
Evan Cheng12c6be82007-07-31 08:04:03 +000019}
20
Craig Topper61b62e52016-08-22 07:38:41 +000021def Pseudo : Format<0>;
22def RawFrm : Format<1>;
23def AddRegFrm : Format<2>;
24def RawFrmMemOffs : Format<3>;
25def RawFrmSrc : Format<4>;
26def RawFrmDst : Format<5>;
27def RawFrmDstSrc : Format<6>;
28def RawFrmImm8 : Format<7>;
29def RawFrmImm16 : Format<8>;
Craig Topper5f8419d2016-08-22 07:38:50 +000030def MRMDestMem : Format<32>;
31def MRMSrcMem : Format<33>;
32def MRMSrcMem4VOp3 : Format<34>;
33def MRMSrcMemOp4 : Format<35>;
Craig Topper61b62e52016-08-22 07:38:41 +000034def MRMXm : Format<39>;
35def MRM0m : Format<40>; def MRM1m : Format<41>; def MRM2m : Format<42>;
36def MRM3m : Format<43>; def MRM4m : Format<44>; def MRM5m : Format<45>;
37def MRM6m : Format<46>; def MRM7m : Format<47>;
Craig Topper5f8419d2016-08-22 07:38:50 +000038def MRMDestReg : Format<48>;
39def MRMSrcReg : Format<49>;
40def MRMSrcReg4VOp3 : Format<50>;
41def MRMSrcRegOp4 : Format<51>;
Craig Topper61b62e52016-08-22 07:38:41 +000042def MRMXr : Format<55>;
43def MRM0r : Format<56>; def MRM1r : Format<57>; def MRM2r : Format<58>;
44def MRM3r : Format<59>; def MRM4r : Format<60>; def MRM5r : Format<61>;
45def MRM6r : Format<62>; def MRM7r : Format<63>;
46def MRM_C0 : Format<64>; def MRM_C1 : Format<65>; def MRM_C2 : Format<66>;
47def MRM_C3 : Format<67>; def MRM_C4 : Format<68>; def MRM_C5 : Format<69>;
48def MRM_C6 : Format<70>; def MRM_C7 : Format<71>; def MRM_C8 : Format<72>;
49def MRM_C9 : Format<73>; def MRM_CA : Format<74>; def MRM_CB : Format<75>;
50def MRM_CC : Format<76>; def MRM_CD : Format<77>; def MRM_CE : Format<78>;
51def MRM_CF : Format<79>; def MRM_D0 : Format<80>; def MRM_D1 : Format<81>;
52def MRM_D2 : Format<82>; def MRM_D3 : Format<83>; def MRM_D4 : Format<84>;
53def MRM_D5 : Format<85>; def MRM_D6 : Format<86>; def MRM_D7 : Format<87>;
54def MRM_D8 : Format<88>; def MRM_D9 : Format<89>; def MRM_DA : Format<90>;
55def MRM_DB : Format<91>; def MRM_DC : Format<92>; def MRM_DD : Format<93>;
56def MRM_DE : Format<94>; def MRM_DF : Format<95>; def MRM_E0 : Format<96>;
57def MRM_E1 : Format<97>; def MRM_E2 : Format<98>; def MRM_E3 : Format<99>;
58def MRM_E4 : Format<100>; def MRM_E5 : Format<101>; def MRM_E6 : Format<102>;
59def MRM_E7 : Format<103>; def MRM_E8 : Format<104>; def MRM_E9 : Format<105>;
60def MRM_EA : Format<106>; def MRM_EB : Format<107>; def MRM_EC : Format<108>;
61def MRM_ED : Format<109>; def MRM_EE : Format<110>; def MRM_EF : Format<111>;
62def MRM_F0 : Format<112>; def MRM_F1 : Format<113>; def MRM_F2 : Format<114>;
63def MRM_F3 : Format<115>; def MRM_F4 : Format<116>; def MRM_F5 : Format<117>;
64def MRM_F6 : Format<118>; def MRM_F7 : Format<119>; def MRM_F8 : Format<120>;
65def MRM_F9 : Format<121>; def MRM_FA : Format<122>; def MRM_FB : Format<123>;
66def MRM_FC : Format<124>; def MRM_FD : Format<125>; def MRM_FE : Format<126>;
67def MRM_FF : Format<127>;
Evan Cheng12c6be82007-07-31 08:04:03 +000068
69// ImmType - This specifies the immediate type used by an instruction. This is
70// part of the ad-hoc solution used to emit machine instruction encodings by our
71// machine code emitter.
David Woodhouse0b6c9492014-01-30 22:20:41 +000072class ImmType<bits<4> val> {
73 bits<4> Value = val;
Evan Cheng12c6be82007-07-31 08:04:03 +000074}
Chris Lattner12455ca2010-02-12 22:27:07 +000075def NoImm : ImmType<0>;
76def Imm8 : ImmType<1>;
77def Imm8PCRel : ImmType<2>;
Craig Topperca0eda32016-08-22 01:37:19 +000078def Imm8Reg : ImmType<3>; // Register encoded in [7:4].
79def Imm16 : ImmType<4>;
80def Imm16PCRel : ImmType<5>;
81def Imm32 : ImmType<6>;
82def Imm32PCRel : ImmType<7>;
83def Imm32S : ImmType<8>;
84def Imm64 : ImmType<9>;
Evan Cheng12c6be82007-07-31 08:04:03 +000085
86// FPFormat - This specifies what form this FP instruction has. This is used by
87// the Floating-Point stackifier pass.
88class FPFormat<bits<3> val> {
89 bits<3> Value = val;
90}
91def NotFP : FPFormat<0>;
92def ZeroArgFP : FPFormat<1>;
93def OneArgFP : FPFormat<2>;
94def OneArgFPRW : FPFormat<3>;
95def TwoArgFP : FPFormat<4>;
96def CompareFP : FPFormat<5>;
97def CondMovFP : FPFormat<6>;
98def SpecialFP : FPFormat<7>;
99
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000100// Class specifying the SSE execution domain, used by the SSEDomainFix pass.
Jakob Stoklund Olesendbff4e82010-03-30 22:46:53 +0000101// Keep in sync with tables in X86InstrInfo.cpp.
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000102class Domain<bits<2> val> {
103 bits<2> Value = val;
104}
105def GenericDomain : Domain<0>;
Jakob Stoklund Olesendbff4e82010-03-30 22:46:53 +0000106def SSEPackedSingle : Domain<1>;
107def SSEPackedDouble : Domain<2>;
108def SSEPackedInt : Domain<3>;
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000109
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000110// Class specifying the vector form of the decompressed
111// displacement of 8-bit.
112class CD8VForm<bits<3> val> {
113 bits<3> Value = val;
114}
115def CD8VF : CD8VForm<0>; // v := VL
116def CD8VH : CD8VForm<1>; // v := VL/2
117def CD8VQ : CD8VForm<2>; // v := VL/4
118def CD8VO : CD8VForm<3>; // v := VL/8
Adam Nemet449b3f02014-10-15 23:42:09 +0000119// The tuple (subvector) forms.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000120def CD8VT1 : CD8VForm<4>; // v := 1
121def CD8VT2 : CD8VForm<5>; // v := 2
122def CD8VT4 : CD8VForm<6>; // v := 4
123def CD8VT8 : CD8VForm<7>; // v := 8
124
Craig Topper10243c82014-01-31 08:47:06 +0000125// Class specifying the prefix used an opcode extension.
Craig Topper5ccb6172014-02-18 00:21:49 +0000126class Prefix<bits<3> val> {
127 bits<3> Value = val;
Craig Topper10243c82014-01-31 08:47:06 +0000128}
129def NoPrfx : Prefix<0>;
Craig Topper5ccb6172014-02-18 00:21:49 +0000130def PS : Prefix<1>;
131def PD : Prefix<2>;
132def XS : Prefix<3>;
133def XD : Prefix<4>;
Craig Topper10243c82014-01-31 08:47:06 +0000134
135// Class specifying the opcode map.
Craig Topper56f0ed812014-02-19 08:25:02 +0000136class Map<bits<3> val> {
137 bits<3> Value = val;
Craig Topper10243c82014-01-31 08:47:06 +0000138}
139def OB : Map<0>;
140def TB : Map<1>;
141def T8 : Map<2>;
142def TA : Map<3>;
143def XOP8 : Map<4>;
144def XOP9 : Map<5>;
145def XOPA : Map<6>;
Craig Topper10243c82014-01-31 08:47:06 +0000146
Craig Topperd402df32014-02-02 07:08:01 +0000147// Class specifying the encoding
148class Encoding<bits<2> val> {
149 bits<2> Value = val;
150}
151def EncNormal : Encoding<0>;
152def EncVEX : Encoding<1>;
153def EncXOP : Encoding<2>;
154def EncEVEX : Encoding<3>;
155
Craig Topperfa6298a2014-02-02 09:25:09 +0000156// Operand size for encodings that change based on mode.
157class OperandSize<bits<2> val> {
158 bits<2> Value = val;
159}
160def OpSizeFixed : OperandSize<0>; // Never needs a 0x66 prefix.
161def OpSize16 : OperandSize<1>; // Needs 0x66 prefix in 32-bit mode.
162def OpSize32 : OperandSize<2>; // Needs 0x66 prefix in 16-bit mode.
163
Craig Topperb86338f2014-12-24 06:05:22 +0000164// Address size for encodings that change based on mode.
165class AddressSize<bits<2> val> {
166 bits<2> Value = val;
167}
168def AdSizeX : AddressSize<0>; // Address size determined using addr operand.
169def AdSize16 : AddressSize<1>; // Encodes a 16-bit address.
170def AdSize32 : AddressSize<2>; // Encodes a 32-bit address.
171def AdSize64 : AddressSize<3>; // Encodes a 64-bit address.
172
Evan Cheng12c6be82007-07-31 08:04:03 +0000173// Prefix byte classes which are used to indicate to the ad-hoc machine code
174// emitter that various prefix bytes are required.
Craig Topperfa6298a2014-02-02 09:25:09 +0000175class OpSize16 { OperandSize OpSize = OpSize16; }
176class OpSize32 { OperandSize OpSize = OpSize32; }
Craig Topperb86338f2014-12-24 06:05:22 +0000177class AdSize16 { AddressSize AdSize = AdSize16; }
178class AdSize32 { AddressSize AdSize = AdSize32; }
179class AdSize64 { AddressSize AdSize = AdSize64; }
Evan Cheng12c6be82007-07-31 08:04:03 +0000180class REX_W { bit hasREX_WPrefix = 1; }
Andrew Lenharth0070dd12008-03-01 13:37:02 +0000181class LOCK { bit hasLockPrefix = 1; }
Craig Topperec688662014-01-31 07:00:55 +0000182class REP { bit hasREPPrefix = 1; }
Craig Topperda7160d2014-02-01 08:17:56 +0000183class TB { Map OpMap = TB; }
Craig Topper10243c82014-01-31 08:47:06 +0000184class T8 { Map OpMap = T8; }
185class TA { Map OpMap = TA; }
Craig Topper5ccb6172014-02-18 00:21:49 +0000186class XOP8 { Map OpMap = XOP8; Prefix OpPrefix = PS; }
187class XOP9 { Map OpMap = XOP9; Prefix OpPrefix = PS; }
188class XOPA { Map OpMap = XOPA; Prefix OpPrefix = PS; }
Craig Toppere2347df2014-02-20 07:59:43 +0000189class OBXS { Prefix OpPrefix = XS; }
Craig Topper5ccb6172014-02-18 00:21:49 +0000190class PS : TB { Prefix OpPrefix = PS; }
Craig Topperda7160d2014-02-01 08:17:56 +0000191class PD : TB { Prefix OpPrefix = PD; }
192class XD : TB { Prefix OpPrefix = XD; }
193class XS : TB { Prefix OpPrefix = XS; }
Craig Topper5ccb6172014-02-18 00:21:49 +0000194class T8PS : T8 { Prefix OpPrefix = PS; }
Craig Topperda7160d2014-02-01 08:17:56 +0000195class T8PD : T8 { Prefix OpPrefix = PD; }
196class T8XD : T8 { Prefix OpPrefix = XD; }
197class T8XS : T8 { Prefix OpPrefix = XS; }
Craig Topper5ccb6172014-02-18 00:21:49 +0000198class TAPS : TA { Prefix OpPrefix = PS; }
Craig Topperda7160d2014-02-01 08:17:56 +0000199class TAPD : TA { Prefix OpPrefix = PD; }
200class TAXD : TA { Prefix OpPrefix = XD; }
Craig Topperd402df32014-02-02 07:08:01 +0000201class VEX { Encoding OpEnc = EncVEX; }
Ayman Musa51ffeab2017-02-20 08:27:54 +0000202class VEX_W { bits<2> VEX_WPrefix = 1; }
203class VEX_WIG { bits<2> VEX_WPrefix = 2; }
Craig Topperd402df32014-02-02 07:08:01 +0000204class VEX_4V : VEX { bit hasVEX_4V = 1; }
Bruno Cardoso Lopesfd8bfcd2010-07-13 21:07:28 +0000205class VEX_L { bit hasVEX_L = 1; }
Craig Topperf18c8962011-10-04 06:30:42 +0000206class VEX_LIG { bit ignoresVEX_L = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000207class EVEX : VEX { Encoding OpEnc = EncEVEX; }
208class EVEX_4V : VEX_4V { Encoding OpEnc = EncEVEX; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000209class EVEX_K { bit hasEVEX_K = 1; }
210class EVEX_KZ : EVEX_K { bit hasEVEX_Z = 1; }
211class EVEX_B { bit hasEVEX_B = 1; }
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000212class EVEX_RC { bit hasEVEX_RC = 1; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000213class EVEX_V512 { bit hasEVEX_L2 = 1; bit hasVEX_L = 0; }
Robert Khasanovbfa01312014-07-21 14:54:21 +0000214class EVEX_V256 { bit hasEVEX_L2 = 0; bit hasVEX_L = 1; }
215class EVEX_V128 { bit hasEVEX_L2 = 0; bit hasVEX_L = 0; }
Adam Nemet4dc92b92014-07-17 17:04:34 +0000216
217// Specify AVX512 8-bit compressed displacement encoding based on the vector
218// element size in bits (8, 16, 32, 64) and the CDisp8 form.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000219class EVEX_CD8<int esize, CD8VForm form> {
Adam Nemet4dc92b92014-07-17 17:04:34 +0000220 int CD8_EltSize = !srl(esize, 3);
Adam Nemet4c339ab2014-07-17 17:04:52 +0000221 bits<3> CD8_Form = form.Value;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000222}
Adam Nemet4dc92b92014-07-17 17:04:34 +0000223
Chris Lattner45270db2010-10-03 18:08:05 +0000224class Has3DNow0F0FOpcode { bit has3DNow0F0FOpcode = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000225class XOP { Encoding OpEnc = EncXOP; }
226class XOP_4V : XOP { bit hasVEX_4V = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000227
Ayman Musa0b4f97d2017-05-28 12:39:37 +0000228// Specify the alternative register form instruction to replace the current
229// instruction in case it was picked during generation of memory folding tables
230class FoldGenData<string _RegisterForm> {
231 string FoldGenRegForm = _RegisterForm;
232}
233
Evan Cheng12c6be82007-07-31 08:04:03 +0000234class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
Andrew Trick8523b162012-02-01 23:20:51 +0000235 string AsmStr,
236 InstrItinClass itin,
237 Domain d = GenericDomain>
Evan Cheng12c6be82007-07-31 08:04:03 +0000238 : Instruction {
239 let Namespace = "X86";
240
241 bits<8> Opcode = opcod;
242 Format Form = f;
Craig Topper56f0ed812014-02-19 08:25:02 +0000243 bits<7> FormBits = Form.Value;
Evan Cheng12c6be82007-07-31 08:04:03 +0000244 ImmType ImmT = i;
Evan Cheng12c6be82007-07-31 08:04:03 +0000245
246 dag OutOperandList = outs;
247 dag InOperandList = ins;
248 string AsmString = AsmStr;
249
Chris Lattner7ff33462010-10-31 19:22:57 +0000250 // If this is a pseudo instruction, mark it isCodeGenOnly.
251 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
252
Andrew Trick8523b162012-02-01 23:20:51 +0000253 let Itinerary = itin;
254
Evan Cheng12c6be82007-07-31 08:04:03 +0000255 //
256 // Attributes specific to X86 instructions...
257 //
Craig Topper3484fc22014-01-05 04:17:28 +0000258 bit ForceDisassemble = 0; // Force instruction to disassemble even though it's
259 // isCodeGenonly. Needed to hide an ambiguous
260 // AsmString from the parser, but still disassemble.
261
Craig Topperfa6298a2014-02-02 09:25:09 +0000262 OperandSize OpSize = OpSizeFixed; // Does this instruction's encoding change
Craig Topperb86338f2014-12-24 06:05:22 +0000263 // based on operand size of the mode?
Craig Toppere413b622014-02-26 06:01:21 +0000264 bits<2> OpSizeBits = OpSize.Value;
Craig Topperb86338f2014-12-24 06:05:22 +0000265 AddressSize AdSize = AdSizeX; // Does this instruction's encoding change
266 // based on address size of the mode?
267 bits<2> AdSizeBits = AdSize.Value;
Evan Cheng12c6be82007-07-31 08:04:03 +0000268
Craig Topper10243c82014-01-31 08:47:06 +0000269 Prefix OpPrefix = NoPrfx; // Which prefix byte does this inst have?
Craig Toppere413b622014-02-26 06:01:21 +0000270 bits<3> OpPrefixBits = OpPrefix.Value;
Craig Topper10243c82014-01-31 08:47:06 +0000271 Map OpMap = OB; // Which opcode map does this inst have?
Craig Toppere413b622014-02-26 06:01:21 +0000272 bits<3> OpMapBits = OpMap.Value;
Eric Christopher3a8ae232010-11-30 09:11:54 +0000273 bit hasREX_WPrefix = 0; // Does this inst require the REX.W prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000274 FPFormat FPForm = NotFP; // What flavor of FP instruction is this?
Dan Gohmana21bdda2008-08-20 13:46:21 +0000275 bit hasLockPrefix = 0; // Does this inst have a 0xF0 prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000276 Domain ExeDomain = d;
Craig Topperec688662014-01-31 07:00:55 +0000277 bit hasREPPrefix = 0; // Does this inst have a REP prefix?
Craig Topperd402df32014-02-02 07:08:01 +0000278 Encoding OpEnc = EncNormal; // Encoding used by this instruction
Craig Toppere413b622014-02-26 06:01:21 +0000279 bits<2> OpEncBits = OpEnc.Value;
Ayman Musa51ffeab2017-02-20 08:27:54 +0000280 bits<2> VEX_WPrefix = 0; // Does this inst set the VEX_W field?
Craig Topperd402df32014-02-02 07:08:01 +0000281 bit hasVEX_4V = 0; // Does this inst require the VEX.VVVV field?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000282 bit hasVEX_L = 0; // Does this inst use large (256-bit) registers?
Craig Topperf18c8962011-10-04 06:30:42 +0000283 bit ignoresVEX_L = 0; // Does this instruction ignore the L-bit
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000284 bit hasEVEX_K = 0; // Does this inst require masking?
285 bit hasEVEX_Z = 0; // Does this inst set the EVEX_Z field?
286 bit hasEVEX_L2 = 0; // Does this inst set the EVEX_L2 field?
287 bit hasEVEX_B = 0; // Does this inst set the EVEX_B field?
Adam Nemet4c339ab2014-07-17 17:04:52 +0000288 bits<3> CD8_Form = 0; // Compressed disp8 form - vector-width.
Adam Nemet4dc92b92014-07-17 17:04:34 +0000289 // Declare it int rather than bits<4> so that all bits are defined when
290 // assigning to bits<7>.
291 int CD8_EltSize = 0; // Compressed disp8 form - element-size in bytes.
Chris Lattner45270db2010-10-03 18:08:05 +0000292 bit has3DNow0F0FOpcode =0;// Wacky 3dNow! encoding?
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000293 bit hasEVEX_RC = 0; // Explicitly specified rounding control in FP instruction.
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000294
Adam Nemet4dc92b92014-07-17 17:04:34 +0000295 bits<2> EVEX_LL;
296 let EVEX_LL{0} = hasVEX_L;
297 let EVEX_LL{1} = hasEVEX_L2;
298 // Vector size in bytes.
299 bits<7> VectSize = !shl(16, EVEX_LL);
300
301 // The scaling factor for AVX512's compressed displacement is either
302 // - the size of a power-of-two number of elements or
303 // - the size of a single element for broadcasts or
304 // - the total vector size divided by a power-of-two number.
305 // Possible values are: 0 (non-AVX512 inst), 1, 2, 4, 8, 16, 32 and 64.
306 bits<7> CD8_Scale = !if (!eq (OpEnc.Value, EncEVEX.Value),
Adam Nemet4c339ab2014-07-17 17:04:52 +0000307 !if (CD8_Form{2},
308 !shl(CD8_EltSize, CD8_Form{1-0}),
Adam Nemet4dc92b92014-07-17 17:04:34 +0000309 !if (hasEVEX_B,
310 CD8_EltSize,
Adam Nemet4c339ab2014-07-17 17:04:52 +0000311 !srl(VectSize, CD8_Form{1-0}))), 0);
Adam Nemet4dc92b92014-07-17 17:04:34 +0000312
Ayman Musa0b4f97d2017-05-28 12:39:37 +0000313 // Used in the memory folding generation (TableGen backend) to point to an alternative
314 // instruction to replace the current one in case it got picked during generation.
315 string FoldGenRegForm = ?;
316
Craig Topperb86338f2014-12-24 06:05:22 +0000317 // TSFlags layout should be kept in sync with X86BaseInfo.h.
Craig Topper56f0ed812014-02-19 08:25:02 +0000318 let TSFlags{6-0} = FormBits;
Craig Toppere413b622014-02-26 06:01:21 +0000319 let TSFlags{8-7} = OpSizeBits;
Craig Topperb86338f2014-12-24 06:05:22 +0000320 let TSFlags{10-9} = AdSizeBits;
321 let TSFlags{13-11} = OpPrefixBits;
322 let TSFlags{16-14} = OpMapBits;
323 let TSFlags{17} = hasREX_WPrefix;
324 let TSFlags{21-18} = ImmT.Value;
325 let TSFlags{24-22} = FPForm.Value;
326 let TSFlags{25} = hasLockPrefix;
327 let TSFlags{26} = hasREPPrefix;
328 let TSFlags{28-27} = ExeDomain.Value;
329 let TSFlags{30-29} = OpEncBits;
330 let TSFlags{38-31} = Opcode;
Ayman Musa51ffeab2017-02-20 08:27:54 +0000331 // Currently no need for second bit in TSFlags - W Ignore is equivalent to 0.
332 let TSFlags{39} = VEX_WPrefix{0};
Craig Topperb86338f2014-12-24 06:05:22 +0000333 let TSFlags{40} = hasVEX_4V;
Craig Topper5f8419d2016-08-22 07:38:50 +0000334 let TSFlags{41} = hasVEX_L;
335 let TSFlags{42} = hasEVEX_K;
336 let TSFlags{43} = hasEVEX_Z;
337 let TSFlags{44} = hasEVEX_L2;
338 let TSFlags{45} = hasEVEX_B;
Adam Nemet54adb0f2014-07-17 17:04:50 +0000339 // If we run out of TSFlags bits, it's possible to encode this in 3 bits.
Craig Topper5f8419d2016-08-22 07:38:50 +0000340 let TSFlags{52-46} = CD8_Scale;
341 let TSFlags{53} = has3DNow0F0FOpcode;
342 let TSFlags{54} = hasEVEX_RC;
Evan Cheng12c6be82007-07-31 08:04:03 +0000343}
344
Eric Christopheref62f572010-11-30 08:57:23 +0000345class PseudoI<dag oops, dag iops, list<dag> pattern>
Andrew Trick8523b162012-02-01 23:20:51 +0000346 : X86Inst<0, Pseudo, NoImm, oops, iops, "", NoItinerary> {
Eric Christopheref62f572010-11-30 08:57:23 +0000347 let Pattern = pattern;
348}
349
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000350class I<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000351 list<dag> pattern, InstrItinClass itin = NoItinerary,
Andrew Trick8523b162012-02-01 23:20:51 +0000352 Domain d = GenericDomain>
353 : X86Inst<o, f, NoImm, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000354 let Pattern = pattern;
355 let CodeSize = 3;
356}
Michael Liao5bf95782014-12-04 05:20:33 +0000357class Ii8 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000358 list<dag> pattern, InstrItinClass itin = NoItinerary,
Andrew Trick8523b162012-02-01 23:20:51 +0000359 Domain d = GenericDomain>
360 : X86Inst<o, f, Imm8, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000361 let Pattern = pattern;
362 let CodeSize = 3;
363}
Craig Topperca0eda32016-08-22 01:37:19 +0000364class Ii8Reg<bits<8> o, Format f, dag outs, dag ins, string asm,
365 list<dag> pattern, InstrItinClass itin = NoItinerary,
366 Domain d = GenericDomain>
367 : X86Inst<o, f, Imm8Reg, outs, ins, asm, itin, d> {
368 let Pattern = pattern;
369 let CodeSize = 3;
370}
Michael Liao5bf95782014-12-04 05:20:33 +0000371class Ii8PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000372 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000373 : X86Inst<o, f, Imm8PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000374 let Pattern = pattern;
375 let CodeSize = 3;
376}
Michael Liao5bf95782014-12-04 05:20:33 +0000377class Ii16<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000378 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000379 : X86Inst<o, f, Imm16, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000380 let Pattern = pattern;
381 let CodeSize = 3;
382}
Michael Liao5bf95782014-12-04 05:20:33 +0000383class Ii32<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000384 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000385 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000386 let Pattern = pattern;
387 let CodeSize = 3;
388}
David Woodhouse0b6c9492014-01-30 22:20:41 +0000389class Ii32S<bits<8> o, Format f, dag outs, dag ins, string asm,
390 list<dag> pattern, InstrItinClass itin = NoItinerary>
391 : X86Inst<o, f, Imm32S, outs, ins, asm, itin> {
392 let Pattern = pattern;
393 let CodeSize = 3;
394}
Evan Cheng12c6be82007-07-31 08:04:03 +0000395
Michael Liao5bf95782014-12-04 05:20:33 +0000396class Ii16PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000397 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000398 : X86Inst<o, f, Imm16PCRel, outs, ins, asm, itin> {
Chris Lattnerac588122010-07-07 22:27:31 +0000399 let Pattern = pattern;
400 let CodeSize = 3;
401}
402
Michael Liao5bf95782014-12-04 05:20:33 +0000403class Ii32PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000404 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000405 : X86Inst<o, f, Imm32PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000406 let Pattern = pattern;
407 let CodeSize = 3;
408}
409
Evan Cheng12c6be82007-07-31 08:04:03 +0000410// FPStack Instruction Templates:
411// FPI - Floating Point Instruction template.
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000412class FPI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000413 InstrItinClass itin = NoItinerary>
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000414 : I<o, F, outs, ins, asm, [], itin> {}
Evan Cheng12c6be82007-07-31 08:04:03 +0000415
Bob Wilsona967c422010-08-26 18:08:11 +0000416// FpI_ - Floating Point Pseudo Instruction template. Not Predicated.
Andrew Trick8523b162012-02-01 23:20:51 +0000417class FpI_<dag outs, dag ins, FPFormat fp, list<dag> pattern,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000418 InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000419 : X86Inst<0, Pseudo, NoImm, outs, ins, "", itin> {
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000420 let FPForm = fp;
Evan Cheng12c6be82007-07-31 08:04:03 +0000421 let Pattern = pattern;
422}
423
Sean Callanan050e0cd2009-09-15 00:35:17 +0000424// Templates for instructions that use a 16- or 32-bit segmented address as
425// their only operand: lcall (FAR CALL) and ljmp (FAR JMP)
426//
427// Iseg16 - 16-bit segment selector, 16-bit offset
428// Iseg32 - 16-bit segment selector, 32-bit offset
429
Michael Liao5bf95782014-12-04 05:20:33 +0000430class Iseg16 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000431 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000432 : X86Inst<o, f, Imm16, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000433 let Pattern = pattern;
434 let CodeSize = 3;
435}
436
Michael Liao5bf95782014-12-04 05:20:33 +0000437class Iseg32 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000438 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000439 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000440 let Pattern = pattern;
441 let CodeSize = 3;
442}
443
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000444// SI - SSE 1 & 2 scalar instructions
Andrew Trick8523b162012-02-01 23:20:51 +0000445class SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Chandler Carruth4d31f582015-02-04 10:58:53 +0000446 list<dag> pattern, InstrItinClass itin = NoItinerary,
447 Domain d = GenericDomain>
448 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000449 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
450 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX],
451 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
452 !if(!eq(OpPrefix.Value, XD.Value), [UseSSE2],
453 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000454 [UseSSE1])))));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000455
456 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000457 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
458 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
459 asm));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000460}
461
Elena Demikhovsky4aed59fc2015-05-21 14:01:32 +0000462// SI - SSE 1 & 2 scalar intrinsics - vex form available on AVX512
463class SI_Int<bits<8> o, Format F, dag outs, dag ins, string asm,
464 list<dag> pattern, InstrItinClass itin = NoItinerary,
465 Domain d = GenericDomain>
466 : I<o, F, outs, ins, asm, pattern, itin, d> {
467 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
Craig Topper56d40222017-02-22 06:54:18 +0000468 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX],
Elena Demikhovsky4aed59fc2015-05-21 14:01:32 +0000469 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
470 !if(!eq(OpPrefix.Value, XD.Value), [UseSSE2],
471 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
472 [UseSSE1])))));
473
474 // AVX instructions have a 'v' prefix in the mnemonic
475 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
476 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
477 asm));
478}
479// SIi8 - SSE 1 & 2 scalar instructions - vex form available on AVX512
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000480class SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000481 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000482 : Ii8<o, F, outs, ins, asm, pattern, itin> {
Craig Topperd402df32014-02-02 07:08:01 +0000483 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
Elena Demikhovsky4aed59fc2015-05-21 14:01:32 +0000484 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
Craig Topperd402df32014-02-02 07:08:01 +0000485 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
Craig Topper10243c82014-01-31 08:47:06 +0000486 [UseSSE2])));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000487
488 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000489 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
490 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
491 asm));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000492}
493
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000494// PI - SSE 1 & 2 packed instructions
495class PI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
Andrew Trick8523b162012-02-01 23:20:51 +0000496 InstrItinClass itin, Domain d>
497 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000498 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
499 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
500 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000501 [UseSSE1])));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000502
503 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000504 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
505 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
506 asm));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000507}
508
Michael Liaobbd10792012-08-30 16:54:46 +0000509// MMXPI - SSE 1 & 2 packed instructions with MMX operands
510class MMXPI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
511 InstrItinClass itin, Domain d>
512 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000513 let Predicates = !if(!eq(OpPrefix.Value, PD.Value), [HasSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000514 [HasSSE1]);
Michael Liaobbd10792012-08-30 16:54:46 +0000515}
516
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000517// PIi8 - SSE 1 & 2 packed instructions with immediate
518class PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Andrew Trick8523b162012-02-01 23:20:51 +0000519 list<dag> pattern, InstrItinClass itin, Domain d>
520 : Ii8<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000521 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
522 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
523 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000524 [UseSSE1])));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000525
526 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000527 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
528 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
529 asm));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000530}
531
Evan Cheng12c6be82007-07-31 08:04:03 +0000532// SSE1 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000533//
Evan Cheng12c6be82007-07-31 08:04:03 +0000534// SSI - SSE1 instructions with XS prefix.
Craig Topper5ccb6172014-02-18 00:21:49 +0000535// PSI - SSE1 instructions with PS prefix.
536// PSIi8 - SSE1 instructions with ImmT == Imm8 and PS prefix.
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000537// VSSI - SSE1 instructions with XS prefix in AVX form.
Craig Topper5ccb6172014-02-18 00:21:49 +0000538// VPSI - SSE1 instructions with PS prefix in AVX form, packed single.
Evan Cheng12c6be82007-07-31 08:04:03 +0000539
Andrew Trick8523b162012-02-01 23:20:51 +0000540class SSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000541 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000542 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000543class SSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000544 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000545 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000546class PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000547 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000548 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, PS,
Michael Liaobbd10792012-08-30 16:54:46 +0000549 Requires<[UseSSE1]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000550class PSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000551 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000552 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, PS,
Michael Liaobbd10792012-08-30 16:54:46 +0000553 Requires<[UseSSE1]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000554class VSSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000555 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000556 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000557 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000558class VPSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000559 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000560 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin, SSEPackedSingle>, PS,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000561 Requires<[HasAVX]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000562
563// SSE2 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000564//
Bill Wendling76105a42008-08-27 21:32:04 +0000565// SDI - SSE2 instructions with XD prefix.
566// SDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix.
Craig Topperf881d382012-07-30 02:14:02 +0000567// S2SI - SSE2 instructions with XS prefix.
Bill Wendling76105a42008-08-27 21:32:04 +0000568// SSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix.
Craig Topperae11aed2014-01-14 07:41:20 +0000569// PDI - SSE2 instructions with PD prefix, packed double domain.
570// PDIi8 - SSE2 instructions with ImmT == Imm8 and PD prefix.
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000571// VSDI - SSE2 scalar instructions with XD prefix in AVX form.
Craig Topperae11aed2014-01-14 07:41:20 +0000572// VPDI - SSE2 vector instructions with PD prefix in AVX form,
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000573// packed double domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000574// VS2I - SSE2 scalar instructions with PD prefix in AVX form.
575// S2I - SSE2 scalar instructions with PD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000576// MMXSDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix as well as
577// MMX operands.
578// MMXSSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix as well as
579// MMX operands.
Evan Cheng12c6be82007-07-31 08:04:03 +0000580
Andrew Trick8523b162012-02-01 23:20:51 +0000581class SDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000582 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000583 : I<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Evan Cheng01c7c192007-12-20 19:57:09 +0000584class SDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000585 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000586 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000587class S2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000588 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000589 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000590class S2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000591 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000592 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE2]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000593class PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000594 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000595 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000596 Requires<[UseSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000597class PDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000598 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000599 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000600 Requires<[UseSSE2]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000601class VSDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000602 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000603 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XD,
Elena Demikhovsky3ce8dbb2013-08-18 13:08:57 +0000604 Requires<[UseAVX]>;
Craig Topperf881d382012-07-30 02:14:02 +0000605class VS2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000606 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperf881d382012-07-30 02:14:02 +0000607 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
608 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000609class VPDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000610 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000611 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin, SSEPackedDouble>,
612 PD, Requires<[HasAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000613class VS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
614 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000615 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, PD,
616 Requires<[UseAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000617class S2I<bits<8> o, Format F, dag outs, dag ins, string asm,
618 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000619 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[UseSSE2]>;
Michael Liaobbd10792012-08-30 16:54:46 +0000620class MMXSDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000621 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000622 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasSSE2]>;
623class MMXS2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000624 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000625 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[HasSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000626
627// SSE3 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000628//
Craig Topperae11aed2014-01-14 07:41:20 +0000629// S3I - SSE3 instructions with PD prefixes.
Evan Cheng12c6be82007-07-31 08:04:03 +0000630// S3SI - SSE3 instructions with XS prefix.
631// S3DI - SSE3 instructions with XD prefix.
632
Michael Liao5bf95782014-12-04 05:20:33 +0000633class S3SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000634 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000635 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, XS,
Michael Liaobbd10792012-08-30 16:54:46 +0000636 Requires<[UseSSE3]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000637class S3DI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000638 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000639 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, XD,
Michael Liaobbd10792012-08-30 16:54:46 +0000640 Requires<[UseSSE3]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000641class S3I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000642 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000643 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000644 Requires<[UseSSE3]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000645
646
Nate Begeman8ef50212008-02-12 22:51:28 +0000647// SSSE3 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000648//
Nate Begeman8ef50212008-02-12 22:51:28 +0000649// SS38I - SSSE3 instructions with T8 prefix.
650// SS3AI - SSSE3 instructions with TA prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000651// MMXSS38I - SSSE3 instructions with T8 prefix and MMX operands.
652// MMXSS3AI - SSSE3 instructions with TA prefix and MMX operands.
Nate Begeman8ef50212008-02-12 22:51:28 +0000653//
654// Note: SSSE3 instructions have 64-bit and 128-bit versions. The 64-bit version
Craig Topper744f6312012-01-09 00:11:29 +0000655// uses the MMX registers. The 64-bit versions are grouped with the MMX
656// classes. They need to be enabled even if AVX is enabled.
Nate Begeman8ef50212008-02-12 22:51:28 +0000657
658class SS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000659 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000660 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000661 Requires<[UseSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000662class SS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000663 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000664 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000665 Requires<[UseSSSE3]>;
666class MMXSS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000667 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper87557402014-02-18 08:24:22 +0000668 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PS,
Michael Liaobbd10792012-08-30 16:54:46 +0000669 Requires<[HasSSSE3]>;
670class MMXSS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000671 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper87557402014-02-18 08:24:22 +0000672 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPS,
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000673 Requires<[HasSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000674
675// SSE4.1 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000676//
Nate Begeman8ef50212008-02-12 22:51:28 +0000677// SS48I - SSE 4.1 instructions with T8 prefix.
Evan Cheng96bdbd62008-03-14 07:39:27 +0000678// SS41AIi8 - SSE 4.1 instructions with TA prefix and ImmT == Imm8.
Nate Begeman8ef50212008-02-12 22:51:28 +0000679//
680class SS48I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000681 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000682 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000683 Requires<[UseSSE41]>;
Evan Cheng96bdbd62008-03-14 07:39:27 +0000684class SS4AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000685 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000686 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000687 Requires<[UseSSE41]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000688
Nate Begeman55b7bec2008-07-17 16:51:19 +0000689// SSE4.2 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000690//
Nate Begeman55b7bec2008-07-17 16:51:19 +0000691// SS428I - SSE 4.2 instructions with T8 prefix.
692class SS428I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000693 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000694 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000695 Requires<[UseSSE42]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000696
Craig Topper96fa5972011-10-16 16:50:08 +0000697// SS42FI - SSE 4.2 instructions with T8XD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000698// NOTE: 'HasSSE42' is used as SS42FI is only used for CRC32 insns.
Eric Christopher7dfa9f22009-08-08 21:55:08 +0000699class SS42FI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000700 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000701 : I<o, F, outs, ins, asm, pattern, itin>, T8XD, Requires<[HasSSE42]>;
Craig Topperb9109842012-01-01 19:51:58 +0000702
Eric Christopher9fe912d2009-08-18 22:50:32 +0000703// SS42AI = SSE 4.2 instructions with TA prefix
704class SS42AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000705 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000706 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000707 Requires<[UseSSE42]>;
Eric Christopher9fe912d2009-08-18 22:50:32 +0000708
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000709// AVX Instruction Templates:
710// Instructions introduced in AVX (no SSE equivalent forms)
711//
Craig Topperae11aed2014-01-14 07:41:20 +0000712// AVX8I - AVX instructions with T8PD prefix.
713// AVXAIi8 - AVX instructions with TAPD prefix and ImmT = Imm8.
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000714class AVX8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000715 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000716 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000717 Requires<[HasAVX]>;
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000718class AVXAIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000719 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000720 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000721 Requires<[HasAVX]>;
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000722
Craig Topper05d1cb92011-11-06 06:12:20 +0000723// AVX2 Instruction Templates:
724// Instructions introduced in AVX2 (no SSE equivalent forms)
725//
Craig Topperae11aed2014-01-14 07:41:20 +0000726// AVX28I - AVX2 instructions with T8PD prefix.
727// AVX2AIi8 - AVX2 instructions with TAPD prefix and ImmT = Imm8.
Craig Topper05d1cb92011-11-06 06:12:20 +0000728class AVX28I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000729 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000730 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000731 Requires<[HasAVX2]>;
Craig Topperf01f1b52011-11-06 23:04:08 +0000732class AVX2AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000733 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000734 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000735 Requires<[HasAVX2]>;
736
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000737
738// AVX-512 Instruction Templates:
739// Instructions introduced in AVX-512 (no SSE equivalent forms)
740//
Craig Topperae11aed2014-01-14 07:41:20 +0000741// AVX5128I - AVX-512 instructions with T8PD prefix.
742// AVX512AIi8 - AVX-512 instructions with TAPD prefix and ImmT = Imm8.
743// AVX512PDI - AVX-512 instructions with PD, double packed.
Craig Topper5ccb6172014-02-18 00:21:49 +0000744// AVX512PSI - AVX-512 instructions with PS, single packed.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000745// AVX512XS8I - AVX-512 instructions with T8 and XS prefixes.
746// AVX512XSI - AVX-512 instructions with XS prefix, generic domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000747// AVX512BI - AVX-512 instructions with PD, int packed domain.
748// AVX512SI - AVX-512 scalar instructions with PD prefix.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000749
750class AVX5128I<bits<8> o, Format F, dag outs, dag ins, string asm,
751 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000752 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000753 Requires<[HasAVX512]>;
Cameron McInally5fb084e2014-12-11 17:13:05 +0000754class AVX5128IBase : T8PD {
755 Domain ExeDomain = SSEPackedInt;
756}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000757class AVX512XS8I<bits<8> o, Format F, dag outs, dag ins, string asm,
758 list<dag> pattern, InstrItinClass itin = NoItinerary>
759 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8XS,
760 Requires<[HasAVX512]>;
761class AVX512XSI<bits<8> o, Format F, dag outs, dag ins, string asm,
762 list<dag> pattern, InstrItinClass itin = NoItinerary>
763 : I<o, F, outs, ins, asm, pattern, itin>, XS,
764 Requires<[HasAVX512]>;
765class AVX512XDI<bits<8> o, Format F, dag outs, dag ins, string asm,
766 list<dag> pattern, InstrItinClass itin = NoItinerary>
767 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, XD,
768 Requires<[HasAVX512]>;
769class AVX512BI<bits<8> o, Format F, dag outs, dag ins, string asm,
770 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000771 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000772 Requires<[HasAVX512]>;
Robert Khasanov44241442014-10-08 14:37:45 +0000773class AVX512BIBase : PD {
774 Domain ExeDomain = SSEPackedInt;
775}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000776class AVX512BIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
777 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000778 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000779 Requires<[HasAVX512]>;
Cameron McInally04400442014-11-14 15:43:00 +0000780class AVX512BIi8Base : PD {
781 Domain ExeDomain = SSEPackedInt;
782 ImmType ImmT = Imm8;
783}
Elena Demikhovsky75ede682015-06-01 07:17:23 +0000784class AVX512XSIi8Base : XS {
785 Domain ExeDomain = SSEPackedInt;
786 ImmType ImmT = Imm8;
787}
788class AVX512XDIi8Base : XD {
789 Domain ExeDomain = SSEPackedInt;
790 ImmType ImmT = Imm8;
791}
Elena Demikhovsky29792e92015-05-07 11:24:42 +0000792class AVX512PSIi8Base : PS {
793 Domain ExeDomain = SSEPackedSingle;
794 ImmType ImmT = Imm8;
795}
796class AVX512PDIi8Base : PD {
797 Domain ExeDomain = SSEPackedDouble;
798 ImmType ImmT = Imm8;
799}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000800class AVX512AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
801 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000802 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000803 Requires<[HasAVX512]>;
Adam Nemet2e91ee52014-08-14 17:13:19 +0000804class AVX512AIi8Base : TAPD {
Adam Nemet2e2537f2014-08-07 17:53:55 +0000805 ImmType ImmT = Imm8;
806}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000807class AVX512Ii8<bits<8> o, Format F, dag outs, dag ins, string asm,
808 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000809 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>,
Craig Topperae11aed2014-01-14 07:41:20 +0000810 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000811class AVX512PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
812 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000813 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
814 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000815class AVX512PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
816 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000817 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, PS,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000818 Requires<[HasAVX512]>;
819class AVX512PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
820 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000821 : Ii8<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000822class AVX512PI<bits<8> o, Format F, dag outs, dag ins, string asm,
823 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000824 : I<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000825class AVX512FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
826 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000827 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
828 EVEX_4V, Requires<[HasAVX512]>;
Adam Nemet2e91ee52014-08-14 17:13:19 +0000829class AVX512FMA3Base : T8PD, EVEX_4V;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000830
Adam Nemet2e2537f2014-08-07 17:53:55 +0000831class AVX512<bits<8> o, Format F, dag outs, dag ins, string asm,
832 list<dag>pattern, InstrItinClass itin = NoItinerary>
833 : I<o, F, outs, ins, asm, pattern, itin>, Requires<[HasAVX512]>;
834
Eric Christopher2ef63182010-04-02 21:54:27 +0000835// AES Instruction Templates:
836//
837// AES8I
Eric Christopher1290fa02010-04-05 21:14:32 +0000838// These use the same encoding as the SSE4.2 T8 and TA encodings.
Eric Christopher2ef63182010-04-02 21:54:27 +0000839class AES8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Preston Gurd3fe264d2013-09-13 19:23:28 +0000840 list<dag>pattern, InstrItinClass itin = IIC_AES>
Craig Topperae11aed2014-01-14 07:41:20 +0000841 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topperc0cef322012-05-01 05:35:02 +0000842 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000843
844class AESAI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000845 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000846 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topperc0cef322012-05-01 05:35:02 +0000847 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000848
Benjamin Kramera0396e42012-05-31 14:34:17 +0000849// PCLMUL Instruction Templates
850class PCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000851 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000852 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
853 Requires<[HasPCLMUL]>;
Eli Friedman415412e2011-07-05 18:21:20 +0000854
Benjamin Kramera0396e42012-05-31 14:34:17 +0000855class AVXPCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000856 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000857 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
858 VEX_4V, Requires<[HasAVX, HasPCLMUL]>;
Bruno Cardoso Lopesea0e05a2010-07-23 18:41:12 +0000859
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000860// FMA3 Instruction Templates
861class FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000862 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000863 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
Elena Demikhovsky86528272016-02-04 15:11:11 +0000864 VEX_4V, FMASC, Requires<[HasFMA, NoVLX]>;
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000865
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000866// FMA4 Instruction Templates
867class FMA4<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000868 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperca0eda32016-08-22 01:37:19 +0000869 : Ii8Reg<o, F, outs, ins, asm, pattern, itin>, TAPD,
870 VEX_4V, FMASC, Requires<[HasFMA4]>;
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000871
Jan Sjödin7c0face2011-12-12 19:37:49 +0000872// XOP 2, 3 and 4 Operand Instruction Template
873class IXOP<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000874 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000875 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Craig Topperd402df32014-02-02 07:08:01 +0000876 XOP9, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000877
Craig Topperca0eda32016-08-22 01:37:19 +0000878// XOP 2 and 3 Operand Instruction Templates with imm byte
Jan Sjödin7c0face2011-12-12 19:37:49 +0000879class IXOPi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000880 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000881 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Craig Topperd402df32014-02-02 07:08:01 +0000882 XOP8, Requires<[HasXOP]>;
Craig Topperca0eda32016-08-22 01:37:19 +0000883// XOP 4 Operand Instruction Templates with imm byte
884class IXOPi8Reg<bits<8> o, Format F, dag outs, dag ins, string asm,
885 list<dag> pattern, InstrItinClass itin = NoItinerary>
886 : Ii8Reg<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
887 XOP8, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000888
889// XOP 5 operand instruction (VEX encoding!)
890class IXOP5<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000891 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperca0eda32016-08-22 01:37:19 +0000892 : Ii8Reg<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
893 VEX_4V, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000894
Evan Cheng12c6be82007-07-31 08:04:03 +0000895// X86-64 Instruction templates...
896//
897
Andrew Trick8523b162012-02-01 23:20:51 +0000898class RI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000899 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000900 : I<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000901class RIi8 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000902 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000903 : Ii8<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse4e033b02014-01-13 14:05:59 +0000904class RIi16 <bits<8> o, Format F, dag outs, dag ins, string asm,
905 list<dag> pattern, InstrItinClass itin = NoItinerary>
906 : Ii16<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000907class RIi32 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000908 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000909 : Ii32<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse0b6c9492014-01-30 22:20:41 +0000910class RIi32S <bits<8> o, Format F, dag outs, dag ins, string asm,
911 list<dag> pattern, InstrItinClass itin = NoItinerary>
912 : Ii32S<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000913
914class RIi64<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000915 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000916 : X86Inst<o, f, Imm64, outs, ins, asm, itin>, REX_W {
Evan Cheng12c6be82007-07-31 08:04:03 +0000917 let Pattern = pattern;
918 let CodeSize = 3;
919}
920
Kevin Enderby285da022013-07-22 21:25:31 +0000921class RIi64_NOREX<bits<8> o, Format f, dag outs, dag ins, string asm,
922 list<dag> pattern, InstrItinClass itin = NoItinerary>
923 : X86Inst<o, f, Imm64, outs, ins, asm, itin> {
924 let Pattern = pattern;
925 let CodeSize = 3;
926}
927
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000928class RS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
929 list<dag> pattern, InstrItinClass itin = NoItinerary>
930 : S2I<o, F, outs, ins, asm, pattern, itin>, REX_W;
931class VRS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
932 list<dag> pattern, InstrItinClass itin = NoItinerary>
933 : VS2I<o, F, outs, ins, asm, pattern, itin>, VEX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000934
935// MMX Instruction templates
936//
937
938// MMXI - MMX instructions with TB prefix.
Craig Topperbc749db2013-10-09 02:18:34 +0000939// MMXI32 - MMX instructions with TB prefix valid only in 32 bit mode.
Anton Korobeynikov31099512008-08-23 15:53:19 +0000940// MMXI64 - MMX instructions with TB prefix valid only in 64 bit mode.
Craig Topperae11aed2014-01-14 07:41:20 +0000941// MMX2I - MMX / SSE2 instructions with PD prefix.
Craig Topper5ccb6172014-02-18 00:21:49 +0000942// MMXIi8 - MMX instructions with ImmT == Imm8 and PS prefix.
943// MMXIi8 - MMX instructions with ImmT == Imm8 and PS prefix.
Evan Cheng12c6be82007-07-31 08:04:03 +0000944// MMXID - MMX instructions with XD prefix.
945// MMXIS - MMX instructions with XS prefix.
Michael Liao5bf95782014-12-04 05:20:33 +0000946class MMXI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000947 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000948 : I<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000949class MMXI32<bits<8> o, Format F, dag outs, dag ins, string asm,
Craig Topperbc749db2013-10-09 02:18:34 +0000950 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000951 : I<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX,Not64BitMode]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000952class MMXI64<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000953 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000954 : I<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX,In64BitMode]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000955class MMXRI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000956 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000957 : I<o, F, outs, ins, asm, pattern, itin>, PS, REX_W, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000958class MMX2I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000959 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000960 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000961class MMXIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000962 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000963 : Ii8<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000964class MMXID<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000965 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000966 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000967class MMXIS<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000968 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000969 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[HasMMX]>;