blob: 56043fb068276ff0204145ece6c69252de506ea5 [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>;
Craig Toppera3776de2015-02-15 04:16:44 +000037def MRM_C3 : Format<35>; def MRM_C4 : Format<36>; def MRM_C5 : Format<37>;
38def MRM_C6 : Format<38>; def MRM_C7 : Format<39>; def MRM_C8 : Format<40>;
39def MRM_C9 : Format<41>; def MRM_CA : Format<42>; def MRM_CB : Format<43>;
40def MRM_CC : Format<44>; def MRM_CD : Format<45>; def MRM_CE : Format<46>;
41def MRM_CF : Format<47>; def MRM_D0 : Format<48>; def MRM_D1 : Format<49>;
42def MRM_D2 : Format<50>; def MRM_D3 : Format<51>; def MRM_D4 : Format<52>;
43def MRM_D5 : Format<53>; def MRM_D6 : Format<54>; def MRM_D7 : Format<55>;
44def MRM_D8 : Format<56>; def MRM_D9 : Format<57>; def MRM_DA : Format<58>;
45def MRM_DB : Format<59>; def MRM_DC : Format<60>; def MRM_DD : Format<61>;
46def MRM_DE : Format<62>; def MRM_DF : Format<63>; def MRM_E0 : Format<64>;
47def MRM_E1 : Format<65>; def MRM_E2 : Format<66>; def MRM_E3 : Format<67>;
48def MRM_E4 : Format<68>; def MRM_E5 : Format<69>; def MRM_E6 : Format<70>;
49def MRM_E7 : Format<71>; def MRM_E8 : Format<72>; def MRM_E9 : Format<73>;
50def MRM_EA : Format<74>; def MRM_EB : Format<75>; def MRM_EC : Format<76>;
51def MRM_ED : Format<77>; def MRM_EE : Format<78>; def MRM_EF : Format<79>;
52def MRM_F0 : Format<80>; def MRM_F1 : Format<81>; def MRM_F2 : Format<82>;
53def MRM_F3 : Format<83>; def MRM_F4 : Format<84>; def MRM_F5 : Format<85>;
54def MRM_F6 : Format<86>; def MRM_F7 : Format<87>; def MRM_F8 : Format<88>;
55def MRM_F9 : Format<89>; def MRM_FA : Format<90>; def MRM_FB : Format<91>;
56def MRM_FC : Format<92>; def MRM_FD : Format<93>; def MRM_FE : Format<94>;
57def MRM_FF : Format<95>;
Evan Cheng12c6be82007-07-31 08:04:03 +000058
59// ImmType - This specifies the immediate type used by an instruction. This is
60// part of the ad-hoc solution used to emit machine instruction encodings by our
61// machine code emitter.
David Woodhouse0b6c9492014-01-30 22:20:41 +000062class ImmType<bits<4> val> {
63 bits<4> Value = val;
Evan Cheng12c6be82007-07-31 08:04:03 +000064}
Chris Lattner12455ca2010-02-12 22:27:07 +000065def NoImm : ImmType<0>;
66def Imm8 : ImmType<1>;
67def Imm8PCRel : ImmType<2>;
68def Imm16 : ImmType<3>;
Chris Lattnerac588122010-07-07 22:27:31 +000069def Imm16PCRel : ImmType<4>;
70def Imm32 : ImmType<5>;
71def Imm32PCRel : ImmType<6>;
David Woodhouse0b6c9492014-01-30 22:20:41 +000072def Imm32S : ImmType<7>;
73def Imm64 : ImmType<8>;
Evan Cheng12c6be82007-07-31 08:04:03 +000074
75// FPFormat - This specifies what form this FP instruction has. This is used by
76// the Floating-Point stackifier pass.
77class FPFormat<bits<3> val> {
78 bits<3> Value = val;
79}
80def NotFP : FPFormat<0>;
81def ZeroArgFP : FPFormat<1>;
82def OneArgFP : FPFormat<2>;
83def OneArgFPRW : FPFormat<3>;
84def TwoArgFP : FPFormat<4>;
85def CompareFP : FPFormat<5>;
86def CondMovFP : FPFormat<6>;
87def SpecialFP : FPFormat<7>;
88
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +000089// Class specifying the SSE execution domain, used by the SSEDomainFix pass.
Jakob Stoklund Olesendbff4e82010-03-30 22:46:53 +000090// Keep in sync with tables in X86InstrInfo.cpp.
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +000091class Domain<bits<2> val> {
92 bits<2> Value = val;
93}
94def GenericDomain : Domain<0>;
Jakob Stoklund Olesendbff4e82010-03-30 22:46:53 +000095def SSEPackedSingle : Domain<1>;
96def SSEPackedDouble : Domain<2>;
97def SSEPackedInt : Domain<3>;
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +000098
Elena Demikhovsky003e7d72013-07-28 08:28:38 +000099// Class specifying the vector form of the decompressed
100// displacement of 8-bit.
101class CD8VForm<bits<3> val> {
102 bits<3> Value = val;
103}
104def CD8VF : CD8VForm<0>; // v := VL
105def CD8VH : CD8VForm<1>; // v := VL/2
106def CD8VQ : CD8VForm<2>; // v := VL/4
107def CD8VO : CD8VForm<3>; // v := VL/8
Adam Nemet449b3f02014-10-15 23:42:09 +0000108// The tuple (subvector) forms.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000109def CD8VT1 : CD8VForm<4>; // v := 1
110def CD8VT2 : CD8VForm<5>; // v := 2
111def CD8VT4 : CD8VForm<6>; // v := 4
112def CD8VT8 : CD8VForm<7>; // v := 8
113
Craig Topper10243c82014-01-31 08:47:06 +0000114// Class specifying the prefix used an opcode extension.
Craig Topper5ccb6172014-02-18 00:21:49 +0000115class Prefix<bits<3> val> {
116 bits<3> Value = val;
Craig Topper10243c82014-01-31 08:47:06 +0000117}
118def NoPrfx : Prefix<0>;
Craig Topper5ccb6172014-02-18 00:21:49 +0000119def PS : Prefix<1>;
120def PD : Prefix<2>;
121def XS : Prefix<3>;
122def XD : Prefix<4>;
Craig Topper10243c82014-01-31 08:47:06 +0000123
124// Class specifying the opcode map.
Craig Topper56f0ed812014-02-19 08:25:02 +0000125class Map<bits<3> val> {
126 bits<3> Value = val;
Craig Topper10243c82014-01-31 08:47:06 +0000127}
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>;
Craig Topper10243c82014-01-31 08:47:06 +0000135
Craig Topperd402df32014-02-02 07:08:01 +0000136// Class specifying the encoding
137class Encoding<bits<2> val> {
138 bits<2> Value = val;
139}
140def EncNormal : Encoding<0>;
141def EncVEX : Encoding<1>;
142def EncXOP : Encoding<2>;
143def EncEVEX : Encoding<3>;
144
Craig Topperfa6298a2014-02-02 09:25:09 +0000145// Operand size for encodings that change based on mode.
146class OperandSize<bits<2> val> {
147 bits<2> Value = val;
148}
149def OpSizeFixed : OperandSize<0>; // Never needs a 0x66 prefix.
150def OpSize16 : OperandSize<1>; // Needs 0x66 prefix in 32-bit mode.
151def OpSize32 : OperandSize<2>; // Needs 0x66 prefix in 16-bit mode.
152
Craig Topperb86338f2014-12-24 06:05:22 +0000153// Address size for encodings that change based on mode.
154class AddressSize<bits<2> val> {
155 bits<2> Value = val;
156}
157def AdSizeX : AddressSize<0>; // Address size determined using addr operand.
158def AdSize16 : AddressSize<1>; // Encodes a 16-bit address.
159def AdSize32 : AddressSize<2>; // Encodes a 32-bit address.
160def AdSize64 : AddressSize<3>; // Encodes a 64-bit address.
161
Evan Cheng12c6be82007-07-31 08:04:03 +0000162// Prefix byte classes which are used to indicate to the ad-hoc machine code
163// emitter that various prefix bytes are required.
Craig Topperfa6298a2014-02-02 09:25:09 +0000164class OpSize16 { OperandSize OpSize = OpSize16; }
165class OpSize32 { OperandSize OpSize = OpSize32; }
Craig Topperb86338f2014-12-24 06:05:22 +0000166class AdSize16 { AddressSize AdSize = AdSize16; }
167class AdSize32 { AddressSize AdSize = AdSize32; }
168class AdSize64 { AddressSize AdSize = AdSize64; }
Evan Cheng12c6be82007-07-31 08:04:03 +0000169class REX_W { bit hasREX_WPrefix = 1; }
Andrew Lenharth0070dd12008-03-01 13:37:02 +0000170class LOCK { bit hasLockPrefix = 1; }
Craig Topperec688662014-01-31 07:00:55 +0000171class REP { bit hasREPPrefix = 1; }
Craig Topperda7160d2014-02-01 08:17:56 +0000172class TB { Map OpMap = TB; }
Craig Topper10243c82014-01-31 08:47:06 +0000173class T8 { Map OpMap = T8; }
174class TA { Map OpMap = TA; }
Craig Topper5ccb6172014-02-18 00:21:49 +0000175class XOP8 { Map OpMap = XOP8; Prefix OpPrefix = PS; }
176class XOP9 { Map OpMap = XOP9; Prefix OpPrefix = PS; }
177class XOPA { Map OpMap = XOPA; Prefix OpPrefix = PS; }
Craig Toppere2347df2014-02-20 07:59:43 +0000178class OBXS { Prefix OpPrefix = XS; }
Craig Topper5ccb6172014-02-18 00:21:49 +0000179class PS : TB { Prefix OpPrefix = PS; }
Craig Topperda7160d2014-02-01 08:17:56 +0000180class PD : TB { Prefix OpPrefix = PD; }
181class XD : TB { Prefix OpPrefix = XD; }
182class XS : TB { Prefix OpPrefix = XS; }
Craig Topper5ccb6172014-02-18 00:21:49 +0000183class T8PS : T8 { Prefix OpPrefix = PS; }
Craig Topperda7160d2014-02-01 08:17:56 +0000184class T8PD : T8 { Prefix OpPrefix = PD; }
185class T8XD : T8 { Prefix OpPrefix = XD; }
186class T8XS : T8 { Prefix OpPrefix = XS; }
Craig Topper5ccb6172014-02-18 00:21:49 +0000187class TAPS : TA { Prefix OpPrefix = PS; }
Craig Topperda7160d2014-02-01 08:17:56 +0000188class TAPD : TA { Prefix OpPrefix = PD; }
189class TAXD : TA { Prefix OpPrefix = XD; }
Craig Topperd402df32014-02-02 07:08:01 +0000190class VEX { Encoding OpEnc = EncVEX; }
Bruno Cardoso Lopes05166742010-07-01 01:20:06 +0000191class VEX_W { bit hasVEX_WPrefix = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000192class VEX_4V : VEX { bit hasVEX_4V = 1; }
193class VEX_4VOp3 : VEX { bit hasVEX_4VOp3 = 1; }
Bruno Cardoso Lopese2bd0582010-07-06 22:36:24 +0000194class VEX_I8IMM { bit hasVEX_i8ImmReg = 1; }
Bruno Cardoso Lopesfd8bfcd2010-07-13 21:07:28 +0000195class VEX_L { bit hasVEX_L = 1; }
Craig Topperf18c8962011-10-04 06:30:42 +0000196class VEX_LIG { bit ignoresVEX_L = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000197class EVEX : VEX { Encoding OpEnc = EncEVEX; }
198class EVEX_4V : VEX_4V { Encoding OpEnc = EncEVEX; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000199class EVEX_K { bit hasEVEX_K = 1; }
200class EVEX_KZ : EVEX_K { bit hasEVEX_Z = 1; }
201class EVEX_B { bit hasEVEX_B = 1; }
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000202class EVEX_RC { bit hasEVEX_RC = 1; }
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000203class EVEX_V512 { bit hasEVEX_L2 = 1; bit hasVEX_L = 0; }
Robert Khasanovbfa01312014-07-21 14:54:21 +0000204class EVEX_V256 { bit hasEVEX_L2 = 0; bit hasVEX_L = 1; }
205class EVEX_V128 { bit hasEVEX_L2 = 0; bit hasVEX_L = 0; }
Adam Nemet4dc92b92014-07-17 17:04:34 +0000206
207// Specify AVX512 8-bit compressed displacement encoding based on the vector
208// element size in bits (8, 16, 32, 64) and the CDisp8 form.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000209class EVEX_CD8<int esize, CD8VForm form> {
Adam Nemet4dc92b92014-07-17 17:04:34 +0000210 int CD8_EltSize = !srl(esize, 3);
Adam Nemet4c339ab2014-07-17 17:04:52 +0000211 bits<3> CD8_Form = form.Value;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000212}
Adam Nemet4dc92b92014-07-17 17:04:34 +0000213
Chris Lattner45270db2010-10-03 18:08:05 +0000214class Has3DNow0F0FOpcode { bit has3DNow0F0FOpcode = 1; }
Craig Toppercd93de92011-12-30 04:48:54 +0000215class MemOp4 { bit hasMemOp4Prefix = 1; }
Craig Topperd402df32014-02-02 07:08:01 +0000216class XOP { Encoding OpEnc = EncXOP; }
217class XOP_4V : XOP { bit hasVEX_4V = 1; }
218class XOP_4VOp3 : XOP { bit hasVEX_4VOp3 = 1; }
219
Evan Cheng12c6be82007-07-31 08:04:03 +0000220class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
Andrew Trick8523b162012-02-01 23:20:51 +0000221 string AsmStr,
222 InstrItinClass itin,
223 Domain d = GenericDomain>
Evan Cheng12c6be82007-07-31 08:04:03 +0000224 : Instruction {
225 let Namespace = "X86";
226
227 bits<8> Opcode = opcod;
228 Format Form = f;
Craig Topper56f0ed812014-02-19 08:25:02 +0000229 bits<7> FormBits = Form.Value;
Evan Cheng12c6be82007-07-31 08:04:03 +0000230 ImmType ImmT = i;
Evan Cheng12c6be82007-07-31 08:04:03 +0000231
232 dag OutOperandList = outs;
233 dag InOperandList = ins;
234 string AsmString = AsmStr;
235
Chris Lattner7ff33462010-10-31 19:22:57 +0000236 // If this is a pseudo instruction, mark it isCodeGenOnly.
237 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
238
Andrew Trick8523b162012-02-01 23:20:51 +0000239 let Itinerary = itin;
240
Evan Cheng12c6be82007-07-31 08:04:03 +0000241 //
242 // Attributes specific to X86 instructions...
243 //
Craig Topper3484fc22014-01-05 04:17:28 +0000244 bit ForceDisassemble = 0; // Force instruction to disassemble even though it's
245 // isCodeGenonly. Needed to hide an ambiguous
246 // AsmString from the parser, but still disassemble.
247
Craig Topperfa6298a2014-02-02 09:25:09 +0000248 OperandSize OpSize = OpSizeFixed; // Does this instruction's encoding change
Craig Topperb86338f2014-12-24 06:05:22 +0000249 // based on operand size of the mode?
Craig Toppere413b622014-02-26 06:01:21 +0000250 bits<2> OpSizeBits = OpSize.Value;
Craig Topperb86338f2014-12-24 06:05:22 +0000251 AddressSize AdSize = AdSizeX; // Does this instruction's encoding change
252 // based on address size of the mode?
253 bits<2> AdSizeBits = AdSize.Value;
Evan Cheng12c6be82007-07-31 08:04:03 +0000254
Craig Topper10243c82014-01-31 08:47:06 +0000255 Prefix OpPrefix = NoPrfx; // Which prefix byte does this inst have?
Craig Toppere413b622014-02-26 06:01:21 +0000256 bits<3> OpPrefixBits = OpPrefix.Value;
Craig Topper10243c82014-01-31 08:47:06 +0000257 Map OpMap = OB; // Which opcode map does this inst have?
Craig Toppere413b622014-02-26 06:01:21 +0000258 bits<3> OpMapBits = OpMap.Value;
Eric Christopher3a8ae232010-11-30 09:11:54 +0000259 bit hasREX_WPrefix = 0; // Does this inst require the REX.W prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000260 FPFormat FPForm = NotFP; // What flavor of FP instruction is this?
Dan Gohmana21bdda2008-08-20 13:46:21 +0000261 bit hasLockPrefix = 0; // Does this inst have a 0xF0 prefix?
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000262 Domain ExeDomain = d;
Craig Topperec688662014-01-31 07:00:55 +0000263 bit hasREPPrefix = 0; // Does this inst have a REP prefix?
Craig Topperd402df32014-02-02 07:08:01 +0000264 Encoding OpEnc = EncNormal; // Encoding used by this instruction
Craig Toppere413b622014-02-26 06:01:21 +0000265 bits<2> OpEncBits = OpEnc.Value;
Bruno Cardoso Lopes05166742010-07-01 01:20:06 +0000266 bit hasVEX_WPrefix = 0; // Does this inst set the VEX_W field?
Craig Topperd402df32014-02-02 07:08:01 +0000267 bit hasVEX_4V = 0; // Does this inst require the VEX.VVVV field?
268 bit hasVEX_4VOp3 = 0; // Does this inst require the VEX.VVVV field to
269 // encode the third operand?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000270 bit hasVEX_i8ImmReg = 0; // Does this inst require the last source register
Bruno Cardoso Lopese2bd0582010-07-06 22:36:24 +0000271 // to be encoded in a immediate field?
Eric Christopher3a8ae232010-11-30 09:11:54 +0000272 bit hasVEX_L = 0; // Does this inst use large (256-bit) registers?
Craig Topperf18c8962011-10-04 06:30:42 +0000273 bit ignoresVEX_L = 0; // Does this instruction ignore the L-bit
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000274 bit hasEVEX_K = 0; // Does this inst require masking?
275 bit hasEVEX_Z = 0; // Does this inst set the EVEX_Z field?
276 bit hasEVEX_L2 = 0; // Does this inst set the EVEX_L2 field?
277 bit hasEVEX_B = 0; // Does this inst set the EVEX_B field?
Adam Nemet4c339ab2014-07-17 17:04:52 +0000278 bits<3> CD8_Form = 0; // Compressed disp8 form - vector-width.
Adam Nemet4dc92b92014-07-17 17:04:34 +0000279 // Declare it int rather than bits<4> so that all bits are defined when
280 // assigning to bits<7>.
281 int CD8_EltSize = 0; // Compressed disp8 form - element-size in bytes.
Chris Lattner45270db2010-10-03 18:08:05 +0000282 bit has3DNow0F0FOpcode =0;// Wacky 3dNow! encoding?
Craig Toppercd93de92011-12-30 04:48:54 +0000283 bit hasMemOp4Prefix = 0; // Same bit as VEX_W, but used for swapping operands
Elena Demikhovskyb19c9dc2014-01-13 12:55:03 +0000284 bit hasEVEX_RC = 0; // Explicitly specified rounding control in FP instruction.
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000285
Adam Nemet4dc92b92014-07-17 17:04:34 +0000286 bits<2> EVEX_LL;
287 let EVEX_LL{0} = hasVEX_L;
288 let EVEX_LL{1} = hasEVEX_L2;
289 // Vector size in bytes.
290 bits<7> VectSize = !shl(16, EVEX_LL);
291
292 // The scaling factor for AVX512's compressed displacement is either
293 // - the size of a power-of-two number of elements or
294 // - the size of a single element for broadcasts or
295 // - the total vector size divided by a power-of-two number.
296 // Possible values are: 0 (non-AVX512 inst), 1, 2, 4, 8, 16, 32 and 64.
297 bits<7> CD8_Scale = !if (!eq (OpEnc.Value, EncEVEX.Value),
Adam Nemet4c339ab2014-07-17 17:04:52 +0000298 !if (CD8_Form{2},
299 !shl(CD8_EltSize, CD8_Form{1-0}),
Adam Nemet4dc92b92014-07-17 17:04:34 +0000300 !if (hasEVEX_B,
301 CD8_EltSize,
Adam Nemet4c339ab2014-07-17 17:04:52 +0000302 !srl(VectSize, CD8_Form{1-0}))), 0);
Adam Nemet4dc92b92014-07-17 17:04:34 +0000303
Craig Topperb86338f2014-12-24 06:05:22 +0000304 // TSFlags layout should be kept in sync with X86BaseInfo.h.
Craig Topper56f0ed812014-02-19 08:25:02 +0000305 let TSFlags{6-0} = FormBits;
Craig Toppere413b622014-02-26 06:01:21 +0000306 let TSFlags{8-7} = OpSizeBits;
Craig Topperb86338f2014-12-24 06:05:22 +0000307 let TSFlags{10-9} = AdSizeBits;
308 let TSFlags{13-11} = OpPrefixBits;
309 let TSFlags{16-14} = OpMapBits;
310 let TSFlags{17} = hasREX_WPrefix;
311 let TSFlags{21-18} = ImmT.Value;
312 let TSFlags{24-22} = FPForm.Value;
313 let TSFlags{25} = hasLockPrefix;
314 let TSFlags{26} = hasREPPrefix;
315 let TSFlags{28-27} = ExeDomain.Value;
316 let TSFlags{30-29} = OpEncBits;
317 let TSFlags{38-31} = Opcode;
318 let TSFlags{39} = hasVEX_WPrefix;
319 let TSFlags{40} = hasVEX_4V;
320 let TSFlags{41} = hasVEX_4VOp3;
321 let TSFlags{42} = hasVEX_i8ImmReg;
322 let TSFlags{43} = hasVEX_L;
323 let TSFlags{44} = ignoresVEX_L;
324 let TSFlags{45} = hasEVEX_K;
325 let TSFlags{46} = hasEVEX_Z;
326 let TSFlags{47} = hasEVEX_L2;
327 let TSFlags{48} = hasEVEX_B;
Adam Nemet54adb0f2014-07-17 17:04:50 +0000328 // If we run out of TSFlags bits, it's possible to encode this in 3 bits.
Craig Topperb86338f2014-12-24 06:05:22 +0000329 let TSFlags{55-49} = CD8_Scale;
330 let TSFlags{56} = has3DNow0F0FOpcode;
331 let TSFlags{57} = hasMemOp4Prefix;
332 let TSFlags{58} = hasEVEX_RC;
Evan Cheng12c6be82007-07-31 08:04:03 +0000333}
334
Eric Christopheref62f572010-11-30 08:57:23 +0000335class PseudoI<dag oops, dag iops, list<dag> pattern>
Andrew Trick8523b162012-02-01 23:20:51 +0000336 : X86Inst<0, Pseudo, NoImm, oops, iops, "", NoItinerary> {
Eric Christopheref62f572010-11-30 08:57:23 +0000337 let Pattern = pattern;
338}
339
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000340class I<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000341 list<dag> pattern, InstrItinClass itin = NoItinerary,
Andrew Trick8523b162012-02-01 23:20:51 +0000342 Domain d = GenericDomain>
343 : X86Inst<o, f, NoImm, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000344 let Pattern = pattern;
345 let CodeSize = 3;
346}
Michael Liao5bf95782014-12-04 05:20:33 +0000347class Ii8 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000348 list<dag> pattern, InstrItinClass itin = NoItinerary,
Andrew Trick8523b162012-02-01 23:20:51 +0000349 Domain d = GenericDomain>
350 : X86Inst<o, f, Imm8, outs, ins, asm, itin, d> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000351 let Pattern = pattern;
352 let CodeSize = 3;
353}
Michael Liao5bf95782014-12-04 05:20:33 +0000354class Ii8PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000355 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000356 : X86Inst<o, f, Imm8PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000357 let Pattern = pattern;
358 let CodeSize = 3;
359}
Michael Liao5bf95782014-12-04 05:20:33 +0000360class Ii16<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000361 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000362 : X86Inst<o, f, Imm16, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000363 let Pattern = pattern;
364 let CodeSize = 3;
365}
Michael Liao5bf95782014-12-04 05:20:33 +0000366class Ii32<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000367 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000368 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Evan Cheng12c6be82007-07-31 08:04:03 +0000369 let Pattern = pattern;
370 let CodeSize = 3;
371}
David Woodhouse0b6c9492014-01-30 22:20:41 +0000372class Ii32S<bits<8> o, Format f, dag outs, dag ins, string asm,
373 list<dag> pattern, InstrItinClass itin = NoItinerary>
374 : X86Inst<o, f, Imm32S, outs, ins, asm, itin> {
375 let Pattern = pattern;
376 let CodeSize = 3;
377}
Evan Cheng12c6be82007-07-31 08:04:03 +0000378
Michael Liao5bf95782014-12-04 05:20:33 +0000379class Ii16PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000380 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000381 : X86Inst<o, f, Imm16PCRel, outs, ins, asm, itin> {
Chris Lattnerac588122010-07-07 22:27:31 +0000382 let Pattern = pattern;
383 let CodeSize = 3;
384}
385
Michael Liao5bf95782014-12-04 05:20:33 +0000386class Ii32PCRel<bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000387 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000388 : X86Inst<o, f, Imm32PCRel, outs, ins, asm, itin> {
Chris Lattner12455ca2010-02-12 22:27:07 +0000389 let Pattern = pattern;
390 let CodeSize = 3;
391}
392
Evan Cheng12c6be82007-07-31 08:04:03 +0000393// FPStack Instruction Templates:
394// FPI - Floating Point Instruction template.
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000395class FPI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000396 InstrItinClass itin = NoItinerary>
Preston Gurdfa3f6cb2012-05-02 16:03:35 +0000397 : I<o, F, outs, ins, asm, [], itin> {}
Evan Cheng12c6be82007-07-31 08:04:03 +0000398
Bob Wilsona967c422010-08-26 18:08:11 +0000399// FpI_ - Floating Point Pseudo Instruction template. Not Predicated.
Andrew Trick8523b162012-02-01 23:20:51 +0000400class FpI_<dag outs, dag ins, FPFormat fp, list<dag> pattern,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000401 InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000402 : X86Inst<0, Pseudo, NoImm, outs, ins, "", itin> {
Jakob Stoklund Olesenf8d7eda2010-03-25 18:52:01 +0000403 let FPForm = fp;
Evan Cheng12c6be82007-07-31 08:04:03 +0000404 let Pattern = pattern;
405}
406
Sean Callanan050e0cd2009-09-15 00:35:17 +0000407// Templates for instructions that use a 16- or 32-bit segmented address as
408// their only operand: lcall (FAR CALL) and ljmp (FAR JMP)
409//
410// Iseg16 - 16-bit segment selector, 16-bit offset
411// Iseg32 - 16-bit segment selector, 32-bit offset
412
Michael Liao5bf95782014-12-04 05:20:33 +0000413class Iseg16 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000414 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000415 : X86Inst<o, f, Imm16, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000416 let Pattern = pattern;
417 let CodeSize = 3;
418}
419
Michael Liao5bf95782014-12-04 05:20:33 +0000420class Iseg32 <bits<8> o, Format f, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000421 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000422 : X86Inst<o, f, Imm32, outs, ins, asm, itin> {
Sean Callanan050e0cd2009-09-15 00:35:17 +0000423 let Pattern = pattern;
424 let CodeSize = 3;
425}
426
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000427// SI - SSE 1 & 2 scalar instructions
Andrew Trick8523b162012-02-01 23:20:51 +0000428class SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Chandler Carruth4d31f582015-02-04 10:58:53 +0000429 list<dag> pattern, InstrItinClass itin = NoItinerary,
430 Domain d = GenericDomain>
431 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000432 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
433 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX],
434 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
435 !if(!eq(OpPrefix.Value, XD.Value), [UseSSE2],
436 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000437 [UseSSE1])))));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000438
439 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000440 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
441 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
442 asm));
Bruno Cardoso Lopes6b98f712010-06-17 23:05:30 +0000443}
444
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000445// SIi8 - SSE 1 & 2 scalar instructions
446class SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000447 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000448 : Ii8<o, F, outs, ins, asm, pattern, itin> {
Craig Topperd402df32014-02-02 07:08:01 +0000449 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
450 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX],
451 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1],
Craig Topper10243c82014-01-31 08:47:06 +0000452 [UseSSE2])));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000453
454 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000455 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
456 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
457 asm));
Bruno Cardoso Lopes191a1cd2010-06-24 00:32:06 +0000458}
459
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000460// PI - SSE 1 & 2 packed instructions
461class PI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
Andrew Trick8523b162012-02-01 23:20:51 +0000462 InstrItinClass itin, Domain d>
463 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000464 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
465 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
466 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000467 [UseSSE1])));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000468
469 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000470 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
471 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
472 asm));
Bruno Cardoso Lopes2bfad412010-06-18 23:13:35 +0000473}
474
Michael Liaobbd10792012-08-30 16:54:46 +0000475// MMXPI - SSE 1 & 2 packed instructions with MMX operands
476class MMXPI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern,
477 InstrItinClass itin, Domain d>
478 : I<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000479 let Predicates = !if(!eq(OpPrefix.Value, PD.Value), [HasSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000480 [HasSSE1]);
Michael Liaobbd10792012-08-30 16:54:46 +0000481}
482
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000483// PIi8 - SSE 1 & 2 packed instructions with immediate
484class PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Andrew Trick8523b162012-02-01 23:20:51 +0000485 list<dag> pattern, InstrItinClass itin, Domain d>
486 : Ii8<o, F, outs, ins, asm, pattern, itin, d> {
Craig Topperd402df32014-02-02 07:08:01 +0000487 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512],
488 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX],
489 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2],
Craig Topper10243c82014-01-31 08:47:06 +0000490 [UseSSE1])));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000491
492 // AVX instructions have a 'v' prefix in the mnemonic
Craig Topperd402df32014-02-02 07:08:01 +0000493 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm),
494 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm),
495 asm));
Bruno Cardoso Lopes1e13c172010-06-22 23:37:59 +0000496}
497
Evan Cheng12c6be82007-07-31 08:04:03 +0000498// SSE1 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000499//
Evan Cheng12c6be82007-07-31 08:04:03 +0000500// SSI - SSE1 instructions with XS prefix.
Craig Topper5ccb6172014-02-18 00:21:49 +0000501// PSI - SSE1 instructions with PS prefix.
502// PSIi8 - SSE1 instructions with ImmT == Imm8 and PS prefix.
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000503// VSSI - SSE1 instructions with XS prefix in AVX form.
Craig Topper5ccb6172014-02-18 00:21:49 +0000504// VPSI - SSE1 instructions with PS prefix in AVX form, packed single.
Evan Cheng12c6be82007-07-31 08:04:03 +0000505
Andrew Trick8523b162012-02-01 23:20:51 +0000506class SSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000507 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000508 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000509class SSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000510 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000511 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE1]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000512class PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000513 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000514 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, PS,
Michael Liaobbd10792012-08-30 16:54:46 +0000515 Requires<[UseSSE1]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000516class PSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000517 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000518 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, PS,
Michael Liaobbd10792012-08-30 16:54:46 +0000519 Requires<[UseSSE1]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000520class VSSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000521 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000522 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000523 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000524class VPSI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000525 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000526 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin, SSEPackedSingle>, PS,
Bruno Cardoso Lopes77a3c442010-07-13 00:38:47 +0000527 Requires<[HasAVX]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000528
529// SSE2 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000530//
Bill Wendling76105a42008-08-27 21:32:04 +0000531// SDI - SSE2 instructions with XD prefix.
532// SDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix.
Craig Topperf881d382012-07-30 02:14:02 +0000533// S2SI - SSE2 instructions with XS prefix.
Bill Wendling76105a42008-08-27 21:32:04 +0000534// SSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix.
Craig Topperae11aed2014-01-14 07:41:20 +0000535// PDI - SSE2 instructions with PD prefix, packed double domain.
536// PDIi8 - SSE2 instructions with ImmT == Imm8 and PD prefix.
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000537// VSDI - SSE2 scalar instructions with XD prefix in AVX form.
Craig Topperae11aed2014-01-14 07:41:20 +0000538// VPDI - SSE2 vector instructions with PD prefix in AVX form,
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000539// packed double domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000540// VS2I - SSE2 scalar instructions with PD prefix in AVX form.
541// S2I - SSE2 scalar instructions with PD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000542// MMXSDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix as well as
543// MMX operands.
544// MMXSSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix as well as
545// MMX operands.
Evan Cheng12c6be82007-07-31 08:04:03 +0000546
Andrew Trick8523b162012-02-01 23:20:51 +0000547class SDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000548 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000549 : I<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Evan Cheng01c7c192007-12-20 19:57:09 +0000550class SDIi8<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>
Michael Liaobbd10792012-08-30 16:54:46 +0000552 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000553class S2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000554 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000555 : I<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[UseSSE2]>;
Craig Topperf881d382012-07-30 02:14:02 +0000556class S2SIi8<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>
Michael Liaobbd10792012-08-30 16:54:46 +0000558 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE2]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000559class PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000560 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000561 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000562 Requires<[UseSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000563class PDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000564 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000565 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000566 Requires<[UseSSE2]>;
Bruno Cardoso Lopesc2f87b72010-06-08 22:51:23 +0000567class VSDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000568 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000569 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XD,
Elena Demikhovsky3ce8dbb2013-08-18 13:08:57 +0000570 Requires<[UseAVX]>;
Craig Topperf881d382012-07-30 02:14:02 +0000571class VS2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000572 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperf881d382012-07-30 02:14:02 +0000573 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, XS,
574 Requires<[HasAVX]>;
Bruno Cardoso Lopesb06f54b2010-06-12 01:23:26 +0000575class VPDI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000576 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000577 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin, SSEPackedDouble>,
578 PD, Requires<[HasAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000579class VS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
580 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000581 : I<o, F, outs, ins, !strconcat("v", asm), pattern, itin>, PD,
582 Requires<[UseAVX]>;
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000583class S2I<bits<8> o, Format F, dag outs, dag ins, string asm,
584 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000585 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[UseSSE2]>;
Michael Liaobbd10792012-08-30 16:54:46 +0000586class MMXSDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000587 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000588 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasSSE2]>;
589class MMXS2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000590 list<dag> pattern, InstrItinClass itin = NoItinerary>
Michael Liaobbd10792012-08-30 16:54:46 +0000591 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[HasSSE2]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000592
593// SSE3 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000594//
Craig Topperae11aed2014-01-14 07:41:20 +0000595// S3I - SSE3 instructions with PD prefixes.
Evan Cheng12c6be82007-07-31 08:04:03 +0000596// S3SI - SSE3 instructions with XS prefix.
597// S3DI - SSE3 instructions with XD prefix.
598
Michael Liao5bf95782014-12-04 05:20:33 +0000599class S3SI<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000601 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, XS,
Michael Liaobbd10792012-08-30 16:54:46 +0000602 Requires<[UseSSE3]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000603class S3DI<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000605 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, XD,
Michael Liaobbd10792012-08-30 16:54:46 +0000606 Requires<[UseSSE3]>;
Andrew Trick8523b162012-02-01 23:20:51 +0000607class S3I<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000609 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000610 Requires<[UseSSE3]>;
Evan Cheng12c6be82007-07-31 08:04:03 +0000611
612
Nate Begeman8ef50212008-02-12 22:51:28 +0000613// SSSE3 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000614//
Nate Begeman8ef50212008-02-12 22:51:28 +0000615// SS38I - SSSE3 instructions with T8 prefix.
616// SS3AI - SSSE3 instructions with TA prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000617// MMXSS38I - SSSE3 instructions with T8 prefix and MMX operands.
618// MMXSS3AI - SSSE3 instructions with TA prefix and MMX operands.
Nate Begeman8ef50212008-02-12 22:51:28 +0000619//
620// Note: SSSE3 instructions have 64-bit and 128-bit versions. The 64-bit version
Craig Topper744f6312012-01-09 00:11:29 +0000621// uses the MMX registers. The 64-bit versions are grouped with the MMX
622// classes. They need to be enabled even if AVX is enabled.
Nate Begeman8ef50212008-02-12 22:51:28 +0000623
624class SS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000625 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000626 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000627 Requires<[UseSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000628class SS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000629 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000630 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000631 Requires<[UseSSSE3]>;
632class MMXSS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000633 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper87557402014-02-18 08:24:22 +0000634 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PS,
Michael Liaobbd10792012-08-30 16:54:46 +0000635 Requires<[HasSSSE3]>;
636class MMXSS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000637 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper87557402014-02-18 08:24:22 +0000638 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPS,
Jakob Stoklund Olesen49e121d2010-03-25 17:25:00 +0000639 Requires<[HasSSSE3]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000640
641// SSE4.1 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000642//
Nate Begeman8ef50212008-02-12 22:51:28 +0000643// SS48I - SSE 4.1 instructions with T8 prefix.
Evan Cheng96bdbd62008-03-14 07:39:27 +0000644// SS41AIi8 - SSE 4.1 instructions with TA prefix and ImmT == Imm8.
Nate Begeman8ef50212008-02-12 22:51:28 +0000645//
646class SS48I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000647 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000648 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000649 Requires<[UseSSE41]>;
Evan Cheng96bdbd62008-03-14 07:39:27 +0000650class SS4AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000651 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000652 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000653 Requires<[UseSSE41]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000654
Nate Begeman55b7bec2008-07-17 16:51:19 +0000655// SSE4.2 Instruction Templates:
Michael Liao5bf95782014-12-04 05:20:33 +0000656//
Nate Begeman55b7bec2008-07-17 16:51:19 +0000657// SS428I - SSE 4.2 instructions with T8 prefix.
658class SS428I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000659 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000660 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Michael Liaobbd10792012-08-30 16:54:46 +0000661 Requires<[UseSSE42]>;
Nate Begeman8ef50212008-02-12 22:51:28 +0000662
Craig Topper96fa5972011-10-16 16:50:08 +0000663// SS42FI - SSE 4.2 instructions with T8XD prefix.
Michael Liaobbd10792012-08-30 16:54:46 +0000664// NOTE: 'HasSSE42' is used as SS42FI is only used for CRC32 insns.
Eric Christopher7dfa9f22009-08-08 21:55:08 +0000665class SS42FI<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>
Andrew Trick8523b162012-02-01 23:20:51 +0000667 : I<o, F, outs, ins, asm, pattern, itin>, T8XD, Requires<[HasSSE42]>;
Craig Topperb9109842012-01-01 19:51:58 +0000668
Eric Christopher9fe912d2009-08-18 22:50:32 +0000669// SS42AI = SSE 4.2 instructions with TA prefix
670class SS42AI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000671 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000672 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Michael Liaobbd10792012-08-30 16:54:46 +0000673 Requires<[UseSSE42]>;
Eric Christopher9fe912d2009-08-18 22:50:32 +0000674
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000675// AVX Instruction Templates:
676// Instructions introduced in AVX (no SSE equivalent forms)
677//
Craig Topperae11aed2014-01-14 07:41:20 +0000678// AVX8I - AVX instructions with T8PD prefix.
679// AVXAIi8 - AVX instructions with TAPD prefix and ImmT = Imm8.
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000680class AVX8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000681 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000682 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000683 Requires<[HasAVX]>;
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000684class AVXAIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000685 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000686 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Bruno Cardoso Lopes3b505842010-07-20 19:44:51 +0000687 Requires<[HasAVX]>;
Bruno Cardoso Lopes14c5fd42010-07-20 00:11:13 +0000688
Craig Topper05d1cb92011-11-06 06:12:20 +0000689// AVX2 Instruction Templates:
690// Instructions introduced in AVX2 (no SSE equivalent forms)
691//
Craig Topperae11aed2014-01-14 07:41:20 +0000692// AVX28I - AVX2 instructions with T8PD prefix.
693// AVX2AIi8 - AVX2 instructions with TAPD prefix and ImmT = Imm8.
Craig Topper05d1cb92011-11-06 06:12:20 +0000694class AVX28I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000695 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000696 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000697 Requires<[HasAVX2]>;
Craig Topperf01f1b52011-11-06 23:04:08 +0000698class AVX2AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000699 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000700 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topper05d1cb92011-11-06 06:12:20 +0000701 Requires<[HasAVX2]>;
702
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000703
704// AVX-512 Instruction Templates:
705// Instructions introduced in AVX-512 (no SSE equivalent forms)
706//
Craig Topperae11aed2014-01-14 07:41:20 +0000707// AVX5128I - AVX-512 instructions with T8PD prefix.
708// AVX512AIi8 - AVX-512 instructions with TAPD prefix and ImmT = Imm8.
709// AVX512PDI - AVX-512 instructions with PD, double packed.
Craig Topper5ccb6172014-02-18 00:21:49 +0000710// AVX512PSI - AVX-512 instructions with PS, single packed.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000711// AVX512XS8I - AVX-512 instructions with T8 and XS prefixes.
712// AVX512XSI - AVX-512 instructions with XS prefix, generic domain.
Craig Topperae11aed2014-01-14 07:41:20 +0000713// AVX512BI - AVX-512 instructions with PD, int packed domain.
714// AVX512SI - AVX-512 scalar instructions with PD prefix.
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000715
716class AVX5128I<bits<8> o, Format F, dag outs, dag ins, string asm,
717 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000718 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000719 Requires<[HasAVX512]>;
Cameron McInally5fb084e2014-12-11 17:13:05 +0000720class AVX5128IBase : T8PD {
721 Domain ExeDomain = SSEPackedInt;
722}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000723class AVX512XS8I<bits<8> o, Format F, dag outs, dag ins, string asm,
724 list<dag> pattern, InstrItinClass itin = NoItinerary>
725 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8XS,
726 Requires<[HasAVX512]>;
727class AVX512XSI<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>, XS,
730 Requires<[HasAVX512]>;
731class AVX512XDI<bits<8> o, Format F, dag outs, dag ins, string asm,
732 list<dag> pattern, InstrItinClass itin = NoItinerary>
733 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, XD,
734 Requires<[HasAVX512]>;
735class AVX512BI<bits<8> o, Format F, dag outs, dag ins, string asm,
736 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000737 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000738 Requires<[HasAVX512]>;
Robert Khasanov44241442014-10-08 14:37:45 +0000739class AVX512BIBase : PD {
740 Domain ExeDomain = SSEPackedInt;
741}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000742class AVX512BIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
743 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000744 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, PD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000745 Requires<[HasAVX512]>;
Cameron McInally04400442014-11-14 15:43:00 +0000746class AVX512BIi8Base : PD {
747 Domain ExeDomain = SSEPackedInt;
748 ImmType ImmT = Imm8;
749}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000750class AVX512AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
751 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000752 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000753 Requires<[HasAVX512]>;
Adam Nemet2e91ee52014-08-14 17:13:19 +0000754class AVX512AIi8Base : TAPD {
Adam Nemet2e2537f2014-08-07 17:53:55 +0000755 Domain ExeDomain = SSEPackedInt;
756 ImmType ImmT = Imm8;
757}
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000758class AVX512Ii8<bits<8> o, Format F, dag outs, dag ins, string asm,
759 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000760 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>,
Craig Topperae11aed2014-01-14 07:41:20 +0000761 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000762class AVX512PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
763 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000764 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>, PD,
765 Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000766class AVX512PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
767 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000768 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedSingle>, PS,
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000769 Requires<[HasAVX512]>;
770class AVX512PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
771 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000772 : Ii8<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000773class AVX512PI<bits<8> o, Format F, dag outs, dag ins, string asm,
774 list<dag> pattern, Domain d, InstrItinClass itin = NoItinerary>
Craig Topperda7160d2014-02-01 08:17:56 +0000775 : I<o, F, outs, ins, asm, pattern, itin, d>, Requires<[HasAVX512]>;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000776class AVX512FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
777 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000778 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
779 EVEX_4V, Requires<[HasAVX512]>;
Adam Nemet2e91ee52014-08-14 17:13:19 +0000780class AVX512FMA3Base : T8PD, EVEX_4V;
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000781
Adam Nemet2e2537f2014-08-07 17:53:55 +0000782class AVX512<bits<8> o, Format F, dag outs, dag ins, string asm,
783 list<dag>pattern, InstrItinClass itin = NoItinerary>
784 : I<o, F, outs, ins, asm, pattern, itin>, Requires<[HasAVX512]>;
785
Eric Christopher2ef63182010-04-02 21:54:27 +0000786// AES Instruction Templates:
787//
788// AES8I
Eric Christopher1290fa02010-04-05 21:14:32 +0000789// These use the same encoding as the SSE4.2 T8 and TA encodings.
Eric Christopher2ef63182010-04-02 21:54:27 +0000790class AES8I<bits<8> o, Format F, dag outs, dag ins, string asm,
Preston Gurd3fe264d2013-09-13 19:23:28 +0000791 list<dag>pattern, InstrItinClass itin = IIC_AES>
Craig Topperae11aed2014-01-14 07:41:20 +0000792 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, T8PD,
Craig Topperc0cef322012-05-01 05:35:02 +0000793 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000794
795class AESAI<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000797 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
Craig Topperc0cef322012-05-01 05:35:02 +0000798 Requires<[HasAES]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000799
Benjamin Kramera0396e42012-05-31 14:34:17 +0000800// PCLMUL Instruction Templates
801class PCLMULIi8<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000803 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
804 Requires<[HasPCLMUL]>;
Eli Friedman415412e2011-07-05 18:21:20 +0000805
Benjamin Kramera0396e42012-05-31 14:34:17 +0000806class AVXPCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000807 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000808 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
809 VEX_4V, Requires<[HasAVX, HasPCLMUL]>;
Bruno Cardoso Lopesea0e05a2010-07-23 18:41:12 +0000810
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000811// FMA3 Instruction Templates
812class FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000813 list<dag>pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000814 : I<o, F, outs, ins, asm, pattern, itin>, T8PD,
815 VEX_4V, FMASC, Requires<[HasFMA]>;
Bruno Cardoso Lopesacd92302010-07-23 00:54:35 +0000816
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000817// FMA4 Instruction Templates
818class FMA4<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000820 : Ii8<o, F, outs, ins, asm, pattern, itin>, TAPD,
821 VEX_4V, VEX_I8IMM, FMASC, Requires<[HasFMA4]>;
Bruno Cardoso Lopes0f9a1f52011-11-25 19:33:42 +0000822
Jan Sjödin7c0face2011-12-12 19:37:49 +0000823// XOP 2, 3 and 4 Operand Instruction Template
824class IXOP<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 : I<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Craig Topperd402df32014-02-02 07:08:01 +0000827 XOP9, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000828
829// XOP 2, 3 and 4 Operand Instruction Templates with imm byte
830class IXOPi8<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 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedDouble>,
Craig Topperd402df32014-02-02 07:08:01 +0000833 XOP8, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000834
835// XOP 5 operand instruction (VEX encoding!)
836class IXOP5<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>
Craig Topperae11aed2014-01-14 07:41:20 +0000838 : Ii8<o, F, outs, ins, asm, pattern, itin, SSEPackedInt>, TAPD,
839 VEX_4V, VEX_I8IMM, Requires<[HasXOP]>;
Jan Sjödin7c0face2011-12-12 19:37:49 +0000840
Evan Cheng12c6be82007-07-31 08:04:03 +0000841// X86-64 Instruction templates...
842//
843
Andrew Trick8523b162012-02-01 23:20:51 +0000844class RI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000845 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000846 : I<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000847class RIi8 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000848 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000849 : Ii8<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse4e033b02014-01-13 14:05:59 +0000850class RIi16 <bits<8> o, Format F, dag outs, dag ins, string asm,
851 list<dag> pattern, InstrItinClass itin = NoItinerary>
852 : Ii16<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000853class RIi32 <bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000854 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000855 : Ii32<o, F, outs, ins, asm, pattern, itin>, REX_W;
David Woodhouse0b6c9492014-01-30 22:20:41 +0000856class RIi32S <bits<8> o, Format F, dag outs, dag ins, string asm,
857 list<dag> pattern, InstrItinClass itin = NoItinerary>
858 : Ii32S<o, F, outs, ins, asm, pattern, itin>, REX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000859
860class RIi64<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 : X86Inst<o, f, Imm64, outs, ins, asm, itin>, REX_W {
Evan Cheng12c6be82007-07-31 08:04:03 +0000863 let Pattern = pattern;
864 let CodeSize = 3;
865}
866
Kevin Enderby285da022013-07-22 21:25:31 +0000867class RIi64_NOREX<bits<8> o, Format f, dag outs, dag ins, string asm,
868 list<dag> pattern, InstrItinClass itin = NoItinerary>
869 : X86Inst<o, f, Imm64, outs, ins, asm, itin> {
870 let Pattern = pattern;
871 let CodeSize = 3;
872}
873
Elena Demikhovsky89703c02013-06-09 07:37:10 +0000874class RS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
875 list<dag> pattern, InstrItinClass itin = NoItinerary>
876 : S2I<o, F, outs, ins, asm, pattern, itin>, REX_W;
877class VRS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
878 list<dag> pattern, InstrItinClass itin = NoItinerary>
879 : VS2I<o, F, outs, ins, asm, pattern, itin>, VEX_W;
Evan Cheng12c6be82007-07-31 08:04:03 +0000880
881// MMX Instruction templates
882//
883
884// MMXI - MMX instructions with TB prefix.
Craig Topperbc749db2013-10-09 02:18:34 +0000885// MMXI32 - MMX instructions with TB prefix valid only in 32 bit mode.
Anton Korobeynikov31099512008-08-23 15:53:19 +0000886// MMXI64 - MMX instructions with TB prefix valid only in 64 bit mode.
Craig Topperae11aed2014-01-14 07:41:20 +0000887// MMX2I - MMX / SSE2 instructions with PD prefix.
Craig Topper5ccb6172014-02-18 00:21:49 +0000888// MMXIi8 - MMX instructions with ImmT == Imm8 and PS prefix.
889// MMXIi8 - MMX instructions with ImmT == Imm8 and PS prefix.
Evan Cheng12c6be82007-07-31 08:04:03 +0000890// MMXID - MMX instructions with XD prefix.
891// MMXIS - MMX instructions with XS prefix.
Michael Liao5bf95782014-12-04 05:20:33 +0000892class MMXI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000893 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000894 : I<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000895class MMXI32<bits<8> o, Format F, dag outs, dag ins, string asm,
Craig Topperbc749db2013-10-09 02:18:34 +0000896 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000897 : I<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX,Not64BitMode]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000898class MMXI64<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000899 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000900 : I<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX,In64BitMode]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000901class MMXRI<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000902 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000903 : I<o, F, outs, ins, asm, pattern, itin>, PS, REX_W, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000904class MMX2I<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000905 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topperae11aed2014-01-14 07:41:20 +0000906 : I<o, F, outs, ins, asm, pattern, itin>, PD, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000907class MMXIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000908 list<dag> pattern, InstrItinClass itin = NoItinerary>
Craig Topper5ccb6172014-02-18 00:21:49 +0000909 : Ii8<o, F, outs, ins, asm, pattern, itin>, PS, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000910class MMXID<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000911 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000912 : Ii8<o, F, outs, ins, asm, pattern, itin>, XD, Requires<[HasMMX]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000913class MMXIS<bits<8> o, Format F, dag outs, dag ins, string asm,
Jakob Stoklund Olesen4d39e812013-03-25 23:12:41 +0000914 list<dag> pattern, InstrItinClass itin = NoItinerary>
Andrew Trick8523b162012-02-01 23:20:51 +0000915 : Ii8<o, F, outs, ins, asm, pattern, itin>, XS, Requires<[HasMMX]>;