blob: 610756aa37da7f7976b86498b96997c621d5e779 [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; }
Bruno Cardoso Lopes05166742010-07-01 01:20:06 +0000202class VEX_W { bit hasVEX_WPrefix = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000203class VEX_4V : VEX { bit hasVEX_4V = 1; }
Bruno Cardoso Lopesfd8bfcd2010-07-13 21:07:28 +0000204class VEX_L { bit hasVEX_L = 1; }
Craig Topperf18c8962011-10-04 06:30:42 +0000205class VEX_LIG { bit ignoresVEX_L = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000206class EVEX : VEX { Encoding OpEnc = EncEVEX; }
207class EVEX_4V : VEX_4V { Encoding OpEnc = EncEVEX; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000208class EVEX_K { bit hasEVEX_K = 1; }
209class EVEX_KZ : EVEX_K { bit hasEVEX_Z = 1; }
210class EVEX_B { bit hasEVEX_B = 1; }
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000211class EVEX_RC { bit hasEVEX_RC = 1; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000212class EVEX_V512 { bit hasEVEX_L2 = 1; bit hasVEX_L = 0; }
Robert Khasanovbfa01312014-07-21 14:54:21 +0000213class EVEX_V256 { bit hasEVEX_L2 = 0; bit hasVEX_L = 1; }
214class EVEX_V128 { bit hasEVEX_L2 = 0; bit hasVEX_L = 0; }
Adam Nemet4dc92b92014-07-17 17:04:34 +0000215
216// Specify AVX512 8-bit compressed displacement encoding based on the vector
217// element size in bits (8, 16, 32, 64) and the CDisp8 form.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000218class EVEX_CD8<int esize, CD8VForm form> {
Adam Nemet4dc92b92014-07-17 17:04:34 +0000219 int CD8_EltSize = !srl(esize, 3);
Adam Nemet4c339ab2014-07-17 17:04:52 +0000220 bits<3> CD8_Form = form.Value;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000221}
Adam Nemet4dc92b92014-07-17 17:04:34 +0000222
Chris Lattner45270db2010-10-03 18:08:05 +0000223class Has3DNow0F0FOpcode { bit has3DNow0F0FOpcode = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000224class XOP { Encoding OpEnc = EncXOP; }
225class XOP_4V : XOP { bit hasVEX_4V = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000226
Evan Cheng12c6be82007-07-31 08:04:03 +0000227class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
Andrew Trick8523b162012-02-01 23:20:51 +0000228 string AsmStr,
229 InstrItinClass itin,
230 Domain d = GenericDomain>
Evan Cheng12c6be82007-07-31 08:04:03 +0000231 : Instruction {
232 let Namespace = "X86";
233
234 bits<8> Opcode = opcod;
235 Format Form = f;
Craig Topper56f0ed812014-02-19 08:25:02 +0000236 bits<7> FormBits = Form.Value;
Evan Cheng12c6be82007-07-31 08:04:03 +0000237 ImmType ImmT = i;
Evan Cheng12c6be82007-07-31 08:04:03 +0000238
239 dag OutOperandList = outs;
240 dag InOperandList = ins;
241 string AsmString = AsmStr;
242
Chris Lattner7ff33462010-10-31 19:22:57 +0000243 // If this is a pseudo instruction, mark it isCodeGenOnly.
244 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
245
Andrew Trick8523b162012-02-01 23:20:51 +0000246 let Itinerary = itin;
247
Evan Cheng12c6be82007-07-31 08:04:03 +0000248 //
249 // Attributes specific to X86 instructions...
250 //
Craig Topper3484fc22014-01-05 04:17:28 +0000251 bit ForceDisassemble = 0; // Force instruction to disassemble even though it's
252 // isCodeGenonly. Needed to hide an ambiguous
253 // AsmString from the parser, but still disassemble.
254
Craig Topperfa6298a2014-02-02 09:25:09 +0000255 OperandSize OpSize = OpSizeFixed; // Does this instruction's encoding change
Craig Topperb86338f2014-12-24 06:05:22 +0000256 // based on operand size of the mode?
Craig Toppere413b622014-02-26 06:01:21 +0000257 bits<2> OpSizeBits = OpSize.Value;
Craig Topperb86338f2014-12-24 06:05:22 +0000258 AddressSize AdSize = AdSizeX; // Does this instruction's encoding change
259 // based on address size of the mode?
260 bits<2> AdSizeBits = AdSize.Value;
Evan Cheng12c6be82007-07-31 08:04:03 +0000261
Craig Topper10243c82014-01-31 08:47:06 +0000262 Prefix OpPrefix = NoPrfx; // Which prefix byte does this inst have?
Craig Toppere413b622014-02-26 06:01:21 +0000263 bits<3> OpPrefixBits = OpPrefix.Value;
Craig Topper10243c82014-01-31 08:47:06 +0000264 Map OpMap = OB; // Which opcode map does this inst have?
Craig Toppere413b622014-02-26 06:01:21 +0000265 bits<3> OpMapBits = OpMap.Value;
Eric Christopher3a8ae232010-11-30 09:11:54 +0000266 bit hasREX_WPrefix = 0; // Does this inst require the REX.W prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000267 FPFormat FPForm = NotFP; // What flavor of FP instruction is this?
Dan Gohmana21bdda2008-08-20 13:46:21 +0000268 bit hasLockPrefix = 0; // Does this inst have a 0xF0 prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000269 Domain ExeDomain = d;
Craig Topperec688662014-01-31 07:00:55 +0000270 bit hasREPPrefix = 0; // Does this inst have a REP prefix?
Craig Topperd402df32014-02-02 07:08:01 +0000271 Encoding OpEnc = EncNormal; // Encoding used by this instruction
Craig Toppere413b622014-02-26 06:01:21 +0000272 bits<2> OpEncBits = OpEnc.Value;
Bruno Cardoso Lopes05166742010-07-01 01:20:06 +0000273 bit hasVEX_WPrefix = 0; // Does this inst set the VEX_W field?
Craig Topperd402df32014-02-02 07:08:01 +0000274 bit hasVEX_4V = 0; // Does this inst require the VEX.VVVV field?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000275 bit hasVEX_L = 0; // Does this inst use large (256-bit) registers?
Craig Topperf18c8962011-10-04 06:30:42 +0000276 bit ignoresVEX_L = 0; // Does this instruction ignore the L-bit
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000277 bit hasEVEX_K = 0; // Does this inst require masking?
278 bit hasEVEX_Z = 0; // Does this inst set the EVEX_Z field?
279 bit hasEVEX_L2 = 0; // Does this inst set the EVEX_L2 field?
280 bit hasEVEX_B = 0; // Does this inst set the EVEX_B field?
Adam Nemet4c339ab2014-07-17 17:04:52 +0000281 bits<3> CD8_Form = 0; // Compressed disp8 form - vector-width.
Adam Nemet4dc92b92014-07-17 17:04:34 +0000282 // Declare it int rather than bits<4> so that all bits are defined when
283 // assigning to bits<7>.
284 int CD8_EltSize = 0; // Compressed disp8 form - element-size in bytes.
Chris Lattner45270db2010-10-03 18:08:05 +0000285 bit has3DNow0F0FOpcode =0;// Wacky 3dNow! encoding?
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000286 bit hasEVEX_RC = 0; // Explicitly specified rounding control in FP instruction.
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000287
Adam Nemet4dc92b92014-07-17 17:04:34 +0000288 bits<2> EVEX_LL;
289 let EVEX_LL{0} = hasVEX_L;
290 let EVEX_LL{1} = hasEVEX_L2;
291 // Vector size in bytes.
292 bits<7> VectSize = !shl(16, EVEX_LL);
293
294 // The scaling factor for AVX512's compressed displacement is either
295 // - the size of a power-of-two number of elements or
296 // - the size of a single element for broadcasts or
297 // - the total vector size divided by a power-of-two number.
298 // Possible values are: 0 (non-AVX512 inst), 1, 2, 4, 8, 16, 32 and 64.
299 bits<7> CD8_Scale = !if (!eq (OpEnc.Value, EncEVEX.Value),
Adam Nemet4c339ab2014-07-17 17:04:52 +0000300 !if (CD8_Form{2},
301 !shl(CD8_EltSize, CD8_Form{1-0}),
Adam Nemet4dc92b92014-07-17 17:04:34 +0000302 !if (hasEVEX_B,
303 CD8_EltSize,
Adam Nemet4c339ab2014-07-17 17:04:52 +0000304 !srl(VectSize, CD8_Form{1-0}))), 0);
Adam Nemet4dc92b92014-07-17 17:04:34 +0000305
Craig Topperb86338f2014-12-24 06:05:22 +0000306 // TSFlags layout should be kept in sync with X86BaseInfo.h.
Craig Topper56f0ed812014-02-19 08:25:02 +0000307 let TSFlags{6-0} = FormBits;
Craig Toppere413b622014-02-26 06:01:21 +0000308 let TSFlags{8-7} = OpSizeBits;
Craig Topperb86338f2014-12-24 06:05:22 +0000309 let TSFlags{10-9} = AdSizeBits;
310 let TSFlags{13-11} = OpPrefixBits;
311 let TSFlags{16-14} = OpMapBits;
312 let TSFlags{17} = hasREX_WPrefix;
313 let TSFlags{21-18} = ImmT.Value;
314 let TSFlags{24-22} = FPForm.Value;
315 let TSFlags{25} = hasLockPrefix;
316 let TSFlags{26} = hasREPPrefix;
317 let TSFlags{28-27} = ExeDomain.Value;
318 let TSFlags{30-29} = OpEncBits;
319 let TSFlags{38-31} = Opcode;
320 let TSFlags{39} = hasVEX_WPrefix;
321 let TSFlags{40} = hasVEX_4V;
Craig Topper5f8419d2016-08-22 07:38:50 +0000322 let TSFlags{41} = hasVEX_L;
323 let TSFlags{42} = hasEVEX_K;
324 let TSFlags{43} = hasEVEX_Z;
325 let TSFlags{44} = hasEVEX_L2;
326 let TSFlags{45} = hasEVEX_B;
Adam Nemet54adb0f2014-07-17 17:04:50 +0000327 // If we run out of TSFlags bits, it's possible to encode this in 3 bits.
Craig Topper5f8419d2016-08-22 07:38:50 +0000328 let TSFlags{52-46} = CD8_Scale;
329 let TSFlags{53} = has3DNow0F0FOpcode;
330 let TSFlags{54} = hasEVEX_RC;
Evan Cheng12c6be82007-07-31 08:04:03 +0000331}
332
Eric Christopheref62f572010-11-30 08:57:23 +0000333class PseudoI<dag oops, dag iops, list<dag> pattern>
Andrew Trick8523b162012-02-01 23:20:51 +0000334 : X86Inst<0, Pseudo, NoImm, oops, iops, "", NoItinerary> {
Eric Christopheref62f572010-11-30 08:57:23 +0000335 let Pattern = pattern;
336}
337
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000338class I<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000339 list<dag> pattern, InstrItinClass itin = NoItinerary,
Andrew Trick8523b162012-02-01 23:20:51 +0000340 Domain d = GenericDomain>
341 : X86Inst<o, f, NoImm, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000342 let Pattern = pattern;
343 let CodeSize = 3;
344}
Michael Liao5bf95782014-12-04 05:20:33 +0000345class Ii8 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000346 list<dag> pattern, InstrItinClass itin = NoItinerary,
Andrew Trick8523b162012-02-01 23:20:51 +0000347 Domain d = GenericDomain>
348 : X86Inst<o, f, Imm8, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000349 let Pattern = pattern;
350 let CodeSize = 3;
351}
Craig Topperca0eda32016-08-22 01:37:19 +0000352class Ii8Reg<bits<8> o, Format f, dag outs, dag ins, string asm,
353 list<dag> pattern, InstrItinClass itin = NoItinerary,
354 Domain d = GenericDomain>
355 : X86Inst<o, f, Imm8Reg, outs, ins, asm, itin, d> {
356 let Pattern = pattern;
357 let CodeSize = 3;
358}
Michael Liao5bf95782014-12-04 05:20:33 +0000359class Ii8PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000360 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000361 : X86Inst<o, f, Imm8PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000362 let Pattern = pattern;
363 let CodeSize = 3;
364}
Michael Liao5bf95782014-12-04 05:20:33 +0000365class Ii16<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000366 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000367 : X86Inst<o, f, Imm16, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000368 let Pattern = pattern;
369 let CodeSize = 3;
370}
Michael Liao5bf95782014-12-04 05:20:33 +0000371class Ii32<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, Imm32, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000374 let Pattern = pattern;
375 let CodeSize = 3;
376}
David Woodhouse0b6c9492014-01-30 22:20:41 +0000377class Ii32S<bits<8> o, Format f, dag outs, dag ins, string asm,
378 list<dag> pattern, InstrItinClass itin = NoItinerary>
379 : X86Inst<o, f, Imm32S, outs, ins, asm, itin> {
380 let Pattern = pattern;
381 let CodeSize = 3;
382}
Evan Cheng12c6be82007-07-31 08:04:03 +0000383
Michael Liao5bf95782014-12-04 05:20:33 +0000384class Ii16PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000385 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000386 : X86Inst<o, f, Imm16PCRel, outs, ins, asm, itin> {
Chris Lattnerac588122010-07-07 22:27:31 +0000387 let Pattern = pattern;
388 let CodeSize = 3;
389}
390
Michael Liao5bf95782014-12-04 05:20:33 +0000391class Ii32PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000392 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000393 : X86Inst<o, f, Imm32PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000394 let Pattern = pattern;
395 let CodeSize = 3;
396}
397
Evan Cheng12c6be82007-07-31 08:04:03 +0000398// FPStack Instruction Templates:
399// FPI - Floating Point Instruction template.
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000400class FPI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000401 InstrItinClass itin = NoItinerary>
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000402 : I<o, F, outs, ins, asm, [], itin> {}
Evan Cheng12c6be82007-07-31 08:04:03 +0000403
Bob Wilsona967c422010-08-26 18:08:11 +0000404// FpI_ - Floating Point Pseudo Instruction template. Not Predicated.
Andrew Trick8523b162012-02-01 23:20:51 +0000405class FpI_<dag outs, dag ins, FPFormat fp, list<dag> pattern,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000406 InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000407 : X86Inst<0, Pseudo, NoImm, outs, ins, "", itin> {
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000408 let FPForm = fp;
Evan Cheng12c6be82007-07-31 08:04:03 +0000409 let Pattern = pattern;
410}
411
Sean Callanan050e0cd2009-09-15 00:35:17 +0000412// Templates for instructions that use a 16- or 32-bit segmented address as
413// their only operand: lcall (FAR CALL) and ljmp (FAR JMP)
414//
415// Iseg16 - 16-bit segment selector, 16-bit offset
416// Iseg32 - 16-bit segment selector, 32-bit offset
417
Michael Liao5bf95782014-12-04 05:20:33 +0000418class Iseg16 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000419 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000420 : X86Inst<o, f, Imm16, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000421 let Pattern = pattern;
422 let CodeSize = 3;
423}
424
Michael Liao5bf95782014-12-04 05:20:33 +0000425class Iseg32 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000426 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000427 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000428 let Pattern = pattern;
429 let CodeSize = 3;
430}
431
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000432// SI - SSE 1 & 2 scalar instructions
Andrew Trick8523b162012-02-01 23:20:51 +0000433class SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Chandler Carruth4d31f582015-02-04 10:58:53 +0000434 list<dag> pattern, InstrItinClass itin = NoItinerary,
435 Domain d = GenericDomain>
436 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000437 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
438 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX],
439 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
440 !if(!eq(OpPrefix.Value, XD.Value), [UseSSE2],
441 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000442 [UseSSE1])))));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000443
444 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000445 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
446 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
447 asm));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000448}
449
Elena Demikhovsky4aed59fc2015-05-21 14:01:32 +0000450// SI - SSE 1 & 2 scalar intrinsics - vex form available on AVX512
451class SI_Int<bits<8> o, Format F, dag outs, dag ins, string asm,
452 list<dag> pattern, InstrItinClass itin = NoItinerary,
453 Domain d = GenericDomain>
454 : I<o, F, outs, ins, asm, pattern, itin, d> {
455 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
456 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
457 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
458 !if(!eq(OpPrefix.Value, XD.Value), [UseSSE2],
459 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
460 [UseSSE1])))));
461
462 // AVX instructions have a 'v' prefix in the mnemonic
463 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
464 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
465 asm));
466}
467// SIi8 - SSE 1 & 2 scalar instructions - vex form available on AVX512
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000468class SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000469 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000470 : Ii8<o, F, outs, ins, asm, pattern, itin> {
Craig Topperd402df32014-02-02 07:08:01 +0000471 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
Elena Demikhovsky4aed59fc2015-05-21 14:01:32 +0000472 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
Craig Topperd402df32014-02-02 07:08:01 +0000473 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
Craig Topper10243c82014-01-31 08:47:06 +0000474 [UseSSE2])));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000475
476 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000477 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
478 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
479 asm));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000480}
481
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000482// PI - SSE 1 & 2 packed instructions
483class PI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
Andrew Trick8523b162012-02-01 23:20:51 +0000484 InstrItinClass itin, Domain d>
485 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000486 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
487 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
488 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000489 [UseSSE1])));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000490
491 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000492 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
493 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
494 asm));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000495}
496
Michael Liaobbd10792012-08-30 16:54:46 +0000497// MMXPI - SSE 1 & 2 packed instructions with MMX operands
498class MMXPI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
499 InstrItinClass itin, Domain d>
500 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000501 let Predicates = !if(!eq(OpPrefix.Value, PD.Value), [HasSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000502 [HasSSE1]);
Michael Liaobbd10792012-08-30 16:54:46 +0000503}
504
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000505// PIi8 - SSE 1 & 2 packed instructions with immediate
506class PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Andrew Trick8523b162012-02-01 23:20:51 +0000507 list<dag> pattern, InstrItinClass itin, Domain d>
508 : Ii8<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000509 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
510 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
511 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000512 [UseSSE1])));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000513
514 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000515 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
516 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
517 asm));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000518}
519
Evan Cheng12c6be82007-07-31 08:04:03 +0000520// SSE1 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000521//
Evan Cheng12c6be82007-07-31 08:04:03 +0000522// SSI - SSE1 instructions with XS prefix.
Craig Topper5ccb6172014-02-18 00:21:49 +0000523// PSI - SSE1 instructions with PS prefix.
524// PSIi8 - SSE1 instructions with ImmT == Imm8 and PS prefix.
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000525// VSSI - SSE1 instructions with XS prefix in AVX form.
Craig Topper5ccb6172014-02-18 00:21:49 +0000526// VPSI - SSE1 instructions with PS prefix in AVX form, packed single.
Evan Cheng12c6be82007-07-31 08:04:03 +0000527
Andrew Trick8523b162012-02-01 23:20:51 +0000528class SSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000529 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000530 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000531class SSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000532 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000533 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000534class PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000535 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000536 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, PS,
Michael Liaobbd10792012-08-30 16:54:46 +0000537 Requires<[UseSSE1]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000538class PSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000539 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000540 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, PS,
Michael Liaobbd10792012-08-30 16:54:46 +0000541 Requires<[UseSSE1]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000542class VSSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000543 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000544 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000545 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000546class VPSI<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, !strconcat("v", asm), pattern, itin, SSEPackedSingle>, PS,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000549 Requires<[HasAVX]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000550
551// SSE2 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000552//
Bill Wendling76105a42008-08-27 21:32:04 +0000553// SDI - SSE2 instructions with XD prefix.
554// SDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix.
Craig Topperf881d382012-07-30 02:14:02 +0000555// S2SI - SSE2 instructions with XS prefix.
Bill Wendling76105a42008-08-27 21:32:04 +0000556// SSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix.
Craig Topperae11aed2014-01-14 07:41:20 +0000557// PDI - SSE2 instructions with PD prefix, packed double domain.
558// PDIi8 - SSE2 instructions with ImmT == Imm8 and PD prefix.
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000559// VSDI - SSE2 scalar instructions with XD prefix in AVX form.
Craig Topperae11aed2014-01-14 07:41:20 +0000560// VPDI - SSE2 vector instructions with PD prefix in AVX form,
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000561// packed double domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000562// VS2I - SSE2 scalar instructions with PD prefix in AVX form.
563// S2I - SSE2 scalar instructions with PD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000564// MMXSDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix as well as
565// MMX operands.
566// MMXSSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix as well as
567// MMX operands.
Evan Cheng12c6be82007-07-31 08:04:03 +0000568
Andrew Trick8523b162012-02-01 23:20:51 +0000569class SDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000570 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000571 : I<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Evan Cheng01c7c192007-12-20 19:57:09 +0000572class SDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000573 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000574 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000575class S2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000576 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000577 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000578class S2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000579 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000580 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE2]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000581class PDI<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000583 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000584 Requires<[UseSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000585class PDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000586 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000587 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000588 Requires<[UseSSE2]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000589class VSDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000590 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000591 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XD,
Elena Demikhovsky3ce8dbb2013-08-18 13:08:57 +0000592 Requires<[UseAVX]>;
Craig Topperf881d382012-07-30 02:14:02 +0000593class VS2SI<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 Topperf881d382012-07-30 02:14:02 +0000595 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
596 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000597class VPDI<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 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin, SSEPackedDouble>,
600 PD, Requires<[HasAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000601class VS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
602 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000603 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, PD,
604 Requires<[UseAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000605class S2I<bits<8> o, Format F, dag outs, dag ins, string asm,
606 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000607 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[UseSSE2]>;
Michael Liaobbd10792012-08-30 16:54:46 +0000608class MMXSDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000609 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000610 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasSSE2]>;
611class MMXS2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000612 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000613 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[HasSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000614
615// SSE3 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000616//
Craig Topperae11aed2014-01-14 07:41:20 +0000617// S3I - SSE3 instructions with PD prefixes.
Evan Cheng12c6be82007-07-31 08:04:03 +0000618// S3SI - SSE3 instructions with XS prefix.
619// S3DI - SSE3 instructions with XD prefix.
620
Michael Liao5bf95782014-12-04 05:20:33 +0000621class S3SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000622 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000623 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, XS,
Michael Liaobbd10792012-08-30 16:54:46 +0000624 Requires<[UseSSE3]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000625class S3DI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000626 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000627 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, XD,
Michael Liaobbd10792012-08-30 16:54:46 +0000628 Requires<[UseSSE3]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000629class S3I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000630 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000631 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000632 Requires<[UseSSE3]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000633
634
Nate Begeman8ef50212008-02-12 22:51:28 +0000635// SSSE3 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000636//
Nate Begeman8ef50212008-02-12 22:51:28 +0000637// SS38I - SSSE3 instructions with T8 prefix.
638// SS3AI - SSSE3 instructions with TA prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000639// MMXSS38I - SSSE3 instructions with T8 prefix and MMX operands.
640// MMXSS3AI - SSSE3 instructions with TA prefix and MMX operands.
Nate Begeman8ef50212008-02-12 22:51:28 +0000641//
642// Note: SSSE3 instructions have 64-bit and 128-bit versions. The 64-bit version
Craig Topper744f6312012-01-09 00:11:29 +0000643// uses the MMX registers. The 64-bit versions are grouped with the MMX
644// classes. They need to be enabled even if AVX is enabled.
Nate Begeman8ef50212008-02-12 22:51:28 +0000645
646class SS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000647 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000648 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000649 Requires<[UseSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000650class SS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000651 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000652 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000653 Requires<[UseSSSE3]>;
654class MMXSS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000655 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper87557402014-02-18 08:24:22 +0000656 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PS,
Michael Liaobbd10792012-08-30 16:54:46 +0000657 Requires<[HasSSSE3]>;
658class MMXSS3AI<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 Topper87557402014-02-18 08:24:22 +0000660 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPS,
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000661 Requires<[HasSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000662
663// SSE4.1 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000664//
Nate Begeman8ef50212008-02-12 22:51:28 +0000665// SS48I - SSE 4.1 instructions with T8 prefix.
Evan Cheng96bdbd62008-03-14 07:39:27 +0000666// SS41AIi8 - SSE 4.1 instructions with TA prefix and ImmT == Imm8.
Nate Begeman8ef50212008-02-12 22:51:28 +0000667//
668class SS48I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000669 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000670 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000671 Requires<[UseSSE41]>;
Evan Cheng96bdbd62008-03-14 07:39:27 +0000672class SS4AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000673 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000674 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000675 Requires<[UseSSE41]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000676
Nate Begeman55b7bec2008-07-17 16:51:19 +0000677// SSE4.2 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000678//
Nate Begeman55b7bec2008-07-17 16:51:19 +0000679// SS428I - SSE 4.2 instructions with T8 prefix.
680class SS428I<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<[UseSSE42]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000684
Craig Topper96fa5972011-10-16 16:50:08 +0000685// SS42FI - SSE 4.2 instructions with T8XD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000686// NOTE: 'HasSSE42' is used as SS42FI is only used for CRC32 insns.
Eric Christopher7dfa9f22009-08-08 21:55:08 +0000687class SS42FI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000688 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000689 : I<o, F, outs, ins, asm, pattern, itin>, T8XD, Requires<[HasSSE42]>;
Craig Topperb9109842012-01-01 19:51:58 +0000690
Eric Christopher9fe912d2009-08-18 22:50:32 +0000691// SS42AI = SSE 4.2 instructions with TA prefix
692class SS42AI<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 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000695 Requires<[UseSSE42]>;
Eric Christopher9fe912d2009-08-18 22:50:32 +0000696
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000697// AVX Instruction Templates:
698// Instructions introduced in AVX (no SSE equivalent forms)
699//
Craig Topperae11aed2014-01-14 07:41:20 +0000700// AVX8I - AVX instructions with T8PD prefix.
701// AVXAIi8 - AVX instructions with TAPD prefix and ImmT = Imm8.
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000702class AVX8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000703 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000704 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000705 Requires<[HasAVX]>;
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000706class AVXAIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000707 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000708 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000709 Requires<[HasAVX]>;
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000710
Craig Topper05d1cb92011-11-06 06:12:20 +0000711// AVX2 Instruction Templates:
712// Instructions introduced in AVX2 (no SSE equivalent forms)
713//
Craig Topperae11aed2014-01-14 07:41:20 +0000714// AVX28I - AVX2 instructions with T8PD prefix.
715// AVX2AIi8 - AVX2 instructions with TAPD prefix and ImmT = Imm8.
Craig Topper05d1cb92011-11-06 06:12:20 +0000716class AVX28I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000717 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000718 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000719 Requires<[HasAVX2]>;
Craig Topperf01f1b52011-11-06 23:04:08 +0000720class AVX2AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000721 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000722 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000723 Requires<[HasAVX2]>;
724
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000725
726// AVX-512 Instruction Templates:
727// Instructions introduced in AVX-512 (no SSE equivalent forms)
728//
Craig Topperae11aed2014-01-14 07:41:20 +0000729// AVX5128I - AVX-512 instructions with T8PD prefix.
730// AVX512AIi8 - AVX-512 instructions with TAPD prefix and ImmT = Imm8.
731// AVX512PDI - AVX-512 instructions with PD, double packed.
Craig Topper5ccb6172014-02-18 00:21:49 +0000732// AVX512PSI - AVX-512 instructions with PS, single packed.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000733// AVX512XS8I - AVX-512 instructions with T8 and XS prefixes.
734// AVX512XSI - AVX-512 instructions with XS prefix, generic domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000735// AVX512BI - AVX-512 instructions with PD, int packed domain.
736// AVX512SI - AVX-512 scalar instructions with PD prefix.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000737
738class AVX5128I<bits<8> o, Format F, dag outs, dag ins, string asm,
739 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000740 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000741 Requires<[HasAVX512]>;
Cameron McInally5fb084e2014-12-11 17:13:05 +0000742class AVX5128IBase : T8PD {
743 Domain ExeDomain = SSEPackedInt;
744}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000745class AVX512XS8I<bits<8> o, Format F, dag outs, dag ins, string asm,
746 list<dag> pattern, InstrItinClass itin = NoItinerary>
747 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8XS,
748 Requires<[HasAVX512]>;
749class AVX512XSI<bits<8> o, Format F, dag outs, dag ins, string asm,
750 list<dag> pattern, InstrItinClass itin = NoItinerary>
751 : I<o, F, outs, ins, asm, pattern, itin>, XS,
752 Requires<[HasAVX512]>;
753class AVX512XDI<bits<8> o, Format F, dag outs, dag ins, string asm,
754 list<dag> pattern, InstrItinClass itin = NoItinerary>
755 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, XD,
756 Requires<[HasAVX512]>;
757class AVX512BI<bits<8> o, Format F, dag outs, dag ins, string asm,
758 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000759 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000760 Requires<[HasAVX512]>;
Robert Khasanov44241442014-10-08 14:37:45 +0000761class AVX512BIBase : PD {
762 Domain ExeDomain = SSEPackedInt;
763}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000764class AVX512BIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
765 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000766 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000767 Requires<[HasAVX512]>;
Cameron McInally04400442014-11-14 15:43:00 +0000768class AVX512BIi8Base : PD {
769 Domain ExeDomain = SSEPackedInt;
770 ImmType ImmT = Imm8;
771}
Elena Demikhovsky75ede682015-06-01 07:17:23 +0000772class AVX512XSIi8Base : XS {
773 Domain ExeDomain = SSEPackedInt;
774 ImmType ImmT = Imm8;
775}
776class AVX512XDIi8Base : XD {
777 Domain ExeDomain = SSEPackedInt;
778 ImmType ImmT = Imm8;
779}
Elena Demikhovsky29792e92015-05-07 11:24:42 +0000780class AVX512PSIi8Base : PS {
781 Domain ExeDomain = SSEPackedSingle;
782 ImmType ImmT = Imm8;
783}
784class AVX512PDIi8Base : PD {
785 Domain ExeDomain = SSEPackedDouble;
786 ImmType ImmT = Imm8;
787}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000788class AVX512AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
789 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000790 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000791 Requires<[HasAVX512]>;
Adam Nemet2e91ee52014-08-14 17:13:19 +0000792class AVX512AIi8Base : TAPD {
Adam Nemet2e2537f2014-08-07 17:53:55 +0000793 ImmType ImmT = Imm8;
794}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000795class AVX512Ii8<bits<8> o, Format F, dag outs, dag ins, string asm,
796 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000797 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>,
Craig Topperae11aed2014-01-14 07:41:20 +0000798 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000799class AVX512PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
800 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000801 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
802 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000803class AVX512PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
804 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000805 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, PS,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000806 Requires<[HasAVX512]>;
807class AVX512PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
808 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000809 : Ii8<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000810class AVX512PI<bits<8> o, Format F, dag outs, dag ins, string asm,
811 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000812 : I<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000813class AVX512FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
814 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000815 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
816 EVEX_4V, Requires<[HasAVX512]>;
Adam Nemet2e91ee52014-08-14 17:13:19 +0000817class AVX512FMA3Base : T8PD, EVEX_4V;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000818
Adam Nemet2e2537f2014-08-07 17:53:55 +0000819class AVX512<bits<8> o, Format F, dag outs, dag ins, string asm,
820 list<dag>pattern, InstrItinClass itin = NoItinerary>
821 : I<o, F, outs, ins, asm, pattern, itin>, Requires<[HasAVX512]>;
822
Eric Christopher2ef63182010-04-02 21:54:27 +0000823// AES Instruction Templates:
824//
825// AES8I
Eric Christopher1290fa02010-04-05 21:14:32 +0000826// These use the same encoding as the SSE4.2 T8 and TA encodings.
Eric Christopher2ef63182010-04-02 21:54:27 +0000827class AES8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Preston Gurd3fe264d2013-09-13 19:23:28 +0000828 list<dag>pattern, InstrItinClass itin = IIC_AES>
Craig Topperae11aed2014-01-14 07:41:20 +0000829 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topperc0cef322012-05-01 05:35:02 +0000830 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000831
832class AESAI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000833 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000834 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topperc0cef322012-05-01 05:35:02 +0000835 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000836
Benjamin Kramera0396e42012-05-31 14:34:17 +0000837// PCLMUL Instruction Templates
838class PCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000839 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000840 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
841 Requires<[HasPCLMUL]>;
Eli Friedman415412e2011-07-05 18:21:20 +0000842
Benjamin Kramera0396e42012-05-31 14:34:17 +0000843class AVXPCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000844 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000845 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
846 VEX_4V, Requires<[HasAVX, HasPCLMUL]>;
Bruno Cardoso Lopesea0e05a2010-07-23 18:41:12 +0000847
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000848// FMA3 Instruction Templates
849class FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000850 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000851 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
Elena Demikhovsky86528272016-02-04 15:11:11 +0000852 VEX_4V, FMASC, Requires<[HasFMA, NoVLX]>;
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000853
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000854// FMA4 Instruction Templates
855class FMA4<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 Topperca0eda32016-08-22 01:37:19 +0000857 : Ii8Reg<o, F, outs, ins, asm, pattern, itin>, TAPD,
858 VEX_4V, FMASC, Requires<[HasFMA4]>;
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000859
Jan Sjödin7c0face2011-12-12 19:37:49 +0000860// XOP 2, 3 and 4 Operand Instruction Template
861class IXOP<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000863 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Craig Topperd402df32014-02-02 07:08:01 +0000864 XOP9, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000865
Craig Topperca0eda32016-08-22 01:37:19 +0000866// XOP 2 and 3 Operand Instruction Templates with imm byte
Jan Sjödin7c0face2011-12-12 19:37:49 +0000867class IXOPi8<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000869 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Craig Topperd402df32014-02-02 07:08:01 +0000870 XOP8, Requires<[HasXOP]>;
Craig Topperca0eda32016-08-22 01:37:19 +0000871// XOP 4 Operand Instruction Templates with imm byte
872class IXOPi8Reg<bits<8> o, Format F, dag outs, dag ins, string asm,
873 list<dag> pattern, InstrItinClass itin = NoItinerary>
874 : Ii8Reg<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
875 XOP8, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000876
877// XOP 5 operand instruction (VEX encoding!)
878class IXOP5<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000879 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperca0eda32016-08-22 01:37:19 +0000880 : Ii8Reg<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
881 VEX_4V, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000882
Evan Cheng12c6be82007-07-31 08:04:03 +0000883// X86-64 Instruction templates...
884//
885
Andrew Trick8523b162012-02-01 23:20:51 +0000886class RI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000887 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000888 : I<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000889class RIi8 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000890 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000891 : Ii8<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse4e033b02014-01-13 14:05:59 +0000892class RIi16 <bits<8> o, Format F, dag outs, dag ins, string asm,
893 list<dag> pattern, InstrItinClass itin = NoItinerary>
894 : Ii16<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000895class RIi32 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000896 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000897 : Ii32<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse0b6c9492014-01-30 22:20:41 +0000898class RIi32S <bits<8> o, Format F, dag outs, dag ins, string asm,
899 list<dag> pattern, InstrItinClass itin = NoItinerary>
900 : Ii32S<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000901
902class RIi64<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000903 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000904 : X86Inst<o, f, Imm64, outs, ins, asm, itin>, REX_W {
Evan Cheng12c6be82007-07-31 08:04:03 +0000905 let Pattern = pattern;
906 let CodeSize = 3;
907}
908
Kevin Enderby285da022013-07-22 21:25:31 +0000909class RIi64_NOREX<bits<8> o, Format f, dag outs, dag ins, string asm,
910 list<dag> pattern, InstrItinClass itin = NoItinerary>
911 : X86Inst<o, f, Imm64, outs, ins, asm, itin> {
912 let Pattern = pattern;
913 let CodeSize = 3;
914}
915
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000916class RS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
917 list<dag> pattern, InstrItinClass itin = NoItinerary>
918 : S2I<o, F, outs, ins, asm, pattern, itin>, REX_W;
919class VRS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
920 list<dag> pattern, InstrItinClass itin = NoItinerary>
921 : VS2I<o, F, outs, ins, asm, pattern, itin>, VEX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000922
923// MMX Instruction templates
924//
925
926// MMXI - MMX instructions with TB prefix.
Craig Topperbc749db2013-10-09 02:18:34 +0000927// MMXI32 - MMX instructions with TB prefix valid only in 32 bit mode.
Anton Korobeynikov31099512008-08-23 15:53:19 +0000928// MMXI64 - MMX instructions with TB prefix valid only in 64 bit mode.
Craig Topperae11aed2014-01-14 07:41:20 +0000929// MMX2I - MMX / SSE2 instructions with PD prefix.
Craig Topper5ccb6172014-02-18 00:21:49 +0000930// MMXIi8 - MMX instructions with ImmT == Imm8 and PS prefix.
931// MMXIi8 - MMX instructions with ImmT == Imm8 and PS prefix.
Evan Cheng12c6be82007-07-31 08:04:03 +0000932// MMXID - MMX instructions with XD prefix.
933// MMXIS - MMX instructions with XS prefix.
Michael Liao5bf95782014-12-04 05:20:33 +0000934class MMXI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000935 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000936 : I<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000937class MMXI32<bits<8> o, Format F, dag outs, dag ins, string asm,
Craig Topperbc749db2013-10-09 02:18:34 +0000938 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000939 : I<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX,Not64BitMode]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000940class MMXI64<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000941 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000942 : I<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX,In64BitMode]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000943class MMXRI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000944 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000945 : I<o, F, outs, ins, asm, pattern, itin>, PS, REX_W, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000946class MMX2I<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 Topperae11aed2014-01-14 07:41:20 +0000948 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000949class MMXIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000950 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000951 : Ii8<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000952class MMXID<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000954 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000955class MMXIS<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000957 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[HasMMX]>;