1 //=- X86ScheduleSLM.td - X86 Silvermont Scheduling -----------*- tablegen -*-=//
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
7 //===----------------------------------------------------------------------===//
9 // This file defines the machine model for Intel Silvermont to support
10 // instruction scheduling and other instruction cost heuristics.
12 //===----------------------------------------------------------------------===//
14 def SLMModel : SchedMachineModel {
15 // All x86 instructions are modeled as a single micro-op, and SLM can decode 2
16 // instructions per cycle.
18 let MicroOpBufferSize = 32; // Based on the reorder buffer.
20 let MispredictPenalty = 10;
21 let PostRAScheduler = 1;
23 // For small loops, expand by a small factor to hide the backedge cost.
24 let LoopMicroOpBufferSize = 10;
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;
31 let SchedModel = SLMModel in {
33 // Silvermont has 5 reservation stations for micro-ops
34 def SLM_IEC_RSV0 : ProcResource<1>;
35 def SLM_IEC_RSV1 : ProcResource<1>;
36 def SLM_FPC_RSV0 : ProcResource<1> { let BufferSize = 1; }
37 def SLM_FPC_RSV1 : ProcResource<1> { let BufferSize = 1; }
38 def SLM_MEC_RSV : ProcResource<1>;
40 // Many micro-ops are capable of issuing on multiple ports.
41 def SLM_IEC_RSV01 : ProcResGroup<[SLM_IEC_RSV0, SLM_IEC_RSV1]>;
42 def SLM_FPC_RSV01 : ProcResGroup<[SLM_FPC_RSV0, SLM_FPC_RSV1]>;
44 def SLMDivider : ProcResource<1>;
45 def SLMFPMultiplier : ProcResource<1>;
46 def SLMFPDivider : ProcResource<1>;
48 // Loads are 3 cycles, so ReadAfterLd registers needn't be available until 3
49 // cycles after the memory operand.
50 def : ReadAdvance<ReadAfterLd, 3>;
51 def : ReadAdvance<ReadAfterVecLd, 3>;
52 def : ReadAdvance<ReadAfterVecXLd, 3>;
53 def : ReadAdvance<ReadAfterVecYLd, 3>;
55 def : ReadAdvance<ReadInt2Fpu, 0>;
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
62 multiclass SLMWriteResPair<X86FoldableSchedWrite SchedRW,
63 list<ProcResourceKind> ExePorts,
64 int Lat, list<int> Res = [1], int UOps = 1,
66 // Register variant is using a single cycle on ExePort.
67 def : WriteRes<SchedRW, ExePorts> {
69 let ResourceCycles = Res;
70 let NumMicroOps = UOps;
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;
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.
84 def : WriteRes<WriteRMW, [SLM_MEC_RSV]>;
86 def : WriteRes<WriteStore, [SLM_IEC_RSV01, SLM_MEC_RSV]>;
87 def : WriteRes<WriteStoreNT, [SLM_IEC_RSV01, SLM_MEC_RSV]>;
88 def : WriteRes<WriteLoad, [SLM_MEC_RSV]> { let Latency = 3; }
89 def : WriteRes<WriteMove, [SLM_IEC_RSV01]>;
90 def : WriteRes<WriteZero, []>;
93 // FIXME: These are probably wrong. They are copy pasted from WriteStore/Load.
94 def : WriteRes<WriteSTMXCSR, [SLM_IEC_RSV01, SLM_MEC_RSV]>;
95 def : WriteRes<WriteLDMXCSR, [SLM_MEC_RSV]> { let Latency = 3; }
97 // Treat misc copies as a move.
98 def : InstRW<[WriteMove], (instrs COPY)>;
100 defm : SLMWriteResPair<WriteALU, [SLM_IEC_RSV01], 1>;
101 defm : SLMWriteResPair<WriteADC, [SLM_IEC_RSV01], 1>;
103 defm : SLMWriteResPair<WriteIMul8, [SLM_IEC_RSV1], 3>;
104 defm : SLMWriteResPair<WriteIMul16, [SLM_IEC_RSV1], 3>;
105 defm : SLMWriteResPair<WriteIMul16Imm, [SLM_IEC_RSV1], 3>;
106 defm : SLMWriteResPair<WriteIMul16Reg, [SLM_IEC_RSV1], 3>;
107 defm : SLMWriteResPair<WriteIMul32, [SLM_IEC_RSV1], 3>;
108 defm : SLMWriteResPair<WriteIMul32Imm, [SLM_IEC_RSV1], 3>;
109 defm : SLMWriteResPair<WriteIMul32Reg, [SLM_IEC_RSV1], 3>;
110 defm : SLMWriteResPair<WriteIMul64, [SLM_IEC_RSV1], 3>;
111 defm : SLMWriteResPair<WriteIMul64Imm, [SLM_IEC_RSV1], 3>;
112 defm : SLMWriteResPair<WriteIMul64Reg, [SLM_IEC_RSV1], 3>;
114 defm : X86WriteRes<WriteBSWAP32, [SLM_IEC_RSV01], 1, [1], 1>;
115 defm : X86WriteRes<WriteBSWAP64, [SLM_IEC_RSV01], 1, [1], 1>;
116 defm : X86WriteRes<WriteCMPXCHG, [SLM_IEC_RSV01], 1, [1], 1>;
117 defm : X86WriteRes<WriteCMPXCHGRMW, [SLM_IEC_RSV01, SLM_MEC_RSV], 4, [1, 2], 2>;
118 defm : X86WriteRes<WriteXCHG, [SLM_IEC_RSV01], 1, [1], 1>;
120 defm : SLMWriteResPair<WriteShift, [SLM_IEC_RSV0], 1>;
121 defm : SLMWriteResPair<WriteShiftCL, [SLM_IEC_RSV0], 1>;
122 defm : SLMWriteResPair<WriteRotate, [SLM_IEC_RSV0], 1>;
123 defm : SLMWriteResPair<WriteRotateCL, [SLM_IEC_RSV0], 1>;
125 defm : X86WriteRes<WriteSHDrri, [SLM_IEC_RSV0], 1, [1], 1>;
126 defm : X86WriteRes<WriteSHDrrcl,[SLM_IEC_RSV0], 1, [1], 1>;
127 defm : X86WriteRes<WriteSHDmri, [SLM_MEC_RSV, SLM_IEC_RSV0], 4, [2, 1], 2>;
128 defm : X86WriteRes<WriteSHDmrcl,[SLM_MEC_RSV, SLM_IEC_RSV0], 4, [2, 1], 2>;
130 defm : SLMWriteResPair<WriteJump, [SLM_IEC_RSV1], 1>;
131 defm : SLMWriteResPair<WriteCRC32, [SLM_IEC_RSV1], 3>;
133 defm : SLMWriteResPair<WriteCMOV, [SLM_IEC_RSV01], 2, [2]>;
134 defm : SLMWriteResPair<WriteCMOV2, [SLM_IEC_RSV01], 2, [2]>;
135 defm : X86WriteRes<WriteFCMOV, [SLM_FPC_RSV1], 3, [1], 1>; // x87 conditional move.
136 def : WriteRes<WriteSETCC, [SLM_IEC_RSV01]>;
137 def : WriteRes<WriteSETCCStore, [SLM_IEC_RSV01, SLM_MEC_RSV]> {
138 // FIXME Latency and NumMicrOps?
139 let ResourceCycles = [2,1];
141 defm : X86WriteRes<WriteLAHFSAHF, [SLM_IEC_RSV01], 1, [1], 1>;
142 defm : X86WriteRes<WriteBitTest, [SLM_IEC_RSV01], 1, [1], 1>;
143 defm : X86WriteRes<WriteBitTestImmLd, [SLM_IEC_RSV01, SLM_MEC_RSV], 4, [1,1], 1>;
144 defm : X86WriteRes<WriteBitTestRegLd, [SLM_IEC_RSV01, SLM_MEC_RSV], 4, [1,1], 1>;
145 defm : X86WriteRes<WriteBitTestSet, [SLM_IEC_RSV01], 1, [1], 1>;
146 defm : X86WriteRes<WriteBitTestSetImmLd, [SLM_IEC_RSV01, SLM_MEC_RSV], 3, [1,1], 1>;
147 defm : X86WriteRes<WriteBitTestSetRegLd, [SLM_IEC_RSV01, SLM_MEC_RSV], 3, [1,1], 1>;
149 // This is for simple LEAs with one or two input operands.
150 // The complex ones can only execute on port 1, and they require two cycles on
151 // the port to read all inputs. We don't model that.
152 def : WriteRes<WriteLEA, [SLM_IEC_RSV1]>;
155 defm : SLMWriteResPair<WriteBSF, [SLM_IEC_RSV01], 10, [20], 10>;
156 defm : SLMWriteResPair<WriteBSR, [SLM_IEC_RSV01], 10, [20], 10>;
157 defm : SLMWriteResPair<WriteLZCNT, [SLM_IEC_RSV0], 3>;
158 defm : SLMWriteResPair<WriteTZCNT, [SLM_IEC_RSV0], 3>;
159 defm : SLMWriteResPair<WritePOPCNT, [SLM_IEC_RSV0], 3>;
161 // BMI1 BEXTR/BLS, BMI2 BZHI
162 defm : X86WriteResPairUnsupported<WriteBEXTR>;
163 defm : X86WriteResPairUnsupported<WriteBLS>;
164 defm : X86WriteResPairUnsupported<WriteBZHI>;
166 defm : SLMWriteResPair<WriteDiv8, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
167 defm : SLMWriteResPair<WriteDiv16, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
168 defm : SLMWriteResPair<WriteDiv32, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
169 defm : SLMWriteResPair<WriteDiv64, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
170 defm : SLMWriteResPair<WriteIDiv8, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
171 defm : SLMWriteResPair<WriteIDiv16, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
172 defm : SLMWriteResPair<WriteIDiv32, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
173 defm : SLMWriteResPair<WriteIDiv64, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 4>;
175 // Scalar and vector floating point.
176 defm : X86WriteRes<WriteFLD0, [SLM_FPC_RSV01], 1, [1], 1>;
177 defm : X86WriteRes<WriteFLD1, [SLM_FPC_RSV01], 1, [1], 1>;
178 defm : X86WriteRes<WriteFLDC, [SLM_FPC_RSV01], 1, [2], 2>;
179 def : WriteRes<WriteFLoad, [SLM_MEC_RSV]> { let Latency = 3; }
180 def : WriteRes<WriteFLoadX, [SLM_MEC_RSV]> { let Latency = 3; }
181 def : WriteRes<WriteFLoadY, [SLM_MEC_RSV]> { let Latency = 3; }
182 def : WriteRes<WriteFMaskedLoad, [SLM_MEC_RSV]> { let Latency = 3; }
183 def : WriteRes<WriteFMaskedLoadY, [SLM_MEC_RSV]> { let Latency = 3; }
184 def : WriteRes<WriteFStore, [SLM_MEC_RSV]>;
185 def : WriteRes<WriteFStoreX, [SLM_MEC_RSV]>;
186 def : WriteRes<WriteFStoreY, [SLM_MEC_RSV]>;
187 def : WriteRes<WriteFStoreNT, [SLM_MEC_RSV]>;
188 def : WriteRes<WriteFStoreNTX, [SLM_MEC_RSV]>;
189 def : WriteRes<WriteFStoreNTY, [SLM_MEC_RSV]>;
190 def : WriteRes<WriteFMaskedStore, [SLM_MEC_RSV]>;
191 def : WriteRes<WriteFMaskedStoreY, [SLM_MEC_RSV]>;
192 def : WriteRes<WriteFMove, [SLM_FPC_RSV01]>;
193 def : WriteRes<WriteFMoveX, [SLM_FPC_RSV01]>;
194 def : WriteRes<WriteFMoveY, [SLM_FPC_RSV01]>;
195 defm : X86WriteRes<WriteEMMS, [SLM_FPC_RSV01], 10, [10], 9>;
197 defm : SLMWriteResPair<WriteFAdd, [SLM_FPC_RSV1], 3>;
198 defm : SLMWriteResPair<WriteFAddX, [SLM_FPC_RSV1], 3>;
199 defm : SLMWriteResPair<WriteFAddY, [SLM_FPC_RSV1], 3>;
200 defm : X86WriteResPairUnsupported<WriteFAddZ>;
201 defm : SLMWriteResPair<WriteFAdd64, [SLM_FPC_RSV1], 3>;
202 defm : SLMWriteResPair<WriteFAdd64X, [SLM_FPC_RSV1], 3>;
203 defm : SLMWriteResPair<WriteFAdd64Y, [SLM_FPC_RSV1], 3>;
204 defm : X86WriteResPairUnsupported<WriteFAdd64Z>;
205 defm : SLMWriteResPair<WriteFCmp, [SLM_FPC_RSV1], 3>;
206 defm : SLMWriteResPair<WriteFCmpX, [SLM_FPC_RSV1], 3>;
207 defm : SLMWriteResPair<WriteFCmpY, [SLM_FPC_RSV1], 3>;
208 defm : X86WriteResPairUnsupported<WriteFCmpZ>;
209 defm : SLMWriteResPair<WriteFCmp64, [SLM_FPC_RSV1], 3>;
210 defm : SLMWriteResPair<WriteFCmp64X, [SLM_FPC_RSV1], 3>;
211 defm : SLMWriteResPair<WriteFCmp64Y, [SLM_FPC_RSV1], 3>;
212 defm : X86WriteResPairUnsupported<WriteFCmp64Z>;
213 defm : SLMWriteResPair<WriteFCom, [SLM_FPC_RSV1], 3>;
214 defm : SLMWriteResPair<WriteFMul, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
215 defm : SLMWriteResPair<WriteFMulX, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
216 defm : SLMWriteResPair<WriteFMulY, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
217 defm : X86WriteResPairUnsupported<WriteFMulZ>;
218 defm : SLMWriteResPair<WriteFMul64, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
219 defm : SLMWriteResPair<WriteFMul64X, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
220 defm : SLMWriteResPair<WriteFMul64Y, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
221 defm : X86WriteResPairUnsupported<WriteFMul64Z>;
222 defm : SLMWriteResPair<WriteFDiv, [SLM_FPC_RSV0, SLMFPDivider], 19, [1,17]>;
223 defm : SLMWriteResPair<WriteFDivX, [SLM_FPC_RSV0, SLMFPDivider], 39, [1,39]>;
224 defm : SLMWriteResPair<WriteFDivY, [SLM_FPC_RSV0, SLMFPDivider], 39, [1,39]>;
225 defm : X86WriteResPairUnsupported<WriteFDivZ>;
226 defm : SLMWriteResPair<WriteFDiv64, [SLM_FPC_RSV0, SLMFPDivider], 34, [1,32]>;
227 defm : SLMWriteResPair<WriteFDiv64X, [SLM_FPC_RSV0, SLMFPDivider], 69, [1,69]>;
228 defm : SLMWriteResPair<WriteFDiv64Y, [SLM_FPC_RSV0, SLMFPDivider], 69, [1,69]>;
229 defm : X86WriteResPairUnsupported<WriteFDiv64Z>;
230 defm : SLMWriteResPair<WriteFRcp, [SLM_FPC_RSV0], 5>;
231 defm : SLMWriteResPair<WriteFRcpX, [SLM_FPC_RSV0], 5>;
232 defm : SLMWriteResPair<WriteFRcpY, [SLM_FPC_RSV0], 5>;
233 defm : X86WriteResPairUnsupported<WriteFRcpZ>;
234 defm : SLMWriteResPair<WriteFRsqrt, [SLM_FPC_RSV0], 5>;
235 defm : SLMWriteResPair<WriteFRsqrtX, [SLM_FPC_RSV0], 5>;
236 defm : SLMWriteResPair<WriteFRsqrtY, [SLM_FPC_RSV0], 5>;
237 defm : X86WriteResPairUnsupported<WriteFRsqrtZ>;
238 defm : SLMWriteResPair<WriteFSqrt, [SLM_FPC_RSV0,SLMFPDivider], 20, [1,20], 1, 3>;
239 defm : SLMWriteResPair<WriteFSqrtX, [SLM_FPC_RSV0,SLMFPDivider], 41, [1,40], 1, 3>;
240 defm : SLMWriteResPair<WriteFSqrtY, [SLM_FPC_RSV0,SLMFPDivider], 41, [1,40], 1, 3>;
241 defm : X86WriteResPairUnsupported<WriteFSqrtZ>;
242 defm : SLMWriteResPair<WriteFSqrt64, [SLM_FPC_RSV0,SLMFPDivider], 35, [1,35], 1, 3>;
243 defm : SLMWriteResPair<WriteFSqrt64X, [SLM_FPC_RSV0,SLMFPDivider], 71, [1,70], 1, 3>;
244 defm : SLMWriteResPair<WriteFSqrt64Y, [SLM_FPC_RSV0,SLMFPDivider], 71, [1,70], 1, 3>;
245 defm : X86WriteResPairUnsupported<WriteFSqrt64Z>;
246 defm : SLMWriteResPair<WriteFSqrt80, [SLM_FPC_RSV0,SLMFPDivider], 40, [1,40]>;
247 defm : SLMWriteResPair<WriteDPPD, [SLM_FPC_RSV1], 3>;
248 defm : SLMWriteResPair<WriteDPPS, [SLM_FPC_RSV1], 3>;
249 defm : SLMWriteResPair<WriteDPPSY, [SLM_FPC_RSV1], 3>;
250 defm : X86WriteResPairUnsupported<WriteDPPSZ>;
251 defm : SLMWriteResPair<WriteFSign, [SLM_FPC_RSV01], 1>;
252 defm : SLMWriteResPair<WriteFRnd, [SLM_FPC_RSV1], 3>;
253 defm : SLMWriteResPair<WriteFRndY, [SLM_FPC_RSV1], 3>;
254 defm : X86WriteResPairUnsupported<WriteFRndZ>;
255 defm : SLMWriteResPair<WriteFLogic, [SLM_FPC_RSV01], 1>;
256 defm : SLMWriteResPair<WriteFLogicY, [SLM_FPC_RSV01], 1>;
257 defm : X86WriteResPairUnsupported<WriteFLogicZ>;
258 defm : SLMWriteResPair<WriteFTest, [SLM_FPC_RSV01], 1>;
259 defm : SLMWriteResPair<WriteFTestY, [SLM_FPC_RSV01], 1>;
260 defm : X86WriteResPairUnsupported<WriteFTestZ>;
261 defm : SLMWriteResPair<WriteFShuffle, [SLM_FPC_RSV0], 1>;
262 defm : SLMWriteResPair<WriteFShuffleY, [SLM_FPC_RSV0], 1>;
263 defm : X86WriteResPairUnsupported<WriteFShuffleZ>;
264 defm : SLMWriteResPair<WriteFVarShuffle, [SLM_FPC_RSV0], 1>;
265 defm : SLMWriteResPair<WriteFVarShuffleY,[SLM_FPC_RSV0], 1>;
266 defm : X86WriteResPairUnsupported<WriteFVarShuffleZ>;
267 defm : SLMWriteResPair<WriteFBlend, [SLM_FPC_RSV0], 1>;
269 // Conversion between integer and float.
270 defm : SLMWriteResPair<WriteCvtSS2I, [SLM_FPC_RSV01], 4>;
271 defm : SLMWriteResPair<WriteCvtPS2I, [SLM_FPC_RSV01], 4>;
272 defm : SLMWriteResPair<WriteCvtPS2IY, [SLM_FPC_RSV01], 4>;
273 defm : X86WriteResPairUnsupported<WriteCvtPS2IZ>;
274 defm : SLMWriteResPair<WriteCvtSD2I, [SLM_FPC_RSV01], 4>;
275 defm : SLMWriteResPair<WriteCvtPD2I, [SLM_FPC_RSV01], 4>;
276 defm : SLMWriteResPair<WriteCvtPD2IY, [SLM_FPC_RSV01], 4>;
277 defm : X86WriteResPairUnsupported<WriteCvtPD2IZ>;
279 defm : SLMWriteResPair<WriteCvtI2SS, [SLM_FPC_RSV01], 4>;
280 defm : SLMWriteResPair<WriteCvtI2PS, [SLM_FPC_RSV01], 4>;
281 defm : SLMWriteResPair<WriteCvtI2PSY, [SLM_FPC_RSV01], 4>;
282 defm : X86WriteResPairUnsupported<WriteCvtI2PSZ>;
283 defm : SLMWriteResPair<WriteCvtI2SD, [SLM_FPC_RSV01], 4>;
284 defm : SLMWriteResPair<WriteCvtI2PD, [SLM_FPC_RSV01], 4>;
285 defm : SLMWriteResPair<WriteCvtI2PDY, [SLM_FPC_RSV01], 4>;
286 defm : X86WriteResPairUnsupported<WriteCvtI2PDZ>;
288 defm : SLMWriteResPair<WriteCvtSS2SD, [SLM_FPC_RSV01], 4>;
289 defm : SLMWriteResPair<WriteCvtPS2PD, [SLM_FPC_RSV01], 4>;
290 defm : SLMWriteResPair<WriteCvtPS2PDY, [SLM_FPC_RSV01], 4>;
291 defm : X86WriteResPairUnsupported<WriteCvtPS2PDZ>;
292 defm : SLMWriteResPair<WriteCvtSD2SS, [SLM_FPC_RSV01], 4>;
293 defm : SLMWriteResPair<WriteCvtPD2PS, [SLM_FPC_RSV01], 4>;
294 defm : SLMWriteResPair<WriteCvtPD2PSY, [SLM_FPC_RSV01], 4>;
295 defm : X86WriteResPairUnsupported<WriteCvtPD2PSZ>;
297 // Vector integer operations.
298 def : WriteRes<WriteVecLoad, [SLM_MEC_RSV]> { let Latency = 3; }
299 def : WriteRes<WriteVecLoadX, [SLM_MEC_RSV]> { let Latency = 3; }
300 def : WriteRes<WriteVecLoadY, [SLM_MEC_RSV]> { let Latency = 3; }
301 def : WriteRes<WriteVecLoadNT, [SLM_MEC_RSV]> { let Latency = 3; }
302 def : WriteRes<WriteVecLoadNTY, [SLM_MEC_RSV]> { let Latency = 3; }
303 def : WriteRes<WriteVecMaskedLoad, [SLM_MEC_RSV]> { let Latency = 3; }
304 def : WriteRes<WriteVecMaskedLoadY, [SLM_MEC_RSV]> { let Latency = 3; }
305 def : WriteRes<WriteVecStore, [SLM_MEC_RSV]>;
306 def : WriteRes<WriteVecStoreX, [SLM_MEC_RSV]>;
307 def : WriteRes<WriteVecStoreY, [SLM_MEC_RSV]>;
308 def : WriteRes<WriteVecStoreNT, [SLM_MEC_RSV]>;
309 def : WriteRes<WriteVecStoreNTY, [SLM_MEC_RSV]>;
310 def : WriteRes<WriteVecMaskedStore, [SLM_MEC_RSV]>;
311 def : WriteRes<WriteVecMaskedStoreY, [SLM_MEC_RSV]>;
312 def : WriteRes<WriteVecMove, [SLM_FPC_RSV01]>;
313 def : WriteRes<WriteVecMoveX, [SLM_FPC_RSV01]>;
314 def : WriteRes<WriteVecMoveY, [SLM_FPC_RSV01]>;
315 def : WriteRes<WriteVecMoveToGpr, [SLM_IEC_RSV01]>;
316 def : WriteRes<WriteVecMoveFromGpr, [SLM_IEC_RSV01]>;
318 defm : SLMWriteResPair<WriteVecShift, [SLM_FPC_RSV0], 1>;
319 defm : SLMWriteResPair<WriteVecShiftX, [SLM_FPC_RSV0], 1>;
320 defm : SLMWriteResPair<WriteVecShiftY, [SLM_FPC_RSV0], 1>;
321 defm : X86WriteResPairUnsupported<WriteVecShiftZ>;
322 defm : SLMWriteResPair<WriteVecShiftImm, [SLM_FPC_RSV0], 1>;
323 defm : SLMWriteResPair<WriteVecShiftImmX,[SLM_FPC_RSV0], 1>;
324 defm : SLMWriteResPair<WriteVecShiftImmY,[SLM_FPC_RSV0], 1>;
325 defm : X86WriteResPairUnsupported<WriteVecShiftImmZ>;
326 defm : SLMWriteResPair<WriteVecLogic, [SLM_FPC_RSV01], 1>;
327 defm : SLMWriteResPair<WriteVecLogicX,[SLM_FPC_RSV01], 1>;
328 defm : SLMWriteResPair<WriteVecLogicY,[SLM_FPC_RSV01], 1>;
329 defm : X86WriteResPairUnsupported<WriteVecLogicZ>;
330 defm : SLMWriteResPair<WriteVecTest, [SLM_FPC_RSV01], 1>;
331 defm : SLMWriteResPair<WriteVecTestY, [SLM_FPC_RSV01], 1>;
332 defm : X86WriteResPairUnsupported<WriteVecTestZ>;
333 defm : SLMWriteResPair<WriteVecALU, [SLM_FPC_RSV01], 1>;
334 defm : SLMWriteResPair<WriteVecALUX, [SLM_FPC_RSV01], 1>;
335 defm : SLMWriteResPair<WriteVecALUY, [SLM_FPC_RSV01], 1>;
336 defm : X86WriteResPairUnsupported<WriteVecALUZ>;
337 defm : SLMWriteResPair<WriteVecIMul, [SLM_FPC_RSV0], 4>;
338 defm : SLMWriteResPair<WriteVecIMulX, [SLM_FPC_RSV0], 4>;
339 defm : SLMWriteResPair<WriteVecIMulY, [SLM_FPC_RSV0], 4>;
340 defm : X86WriteResPairUnsupported<WriteVecIMulZ>;
341 // FIXME: The below is closer to correct, but caused some perf regressions.
342 //defm : SLMWriteResPair<WritePMULLD, [SLM_FPC_RSV0], 11, [11], 7>;
343 defm : SLMWriteResPair<WritePMULLD, [SLM_FPC_RSV0], 4>;
344 defm : SLMWriteResPair<WritePMULLDY, [SLM_FPC_RSV0], 4>;
345 defm : X86WriteResPairUnsupported<WritePMULLDZ>;
346 defm : SLMWriteResPair<WriteShuffle, [SLM_FPC_RSV0], 1>;
347 defm : SLMWriteResPair<WriteShuffleY, [SLM_FPC_RSV0], 1>;
348 defm : X86WriteResPairUnsupported<WriteShuffleZ>;
349 defm : SLMWriteResPair<WriteShuffleX, [SLM_FPC_RSV0], 1>;
350 defm : SLMWriteResPair<WriteVarShuffle, [SLM_FPC_RSV0], 1>;
351 defm : SLMWriteResPair<WriteVarShuffleX, [SLM_FPC_RSV0], 1>;
352 defm : SLMWriteResPair<WriteVarShuffleY, [SLM_FPC_RSV0], 1>;
353 defm : X86WriteResPairUnsupported<WriteVarShuffleZ>;
354 defm : SLMWriteResPair<WriteBlend, [SLM_FPC_RSV0], 1>;
355 defm : SLMWriteResPair<WriteBlendY, [SLM_FPC_RSV0], 1>;
356 defm : X86WriteResPairUnsupported<WriteBlendZ>;
357 defm : SLMWriteResPair<WriteMPSAD, [SLM_FPC_RSV0], 7>;
358 defm : SLMWriteResPair<WriteMPSADY, [SLM_FPC_RSV0], 7>;
359 defm : X86WriteResPairUnsupported<WriteMPSADZ>;
360 defm : SLMWriteResPair<WritePSADBW, [SLM_FPC_RSV0], 4>;
361 defm : SLMWriteResPair<WritePSADBWX, [SLM_FPC_RSV0], 4>;
362 defm : SLMWriteResPair<WritePSADBWY, [SLM_FPC_RSV0], 4>;
363 defm : X86WriteResPairUnsupported<WritePSADBWZ>;
364 defm : SLMWriteResPair<WritePHMINPOS, [SLM_FPC_RSV0], 4>;
366 // Vector insert/extract operations.
367 defm : SLMWriteResPair<WriteVecInsert, [SLM_FPC_RSV0], 1>;
369 def : WriteRes<WriteVecExtract, [SLM_FPC_RSV0]>;
370 def : WriteRes<WriteVecExtractSt, [SLM_FPC_RSV0, SLM_MEC_RSV]> {
373 let ResourceCycles = [1, 2];
376 ////////////////////////////////////////////////////////////////////////////////
377 // Horizontal add/sub instructions.
378 ////////////////////////////////////////////////////////////////////////////////
380 defm : SLMWriteResPair<WriteFHAdd, [SLM_FPC_RSV01], 3, [2]>;
381 defm : SLMWriteResPair<WriteFHAddY, [SLM_FPC_RSV01], 3, [2]>;
382 defm : X86WriteResPairUnsupported<WriteFHAddZ>;
383 defm : SLMWriteResPair<WritePHAdd, [SLM_FPC_RSV01], 1>;
384 defm : SLMWriteResPair<WritePHAddX, [SLM_FPC_RSV01], 1>;
385 defm : SLMWriteResPair<WritePHAddY, [SLM_FPC_RSV01], 1>;
386 defm : X86WriteResPairUnsupported<WritePHAddZ>;
388 // String instructions.
389 // Packed Compare Implicit Length Strings, Return Mask
390 def : WriteRes<WritePCmpIStrM, [SLM_FPC_RSV0]> {
392 let ResourceCycles = [13];
394 def : WriteRes<WritePCmpIStrMLd, [SLM_FPC_RSV0, SLM_MEC_RSV]> {
396 let ResourceCycles = [13, 1];
399 // Packed Compare Explicit Length Strings, Return Mask
400 def : WriteRes<WritePCmpEStrM, [SLM_FPC_RSV0]> {
402 let ResourceCycles = [17];
404 def : WriteRes<WritePCmpEStrMLd, [SLM_FPC_RSV0, SLM_MEC_RSV]> {
406 let ResourceCycles = [17, 1];
409 // Packed Compare Implicit Length Strings, Return Index
410 def : WriteRes<WritePCmpIStrI, [SLM_FPC_RSV0]> {
412 let ResourceCycles = [17];
414 def : WriteRes<WritePCmpIStrILd, [SLM_FPC_RSV0, SLM_MEC_RSV]> {
416 let ResourceCycles = [17, 1];
419 // Packed Compare Explicit Length Strings, Return Index
420 def : WriteRes<WritePCmpEStrI, [SLM_FPC_RSV0]> {
422 let ResourceCycles = [21];
424 def : WriteRes<WritePCmpEStrILd, [SLM_FPC_RSV0, SLM_MEC_RSV]> {
426 let ResourceCycles = [21, 1];
429 // MOVMSK Instructions.
430 def : WriteRes<WriteFMOVMSK, [SLM_FPC_RSV1]> { let Latency = 4; }
431 def : WriteRes<WriteVecMOVMSK, [SLM_FPC_RSV1]> { let Latency = 4; }
432 def : WriteRes<WriteVecMOVMSKY, [SLM_FPC_RSV1]> { let Latency = 4; }
433 def : WriteRes<WriteMMXMOVMSK, [SLM_FPC_RSV1]> { let Latency = 4; }
436 def : WriteRes<WriteAESDecEnc, [SLM_FPC_RSV0]> {
438 let ResourceCycles = [5];
440 def : WriteRes<WriteAESDecEncLd, [SLM_FPC_RSV0, SLM_MEC_RSV]> {
442 let ResourceCycles = [5, 1];
445 def : WriteRes<WriteAESIMC, [SLM_FPC_RSV0]> {
447 let ResourceCycles = [5];
449 def : WriteRes<WriteAESIMCLd, [SLM_FPC_RSV0, SLM_MEC_RSV]> {
451 let ResourceCycles = [5, 1];
454 def : WriteRes<WriteAESKeyGen, [SLM_FPC_RSV0]> {
456 let ResourceCycles = [5];
458 def : WriteRes<WriteAESKeyGenLd, [SLM_FPC_RSV0, SLM_MEC_RSV]> {
460 let ResourceCycles = [5, 1];
463 // Carry-less multiplication instructions.
464 def : WriteRes<WriteCLMul, [SLM_FPC_RSV0]> {
466 let ResourceCycles = [10];
468 def : WriteRes<WriteCLMulLd, [SLM_FPC_RSV0, SLM_MEC_RSV]> {
470 let ResourceCycles = [10, 1];
473 def : WriteRes<WriteSystem, [SLM_FPC_RSV0]> { let Latency = 100; }
474 def : WriteRes<WriteMicrocoded, [SLM_FPC_RSV0]> { let Latency = 100; }
475 def : WriteRes<WriteFence, [SLM_MEC_RSV]>;
476 def : WriteRes<WriteNop, []>;
478 // AVX/FMA is not supported on that architecture, but we should define the basic
479 // scheduling resources anyway.
480 def : WriteRes<WriteIMulH, [SLM_FPC_RSV0]>;
481 defm : X86WriteResPairUnsupported<WriteFBlendY>;
482 defm : X86WriteResPairUnsupported<WriteFBlendZ>;
483 defm : SLMWriteResPair<WriteVarBlend, [SLM_FPC_RSV0], 1>;
484 defm : X86WriteResPairUnsupported<WriteVarBlendY>;
485 defm : X86WriteResPairUnsupported<WriteVarBlendZ>;
486 defm : SLMWriteResPair<WriteFVarBlend, [SLM_FPC_RSV0], 1>;
487 defm : X86WriteResPairUnsupported<WriteFVarBlendY>;
488 defm : X86WriteResPairUnsupported<WriteFVarBlendZ>;
489 defm : X86WriteResPairUnsupported<WriteFShuffle256>;
490 defm : X86WriteResPairUnsupported<WriteFVarShuffle256>;
491 defm : X86WriteResPairUnsupported<WriteShuffle256>;
492 defm : X86WriteResPairUnsupported<WriteVarShuffle256>;
493 defm : SLMWriteResPair<WriteVarVecShift, [SLM_FPC_RSV0], 1>;
494 defm : X86WriteResPairUnsupported<WriteVarVecShiftY>;
495 defm : X86WriteResPairUnsupported<WriteVarVecShiftZ>;
496 defm : X86WriteResPairUnsupported<WriteFMA>;
497 defm : X86WriteResPairUnsupported<WriteFMAX>;
498 defm : X86WriteResPairUnsupported<WriteFMAY>;
499 defm : X86WriteResPairUnsupported<WriteFMAZ>;
501 defm : X86WriteResPairUnsupported<WriteCvtPH2PS>;
502 defm : X86WriteResPairUnsupported<WriteCvtPH2PSY>;
503 defm : X86WriteResPairUnsupported<WriteCvtPH2PSZ>;
504 defm : X86WriteResUnsupported<WriteCvtPS2PH>;
505 defm : X86WriteResUnsupported<WriteCvtPS2PHY>;
506 defm : X86WriteResUnsupported<WriteCvtPS2PHZ>;
507 defm : X86WriteResUnsupported<WriteCvtPS2PHSt>;
508 defm : X86WriteResUnsupported<WriteCvtPS2PHYSt>;
509 defm : X86WriteResUnsupported<WriteCvtPS2PHZSt>;