xref: /freebsd/contrib/llvm-project/llvm/lib/Target/X86/X86Schedule.td (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
1//===-- X86Schedule.td - X86 Scheduling Definitions --------*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10// InstrSchedModel annotations for out-of-order CPUs.
11
12// Instructions with folded loads need to read the memory operand immediately,
13// but other register operands don't have to be read until the load is ready.
14// These operands are marked with ReadAfterLd.
15def ReadAfterLd : SchedRead;
16def ReadAfterVecLd : SchedRead;
17def ReadAfterVecXLd : SchedRead;
18def ReadAfterVecYLd : SchedRead;
19
20// Instructions that move data between general purpose registers and vector
21// registers may be subject to extra latency due to data bypass delays.
22// This SchedRead describes a bypass delay caused by data being moved from the
23// integer unit to the floating point unit.
24def ReadInt2Fpu : SchedRead;
25
26// Instructions with both a load and a store folded are modeled as a folded
27// load + WriteRMW.
28def WriteRMW : SchedWrite;
29
30// Helper to set SchedWrite ExePorts/Latency/ResourceCycles/NumMicroOps.
31multiclass X86WriteRes<SchedWrite SchedRW,
32                       list<ProcResourceKind> ExePorts,
33                       int Lat, list<int> Res, int UOps> {
34  def : WriteRes<SchedRW, ExePorts> {
35    let Latency = Lat;
36    let ResourceCycles = Res;
37    let NumMicroOps = UOps;
38  }
39}
40
41// Most instructions can fold loads, so almost every SchedWrite comes in two
42// variants: With and without a folded load.
43// An X86FoldableSchedWrite holds a reference to the corresponding SchedWrite
44// with a folded load.
45class X86FoldableSchedWrite : SchedWrite {
46  // The SchedWrite to use when a load is folded into the instruction.
47  SchedWrite Folded;
48  // The SchedRead to tag register operands than don't need to be ready
49  // until the folded load has completed.
50  SchedRead ReadAfterFold;
51}
52
53// Multiclass that produces a linked pair of SchedWrites.
54multiclass X86SchedWritePair<SchedRead ReadAfter = ReadAfterLd> {
55  // Register-Memory operation.
56  def Ld : SchedWrite;
57  // Register-Register operation.
58  def NAME : X86FoldableSchedWrite {
59    let Folded = !cast<SchedWrite>(NAME#"Ld");
60    let ReadAfterFold = ReadAfter;
61  }
62}
63
64// Helpers to mark SchedWrites as unsupported.
65multiclass X86WriteResUnsupported<SchedWrite SchedRW> {
66  let Unsupported = 1 in {
67    def : WriteRes<SchedRW, []>;
68  }
69}
70multiclass X86WriteResPairUnsupported<X86FoldableSchedWrite SchedRW> {
71  let Unsupported = 1 in {
72    def : WriteRes<SchedRW, []>;
73    def : WriteRes<SchedRW.Folded, []>;
74  }
75}
76
77// Multiclass that wraps X86FoldableSchedWrite for each vector width.
78class X86SchedWriteWidths<X86FoldableSchedWrite sScl,
79                          X86FoldableSchedWrite s128,
80                          X86FoldableSchedWrite s256,
81                          X86FoldableSchedWrite s512> {
82  X86FoldableSchedWrite Scl = sScl; // Scalar float/double operations.
83  X86FoldableSchedWrite MMX = sScl; // MMX operations.
84  X86FoldableSchedWrite XMM = s128; // XMM operations.
85  X86FoldableSchedWrite YMM = s256; // YMM operations.
86  X86FoldableSchedWrite ZMM = s512; // ZMM operations.
87}
88
89// Multiclass that wraps X86SchedWriteWidths for each fp vector type.
90class X86SchedWriteSizes<X86SchedWriteWidths sPH,
91                         X86SchedWriteWidths sPS,
92                         X86SchedWriteWidths sPD> {
93  X86SchedWriteWidths PH = sPH;
94  X86SchedWriteWidths PS = sPS;
95  X86SchedWriteWidths PD = sPD;
96}
97
98// Multiclass that wraps move/load/store triple for a vector width.
99class X86SchedWriteMoveLS<SchedWrite MoveRR,
100                          SchedWrite LoadRM,
101                          SchedWrite StoreMR> {
102  SchedWrite RR = MoveRR;
103  SchedWrite RM = LoadRM;
104  SchedWrite MR = StoreMR;
105}
106
107// Multiclass that wraps masked load/store writes for a vector width.
108class X86SchedWriteMaskMove<SchedWrite LoadRM, SchedWrite StoreMR> {
109  SchedWrite RM = LoadRM;
110  SchedWrite MR = StoreMR;
111}
112
113// Multiclass that wraps X86SchedWriteMoveLS for each vector width.
114class X86SchedWriteMoveLSWidths<X86SchedWriteMoveLS sScl,
115                                X86SchedWriteMoveLS s128,
116                                X86SchedWriteMoveLS s256,
117                                X86SchedWriteMoveLS s512> {
118  X86SchedWriteMoveLS Scl = sScl; // Scalar float/double operations.
119  X86SchedWriteMoveLS MMX = sScl; // MMX operations.
120  X86SchedWriteMoveLS XMM = s128; // XMM operations.
121  X86SchedWriteMoveLS YMM = s256; // YMM operations.
122  X86SchedWriteMoveLS ZMM = s512; // ZMM operations.
123}
124
125// Loads, stores, and moves, not folded with other operations.
126def WriteLoad    : SchedWrite;
127def WriteStore   : SchedWrite;
128def WriteStoreNT : SchedWrite;
129def WriteMove    : SchedWrite;
130def WriteVecMaskedGatherWriteback : SchedWrite;
131def WriteCopy    : WriteSequence<[WriteLoad, WriteStore]>; // mem->mem copy
132
133// Arithmetic.
134defm WriteALU    : X86SchedWritePair; // Simple integer ALU op.
135defm WriteADC    : X86SchedWritePair; // Integer ALU + flags op.
136def  WriteALURMW : WriteSequence<[WriteALULd, WriteRMW]>;
137def  WriteADCRMW : WriteSequence<[WriteADCLd, WriteRMW]>;
138def  WriteLEA    : SchedWrite;        // LEA instructions can't fold loads.
139
140// Integer multiplication
141defm WriteIMul8     : X86SchedWritePair; // Integer 8-bit multiplication.
142defm WriteIMul16    : X86SchedWritePair; // Integer 16-bit multiplication.
143defm WriteIMul16Imm : X86SchedWritePair; // Integer 16-bit multiplication by immediate.
144defm WriteIMul16Reg : X86SchedWritePair; // Integer 16-bit multiplication by register.
145defm WriteIMul32    : X86SchedWritePair; // Integer 32-bit multiplication.
146defm WriteIMul32Imm : X86SchedWritePair; // Integer 32-bit multiplication by immediate.
147defm WriteIMul32Reg : X86SchedWritePair; // Integer 32-bit multiplication by register.
148defm WriteIMul64    : X86SchedWritePair; // Integer 64-bit multiplication.
149defm WriteIMul64Imm : X86SchedWritePair; // Integer 64-bit multiplication by immediate.
150defm WriteIMul64Reg : X86SchedWritePair; // Integer 64-bit multiplication by register.
151defm WriteMULX32    : X86SchedWritePair; // Integer 32-bit Multiplication without affecting flags.
152defm WriteMULX64    : X86SchedWritePair; // Integer 64-bit Multiplication without affecting flags.
153def  WriteIMulH     : SchedWrite;        // Integer multiplication, high part (only used by the RR variant of MULX).
154def  WriteIMulHLd   : SchedWrite;        // Integer multiplication, high part (only used by the RM variant of MULX).
155
156def  WriteBSWAP32 : SchedWrite; // Byte Order (Endianness) 32-bit Swap.
157def  WriteBSWAP64 : SchedWrite; // Byte Order (Endianness) 64-bit Swap.
158defm WriteCMPXCHG : X86SchedWritePair; // Compare and set, compare and swap.
159def  WriteCMPXCHGRMW : SchedWrite;     // Compare and set, compare and swap.
160def  WriteXCHG    : SchedWrite;        // Compare+Exchange - TODO RMW support.
161
162// Integer division.
163defm WriteDiv8   : X86SchedWritePair;
164defm WriteDiv16  : X86SchedWritePair;
165defm WriteDiv32  : X86SchedWritePair;
166defm WriteDiv64  : X86SchedWritePair;
167defm WriteIDiv8  : X86SchedWritePair;
168defm WriteIDiv16 : X86SchedWritePair;
169defm WriteIDiv32 : X86SchedWritePair;
170defm WriteIDiv64 : X86SchedWritePair;
171
172defm WriteBSF : X86SchedWritePair; // Bit scan forward.
173defm WriteBSR : X86SchedWritePair; // Bit scan reverse.
174defm WritePOPCNT : X86SchedWritePair; // Bit population count.
175defm WriteLZCNT : X86SchedWritePair; // Leading zero count.
176defm WriteTZCNT : X86SchedWritePair; // Trailing zero count.
177defm WriteCMOV  : X86SchedWritePair; // Conditional move.
178def  WriteFCMOV : SchedWrite; // X87 conditional move.
179def  WriteSETCC : SchedWrite; // Set register based on condition code.
180def  WriteSETCCStore : SchedWrite;
181def  WriteLAHFSAHF : SchedWrite; // Load/Store flags in AH.
182
183def  WriteBitTest      : SchedWrite; // Bit Test
184def  WriteBitTestImmLd : SchedWrite;
185def  WriteBitTestRegLd : SchedWrite;
186
187def  WriteBitTestSet       : SchedWrite; // Bit Test + Set
188def  WriteBitTestSetImmLd  : SchedWrite;
189def  WriteBitTestSetRegLd  : SchedWrite;
190def  WriteBitTestSetImmRMW : WriteSequence<[WriteBitTestSetImmLd, WriteRMW]>;
191def  WriteBitTestSetRegRMW : WriteSequence<[WriteBitTestSetRegLd, WriteRMW]>;
192
193// Integer shifts and rotates.
194defm WriteShift    : X86SchedWritePair;
195defm WriteShiftCL  : X86SchedWritePair;
196defm WriteRotate   : X86SchedWritePair;
197defm WriteRotateCL : X86SchedWritePair;
198
199// Double shift instructions.
200def  WriteSHDrri  : SchedWrite;
201def  WriteSHDrrcl : SchedWrite;
202def  WriteSHDmri  : SchedWrite;
203def  WriteSHDmrcl : SchedWrite;
204
205// BMI1 BEXTR/BLS, BMI2 BZHI
206defm WriteBEXTR : X86SchedWritePair;
207defm WriteBLS   : X86SchedWritePair;
208defm WriteBZHI  : X86SchedWritePair;
209
210// Idioms that clear a register, like xorps %xmm0, %xmm0.
211// These can often bypass execution ports completely.
212def WriteZero : SchedWrite;
213
214// Branches don't produce values, so they have no latency, but they still
215// consume resources. Indirect branches can fold loads.
216defm WriteJump : X86SchedWritePair;
217
218// Floating point. This covers both scalar and vector operations.
219def  WriteFLD0          : SchedWrite;
220def  WriteFLD1          : SchedWrite;
221def  WriteFLDC          : SchedWrite;
222def  WriteFLoad         : SchedWrite;
223def  WriteFLoadX        : SchedWrite;
224def  WriteFLoadY        : SchedWrite;
225def  WriteFMaskedLoad   : SchedWrite;
226def  WriteFMaskedLoadY  : SchedWrite;
227def  WriteFStore        : SchedWrite;
228def  WriteFStoreX       : SchedWrite;
229def  WriteFStoreY       : SchedWrite;
230def  WriteFStoreNT      : SchedWrite;
231def  WriteFStoreNTX     : SchedWrite;
232def  WriteFStoreNTY     : SchedWrite;
233
234def  WriteFMaskedStore32  : SchedWrite;
235def  WriteFMaskedStore64  : SchedWrite;
236def  WriteFMaskedStore32Y : SchedWrite;
237def  WriteFMaskedStore64Y : SchedWrite;
238
239def  WriteFMove         : SchedWrite;
240def  WriteFMoveX        : SchedWrite;
241def  WriteFMoveY        : SchedWrite;
242def  WriteFMoveZ        : SchedWrite;
243
244defm WriteFAdd    : X86SchedWritePair<ReadAfterVecLd>;  // Floating point add/sub.
245defm WriteFAddX   : X86SchedWritePair<ReadAfterVecXLd>; // Floating point add/sub (XMM).
246defm WriteFAddY   : X86SchedWritePair<ReadAfterVecYLd>; // Floating point add/sub (YMM).
247defm WriteFAddZ   : X86SchedWritePair<ReadAfterVecYLd>; // Floating point add/sub (ZMM).
248defm WriteFAdd64  : X86SchedWritePair<ReadAfterVecLd>;  // Floating point double add/sub.
249defm WriteFAdd64X : X86SchedWritePair<ReadAfterVecXLd>; // Floating point double add/sub (XMM).
250defm WriteFAdd64Y : X86SchedWritePair<ReadAfterVecYLd>; // Floating point double add/sub (YMM).
251defm WriteFAdd64Z : X86SchedWritePair<ReadAfterVecYLd>; // Floating point double add/sub (ZMM).
252defm WriteFCmp    : X86SchedWritePair<ReadAfterVecLd>;  // Floating point compare.
253defm WriteFCmpX   : X86SchedWritePair<ReadAfterVecXLd>; // Floating point compare (XMM).
254defm WriteFCmpY   : X86SchedWritePair<ReadAfterVecYLd>; // Floating point compare (YMM).
255defm WriteFCmpZ   : X86SchedWritePair<ReadAfterVecYLd>; // Floating point compare (ZMM).
256defm WriteFCmp64  : X86SchedWritePair<ReadAfterVecLd>;  // Floating point double compare.
257defm WriteFCmp64X : X86SchedWritePair<ReadAfterVecXLd>; // Floating point double compare (XMM).
258defm WriteFCmp64Y : X86SchedWritePair<ReadAfterVecYLd>; // Floating point double compare (YMM).
259defm WriteFCmp64Z : X86SchedWritePair<ReadAfterVecYLd>; // Floating point double compare (ZMM).
260defm WriteFCom    : X86SchedWritePair<ReadAfterVecLd>;  // Floating point compare to flags (X87).
261defm WriteFComX   : X86SchedWritePair<ReadAfterVecLd>;  // Floating point compare to flags (SSE).
262defm WriteFMul    : X86SchedWritePair<ReadAfterVecLd>;  // Floating point multiplication.
263defm WriteFMulX   : X86SchedWritePair<ReadAfterVecXLd>; // Floating point multiplication (XMM).
264defm WriteFMulY   : X86SchedWritePair<ReadAfterVecYLd>; // Floating point multiplication (YMM).
265defm WriteFMulZ   : X86SchedWritePair<ReadAfterVecYLd>; // Floating point multiplication (YMM).
266defm WriteFMul64  : X86SchedWritePair<ReadAfterVecLd>;  // Floating point double multiplication.
267defm WriteFMul64X : X86SchedWritePair<ReadAfterVecXLd>; // Floating point double multiplication (XMM).
268defm WriteFMul64Y : X86SchedWritePair<ReadAfterVecYLd>; // Floating point double multiplication (YMM).
269defm WriteFMul64Z : X86SchedWritePair<ReadAfterVecYLd>; // Floating point double multiplication (ZMM).
270defm WriteFDiv    : X86SchedWritePair<ReadAfterVecLd>;  // Floating point division.
271defm WriteFDivX   : X86SchedWritePair<ReadAfterVecXLd>; // Floating point division (XMM).
272defm WriteFDivY   : X86SchedWritePair<ReadAfterVecYLd>; // Floating point division (YMM).
273defm WriteFDivZ   : X86SchedWritePair<ReadAfterVecYLd>; // Floating point division (ZMM).
274defm WriteFDiv64  : X86SchedWritePair<ReadAfterVecLd>;  // Floating point double division.
275defm WriteFDiv64X : X86SchedWritePair<ReadAfterVecXLd>; // Floating point double division (XMM).
276defm WriteFDiv64Y : X86SchedWritePair<ReadAfterVecYLd>; // Floating point double division (YMM).
277defm WriteFDiv64Z : X86SchedWritePair<ReadAfterVecYLd>; // Floating point double division (ZMM).
278defm WriteFSqrt  : X86SchedWritePair<ReadAfterVecLd>;   // Floating point square root.
279defm WriteFSqrtX : X86SchedWritePair<ReadAfterVecXLd>;  // Floating point square root (XMM).
280defm WriteFSqrtY : X86SchedWritePair<ReadAfterVecYLd>;  // Floating point square root (YMM).
281defm WriteFSqrtZ : X86SchedWritePair<ReadAfterVecYLd>;  // Floating point square root (ZMM).
282defm WriteFSqrt64  : X86SchedWritePair<ReadAfterVecLd>;  // Floating point double square root.
283defm WriteFSqrt64X : X86SchedWritePair<ReadAfterVecXLd>; // Floating point double square root (XMM).
284defm WriteFSqrt64Y : X86SchedWritePair<ReadAfterVecYLd>; // Floating point double square root (YMM).
285defm WriteFSqrt64Z : X86SchedWritePair<ReadAfterVecYLd>; // Floating point double square root (ZMM).
286defm WriteFSqrt80  : X86SchedWritePair<ReadAfterVecLd>;  // Floating point long double square root.
287defm WriteFRcp   : X86SchedWritePair<ReadAfterVecLd>;  // Floating point reciprocal estimate.
288defm WriteFRcpX  : X86SchedWritePair<ReadAfterVecXLd>; // Floating point reciprocal estimate (XMM).
289defm WriteFRcpY  : X86SchedWritePair<ReadAfterVecYLd>; // Floating point reciprocal estimate (YMM).
290defm WriteFRcpZ  : X86SchedWritePair<ReadAfterVecYLd>; // Floating point reciprocal estimate (ZMM).
291defm WriteFRsqrt : X86SchedWritePair<ReadAfterVecLd>;  // Floating point reciprocal square root estimate.
292defm WriteFRsqrtX: X86SchedWritePair<ReadAfterVecXLd>; // Floating point reciprocal square root estimate (XMM).
293defm WriteFRsqrtY: X86SchedWritePair<ReadAfterVecYLd>; // Floating point reciprocal square root estimate (YMM).
294defm WriteFRsqrtZ: X86SchedWritePair<ReadAfterVecYLd>; // Floating point reciprocal square root estimate (ZMM).
295defm WriteFMA    : X86SchedWritePair<ReadAfterVecLd>;  // Fused Multiply Add.
296defm WriteFMAX   : X86SchedWritePair<ReadAfterVecXLd>; // Fused Multiply Add (XMM).
297defm WriteFMAY   : X86SchedWritePair<ReadAfterVecYLd>; // Fused Multiply Add (YMM).
298defm WriteFMAZ   : X86SchedWritePair<ReadAfterVecYLd>; // Fused Multiply Add (ZMM).
299defm WriteDPPD   : X86SchedWritePair<ReadAfterVecXLd>; // Floating point double dot product.
300defm WriteDPPS   : X86SchedWritePair<ReadAfterVecXLd>; // Floating point single dot product.
301defm WriteDPPSY  : X86SchedWritePair<ReadAfterVecYLd>; // Floating point single dot product (YMM).
302defm WriteDPPSZ  : X86SchedWritePair<ReadAfterVecYLd>; // Floating point single dot product (ZMM).
303defm WriteFSign  : X86SchedWritePair<ReadAfterVecLd>;  // Floating point fabs/fchs.
304defm WriteFRnd   : X86SchedWritePair<ReadAfterVecXLd>; // Floating point rounding.
305defm WriteFRndY  : X86SchedWritePair<ReadAfterVecYLd>; // Floating point rounding (YMM).
306defm WriteFRndZ  : X86SchedWritePair<ReadAfterVecYLd>; // Floating point rounding (ZMM).
307defm WriteFLogic  : X86SchedWritePair<ReadAfterVecXLd>; // Floating point and/or/xor logicals.
308defm WriteFLogicY : X86SchedWritePair<ReadAfterVecYLd>; // Floating point and/or/xor logicals (YMM).
309defm WriteFLogicZ : X86SchedWritePair<ReadAfterVecYLd>; // Floating point and/or/xor logicals (ZMM).
310defm WriteFTest   : X86SchedWritePair<ReadAfterVecXLd>; // Floating point TEST instructions.
311defm WriteFTestY  : X86SchedWritePair<ReadAfterVecYLd>; // Floating point TEST instructions (YMM).
312defm WriteFTestZ  : X86SchedWritePair<ReadAfterVecYLd>; // Floating point TEST instructions (ZMM).
313defm WriteFShuffle  : X86SchedWritePair<ReadAfterVecXLd>; // Floating point vector shuffles.
314defm WriteFShuffleY : X86SchedWritePair<ReadAfterVecYLd>; // Floating point vector shuffles (YMM).
315defm WriteFShuffleZ : X86SchedWritePair<ReadAfterVecYLd>; // Floating point vector shuffles (ZMM).
316defm WriteFVarShuffle  : X86SchedWritePair<ReadAfterVecXLd>; // Floating point vector variable shuffles.
317defm WriteFVarShuffleY : X86SchedWritePair<ReadAfterVecYLd>; // Floating point vector variable shuffles (YMM).
318defm WriteFVarShuffleZ : X86SchedWritePair<ReadAfterVecYLd>; // Floating point vector variable shuffles (ZMM).
319defm WriteFBlend  : X86SchedWritePair<ReadAfterVecXLd>; // Floating point vector blends.
320defm WriteFBlendY : X86SchedWritePair<ReadAfterVecYLd>; // Floating point vector blends (YMM).
321defm WriteFBlendZ : X86SchedWritePair<ReadAfterVecYLd>; // Floating point vector blends (ZMM).
322defm WriteFVarBlend  : X86SchedWritePair<ReadAfterVecXLd>; // Fp vector variable blends.
323defm WriteFVarBlendY : X86SchedWritePair<ReadAfterVecYLd>; // Fp vector variable blends (YMM).
324defm WriteFVarBlendZ : X86SchedWritePair<ReadAfterVecYLd>; // Fp vector variable blends (YMZMM).
325
326// FMA Scheduling helper class.
327class FMASC { X86FoldableSchedWrite Sched = WriteFAdd; }
328
329// Horizontal Add/Sub (float and integer)
330defm WriteFHAdd  : X86SchedWritePair<ReadAfterVecXLd>;
331defm WriteFHAddY : X86SchedWritePair<ReadAfterVecYLd>;
332defm WriteFHAddZ : X86SchedWritePair<ReadAfterVecYLd>;
333defm WritePHAdd  : X86SchedWritePair<ReadAfterVecLd>;
334defm WritePHAddX : X86SchedWritePair<ReadAfterVecXLd>;
335defm WritePHAddY : X86SchedWritePair<ReadAfterVecYLd>;
336defm WritePHAddZ : X86SchedWritePair<ReadAfterVecYLd>;
337
338// Vector integer operations.
339def  WriteVecLoad         : SchedWrite;
340def  WriteVecLoadX        : SchedWrite;
341def  WriteVecLoadY        : SchedWrite;
342def  WriteVecLoadNT       : SchedWrite;
343def  WriteVecLoadNTY      : SchedWrite;
344def  WriteVecMaskedLoad   : SchedWrite;
345def  WriteVecMaskedLoadY  : SchedWrite;
346def  WriteVecStore        : SchedWrite;
347def  WriteVecStoreX       : SchedWrite;
348def  WriteVecStoreY       : SchedWrite;
349def  WriteVecStoreNT      : SchedWrite;
350def  WriteVecStoreNTY     : SchedWrite;
351def  WriteVecMaskedStore32  : SchedWrite;
352def  WriteVecMaskedStore64  : SchedWrite;
353def  WriteVecMaskedStore32Y : SchedWrite;
354def  WriteVecMaskedStore64Y : SchedWrite;
355def  WriteVecMove         : SchedWrite;
356def  WriteVecMoveX        : SchedWrite;
357def  WriteVecMoveY        : SchedWrite;
358def  WriteVecMoveZ        : SchedWrite;
359def  WriteVecMoveToGpr    : SchedWrite;
360def  WriteVecMoveFromGpr  : SchedWrite;
361
362defm WriteVecALU    : X86SchedWritePair<ReadAfterVecLd>;  // Vector integer ALU op, no logicals.
363defm WriteVecALUX   : X86SchedWritePair<ReadAfterVecXLd>; // Vector integer ALU op, no logicals (XMM).
364defm WriteVecALUY   : X86SchedWritePair<ReadAfterVecYLd>; // Vector integer ALU op, no logicals (YMM).
365defm WriteVecALUZ   : X86SchedWritePair<ReadAfterVecYLd>; // Vector integer ALU op, no logicals (ZMM).
366defm WriteVecLogic  : X86SchedWritePair<ReadAfterVecLd>;  // Vector integer and/or/xor logicals.
367defm WriteVecLogicX : X86SchedWritePair<ReadAfterVecXLd>; // Vector integer and/or/xor logicals (XMM).
368defm WriteVecLogicY : X86SchedWritePair<ReadAfterVecYLd>; // Vector integer and/or/xor logicals (YMM).
369defm WriteVecLogicZ : X86SchedWritePair<ReadAfterVecYLd>; // Vector integer and/or/xor logicals (ZMM).
370defm WriteVecTest  : X86SchedWritePair<ReadAfterVecXLd>;  // Vector integer TEST instructions.
371defm WriteVecTestY : X86SchedWritePair<ReadAfterVecYLd>;  // Vector integer TEST instructions (YMM).
372defm WriteVecTestZ : X86SchedWritePair<ReadAfterVecYLd>;  // Vector integer TEST instructions (ZMM).
373defm WriteVecShift  : X86SchedWritePair<ReadAfterVecLd>;  // Vector integer shifts (default).
374defm WriteVecShiftX : X86SchedWritePair<ReadAfterVecXLd>; // Vector integer shifts (XMM).
375defm WriteVecShiftY : X86SchedWritePair<ReadAfterVecYLd>; // Vector integer shifts (YMM).
376defm WriteVecShiftZ : X86SchedWritePair<ReadAfterVecYLd>; // Vector integer shifts (ZMM).
377defm WriteVecShiftImm : X86SchedWritePair<ReadAfterVecLd>;  // Vector integer immediate shifts (default).
378defm WriteVecShiftImmX: X86SchedWritePair<ReadAfterVecXLd>; // Vector integer immediate shifts (XMM).
379defm WriteVecShiftImmY: X86SchedWritePair<ReadAfterVecYLd>; // Vector integer immediate shifts (YMM).
380defm WriteVecShiftImmZ: X86SchedWritePair<ReadAfterVecYLd>; // Vector integer immediate shifts (ZMM).
381defm WriteVecIMul  : X86SchedWritePair<ReadAfterVecLd>;  // Vector integer multiply (default).
382defm WriteVecIMulX : X86SchedWritePair<ReadAfterVecXLd>; // Vector integer multiply (XMM).
383defm WriteVecIMulY : X86SchedWritePair<ReadAfterVecYLd>; // Vector integer multiply (YMM).
384defm WriteVecIMulZ : X86SchedWritePair<ReadAfterVecYLd>; // Vector integer multiply (ZMM).
385defm WritePMULLD   : X86SchedWritePair<ReadAfterVecXLd>; // Vector PMULLD.
386defm WritePMULLDY  : X86SchedWritePair<ReadAfterVecYLd>; // Vector PMULLD (YMM).
387defm WritePMULLDZ  : X86SchedWritePair<ReadAfterVecYLd>; // Vector PMULLD (ZMM).
388defm WriteShuffle  : X86SchedWritePair<ReadAfterVecLd>;  // Vector shuffles.
389defm WriteShuffleX : X86SchedWritePair<ReadAfterVecXLd>; // Vector shuffles (XMM).
390defm WriteShuffleY : X86SchedWritePair<ReadAfterVecYLd>; // Vector shuffles (YMM).
391defm WriteShuffleZ : X86SchedWritePair<ReadAfterVecYLd>; // Vector shuffles (ZMM).
392defm WriteVarShuffle  : X86SchedWritePair<ReadAfterVecLd>;  // Vector variable shuffles.
393defm WriteVarShuffleX : X86SchedWritePair<ReadAfterVecXLd>; // Vector variable shuffles (XMM).
394defm WriteVarShuffleY : X86SchedWritePair<ReadAfterVecYLd>; // Vector variable shuffles (YMM).
395defm WriteVarShuffleZ : X86SchedWritePair<ReadAfterVecYLd>; // Vector variable shuffles (ZMM).
396defm WriteBlend  : X86SchedWritePair<ReadAfterVecXLd>; // Vector blends.
397defm WriteBlendY : X86SchedWritePair<ReadAfterVecYLd>; // Vector blends (YMM).
398defm WriteBlendZ : X86SchedWritePair<ReadAfterVecYLd>; // Vector blends (ZMM).
399defm WriteVarBlend  : X86SchedWritePair<ReadAfterVecXLd>; // Vector variable blends.
400defm WriteVarBlendY : X86SchedWritePair<ReadAfterVecYLd>; // Vector variable blends (YMM).
401defm WriteVarBlendZ : X86SchedWritePair<ReadAfterVecYLd>; // Vector variable blends (ZMM).
402defm WritePSADBW  : X86SchedWritePair<ReadAfterVecLd>;  // Vector PSADBW.
403defm WritePSADBWX : X86SchedWritePair<ReadAfterVecXLd>; // Vector PSADBW (XMM).
404defm WritePSADBWY : X86SchedWritePair<ReadAfterVecYLd>; // Vector PSADBW (YMM).
405defm WritePSADBWZ : X86SchedWritePair<ReadAfterVecYLd>; // Vector PSADBW (ZMM).
406defm WriteMPSAD  : X86SchedWritePair<ReadAfterVecXLd>; // Vector MPSAD.
407defm WriteMPSADY : X86SchedWritePair<ReadAfterVecYLd>; // Vector MPSAD (YMM).
408defm WriteMPSADZ : X86SchedWritePair<ReadAfterVecYLd>; // Vector MPSAD (ZMM).
409defm WritePHMINPOS : X86SchedWritePair<ReadAfterVecXLd>;  // Vector PHMINPOS.
410
411// Vector insert/extract operations.
412defm WriteVecInsert : X86SchedWritePair; // Insert gpr to vector element.
413def  WriteVecExtract : SchedWrite; // Extract vector element to gpr.
414def  WriteVecExtractSt : SchedWrite; // Extract vector element and store.
415
416// MOVMSK operations.
417def WriteFMOVMSK    : SchedWrite;
418def WriteVecMOVMSK  : SchedWrite;
419def WriteVecMOVMSKY : SchedWrite;
420def WriteMMXMOVMSK  : SchedWrite;
421
422// Conversion between integer and float.
423defm WriteCvtSD2I  : X86SchedWritePair<ReadAfterVecLd>;  // Double -> Integer.
424defm WriteCvtPD2I  : X86SchedWritePair<ReadAfterVecXLd>; // Double -> Integer (XMM).
425defm WriteCvtPD2IY : X86SchedWritePair<ReadAfterVecYLd>; // Double -> Integer (YMM).
426defm WriteCvtPD2IZ : X86SchedWritePair<ReadAfterVecYLd>; // Double -> Integer (ZMM).
427
428defm WriteCvtSS2I  : X86SchedWritePair<ReadAfterVecLd>;  // Float -> Integer.
429defm WriteCvtPS2I  : X86SchedWritePair<ReadAfterVecXLd>; // Float -> Integer (XMM).
430defm WriteCvtPS2IY : X86SchedWritePair<ReadAfterVecYLd>; // Float -> Integer (YMM).
431defm WriteCvtPS2IZ : X86SchedWritePair<ReadAfterVecYLd>; // Float -> Integer (ZMM).
432
433defm WriteCvtI2SD  : X86SchedWritePair<ReadAfterVecLd>;  // Integer -> Double.
434defm WriteCvtI2PD  : X86SchedWritePair<ReadAfterVecXLd>; // Integer -> Double (XMM).
435defm WriteCvtI2PDY : X86SchedWritePair<ReadAfterVecYLd>; // Integer -> Double (YMM).
436defm WriteCvtI2PDZ : X86SchedWritePair<ReadAfterVecYLd>; // Integer -> Double (ZMM).
437
438defm WriteCvtI2SS  : X86SchedWritePair<ReadAfterVecLd>;  // Integer -> Float.
439defm WriteCvtI2PS  : X86SchedWritePair<ReadAfterVecXLd>; // Integer -> Float (XMM).
440defm WriteCvtI2PSY : X86SchedWritePair<ReadAfterVecYLd>; // Integer -> Float (YMM).
441defm WriteCvtI2PSZ : X86SchedWritePair<ReadAfterVecYLd>; // Integer -> Float (ZMM).
442
443defm WriteCvtSS2SD  : X86SchedWritePair<ReadAfterVecLd>;  // Float -> Double size conversion.
444defm WriteCvtPS2PD  : X86SchedWritePair<ReadAfterVecXLd>; // Float -> Double size conversion (XMM).
445defm WriteCvtPS2PDY : X86SchedWritePair<ReadAfterVecYLd>; // Float -> Double size conversion (YMM).
446defm WriteCvtPS2PDZ : X86SchedWritePair<ReadAfterVecYLd>; // Float -> Double size conversion (ZMM).
447
448defm WriteCvtSD2SS  : X86SchedWritePair<ReadAfterVecLd>;  // Double -> Float size conversion.
449defm WriteCvtPD2PS  : X86SchedWritePair<ReadAfterVecXLd>; // Double -> Float size conversion (XMM).
450defm WriteCvtPD2PSY : X86SchedWritePair<ReadAfterVecYLd>; // Double -> Float size conversion (YMM).
451defm WriteCvtPD2PSZ : X86SchedWritePair<ReadAfterVecYLd>; // Double -> Float size conversion (ZMM).
452
453defm WriteCvtPH2PS  : X86SchedWritePair<ReadAfterVecXLd>; // Half -> Float size conversion.
454defm WriteCvtPH2PSY : X86SchedWritePair<ReadAfterVecYLd>; // Half -> Float size conversion (YMM).
455defm WriteCvtPH2PSZ : X86SchedWritePair<ReadAfterVecYLd>; // Half -> Float size conversion (ZMM).
456
457def  WriteCvtPS2PH    : SchedWrite; // // Float -> Half size conversion.
458def  WriteCvtPS2PHY   : SchedWrite; // // Float -> Half size conversion (YMM).
459def  WriteCvtPS2PHZ   : SchedWrite; // // Float -> Half size conversion (ZMM).
460def  WriteCvtPS2PHSt  : SchedWrite; // // Float -> Half + store size conversion.
461def  WriteCvtPS2PHYSt : SchedWrite; // // Float -> Half + store size conversion (YMM).
462def  WriteCvtPS2PHZSt : SchedWrite; // // Float -> Half + store size conversion (ZMM).
463
464// CRC32 instruction.
465defm WriteCRC32 : X86SchedWritePair<ReadAfterLd>;
466
467// Strings instructions.
468// Packed Compare Implicit Length Strings, Return Mask
469defm WritePCmpIStrM : X86SchedWritePair<ReadAfterVecXLd>;
470// Packed Compare Explicit Length Strings, Return Mask
471defm WritePCmpEStrM : X86SchedWritePair<ReadAfterVecXLd>;
472// Packed Compare Implicit Length Strings, Return Index
473defm WritePCmpIStrI : X86SchedWritePair<ReadAfterVecXLd>;
474// Packed Compare Explicit Length Strings, Return Index
475defm WritePCmpEStrI : X86SchedWritePair<ReadAfterVecXLd>;
476
477// AES instructions.
478defm WriteAESDecEnc : X86SchedWritePair<ReadAfterVecXLd>; // Decryption, encryption.
479defm WriteAESIMC : X86SchedWritePair<ReadAfterVecXLd>; // InvMixColumn.
480defm WriteAESKeyGen : X86SchedWritePair<ReadAfterVecXLd>; // Key Generation.
481
482// Carry-less multiplication instructions.
483defm WriteCLMul : X86SchedWritePair<ReadAfterVecXLd>;
484
485// EMMS/FEMMS
486def WriteEMMS : SchedWrite;
487
488// Load/store MXCSR
489def WriteLDMXCSR : SchedWrite;
490def WriteSTMXCSR : SchedWrite;
491
492// Catch-all for expensive system instructions.
493def WriteSystem : SchedWrite;
494
495// AVX2.
496defm WriteFShuffle256 : X86SchedWritePair<ReadAfterVecYLd>; // Fp 256-bit width vector shuffles.
497defm WriteFVarShuffle256 : X86SchedWritePair<ReadAfterVecYLd>; // Fp 256-bit width variable shuffles.
498defm WriteShuffle256 : X86SchedWritePair<ReadAfterVecYLd>; // 256-bit width vector shuffles.
499defm WriteVPMOV256 : X86SchedWritePair<ReadAfterVecYLd>; // 256-bit width packed vector width-changing move.
500defm WriteVarShuffle256 : X86SchedWritePair<ReadAfterVecYLd>; // 256-bit width vector variable shuffles.
501defm WriteVarVecShift  : X86SchedWritePair<ReadAfterVecXLd>; // Variable vector shifts.
502defm WriteVarVecShiftY : X86SchedWritePair<ReadAfterVecYLd>; // Variable vector shifts (YMM).
503defm WriteVarVecShiftZ : X86SchedWritePair<ReadAfterVecYLd>; // Variable vector shifts (ZMM).
504
505// Old microcoded instructions that nobody use.
506def WriteMicrocoded : SchedWrite;
507
508// Fence instructions.
509def WriteFence : SchedWrite;
510
511// Nop, not very useful expect it provides a model for nops!
512def WriteNop : SchedWrite;
513
514// Move/Load/Store wrappers.
515def WriteFMoveLS
516 : X86SchedWriteMoveLS<WriteFMove, WriteFLoad, WriteFStore>;
517def WriteFMoveLSX
518 : X86SchedWriteMoveLS<WriteFMoveX, WriteFLoadX, WriteFStoreX>;
519def WriteFMoveLSY
520 : X86SchedWriteMoveLS<WriteFMoveY, WriteFLoadY, WriteFStoreY>;
521def WriteFMoveLSZ
522 : X86SchedWriteMoveLS<WriteFMoveZ, WriteFLoadY, WriteFStoreY>;
523def SchedWriteFMoveLS
524  : X86SchedWriteMoveLSWidths<WriteFMoveLS, WriteFMoveLSX,
525                              WriteFMoveLSY, WriteFMoveLSZ>;
526
527def WriteFMoveLSNT
528 : X86SchedWriteMoveLS<WriteFMove, WriteFLoad, WriteFStoreNT>;
529def WriteFMoveLSNTX
530 : X86SchedWriteMoveLS<WriteFMove, WriteFLoad, WriteFStoreNTX>;
531def WriteFMoveLSNTY
532 : X86SchedWriteMoveLS<WriteFMoveY, WriteFLoadY, WriteFStoreNTY>;
533def SchedWriteFMoveLSNT
534  : X86SchedWriteMoveLSWidths<WriteFMoveLSNT, WriteFMoveLSNTX,
535                              WriteFMoveLSNTY, WriteFMoveLSNTY>;
536
537def WriteVecMoveLS
538 : X86SchedWriteMoveLS<WriteVecMove, WriteVecLoad, WriteVecStore>;
539def WriteVecMoveLSX
540 : X86SchedWriteMoveLS<WriteVecMoveX, WriteVecLoadX, WriteVecStoreX>;
541def WriteVecMoveLSY
542 : X86SchedWriteMoveLS<WriteVecMoveY, WriteVecLoadY, WriteVecStoreY>;
543def WriteVecMoveLSZ
544 : X86SchedWriteMoveLS<WriteVecMoveZ, WriteVecLoadY, WriteVecStoreY>;
545def SchedWriteVecMoveLS
546  : X86SchedWriteMoveLSWidths<WriteVecMoveLS, WriteVecMoveLSX,
547                              WriteVecMoveLSY, WriteVecMoveLSZ>;
548
549def WriteVecMoveLSNT
550 : X86SchedWriteMoveLS<WriteVecMove, WriteVecLoadNT, WriteVecStoreNT>;
551def WriteVecMoveLSNTX
552 : X86SchedWriteMoveLS<WriteVecMoveX, WriteVecLoadNT, WriteVecStoreNT>;
553def WriteVecMoveLSNTY
554 : X86SchedWriteMoveLS<WriteVecMoveY, WriteVecLoadNTY, WriteVecStoreNTY>;
555def SchedWriteVecMoveLSNT
556  : X86SchedWriteMoveLSWidths<WriteVecMoveLSNT, WriteVecMoveLSNTX,
557                              WriteVecMoveLSNTY, WriteVecMoveLSNTY>;
558
559// Conditional SIMD Packed Loads and Stores wrappers.
560def WriteFMaskMove32
561  : X86SchedWriteMaskMove<WriteFMaskedLoad, WriteFMaskedStore32>;
562def WriteFMaskMove64
563  : X86SchedWriteMaskMove<WriteFMaskedLoad, WriteFMaskedStore64>;
564def WriteFMaskMove32Y
565  : X86SchedWriteMaskMove<WriteFMaskedLoadY, WriteFMaskedStore32Y>;
566def WriteFMaskMove64Y
567  : X86SchedWriteMaskMove<WriteFMaskedLoadY, WriteFMaskedStore64Y>;
568def WriteVecMaskMove32
569  : X86SchedWriteMaskMove<WriteVecMaskedLoad, WriteVecMaskedStore32>;
570def WriteVecMaskMove64
571  : X86SchedWriteMaskMove<WriteVecMaskedLoad, WriteVecMaskedStore64>;
572def WriteVecMaskMove32Y
573  : X86SchedWriteMaskMove<WriteVecMaskedLoadY, WriteVecMaskedStore32Y>;
574def WriteVecMaskMove64Y
575  : X86SchedWriteMaskMove<WriteVecMaskedLoadY, WriteVecMaskedStore64Y>;
576
577// Vector width wrappers.
578def SchedWriteFAdd
579 : X86SchedWriteWidths<WriteFAdd, WriteFAddX, WriteFAddY, WriteFAddZ>;
580def SchedWriteFAdd64
581 : X86SchedWriteWidths<WriteFAdd64, WriteFAdd64X, WriteFAdd64Y, WriteFAdd64Z>;
582def SchedWriteFHAdd
583 : X86SchedWriteWidths<WriteFHAdd, WriteFHAdd, WriteFHAddY, WriteFHAddZ>;
584def SchedWriteFCmp
585 : X86SchedWriteWidths<WriteFCmp, WriteFCmpX, WriteFCmpY, WriteFCmpZ>;
586def SchedWriteFCmp64
587 : X86SchedWriteWidths<WriteFCmp64, WriteFCmp64X, WriteFCmp64Y, WriteFCmp64Z>;
588def SchedWriteFMul
589 : X86SchedWriteWidths<WriteFMul, WriteFMulX, WriteFMulY, WriteFMulZ>;
590def SchedWriteFMul64
591 : X86SchedWriteWidths<WriteFMul64, WriteFMul64X, WriteFMul64Y, WriteFMul64Z>;
592def SchedWriteFMA
593 : X86SchedWriteWidths<WriteFMA, WriteFMAX, WriteFMAY, WriteFMAZ>;
594def SchedWriteDPPD
595 : X86SchedWriteWidths<WriteDPPD, WriteDPPD, WriteDPPD, WriteDPPD>;
596def SchedWriteDPPS
597 : X86SchedWriteWidths<WriteDPPS, WriteDPPS, WriteDPPSY, WriteDPPSZ>;
598def SchedWriteFDiv
599 : X86SchedWriteWidths<WriteFDiv, WriteFDivX, WriteFDivY, WriteFDivZ>;
600def SchedWriteFDiv64
601 : X86SchedWriteWidths<WriteFDiv64, WriteFDiv64X, WriteFDiv64Y, WriteFDiv64Z>;
602def SchedWriteFSqrt
603 : X86SchedWriteWidths<WriteFSqrt, WriteFSqrtX,
604                       WriteFSqrtY, WriteFSqrtZ>;
605def SchedWriteFSqrt64
606 : X86SchedWriteWidths<WriteFSqrt64, WriteFSqrt64X,
607                       WriteFSqrt64Y, WriteFSqrt64Z>;
608def SchedWriteFRcp
609 : X86SchedWriteWidths<WriteFRcp, WriteFRcpX, WriteFRcpY, WriteFRcpZ>;
610def SchedWriteFRsqrt
611 : X86SchedWriteWidths<WriteFRsqrt, WriteFRsqrtX, WriteFRsqrtY, WriteFRsqrtZ>;
612def SchedWriteFRnd
613 : X86SchedWriteWidths<WriteFRnd, WriteFRnd, WriteFRndY, WriteFRndZ>;
614def SchedWriteFLogic
615 : X86SchedWriteWidths<WriteFLogic, WriteFLogic, WriteFLogicY, WriteFLogicZ>;
616def SchedWriteFTest
617 : X86SchedWriteWidths<WriteFTest, WriteFTest, WriteFTestY, WriteFTestZ>;
618
619def SchedWriteFShuffle
620 : X86SchedWriteWidths<WriteFShuffle, WriteFShuffle,
621                       WriteFShuffleY, WriteFShuffleZ>;
622def SchedWriteFVarShuffle
623 : X86SchedWriteWidths<WriteFVarShuffle, WriteFVarShuffle,
624                       WriteFVarShuffleY, WriteFVarShuffleZ>;
625def SchedWriteFBlend
626 : X86SchedWriteWidths<WriteFBlend, WriteFBlend, WriteFBlendY, WriteFBlendZ>;
627def SchedWriteFVarBlend
628 : X86SchedWriteWidths<WriteFVarBlend, WriteFVarBlend,
629                       WriteFVarBlendY, WriteFVarBlendZ>;
630
631def SchedWriteCvtDQ2PD
632 : X86SchedWriteWidths<WriteCvtI2SD, WriteCvtI2PD,
633                       WriteCvtI2PDY, WriteCvtI2PDZ>;
634def SchedWriteCvtDQ2PS
635 : X86SchedWriteWidths<WriteCvtI2SS, WriteCvtI2PS,
636                       WriteCvtI2PSY, WriteCvtI2PSZ>;
637def SchedWriteCvtPD2DQ
638 : X86SchedWriteWidths<WriteCvtSD2I, WriteCvtPD2I,
639                       WriteCvtPD2IY, WriteCvtPD2IZ>;
640def SchedWriteCvtPS2DQ
641 : X86SchedWriteWidths<WriteCvtSS2I, WriteCvtPS2I,
642                       WriteCvtPS2IY, WriteCvtPS2IZ>;
643def SchedWriteCvtPS2PD
644 : X86SchedWriteWidths<WriteCvtSS2SD, WriteCvtPS2PD,
645                       WriteCvtPS2PDY, WriteCvtPS2PDZ>;
646def SchedWriteCvtPD2PS
647 : X86SchedWriteWidths<WriteCvtSD2SS, WriteCvtPD2PS,
648                       WriteCvtPD2PSY, WriteCvtPD2PSZ>;
649
650def SchedWriteVecALU
651 : X86SchedWriteWidths<WriteVecALU, WriteVecALUX, WriteVecALUY, WriteVecALUZ>;
652def SchedWritePHAdd
653 : X86SchedWriteWidths<WritePHAdd, WritePHAddX, WritePHAddY, WritePHAddZ>;
654def SchedWriteVecLogic
655 : X86SchedWriteWidths<WriteVecLogic, WriteVecLogicX,
656                       WriteVecLogicY, WriteVecLogicZ>;
657def SchedWriteVecTest
658 : X86SchedWriteWidths<WriteVecTest, WriteVecTest,
659                       WriteVecTestY, WriteVecTestZ>;
660def SchedWriteVecShift
661 : X86SchedWriteWidths<WriteVecShift, WriteVecShiftX,
662                       WriteVecShiftY, WriteVecShiftZ>;
663def SchedWriteVecShiftImm
664 : X86SchedWriteWidths<WriteVecShiftImm, WriteVecShiftImmX,
665                       WriteVecShiftImmY, WriteVecShiftImmZ>;
666def SchedWriteVarVecShift
667 : X86SchedWriteWidths<WriteVarVecShift, WriteVarVecShift,
668                       WriteVarVecShiftY, WriteVarVecShiftZ>;
669def SchedWriteVecIMul
670 : X86SchedWriteWidths<WriteVecIMul, WriteVecIMulX,
671                       WriteVecIMulY, WriteVecIMulZ>;
672def SchedWritePMULLD
673 : X86SchedWriteWidths<WritePMULLD, WritePMULLD,
674                       WritePMULLDY, WritePMULLDZ>;
675def SchedWriteMPSAD
676 : X86SchedWriteWidths<WriteMPSAD, WriteMPSAD,
677                       WriteMPSADY, WriteMPSADZ>;
678def SchedWritePSADBW
679 : X86SchedWriteWidths<WritePSADBW, WritePSADBWX,
680                       WritePSADBWY, WritePSADBWZ>;
681
682def SchedWriteShuffle
683 : X86SchedWriteWidths<WriteShuffle, WriteShuffleX,
684                       WriteShuffleY, WriteShuffleZ>;
685def SchedWriteVarShuffle
686 : X86SchedWriteWidths<WriteVarShuffle, WriteVarShuffleX,
687                       WriteVarShuffleY, WriteVarShuffleZ>;
688def SchedWriteBlend
689 : X86SchedWriteWidths<WriteBlend, WriteBlend, WriteBlendY, WriteBlendZ>;
690def SchedWriteVarBlend
691 : X86SchedWriteWidths<WriteVarBlend, WriteVarBlend,
692                       WriteVarBlendY, WriteVarBlendZ>;
693
694// Vector size wrappers.
695// FIXME: Currently PH uses the same schedule method as PS.
696// We may refine them later.
697def SchedWriteFAddSizes
698 : X86SchedWriteSizes<SchedWriteFAdd, SchedWriteFAdd, SchedWriteFAdd64>;
699def SchedWriteFCmpSizes
700 : X86SchedWriteSizes<SchedWriteFCmp, SchedWriteFCmp, SchedWriteFCmp64>;
701def SchedWriteFMulSizes
702 : X86SchedWriteSizes<SchedWriteFMul, SchedWriteFMul, SchedWriteFMul64>;
703def SchedWriteFDivSizes
704 : X86SchedWriteSizes<SchedWriteFDiv, SchedWriteFDiv, SchedWriteFDiv64>;
705def SchedWriteFSqrtSizes
706 : X86SchedWriteSizes<SchedWriteFSqrt, SchedWriteFSqrt, SchedWriteFSqrt64>;
707def SchedWriteFLogicSizes
708 : X86SchedWriteSizes<SchedWriteFLogic, SchedWriteFLogic, SchedWriteFLogic>;
709def SchedWriteFShuffleSizes
710 : X86SchedWriteSizes<SchedWriteFShuffle, SchedWriteFShuffle, SchedWriteFShuffle>;
711
712//===----------------------------------------------------------------------===//
713// Generic Processor Scheduler Models.
714
715// IssueWidth is analogous to the number of decode units. Core and its
716// descendents, including Nehalem and SandyBridge have 4 decoders.
717// Resources beyond the decoder operate on micro-ops and are bufferred
718// so adjacent micro-ops don't directly compete.
719//
720// MicroOpBufferSize > 1 indicates that RAW dependencies can be
721// decoded in the same cycle. The value 32 is a reasonably arbitrary
722// number of in-flight instructions.
723//
724// HighLatency=10 is optimistic. X86InstrInfo::isHighLatencyDef
725// indicates high latency opcodes. Alternatively, InstrItinData
726// entries may be included here to define specific operand
727// latencies. Since these latencies are not used for pipeline hazards,
728// they do not need to be exact.
729//
730// The GenericX86Model contains no instruction schedules
731// and disables PostRAScheduler.
732class GenericX86Model : SchedMachineModel {
733  let IssueWidth = 4;
734  let MicroOpBufferSize = 32;
735  let LoadLatency = 4;
736  let HighLatency = 10;
737  let PostRAScheduler = 0;
738  let CompleteModel = 0;
739}
740
741def GenericModel : GenericX86Model;
742
743// Define a model with the PostRAScheduler enabled.
744def GenericPostRAModel : GenericX86Model {
745  let PostRAScheduler = 1;
746}
747