xref: /freebsd/contrib/llvm-project/llvm/lib/Target/X86/X86ScheduleSLM.td (revision 43a5ec4eb41567cc92586503212743d89686d78f)
1//=- X86ScheduleSLM.td - X86 Silvermont Scheduling -----------*- 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// This file defines the machine model for Intel Silvermont to support
10// instruction scheduling and other instruction cost heuristics.
11//
12//===----------------------------------------------------------------------===//
13
14def SLMModel : SchedMachineModel {
15  // All x86 instructions are modeled as a single micro-op, and SLM can decode 2
16  // instructions per cycle.
17  let IssueWidth = 2;
18  let MicroOpBufferSize = 32; // Based on the reorder buffer.
19  let LoadLatency = 3;
20  let MispredictPenalty = 10;
21  let PostRAScheduler = 1;
22
23  // For small loops, expand by a small factor to hide the backedge cost.
24  let LoopMicroOpBufferSize = 10;
25
26  // FIXME: SSE4 is unimplemented. This flag is set to allow
27  // the scheduler to assign a default model to unrecognized opcodes.
28  let CompleteModel = 0;
29}
30
31let SchedModel = SLMModel in {
32
33// Silvermont has 5 reservation stations for micro-ops
34def SLM_IEC_RSV0 : ProcResource<1>;
35def SLM_IEC_RSV1 : ProcResource<1>;
36def SLM_FPC_RSV0 : ProcResource<1> { let BufferSize = 1; }
37def SLM_FPC_RSV1 : ProcResource<1> { let BufferSize = 1; }
38def SLM_MEC_RSV  : ProcResource<1>;
39
40// Many micro-ops are capable of issuing on multiple ports.
41def SLM_IEC_RSV01  : ProcResGroup<[SLM_IEC_RSV0, SLM_IEC_RSV1]>;
42def SLM_FPC_RSV01  : ProcResGroup<[SLM_FPC_RSV0, SLM_FPC_RSV1]>;
43
44def SLMDivider      : ProcResource<1>;
45def SLMFPMultiplier : ProcResource<1>;
46def SLMFPDivider    : ProcResource<1>;
47
48// Loads are 3 cycles, so ReadAfterLd registers needn't be available until 3
49// cycles after the memory operand.
50def : ReadAdvance<ReadAfterLd, 3>;
51def : ReadAdvance<ReadAfterVecLd, 3>;
52def : ReadAdvance<ReadAfterVecXLd, 3>;
53def : ReadAdvance<ReadAfterVecYLd, 3>;
54
55def : ReadAdvance<ReadInt2Fpu, 0>;
56
57// Many SchedWrites are defined in pairs with and without a folded load.
58// Instructions with folded loads are usually micro-fused, so they only appear
59// as two micro-ops when queued in the reservation station.
60// This multiclass defines the resource usage for variants with and without
61// folded loads.
62multiclass SLMWriteResPair<X86FoldableSchedWrite SchedRW,
63                           list<ProcResourceKind> ExePorts,
64                           int Lat, list<int> Res = [1], int UOps = 1,
65                           int LoadLat = 3> {
66  // Register variant is using a single cycle on ExePort.
67  def : WriteRes<SchedRW, ExePorts> {
68    let Latency = Lat;
69    let ResourceCycles = Res;
70    let NumMicroOps = UOps;
71  }
72
73  // Memory variant also uses a cycle on MEC_RSV and adds LoadLat cycles to
74  // the latency (default = 3).
75  def : WriteRes<SchedRW.Folded, !listconcat([SLM_MEC_RSV], ExePorts)> {
76    let Latency = !add(Lat, LoadLat);
77    let ResourceCycles = !listconcat([1], Res);
78    let NumMicroOps = UOps;
79  }
80}
81
82// A folded store needs a cycle on MEC_RSV for the store data, but it does not
83// need an extra port cycle to recompute the address.
84def : WriteRes<WriteRMW, [SLM_MEC_RSV]>;
85
86def : WriteRes<WriteStore,   [SLM_IEC_RSV01, SLM_MEC_RSV]>;
87def : WriteRes<WriteStoreNT, [SLM_IEC_RSV01, SLM_MEC_RSV]>;
88def : WriteRes<WriteLoad,    [SLM_MEC_RSV]> { let Latency = 3; }
89def : WriteRes<WriteMove,    [SLM_IEC_RSV01]>;
90def : WriteRes<WriteZero,    []>;
91defm : X86WriteResUnsupported<WriteVecMaskedGatherWriteback>;
92
93// Load/store MXCSR.
94// FIXME: These are probably wrong. They are copy pasted from WriteStore/Load.
95def : WriteRes<WriteSTMXCSR, [SLM_IEC_RSV01, SLM_MEC_RSV]>;
96def : WriteRes<WriteLDMXCSR,  [SLM_MEC_RSV]> { let Latency = 3; }
97
98// Treat misc copies as a move.
99def : InstRW<[WriteMove], (instrs COPY)>;
100
101defm : SLMWriteResPair<WriteALU,    [SLM_IEC_RSV01], 1>;
102defm : SLMWriteResPair<WriteADC,    [SLM_IEC_RSV01], 1>;
103
104defm : SLMWriteResPair<WriteIMul8,     [SLM_IEC_RSV1],  3>;
105defm : SLMWriteResPair<WriteIMul16,    [SLM_IEC_RSV1],  3>;
106defm : SLMWriteResPair<WriteIMul16Imm, [SLM_IEC_RSV1],  3>;
107defm : SLMWriteResPair<WriteIMul16Reg, [SLM_IEC_RSV1],  3>;
108defm : SLMWriteResPair<WriteIMul32,    [SLM_IEC_RSV1],  3>;
109defm : SLMWriteResPair<WriteIMul32Imm, [SLM_IEC_RSV1],  3>;
110defm : SLMWriteResPair<WriteIMul32Reg, [SLM_IEC_RSV1],  3>;
111defm : SLMWriteResPair<WriteIMul64,    [SLM_IEC_RSV1],  3>;
112defm : SLMWriteResPair<WriteIMul64Imm, [SLM_IEC_RSV1],  3>;
113defm : SLMWriteResPair<WriteIMul64Reg, [SLM_IEC_RSV1],  3>;
114def  : WriteRes<WriteIMulH, [SLM_FPC_RSV0]>;
115
116defm : X86WriteRes<WriteBSWAP32, [SLM_IEC_RSV01], 1, [1], 1>;
117defm : X86WriteRes<WriteBSWAP64, [SLM_IEC_RSV01], 1, [1], 1>;
118defm : X86WriteRes<WriteCMPXCHG, [SLM_IEC_RSV01], 1, [1], 1>;
119defm : X86WriteRes<WriteCMPXCHGRMW, [SLM_IEC_RSV01, SLM_MEC_RSV], 4, [1, 2], 2>;
120defm : X86WriteRes<WriteXCHG,      [SLM_IEC_RSV01], 1, [1], 1>;
121
122defm : SLMWriteResPair<WriteShift,    [SLM_IEC_RSV0],  1>;
123defm : SLMWriteResPair<WriteShiftCL,  [SLM_IEC_RSV0],  1>;
124defm : SLMWriteResPair<WriteRotate,   [SLM_IEC_RSV0],  1>;
125defm : SLMWriteResPair<WriteRotateCL, [SLM_IEC_RSV0],  1>;
126
127defm : X86WriteRes<WriteSHDrri, [SLM_IEC_RSV0],  1, [1], 1>;
128defm : X86WriteRes<WriteSHDrrcl,[SLM_IEC_RSV0],  1, [1], 1>;
129defm : X86WriteRes<WriteSHDmri, [SLM_MEC_RSV, SLM_IEC_RSV0], 4, [2, 1], 2>;
130defm : X86WriteRes<WriteSHDmrcl,[SLM_MEC_RSV, SLM_IEC_RSV0], 4, [2, 1], 2>;
131
132defm : SLMWriteResPair<WriteJump,   [SLM_IEC_RSV1],  1>;
133defm : SLMWriteResPair<WriteCRC32,  [SLM_IEC_RSV1],  3>;
134
135defm : SLMWriteResPair<WriteCMOV,  [SLM_IEC_RSV01], 2, [2]>;
136defm : X86WriteRes<WriteFCMOV, [SLM_FPC_RSV1], 3, [1], 1>; // x87 conditional move.
137def  : WriteRes<WriteSETCC, [SLM_IEC_RSV01]>;
138def  : WriteRes<WriteSETCCStore, [SLM_IEC_RSV01, SLM_MEC_RSV]> {
139  // FIXME Latency and NumMicrOps?
140  let ResourceCycles = [2,1];
141}
142defm : X86WriteRes<WriteLAHFSAHF,        [SLM_IEC_RSV01], 1, [1], 1>;
143defm : X86WriteRes<WriteBitTest,         [SLM_IEC_RSV01], 1, [1], 1>;
144defm : X86WriteRes<WriteBitTestImmLd,    [SLM_IEC_RSV01, SLM_MEC_RSV], 4, [1,1], 1>;
145defm : X86WriteRes<WriteBitTestRegLd,    [SLM_IEC_RSV01, SLM_MEC_RSV], 4, [1,1], 1>;
146defm : X86WriteRes<WriteBitTestSet,      [SLM_IEC_RSV01], 1, [1], 1>;
147defm : X86WriteRes<WriteBitTestSetImmLd, [SLM_IEC_RSV01, SLM_MEC_RSV], 3, [1,1], 1>;
148defm : X86WriteRes<WriteBitTestSetRegLd, [SLM_IEC_RSV01, SLM_MEC_RSV], 3, [1,1], 1>;
149
150// This is for simple LEAs with one or two input operands.
151// The complex ones can only execute on port 1, and they require two cycles on
152// the port to read all inputs. We don't model that.
153def : WriteRes<WriteLEA, [SLM_IEC_RSV1]>;
154
155// Bit counts.
156defm : SLMWriteResPair<WriteBSF, [SLM_IEC_RSV01], 10, [20], 10>;
157defm : SLMWriteResPair<WriteBSR, [SLM_IEC_RSV01], 10, [20], 10>;
158defm : SLMWriteResPair<WriteLZCNT,          [SLM_IEC_RSV0], 3>;
159defm : SLMWriteResPair<WriteTZCNT,          [SLM_IEC_RSV0], 3>;
160defm : SLMWriteResPair<WritePOPCNT,         [SLM_IEC_RSV0], 3>;
161
162// BMI1 BEXTR/BLS, BMI2 BZHI
163defm : X86WriteResPairUnsupported<WriteBEXTR>;
164defm : X86WriteResPairUnsupported<WriteBLS>;
165defm : X86WriteResPairUnsupported<WriteBZHI>;
166
167defm : SLMWriteResPair<WriteDiv8,   [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
168defm : SLMWriteResPair<WriteDiv16,  [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
169defm : SLMWriteResPair<WriteDiv32,  [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
170defm : SLMWriteResPair<WriteDiv64,  [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
171defm : SLMWriteResPair<WriteIDiv8,  [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
172defm : SLMWriteResPair<WriteIDiv16, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
173defm : SLMWriteResPair<WriteIDiv32, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
174defm : SLMWriteResPair<WriteIDiv64, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
175
176// Scalar and vector floating point.
177defm : X86WriteRes<WriteFLD0,       [SLM_FPC_RSV01], 1, [1], 1>;
178defm : X86WriteRes<WriteFLD1,       [SLM_FPC_RSV01], 1, [1], 1>;
179defm : X86WriteRes<WriteFLDC,       [SLM_FPC_RSV01], 1, [2], 2>;
180def  : WriteRes<WriteFLoad,         [SLM_MEC_RSV]> { let Latency = 3; }
181def  : WriteRes<WriteFLoadX,        [SLM_MEC_RSV]> { let Latency = 3; }
182def  : WriteRes<WriteFLoadY,        [SLM_MEC_RSV]> { let Latency = 3; }
183def  : WriteRes<WriteFMaskedLoad,   [SLM_MEC_RSV]> { let Latency = 3; }
184def  : WriteRes<WriteFMaskedLoadY,  [SLM_MEC_RSV]> { let Latency = 3; }
185def  : WriteRes<WriteFStore,        [SLM_MEC_RSV]>;
186def  : WriteRes<WriteFStoreX,       [SLM_MEC_RSV]>;
187def  : WriteRes<WriteFStoreY,       [SLM_MEC_RSV]>;
188def  : WriteRes<WriteFStoreNT,      [SLM_MEC_RSV]>;
189def  : WriteRes<WriteFStoreNTX,     [SLM_MEC_RSV]>;
190def  : WriteRes<WriteFStoreNTY,     [SLM_MEC_RSV]>;
191
192def  : WriteRes<WriteFMaskedStore32,    [SLM_MEC_RSV]>;
193def  : WriteRes<WriteFMaskedStore32Y,   [SLM_MEC_RSV]>;
194def  : WriteRes<WriteFMaskedStore64,    [SLM_MEC_RSV]>;
195def  : WriteRes<WriteFMaskedStore64Y,   [SLM_MEC_RSV]>;
196
197def  : WriteRes<WriteFMove,         [SLM_FPC_RSV01]>;
198def  : WriteRes<WriteFMoveX,        [SLM_FPC_RSV01]>;
199def  : WriteRes<WriteFMoveY,        [SLM_FPC_RSV01]>;
200defm : X86WriteRes<WriteEMMS,       [SLM_FPC_RSV01], 10, [10], 9>;
201
202defm : SLMWriteResPair<WriteFAdd,     [SLM_FPC_RSV1], 3>;
203defm : SLMWriteResPair<WriteFAddX,    [SLM_FPC_RSV1], 3>;
204defm : SLMWriteResPair<WriteFAddY,    [SLM_FPC_RSV1], 3>;
205defm : X86WriteResPairUnsupported<WriteFAddZ>;
206defm : SLMWriteResPair<WriteFAdd64,   [SLM_FPC_RSV1], 3>;
207defm : SLMWriteResPair<WriteFAdd64X,  [SLM_FPC_RSV1], 4, [2]>;
208defm : SLMWriteResPair<WriteFAdd64Y,  [SLM_FPC_RSV1], 4, [2]>;
209defm : X86WriteResPairUnsupported<WriteFAdd64Z>;
210defm : SLMWriteResPair<WriteFCmp,     [SLM_FPC_RSV1], 3>;
211defm : SLMWriteResPair<WriteFCmpX,    [SLM_FPC_RSV1], 3>;
212defm : SLMWriteResPair<WriteFCmpY,    [SLM_FPC_RSV1], 3>;
213defm : X86WriteResPairUnsupported<WriteFCmpZ>;
214defm : SLMWriteResPair<WriteFCmp64,   [SLM_FPC_RSV1], 3>;
215defm : SLMWriteResPair<WriteFCmp64X,  [SLM_FPC_RSV1], 3>;
216defm : SLMWriteResPair<WriteFCmp64Y,  [SLM_FPC_RSV1], 3>;
217defm : X86WriteResPairUnsupported<WriteFCmp64Z>;
218defm : SLMWriteResPair<WriteFCom,     [SLM_FPC_RSV1], 3>;
219defm : SLMWriteResPair<WriteFComX,    [SLM_FPC_RSV1], 3>;
220defm : SLMWriteResPair<WriteFMul,     [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
221defm : SLMWriteResPair<WriteFMulX,    [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
222defm : SLMWriteResPair<WriteFMulY,    [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
223defm : X86WriteResPairUnsupported<WriteFMulZ>;
224defm : SLMWriteResPair<WriteFMul64,   [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
225defm : SLMWriteResPair<WriteFMul64X,  [SLM_FPC_RSV0, SLMFPMultiplier], 7, [1,4]>;
226defm : SLMWriteResPair<WriteFMul64Y,  [SLM_FPC_RSV0, SLMFPMultiplier], 7, [1,4]>;
227defm : X86WriteResPairUnsupported<WriteFMul64Z>;
228defm : X86WriteResPairUnsupported<WriteFMA>;
229defm : X86WriteResPairUnsupported<WriteFMAX>;
230defm : X86WriteResPairUnsupported<WriteFMAY>;
231defm : X86WriteResPairUnsupported<WriteFMAZ>;
232defm : SLMWriteResPair<WriteFDiv,     [SLM_FPC_RSV0, SLMFPDivider], 19, [1,17]>;
233defm : SLMWriteResPair<WriteFDivX,    [SLM_FPC_RSV0, SLMFPDivider], 39, [1,39]>;
234defm : SLMWriteResPair<WriteFDivY,    [SLM_FPC_RSV0, SLMFPDivider], 39, [1,39]>;
235defm : X86WriteResPairUnsupported<WriteFDivZ>;
236defm : SLMWriteResPair<WriteFDiv64,   [SLM_FPC_RSV0, SLMFPDivider], 34, [1,32]>;
237defm : SLMWriteResPair<WriteFDiv64X,  [SLM_FPC_RSV0, SLMFPDivider], 69, [1,69]>;
238defm : SLMWriteResPair<WriteFDiv64Y,  [SLM_FPC_RSV0, SLMFPDivider], 69, [1,69]>;
239defm : X86WriteResPairUnsupported<WriteFDiv64Z>;
240defm : SLMWriteResPair<WriteFRcp,     [SLM_FPC_RSV0], 5>;
241defm : SLMWriteResPair<WriteFRcpX,    [SLM_FPC_RSV0], 5>;
242defm : SLMWriteResPair<WriteFRcpY,    [SLM_FPC_RSV0], 5>;
243defm : X86WriteResPairUnsupported<WriteFRcpZ>;
244defm : SLMWriteResPair<WriteFRsqrt,   [SLM_FPC_RSV0], 5>;
245defm : SLMWriteResPair<WriteFRsqrtX,  [SLM_FPC_RSV0], 5>;
246defm : SLMWriteResPair<WriteFRsqrtY,  [SLM_FPC_RSV0], 5>;
247defm : X86WriteResPairUnsupported<WriteFRsqrtZ>;
248defm : SLMWriteResPair<WriteFSqrt,    [SLM_FPC_RSV0,SLMFPDivider], 20, [1,20], 1, 3>;
249defm : SLMWriteResPair<WriteFSqrtX,   [SLM_FPC_RSV0,SLMFPDivider], 41, [1,40], 1, 3>;
250defm : SLMWriteResPair<WriteFSqrtY,   [SLM_FPC_RSV0,SLMFPDivider], 41, [1,40], 1, 3>;
251defm : X86WriteResPairUnsupported<WriteFSqrtZ>;
252defm : SLMWriteResPair<WriteFSqrt64,  [SLM_FPC_RSV0,SLMFPDivider], 35, [1,35], 1, 3>;
253defm : SLMWriteResPair<WriteFSqrt64X, [SLM_FPC_RSV0,SLMFPDivider], 71, [1,70], 1, 3>;
254defm : SLMWriteResPair<WriteFSqrt64Y, [SLM_FPC_RSV0,SLMFPDivider], 71, [1,70], 1, 3>;
255defm : X86WriteResPairUnsupported<WriteFSqrt64Z>;
256defm : SLMWriteResPair<WriteFSqrt80,  [SLM_FPC_RSV0,SLMFPDivider], 40, [1,40]>;
257defm : SLMWriteResPair<WriteDPPD,   [SLM_FPC_RSV1], 3>;
258defm : SLMWriteResPair<WriteDPPS,   [SLM_FPC_RSV1], 3>;
259defm : SLMWriteResPair<WriteDPPSY,  [SLM_FPC_RSV1], 3>;
260defm : X86WriteResPairUnsupported<WriteDPPSZ>;
261defm : SLMWriteResPair<WriteFSign,  [SLM_FPC_RSV01], 1>;
262defm : SLMWriteResPair<WriteFRnd,   [SLM_FPC_RSV1], 3>;
263defm : SLMWriteResPair<WriteFRndY,  [SLM_FPC_RSV1], 3>;
264defm : X86WriteResPairUnsupported<WriteFRndZ>;
265defm : SLMWriteResPair<WriteFLogic, [SLM_FPC_RSV01], 1>;
266defm : SLMWriteResPair<WriteFLogicY, [SLM_FPC_RSV01], 1>;
267defm : X86WriteResPairUnsupported<WriteFLogicZ>;
268defm : SLMWriteResPair<WriteFTest,  [SLM_FPC_RSV01], 1>;
269defm : SLMWriteResPair<WriteFTestY, [SLM_FPC_RSV01], 1>;
270defm : X86WriteResPairUnsupported<WriteFTestZ>;
271defm : SLMWriteResPair<WriteFShuffle,  [SLM_FPC_RSV0], 1>;
272defm : SLMWriteResPair<WriteFShuffleY, [SLM_FPC_RSV0], 1>;
273defm : X86WriteResPairUnsupported<WriteFShuffleZ>;
274defm : SLMWriteResPair<WriteFVarShuffle, [SLM_FPC_RSV0],  1>;
275defm : SLMWriteResPair<WriteFVarShuffleY,[SLM_FPC_RSV0],  1>;
276defm : X86WriteResPairUnsupported<WriteFVarShuffleZ>;
277defm : SLMWriteResPair<WriteFBlend,  [SLM_FPC_RSV0],  1>;
278defm : X86WriteResPairUnsupported<WriteFBlendY>;
279defm : X86WriteResPairUnsupported<WriteFBlendZ>;
280defm : SLMWriteResPair<WriteFVarBlend, [SLM_FPC_RSV0], 4, [4], 3>;
281defm : X86WriteResPairUnsupported<WriteFVarBlendY>;
282defm : X86WriteResPairUnsupported<WriteFVarBlendZ>;
283defm : X86WriteResPairUnsupported<WriteFShuffle256>;
284defm : X86WriteResPairUnsupported<WriteFVarShuffle256>;
285
286// Conversion between integer and float.
287defm : SLMWriteResPair<WriteCvtSS2I,   [SLM_FPC_RSV0], 5>;
288defm : SLMWriteResPair<WriteCvtPS2I,   [SLM_FPC_RSV0], 5, [2]>;
289defm : SLMWriteResPair<WriteCvtPS2IY,  [SLM_FPC_RSV0], 5, [2]>;
290defm : X86WriteResPairUnsupported<WriteCvtPS2IZ>;
291defm : SLMWriteResPair<WriteCvtSD2I,   [SLM_FPC_RSV0], 5>;
292defm : SLMWriteResPair<WriteCvtPD2I,   [SLM_FPC_RSV0], 5, [2]>;
293defm : SLMWriteResPair<WriteCvtPD2IY,  [SLM_FPC_RSV0], 5, [2]>;
294defm : X86WriteResPairUnsupported<WriteCvtPD2IZ>;
295
296defm : SLMWriteResPair<WriteCvtI2SS,   [SLM_FPC_RSV0], 5, [2]>;
297defm : SLMWriteResPair<WriteCvtI2PS,   [SLM_FPC_RSV0], 5, [2]>;
298defm : SLMWriteResPair<WriteCvtI2PSY,  [SLM_FPC_RSV0], 5, [2]>;
299defm : X86WriteResPairUnsupported<WriteCvtI2PSZ>;
300defm : SLMWriteResPair<WriteCvtI2SD,   [SLM_FPC_RSV0], 5, [2]>;
301defm : SLMWriteResPair<WriteCvtI2PD,   [SLM_FPC_RSV0], 5, [2]>;
302defm : SLMWriteResPair<WriteCvtI2PDY,  [SLM_FPC_RSV0], 5, [2]>;
303defm : X86WriteResPairUnsupported<WriteCvtI2PDZ>;
304
305defm : SLMWriteResPair<WriteCvtSS2SD,  [SLM_FPC_RSV0], 4, [2]>;
306defm : SLMWriteResPair<WriteCvtPS2PD,  [SLM_FPC_RSV0], 5, [2]>;
307defm : SLMWriteResPair<WriteCvtPS2PDY, [SLM_FPC_RSV0], 5, [2]>;
308defm : X86WriteResPairUnsupported<WriteCvtPS2PDZ>;
309defm : SLMWriteResPair<WriteCvtSD2SS,  [SLM_FPC_RSV0], 4, [2]>;
310defm : SLMWriteResPair<WriteCvtPD2PS,  [SLM_FPC_RSV0], 5, [2]>;
311defm : SLMWriteResPair<WriteCvtPD2PSY, [SLM_FPC_RSV0], 5, [2]>;
312defm : X86WriteResPairUnsupported<WriteCvtPD2PSZ>;
313
314defm : X86WriteResPairUnsupported<WriteCvtPH2PS>;
315defm : X86WriteResPairUnsupported<WriteCvtPH2PSY>;
316defm : X86WriteResPairUnsupported<WriteCvtPH2PSZ>;
317
318defm : X86WriteResUnsupported<WriteCvtPS2PH>;
319defm : X86WriteResUnsupported<WriteCvtPS2PHY>;
320defm : X86WriteResUnsupported<WriteCvtPS2PHZ>;
321defm : X86WriteResUnsupported<WriteCvtPS2PHSt>;
322defm : X86WriteResUnsupported<WriteCvtPS2PHYSt>;
323defm : X86WriteResUnsupported<WriteCvtPS2PHZSt>;
324
325// Vector integer operations.
326def  : WriteRes<WriteVecLoad,         [SLM_MEC_RSV]> { let Latency = 3; }
327def  : WriteRes<WriteVecLoadX,        [SLM_MEC_RSV]> { let Latency = 3; }
328def  : WriteRes<WriteVecLoadY,        [SLM_MEC_RSV]> { let Latency = 3; }
329def  : WriteRes<WriteVecLoadNT,       [SLM_MEC_RSV]> { let Latency = 3; }
330def  : WriteRes<WriteVecLoadNTY,      [SLM_MEC_RSV]> { let Latency = 3; }
331def  : WriteRes<WriteVecMaskedLoad,   [SLM_MEC_RSV]> { let Latency = 3; }
332def  : WriteRes<WriteVecMaskedLoadY,  [SLM_MEC_RSV]> { let Latency = 3; }
333def  : WriteRes<WriteVecStore,        [SLM_MEC_RSV]>;
334def  : WriteRes<WriteVecStoreX,       [SLM_MEC_RSV]>;
335def  : WriteRes<WriteVecStoreY,       [SLM_MEC_RSV]>;
336def  : WriteRes<WriteVecStoreNT,      [SLM_MEC_RSV]>;
337def  : WriteRes<WriteVecStoreNTY,     [SLM_MEC_RSV]>;
338def  : WriteRes<WriteVecMaskedStore32,    [SLM_MEC_RSV]>;
339def  : WriteRes<WriteVecMaskedStore32Y,   [SLM_MEC_RSV]>;
340def  : WriteRes<WriteVecMaskedStore64,    [SLM_MEC_RSV]>;
341def  : WriteRes<WriteVecMaskedStore64Y,   [SLM_MEC_RSV]>;
342def  : WriteRes<WriteVecMove,         [SLM_FPC_RSV01]>;
343def  : WriteRes<WriteVecMoveX,        [SLM_FPC_RSV01]>;
344def  : WriteRes<WriteVecMoveY,        [SLM_FPC_RSV01]>;
345def  : WriteRes<WriteVecMoveToGpr,    [SLM_IEC_RSV01]>;
346def  : WriteRes<WriteVecMoveFromGpr,  [SLM_IEC_RSV01]>;
347
348defm : SLMWriteResPair<WriteVecShift,    [SLM_FPC_RSV0],  2, [2], 2>;
349defm : SLMWriteResPair<WriteVecShiftX,   [SLM_FPC_RSV0],  2, [2], 2>;
350defm : SLMWriteResPair<WriteVecShiftY,   [SLM_FPC_RSV0],  2, [2], 2>;
351defm : X86WriteResPairUnsupported<WriteVecShiftZ>;
352defm : SLMWriteResPair<WriteVecShiftImm, [SLM_FPC_RSV0],  1>;
353defm : SLMWriteResPair<WriteVecShiftImmX,[SLM_FPC_RSV0],  1>;
354defm : SLMWriteResPair<WriteVecShiftImmY,[SLM_FPC_RSV0],  1>;
355defm : X86WriteResPairUnsupported<WriteVecShiftImmZ>;
356defm : SLMWriteResPair<WriteVarVecShift,  [SLM_FPC_RSV0],  1>;
357defm : X86WriteResPairUnsupported<WriteVarVecShiftY>;
358defm : X86WriteResPairUnsupported<WriteVarVecShiftZ>;
359
360defm : SLMWriteResPair<WriteVecLogic, [SLM_FPC_RSV01], 1>;
361defm : SLMWriteResPair<WriteVecLogicX,[SLM_FPC_RSV01], 1>;
362defm : SLMWriteResPair<WriteVecLogicY,[SLM_FPC_RSV01], 1>;
363defm : X86WriteResPairUnsupported<WriteVecLogicZ>;
364defm : SLMWriteResPair<WriteVecTest,  [SLM_FPC_RSV01], 1>;
365defm : SLMWriteResPair<WriteVecTestY, [SLM_FPC_RSV01], 1>;
366defm : X86WriteResPairUnsupported<WriteVecTestZ>;
367defm : SLMWriteResPair<WriteVecALU,   [SLM_FPC_RSV01],  1>;
368defm : SLMWriteResPair<WriteVecALUX,  [SLM_FPC_RSV01],  1>;
369defm : SLMWriteResPair<WriteVecALUY,  [SLM_FPC_RSV01],  1>;
370defm : X86WriteResPairUnsupported<WriteVecALUZ>;
371defm : SLMWriteResPair<WriteVecIMul,  [SLM_FPC_RSV0],   4>;
372defm : SLMWriteResPair<WriteVecIMulX, [SLM_FPC_RSV0],   5, [2], 2>;
373defm : SLMWriteResPair<WriteVecIMulY, [SLM_FPC_RSV0],   5, [2], 2>;
374defm : X86WriteResPairUnsupported<WriteVecIMulZ>;
375// FIXME: The below is closer to correct, but caused some perf regressions.
376//defm : SLMWriteResPair<WritePMULLD,  [SLM_FPC_RSV0],   11, [11], 7>;
377defm : SLMWriteResPair<WritePMULLD,  [SLM_FPC_RSV0],   4>;
378defm : SLMWriteResPair<WritePMULLDY, [SLM_FPC_RSV0],   4>;
379defm : X86WriteResPairUnsupported<WritePMULLDZ>;
380defm : SLMWriteResPair<WriteShuffle,  [SLM_FPC_RSV0],  1>;
381defm : SLMWriteResPair<WriteShuffleY, [SLM_FPC_RSV0],  1>;
382defm : X86WriteResPairUnsupported<WriteShuffleZ>;
383defm : SLMWriteResPair<WriteShuffleX, [SLM_FPC_RSV0],  1>;
384defm : SLMWriteResPair<WriteVarShuffle,  [SLM_FPC_RSV0],  1>;
385defm : SLMWriteResPair<WriteVarShuffleX, [SLM_FPC_RSV0],  5, [5], 4>;
386defm : SLMWriteResPair<WriteVarShuffleY, [SLM_FPC_RSV0],  5, [5], 4>;
387defm : X86WriteResPairUnsupported<WriteVarShuffleZ>;
388defm : SLMWriteResPair<WriteBlend,  [SLM_FPC_RSV0],  1>;
389defm : SLMWriteResPair<WriteBlendY, [SLM_FPC_RSV0],  1>;
390defm : X86WriteResPairUnsupported<WriteBlendZ>;
391defm : SLMWriteResPair<WriteVarBlend, [SLM_FPC_RSV0], 1>;
392defm : X86WriteResPairUnsupported<WriteVarBlendY>;
393defm : X86WriteResPairUnsupported<WriteVarBlendZ>;
394defm : SLMWriteResPair<WriteMPSAD,  [SLM_FPC_RSV0],  7>;
395defm : SLMWriteResPair<WriteMPSADY, [SLM_FPC_RSV0],  7>;
396defm : X86WriteResPairUnsupported<WriteMPSADZ>;
397defm : SLMWriteResPair<WritePSADBW,  [SLM_FPC_RSV0],  4>;
398defm : SLMWriteResPair<WritePSADBWX, [SLM_FPC_RSV0],  4>;
399defm : SLMWriteResPair<WritePSADBWY, [SLM_FPC_RSV0],  4>;
400defm : X86WriteResPairUnsupported<WritePSADBWZ>;
401defm : SLMWriteResPair<WritePHMINPOS,  [SLM_FPC_RSV0],   4>;
402defm : X86WriteResPairUnsupported<WriteShuffle256>;
403defm : X86WriteResPairUnsupported<WriteVarShuffle256>;
404defm : X86WriteResPairUnsupported<WriteVPMOV256>;
405
406// Vector insert/extract operations.
407defm : SLMWriteResPair<WriteVecInsert, [SLM_FPC_RSV0],  1>;
408
409def  : WriteRes<WriteVecExtract, [SLM_FPC_RSV0]>;
410def  : WriteRes<WriteVecExtractSt, [SLM_FPC_RSV0, SLM_MEC_RSV]> {
411  let Latency = 4;
412  let NumMicroOps = 2;
413  let ResourceCycles = [1, 2];
414}
415
416////////////////////////////////////////////////////////////////////////////////
417// Horizontal add/sub  instructions.
418////////////////////////////////////////////////////////////////////////////////
419
420defm : SLMWriteResPair<WriteFHAdd,   [SLM_FPC_RSV01], 6, [6], 4>;
421defm : SLMWriteResPair<WriteFHAddY,  [SLM_FPC_RSV01], 6, [6], 4>;
422defm : X86WriteResPairUnsupported<WriteFHAddZ>;
423defm : SLMWriteResPair<WritePHAdd,   [SLM_FPC_RSV01], 1>;
424defm : SLMWriteResPair<WritePHAddX,  [SLM_FPC_RSV01], 1>;
425defm : SLMWriteResPair<WritePHAddY,  [SLM_FPC_RSV01], 1>;
426defm : X86WriteResPairUnsupported<WritePHAddZ>;
427
428// String instructions.
429// Packed Compare Implicit Length Strings, Return Mask
430defm : SLMWriteResPair<WritePCmpIStrM,  [SLM_FPC_RSV0], 13, [13]>;
431
432// Packed Compare Explicit Length Strings, Return Mask
433defm : SLMWriteResPair<WritePCmpEStrM,  [SLM_FPC_RSV0], 17, [17]>;
434
435// Packed Compare Implicit Length Strings, Return Index
436defm : SLMWriteResPair<WritePCmpIStrI,  [SLM_FPC_RSV0], 17, [17]>;
437
438// Packed Compare Explicit Length Strings, Return Index
439defm : SLMWriteResPair<WritePCmpEStrI,  [SLM_FPC_RSV0], 21, [21]>;
440
441// MOVMSK Instructions.
442def : WriteRes<WriteFMOVMSK,    [SLM_FPC_RSV1]> { let Latency = 4; }
443def : WriteRes<WriteVecMOVMSK,  [SLM_FPC_RSV1]> { let Latency = 4; }
444def : WriteRes<WriteVecMOVMSKY, [SLM_FPC_RSV1]> { let Latency = 4; }
445def : WriteRes<WriteMMXMOVMSK,  [SLM_FPC_RSV1]> { let Latency = 4; }
446
447// AES Instructions.
448defm : SLMWriteResPair<WriteAESDecEnc, [SLM_FPC_RSV0], 8, [5]>;
449defm : SLMWriteResPair<WriteAESIMC,    [SLM_FPC_RSV0], 8, [5]>;
450defm : SLMWriteResPair<WriteAESKeyGen, [SLM_FPC_RSV0], 8, [5]>;
451
452// Carry-less multiplication instructions.
453defm : SLMWriteResPair<WriteCLMul, [SLM_FPC_RSV0], 10, [10]>;
454
455def : WriteRes<WriteSystem,     [SLM_FPC_RSV0]> { let Latency = 100; }
456def : WriteRes<WriteMicrocoded, [SLM_FPC_RSV0]> { let Latency = 100; }
457def : WriteRes<WriteFence, [SLM_MEC_RSV]>;
458def : WriteRes<WriteNop, []>;
459
460// Remaining SLM instrs.
461
462def SLMWriteResGroup1rr : SchedWriteRes<[SLM_FPC_RSV01]> {
463  let Latency = 4;
464  let NumMicroOps = 2;
465  let ResourceCycles = [4];
466}
467def: InstRW<[SLMWriteResGroup1rr], (instrs PADDQrr, PSUBQrr, PCMPEQQrr)>;
468
469def SLMWriteResGroup1rm : SchedWriteRes<[SLM_MEC_RSV,SLM_FPC_RSV01]> {
470  let Latency = 7;
471  let NumMicroOps = 3;
472  let ResourceCycles = [1,4];
473}
474def: InstRW<[SLMWriteResGroup1rm], (instrs PADDQrm, PSUBQrm, PCMPEQQrm)>;
475
476} // SchedModel
477