blob: 3bbb9de387d74af55f34c1e2acafe503b001333f [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- X86InstrFormats.td - X86 Instruction Formats -------*- tablegen -*-===//
2//
Evan Cheng12c6be82007-07-31 08:04:03 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Jia Liub22310f2012-02-18 12:03:15 +00007//
Evan Cheng12c6be82007-07-31 08:04:03 +00008//===----------------------------------------------------------------------===//
9
10//===----------------------------------------------------------------------===//
11// X86 Instruction Format Definitions.
12//
13
14// Format specifies the encoding used by the instruction. This is part of the
15// ad-hoc solution used to emit machine instruction encodings by our machine
16// code emitter.
Craig Topper56f0ed812014-02-19 08:25:02 +000017class Format<bits<7> val> {
18 bits<7> Value = val;
Evan Cheng12c6be82007-07-31 08:04:03 +000019}
20
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>;
Craig Topper2fb696b2014-02-19 06:59:13 +000027def RawFrmImm8 : Format<11>;
28def RawFrmImm16 : Format<12>;
Craig Toppera0869dc2014-02-10 06:55:41 +000029def MRMXr : Format<14>; def MRMXm : Format<15>;
Evan Cheng12c6be82007-07-31 08:04:03 +000030def MRM0r : Format<16>; def MRM1r : Format<17>; def MRM2r : Format<18>;
31def MRM3r : Format<19>; def MRM4r : Format<20>; def MRM5r : Format<21>;
32def MRM6r : Format<22>; def MRM7r : Format<23>;
33def MRM0m : Format<24>; def MRM1m : Format<25>; def MRM2m : Format<26>;
34def MRM3m : Format<27>; def MRM4m : Format<28>; def MRM5m : Format<29>;
35def MRM6m : Format<30>; def MRM7m : Format<31>;
Craig Topper56f0ed812014-02-19 08:25:02 +000036def MRM_C0 : Format<32>; def MRM_C1 : Format<33>; def MRM_C2 : Format<34>;
37def MRM_C3 : Format<35>; def MRM_C4 : Format<36>; def MRM_C8 : Format<37>;
38def MRM_C9 : Format<38>; def MRM_CA : Format<39>; def MRM_CB : Format<40>;
Kevin Enderby0d928a12014-07-31 23:57:38 +000039def MRM_CF : Format<41>; def MRM_D0 : Format<42>; def MRM_D1 : Format<43>;
40def MRM_D4 : Format<44>; def MRM_D5 : Format<45>; def MRM_D6 : Format<46>;
41def MRM_D7 : Format<47>; def MRM_D8 : Format<48>; def MRM_D9 : Format<49>;
42def MRM_DA : Format<50>; def MRM_DB : Format<51>; def MRM_DC : Format<52>;
43def MRM_DD : Format<53>; def MRM_DE : Format<54>; def MRM_DF : Format<55>;
44def MRM_E0 : Format<56>; def MRM_E1 : Format<57>; def MRM_E2 : Format<58>;
45def MRM_E3 : Format<59>; def MRM_E4 : Format<60>; def MRM_E5 : Format<61>;
46def MRM_E8 : Format<62>; def MRM_E9 : Format<63>; def MRM_EA : Format<64>;
47def MRM_EB : Format<65>; def MRM_EC : Format<66>; def MRM_ED : Format<67>;
48def MRM_EE : Format<68>; def MRM_F0 : Format<69>; def MRM_F1 : Format<70>;
49def MRM_F2 : Format<71>; def MRM_F3 : Format<72>; def MRM_F4 : Format<73>;
50def MRM_F5 : Format<74>; def MRM_F6 : Format<75>; def MRM_F7 : Format<76>;
51def MRM_F8 : Format<77>; def MRM_F9 : Format<78>; def MRM_FA : Format<79>;
52def MRM_FB : Format<80>; def MRM_FC : Format<81>; def MRM_FD : Format<82>;
53def MRM_FE : Format<83>; def MRM_FF : Format<84>;
Evan Cheng12c6be82007-07-31 08:04:03 +000054
55// ImmType - This specifies the immediate type used by an instruction. This is
56// part of the ad-hoc solution used to emit machine instruction encodings by our
57// machine code emitter.
David Woodhouse0b6c9492014-01-30 22:20:41 +000058class ImmType<bits<4> val> {
59 bits<4> Value = val;
Evan Cheng12c6be82007-07-31 08:04:03 +000060}
Chris Lattner12455ca2010-02-12 22:27:07 +000061def NoImm : ImmType<0>;
62def Imm8 : ImmType<1>;
63def Imm8PCRel : ImmType<2>;
64def Imm16 : ImmType<3>;
Chris Lattnerac588122010-07-07 22:27:31 +000065def Imm16PCRel : ImmType<4>;
66def Imm32 : ImmType<5>;
67def Imm32PCRel : ImmType<6>;
David Woodhouse0b6c9492014-01-30 22:20:41 +000068def Imm32S : ImmType<7>;
69def Imm64 : ImmType<8>;
Evan Cheng12c6be82007-07-31 08:04:03 +000070
71// FPFormat - This specifies what form this FP instruction has. This is used by
72// the Floating-Point stackifier pass.
73class FPFormat<bits<3> val> {
74 bits<3> Value = val;
75}
76def NotFP : FPFormat<0>;
77def ZeroArgFP : FPFormat<1>;
78def OneArgFP : FPFormat<2>;
79def OneArgFPRW : FPFormat<3>;
80def TwoArgFP : FPFormat<4>;
81def CompareFP : FPFormat<5>;
82def CondMovFP : FPFormat<6>;
83def SpecialFP : FPFormat<7>;
84
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +000085// Class specifying the SSE execution domain, used by the SSEDomainFix pass.
Jakob Stoklund Olesendbff4e82010-03-30 22:46:53 +000086// Keep in sync with tables in X86InstrInfo.cpp.
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +000087class Domain<bits<2> val> {
88 bits<2> Value = val;
89}
90def GenericDomain : Domain<0>;
Jakob Stoklund Olesendbff4e82010-03-30 22:46:53 +000091def SSEPackedSingle : Domain<1>;
92def SSEPackedDouble : Domain<2>;
93def SSEPackedInt : Domain<3>;
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +000094
Elena Demikhovsky003e7d72013-07-28 08:28:38 +000095// Class specifying the vector form of the decompressed
96// displacement of 8-bit.
97class CD8VForm<bits<3> val> {
98 bits<3> Value = val;
99}
100def CD8VF : CD8VForm<0>; // v := VL
101def CD8VH : CD8VForm<1>; // v := VL/2
102def CD8VQ : CD8VForm<2>; // v := VL/4
103def CD8VO : CD8VForm<3>; // v := VL/8
104def CD8VT1 : CD8VForm<4>; // v := 1
105def CD8VT2 : CD8VForm<5>; // v := 2
106def CD8VT4 : CD8VForm<6>; // v := 4
107def CD8VT8 : CD8VForm<7>; // v := 8
108
Craig Topper10243c82014-01-31 08:47:06 +0000109// Class specifying the prefix used an opcode extension.
Craig Topper5ccb6172014-02-18 00:21:49 +0000110class Prefix<bits<3> val> {
111 bits<3> Value = val;
Craig Topper10243c82014-01-31 08:47:06 +0000112}
113def NoPrfx : Prefix<0>;
Craig Topper5ccb6172014-02-18 00:21:49 +0000114def PS : Prefix<1>;
115def PD : Prefix<2>;
116def XS : Prefix<3>;
117def XD : Prefix<4>;
Craig Topper10243c82014-01-31 08:47:06 +0000118
119// Class specifying the opcode map.
Craig Topper56f0ed812014-02-19 08:25:02 +0000120class Map<bits<3> val> {
121 bits<3> Value = val;
Craig Topper10243c82014-01-31 08:47:06 +0000122}
123def OB : Map<0>;
124def TB : Map<1>;
125def T8 : Map<2>;
126def TA : Map<3>;
127def XOP8 : Map<4>;
128def XOP9 : Map<5>;
129def XOPA : Map<6>;
Craig Topper10243c82014-01-31 08:47:06 +0000130
Craig Topperd402df32014-02-02 07:08:01 +0000131// Class specifying the encoding
132class Encoding<bits<2> val> {
133 bits<2> Value = val;
134}
135def EncNormal : Encoding<0>;
136def EncVEX : Encoding<1>;
137def EncXOP : Encoding<2>;
138def EncEVEX : Encoding<3>;
139
Craig Topperfa6298a2014-02-02 09:25:09 +0000140// Operand size for encodings that change based on mode.
141class OperandSize<bits<2> val> {
142 bits<2> Value = val;
143}
144def OpSizeFixed : OperandSize<0>; // Never needs a 0x66 prefix.
145def OpSize16 : OperandSize<1>; // Needs 0x66 prefix in 32-bit mode.
146def OpSize32 : OperandSize<2>; // Needs 0x66 prefix in 16-bit mode.
147
Evan Cheng12c6be82007-07-31 08:04:03 +0000148// Prefix byte classes which are used to indicate to the ad-hoc machine code
149// emitter that various prefix bytes are required.
Craig Topperfa6298a2014-02-02 09:25:09 +0000150class OpSize16 { OperandSize OpSize = OpSize16; }
151class OpSize32 { OperandSize OpSize = OpSize32; }
Evan Cheng12c6be82007-07-31 08:04:03 +0000152class AdSize { bit hasAdSizePrefix = 1; }
153class REX_W { bit hasREX_WPrefix = 1; }
Andrew Lenharth0070dd12008-03-01 13:37:02 +0000154class LOCK { bit hasLockPrefix = 1; }
Craig Topperec688662014-01-31 07:00:55 +0000155class REP { bit hasREPPrefix = 1; }
Craig Topperda7160d2014-02-01 08:17:56 +0000156class TB { Map OpMap = TB; }
Craig Topper10243c82014-01-31 08:47:06 +0000157class T8 { Map OpMap = T8; }
158class TA { Map OpMap = TA; }
Craig Topper5ccb6172014-02-18 00:21:49 +0000159class XOP8 { Map OpMap = XOP8; Prefix OpPrefix = PS; }
160class XOP9 { Map OpMap = XOP9; Prefix OpPrefix = PS; }
161class XOPA { Map OpMap = XOPA; Prefix OpPrefix = PS; }
Craig Toppere2347df2014-02-20 07:59:43 +0000162class OBXS { Prefix OpPrefix = XS; }
Craig Topper5ccb6172014-02-18 00:21:49 +0000163class PS : TB { Prefix OpPrefix = PS; }
Craig Topperda7160d2014-02-01 08:17:56 +0000164class PD : TB { Prefix OpPrefix = PD; }
165class XD : TB { Prefix OpPrefix = XD; }
166class XS : TB { Prefix OpPrefix = XS; }
Craig Topper5ccb6172014-02-18 00:21:49 +0000167class T8PS : T8 { Prefix OpPrefix = PS; }
Craig Topperda7160d2014-02-01 08:17:56 +0000168class T8PD : T8 { Prefix OpPrefix = PD; }
169class T8XD : T8 { Prefix OpPrefix = XD; }
170class T8XS : T8 { Prefix OpPrefix = XS; }
Craig Topper5ccb6172014-02-18 00:21:49 +0000171class TAPS : TA { Prefix OpPrefix = PS; }
Craig Topperda7160d2014-02-01 08:17:56 +0000172class TAPD : TA { Prefix OpPrefix = PD; }
173class TAXD : TA { Prefix OpPrefix = XD; }
Craig Topperd402df32014-02-02 07:08:01 +0000174class VEX { Encoding OpEnc = EncVEX; }
Bruno Cardoso Lopes05166742010-07-01 01:20:06 +0000175class VEX_W { bit hasVEX_WPrefix = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000176class VEX_4V : VEX { bit hasVEX_4V = 1; }
177class VEX_4VOp3 : VEX { bit hasVEX_4VOp3 = 1; }
Bruno Cardoso Lopese2bd0582010-07-06 22:36:24 +0000178class VEX_I8IMM { bit hasVEX_i8ImmReg = 1; }
Bruno Cardoso Lopesfd8bfcd2010-07-13 21:07:28 +0000179class VEX_L { bit hasVEX_L = 1; }
Craig Topperf18c8962011-10-04 06:30:42 +0000180class VEX_LIG { bit ignoresVEX_L = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000181class EVEX : VEX { Encoding OpEnc = EncEVEX; }
182class EVEX_4V : VEX_4V { Encoding OpEnc = EncEVEX; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000183class EVEX_K { bit hasEVEX_K = 1; }
184class EVEX_KZ : EVEX_K { bit hasEVEX_Z = 1; }
185class EVEX_B { bit hasEVEX_B = 1; }
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000186class EVEX_RC { bit hasEVEX_RC = 1; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000187class EVEX_V512 { bit hasEVEX_L2 = 1; bit hasVEX_L = 0; }
Robert Khasanovbfa01312014-07-21 14:54:21 +0000188class EVEX_V256 { bit hasEVEX_L2 = 0; bit hasVEX_L = 1; }
189class EVEX_V128 { bit hasEVEX_L2 = 0; bit hasVEX_L = 0; }
Adam Nemet4dc92b92014-07-17 17:04:34 +0000190
191// Specify AVX512 8-bit compressed displacement encoding based on the vector
192// element size in bits (8, 16, 32, 64) and the CDisp8 form.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000193class EVEX_CD8<int esize, CD8VForm form> {
Adam Nemet4dc92b92014-07-17 17:04:34 +0000194 int CD8_EltSize = !srl(esize, 3);
Adam Nemet4c339ab2014-07-17 17:04:52 +0000195 bits<3> CD8_Form = form.Value;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000196}
Adam Nemet4dc92b92014-07-17 17:04:34 +0000197
Chris Lattner45270db2010-10-03 18:08:05 +0000198class Has3DNow0F0FOpcode { bit has3DNow0F0FOpcode = 1; }
Craig Toppercd93de92011-12-30 04:48:54 +0000199class MemOp4 { bit hasMemOp4Prefix = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000200class XOP { Encoding OpEnc = EncXOP; }
201class XOP_4V : XOP { bit hasVEX_4V = 1; }
202class XOP_4VOp3 : XOP { bit hasVEX_4VOp3 = 1; }
203
Evan Cheng12c6be82007-07-31 08:04:03 +0000204class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
Andrew Trick8523b162012-02-01 23:20:51 +0000205 string AsmStr,
206 InstrItinClass itin,
207 Domain d = GenericDomain>
Evan Cheng12c6be82007-07-31 08:04:03 +0000208 : Instruction {
209 let Namespace = "X86";
210
211 bits<8> Opcode = opcod;
212 Format Form = f;
Craig Topper56f0ed812014-02-19 08:25:02 +0000213 bits<7> FormBits = Form.Value;
Evan Cheng12c6be82007-07-31 08:04:03 +0000214 ImmType ImmT = i;
Evan Cheng12c6be82007-07-31 08:04:03 +0000215
216 dag OutOperandList = outs;
217 dag InOperandList = ins;
218 string AsmString = AsmStr;
219
Chris Lattner7ff33462010-10-31 19:22:57 +0000220 // If this is a pseudo instruction, mark it isCodeGenOnly.
221 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
222
Andrew Trick8523b162012-02-01 23:20:51 +0000223 let Itinerary = itin;
224
Evan Cheng12c6be82007-07-31 08:04:03 +0000225 //
226 // Attributes specific to X86 instructions...
227 //
Craig Topper3484fc22014-01-05 04:17:28 +0000228 bit ForceDisassemble = 0; // Force instruction to disassemble even though it's
229 // isCodeGenonly. Needed to hide an ambiguous
230 // AsmString from the parser, but still disassemble.
231
Craig Topperfa6298a2014-02-02 09:25:09 +0000232 OperandSize OpSize = OpSizeFixed; // Does this instruction's encoding change
233 // based on operand size of the mode
Craig Toppere413b622014-02-26 06:01:21 +0000234 bits<2> OpSizeBits = OpSize.Value;
Evan Cheng12c6be82007-07-31 08:04:03 +0000235 bit hasAdSizePrefix = 0; // Does this inst have a 0x67 prefix?
236
Craig Topper10243c82014-01-31 08:47:06 +0000237 Prefix OpPrefix = NoPrfx; // Which prefix byte does this inst have?
Craig Toppere413b622014-02-26 06:01:21 +0000238 bits<3> OpPrefixBits = OpPrefix.Value;
Craig Topper10243c82014-01-31 08:47:06 +0000239 Map OpMap = OB; // Which opcode map does this inst have?
Craig Toppere413b622014-02-26 06:01:21 +0000240 bits<3> OpMapBits = OpMap.Value;
Eric Christopher3a8ae232010-11-30 09:11:54 +0000241 bit hasREX_WPrefix = 0; // Does this inst require the REX.W prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000242 FPFormat FPForm = NotFP; // What flavor of FP instruction is this?
Dan Gohmana21bdda2008-08-20 13:46:21 +0000243 bit hasLockPrefix = 0; // Does this inst have a 0xF0 prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000244 Domain ExeDomain = d;
Craig Topperec688662014-01-31 07:00:55 +0000245 bit hasREPPrefix = 0; // Does this inst have a REP prefix?
Craig Topperd402df32014-02-02 07:08:01 +0000246 Encoding OpEnc = EncNormal; // Encoding used by this instruction
Craig Toppere413b622014-02-26 06:01:21 +0000247 bits<2> OpEncBits = OpEnc.Value;
Bruno Cardoso Lopes05166742010-07-01 01:20:06 +0000248 bit hasVEX_WPrefix = 0; // Does this inst set the VEX_W field?
Craig Topperd402df32014-02-02 07:08:01 +0000249 bit hasVEX_4V = 0; // Does this inst require the VEX.VVVV field?
250 bit hasVEX_4VOp3 = 0; // Does this inst require the VEX.VVVV field to
251 // encode the third operand?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000252 bit hasVEX_i8ImmReg = 0; // Does this inst require the last source register
Bruno Cardoso Lopese2bd0582010-07-06 22:36:24 +0000253 // to be encoded in a immediate field?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000254 bit hasVEX_L = 0; // Does this inst use large (256-bit) registers?
Craig Topperf18c8962011-10-04 06:30:42 +0000255 bit ignoresVEX_L = 0; // Does this instruction ignore the L-bit
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000256 bit hasEVEX_K = 0; // Does this inst require masking?
257 bit hasEVEX_Z = 0; // Does this inst set the EVEX_Z field?
258 bit hasEVEX_L2 = 0; // Does this inst set the EVEX_L2 field?
259 bit hasEVEX_B = 0; // Does this inst set the EVEX_B field?
Adam Nemet4c339ab2014-07-17 17:04:52 +0000260 bits<3> CD8_Form = 0; // Compressed disp8 form - vector-width.
Adam Nemet4dc92b92014-07-17 17:04:34 +0000261 // Declare it int rather than bits<4> so that all bits are defined when
262 // assigning to bits<7>.
263 int CD8_EltSize = 0; // Compressed disp8 form - element-size in bytes.
Chris Lattner45270db2010-10-03 18:08:05 +0000264 bit has3DNow0F0FOpcode =0;// Wacky 3dNow! encoding?
Craig Toppercd93de92011-12-30 04:48:54 +0000265 bit hasMemOp4Prefix = 0; // Same bit as VEX_W, but used for swapping operands
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000266 bit hasEVEX_RC = 0; // Explicitly specified rounding control in FP instruction.
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000267
Adam Nemet4dc92b92014-07-17 17:04:34 +0000268 bits<2> EVEX_LL;
269 let EVEX_LL{0} = hasVEX_L;
270 let EVEX_LL{1} = hasEVEX_L2;
271 // Vector size in bytes.
272 bits<7> VectSize = !shl(16, EVEX_LL);
273
274 // The scaling factor for AVX512's compressed displacement is either
275 // - the size of a power-of-two number of elements or
276 // - the size of a single element for broadcasts or
277 // - the total vector size divided by a power-of-two number.
278 // Possible values are: 0 (non-AVX512 inst), 1, 2, 4, 8, 16, 32 and 64.
279 bits<7> CD8_Scale = !if (!eq (OpEnc.Value, EncEVEX.Value),
Adam Nemet4c339ab2014-07-17 17:04:52 +0000280 !if (CD8_Form{2},
281 !shl(CD8_EltSize, CD8_Form{1-0}),
Adam Nemet4dc92b92014-07-17 17:04:34 +0000282 !if (hasEVEX_B,
283 CD8_EltSize,
Adam Nemet4c339ab2014-07-17 17:04:52 +0000284 !srl(VectSize, CD8_Form{1-0}))), 0);
Adam Nemet4dc92b92014-07-17 17:04:34 +0000285
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000286 // TSFlags layout should be kept in sync with X86InstrInfo.h.
Craig Topper56f0ed812014-02-19 08:25:02 +0000287 let TSFlags{6-0} = FormBits;
Craig Toppere413b622014-02-26 06:01:21 +0000288 let TSFlags{8-7} = OpSizeBits;
Craig Topper56f0ed812014-02-19 08:25:02 +0000289 let TSFlags{9} = hasAdSizePrefix;
Craig Toppere413b622014-02-26 06:01:21 +0000290 let TSFlags{12-10} = OpPrefixBits;
291 let TSFlags{15-13} = OpMapBits;
Craig Topper8f540272014-02-19 07:29:07 +0000292 let TSFlags{16} = hasREX_WPrefix;
293 let TSFlags{20-17} = ImmT.Value;
294 let TSFlags{23-21} = FPForm.Value;
295 let TSFlags{24} = hasLockPrefix;
296 let TSFlags{25} = hasREPPrefix;
297 let TSFlags{27-26} = ExeDomain.Value;
Craig Toppere413b622014-02-26 06:01:21 +0000298 let TSFlags{29-28} = OpEncBits;
Craig Topper8f540272014-02-19 07:29:07 +0000299 let TSFlags{37-30} = Opcode;
300 let TSFlags{38} = hasVEX_WPrefix;
301 let TSFlags{39} = hasVEX_4V;
302 let TSFlags{40} = hasVEX_4VOp3;
303 let TSFlags{41} = hasVEX_i8ImmReg;
304 let TSFlags{42} = hasVEX_L;
305 let TSFlags{43} = ignoresVEX_L;
306 let TSFlags{44} = hasEVEX_K;
307 let TSFlags{45} = hasEVEX_Z;
308 let TSFlags{46} = hasEVEX_L2;
309 let TSFlags{47} = hasEVEX_B;
Adam Nemet54adb0f2014-07-17 17:04:50 +0000310 // If we run out of TSFlags bits, it's possible to encode this in 3 bits.
311 let TSFlags{54-48} = CD8_Scale;
312 let TSFlags{55} = has3DNow0F0FOpcode;
313 let TSFlags{56} = hasMemOp4Prefix;
314 let TSFlags{57} = hasEVEX_RC;
Evan Cheng12c6be82007-07-31 08:04:03 +0000315}
316
Eric Christopheref62f572010-11-30 08:57:23 +0000317class PseudoI<dag oops, dag iops, list<dag> pattern>
Andrew Trick8523b162012-02-01 23:20:51 +0000318 : X86Inst<0, Pseudo, NoImm, oops, iops, "", NoItinerary> {
Eric Christopheref62f572010-11-30 08:57:23 +0000319 let Pattern = pattern;
320}
321
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000322class I<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000323 list<dag> pattern, InstrItinClass itin = NoItinerary,
Andrew Trick8523b162012-02-01 23:20:51 +0000324 Domain d = GenericDomain>
325 : X86Inst<o, f, NoImm, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000326 let Pattern = pattern;
327 let CodeSize = 3;
328}
Sean Callanan04d8cb72009-12-18 00:01:26 +0000329class Ii8 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000330 list<dag> pattern, InstrItinClass itin = NoItinerary,
Andrew Trick8523b162012-02-01 23:20:51 +0000331 Domain d = GenericDomain>
332 : X86Inst<o, f, Imm8, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000333 let Pattern = pattern;
334 let CodeSize = 3;
335}
Chris Lattner12455ca2010-02-12 22:27:07 +0000336class Ii8PCRel<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, Imm8PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000339 let Pattern = pattern;
340 let CodeSize = 3;
341}
Sean Callanan04d8cb72009-12-18 00:01:26 +0000342class Ii16<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, Imm16, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000345 let Pattern = pattern;
346 let CodeSize = 3;
347}
Sean Callanan04d8cb72009-12-18 00:01:26 +0000348class Ii32<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000349 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000350 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000351 let Pattern = pattern;
352 let CodeSize = 3;
353}
David Woodhouse0b6c9492014-01-30 22:20:41 +0000354class Ii32S<bits<8> o, Format f, dag outs, dag ins, string asm,
355 list<dag> pattern, InstrItinClass itin = NoItinerary>
356 : X86Inst<o, f, Imm32S, outs, ins, asm, itin> {
357 let Pattern = pattern;
358 let CodeSize = 3;
359}
Evan Cheng12c6be82007-07-31 08:04:03 +0000360
Chris Lattnerac588122010-07-07 22:27:31 +0000361class Ii16PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000362 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000363 : X86Inst<o, f, Imm16PCRel, outs, ins, asm, itin> {
Chris Lattnerac588122010-07-07 22:27:31 +0000364 let Pattern = pattern;
365 let CodeSize = 3;
366}
367
Chris Lattner12455ca2010-02-12 22:27:07 +0000368class Ii32PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000369 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000370 : X86Inst<o, f, Imm32PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000371 let Pattern = pattern;
372 let CodeSize = 3;
373}
374
Evan Cheng12c6be82007-07-31 08:04:03 +0000375// FPStack Instruction Templates:
376// FPI - Floating Point Instruction template.
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000377class FPI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000378 InstrItinClass itin = NoItinerary>
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000379 : I<o, F, outs, ins, asm, [], itin> {}
Evan Cheng12c6be82007-07-31 08:04:03 +0000380
Bob Wilsona967c422010-08-26 18:08:11 +0000381// FpI_ - Floating Point Pseudo Instruction template. Not Predicated.
Andrew Trick8523b162012-02-01 23:20:51 +0000382class FpI_<dag outs, dag ins, FPFormat fp, list<dag> pattern,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000383 InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000384 : X86Inst<0, Pseudo, NoImm, outs, ins, "", itin> {
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000385 let FPForm = fp;
Evan Cheng12c6be82007-07-31 08:04:03 +0000386 let Pattern = pattern;
387}
388
Sean Callanan050e0cd2009-09-15 00:35:17 +0000389// Templates for instructions that use a 16- or 32-bit segmented address as
390// their only operand: lcall (FAR CALL) and ljmp (FAR JMP)
391//
392// Iseg16 - 16-bit segment selector, 16-bit offset
393// Iseg32 - 16-bit segment selector, 32-bit offset
394
395class Iseg16 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000396 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000397 : X86Inst<o, f, Imm16, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000398 let Pattern = pattern;
399 let CodeSize = 3;
400}
401
402class Iseg32 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000403 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000404 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000405 let Pattern = pattern;
406 let CodeSize = 3;
407}
408
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000409// SI - SSE 1 & 2 scalar instructions
Andrew Trick8523b162012-02-01 23:20:51 +0000410class SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000411 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000412 : I<o, F, outs, ins, asm, pattern, itin> {
Craig Topperd402df32014-02-02 07:08:01 +0000413 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
414 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX],
415 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
416 !if(!eq(OpPrefix.Value, XD.Value), [UseSSE2],
417 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000418 [UseSSE1])))));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000419
420 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000421 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
422 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
423 asm));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000424}
425
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000426// SIi8 - SSE 1 & 2 scalar instructions
427class SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000428 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000429 : Ii8<o, F, outs, ins, asm, pattern, itin> {
Craig Topperd402df32014-02-02 07:08:01 +0000430 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
431 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX],
432 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
Craig Topper10243c82014-01-31 08:47:06 +0000433 [UseSSE2])));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000434
435 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000436 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
437 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
438 asm));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000439}
440
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000441// PI - SSE 1 & 2 packed instructions
442class PI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
Andrew Trick8523b162012-02-01 23:20:51 +0000443 InstrItinClass itin, Domain d>
444 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000445 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
446 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
447 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000448 [UseSSE1])));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000449
450 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000451 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
452 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
453 asm));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000454}
455
Michael Liaobbd10792012-08-30 16:54:46 +0000456// MMXPI - SSE 1 & 2 packed instructions with MMX operands
457class MMXPI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
458 InstrItinClass itin, Domain d>
459 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000460 let Predicates = !if(!eq(OpPrefix.Value, PD.Value), [HasSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000461 [HasSSE1]);
Michael Liaobbd10792012-08-30 16:54:46 +0000462}
463
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000464// PIi8 - SSE 1 & 2 packed instructions with immediate
465class PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Andrew Trick8523b162012-02-01 23:20:51 +0000466 list<dag> pattern, InstrItinClass itin, Domain d>
467 : Ii8<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000468 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
469 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
470 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000471 [UseSSE1])));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000472
473 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000474 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
475 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
476 asm));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000477}
478
Evan Cheng12c6be82007-07-31 08:04:03 +0000479// SSE1 Instruction Templates:
480//
481// SSI - SSE1 instructions with XS prefix.
Craig Topper5ccb6172014-02-18 00:21:49 +0000482// PSI - SSE1 instructions with PS prefix.
483// PSIi8 - SSE1 instructions with ImmT == Imm8 and PS prefix.
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000484// VSSI - SSE1 instructions with XS prefix in AVX form.
Craig Topper5ccb6172014-02-18 00:21:49 +0000485// VPSI - SSE1 instructions with PS prefix in AVX form, packed single.
Evan Cheng12c6be82007-07-31 08:04:03 +0000486
Andrew Trick8523b162012-02-01 23:20:51 +0000487class SSI<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>
Michael Liaobbd10792012-08-30 16:54:46 +0000489 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000490class SSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000491 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000492 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000493class PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000494 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000495 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, PS,
Michael Liaobbd10792012-08-30 16:54:46 +0000496 Requires<[UseSSE1]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000497class PSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000498 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000499 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, PS,
Michael Liaobbd10792012-08-30 16:54:46 +0000500 Requires<[UseSSE1]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000501class VSSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000502 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000503 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000504 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000505class VPSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000506 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000507 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin, SSEPackedSingle>, PS,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000508 Requires<[HasAVX]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000509
510// SSE2 Instruction Templates:
511//
Bill Wendling76105a42008-08-27 21:32:04 +0000512// SDI - SSE2 instructions with XD prefix.
513// SDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix.
Craig Topperf881d382012-07-30 02:14:02 +0000514// S2SI - SSE2 instructions with XS prefix.
Bill Wendling76105a42008-08-27 21:32:04 +0000515// SSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix.
Craig Topperae11aed2014-01-14 07:41:20 +0000516// PDI - SSE2 instructions with PD prefix, packed double domain.
517// PDIi8 - SSE2 instructions with ImmT == Imm8 and PD prefix.
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000518// VSDI - SSE2 scalar instructions with XD prefix in AVX form.
Craig Topperae11aed2014-01-14 07:41:20 +0000519// VPDI - SSE2 vector instructions with PD prefix in AVX form,
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000520// packed double domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000521// VS2I - SSE2 scalar instructions with PD prefix in AVX form.
522// S2I - SSE2 scalar instructions with PD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000523// MMXSDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix as well as
524// MMX operands.
525// MMXSSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix as well as
526// MMX operands.
Evan Cheng12c6be82007-07-31 08:04:03 +0000527
Andrew Trick8523b162012-02-01 23:20:51 +0000528class SDI<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>, XD, Requires<[UseSSE2]>;
Evan Cheng01c7c192007-12-20 19:57:09 +0000531class SDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000532 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000533 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000534class S2SI<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>
Michael Liaobbd10792012-08-30 16:54:46 +0000536 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000537class S2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000538 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000539 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE2]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000540class PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000541 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000542 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000543 Requires<[UseSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000544class PDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000545 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000546 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000547 Requires<[UseSSE2]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000548class VSDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000549 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000550 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XD,
Elena Demikhovsky3ce8dbb2013-08-18 13:08:57 +0000551 Requires<[UseAVX]>;
Craig Topperf881d382012-07-30 02:14:02 +0000552class VS2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000553 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperf881d382012-07-30 02:14:02 +0000554 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
555 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000556class VPDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000557 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000558 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin, SSEPackedDouble>,
559 PD, Requires<[HasAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000560class VS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
561 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000562 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, PD,
563 Requires<[UseAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000564class S2I<bits<8> o, Format F, dag outs, dag ins, string asm,
565 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000566 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[UseSSE2]>;
Michael Liaobbd10792012-08-30 16:54:46 +0000567class MMXSDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000568 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000569 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasSSE2]>;
570class MMXS2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000571 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000572 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[HasSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000573
574// SSE3 Instruction Templates:
575//
Craig Topperae11aed2014-01-14 07:41:20 +0000576// S3I - SSE3 instructions with PD prefixes.
Evan Cheng12c6be82007-07-31 08:04:03 +0000577// S3SI - SSE3 instructions with XS prefix.
578// S3DI - SSE3 instructions with XD prefix.
579
Sean Callanan04d8cb72009-12-18 00:01:26 +0000580class S3SI<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000582 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, XS,
Michael Liaobbd10792012-08-30 16:54:46 +0000583 Requires<[UseSSE3]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000584class S3DI<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000586 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, XD,
Michael Liaobbd10792012-08-30 16:54:46 +0000587 Requires<[UseSSE3]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000588class S3I<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000590 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000591 Requires<[UseSSE3]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000592
593
Nate Begeman8ef50212008-02-12 22:51:28 +0000594// SSSE3 Instruction Templates:
595//
596// SS38I - SSSE3 instructions with T8 prefix.
597// SS3AI - SSSE3 instructions with TA prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000598// MMXSS38I - SSSE3 instructions with T8 prefix and MMX operands.
599// MMXSS3AI - SSSE3 instructions with TA prefix and MMX operands.
Nate Begeman8ef50212008-02-12 22:51:28 +0000600//
601// Note: SSSE3 instructions have 64-bit and 128-bit versions. The 64-bit version
Craig Topper744f6312012-01-09 00:11:29 +0000602// uses the MMX registers. The 64-bit versions are grouped with the MMX
603// classes. They need to be enabled even if AVX is enabled.
Nate Begeman8ef50212008-02-12 22:51:28 +0000604
605class SS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000606 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000607 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000608 Requires<[UseSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000609class SS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000610 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000611 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000612 Requires<[UseSSSE3]>;
613class MMXSS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000614 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper87557402014-02-18 08:24:22 +0000615 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PS,
Michael Liaobbd10792012-08-30 16:54:46 +0000616 Requires<[HasSSSE3]>;
617class MMXSS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000618 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper87557402014-02-18 08:24:22 +0000619 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPS,
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000620 Requires<[HasSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000621
622// SSE4.1 Instruction Templates:
623//
624// SS48I - SSE 4.1 instructions with T8 prefix.
Evan Cheng96bdbd62008-03-14 07:39:27 +0000625// SS41AIi8 - SSE 4.1 instructions with TA prefix and ImmT == Imm8.
Nate Begeman8ef50212008-02-12 22:51:28 +0000626//
627class SS48I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000628 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000629 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000630 Requires<[UseSSE41]>;
Evan Cheng96bdbd62008-03-14 07:39:27 +0000631class SS4AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000632 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000633 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000634 Requires<[UseSSE41]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000635
Nate Begeman55b7bec2008-07-17 16:51:19 +0000636// SSE4.2 Instruction Templates:
637//
638// SS428I - SSE 4.2 instructions with T8 prefix.
639class SS428I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000640 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000641 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000642 Requires<[UseSSE42]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000643
Craig Topper96fa5972011-10-16 16:50:08 +0000644// SS42FI - SSE 4.2 instructions with T8XD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000645// NOTE: 'HasSSE42' is used as SS42FI is only used for CRC32 insns.
Eric Christopher7dfa9f22009-08-08 21:55:08 +0000646class SS42FI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000647 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000648 : I<o, F, outs, ins, asm, pattern, itin>, T8XD, Requires<[HasSSE42]>;
Craig Topperb9109842012-01-01 19:51:58 +0000649
Eric Christopher9fe912d2009-08-18 22:50:32 +0000650// SS42AI = SSE 4.2 instructions with TA prefix
651class SS42AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000652 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000653 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000654 Requires<[UseSSE42]>;
Eric Christopher9fe912d2009-08-18 22:50:32 +0000655
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000656// AVX Instruction Templates:
657// Instructions introduced in AVX (no SSE equivalent forms)
658//
Craig Topperae11aed2014-01-14 07:41:20 +0000659// AVX8I - AVX instructions with T8PD prefix.
660// AVXAIi8 - AVX instructions with TAPD prefix and ImmT = Imm8.
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000661class AVX8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000662 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000663 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000664 Requires<[HasAVX]>;
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000665class AVXAIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000666 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000667 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000668 Requires<[HasAVX]>;
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000669
Craig Topper05d1cb92011-11-06 06:12:20 +0000670// AVX2 Instruction Templates:
671// Instructions introduced in AVX2 (no SSE equivalent forms)
672//
Craig Topperae11aed2014-01-14 07:41:20 +0000673// AVX28I - AVX2 instructions with T8PD prefix.
674// AVX2AIi8 - AVX2 instructions with TAPD prefix and ImmT = Imm8.
Craig Topper05d1cb92011-11-06 06:12:20 +0000675class AVX28I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000676 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000677 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000678 Requires<[HasAVX2]>;
Craig Topperf01f1b52011-11-06 23:04:08 +0000679class AVX2AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000680 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000681 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000682 Requires<[HasAVX2]>;
683
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000684
685// AVX-512 Instruction Templates:
686// Instructions introduced in AVX-512 (no SSE equivalent forms)
687//
Craig Topperae11aed2014-01-14 07:41:20 +0000688// AVX5128I - AVX-512 instructions with T8PD prefix.
689// AVX512AIi8 - AVX-512 instructions with TAPD prefix and ImmT = Imm8.
690// AVX512PDI - AVX-512 instructions with PD, double packed.
Craig Topper5ccb6172014-02-18 00:21:49 +0000691// AVX512PSI - AVX-512 instructions with PS, single packed.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000692// AVX512XS8I - AVX-512 instructions with T8 and XS prefixes.
693// AVX512XSI - AVX-512 instructions with XS prefix, generic domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000694// AVX512BI - AVX-512 instructions with PD, int packed domain.
695// AVX512SI - AVX-512 scalar instructions with PD prefix.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000696
697class AVX5128I<bits<8> o, Format F, dag outs, dag ins, string asm,
698 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000699 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000700 Requires<[HasAVX512]>;
701class AVX512XS8I<bits<8> o, Format F, dag outs, dag ins, string asm,
702 list<dag> pattern, InstrItinClass itin = NoItinerary>
703 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8XS,
704 Requires<[HasAVX512]>;
705class AVX512XSI<bits<8> o, Format F, dag outs, dag ins, string asm,
706 list<dag> pattern, InstrItinClass itin = NoItinerary>
707 : I<o, F, outs, ins, asm, pattern, itin>, XS,
708 Requires<[HasAVX512]>;
709class AVX512XDI<bits<8> o, Format F, dag outs, dag ins, string asm,
710 list<dag> pattern, InstrItinClass itin = NoItinerary>
711 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, XD,
712 Requires<[HasAVX512]>;
713class AVX512BI<bits<8> o, Format F, dag outs, dag ins, string asm,
714 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000715 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000716 Requires<[HasAVX512]>;
717class AVX512BIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
718 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000719 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000720 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000721class AVX512AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
722 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000723 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000724 Requires<[HasAVX512]>;
Adam Nemet2e91ee52014-08-14 17:13:19 +0000725class AVX512AIi8Base : TAPD {
Adam Nemet2e2537f2014-08-07 17:53:55 +0000726 Domain ExeDomain = SSEPackedInt;
727 ImmType ImmT = Imm8;
728}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000729class AVX512Ii8<bits<8> o, Format F, dag outs, dag ins, string asm,
730 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000731 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>,
Craig Topperae11aed2014-01-14 07:41:20 +0000732 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000733class AVX512PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
734 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000735 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
736 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000737class AVX512PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
738 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000739 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, PS,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000740 Requires<[HasAVX512]>;
741class AVX512PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
742 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000743 : Ii8<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000744class AVX512PI<bits<8> o, Format F, dag outs, dag ins, string asm,
745 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000746 : I<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000747class AVX512FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
748 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000749 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
750 EVEX_4V, Requires<[HasAVX512]>;
Adam Nemet2e91ee52014-08-14 17:13:19 +0000751class AVX512FMA3Base : T8PD, EVEX_4V;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000752
Adam Nemet2e2537f2014-08-07 17:53:55 +0000753class AVX512<bits<8> o, Format F, dag outs, dag ins, string asm,
754 list<dag>pattern, InstrItinClass itin = NoItinerary>
755 : I<o, F, outs, ins, asm, pattern, itin>, Requires<[HasAVX512]>;
756
Eric Christopher2ef63182010-04-02 21:54:27 +0000757// AES Instruction Templates:
758//
759// AES8I
Eric Christopher1290fa02010-04-05 21:14:32 +0000760// These use the same encoding as the SSE4.2 T8 and TA encodings.
Eric Christopher2ef63182010-04-02 21:54:27 +0000761class AES8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Preston Gurd3fe264d2013-09-13 19:23:28 +0000762 list<dag>pattern, InstrItinClass itin = IIC_AES>
Craig Topperae11aed2014-01-14 07:41:20 +0000763 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topperc0cef322012-05-01 05:35:02 +0000764 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000765
766class AESAI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000767 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000768 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topperc0cef322012-05-01 05:35:02 +0000769 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000770
Benjamin Kramera0396e42012-05-31 14:34:17 +0000771// PCLMUL Instruction Templates
772class PCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000773 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000774 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
775 Requires<[HasPCLMUL]>;
Eli Friedman415412e2011-07-05 18:21:20 +0000776
Benjamin Kramera0396e42012-05-31 14:34:17 +0000777class AVXPCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000778 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000779 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
780 VEX_4V, Requires<[HasAVX, HasPCLMUL]>;
Bruno Cardoso Lopesea0e05a2010-07-23 18:41:12 +0000781
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000782// FMA3 Instruction Templates
783class FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000784 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000785 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
786 VEX_4V, FMASC, Requires<[HasFMA]>;
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000787
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000788// FMA4 Instruction Templates
789class FMA4<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000790 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000791 : Ii8<o, F, outs, ins, asm, pattern, itin>, TAPD,
792 VEX_4V, VEX_I8IMM, FMASC, Requires<[HasFMA4]>;
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000793
Jan Sjödin7c0face2011-12-12 19:37:49 +0000794// XOP 2, 3 and 4 Operand Instruction Template
795class IXOP<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000796 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000797 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Craig Topperd402df32014-02-02 07:08:01 +0000798 XOP9, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000799
800// XOP 2, 3 and 4 Operand Instruction Templates with imm byte
801class IXOPi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000802 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000803 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Craig Topperd402df32014-02-02 07:08:01 +0000804 XOP8, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000805
806// XOP 5 operand instruction (VEX encoding!)
807class IXOP5<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000808 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000809 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
810 VEX_4V, VEX_I8IMM, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000811
Evan Cheng12c6be82007-07-31 08:04:03 +0000812// X86-64 Instruction templates...
813//
814
Andrew Trick8523b162012-02-01 23:20:51 +0000815class RI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000816 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000817 : I<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000818class RIi8 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000819 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000820 : Ii8<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse4e033b02014-01-13 14:05:59 +0000821class RIi16 <bits<8> o, Format F, dag outs, dag ins, string asm,
822 list<dag> pattern, InstrItinClass itin = NoItinerary>
823 : Ii16<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000824class RIi32 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000825 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000826 : Ii32<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse0b6c9492014-01-30 22:20:41 +0000827class RIi32S <bits<8> o, Format F, dag outs, dag ins, string asm,
828 list<dag> pattern, InstrItinClass itin = NoItinerary>
829 : Ii32S<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000830
831class RIi64<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000832 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000833 : X86Inst<o, f, Imm64, outs, ins, asm, itin>, REX_W {
Evan Cheng12c6be82007-07-31 08:04:03 +0000834 let Pattern = pattern;
835 let CodeSize = 3;
836}
837
Kevin Enderby285da022013-07-22 21:25:31 +0000838class RIi64_NOREX<bits<8> o, Format f, dag outs, dag ins, string asm,
839 list<dag> pattern, InstrItinClass itin = NoItinerary>
840 : X86Inst<o, f, Imm64, outs, ins, asm, itin> {
841 let Pattern = pattern;
842 let CodeSize = 3;
843}
844
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000845class RS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
846 list<dag> pattern, InstrItinClass itin = NoItinerary>
847 : S2I<o, F, outs, ins, asm, pattern, itin>, REX_W;
848class VRS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
849 list<dag> pattern, InstrItinClass itin = NoItinerary>
850 : VS2I<o, F, outs, ins, asm, pattern, itin>, VEX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000851
852// MMX Instruction templates
853//
854
855// MMXI - MMX instructions with TB prefix.
Craig Topperbc749db2013-10-09 02:18:34 +0000856// MMXI32 - MMX instructions with TB prefix valid only in 32 bit mode.
Anton Korobeynikov31099512008-08-23 15:53:19 +0000857// MMXI64 - MMX instructions with TB prefix valid only in 64 bit mode.
Craig Topperae11aed2014-01-14 07:41:20 +0000858// MMX2I - MMX / SSE2 instructions with PD prefix.
Craig Topper5ccb6172014-02-18 00:21:49 +0000859// MMXIi8 - MMX instructions with ImmT == Imm8 and PS prefix.
860// MMXIi8 - MMX instructions with ImmT == Imm8 and PS prefix.
Evan Cheng12c6be82007-07-31 08:04:03 +0000861// MMXID - MMX instructions with XD prefix.
862// MMXIS - MMX instructions with XS prefix.
Sean Callanan04d8cb72009-12-18 00:01:26 +0000863class MMXI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000864 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000865 : I<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX]>;
Craig Topperbc749db2013-10-09 02:18:34 +0000866class MMXI32<bits<8> o, Format F, dag outs, dag ins, string asm,
867 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000868 : I<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX,Not64BitMode]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000869class MMXI64<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>
Craig Topper5ccb6172014-02-18 00:21:49 +0000871 : I<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX,In64BitMode]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000872class MMXRI<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 Topper5ccb6172014-02-18 00:21:49 +0000874 : I<o, F, outs, ins, asm, pattern, itin>, PS, REX_W, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000875class MMX2I<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000877 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000878class MMXIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000879 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000880 : Ii8<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000881class MMXID<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>, XD, Requires<[HasMMX]>;
Sean Callanan04d8cb72009-12-18 00:01:26 +0000884class MMXIS<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000885 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000886 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[HasMMX]>;