blob: 453a27ef490ac2ddf9315ad23412c22862a834eb [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.
17class Format<bits<6> val> {
18 bits<6> Value = val;
19}
20
21def Pseudo : Format<0>; def RawFrm : Format<1>;
22def AddRegFrm : Format<2>; def MRMDestReg : Format<3>;
23def MRMDestMem : Format<4>; def MRMSrcReg : Format<5>;
Craig Topper35da3d12014-01-16 07:36:58 +000024def MRMSrcMem : Format<6>; def RawFrmMemOffs : Format<7>;
David Woodhouseb33c2ef2014-01-22 15:08:21 +000025def RawFrmSrc : Format<8>; def RawFrmDst : Format<9>;
David Woodhouse9bbf7ca2014-01-22 15:08:36 +000026def RawFrmDstSrc: Format<10>;
Evan Cheng12c6be82007-07-31 08:04:03 +000027def MRM0r : Format<16>; def MRM1r : Format<17>; def MRM2r : Format<18>;
28def MRM3r : Format<19>; def MRM4r : Format<20>; def MRM5r : Format<21>;
29def MRM6r : Format<22>; def MRM7r : Format<23>;
30def MRM0m : Format<24>; def MRM1m : Format<25>; def MRM2m : Format<26>;
31def MRM3m : Format<27>; def MRM4m : Format<28>; def MRM5m : Format<29>;
32def MRM6m : Format<30>; def MRM7m : Format<31>;
Chris Lattnerf7477e52010-02-12 02:06:33 +000033def MRM_C1 : Format<33>;
Chris Lattner140caa72010-02-13 00:41:14 +000034def MRM_C2 : Format<34>;
35def MRM_C3 : Format<35>;
36def MRM_C4 : Format<36>;
37def MRM_C8 : Format<37>;
38def MRM_C9 : Format<38>;
Michael Liao95d944032013-04-11 04:52:28 +000039def MRM_CA : Format<39>;
40def MRM_CB : Format<40>;
41def MRM_E8 : Format<41>;
42def MRM_F0 : Format<42>;
Chris Lattnercea0a8d2010-09-17 18:02:29 +000043def RawFrmImm8 : Format<43>;
44def RawFrmImm16 : Format<44>;
Michael Liao95d944032013-04-11 04:52:28 +000045def MRM_F8 : Format<45>;
46def MRM_F9 : Format<46>;
47def MRM_D0 : Format<47>;
48def MRM_D1 : Format<48>;
49def MRM_D4 : Format<49>;
50def MRM_D5 : Format<50>;
51def MRM_D6 : Format<51>;
52def MRM_D8 : Format<52>;
53def MRM_D9 : Format<53>;
54def MRM_DA : Format<54>;
55def MRM_DB : Format<55>;
56def MRM_DC : Format<56>;
57def MRM_DD : Format<57>;
58def MRM_DE : Format<58>;
59def MRM_DF : Format<59>;
Evan Cheng12c6be82007-07-31 08:04:03 +000060
61// ImmType - This specifies the immediate type used by an instruction. This is
62// part of the ad-hoc solution used to emit machine instruction encodings by our
63// machine code emitter.
David Woodhouse0b6c9492014-01-30 22:20:41 +000064class ImmType<bits<4> val> {
65 bits<4> Value = val;
Evan Cheng12c6be82007-07-31 08:04:03 +000066}
Chris Lattner12455ca2010-02-12 22:27:07 +000067def NoImm : ImmType<0>;
68def Imm8 : ImmType<1>;
69def Imm8PCRel : ImmType<2>;
70def Imm16 : ImmType<3>;
Chris Lattnerac588122010-07-07 22:27:31 +000071def Imm16PCRel : ImmType<4>;
72def Imm32 : ImmType<5>;
73def Imm32PCRel : ImmType<6>;
David Woodhouse0b6c9492014-01-30 22:20:41 +000074def Imm32S : ImmType<7>;
75def Imm64 : ImmType<8>;
Evan Cheng12c6be82007-07-31 08:04:03 +000076
77// FPFormat - This specifies what form this FP instruction has. This is used by
78// the Floating-Point stackifier pass.
79class FPFormat<bits<3> val> {
80 bits<3> Value = val;
81}
82def NotFP : FPFormat<0>;
83def ZeroArgFP : FPFormat<1>;
84def OneArgFP : FPFormat<2>;
85def OneArgFPRW : FPFormat<3>;
86def TwoArgFP : FPFormat<4>;
87def CompareFP : FPFormat<5>;
88def CondMovFP : FPFormat<6>;
89def SpecialFP : FPFormat<7>;
90
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +000091// Class specifying the SSE execution domain, used by the SSEDomainFix pass.
Jakob Stoklund Olesendbff4e82010-03-30 22:46:53 +000092// Keep in sync with tables in X86InstrInfo.cpp.
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +000093class Domain<bits<2> val> {
94 bits<2> Value = val;
95}
96def GenericDomain : Domain<0>;
Jakob Stoklund Olesendbff4e82010-03-30 22:46:53 +000097def SSEPackedSingle : Domain<1>;
98def SSEPackedDouble : Domain<2>;
99def SSEPackedInt : Domain<3>;
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000100
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000101// Class specifying the vector form of the decompressed
102// displacement of 8-bit.
103class CD8VForm<bits<3> val> {
104 bits<3> Value = val;
105}
106def CD8VF : CD8VForm<0>; // v := VL
107def CD8VH : CD8VForm<1>; // v := VL/2
108def CD8VQ : CD8VForm<2>; // v := VL/4
109def CD8VO : CD8VForm<3>; // v := VL/8
110def CD8VT1 : CD8VForm<4>; // v := 1
111def CD8VT2 : CD8VForm<5>; // v := 2
112def CD8VT4 : CD8VForm<6>; // v := 4
113def CD8VT8 : CD8VForm<7>; // v := 8
114
Craig Topper10243c82014-01-31 08:47:06 +0000115// Class specifying the prefix used an opcode extension.
116class Prefix<bits<2> val> {
117 bits<2> Value = val;
118}
119def NoPrfx : Prefix<0>;
120def PD : Prefix<1>;
121def XS : Prefix<2>;
122def XD : Prefix<3>;
123
124// Class specifying the opcode map.
125class Map<bits<5> val> {
126 bits<5> Value = val;
127}
128def OB : Map<0>;
129def TB : Map<1>;
130def T8 : Map<2>;
131def TA : Map<3>;
132def XOP8 : Map<4>;
133def XOP9 : Map<5>;
134def XOPA : Map<6>;
135def D8 : Map<7>;
136def D9 : Map<8>;
137def DA : Map<9>;
138def DB : Map<10>;
139def DC : Map<11>;
140def DD : Map<12>;
141def DE : Map<13>;
142def DF : Map<14>;
143def A6 : Map<15>;
144def A7 : Map<16>;
145
Craig Topperd402df32014-02-02 07:08:01 +0000146// Class specifying the encoding
147class Encoding<bits<2> val> {
148 bits<2> Value = val;
149}
150def EncNormal : Encoding<0>;
151def EncVEX : Encoding<1>;
152def EncXOP : Encoding<2>;
153def EncEVEX : Encoding<3>;
154
Evan Cheng12c6be82007-07-31 08:04:03 +0000155// Prefix byte classes which are used to indicate to the ad-hoc machine code
156// emitter that various prefix bytes are required.
157class OpSize { bit hasOpSizePrefix = 1; }
Craig Topper7ceb54a2014-01-06 06:02:58 +0000158class OpSize16 { bit hasOpSize16Prefix = 1; }
Evan Cheng12c6be82007-07-31 08:04:03 +0000159class AdSize { bit hasAdSizePrefix = 1; }
160class REX_W { bit hasREX_WPrefix = 1; }
Andrew Lenharth0070dd12008-03-01 13:37:02 +0000161class LOCK { bit hasLockPrefix = 1; }
Craig Topperec688662014-01-31 07:00:55 +0000162class REP { bit hasREPPrefix = 1; }
Craig Topperda7160d2014-02-01 08:17:56 +0000163class TB { Map OpMap = TB; }
Craig Topper10243c82014-01-31 08:47:06 +0000164class D8 { Map OpMap = D8; }
165class D9 { Map OpMap = D9; }
166class DA { Map OpMap = DA; }
167class DB { Map OpMap = DB; }
168class DC { Map OpMap = DC; }
169class DD { Map OpMap = DD; }
170class DE { Map OpMap = DE; }
171class DF { Map OpMap = DF; }
Craig Topper10243c82014-01-31 08:47:06 +0000172class T8 { Map OpMap = T8; }
173class TA { Map OpMap = TA; }
174class A6 { Map OpMap = A6; }
175class A7 { Map OpMap = A7; }
Craig Topper10243c82014-01-31 08:47:06 +0000176class XOP8 { Map OpMap = XOP8; }
177class XOP9 { Map OpMap = XOP9; }
178class XOPA { Map OpMap = XOPA; }
Craig Topperda7160d2014-02-01 08:17:56 +0000179class PD : TB { Prefix OpPrefix = PD; }
180class XD : TB { Prefix OpPrefix = XD; }
181class XS : TB { Prefix OpPrefix = XS; }
182class T8PD : T8 { Prefix OpPrefix = PD; }
183class T8XD : T8 { Prefix OpPrefix = XD; }
184class T8XS : T8 { Prefix OpPrefix = XS; }
185class TAPD : TA { Prefix OpPrefix = PD; }
186class TAXD : TA { Prefix OpPrefix = XD; }
Craig Topperd402df32014-02-02 07:08:01 +0000187class VEX { Encoding OpEnc = EncVEX; }
Bruno Cardoso Lopes05166742010-07-01 01:20:06 +0000188class VEX_W { bit hasVEX_WPrefix = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000189class VEX_4V : VEX { bit hasVEX_4V = 1; }
190class VEX_4VOp3 : VEX { bit hasVEX_4VOp3 = 1; }
Bruno Cardoso Lopese2bd0582010-07-06 22:36:24 +0000191class VEX_I8IMM { bit hasVEX_i8ImmReg = 1; }
Bruno Cardoso Lopesfd8bfcd2010-07-13 21:07:28 +0000192class VEX_L { bit hasVEX_L = 1; }
Craig Topperf18c8962011-10-04 06:30:42 +0000193class VEX_LIG { bit ignoresVEX_L = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000194class EVEX : VEX { Encoding OpEnc = EncEVEX; }
195class EVEX_4V : VEX_4V { Encoding OpEnc = EncEVEX; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000196class EVEX_K { bit hasEVEX_K = 1; }
197class EVEX_KZ : EVEX_K { bit hasEVEX_Z = 1; }
198class EVEX_B { bit hasEVEX_B = 1; }
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000199class EVEX_RC { bit hasEVEX_RC = 1; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000200class EVEX_V512 { bit hasEVEX_L2 = 1; bit hasVEX_L = 0; }
201class EVEX_CD8<int esize, CD8VForm form> {
202 bits<2> EVEX_CD8E = !if(!eq(esize, 8), 0b00,
203 !if(!eq(esize, 16), 0b01,
204 !if(!eq(esize, 32), 0b10,
205 !if(!eq(esize, 64), 0b11, ?))));
206 bits<3> EVEX_CD8V = form.Value;
207}
Chris Lattner45270db2010-10-03 18:08:05 +0000208class Has3DNow0F0FOpcode { bit has3DNow0F0FOpcode = 1; }
Craig Toppercd93de92011-12-30 04:48:54 +0000209class MemOp4 { bit hasMemOp4Prefix = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000210class XOP { Encoding OpEnc = EncXOP; }
211class XOP_4V : XOP { bit hasVEX_4V = 1; }
212class XOP_4VOp3 : XOP { bit hasVEX_4VOp3 = 1; }
213
Evan Cheng12c6be82007-07-31 08:04:03 +0000214class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
Andrew Trick8523b162012-02-01 23:20:51 +0000215 string AsmStr,
216 InstrItinClass itin,
217 Domain d = GenericDomain>
Evan Cheng12c6be82007-07-31 08:04:03 +0000218 : Instruction {
219 let Namespace = "X86";
220
221 bits<8> Opcode = opcod;
222 Format Form = f;
223 bits<6> FormBits = Form.Value;
224 ImmType ImmT = i;
Evan Cheng12c6be82007-07-31 08:04:03 +0000225
226 dag OutOperandList = outs;
227 dag InOperandList = ins;
228 string AsmString = AsmStr;
229
Chris Lattner7ff33462010-10-31 19:22:57 +0000230 // If this is a pseudo instruction, mark it isCodeGenOnly.
231 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
232
Andrew Trick8523b162012-02-01 23:20:51 +0000233 let Itinerary = itin;
234
Evan Cheng12c6be82007-07-31 08:04:03 +0000235 //
236 // Attributes specific to X86 instructions...
237 //
Craig Topper3484fc22014-01-05 04:17:28 +0000238 bit ForceDisassemble = 0; // Force instruction to disassemble even though it's
239 // isCodeGenonly. Needed to hide an ambiguous
240 // AsmString from the parser, but still disassemble.
241
Evan Cheng12c6be82007-07-31 08:04:03 +0000242 bit hasOpSizePrefix = 0; // Does this inst have a 0x66 prefix?
Craig Topper7ceb54a2014-01-06 06:02:58 +0000243 bit hasOpSize16Prefix = 0;// Does this inst have a 0x66 prefix in 16-bit mode?
Evan Cheng12c6be82007-07-31 08:04:03 +0000244 bit hasAdSizePrefix = 0; // Does this inst have a 0x67 prefix?
245
Craig Topper10243c82014-01-31 08:47:06 +0000246 Prefix OpPrefix = NoPrfx; // Which prefix byte does this inst have?
247 Map OpMap = OB; // Which opcode map does this inst have?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000248 bit hasREX_WPrefix = 0; // Does this inst require the REX.W prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000249 FPFormat FPForm = NotFP; // What flavor of FP instruction is this?
Dan Gohmana21bdda2008-08-20 13:46:21 +0000250 bit hasLockPrefix = 0; // Does this inst have a 0xF0 prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000251 Domain ExeDomain = d;
Craig Topperec688662014-01-31 07:00:55 +0000252 bit hasREPPrefix = 0; // Does this inst have a REP prefix?
Craig Topperd402df32014-02-02 07:08:01 +0000253 Encoding OpEnc = EncNormal; // Encoding used by this instruction
Bruno Cardoso Lopes05166742010-07-01 01:20:06 +0000254 bit hasVEX_WPrefix = 0; // Does this inst set the VEX_W field?
Craig Topperd402df32014-02-02 07:08:01 +0000255 bit hasVEX_4V = 0; // Does this inst require the VEX.VVVV field?
256 bit hasVEX_4VOp3 = 0; // Does this inst require the VEX.VVVV field to
257 // encode the third operand?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000258 bit hasVEX_i8ImmReg = 0; // Does this inst require the last source register
Bruno Cardoso Lopese2bd0582010-07-06 22:36:24 +0000259 // to be encoded in a immediate field?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000260 bit hasVEX_L = 0; // Does this inst use large (256-bit) registers?
Craig Topperf18c8962011-10-04 06:30:42 +0000261 bit ignoresVEX_L = 0; // Does this instruction ignore the L-bit
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000262 bit hasEVEX_K = 0; // Does this inst require masking?
263 bit hasEVEX_Z = 0; // Does this inst set the EVEX_Z field?
264 bit hasEVEX_L2 = 0; // Does this inst set the EVEX_L2 field?
265 bit hasEVEX_B = 0; // Does this inst set the EVEX_B field?
266 bits<2> EVEX_CD8E = 0; // Compressed disp8 form - element-size.
267 bits<3> EVEX_CD8V = 0; // Compressed disp8 form - vector-width.
Chris Lattner45270db2010-10-03 18:08:05 +0000268 bit has3DNow0F0FOpcode =0;// Wacky 3dNow! encoding?
Craig Toppercd93de92011-12-30 04:48:54 +0000269 bit hasMemOp4Prefix = 0; // Same bit as VEX_W, but used for swapping operands
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000270 bit hasEVEX_RC = 0; // Explicitly specified rounding control in FP instruction.
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000271
272 // TSFlags layout should be kept in sync with X86InstrInfo.h.
273 let TSFlags{5-0} = FormBits;
274 let TSFlags{6} = hasOpSizePrefix;
Craig Topper7ceb54a2014-01-06 06:02:58 +0000275 let TSFlags{7} = hasOpSize16Prefix;
276 let TSFlags{8} = hasAdSizePrefix;
Craig Topper10243c82014-01-31 08:47:06 +0000277 let TSFlags{10-9} = OpPrefix.Value;
278 let TSFlags{15-11} = OpMap.Value;
279 let TSFlags{16} = hasREX_WPrefix;
280 let TSFlags{20-17} = ImmT.Value;
281 let TSFlags{23-21} = FPForm.Value;
282 let TSFlags{24} = hasLockPrefix;
283 let TSFlags{25} = hasREPPrefix;
284 let TSFlags{27-26} = ExeDomain.Value;
Craig Topperd402df32014-02-02 07:08:01 +0000285 let TSFlags{29-28} = OpEnc.Value;
286 let TSFlags{37-30} = Opcode;
287 let TSFlags{38} = hasVEX_WPrefix;
288 let TSFlags{39} = hasVEX_4V;
289 let TSFlags{40} = hasVEX_4VOp3;
290 let TSFlags{41} = hasVEX_i8ImmReg;
291 let TSFlags{42} = hasVEX_L;
292 let TSFlags{43} = ignoresVEX_L;
Craig Topper10243c82014-01-31 08:47:06 +0000293 let TSFlags{44} = hasEVEX_K;
294 let TSFlags{45} = hasEVEX_Z;
295 let TSFlags{46} = hasEVEX_L2;
296 let TSFlags{47} = hasEVEX_B;
297 let TSFlags{49-48} = EVEX_CD8E;
298 let TSFlags{52-50} = EVEX_CD8V;
299 let TSFlags{53} = has3DNow0F0FOpcode;
300 let TSFlags{54} = hasMemOp4Prefix;
Craig Topperd402df32014-02-02 07:08:01 +0000301 let TSFlags{55} = hasEVEX_RC;
Evan Cheng12c6be82007-07-31 08:04:03 +0000302}
303
Eric Christopheref62f572010-11-30 08:57:23 +0000304class PseudoI<dag oops, dag iops, list<dag> pattern>
Andrew Trick8523b162012-02-01 23:20:51 +0000305 : X86Inst<0, Pseudo, NoImm, oops, iops, "", NoItinerary> {
Eric Christopheref62f572010-11-30 08:57:23 +0000306 let Pattern = pattern;
307}
308
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000309class I<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000310 list<dag> pattern, InstrItinClass itin = NoItinerary,
Andrew Trick8523b162012-02-01 23:20:51 +0000311 Domain d = GenericDomain>
312 : X86Inst<o, f, NoImm, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000313 let Pattern = pattern;
314 let CodeSize = 3;
315}
Sean Callanan04d8cb72009-12-18 00:01:26 +0000316class Ii8 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000317 list<dag> pattern, InstrItinClass itin = NoItinerary,
Andrew Trick8523b162012-02-01 23:20:51 +0000318 Domain d = GenericDomain>
319 : X86Inst<o, f, Imm8, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000320 let Pattern = pattern;
321 let CodeSize = 3;
322}
Chris Lattner12455ca2010-02-12 22:27:07 +0000323class Ii8PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000324 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000325 : X86Inst<o, f, Imm8PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000326 let Pattern = pattern;
327 let CodeSize = 3;
328}
Sean Callanan04d8cb72009-12-18 00:01:26 +0000329class Ii16<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000330 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000331 : X86Inst<o, f, Imm16, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000332 let Pattern = pattern;
333 let CodeSize = 3;
334}
Sean Callanan04d8cb72009-12-18 00:01:26 +0000335class Ii32<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000336 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000337 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000338 let Pattern = pattern;
339 let CodeSize = 3;
340}
David Woodhouse0b6c9492014-01-30 22:20:41 +0000341class Ii32S<bits<8> o, Format f, dag outs, dag ins, string asm,
342 list<dag> pattern, InstrItinClass itin = NoItinerary>
343 : X86Inst<o, f, Imm32S, outs, ins, asm, itin> {
344 let Pattern = pattern;
345 let CodeSize = 3;
346}
Evan Cheng12c6be82007-07-31 08:04:03 +0000347
Chris Lattnerac588122010-07-07 22:27:31 +0000348class Ii16PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000349 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000350 : X86Inst<o, f, Imm16PCRel, outs, ins, asm, itin> {
Chris Lattnerac588122010-07-07 22:27:31 +0000351 let Pattern = pattern;
352 let CodeSize = 3;
353}
354
Chris Lattner12455ca2010-02-12 22:27:07 +0000355class Ii32PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000356 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000357 : X86Inst<o, f, Imm32PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000358 let Pattern = pattern;
359 let CodeSize = 3;
360}
361
Evan Cheng12c6be82007-07-31 08:04:03 +0000362// FPStack Instruction Templates:
363// FPI - Floating Point Instruction template.
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000364class FPI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000365 InstrItinClass itin = NoItinerary>
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000366 : I<o, F, outs, ins, asm, [], itin> {}
Evan Cheng12c6be82007-07-31 08:04:03 +0000367
Bob Wilsona967c422010-08-26 18:08:11 +0000368// FpI_ - Floating Point Pseudo Instruction template. Not Predicated.
Andrew Trick8523b162012-02-01 23:20:51 +0000369class FpI_<dag outs, dag ins, FPFormat fp, list<dag> pattern,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000370 InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000371 : X86Inst<0, Pseudo, NoImm, outs, ins, "", itin> {
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000372 let FPForm = fp;
Evan Cheng12c6be82007-07-31 08:04:03 +0000373 let Pattern = pattern;
374}
375
Sean Callanan050e0cd2009-09-15 00:35:17 +0000376// Templates for instructions that use a 16- or 32-bit segmented address as
377// their only operand: lcall (FAR CALL) and ljmp (FAR JMP)
378//
379// Iseg16 - 16-bit segment selector, 16-bit offset
380// Iseg32 - 16-bit segment selector, 32-bit offset
381
382class Iseg16 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000383 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000384 : X86Inst<o, f, Imm16, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000385 let Pattern = pattern;
386 let CodeSize = 3;
387}
388
389class Iseg32 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000390 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000391 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000392 let Pattern = pattern;
393 let CodeSize = 3;
394}
395
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000396// SI - SSE 1 & 2 scalar instructions
Andrew Trick8523b162012-02-01 23:20:51 +0000397class SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000398 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000399 : I<o, F, outs, ins, asm, pattern, itin> {
Craig Topperd402df32014-02-02 07:08:01 +0000400 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
401 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX],
402 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
403 !if(!eq(OpPrefix.Value, XD.Value), [UseSSE2],
404 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000405 [UseSSE1])))));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000406
407 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000408 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
409 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
410 asm));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000411}
412
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000413// SIi8 - SSE 1 & 2 scalar instructions
414class SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000415 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000416 : Ii8<o, F, outs, ins, asm, pattern, itin> {
Craig Topperd402df32014-02-02 07:08:01 +0000417 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
418 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX],
419 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
Craig Topper10243c82014-01-31 08:47:06 +0000420 [UseSSE2])));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000421
422 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000423 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
424 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
425 asm));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000426}
427
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000428// PI - SSE 1 & 2 packed instructions
429class PI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
Andrew Trick8523b162012-02-01 23:20:51 +0000430 InstrItinClass itin, Domain d>
431 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000432 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
433 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
434 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000435 [UseSSE1])));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000436
437 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000438 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
439 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
440 asm));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000441}
442
Michael Liaobbd10792012-08-30 16:54:46 +0000443// MMXPI - SSE 1 & 2 packed instructions with MMX operands
444class MMXPI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
445 InstrItinClass itin, Domain d>
446 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000447 let Predicates = !if(!eq(OpPrefix.Value, PD.Value), [HasSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000448 [HasSSE1]);
Michael Liaobbd10792012-08-30 16:54:46 +0000449}
450
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000451// PIi8 - SSE 1 & 2 packed instructions with immediate
452class PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Andrew Trick8523b162012-02-01 23:20:51 +0000453 list<dag> pattern, InstrItinClass itin, Domain d>
454 : Ii8<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000455 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
456 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
457 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000458 [UseSSE1])));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000459
460 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000461 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
462 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
463 asm));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000464}
465
Evan Cheng12c6be82007-07-31 08:04:03 +0000466// SSE1 Instruction Templates:
467//
468// SSI - SSE1 instructions with XS prefix.
469// PSI - SSE1 instructions with TB prefix.
470// PSIi8 - SSE1 instructions with ImmT == Imm8 and TB prefix.
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000471// VSSI - SSE1 instructions with XS prefix in AVX form.
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000472// VPSI - SSE1 instructions with TB prefix in AVX form, packed single.
Evan Cheng12c6be82007-07-31 08:04:03 +0000473
Andrew Trick8523b162012-02-01 23:20:51 +0000474class SSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000475 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000476 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000477class SSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000478 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000479 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000480class PSI<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 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, TB,
Michael Liaobbd10792012-08-30 16:54:46 +0000483 Requires<[UseSSE1]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000484class PSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000485 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000486 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, TB,
Michael Liaobbd10792012-08-30 16:54:46 +0000487 Requires<[UseSSE1]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000488class VSSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000489 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000490 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000491 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000492class VPSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000493 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000494 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin, SSEPackedSingle>, TB,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000495 Requires<[HasAVX]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000496
497// SSE2 Instruction Templates:
498//
Bill Wendling76105a42008-08-27 21:32:04 +0000499// SDI - SSE2 instructions with XD prefix.
500// SDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix.
Craig Topperf881d382012-07-30 02:14:02 +0000501// S2SI - SSE2 instructions with XS prefix.
Bill Wendling76105a42008-08-27 21:32:04 +0000502// SSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix.
Craig Topperae11aed2014-01-14 07:41:20 +0000503// PDI - SSE2 instructions with PD prefix, packed double domain.
504// PDIi8 - SSE2 instructions with ImmT == Imm8 and PD prefix.
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000505// VSDI - SSE2 scalar instructions with XD prefix in AVX form.
Craig Topperae11aed2014-01-14 07:41:20 +0000506// VPDI - SSE2 vector instructions with PD prefix in AVX form,
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000507// packed double domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000508// VS2I - SSE2 scalar instructions with PD prefix in AVX form.
509// S2I - SSE2 scalar instructions with PD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000510// MMXSDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix as well as
511// MMX operands.
512// MMXSSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix as well as
513// MMX operands.
Evan Cheng12c6be82007-07-31 08:04:03 +0000514
Andrew Trick8523b162012-02-01 23:20:51 +0000515class SDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000516 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000517 : I<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Evan Cheng01c7c192007-12-20 19:57:09 +0000518class SDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000519 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000520 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000521class S2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000522 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000523 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000524class S2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000525 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000526 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE2]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000527class PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000528 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000529 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000530 Requires<[UseSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000531class PDIi8<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000533 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000534 Requires<[UseSSE2]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000535class VSDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000536 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000537 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XD,
Elena Demikhovsky3ce8dbb2013-08-18 13:08:57 +0000538 Requires<[UseAVX]>;
Craig Topperf881d382012-07-30 02:14:02 +0000539class VS2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000540 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperf881d382012-07-30 02:14:02 +0000541 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
542 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000543class VPDI<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000545 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin, SSEPackedDouble>,
546 PD, Requires<[HasAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000547class VS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
548 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000549 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, PD,
550 Requires<[UseAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000551class S2I<bits<8> o, Format F, dag outs, dag ins, string asm,
552 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000553 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[UseSSE2]>;
Michael Liaobbd10792012-08-30 16:54:46 +0000554class MMXSDIi8<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>
Michael Liaobbd10792012-08-30 16:54:46 +0000556 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasSSE2]>;
557class MMXS2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000558 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000559 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[HasSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000560
561// SSE3 Instruction Templates:
562//
Craig Topperae11aed2014-01-14 07:41:20 +0000563// S3I - SSE3 instructions with PD prefixes.
Evan Cheng12c6be82007-07-31 08:04:03 +0000564// S3SI - SSE3 instructions with XS prefix.
565// S3DI - SSE3 instructions with XD prefix.
566
Sean Callanan04d8cb72009-12-18 00:01:26 +0000567class S3SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000568 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000569 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, XS,
Michael Liaobbd10792012-08-30 16:54:46 +0000570 Requires<[UseSSE3]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000571class S3DI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000572 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000573 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, XD,
Michael Liaobbd10792012-08-30 16:54:46 +0000574 Requires<[UseSSE3]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000575class S3I<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000577 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000578 Requires<[UseSSE3]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000579
580
Nate Begeman8ef50212008-02-12 22:51:28 +0000581// SSSE3 Instruction Templates:
582//
583// SS38I - SSSE3 instructions with T8 prefix.
584// SS3AI - SSSE3 instructions with TA prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000585// MMXSS38I - SSSE3 instructions with T8 prefix and MMX operands.
586// MMXSS3AI - SSSE3 instructions with TA prefix and MMX operands.
Nate Begeman8ef50212008-02-12 22:51:28 +0000587//
588// Note: SSSE3 instructions have 64-bit and 128-bit versions. The 64-bit version
Craig Topper744f6312012-01-09 00:11:29 +0000589// uses the MMX registers. The 64-bit versions are grouped with the MMX
590// classes. They need to be enabled even if AVX is enabled.
Nate Begeman8ef50212008-02-12 22:51:28 +0000591
592class SS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000593 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000594 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000595 Requires<[UseSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000596class SS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000597 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000598 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000599 Requires<[UseSSSE3]>;
600class MMXSS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000601 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000602 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8,
603 Requires<[HasSSSE3]>;
604class MMXSS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000605 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000606 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TA,
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000607 Requires<[HasSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000608
609// SSE4.1 Instruction Templates:
610//
611// SS48I - SSE 4.1 instructions with T8 prefix.
Evan Cheng96bdbd62008-03-14 07:39:27 +0000612// SS41AIi8 - SSE 4.1 instructions with TA prefix and ImmT == Imm8.
Nate Begeman8ef50212008-02-12 22:51:28 +0000613//
614class SS48I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000615 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000616 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000617 Requires<[UseSSE41]>;
Evan Cheng96bdbd62008-03-14 07:39:27 +0000618class SS4AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000619 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000620 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000621 Requires<[UseSSE41]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000622
Nate Begeman55b7bec2008-07-17 16:51:19 +0000623// SSE4.2 Instruction Templates:
624//
625// SS428I - SSE 4.2 instructions with T8 prefix.
626class SS428I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000627 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000628 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000629 Requires<[UseSSE42]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000630
Craig Topper96fa5972011-10-16 16:50:08 +0000631// SS42FI - SSE 4.2 instructions with T8XD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000632// NOTE: 'HasSSE42' is used as SS42FI is only used for CRC32 insns.
Eric Christopher7dfa9f22009-08-08 21:55:08 +0000633class SS42FI<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>, T8XD, Requires<[HasSSE42]>;
Craig Topperb9109842012-01-01 19:51:58 +0000636
Eric Christopher9fe912d2009-08-18 22:50:32 +0000637// SS42AI = SSE 4.2 instructions with TA prefix
638class SS42AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000639 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000640 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000641 Requires<[UseSSE42]>;
Eric Christopher9fe912d2009-08-18 22:50:32 +0000642
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000643// AVX Instruction Templates:
644// Instructions introduced in AVX (no SSE equivalent forms)
645//
Craig Topperae11aed2014-01-14 07:41:20 +0000646// AVX8I - AVX instructions with T8PD prefix.
647// AVXAIi8 - AVX instructions with TAPD prefix and ImmT = Imm8.
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000648class AVX8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000649 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000650 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000651 Requires<[HasAVX]>;
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000652class AVXAIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000653 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000654 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000655 Requires<[HasAVX]>;
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000656
Craig Topper05d1cb92011-11-06 06:12:20 +0000657// AVX2 Instruction Templates:
658// Instructions introduced in AVX2 (no SSE equivalent forms)
659//
Craig Topperae11aed2014-01-14 07:41:20 +0000660// AVX28I - AVX2 instructions with T8PD prefix.
661// AVX2AIi8 - AVX2 instructions with TAPD prefix and ImmT = Imm8.
Craig Topper05d1cb92011-11-06 06:12:20 +0000662class AVX28I<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 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000665 Requires<[HasAVX2]>;
Craig Topperf01f1b52011-11-06 23:04:08 +0000666class AVX2AIi8<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 Topperae11aed2014-01-14 07:41:20 +0000668 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000669 Requires<[HasAVX2]>;
670
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000671
672// AVX-512 Instruction Templates:
673// Instructions introduced in AVX-512 (no SSE equivalent forms)
674//
Craig Topperae11aed2014-01-14 07:41:20 +0000675// AVX5128I - AVX-512 instructions with T8PD prefix.
676// AVX512AIi8 - AVX-512 instructions with TAPD prefix and ImmT = Imm8.
677// AVX512PDI - AVX-512 instructions with PD, double packed.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000678// AVX512PSI - AVX-512 instructions with TB, single packed.
679// AVX512XS8I - AVX-512 instructions with T8 and XS prefixes.
680// AVX512XSI - AVX-512 instructions with XS prefix, generic domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000681// AVX512BI - AVX-512 instructions with PD, int packed domain.
682// AVX512SI - AVX-512 scalar instructions with PD prefix.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000683
684class AVX5128I<bits<8> o, Format F, dag outs, dag ins, string asm,
685 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000686 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000687 Requires<[HasAVX512]>;
688class AVX512XS8I<bits<8> o, Format F, dag outs, dag ins, string asm,
689 list<dag> pattern, InstrItinClass itin = NoItinerary>
690 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8XS,
691 Requires<[HasAVX512]>;
692class AVX512XSI<bits<8> o, Format F, dag outs, dag ins, string asm,
693 list<dag> pattern, InstrItinClass itin = NoItinerary>
694 : I<o, F, outs, ins, asm, pattern, itin>, XS,
695 Requires<[HasAVX512]>;
696class AVX512XDI<bits<8> o, Format F, dag outs, dag ins, string asm,
697 list<dag> pattern, InstrItinClass itin = NoItinerary>
698 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, XD,
699 Requires<[HasAVX512]>;
700class AVX512BI<bits<8> o, Format F, dag outs, dag ins, string asm,
701 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000702 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000703 Requires<[HasAVX512]>;
704class AVX512BIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
705 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000706 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000707 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000708class AVX512AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
709 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000710 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000711 Requires<[HasAVX512]>;
712class AVX512Ii8<bits<8> o, Format F, dag outs, dag ins, string asm,
713 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000714 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>,
Craig Topperae11aed2014-01-14 07:41:20 +0000715 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000716class AVX512PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
717 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000718 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
719 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000720class AVX512PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
721 list<dag> pattern, InstrItinClass itin = NoItinerary>
722 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, TB,
723 Requires<[HasAVX512]>;
724class AVX512PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
725 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000726 : Ii8<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000727class AVX512PI<bits<8> o, Format F, dag outs, dag ins, string asm,
728 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000729 : I<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000730class AVX512FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
731 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000732 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
733 EVEX_4V, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000734
Eric Christopher2ef63182010-04-02 21:54:27 +0000735// AES Instruction Templates:
736//
737// AES8I
Eric Christopher1290fa02010-04-05 21:14:32 +0000738// These use the same encoding as the SSE4.2 T8 and TA encodings.
Eric Christopher2ef63182010-04-02 21:54:27 +0000739class AES8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Preston Gurd3fe264d2013-09-13 19:23:28 +0000740 list<dag>pattern, InstrItinClass itin = IIC_AES>
Craig Topperae11aed2014-01-14 07:41:20 +0000741 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topperc0cef322012-05-01 05:35:02 +0000742 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000743
744class AESAI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000745 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000746 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topperc0cef322012-05-01 05:35:02 +0000747 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000748
Benjamin Kramera0396e42012-05-31 14:34:17 +0000749// PCLMUL Instruction Templates
750class PCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000751 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000752 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
753 Requires<[HasPCLMUL]>;
Eli Friedman415412e2011-07-05 18:21:20 +0000754
Benjamin Kramera0396e42012-05-31 14:34:17 +0000755class AVXPCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000756 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000757 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
758 VEX_4V, Requires<[HasAVX, HasPCLMUL]>;
Bruno Cardoso Lopesea0e05a2010-07-23 18:41:12 +0000759
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000760// FMA3 Instruction Templates
761class FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000762 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000763 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
764 VEX_4V, FMASC, Requires<[HasFMA]>;
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000765
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000766// FMA4 Instruction Templates
767class FMA4<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000768 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000769 : Ii8<o, F, outs, ins, asm, pattern, itin>, TAPD,
770 VEX_4V, VEX_I8IMM, FMASC, Requires<[HasFMA4]>;
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000771
Jan Sjödin7c0face2011-12-12 19:37:49 +0000772// XOP 2, 3 and 4 Operand Instruction Template
773class IXOP<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000774 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000775 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Craig Topperd402df32014-02-02 07:08:01 +0000776 XOP9, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000777
778// XOP 2, 3 and 4 Operand Instruction Templates with imm byte
779class IXOPi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000780 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000781 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Craig Topperd402df32014-02-02 07:08:01 +0000782 XOP8, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000783
784// XOP 5 operand instruction (VEX encoding!)
785class IXOP5<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000786 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000787 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
788 VEX_4V, VEX_I8IMM, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000789
Evan Cheng12c6be82007-07-31 08:04:03 +0000790// X86-64 Instruction templates...
791//
792
Andrew Trick8523b162012-02-01 23:20:51 +0000793class RI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000794 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000795 : I<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000796class RIi8 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000797 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000798 : Ii8<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse4e033b02014-01-13 14:05:59 +0000799class RIi16 <bits<8> o, Format F, dag outs, dag ins, string asm,
800 list<dag> pattern, InstrItinClass itin = NoItinerary>
801 : Ii16<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000802class RIi32 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000803 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000804 : Ii32<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse0b6c9492014-01-30 22:20:41 +0000805class RIi32S <bits<8> o, Format F, dag outs, dag ins, string asm,
806 list<dag> pattern, InstrItinClass itin = NoItinerary>
807 : Ii32S<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000808
809class RIi64<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000810 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000811 : X86Inst<o, f, Imm64, outs, ins, asm, itin>, REX_W {
Evan Cheng12c6be82007-07-31 08:04:03 +0000812 let Pattern = pattern;
813 let CodeSize = 3;
814}
815
Kevin Enderby285da022013-07-22 21:25:31 +0000816class RIi64_NOREX<bits<8> o, Format f, dag outs, dag ins, string asm,
817 list<dag> pattern, InstrItinClass itin = NoItinerary>
818 : X86Inst<o, f, Imm64, outs, ins, asm, itin> {
819 let Pattern = pattern;
820 let CodeSize = 3;
821}
822
Evan Cheng12c6be82007-07-31 08:04:03 +0000823class RSSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000824 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000825 : SSI<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000826class RSDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000827 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000828 : SDI<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000829class RPDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000830 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000831 : PDI<o, F, outs, ins, asm, pattern, itin>, REX_W;
Bruno Cardoso Lopes123dff02011-07-25 23:05:25 +0000832class VRPDI<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000834 : VPDI<o, F, outs, ins, asm, pattern, itin>, VEX_W;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000835class RS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
836 list<dag> pattern, InstrItinClass itin = NoItinerary>
837 : S2I<o, F, outs, ins, asm, pattern, itin>, REX_W;
838class VRS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
839 list<dag> pattern, InstrItinClass itin = NoItinerary>
840 : VS2I<o, F, outs, ins, asm, pattern, itin>, VEX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000841
842// MMX Instruction templates
843//
844
845// MMXI - MMX instructions with TB prefix.
Craig Topperbc749db2013-10-09 02:18:34 +0000846// MMXI32 - MMX instructions with TB prefix valid only in 32 bit mode.
Anton Korobeynikov31099512008-08-23 15:53:19 +0000847// MMXI64 - MMX instructions with TB prefix valid only in 64 bit mode.
Craig Topperae11aed2014-01-14 07:41:20 +0000848// MMX2I - MMX / SSE2 instructions with PD prefix.
Evan Cheng12c6be82007-07-31 08:04:03 +0000849// MMXIi8 - MMX instructions with ImmT == Imm8 and TB prefix.
850// MMXIi8 - MMX instructions with ImmT == Imm8 and TB prefix.
851// MMXID - MMX instructions with XD prefix.
852// MMXIS - MMX instructions with XS prefix.
Sean Callanan04d8cb72009-12-18 00:01:26 +0000853class MMXI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000854 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000855 : I<o, F, outs, ins, asm, pattern, itin>, TB, Requires<[HasMMX]>;
Craig Topperbc749db2013-10-09 02:18:34 +0000856class MMXI32<bits<8> o, Format F, dag outs, dag ins, string asm,
857 list<dag> pattern, InstrItinClass itin = NoItinerary>
Eric Christopherc0a5aae2013-12-20 02:04:49 +0000858 : I<o, F, outs, ins, asm, pattern, itin>, TB, Requires<[HasMMX,Not64BitMode]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000859class MMXI64<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000860 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000861 : I<o, F, outs, ins, asm, pattern, itin>, TB, Requires<[HasMMX,In64BitMode]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000862class MMXRI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000863 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000864 : I<o, F, outs, ins, asm, pattern, itin>, TB, REX_W, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000865class MMX2I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000866 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000867 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000868class MMXIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000869 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000870 : Ii8<o, F, outs, ins, asm, pattern, itin>, TB, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000871class MMXID<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000872 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000873 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000874class MMXIS<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000875 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000876 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[HasMMX]>;