blob: a834438ffcc3bc505a5b963e1e53edc947ea4a50 [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
Craig Topperfa6298a2014-02-02 09:25:09 +0000155// Operand size for encodings that change based on mode.
156class OperandSize<bits<2> val> {
157 bits<2> Value = val;
158}
159def OpSizeFixed : OperandSize<0>; // Never needs a 0x66 prefix.
160def OpSize16 : OperandSize<1>; // Needs 0x66 prefix in 32-bit mode.
161def OpSize32 : OperandSize<2>; // Needs 0x66 prefix in 16-bit mode.
162
Evan Cheng12c6be82007-07-31 08:04:03 +0000163// Prefix byte classes which are used to indicate to the ad-hoc machine code
164// emitter that various prefix bytes are required.
Craig Topperfa6298a2014-02-02 09:25:09 +0000165class OpSize16 { OperandSize OpSize = OpSize16; }
166class OpSize32 { OperandSize OpSize = OpSize32; }
Evan Cheng12c6be82007-07-31 08:04:03 +0000167class AdSize { bit hasAdSizePrefix = 1; }
168class REX_W { bit hasREX_WPrefix = 1; }
Andrew Lenharth0070dd12008-03-01 13:37:02 +0000169class LOCK { bit hasLockPrefix = 1; }
Craig Topperec688662014-01-31 07:00:55 +0000170class REP { bit hasREPPrefix = 1; }
Craig Topperda7160d2014-02-01 08:17:56 +0000171class TB { Map OpMap = TB; }
Craig Topper10243c82014-01-31 08:47:06 +0000172class D8 { Map OpMap = D8; }
173class D9 { Map OpMap = D9; }
174class DA { Map OpMap = DA; }
175class DB { Map OpMap = DB; }
176class DC { Map OpMap = DC; }
177class DD { Map OpMap = DD; }
178class DE { Map OpMap = DE; }
179class DF { Map OpMap = DF; }
Craig Topper10243c82014-01-31 08:47:06 +0000180class T8 { Map OpMap = T8; }
181class TA { Map OpMap = TA; }
182class A6 { Map OpMap = A6; }
183class A7 { Map OpMap = A7; }
Craig Topper10243c82014-01-31 08:47:06 +0000184class XOP8 { Map OpMap = XOP8; }
185class XOP9 { Map OpMap = XOP9; }
186class XOPA { Map OpMap = XOPA; }
Craig Topperda7160d2014-02-01 08:17:56 +0000187class PD : TB { Prefix OpPrefix = PD; }
188class XD : TB { Prefix OpPrefix = XD; }
189class XS : TB { Prefix OpPrefix = XS; }
190class T8PD : T8 { Prefix OpPrefix = PD; }
191class T8XD : T8 { Prefix OpPrefix = XD; }
192class T8XS : T8 { Prefix OpPrefix = XS; }
193class TAPD : TA { Prefix OpPrefix = PD; }
194class TAXD : TA { Prefix OpPrefix = XD; }
Craig Topperd402df32014-02-02 07:08:01 +0000195class VEX { Encoding OpEnc = EncVEX; }
Bruno Cardoso Lopes05166742010-07-01 01:20:06 +0000196class VEX_W { bit hasVEX_WPrefix = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000197class VEX_4V : VEX { bit hasVEX_4V = 1; }
198class VEX_4VOp3 : VEX { bit hasVEX_4VOp3 = 1; }
Bruno Cardoso Lopese2bd0582010-07-06 22:36:24 +0000199class VEX_I8IMM { bit hasVEX_i8ImmReg = 1; }
Bruno Cardoso Lopesfd8bfcd2010-07-13 21:07:28 +0000200class VEX_L { bit hasVEX_L = 1; }
Craig Topperf18c8962011-10-04 06:30:42 +0000201class VEX_LIG { bit ignoresVEX_L = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000202class EVEX : VEX { Encoding OpEnc = EncEVEX; }
203class EVEX_4V : VEX_4V { Encoding OpEnc = EncEVEX; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000204class EVEX_K { bit hasEVEX_K = 1; }
205class EVEX_KZ : EVEX_K { bit hasEVEX_Z = 1; }
206class EVEX_B { bit hasEVEX_B = 1; }
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000207class EVEX_RC { bit hasEVEX_RC = 1; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000208class EVEX_V512 { bit hasEVEX_L2 = 1; bit hasVEX_L = 0; }
209class EVEX_CD8<int esize, CD8VForm form> {
210 bits<2> EVEX_CD8E = !if(!eq(esize, 8), 0b00,
211 !if(!eq(esize, 16), 0b01,
212 !if(!eq(esize, 32), 0b10,
213 !if(!eq(esize, 64), 0b11, ?))));
214 bits<3> EVEX_CD8V = form.Value;
215}
Chris Lattner45270db2010-10-03 18:08:05 +0000216class Has3DNow0F0FOpcode { bit has3DNow0F0FOpcode = 1; }
Craig Toppercd93de92011-12-30 04:48:54 +0000217class MemOp4 { bit hasMemOp4Prefix = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000218class XOP { Encoding OpEnc = EncXOP; }
219class XOP_4V : XOP { bit hasVEX_4V = 1; }
220class XOP_4VOp3 : XOP { bit hasVEX_4VOp3 = 1; }
221
Evan Cheng12c6be82007-07-31 08:04:03 +0000222class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
Andrew Trick8523b162012-02-01 23:20:51 +0000223 string AsmStr,
224 InstrItinClass itin,
225 Domain d = GenericDomain>
Evan Cheng12c6be82007-07-31 08:04:03 +0000226 : Instruction {
227 let Namespace = "X86";
228
229 bits<8> Opcode = opcod;
230 Format Form = f;
231 bits<6> FormBits = Form.Value;
232 ImmType ImmT = i;
Evan Cheng12c6be82007-07-31 08:04:03 +0000233
234 dag OutOperandList = outs;
235 dag InOperandList = ins;
236 string AsmString = AsmStr;
237
Chris Lattner7ff33462010-10-31 19:22:57 +0000238 // If this is a pseudo instruction, mark it isCodeGenOnly.
239 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
240
Andrew Trick8523b162012-02-01 23:20:51 +0000241 let Itinerary = itin;
242
Evan Cheng12c6be82007-07-31 08:04:03 +0000243 //
244 // Attributes specific to X86 instructions...
245 //
Craig Topper3484fc22014-01-05 04:17:28 +0000246 bit ForceDisassemble = 0; // Force instruction to disassemble even though it's
247 // isCodeGenonly. Needed to hide an ambiguous
248 // AsmString from the parser, but still disassemble.
249
Craig Topperfa6298a2014-02-02 09:25:09 +0000250 OperandSize OpSize = OpSizeFixed; // Does this instruction's encoding change
251 // based on operand size of the mode
Evan Cheng12c6be82007-07-31 08:04:03 +0000252 bit hasAdSizePrefix = 0; // Does this inst have a 0x67 prefix?
253
Craig Topper10243c82014-01-31 08:47:06 +0000254 Prefix OpPrefix = NoPrfx; // Which prefix byte does this inst have?
255 Map OpMap = OB; // Which opcode map does this inst have?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000256 bit hasREX_WPrefix = 0; // Does this inst require the REX.W prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000257 FPFormat FPForm = NotFP; // What flavor of FP instruction is this?
Dan Gohmana21bdda2008-08-20 13:46:21 +0000258 bit hasLockPrefix = 0; // Does this inst have a 0xF0 prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000259 Domain ExeDomain = d;
Craig Topperec688662014-01-31 07:00:55 +0000260 bit hasREPPrefix = 0; // Does this inst have a REP prefix?
Craig Topperd402df32014-02-02 07:08:01 +0000261 Encoding OpEnc = EncNormal; // Encoding used by this instruction
Bruno Cardoso Lopes05166742010-07-01 01:20:06 +0000262 bit hasVEX_WPrefix = 0; // Does this inst set the VEX_W field?
Craig Topperd402df32014-02-02 07:08:01 +0000263 bit hasVEX_4V = 0; // Does this inst require the VEX.VVVV field?
264 bit hasVEX_4VOp3 = 0; // Does this inst require the VEX.VVVV field to
265 // encode the third operand?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000266 bit hasVEX_i8ImmReg = 0; // Does this inst require the last source register
Bruno Cardoso Lopese2bd0582010-07-06 22:36:24 +0000267 // to be encoded in a immediate field?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000268 bit hasVEX_L = 0; // Does this inst use large (256-bit) registers?
Craig Topperf18c8962011-10-04 06:30:42 +0000269 bit ignoresVEX_L = 0; // Does this instruction ignore the L-bit
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000270 bit hasEVEX_K = 0; // Does this inst require masking?
271 bit hasEVEX_Z = 0; // Does this inst set the EVEX_Z field?
272 bit hasEVEX_L2 = 0; // Does this inst set the EVEX_L2 field?
273 bit hasEVEX_B = 0; // Does this inst set the EVEX_B field?
274 bits<2> EVEX_CD8E = 0; // Compressed disp8 form - element-size.
275 bits<3> EVEX_CD8V = 0; // Compressed disp8 form - vector-width.
Chris Lattner45270db2010-10-03 18:08:05 +0000276 bit has3DNow0F0FOpcode =0;// Wacky 3dNow! encoding?
Craig Toppercd93de92011-12-30 04:48:54 +0000277 bit hasMemOp4Prefix = 0; // Same bit as VEX_W, but used for swapping operands
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000278 bit hasEVEX_RC = 0; // Explicitly specified rounding control in FP instruction.
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000279
280 // TSFlags layout should be kept in sync with X86InstrInfo.h.
281 let TSFlags{5-0} = FormBits;
Craig Topperfa6298a2014-02-02 09:25:09 +0000282 let TSFlags{7-6} = OpSize.Value;
Craig Topper7ceb54a2014-01-06 06:02:58 +0000283 let TSFlags{8} = hasAdSizePrefix;
Craig Topper10243c82014-01-31 08:47:06 +0000284 let TSFlags{10-9} = OpPrefix.Value;
285 let TSFlags{15-11} = OpMap.Value;
286 let TSFlags{16} = hasREX_WPrefix;
287 let TSFlags{20-17} = ImmT.Value;
288 let TSFlags{23-21} = FPForm.Value;
289 let TSFlags{24} = hasLockPrefix;
290 let TSFlags{25} = hasREPPrefix;
291 let TSFlags{27-26} = ExeDomain.Value;
Craig Topperd402df32014-02-02 07:08:01 +0000292 let TSFlags{29-28} = OpEnc.Value;
293 let TSFlags{37-30} = Opcode;
294 let TSFlags{38} = hasVEX_WPrefix;
295 let TSFlags{39} = hasVEX_4V;
296 let TSFlags{40} = hasVEX_4VOp3;
297 let TSFlags{41} = hasVEX_i8ImmReg;
298 let TSFlags{42} = hasVEX_L;
299 let TSFlags{43} = ignoresVEX_L;
Craig Topper10243c82014-01-31 08:47:06 +0000300 let TSFlags{44} = hasEVEX_K;
301 let TSFlags{45} = hasEVEX_Z;
302 let TSFlags{46} = hasEVEX_L2;
303 let TSFlags{47} = hasEVEX_B;
304 let TSFlags{49-48} = EVEX_CD8E;
305 let TSFlags{52-50} = EVEX_CD8V;
306 let TSFlags{53} = has3DNow0F0FOpcode;
307 let TSFlags{54} = hasMemOp4Prefix;
Craig Topperd402df32014-02-02 07:08:01 +0000308 let TSFlags{55} = hasEVEX_RC;
Evan Cheng12c6be82007-07-31 08:04:03 +0000309}
310
Eric Christopheref62f572010-11-30 08:57:23 +0000311class PseudoI<dag oops, dag iops, list<dag> pattern>
Andrew Trick8523b162012-02-01 23:20:51 +0000312 : X86Inst<0, Pseudo, NoImm, oops, iops, "", NoItinerary> {
Eric Christopheref62f572010-11-30 08:57:23 +0000313 let Pattern = pattern;
314}
315
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000316class I<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, NoImm, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000320 let Pattern = pattern;
321 let CodeSize = 3;
322}
Sean Callanan04d8cb72009-12-18 00:01:26 +0000323class Ii8 <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 Domain d = GenericDomain>
326 : X86Inst<o, f, Imm8, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000327 let Pattern = pattern;
328 let CodeSize = 3;
329}
Chris Lattner12455ca2010-02-12 22:27:07 +0000330class Ii8PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000331 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000332 : X86Inst<o, f, Imm8PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000333 let Pattern = pattern;
334 let CodeSize = 3;
335}
Sean Callanan04d8cb72009-12-18 00:01:26 +0000336class Ii16<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000337 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000338 : X86Inst<o, f, Imm16, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000339 let Pattern = pattern;
340 let CodeSize = 3;
341}
Sean Callanan04d8cb72009-12-18 00:01:26 +0000342class Ii32<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000343 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000344 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000345 let Pattern = pattern;
346 let CodeSize = 3;
347}
David Woodhouse0b6c9492014-01-30 22:20:41 +0000348class Ii32S<bits<8> o, Format f, dag outs, dag ins, string asm,
349 list<dag> pattern, InstrItinClass itin = NoItinerary>
350 : X86Inst<o, f, Imm32S, outs, ins, asm, itin> {
351 let Pattern = pattern;
352 let CodeSize = 3;
353}
Evan Cheng12c6be82007-07-31 08:04:03 +0000354
Chris Lattnerac588122010-07-07 22:27:31 +0000355class Ii16PCRel<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, Imm16PCRel, outs, ins, asm, itin> {
Chris Lattnerac588122010-07-07 22:27:31 +0000358 let Pattern = pattern;
359 let CodeSize = 3;
360}
361
Chris Lattner12455ca2010-02-12 22:27:07 +0000362class Ii32PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000363 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000364 : X86Inst<o, f, Imm32PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000365 let Pattern = pattern;
366 let CodeSize = 3;
367}
368
Evan Cheng12c6be82007-07-31 08:04:03 +0000369// FPStack Instruction Templates:
370// FPI - Floating Point Instruction template.
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000371class FPI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000372 InstrItinClass itin = NoItinerary>
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000373 : I<o, F, outs, ins, asm, [], itin> {}
Evan Cheng12c6be82007-07-31 08:04:03 +0000374
Bob Wilsona967c422010-08-26 18:08:11 +0000375// FpI_ - Floating Point Pseudo Instruction template. Not Predicated.
Andrew Trick8523b162012-02-01 23:20:51 +0000376class FpI_<dag outs, dag ins, FPFormat fp, list<dag> pattern,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000377 InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000378 : X86Inst<0, Pseudo, NoImm, outs, ins, "", itin> {
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000379 let FPForm = fp;
Evan Cheng12c6be82007-07-31 08:04:03 +0000380 let Pattern = pattern;
381}
382
Sean Callanan050e0cd2009-09-15 00:35:17 +0000383// Templates for instructions that use a 16- or 32-bit segmented address as
384// their only operand: lcall (FAR CALL) and ljmp (FAR JMP)
385//
386// Iseg16 - 16-bit segment selector, 16-bit offset
387// Iseg32 - 16-bit segment selector, 32-bit offset
388
389class Iseg16 <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, Imm16, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000392 let Pattern = pattern;
393 let CodeSize = 3;
394}
395
396class Iseg32 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000397 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000398 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000399 let Pattern = pattern;
400 let CodeSize = 3;
401}
402
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000403// SI - SSE 1 & 2 scalar instructions
Andrew Trick8523b162012-02-01 23:20:51 +0000404class SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000405 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000406 : I<o, F, outs, ins, asm, pattern, itin> {
Craig Topperd402df32014-02-02 07:08:01 +0000407 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
408 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX],
409 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
410 !if(!eq(OpPrefix.Value, XD.Value), [UseSSE2],
411 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000412 [UseSSE1])))));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000413
414 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000415 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
416 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
417 asm));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000418}
419
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000420// SIi8 - SSE 1 & 2 scalar instructions
421class SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000422 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000423 : Ii8<o, F, outs, ins, asm, pattern, itin> {
Craig Topperd402df32014-02-02 07:08:01 +0000424 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
425 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX],
426 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
Craig Topper10243c82014-01-31 08:47:06 +0000427 [UseSSE2])));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000428
429 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000430 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
431 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
432 asm));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000433}
434
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000435// PI - SSE 1 & 2 packed instructions
436class PI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
Andrew Trick8523b162012-02-01 23:20:51 +0000437 InstrItinClass itin, Domain d>
438 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000439 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
440 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
441 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000442 [UseSSE1])));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000443
444 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000445 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
446 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
447 asm));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000448}
449
Michael Liaobbd10792012-08-30 16:54:46 +0000450// MMXPI - SSE 1 & 2 packed instructions with MMX operands
451class MMXPI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
452 InstrItinClass itin, Domain d>
453 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000454 let Predicates = !if(!eq(OpPrefix.Value, PD.Value), [HasSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000455 [HasSSE1]);
Michael Liaobbd10792012-08-30 16:54:46 +0000456}
457
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000458// PIi8 - SSE 1 & 2 packed instructions with immediate
459class PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Andrew Trick8523b162012-02-01 23:20:51 +0000460 list<dag> pattern, InstrItinClass itin, Domain d>
461 : Ii8<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000462 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
463 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
464 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000465 [UseSSE1])));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000466
467 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000468 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
469 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
470 asm));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000471}
472
Evan Cheng12c6be82007-07-31 08:04:03 +0000473// SSE1 Instruction Templates:
474//
475// SSI - SSE1 instructions with XS prefix.
476// PSI - SSE1 instructions with TB prefix.
477// PSIi8 - SSE1 instructions with ImmT == Imm8 and TB prefix.
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000478// VSSI - SSE1 instructions with XS prefix in AVX form.
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000479// VPSI - SSE1 instructions with TB prefix in AVX form, packed single.
Evan Cheng12c6be82007-07-31 08:04:03 +0000480
Andrew Trick8523b162012-02-01 23:20:51 +0000481class SSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000482 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000483 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000484class SSIi8<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>
Michael Liaobbd10792012-08-30 16:54:46 +0000486 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000487class PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000488 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000489 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, TB,
Michael Liaobbd10792012-08-30 16:54:46 +0000490 Requires<[UseSSE1]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000491class PSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000492 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000493 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, TB,
Michael Liaobbd10792012-08-30 16:54:46 +0000494 Requires<[UseSSE1]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000495class VSSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000496 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000497 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000498 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000499class VPSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000500 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000501 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin, SSEPackedSingle>, TB,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000502 Requires<[HasAVX]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000503
504// SSE2 Instruction Templates:
505//
Bill Wendling76105a42008-08-27 21:32:04 +0000506// SDI - SSE2 instructions with XD prefix.
507// SDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix.
Craig Topperf881d382012-07-30 02:14:02 +0000508// S2SI - SSE2 instructions with XS prefix.
Bill Wendling76105a42008-08-27 21:32:04 +0000509// SSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix.
Craig Topperae11aed2014-01-14 07:41:20 +0000510// PDI - SSE2 instructions with PD prefix, packed double domain.
511// PDIi8 - SSE2 instructions with ImmT == Imm8 and PD prefix.
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000512// VSDI - SSE2 scalar instructions with XD prefix in AVX form.
Craig Topperae11aed2014-01-14 07:41:20 +0000513// VPDI - SSE2 vector instructions with PD prefix in AVX form,
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000514// packed double domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000515// VS2I - SSE2 scalar instructions with PD prefix in AVX form.
516// S2I - SSE2 scalar instructions with PD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000517// MMXSDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix as well as
518// MMX operands.
519// MMXSSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix as well as
520// MMX operands.
Evan Cheng12c6be82007-07-31 08:04:03 +0000521
Andrew Trick8523b162012-02-01 23:20:51 +0000522class SDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000523 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000524 : I<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Evan Cheng01c7c192007-12-20 19:57:09 +0000525class SDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000526 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000527 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000528class S2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000529 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000530 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000531class S2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000532 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000533 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE2]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000534class PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000535 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000536 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000537 Requires<[UseSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000538class PDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000539 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000540 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000541 Requires<[UseSSE2]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000542class VSDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000543 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000544 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XD,
Elena Demikhovsky3ce8dbb2013-08-18 13:08:57 +0000545 Requires<[UseAVX]>;
Craig Topperf881d382012-07-30 02:14:02 +0000546class VS2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000547 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperf881d382012-07-30 02:14:02 +0000548 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
549 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000550class VPDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000551 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000552 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin, SSEPackedDouble>,
553 PD, Requires<[HasAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000554class VS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
555 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000556 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, PD,
557 Requires<[UseAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000558class S2I<bits<8> o, Format F, dag outs, dag ins, string asm,
559 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000560 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[UseSSE2]>;
Michael Liaobbd10792012-08-30 16:54:46 +0000561class MMXSDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000562 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000563 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasSSE2]>;
564class MMXS2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000565 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000566 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[HasSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000567
568// SSE3 Instruction Templates:
569//
Craig Topperae11aed2014-01-14 07:41:20 +0000570// S3I - SSE3 instructions with PD prefixes.
Evan Cheng12c6be82007-07-31 08:04:03 +0000571// S3SI - SSE3 instructions with XS prefix.
572// S3DI - SSE3 instructions with XD prefix.
573
Sean Callanan04d8cb72009-12-18 00:01:26 +0000574class S3SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000575 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000576 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, XS,
Michael Liaobbd10792012-08-30 16:54:46 +0000577 Requires<[UseSSE3]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000578class S3DI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000579 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000580 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, XD,
Michael Liaobbd10792012-08-30 16:54:46 +0000581 Requires<[UseSSE3]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000582class S3I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000583 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000584 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000585 Requires<[UseSSE3]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000586
587
Nate Begeman8ef50212008-02-12 22:51:28 +0000588// SSSE3 Instruction Templates:
589//
590// SS38I - SSSE3 instructions with T8 prefix.
591// SS3AI - SSSE3 instructions with TA prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000592// MMXSS38I - SSSE3 instructions with T8 prefix and MMX operands.
593// MMXSS3AI - SSSE3 instructions with TA prefix and MMX operands.
Nate Begeman8ef50212008-02-12 22:51:28 +0000594//
595// Note: SSSE3 instructions have 64-bit and 128-bit versions. The 64-bit version
Craig Topper744f6312012-01-09 00:11:29 +0000596// uses the MMX registers. The 64-bit versions are grouped with the MMX
597// classes. They need to be enabled even if AVX is enabled.
Nate Begeman8ef50212008-02-12 22:51:28 +0000598
599class SS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000600 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000601 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000602 Requires<[UseSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000603class SS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000604 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000605 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000606 Requires<[UseSSSE3]>;
607class MMXSS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000608 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000609 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8,
610 Requires<[HasSSSE3]>;
611class MMXSS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000612 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000613 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TA,
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000614 Requires<[HasSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000615
616// SSE4.1 Instruction Templates:
617//
618// SS48I - SSE 4.1 instructions with T8 prefix.
Evan Cheng96bdbd62008-03-14 07:39:27 +0000619// SS41AIi8 - SSE 4.1 instructions with TA prefix and ImmT == Imm8.
Nate Begeman8ef50212008-02-12 22:51:28 +0000620//
621class SS48I<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000623 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000624 Requires<[UseSSE41]>;
Evan Cheng96bdbd62008-03-14 07:39:27 +0000625class SS4AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000626 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000627 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000628 Requires<[UseSSE41]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000629
Nate Begeman55b7bec2008-07-17 16:51:19 +0000630// SSE4.2 Instruction Templates:
631//
632// SS428I - SSE 4.2 instructions with T8 prefix.
633class SS428I<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000635 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000636 Requires<[UseSSE42]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000637
Craig Topper96fa5972011-10-16 16:50:08 +0000638// SS42FI - SSE 4.2 instructions with T8XD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000639// NOTE: 'HasSSE42' is used as SS42FI is only used for CRC32 insns.
Eric Christopher7dfa9f22009-08-08 21:55:08 +0000640class SS42FI<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000642 : I<o, F, outs, ins, asm, pattern, itin>, T8XD, Requires<[HasSSE42]>;
Craig Topperb9109842012-01-01 19:51:58 +0000643
Eric Christopher9fe912d2009-08-18 22:50:32 +0000644// SS42AI = SSE 4.2 instructions with TA prefix
645class SS42AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000646 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000647 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000648 Requires<[UseSSE42]>;
Eric Christopher9fe912d2009-08-18 22:50:32 +0000649
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000650// AVX Instruction Templates:
651// Instructions introduced in AVX (no SSE equivalent forms)
652//
Craig Topperae11aed2014-01-14 07:41:20 +0000653// AVX8I - AVX instructions with T8PD prefix.
654// AVXAIi8 - AVX instructions with TAPD prefix and ImmT = Imm8.
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000655class AVX8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000656 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000657 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000658 Requires<[HasAVX]>;
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000659class AVXAIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000660 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000661 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000662 Requires<[HasAVX]>;
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000663
Craig Topper05d1cb92011-11-06 06:12:20 +0000664// AVX2 Instruction Templates:
665// Instructions introduced in AVX2 (no SSE equivalent forms)
666//
Craig Topperae11aed2014-01-14 07:41:20 +0000667// AVX28I - AVX2 instructions with T8PD prefix.
668// AVX2AIi8 - AVX2 instructions with TAPD prefix and ImmT = Imm8.
Craig Topper05d1cb92011-11-06 06:12:20 +0000669class AVX28I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000670 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000671 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000672 Requires<[HasAVX2]>;
Craig Topperf01f1b52011-11-06 23:04:08 +0000673class AVX2AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000674 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000675 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000676 Requires<[HasAVX2]>;
677
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000678
679// AVX-512 Instruction Templates:
680// Instructions introduced in AVX-512 (no SSE equivalent forms)
681//
Craig Topperae11aed2014-01-14 07:41:20 +0000682// AVX5128I - AVX-512 instructions with T8PD prefix.
683// AVX512AIi8 - AVX-512 instructions with TAPD prefix and ImmT = Imm8.
684// AVX512PDI - AVX-512 instructions with PD, double packed.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000685// AVX512PSI - AVX-512 instructions with TB, single packed.
686// AVX512XS8I - AVX-512 instructions with T8 and XS prefixes.
687// AVX512XSI - AVX-512 instructions with XS prefix, generic domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000688// AVX512BI - AVX-512 instructions with PD, int packed domain.
689// AVX512SI - AVX-512 scalar instructions with PD prefix.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000690
691class AVX5128I<bits<8> o, Format F, dag outs, dag ins, string asm,
692 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000693 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000694 Requires<[HasAVX512]>;
695class AVX512XS8I<bits<8> o, Format F, dag outs, dag ins, string asm,
696 list<dag> pattern, InstrItinClass itin = NoItinerary>
697 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8XS,
698 Requires<[HasAVX512]>;
699class AVX512XSI<bits<8> o, Format F, dag outs, dag ins, string asm,
700 list<dag> pattern, InstrItinClass itin = NoItinerary>
701 : I<o, F, outs, ins, asm, pattern, itin>, XS,
702 Requires<[HasAVX512]>;
703class AVX512XDI<bits<8> o, Format F, dag outs, dag ins, string asm,
704 list<dag> pattern, InstrItinClass itin = NoItinerary>
705 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, XD,
706 Requires<[HasAVX512]>;
707class AVX512BI<bits<8> o, Format F, dag outs, dag ins, string asm,
708 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000709 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000710 Requires<[HasAVX512]>;
711class AVX512BIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
712 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000713 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000714 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000715class AVX512AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
716 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000717 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000718 Requires<[HasAVX512]>;
719class AVX512Ii8<bits<8> o, Format F, dag outs, dag ins, string asm,
720 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000721 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>,
Craig Topperae11aed2014-01-14 07:41:20 +0000722 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000723class AVX512PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
724 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000725 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
726 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000727class AVX512PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
728 list<dag> pattern, InstrItinClass itin = NoItinerary>
729 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, TB,
730 Requires<[HasAVX512]>;
731class AVX512PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
732 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000733 : Ii8<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000734class AVX512PI<bits<8> o, Format F, dag outs, dag ins, string asm,
735 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000736 : I<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000737class AVX512FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
738 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000739 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
740 EVEX_4V, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000741
Eric Christopher2ef63182010-04-02 21:54:27 +0000742// AES Instruction Templates:
743//
744// AES8I
Eric Christopher1290fa02010-04-05 21:14:32 +0000745// These use the same encoding as the SSE4.2 T8 and TA encodings.
Eric Christopher2ef63182010-04-02 21:54:27 +0000746class AES8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Preston Gurd3fe264d2013-09-13 19:23:28 +0000747 list<dag>pattern, InstrItinClass itin = IIC_AES>
Craig Topperae11aed2014-01-14 07:41:20 +0000748 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topperc0cef322012-05-01 05:35:02 +0000749 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000750
751class AESAI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000752 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000753 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topperc0cef322012-05-01 05:35:02 +0000754 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000755
Benjamin Kramera0396e42012-05-31 14:34:17 +0000756// PCLMUL Instruction Templates
757class PCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000758 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000759 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
760 Requires<[HasPCLMUL]>;
Eli Friedman415412e2011-07-05 18:21:20 +0000761
Benjamin Kramera0396e42012-05-31 14:34:17 +0000762class AVXPCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000763 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000764 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
765 VEX_4V, Requires<[HasAVX, HasPCLMUL]>;
Bruno Cardoso Lopesea0e05a2010-07-23 18:41:12 +0000766
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000767// FMA3 Instruction Templates
768class FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000769 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000770 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
771 VEX_4V, FMASC, Requires<[HasFMA]>;
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000772
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000773// FMA4 Instruction Templates
774class FMA4<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000775 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000776 : Ii8<o, F, outs, ins, asm, pattern, itin>, TAPD,
777 VEX_4V, VEX_I8IMM, FMASC, Requires<[HasFMA4]>;
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000778
Jan Sjödin7c0face2011-12-12 19:37:49 +0000779// XOP 2, 3 and 4 Operand Instruction Template
780class IXOP<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000781 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000782 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Craig Topperd402df32014-02-02 07:08:01 +0000783 XOP9, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000784
785// XOP 2, 3 and 4 Operand Instruction Templates with imm byte
786class IXOPi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000787 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000788 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Craig Topperd402df32014-02-02 07:08:01 +0000789 XOP8, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000790
791// XOP 5 operand instruction (VEX encoding!)
792class IXOP5<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000793 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000794 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
795 VEX_4V, VEX_I8IMM, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000796
Evan Cheng12c6be82007-07-31 08:04:03 +0000797// X86-64 Instruction templates...
798//
799
Andrew Trick8523b162012-02-01 23:20:51 +0000800class RI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000801 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000802 : I<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000803class RIi8 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000804 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000805 : Ii8<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse4e033b02014-01-13 14:05:59 +0000806class RIi16 <bits<8> o, Format F, dag outs, dag ins, string asm,
807 list<dag> pattern, InstrItinClass itin = NoItinerary>
808 : Ii16<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000809class RIi32 <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 : Ii32<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse0b6c9492014-01-30 22:20:41 +0000812class RIi32S <bits<8> o, Format F, dag outs, dag ins, string asm,
813 list<dag> pattern, InstrItinClass itin = NoItinerary>
814 : Ii32S<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000815
816class RIi64<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000817 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000818 : X86Inst<o, f, Imm64, outs, ins, asm, itin>, REX_W {
Evan Cheng12c6be82007-07-31 08:04:03 +0000819 let Pattern = pattern;
820 let CodeSize = 3;
821}
822
Kevin Enderby285da022013-07-22 21:25:31 +0000823class RIi64_NOREX<bits<8> o, Format f, dag outs, dag ins, string asm,
824 list<dag> pattern, InstrItinClass itin = NoItinerary>
825 : X86Inst<o, f, Imm64, outs, ins, asm, itin> {
826 let Pattern = pattern;
827 let CodeSize = 3;
828}
829
Evan Cheng12c6be82007-07-31 08:04:03 +0000830class RSSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000831 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000832 : SSI<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000833class RSDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000834 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000835 : SDI<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000836class RPDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000837 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000838 : PDI<o, F, outs, ins, asm, pattern, itin>, REX_W;
Bruno Cardoso Lopes123dff02011-07-25 23:05:25 +0000839class VRPDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000840 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000841 : VPDI<o, F, outs, ins, asm, pattern, itin>, VEX_W;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000842class RS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
843 list<dag> pattern, InstrItinClass itin = NoItinerary>
844 : S2I<o, F, outs, ins, asm, pattern, itin>, REX_W;
845class VRS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
846 list<dag> pattern, InstrItinClass itin = NoItinerary>
847 : VS2I<o, F, outs, ins, asm, pattern, itin>, VEX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000848
849// MMX Instruction templates
850//
851
852// MMXI - MMX instructions with TB prefix.
Craig Topperbc749db2013-10-09 02:18:34 +0000853// MMXI32 - MMX instructions with TB prefix valid only in 32 bit mode.
Anton Korobeynikov31099512008-08-23 15:53:19 +0000854// MMXI64 - MMX instructions with TB prefix valid only in 64 bit mode.
Craig Topperae11aed2014-01-14 07:41:20 +0000855// MMX2I - MMX / SSE2 instructions with PD prefix.
Evan Cheng12c6be82007-07-31 08:04:03 +0000856// MMXIi8 - MMX instructions with ImmT == Imm8 and TB prefix.
857// MMXIi8 - MMX instructions with ImmT == Imm8 and TB prefix.
858// MMXID - MMX instructions with XD prefix.
859// MMXIS - MMX instructions with XS prefix.
Sean Callanan04d8cb72009-12-18 00:01:26 +0000860class MMXI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000861 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000862 : I<o, F, outs, ins, asm, pattern, itin>, TB, Requires<[HasMMX]>;
Craig Topperbc749db2013-10-09 02:18:34 +0000863class MMXI32<bits<8> o, Format F, dag outs, dag ins, string asm,
864 list<dag> pattern, InstrItinClass itin = NoItinerary>
Eric Christopherc0a5aae2013-12-20 02:04:49 +0000865 : I<o, F, outs, ins, asm, pattern, itin>, TB, Requires<[HasMMX,Not64BitMode]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000866class MMXI64<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000867 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000868 : I<o, F, outs, ins, asm, pattern, itin>, TB, Requires<[HasMMX,In64BitMode]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000869class MMXRI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000870 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000871 : I<o, F, outs, ins, asm, pattern, itin>, TB, REX_W, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000872class MMX2I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000873 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000874 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000875class MMXIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000876 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000877 : Ii8<o, F, outs, ins, asm, pattern, itin>, TB, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000878class MMXID<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000879 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000880 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000881class MMXIS<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000882 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000883 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[HasMMX]>;