blob: 5ef80bdc3150f2a0a0bf8af75fa8b020126a14c9 [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
Evan Cheng12c6be82007-07-31 08:04:03 +0000146// Prefix byte classes which are used to indicate to the ad-hoc machine code
147// emitter that various prefix bytes are required.
148class OpSize { bit hasOpSizePrefix = 1; }
Craig Topper7ceb54a2014-01-06 06:02:58 +0000149class OpSize16 { bit hasOpSize16Prefix = 1; }
Evan Cheng12c6be82007-07-31 08:04:03 +0000150class AdSize { bit hasAdSizePrefix = 1; }
151class REX_W { bit hasREX_WPrefix = 1; }
Andrew Lenharth0070dd12008-03-01 13:37:02 +0000152class LOCK { bit hasLockPrefix = 1; }
Craig Topperec688662014-01-31 07:00:55 +0000153class REP { bit hasREPPrefix = 1; }
Craig Topperda7160d2014-02-01 08:17:56 +0000154class TB { Map OpMap = TB; }
Craig Topper10243c82014-01-31 08:47:06 +0000155class D8 { Map OpMap = D8; }
156class D9 { Map OpMap = D9; }
157class DA { Map OpMap = DA; }
158class DB { Map OpMap = DB; }
159class DC { Map OpMap = DC; }
160class DD { Map OpMap = DD; }
161class DE { Map OpMap = DE; }
162class DF { Map OpMap = DF; }
Craig Topper10243c82014-01-31 08:47:06 +0000163class T8 { Map OpMap = T8; }
164class TA { Map OpMap = TA; }
165class A6 { Map OpMap = A6; }
166class A7 { Map OpMap = A7; }
Craig Topper10243c82014-01-31 08:47:06 +0000167class XOP8 { Map OpMap = XOP8; }
168class XOP9 { Map OpMap = XOP9; }
169class XOPA { Map OpMap = XOPA; }
Craig Topperda7160d2014-02-01 08:17:56 +0000170class PD : TB { Prefix OpPrefix = PD; }
171class XD : TB { Prefix OpPrefix = XD; }
172class XS : TB { Prefix OpPrefix = XS; }
173class T8PD : T8 { Prefix OpPrefix = PD; }
174class T8XD : T8 { Prefix OpPrefix = XD; }
175class T8XS : T8 { Prefix OpPrefix = XS; }
176class TAPD : TA { Prefix OpPrefix = PD; }
177class TAXD : TA { Prefix OpPrefix = XD; }
Bruno Cardoso Lopes1a890f92010-06-22 22:38:56 +0000178class VEX { bit hasVEXPrefix = 1; }
Bruno Cardoso Lopes05166742010-07-01 01:20:06 +0000179class VEX_W { bit hasVEX_WPrefix = 1; }
Bruno Cardoso Lopes1a890f92010-06-22 22:38:56 +0000180class VEX_4V : VEX { bit hasVEX_4VPrefix = 1; }
Craig Topperaea148c2011-10-16 07:55:05 +0000181class VEX_4VOp3 : VEX { bit hasVEX_4VOp3Prefix = 1; }
Bruno Cardoso Lopese2bd0582010-07-06 22:36:24 +0000182class VEX_I8IMM { bit hasVEX_i8ImmReg = 1; }
Bruno Cardoso Lopesfd8bfcd2010-07-13 21:07:28 +0000183class VEX_L { bit hasVEX_L = 1; }
Craig Topperf18c8962011-10-04 06:30:42 +0000184class VEX_LIG { bit ignoresVEX_L = 1; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000185class EVEX : VEX { bit hasEVEXPrefix = 1; }
186class EVEX_4V : VEX_4V { bit hasEVEXPrefix = 1; }
187class EVEX_K { bit hasEVEX_K = 1; }
188class EVEX_KZ : EVEX_K { bit hasEVEX_Z = 1; }
189class EVEX_B { bit hasEVEX_B = 1; }
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000190class EVEX_RC { bit hasEVEX_RC = 1; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000191class EVEX_V512 { bit hasEVEX_L2 = 1; bit hasVEX_L = 0; }
192class EVEX_CD8<int esize, CD8VForm form> {
193 bits<2> EVEX_CD8E = !if(!eq(esize, 8), 0b00,
194 !if(!eq(esize, 16), 0b01,
195 !if(!eq(esize, 32), 0b10,
196 !if(!eq(esize, 64), 0b11, ?))));
197 bits<3> EVEX_CD8V = form.Value;
198}
Chris Lattner45270db2010-10-03 18:08:05 +0000199class Has3DNow0F0FOpcode { bit has3DNow0F0FOpcode = 1; }
Craig Toppercd93de92011-12-30 04:48:54 +0000200class MemOp4 { bit hasMemOp4Prefix = 1; }
Jan Sjödin6dd24882011-12-12 19:12:26 +0000201class XOP { bit hasXOP_Prefix = 1; }
Evan Cheng12c6be82007-07-31 08:04:03 +0000202class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
Andrew Trick8523b162012-02-01 23:20:51 +0000203 string AsmStr,
204 InstrItinClass itin,
205 Domain d = GenericDomain>
Evan Cheng12c6be82007-07-31 08:04:03 +0000206 : Instruction {
207 let Namespace = "X86";
208
209 bits<8> Opcode = opcod;
210 Format Form = f;
211 bits<6> FormBits = Form.Value;
212 ImmType ImmT = i;
Evan Cheng12c6be82007-07-31 08:04:03 +0000213
214 dag OutOperandList = outs;
215 dag InOperandList = ins;
216 string AsmString = AsmStr;
217
Chris Lattner7ff33462010-10-31 19:22:57 +0000218 // If this is a pseudo instruction, mark it isCodeGenOnly.
219 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
220
Andrew Trick8523b162012-02-01 23:20:51 +0000221 let Itinerary = itin;
222
Evan Cheng12c6be82007-07-31 08:04:03 +0000223 //
224 // Attributes specific to X86 instructions...
225 //
Craig Topper3484fc22014-01-05 04:17:28 +0000226 bit ForceDisassemble = 0; // Force instruction to disassemble even though it's
227 // isCodeGenonly. Needed to hide an ambiguous
228 // AsmString from the parser, but still disassemble.
229
Evan Cheng12c6be82007-07-31 08:04:03 +0000230 bit hasOpSizePrefix = 0; // Does this inst have a 0x66 prefix?
Craig Topper7ceb54a2014-01-06 06:02:58 +0000231 bit hasOpSize16Prefix = 0;// Does this inst have a 0x66 prefix in 16-bit mode?
Evan Cheng12c6be82007-07-31 08:04:03 +0000232 bit hasAdSizePrefix = 0; // Does this inst have a 0x67 prefix?
233
Craig Topper10243c82014-01-31 08:47:06 +0000234 Prefix OpPrefix = NoPrfx; // Which prefix byte does this inst have?
235 Map OpMap = OB; // Which opcode map does this inst have?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000236 bit hasREX_WPrefix = 0; // Does this inst require the REX.W prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000237 FPFormat FPForm = NotFP; // What flavor of FP instruction is this?
Dan Gohmana21bdda2008-08-20 13:46:21 +0000238 bit hasLockPrefix = 0; // Does this inst have a 0xF0 prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000239 Domain ExeDomain = d;
Craig Topperec688662014-01-31 07:00:55 +0000240 bit hasREPPrefix = 0; // Does this inst have a REP prefix?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000241 bit hasVEXPrefix = 0; // Does this inst require a VEX prefix?
Bruno Cardoso Lopes05166742010-07-01 01:20:06 +0000242 bit hasVEX_WPrefix = 0; // Does this inst set the VEX_W field?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000243 bit hasVEX_4VPrefix = 0; // Does this inst require the VEX.VVVV field?
Craig Topperaea148c2011-10-16 07:55:05 +0000244 bit hasVEX_4VOp3Prefix = 0; // Does this inst require the VEX.VVVV field to
245 // encode the third operand?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000246 bit hasVEX_i8ImmReg = 0; // Does this inst require the last source register
Bruno Cardoso Lopese2bd0582010-07-06 22:36:24 +0000247 // to be encoded in a immediate field?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000248 bit hasVEX_L = 0; // Does this inst use large (256-bit) registers?
Craig Topperf18c8962011-10-04 06:30:42 +0000249 bit ignoresVEX_L = 0; // Does this instruction ignore the L-bit
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000250 bit hasEVEXPrefix = 0; // Does this inst require EVEX form?
251 bit hasEVEX_K = 0; // Does this inst require masking?
252 bit hasEVEX_Z = 0; // Does this inst set the EVEX_Z field?
253 bit hasEVEX_L2 = 0; // Does this inst set the EVEX_L2 field?
254 bit hasEVEX_B = 0; // Does this inst set the EVEX_B field?
255 bits<2> EVEX_CD8E = 0; // Compressed disp8 form - element-size.
256 bits<3> EVEX_CD8V = 0; // Compressed disp8 form - vector-width.
Chris Lattner45270db2010-10-03 18:08:05 +0000257 bit has3DNow0F0FOpcode =0;// Wacky 3dNow! encoding?
Craig Toppercd93de92011-12-30 04:48:54 +0000258 bit hasMemOp4Prefix = 0; // Same bit as VEX_W, but used for swapping operands
Jan Sjödin6dd24882011-12-12 19:12:26 +0000259 bit hasXOP_Prefix = 0; // Does this inst require an XOP prefix?
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000260 bit hasEVEX_RC = 0; // Explicitly specified rounding control in FP instruction.
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000261
262 // TSFlags layout should be kept in sync with X86InstrInfo.h.
263 let TSFlags{5-0} = FormBits;
264 let TSFlags{6} = hasOpSizePrefix;
Craig Topper7ceb54a2014-01-06 06:02:58 +0000265 let TSFlags{7} = hasOpSize16Prefix;
266 let TSFlags{8} = hasAdSizePrefix;
Craig Topper10243c82014-01-31 08:47:06 +0000267 let TSFlags{10-9} = OpPrefix.Value;
268 let TSFlags{15-11} = OpMap.Value;
269 let TSFlags{16} = hasREX_WPrefix;
270 let TSFlags{20-17} = ImmT.Value;
271 let TSFlags{23-21} = FPForm.Value;
272 let TSFlags{24} = hasLockPrefix;
273 let TSFlags{25} = hasREPPrefix;
274 let TSFlags{27-26} = ExeDomain.Value;
275 let TSFlags{35-28} = Opcode;
276 let TSFlags{36} = hasVEXPrefix;
277 let TSFlags{37} = hasVEX_WPrefix;
278 let TSFlags{38} = hasVEX_4VPrefix;
279 let TSFlags{39} = hasVEX_4VOp3Prefix;
280 let TSFlags{40} = hasVEX_i8ImmReg;
281 let TSFlags{41} = hasVEX_L;
282 let TSFlags{42} = ignoresVEX_L;
283 let TSFlags{43} = hasEVEXPrefix;
284 let TSFlags{44} = hasEVEX_K;
285 let TSFlags{45} = hasEVEX_Z;
286 let TSFlags{46} = hasEVEX_L2;
287 let TSFlags{47} = hasEVEX_B;
288 let TSFlags{49-48} = EVEX_CD8E;
289 let TSFlags{52-50} = EVEX_CD8V;
290 let TSFlags{53} = has3DNow0F0FOpcode;
291 let TSFlags{54} = hasMemOp4Prefix;
292 let TSFlags{55} = hasXOP_Prefix;
293 let TSFlags{56} = hasEVEX_RC;
Evan Cheng12c6be82007-07-31 08:04:03 +0000294}
295
Eric Christopheref62f572010-11-30 08:57:23 +0000296class PseudoI<dag oops, dag iops, list<dag> pattern>
Andrew Trick8523b162012-02-01 23:20:51 +0000297 : X86Inst<0, Pseudo, NoImm, oops, iops, "", NoItinerary> {
Eric Christopheref62f572010-11-30 08:57:23 +0000298 let Pattern = pattern;
299}
300
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000301class I<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000302 list<dag> pattern, InstrItinClass itin = NoItinerary,
Andrew Trick8523b162012-02-01 23:20:51 +0000303 Domain d = GenericDomain>
304 : X86Inst<o, f, NoImm, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000305 let Pattern = pattern;
306 let CodeSize = 3;
307}
Sean Callanan04d8cb72009-12-18 00:01:26 +0000308class Ii8 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000309 list<dag> pattern, InstrItinClass itin = NoItinerary,
Andrew Trick8523b162012-02-01 23:20:51 +0000310 Domain d = GenericDomain>
311 : X86Inst<o, f, Imm8, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000312 let Pattern = pattern;
313 let CodeSize = 3;
314}
Chris Lattner12455ca2010-02-12 22:27:07 +0000315class Ii8PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000316 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000317 : X86Inst<o, f, Imm8PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000318 let Pattern = pattern;
319 let CodeSize = 3;
320}
Sean Callanan04d8cb72009-12-18 00:01:26 +0000321class Ii16<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000322 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000323 : X86Inst<o, f, Imm16, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000324 let Pattern = pattern;
325 let CodeSize = 3;
326}
Sean Callanan04d8cb72009-12-18 00:01:26 +0000327class Ii32<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000328 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000329 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000330 let Pattern = pattern;
331 let CodeSize = 3;
332}
David Woodhouse0b6c9492014-01-30 22:20:41 +0000333class Ii32S<bits<8> o, Format f, dag outs, dag ins, string asm,
334 list<dag> pattern, InstrItinClass itin = NoItinerary>
335 : X86Inst<o, f, Imm32S, outs, ins, asm, itin> {
336 let Pattern = pattern;
337 let CodeSize = 3;
338}
Evan Cheng12c6be82007-07-31 08:04:03 +0000339
Chris Lattnerac588122010-07-07 22:27:31 +0000340class Ii16PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000341 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000342 : X86Inst<o, f, Imm16PCRel, outs, ins, asm, itin> {
Chris Lattnerac588122010-07-07 22:27:31 +0000343 let Pattern = pattern;
344 let CodeSize = 3;
345}
346
Chris Lattner12455ca2010-02-12 22:27:07 +0000347class Ii32PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000348 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000349 : X86Inst<o, f, Imm32PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000350 let Pattern = pattern;
351 let CodeSize = 3;
352}
353
Evan Cheng12c6be82007-07-31 08:04:03 +0000354// FPStack Instruction Templates:
355// FPI - Floating Point Instruction template.
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000356class FPI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000357 InstrItinClass itin = NoItinerary>
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000358 : I<o, F, outs, ins, asm, [], itin> {}
Evan Cheng12c6be82007-07-31 08:04:03 +0000359
Bob Wilsona967c422010-08-26 18:08:11 +0000360// FpI_ - Floating Point Pseudo Instruction template. Not Predicated.
Andrew Trick8523b162012-02-01 23:20:51 +0000361class FpI_<dag outs, dag ins, FPFormat fp, list<dag> pattern,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000362 InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000363 : X86Inst<0, Pseudo, NoImm, outs, ins, "", itin> {
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000364 let FPForm = fp;
Evan Cheng12c6be82007-07-31 08:04:03 +0000365 let Pattern = pattern;
366}
367
Sean Callanan050e0cd2009-09-15 00:35:17 +0000368// Templates for instructions that use a 16- or 32-bit segmented address as
369// their only operand: lcall (FAR CALL) and ljmp (FAR JMP)
370//
371// Iseg16 - 16-bit segment selector, 16-bit offset
372// Iseg32 - 16-bit segment selector, 32-bit offset
373
374class Iseg16 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000375 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000376 : X86Inst<o, f, Imm16, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000377 let Pattern = pattern;
378 let CodeSize = 3;
379}
380
381class Iseg32 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000382 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000383 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000384 let Pattern = pattern;
385 let CodeSize = 3;
386}
387
Michael Liaobbd10792012-08-30 16:54:46 +0000388def __xs : XS;
Elena Demikhovskyfad02922013-05-21 12:04:22 +0000389def __xd : XD;
Craig Topperae11aed2014-01-14 07:41:20 +0000390def __pd : PD;
Michael Liaobbd10792012-08-30 16:54:46 +0000391
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000392// SI - SSE 1 & 2 scalar instructions
Andrew Trick8523b162012-02-01 23:20:51 +0000393class SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000394 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000395 : I<o, F, outs, ins, asm, pattern, itin> {
Elena Demikhovsky3ce8dbb2013-08-18 13:08:57 +0000396 let Predicates = !if(hasEVEXPrefix /* EVEX */, [HasAVX512],
397 !if(hasVEXPrefix /* VEX */, [UseAVX],
Craig Topper10243c82014-01-31 08:47:06 +0000398 !if(!eq(OpPrefix.Value, __xs.OpPrefix.Value), [UseSSE1],
399 !if(!eq(OpPrefix.Value, __xd.OpPrefix.Value), [UseSSE2],
400 !if(!eq(OpPrefix.Value, __pd.OpPrefix.Value), [UseSSE2],
401 [UseSSE1])))));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000402
403 // AVX instructions have a 'v' prefix in the mnemonic
Bruno Cardoso Lopes1a890f92010-06-22 22:38:56 +0000404 let AsmString = !if(hasVEXPrefix, !strconcat("v", asm), asm);
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000405}
406
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000407// SIi8 - SSE 1 & 2 scalar instructions
408class SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000409 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000410 : Ii8<o, F, outs, ins, asm, pattern, itin> {
Elena Demikhovsky3ce8dbb2013-08-18 13:08:57 +0000411 let Predicates = !if(hasEVEXPrefix /* EVEX */, [HasAVX512],
412 !if(hasVEXPrefix /* VEX */, [UseAVX],
Craig Topper10243c82014-01-31 08:47:06 +0000413 !if(!eq(OpPrefix.Value, __xs.OpPrefix.Value), [UseSSE1],
414 [UseSSE2])));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000415
416 // AVX instructions have a 'v' prefix in the mnemonic
417 let AsmString = !if(hasVEXPrefix, !strconcat("v", asm), asm);
418}
419
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000420// PI - SSE 1 & 2 packed instructions
421class PI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
Andrew Trick8523b162012-02-01 23:20:51 +0000422 InstrItinClass itin, Domain d>
423 : I<o, F, outs, ins, asm, pattern, itin, d> {
Elena Demikhovsky3ce8dbb2013-08-18 13:08:57 +0000424 let Predicates = !if(hasEVEXPrefix /* EVEX */, [HasAVX512],
425 !if(hasVEXPrefix /* VEX */, [HasAVX],
Craig Topper10243c82014-01-31 08:47:06 +0000426 !if(!eq(OpPrefix.Value, __pd.OpPrefix.Value), [UseSSE2],
427 [UseSSE1])));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000428
429 // AVX instructions have a 'v' prefix in the mnemonic
Bruno Cardoso Lopes1a890f92010-06-22 22:38:56 +0000430 let AsmString = !if(hasVEXPrefix, !strconcat("v", asm), asm);
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000431}
432
Michael Liaobbd10792012-08-30 16:54:46 +0000433// MMXPI - SSE 1 & 2 packed instructions with MMX operands
434class MMXPI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
435 InstrItinClass itin, Domain d>
436 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topper10243c82014-01-31 08:47:06 +0000437 let Predicates = !if(!eq(OpPrefix.Value, __pd.OpPrefix.Value), [HasSSE2],
438 [HasSSE1]);
Michael Liaobbd10792012-08-30 16:54:46 +0000439}
440
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000441// PIi8 - SSE 1 & 2 packed instructions with immediate
442class PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Andrew Trick8523b162012-02-01 23:20:51 +0000443 list<dag> pattern, InstrItinClass itin, Domain d>
444 : Ii8<o, F, outs, ins, asm, pattern, itin, d> {
Elena Demikhovsky3ce8dbb2013-08-18 13:08:57 +0000445 let Predicates = !if(hasEVEXPrefix /* EVEX */, [HasAVX512],
446 !if(hasVEXPrefix /* VEX */, [HasAVX],
Craig Topper10243c82014-01-31 08:47:06 +0000447 !if(!eq(OpPrefix.Value, __pd.OpPrefix.Value), [UseSSE2],
448 [UseSSE1])));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000449
450 // AVX instructions have a 'v' prefix in the mnemonic
Elena Demikhovsky3ce8dbb2013-08-18 13:08:57 +0000451 let AsmString = !if(hasVEXPrefix, !strconcat("v", asm), asm);
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000452}
453
Evan Cheng12c6be82007-07-31 08:04:03 +0000454// SSE1 Instruction Templates:
455//
456// SSI - SSE1 instructions with XS prefix.
457// PSI - SSE1 instructions with TB prefix.
458// PSIi8 - SSE1 instructions with ImmT == Imm8 and TB prefix.
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000459// VSSI - SSE1 instructions with XS prefix in AVX form.
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000460// VPSI - SSE1 instructions with TB prefix in AVX form, packed single.
Evan Cheng12c6be82007-07-31 08:04:03 +0000461
Andrew Trick8523b162012-02-01 23:20:51 +0000462class SSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000463 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000464 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000465class SSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000466 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000467 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000468class PSI<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 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, TB,
Michael Liaobbd10792012-08-30 16:54:46 +0000471 Requires<[UseSSE1]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000472class PSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000473 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000474 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, TB,
Michael Liaobbd10792012-08-30 16:54:46 +0000475 Requires<[UseSSE1]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000476class VSSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000477 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000478 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000479 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000480class VPSI<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, !strconcat("v", asm), pattern, itin, SSEPackedSingle>, TB,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000483 Requires<[HasAVX]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000484
485// SSE2 Instruction Templates:
486//
Bill Wendling76105a42008-08-27 21:32:04 +0000487// SDI - SSE2 instructions with XD prefix.
488// SDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix.
Craig Topperf881d382012-07-30 02:14:02 +0000489// S2SI - SSE2 instructions with XS prefix.
Bill Wendling76105a42008-08-27 21:32:04 +0000490// SSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix.
Craig Topperae11aed2014-01-14 07:41:20 +0000491// PDI - SSE2 instructions with PD prefix, packed double domain.
492// PDIi8 - SSE2 instructions with ImmT == Imm8 and PD prefix.
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000493// VSDI - SSE2 scalar instructions with XD prefix in AVX form.
Craig Topperae11aed2014-01-14 07:41:20 +0000494// VPDI - SSE2 vector instructions with PD prefix in AVX form,
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000495// packed double domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000496// VS2I - SSE2 scalar instructions with PD prefix in AVX form.
497// S2I - SSE2 scalar instructions with PD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000498// MMXSDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix as well as
499// MMX operands.
500// MMXSSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix as well as
501// MMX operands.
Evan Cheng12c6be82007-07-31 08:04:03 +0000502
Andrew Trick8523b162012-02-01 23:20:51 +0000503class SDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000504 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000505 : I<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Evan Cheng01c7c192007-12-20 19:57:09 +0000506class SDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000507 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000508 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000509class S2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000510 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000511 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000512class S2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000513 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000514 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE2]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000515class PDI<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000517 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000518 Requires<[UseSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000519class PDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000520 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000521 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000522 Requires<[UseSSE2]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000523class VSDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000524 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000525 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XD,
Elena Demikhovsky3ce8dbb2013-08-18 13:08:57 +0000526 Requires<[UseAVX]>;
Craig Topperf881d382012-07-30 02:14:02 +0000527class VS2SI<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 Topperf881d382012-07-30 02:14:02 +0000529 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
530 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000531class VPDI<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 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin, SSEPackedDouble>,
534 PD, Requires<[HasAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000535class VS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
536 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000537 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, PD,
538 Requires<[UseAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000539class S2I<bits<8> o, Format F, dag outs, dag ins, string asm,
540 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000541 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[UseSSE2]>;
Michael Liaobbd10792012-08-30 16:54:46 +0000542class MMXSDIi8<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>
Michael Liaobbd10792012-08-30 16:54:46 +0000544 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasSSE2]>;
545class MMXS2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000546 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000547 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[HasSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000548
549// SSE3 Instruction Templates:
550//
Craig Topperae11aed2014-01-14 07:41:20 +0000551// S3I - SSE3 instructions with PD prefixes.
Evan Cheng12c6be82007-07-31 08:04:03 +0000552// S3SI - SSE3 instructions with XS prefix.
553// S3DI - SSE3 instructions with XD prefix.
554
Sean Callanan04d8cb72009-12-18 00:01:26 +0000555class S3SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000556 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000557 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, XS,
Michael Liaobbd10792012-08-30 16:54:46 +0000558 Requires<[UseSSE3]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000559class S3DI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000560 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000561 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, XD,
Michael Liaobbd10792012-08-30 16:54:46 +0000562 Requires<[UseSSE3]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000563class S3I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000564 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000565 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000566 Requires<[UseSSE3]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000567
568
Nate Begeman8ef50212008-02-12 22:51:28 +0000569// SSSE3 Instruction Templates:
570//
571// SS38I - SSSE3 instructions with T8 prefix.
572// SS3AI - SSSE3 instructions with TA prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000573// MMXSS38I - SSSE3 instructions with T8 prefix and MMX operands.
574// MMXSS3AI - SSSE3 instructions with TA prefix and MMX operands.
Nate Begeman8ef50212008-02-12 22:51:28 +0000575//
576// Note: SSSE3 instructions have 64-bit and 128-bit versions. The 64-bit version
Craig Topper744f6312012-01-09 00:11:29 +0000577// uses the MMX registers. The 64-bit versions are grouped with the MMX
578// classes. They need to be enabled even if AVX is enabled.
Nate Begeman8ef50212008-02-12 22:51:28 +0000579
580class SS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000581 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000582 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000583 Requires<[UseSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000584class SS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000585 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000586 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000587 Requires<[UseSSSE3]>;
588class MMXSS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000589 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000590 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8,
591 Requires<[HasSSSE3]>;
592class MMXSS3AI<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>
Michael Liaobbd10792012-08-30 16:54:46 +0000594 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TA,
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000595 Requires<[HasSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000596
597// SSE4.1 Instruction Templates:
598//
599// SS48I - SSE 4.1 instructions with T8 prefix.
Evan Cheng96bdbd62008-03-14 07:39:27 +0000600// SS41AIi8 - SSE 4.1 instructions with TA prefix and ImmT == Imm8.
Nate Begeman8ef50212008-02-12 22:51:28 +0000601//
602class SS48I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000603 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000604 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000605 Requires<[UseSSE41]>;
Evan Cheng96bdbd62008-03-14 07:39:27 +0000606class SS4AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000607 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000608 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000609 Requires<[UseSSE41]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000610
Nate Begeman55b7bec2008-07-17 16:51:19 +0000611// SSE4.2 Instruction Templates:
612//
613// SS428I - SSE 4.2 instructions with T8 prefix.
614class SS428I<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<[UseSSE42]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000618
Craig Topper96fa5972011-10-16 16:50:08 +0000619// SS42FI - SSE 4.2 instructions with T8XD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000620// NOTE: 'HasSSE42' is used as SS42FI is only used for CRC32 insns.
Eric Christopher7dfa9f22009-08-08 21:55:08 +0000621class SS42FI<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>, T8XD, Requires<[HasSSE42]>;
Craig Topperb9109842012-01-01 19:51:58 +0000624
Eric Christopher9fe912d2009-08-18 22:50:32 +0000625// SS42AI = SSE 4.2 instructions with TA prefix
626class SS42AI<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 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000629 Requires<[UseSSE42]>;
Eric Christopher9fe912d2009-08-18 22:50:32 +0000630
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000631// AVX Instruction Templates:
632// Instructions introduced in AVX (no SSE equivalent forms)
633//
Craig Topperae11aed2014-01-14 07:41:20 +0000634// AVX8I - AVX instructions with T8PD prefix.
635// AVXAIi8 - AVX instructions with TAPD prefix and ImmT = Imm8.
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000636class AVX8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000637 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000638 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000639 Requires<[HasAVX]>;
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000640class AVXAIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000641 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000642 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000643 Requires<[HasAVX]>;
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000644
Craig Topper05d1cb92011-11-06 06:12:20 +0000645// AVX2 Instruction Templates:
646// Instructions introduced in AVX2 (no SSE equivalent forms)
647//
Craig Topperae11aed2014-01-14 07:41:20 +0000648// AVX28I - AVX2 instructions with T8PD prefix.
649// AVX2AIi8 - AVX2 instructions with TAPD prefix and ImmT = Imm8.
Craig Topper05d1cb92011-11-06 06:12:20 +0000650class AVX28I<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 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000653 Requires<[HasAVX2]>;
Craig Topperf01f1b52011-11-06 23:04:08 +0000654class AVX2AIi8<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 Topperae11aed2014-01-14 07:41:20 +0000656 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000657 Requires<[HasAVX2]>;
658
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000659
660// AVX-512 Instruction Templates:
661// Instructions introduced in AVX-512 (no SSE equivalent forms)
662//
Craig Topperae11aed2014-01-14 07:41:20 +0000663// AVX5128I - AVX-512 instructions with T8PD prefix.
664// AVX512AIi8 - AVX-512 instructions with TAPD prefix and ImmT = Imm8.
665// AVX512PDI - AVX-512 instructions with PD, double packed.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000666// AVX512PSI - AVX-512 instructions with TB, single packed.
667// AVX512XS8I - AVX-512 instructions with T8 and XS prefixes.
668// AVX512XSI - AVX-512 instructions with XS prefix, generic domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000669// AVX512BI - AVX-512 instructions with PD, int packed domain.
670// AVX512SI - AVX-512 scalar instructions with PD prefix.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000671
672class AVX5128I<bits<8> o, Format F, dag outs, dag ins, string asm,
673 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000674 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000675 Requires<[HasAVX512]>;
676class AVX512XS8I<bits<8> o, Format F, dag outs, dag ins, string asm,
677 list<dag> pattern, InstrItinClass itin = NoItinerary>
678 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8XS,
679 Requires<[HasAVX512]>;
680class AVX512XSI<bits<8> o, Format F, dag outs, dag ins, string asm,
681 list<dag> pattern, InstrItinClass itin = NoItinerary>
682 : I<o, F, outs, ins, asm, pattern, itin>, XS,
683 Requires<[HasAVX512]>;
684class AVX512XDI<bits<8> o, Format F, dag outs, dag ins, string asm,
685 list<dag> pattern, InstrItinClass itin = NoItinerary>
686 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, XD,
687 Requires<[HasAVX512]>;
688class AVX512BI<bits<8> o, Format F, dag outs, dag ins, string asm,
689 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000690 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000691 Requires<[HasAVX512]>;
692class AVX512BIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
693 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000694 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000695 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000696class AVX512AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
697 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000698 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000699 Requires<[HasAVX512]>;
700class AVX512Ii8<bits<8> o, Format F, dag outs, dag ins, string asm,
701 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000702 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>,
Craig Topperae11aed2014-01-14 07:41:20 +0000703 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000704class AVX512PDI<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 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
707 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000708class AVX512PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
709 list<dag> pattern, InstrItinClass itin = NoItinerary>
710 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, TB,
711 Requires<[HasAVX512]>;
712class AVX512PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
713 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000714 : Ii8<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000715class AVX512PI<bits<8> o, Format F, dag outs, dag ins, string asm,
716 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000717 : I<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000718class AVX512FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
719 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000720 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
721 EVEX_4V, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000722
Eric Christopher2ef63182010-04-02 21:54:27 +0000723// AES Instruction Templates:
724//
725// AES8I
Eric Christopher1290fa02010-04-05 21:14:32 +0000726// These use the same encoding as the SSE4.2 T8 and TA encodings.
Eric Christopher2ef63182010-04-02 21:54:27 +0000727class AES8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Preston Gurd3fe264d2013-09-13 19:23:28 +0000728 list<dag>pattern, InstrItinClass itin = IIC_AES>
Craig Topperae11aed2014-01-14 07:41:20 +0000729 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topperc0cef322012-05-01 05:35:02 +0000730 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000731
732class AESAI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000733 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000734 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topperc0cef322012-05-01 05:35:02 +0000735 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000736
Benjamin Kramera0396e42012-05-31 14:34:17 +0000737// PCLMUL Instruction Templates
738class PCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000739 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000740 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
741 Requires<[HasPCLMUL]>;
Eli Friedman415412e2011-07-05 18:21:20 +0000742
Benjamin Kramera0396e42012-05-31 14:34:17 +0000743class AVXPCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000744 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000745 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
746 VEX_4V, Requires<[HasAVX, HasPCLMUL]>;
Bruno Cardoso Lopesea0e05a2010-07-23 18:41:12 +0000747
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000748// FMA3 Instruction Templates
749class FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000750 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000751 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
752 VEX_4V, FMASC, Requires<[HasFMA]>;
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000753
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000754// FMA4 Instruction Templates
755class FMA4<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>, TAPD,
758 VEX_4V, VEX_I8IMM, FMASC, Requires<[HasFMA4]>;
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000759
Jan Sjödin7c0face2011-12-12 19:37:49 +0000760// XOP 2, 3 and 4 Operand Instruction Template
761class IXOP<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000763 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Jan Sjödin7c0face2011-12-12 19:37:49 +0000764 XOP, XOP9, Requires<[HasXOP]>;
765
766// XOP 2, 3 and 4 Operand Instruction Templates with imm byte
767class IXOPi8<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000769 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Jan Sjödin7c0face2011-12-12 19:37:49 +0000770 XOP, XOP8, Requires<[HasXOP]>;
771
772// XOP 5 operand instruction (VEX encoding!)
773class IXOP5<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000775 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
776 VEX_4V, VEX_I8IMM, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000777
Evan Cheng12c6be82007-07-31 08:04:03 +0000778// X86-64 Instruction templates...
779//
780
Andrew Trick8523b162012-02-01 23:20:51 +0000781class RI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000782 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000783 : I<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000784class RIi8 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000785 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000786 : Ii8<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse4e033b02014-01-13 14:05:59 +0000787class RIi16 <bits<8> o, Format F, dag outs, dag ins, string asm,
788 list<dag> pattern, InstrItinClass itin = NoItinerary>
789 : Ii16<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000790class RIi32 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000791 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000792 : Ii32<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse0b6c9492014-01-30 22:20:41 +0000793class RIi32S <bits<8> o, Format F, dag outs, dag ins, string asm,
794 list<dag> pattern, InstrItinClass itin = NoItinerary>
795 : Ii32S<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000796
797class RIi64<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000798 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000799 : X86Inst<o, f, Imm64, outs, ins, asm, itin>, REX_W {
Evan Cheng12c6be82007-07-31 08:04:03 +0000800 let Pattern = pattern;
801 let CodeSize = 3;
802}
803
Kevin Enderby285da022013-07-22 21:25:31 +0000804class RIi64_NOREX<bits<8> o, Format f, dag outs, dag ins, string asm,
805 list<dag> pattern, InstrItinClass itin = NoItinerary>
806 : X86Inst<o, f, Imm64, outs, ins, asm, itin> {
807 let Pattern = pattern;
808 let CodeSize = 3;
809}
810
Evan Cheng12c6be82007-07-31 08:04:03 +0000811class RSSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000812 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000813 : SSI<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000814class RSDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000815 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000816 : SDI<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000817class RPDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000818 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000819 : PDI<o, F, outs, ins, asm, pattern, itin>, REX_W;
Bruno Cardoso Lopes123dff02011-07-25 23:05:25 +0000820class VRPDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000821 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000822 : VPDI<o, F, outs, ins, asm, pattern, itin>, VEX_W;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000823class RS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
824 list<dag> pattern, InstrItinClass itin = NoItinerary>
825 : S2I<o, F, outs, ins, asm, pattern, itin>, REX_W;
826class VRS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
827 list<dag> pattern, InstrItinClass itin = NoItinerary>
828 : VS2I<o, F, outs, ins, asm, pattern, itin>, VEX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000829
830// MMX Instruction templates
831//
832
833// MMXI - MMX instructions with TB prefix.
Craig Topperbc749db2013-10-09 02:18:34 +0000834// MMXI32 - MMX instructions with TB prefix valid only in 32 bit mode.
Anton Korobeynikov31099512008-08-23 15:53:19 +0000835// MMXI64 - MMX instructions with TB prefix valid only in 64 bit mode.
Craig Topperae11aed2014-01-14 07:41:20 +0000836// MMX2I - MMX / SSE2 instructions with PD prefix.
Evan Cheng12c6be82007-07-31 08:04:03 +0000837// MMXIi8 - MMX instructions with ImmT == Imm8 and TB prefix.
838// MMXIi8 - MMX instructions with ImmT == Imm8 and TB prefix.
839// MMXID - MMX instructions with XD prefix.
840// MMXIS - MMX instructions with XS prefix.
Sean Callanan04d8cb72009-12-18 00:01:26 +0000841class MMXI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000842 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000843 : I<o, F, outs, ins, asm, pattern, itin>, TB, Requires<[HasMMX]>;
Craig Topperbc749db2013-10-09 02:18:34 +0000844class MMXI32<bits<8> o, Format F, dag outs, dag ins, string asm,
845 list<dag> pattern, InstrItinClass itin = NoItinerary>
Eric Christopherc0a5aae2013-12-20 02:04:49 +0000846 : I<o, F, outs, ins, asm, pattern, itin>, TB, Requires<[HasMMX,Not64BitMode]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000847class MMXI64<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000848 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000849 : I<o, F, outs, ins, asm, pattern, itin>, TB, Requires<[HasMMX,In64BitMode]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000850class MMXRI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000851 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000852 : I<o, F, outs, ins, asm, pattern, itin>, TB, REX_W, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000853class MMX2I<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000855 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000856class MMXIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000857 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000858 : Ii8<o, F, outs, ins, asm, pattern, itin>, TB, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000859class MMXID<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 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000862class MMXIS<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 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[HasMMX]>;