1 //=- X86SchedHaswell.td - X86 Haswell 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 Haswell to support instruction
10 // scheduling and other instruction cost heuristics.
12 // Note that we define some instructions here that are not supported by haswell,
13 // but we still have to define them because KNL uses the HSW model.
14 // They are currently tagged with a comment `Unsupported = 1`.
15 // FIXME: Use Unsupported = 1 once KNL has its own model.
17 //===----------------------------------------------------------------------===//
19 def HaswellModel : SchedMachineModel {
20 // All x86 instructions are modeled as a single micro-op, and HW can decode 4
21 // instructions per cycle.
23 let MicroOpBufferSize = 192; // Based on the reorder buffer.
25 let MispredictPenalty = 16;
27 // Based on the LSD (loop-stream detector) queue size and benchmarking data.
28 let LoopMicroOpBufferSize = 50;
30 // This flag is set to allow the scheduler to assign a default model to
31 // unrecognized opcodes.
32 let CompleteModel = 0;
35 let SchedModel = HaswellModel in {
37 // Haswell can issue micro-ops to 8 different ports in one cycle.
39 // Ports 0, 1, 5, and 6 handle all computation.
40 // Port 4 gets the data half of stores. Store data can be available later than
41 // the store address, but since we don't model the latency of stores, we can
43 // Ports 2 and 3 are identical. They handle loads and the address half of
44 // stores. Port 7 can handle address calculations.
45 def HWPort0 : ProcResource<1>;
46 def HWPort1 : ProcResource<1>;
47 def HWPort2 : ProcResource<1>;
48 def HWPort3 : ProcResource<1>;
49 def HWPort4 : ProcResource<1>;
50 def HWPort5 : ProcResource<1>;
51 def HWPort6 : ProcResource<1>;
52 def HWPort7 : ProcResource<1>;
54 // Many micro-ops are capable of issuing on multiple ports.
55 def HWPort01 : ProcResGroup<[HWPort0, HWPort1]>;
56 def HWPort23 : ProcResGroup<[HWPort2, HWPort3]>;
57 def HWPort237 : ProcResGroup<[HWPort2, HWPort3, HWPort7]>;
58 def HWPort04 : ProcResGroup<[HWPort0, HWPort4]>;
59 def HWPort05 : ProcResGroup<[HWPort0, HWPort5]>;
60 def HWPort06 : ProcResGroup<[HWPort0, HWPort6]>;
61 def HWPort15 : ProcResGroup<[HWPort1, HWPort5]>;
62 def HWPort16 : ProcResGroup<[HWPort1, HWPort6]>;
63 def HWPort56 : ProcResGroup<[HWPort5, HWPort6]>;
64 def HWPort015 : ProcResGroup<[HWPort0, HWPort1, HWPort5]>;
65 def HWPort056 : ProcResGroup<[HWPort0, HWPort5, HWPort6]>;
66 def HWPort0156: ProcResGroup<[HWPort0, HWPort1, HWPort5, HWPort6]>;
68 // 60 Entry Unified Scheduler
69 def HWPortAny : ProcResGroup<[HWPort0, HWPort1, HWPort2, HWPort3, HWPort4,
70 HWPort5, HWPort6, HWPort7]> {
74 // Integer division issued on port 0.
75 def HWDivider : ProcResource<1>;
76 // FP division and sqrt on port 0.
77 def HWFPDivider : ProcResource<1>;
79 // Integer loads are 5 cycles, so ReadAfterLd registers needn't be available until 5
80 // cycles after the memory operand.
81 def : ReadAdvance<ReadAfterLd, 5>;
83 // Vector loads are 5/6/7 cycles, so ReadAfterVec*Ld registers needn't be available
84 // until 5/6/7 cycles after the memory operand.
85 def : ReadAdvance<ReadAfterVecLd, 5>;
86 def : ReadAdvance<ReadAfterVecXLd, 6>;
87 def : ReadAdvance<ReadAfterVecYLd, 7>;
89 def : ReadAdvance<ReadInt2Fpu, 0>;
91 // Many SchedWrites are defined in pairs with and without a folded load.
92 // Instructions with folded loads are usually micro-fused, so they only appear
93 // as two micro-ops when queued in the reservation station.
94 // This multiclass defines the resource usage for variants with and without
96 multiclass HWWriteResPair<X86FoldableSchedWrite SchedRW,
97 list<ProcResourceKind> ExePorts,
98 int Lat, list<int> Res = [1], int UOps = 1,
100 // Register variant is using a single cycle on ExePort.
101 def : WriteRes<SchedRW, ExePorts> {
103 let ResourceCycles = Res;
104 let NumMicroOps = UOps;
107 // Memory variant also uses a cycle on port 2/3 and adds LoadLat cycles to
108 // the latency (default = 5).
109 def : WriteRes<SchedRW.Folded, !listconcat([HWPort23], ExePorts)> {
110 let Latency = !add(Lat, LoadLat);
111 let ResourceCycles = !listconcat([1], Res);
112 let NumMicroOps = !add(UOps, 1);
116 // A folded store needs a cycle on port 4 for the store data, and an extra port
117 // 2/3/7 cycle to recompute the address.
118 def : WriteRes<WriteRMW, [HWPort237,HWPort4]>;
120 // Store_addr on 237.
122 defm : X86WriteRes<WriteStore, [HWPort237, HWPort4], 1, [1,1], 1>;
123 defm : X86WriteRes<WriteStoreNT, [HWPort237, HWPort4], 1, [1,1], 2>;
124 defm : X86WriteRes<WriteLoad, [HWPort23], 5, [1], 1>;
125 defm : X86WriteRes<WriteMove, [HWPort0156], 1, [1], 1>;
126 def : WriteRes<WriteZero, []>;
128 // Model the effect of clobbering the read-write mask operand of the GATHER operation.
129 // Does not cost anything by itself, only has latency, matching that of the WriteLoad,
130 defm : X86WriteRes<WriteVecMaskedGatherWriteback, [], 5, [], 0>;
133 defm : HWWriteResPair<WriteALU, [HWPort0156], 1>;
134 defm : HWWriteResPair<WriteADC, [HWPort06, HWPort0156], 2, [1,1], 2>;
136 // Integer multiplication.
137 defm : HWWriteResPair<WriteIMul8, [HWPort1], 3>;
138 defm : HWWriteResPair<WriteIMul16, [HWPort1,HWPort06,HWPort0156], 4, [1,1,2], 4>;
139 defm : X86WriteRes<WriteIMul16Imm, [HWPort1,HWPort0156], 4, [1,1], 2>;
140 defm : X86WriteRes<WriteIMul16ImmLd, [HWPort1,HWPort0156,HWPort23], 8, [1,1,1], 3>;
141 defm : HWWriteResPair<WriteIMul16Reg, [HWPort1], 3>;
142 defm : HWWriteResPair<WriteIMul32, [HWPort1,HWPort06,HWPort0156], 4, [1,1,1], 3>;
143 defm : HWWriteResPair<WriteMULX32, [HWPort1,HWPort06,HWPort0156], 4, [1,1,1], 3>;
144 defm : HWWriteResPair<WriteIMul32Imm, [HWPort1], 3>;
145 defm : HWWriteResPair<WriteIMul32Reg, [HWPort1], 3>;
146 defm : HWWriteResPair<WriteIMul64, [HWPort1,HWPort6], 4, [1,1], 2>;
147 defm : HWWriteResPair<WriteMULX64, [HWPort1,HWPort6], 4, [1,1], 2>;
148 defm : HWWriteResPair<WriteIMul64Imm, [HWPort1], 3>;
149 defm : HWWriteResPair<WriteIMul64Reg, [HWPort1], 3>;
150 def : WriteRes<WriteIMulH, []> { let Latency = 3; }
152 defm : X86WriteRes<WriteBSWAP32, [HWPort15], 1, [1], 1>;
153 defm : X86WriteRes<WriteBSWAP64, [HWPort06, HWPort15], 2, [1,1], 2>;
154 defm : X86WriteRes<WriteCMPXCHG,[HWPort06, HWPort0156], 5, [2,3], 5>;
155 defm : X86WriteRes<WriteCMPXCHGRMW,[HWPort23,HWPort06,HWPort0156,HWPort237,HWPort4], 9, [1,2,1,1,1], 6>;
156 defm : X86WriteRes<WriteXCHG, [HWPort0156], 2, [3], 3>;
158 // Integer shifts and rotates.
159 defm : HWWriteResPair<WriteShift, [HWPort06], 1>;
160 defm : HWWriteResPair<WriteShiftCL, [HWPort06, HWPort0156], 3, [2,1], 3>;
161 defm : HWWriteResPair<WriteRotate, [HWPort06], 1, [1], 1>;
162 defm : HWWriteResPair<WriteRotateCL, [HWPort06, HWPort0156], 3, [2,1], 3>;
165 defm : X86WriteRes<WriteSHDrri, [HWPort1], 3, [1], 1>;
166 defm : X86WriteRes<WriteSHDrrcl,[HWPort1, HWPort06, HWPort0156], 6, [1, 1, 2], 4>;
167 defm : X86WriteRes<WriteSHDmri, [HWPort1, HWPort23, HWPort237, HWPort0156], 10, [1, 1, 1, 1], 4>;
168 defm : X86WriteRes<WriteSHDmrcl,[HWPort1, HWPort23, HWPort237, HWPort06, HWPort0156], 12, [1, 1, 1, 1, 2], 6>;
170 defm : HWWriteResPair<WriteJump, [HWPort06], 1>;
171 defm : HWWriteResPair<WriteCRC32, [HWPort1], 3>;
173 defm : HWWriteResPair<WriteCMOV, [HWPort06,HWPort0156], 2, [1,1], 2>; // Conditional move.
174 defm : X86WriteRes<WriteFCMOV, [HWPort1], 3, [1], 1>; // x87 conditional move.
175 def : WriteRes<WriteSETCC, [HWPort06]>; // Setcc.
176 def : WriteRes<WriteSETCCStore, [HWPort06,HWPort4,HWPort237]> {
181 defm : X86WriteRes<WriteLAHFSAHF, [HWPort06], 1, [1], 1>;
182 defm : X86WriteRes<WriteBitTest, [HWPort06], 1, [1], 1>;
183 defm : X86WriteRes<WriteBitTestImmLd, [HWPort06,HWPort23], 6, [1,1], 2>;
184 defm : X86WriteRes<WriteBitTestRegLd, [], 1, [], 10>;
185 defm : X86WriteRes<WriteBitTestSet, [HWPort06], 1, [1], 1>;
186 defm : X86WriteRes<WriteBitTestSetImmLd, [HWPort06,HWPort23], 6, [1,1], 3>;
187 //defm : X86WriteRes<WriteBitTestSetRegLd, [], 1, [], 11>;
189 // This is for simple LEAs with one or two input operands.
190 // The complex ones can only execute on port 1, and they require two cycles on
191 // the port to read all inputs. We don't model that.
192 def : WriteRes<WriteLEA, [HWPort15]>;
195 defm : HWWriteResPair<WriteBSF, [HWPort1], 3>;
196 defm : HWWriteResPair<WriteBSR, [HWPort1], 3>;
197 defm : HWWriteResPair<WriteLZCNT, [HWPort1], 3>;
198 defm : HWWriteResPair<WriteTZCNT, [HWPort1], 3>;
199 defm : HWWriteResPair<WritePOPCNT, [HWPort1], 3>;
201 // BMI1 BEXTR/BLS, BMI2 BZHI
202 defm : HWWriteResPair<WriteBEXTR, [HWPort06,HWPort15], 2, [1,1], 2>;
203 defm : HWWriteResPair<WriteBLS, [HWPort15], 1>;
204 defm : HWWriteResPair<WriteBZHI, [HWPort15], 1>;
206 // TODO: Why isn't the HWDivider used?
207 defm : X86WriteRes<WriteDiv8, [HWPort0,HWPort1,HWPort5,HWPort6], 22, [], 9>;
208 defm : X86WriteRes<WriteDiv16, [HWPort0,HWPort1,HWPort5,HWPort6,HWPort01,HWPort0156], 98, [7,7,3,3,1,11], 32>;
209 defm : X86WriteRes<WriteDiv32, [HWPort0,HWPort1,HWPort5,HWPort6,HWPort01,HWPort0156], 98, [7,7,3,3,1,11], 32>;
210 defm : X86WriteRes<WriteDiv64, [HWPort0,HWPort1,HWPort5,HWPort6,HWPort01,HWPort0156], 98, [7,7,3,3,1,11], 32>;
211 defm : X86WriteRes<WriteDiv8Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>;
212 defm : X86WriteRes<WriteDiv16Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>;
213 defm : X86WriteRes<WriteDiv32Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>;
214 defm : X86WriteRes<WriteDiv64Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>;
216 defm : X86WriteRes<WriteIDiv8, [HWPort0,HWPort1,HWPort5,HWPort6], 23, [], 9>;
217 defm : X86WriteRes<WriteIDiv16, [HWPort0,HWPort1,HWPort5,HWPort6,HWPort06,HWPort0156], 112, [4,2,4,8,14,34], 66>;
218 defm : X86WriteRes<WriteIDiv32, [HWPort0,HWPort1,HWPort5,HWPort6,HWPort06,HWPort0156], 112, [4,2,4,8,14,34], 66>;
219 defm : X86WriteRes<WriteIDiv64, [HWPort0,HWPort1,HWPort5,HWPort6,HWPort06,HWPort0156], 112, [4,2,4,8,14,34], 66>;
220 defm : X86WriteRes<WriteIDiv8Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>;
221 defm : X86WriteRes<WriteIDiv16Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>;
222 defm : X86WriteRes<WriteIDiv32Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>;
223 defm : X86WriteRes<WriteIDiv64Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>;
225 // Scalar and vector floating point.
226 defm : X86WriteRes<WriteFLD0, [HWPort01], 1, [1], 1>;
227 defm : X86WriteRes<WriteFLD1, [HWPort01], 1, [2], 2>;
228 defm : X86WriteRes<WriteFLDC, [HWPort01], 1, [2], 2>;
229 defm : X86WriteRes<WriteFLoad, [HWPort23], 5, [1], 1>;
230 defm : X86WriteRes<WriteFLoadX, [HWPort23], 6, [1], 1>;
231 defm : X86WriteRes<WriteFLoadY, [HWPort23], 7, [1], 1>;
232 defm : X86WriteRes<WriteFMaskedLoad, [HWPort23,HWPort5], 8, [1,2], 3>;
233 defm : X86WriteRes<WriteFMaskedLoadY, [HWPort23,HWPort5], 9, [1,2], 3>;
234 defm : X86WriteRes<WriteFStore, [HWPort237,HWPort4], 1, [1,1], 2>;
235 defm : X86WriteRes<WriteFStoreX, [HWPort237,HWPort4], 1, [1,1], 2>;
236 defm : X86WriteRes<WriteFStoreY, [HWPort237,HWPort4], 1, [1,1], 2>;
237 defm : X86WriteRes<WriteFStoreNT, [HWPort237,HWPort4], 1, [1,1], 2>;
238 defm : X86WriteRes<WriteFStoreNTX, [HWPort237,HWPort4], 1, [1,1], 2>;
239 defm : X86WriteRes<WriteFStoreNTY, [HWPort237,HWPort4], 1, [1,1], 2>;
241 defm : X86WriteRes<WriteFMaskedStore32, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>;
242 defm : X86WriteRes<WriteFMaskedStore32Y, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>;
243 defm : X86WriteRes<WriteFMaskedStore64, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>;
244 defm : X86WriteRes<WriteFMaskedStore64Y, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>;
246 defm : X86WriteRes<WriteFMove, [HWPort5], 1, [1], 1>;
247 defm : X86WriteRes<WriteFMoveX, [HWPort5], 1, [1], 1>;
248 defm : X86WriteRes<WriteFMoveY, [HWPort5], 1, [1], 1>;
249 defm : X86WriteRes<WriteEMMS, [HWPort01,HWPort15,HWPort015,HWPort0156], 31, [8,1,21,1], 31>;
251 defm : HWWriteResPair<WriteFAdd, [HWPort1], 3, [1], 1, 5>;
252 defm : HWWriteResPair<WriteFAddX, [HWPort1], 3, [1], 1, 6>;
253 defm : HWWriteResPair<WriteFAddY, [HWPort1], 3, [1], 1, 7>;
254 defm : HWWriteResPair<WriteFAddZ, [HWPort1], 3, [1], 1, 7>; // Unsupported = 1
255 defm : HWWriteResPair<WriteFAdd64, [HWPort1], 3, [1], 1, 5>;
256 defm : HWWriteResPair<WriteFAdd64X, [HWPort1], 3, [1], 1, 6>;
257 defm : HWWriteResPair<WriteFAdd64Y, [HWPort1], 3, [1], 1, 7>;
258 defm : HWWriteResPair<WriteFAdd64Z, [HWPort1], 3, [1], 1, 7>; // Unsupported = 1
260 defm : HWWriteResPair<WriteFCmp, [HWPort1], 3, [1], 1, 5>;
261 defm : HWWriteResPair<WriteFCmpX, [HWPort1], 3, [1], 1, 6>;
262 defm : HWWriteResPair<WriteFCmpY, [HWPort1], 3, [1], 1, 7>;
263 defm : HWWriteResPair<WriteFCmpZ, [HWPort1], 3, [1], 1, 7>; // Unsupported = 1
264 defm : HWWriteResPair<WriteFCmp64, [HWPort1], 3, [1], 1, 5>;
265 defm : HWWriteResPair<WriteFCmp64X, [HWPort1], 3, [1], 1, 6>;
266 defm : HWWriteResPair<WriteFCmp64Y, [HWPort1], 3, [1], 1, 7>;
267 defm : HWWriteResPair<WriteFCmp64Z, [HWPort1], 3, [1], 1, 7>; // Unsupported = 1
269 defm : HWWriteResPair<WriteFCom, [HWPort1], 3>;
270 defm : HWWriteResPair<WriteFComX, [HWPort1], 3>;
272 defm : HWWriteResPair<WriteFMul, [HWPort01], 5, [1], 1, 5>;
273 defm : HWWriteResPair<WriteFMulX, [HWPort01], 5, [1], 1, 6>;
274 defm : HWWriteResPair<WriteFMulY, [HWPort01], 5, [1], 1, 7>;
275 defm : HWWriteResPair<WriteFMulZ, [HWPort01], 5, [1], 1, 7>; // Unsupported = 1
276 defm : HWWriteResPair<WriteFMul64, [HWPort01], 5, [1], 1, 5>;
277 defm : HWWriteResPair<WriteFMul64X, [HWPort01], 5, [1], 1, 6>;
278 defm : HWWriteResPair<WriteFMul64Y, [HWPort01], 5, [1], 1, 7>;
279 defm : HWWriteResPair<WriteFMul64Z, [HWPort01], 5, [1], 1, 7>; // Unsupported = 1
281 defm : HWWriteResPair<WriteFDiv, [HWPort0,HWFPDivider], 13, [1,7], 1, 5>;
282 defm : HWWriteResPair<WriteFDivX, [HWPort0,HWFPDivider], 13, [1,7], 1, 6>;
283 defm : HWWriteResPair<WriteFDivY, [HWPort0,HWPort15,HWFPDivider], 21, [2,1,14], 3, 7>;
284 defm : HWWriteResPair<WriteFDivZ, [HWPort0,HWPort15,HWFPDivider], 21, [2,1,14], 3, 7>; // Unsupported = 1
285 defm : HWWriteResPair<WriteFDiv64, [HWPort0,HWFPDivider], 20, [1,14], 1, 5>;
286 defm : HWWriteResPair<WriteFDiv64X, [HWPort0,HWFPDivider], 20, [1,14], 1, 6>;
287 defm : HWWriteResPair<WriteFDiv64Y, [HWPort0,HWPort15,HWFPDivider], 35, [2,1,28], 3, 7>;
288 defm : HWWriteResPair<WriteFDiv64Z, [HWPort0,HWPort15,HWFPDivider], 35, [2,1,28], 3, 7>; // Unsupported = 1
290 defm : HWWriteResPair<WriteFRcp, [HWPort0], 5, [1], 1, 5>;
291 defm : HWWriteResPair<WriteFRcpX, [HWPort0], 5, [1], 1, 6>;
292 defm : HWWriteResPair<WriteFRcpY, [HWPort0,HWPort015], 11, [2,1], 3, 7>;
293 defm : HWWriteResPair<WriteFRcpZ, [HWPort0,HWPort015], 11, [2,1], 3, 7>; // Unsupported = 1
295 defm : HWWriteResPair<WriteFRsqrt, [HWPort0], 5, [1], 1, 5>;
296 defm : HWWriteResPair<WriteFRsqrtX,[HWPort0], 5, [1], 1, 6>;
297 defm : HWWriteResPair<WriteFRsqrtY,[HWPort0,HWPort015], 11, [2,1], 3, 7>;
298 defm : HWWriteResPair<WriteFRsqrtZ,[HWPort0,HWPort015], 11, [2,1], 3, 7>; // Unsupported = 1
300 defm : HWWriteResPair<WriteFSqrt, [HWPort0,HWFPDivider], 11, [1,7], 1, 5>;
301 defm : HWWriteResPair<WriteFSqrtX, [HWPort0,HWFPDivider], 11, [1,7], 1, 6>;
302 defm : HWWriteResPair<WriteFSqrtY, [HWPort0,HWPort15,HWFPDivider], 21, [2,1,14], 3, 7>;
303 defm : HWWriteResPair<WriteFSqrtZ, [HWPort0,HWPort15,HWFPDivider], 21, [2,1,14], 3, 7>; // Unsupported = 1
304 defm : HWWriteResPair<WriteFSqrt64, [HWPort0,HWFPDivider], 16, [1,14], 1, 5>;
305 defm : HWWriteResPair<WriteFSqrt64X, [HWPort0,HWFPDivider], 16, [1,14], 1, 6>;
306 defm : HWWriteResPair<WriteFSqrt64Y, [HWPort0,HWPort15,HWFPDivider], 35, [2,1,28], 3, 7>;
307 defm : HWWriteResPair<WriteFSqrt64Z, [HWPort0,HWPort15,HWFPDivider], 35, [2,1,28], 3, 7>; // Unsupported = 1
308 defm : HWWriteResPair<WriteFSqrt80, [HWPort0,HWFPDivider], 23, [1,17]>;
310 defm : HWWriteResPair<WriteFMA, [HWPort01], 5, [1], 1, 5>;
311 defm : HWWriteResPair<WriteFMAX, [HWPort01], 5, [1], 1, 6>;
312 defm : HWWriteResPair<WriteFMAY, [HWPort01], 5, [1], 1, 7>;
313 defm : HWWriteResPair<WriteFMAZ, [HWPort01], 5, [1], 1, 7>; // Unsupported = 1
314 defm : HWWriteResPair<WriteDPPD, [HWPort0,HWPort1,HWPort5], 9, [1,1,1], 3, 6>;
315 defm : HWWriteResPair<WriteDPPS, [HWPort0,HWPort1,HWPort5], 14, [2,1,1], 4, 6>;
316 defm : HWWriteResPair<WriteDPPSY, [HWPort0,HWPort1,HWPort5], 14, [2,1,1], 4, 7>;
317 defm : HWWriteResPair<WriteDPPSZ, [HWPort0,HWPort1,HWPort5], 14, [2,1,1], 4, 7>; // Unsupported = 1
318 defm : HWWriteResPair<WriteFSign, [HWPort0], 1>;
319 defm : X86WriteRes<WriteFRnd, [HWPort23], 6, [1], 1>;
320 defm : X86WriteRes<WriteFRndY, [HWPort23], 6, [1], 1>;
321 defm : X86WriteRes<WriteFRndZ, [HWPort23], 6, [1], 1>; // Unsupported = 1
322 defm : X86WriteRes<WriteFRndLd, [HWPort1,HWPort23], 12, [2,1], 3>;
323 defm : X86WriteRes<WriteFRndYLd, [HWPort1,HWPort23], 13, [2,1], 3>;
324 defm : X86WriteRes<WriteFRndZLd, [HWPort1,HWPort23], 13, [2,1], 3>; // Unsupported = 1
325 defm : HWWriteResPair<WriteFLogic, [HWPort5], 1, [1], 1, 6>;
326 defm : HWWriteResPair<WriteFLogicY, [HWPort5], 1, [1], 1, 7>;
327 defm : HWWriteResPair<WriteFLogicZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1
328 defm : HWWriteResPair<WriteFTest, [HWPort0], 1, [1], 1, 6>;
329 defm : HWWriteResPair<WriteFTestY, [HWPort0], 1, [1], 1, 7>;
330 defm : HWWriteResPair<WriteFTestZ, [HWPort0], 1, [1], 1, 7>; // Unsupported = 1
331 defm : HWWriteResPair<WriteFShuffle, [HWPort5], 1, [1], 1, 6>;
332 defm : HWWriteResPair<WriteFShuffleY, [HWPort5], 1, [1], 1, 7>;
333 defm : HWWriteResPair<WriteFShuffleZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1
334 defm : HWWriteResPair<WriteFVarShuffle, [HWPort5], 1, [1], 1, 6>;
335 defm : HWWriteResPair<WriteFVarShuffleY, [HWPort5], 1, [1], 1, 7>;
336 defm : HWWriteResPair<WriteFVarShuffleZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1
337 defm : HWWriteResPair<WriteFBlend, [HWPort015], 1, [1], 1, 6>;
338 defm : HWWriteResPair<WriteFBlendY, [HWPort015], 1, [1], 1, 7>;
339 defm : HWWriteResPair<WriteFBlendZ, [HWPort015], 1, [1], 1, 7>; // Unsupported = 1
340 defm : HWWriteResPair<WriteFShuffle256, [HWPort5], 3, [1], 1, 7>;
341 defm : HWWriteResPair<WriteFVarShuffle256, [HWPort5], 3, [1], 1, 7>;
342 defm : HWWriteResPair<WriteFVarBlend, [HWPort5], 2, [2], 2, 6>;
343 defm : HWWriteResPair<WriteFVarBlendY, [HWPort5], 2, [2], 2, 7>;
344 defm : HWWriteResPair<WriteFVarBlendZ, [HWPort5], 2, [2], 2, 7>; // Unsupported = 1
346 // Conversion between integer and float.
347 defm : HWWriteResPair<WriteCvtSD2I, [HWPort1], 3>;
348 defm : HWWriteResPair<WriteCvtPD2I, [HWPort1], 3>;
349 defm : HWWriteResPair<WriteCvtPD2IY, [HWPort1], 3>;
350 defm : HWWriteResPair<WriteCvtPD2IZ, [HWPort1], 3>; // Unsupported = 1
351 defm : HWWriteResPair<WriteCvtSS2I, [HWPort1], 3>;
352 defm : HWWriteResPair<WriteCvtPS2I, [HWPort1], 3>;
353 defm : HWWriteResPair<WriteCvtPS2IY, [HWPort1], 3>;
354 defm : HWWriteResPair<WriteCvtPS2IZ, [HWPort1], 3>; // Unsupported = 1
356 defm : HWWriteResPair<WriteCvtI2SD, [HWPort1], 4>;
357 defm : HWWriteResPair<WriteCvtI2PD, [HWPort1], 4>;
358 defm : HWWriteResPair<WriteCvtI2PDY, [HWPort1], 4>;
359 defm : HWWriteResPair<WriteCvtI2PDZ, [HWPort1], 4>; // Unsupported = 1
360 defm : HWWriteResPair<WriteCvtI2SS, [HWPort1], 4>;
361 defm : HWWriteResPair<WriteCvtI2PS, [HWPort1], 4>;
362 defm : HWWriteResPair<WriteCvtI2PSY, [HWPort1], 4>;
363 defm : HWWriteResPair<WriteCvtI2PSZ, [HWPort1], 4>; // Unsupported = 1
365 defm : HWWriteResPair<WriteCvtSS2SD, [HWPort1], 3>;
366 defm : HWWriteResPair<WriteCvtPS2PD, [HWPort1], 3>;
367 defm : HWWriteResPair<WriteCvtPS2PDY, [HWPort1], 3>;
368 defm : HWWriteResPair<WriteCvtPS2PDZ, [HWPort1], 3>; // Unsupported = 1
369 defm : HWWriteResPair<WriteCvtSD2SS, [HWPort1], 3>;
370 defm : HWWriteResPair<WriteCvtPD2PS, [HWPort1], 3>;
371 defm : HWWriteResPair<WriteCvtPD2PSY, [HWPort1], 3>;
372 defm : HWWriteResPair<WriteCvtPD2PSZ, [HWPort1], 3>; // Unsupported = 1
374 defm : X86WriteRes<WriteCvtPH2PS, [HWPort0,HWPort5], 2, [1,1], 2>;
375 defm : X86WriteRes<WriteCvtPH2PSY, [HWPort0,HWPort5], 2, [1,1], 2>;
376 defm : X86WriteRes<WriteCvtPH2PSZ, [HWPort0,HWPort5], 2, [1,1], 2>; // Unsupported = 1
377 defm : X86WriteRes<WriteCvtPH2PSLd, [HWPort0,HWPort23], 6, [1,1], 2>;
378 defm : X86WriteRes<WriteCvtPH2PSYLd, [HWPort0,HWPort23], 7, [1,1], 2>;
379 defm : X86WriteRes<WriteCvtPH2PSZLd, [HWPort0,HWPort23], 7, [1,1], 2>; // Unsupported = 1
381 defm : X86WriteRes<WriteCvtPS2PH, [HWPort1,HWPort5], 4, [1,1], 2>;
382 defm : X86WriteRes<WriteCvtPS2PHY, [HWPort1,HWPort5], 6, [1,1], 2>;
383 defm : X86WriteRes<WriteCvtPS2PHZ, [HWPort1,HWPort5], 6, [1,1], 2>; // Unsupported = 1
384 defm : X86WriteRes<WriteCvtPS2PHSt, [HWPort1,HWPort4,HWPort5,HWPort237], 5, [1,1,1,1], 4>;
385 defm : X86WriteRes<WriteCvtPS2PHYSt, [HWPort1,HWPort4,HWPort5,HWPort237], 7, [1,1,1,1], 4>;
386 defm : X86WriteRes<WriteCvtPS2PHZSt, [HWPort1,HWPort4,HWPort5,HWPort237], 7, [1,1,1,1], 4>; // Unsupported = 1
388 // Vector integer operations.
389 defm : X86WriteRes<WriteVecLoad, [HWPort23], 5, [1], 1>;
390 defm : X86WriteRes<WriteVecLoadX, [HWPort23], 6, [1], 1>;
391 defm : X86WriteRes<WriteVecLoadY, [HWPort23], 7, [1], 1>;
392 defm : X86WriteRes<WriteVecLoadNT, [HWPort23], 6, [1], 1>;
393 defm : X86WriteRes<WriteVecLoadNTY, [HWPort23], 7, [1], 1>;
394 defm : X86WriteRes<WriteVecMaskedLoad, [HWPort23,HWPort5], 8, [1,2], 3>;
395 defm : X86WriteRes<WriteVecMaskedLoadY, [HWPort23,HWPort5], 9, [1,2], 3>;
396 defm : X86WriteRes<WriteVecStore, [HWPort237,HWPort4], 1, [1,1], 2>;
397 defm : X86WriteRes<WriteVecStoreX, [HWPort237,HWPort4], 1, [1,1], 2>;
398 defm : X86WriteRes<WriteVecStoreY, [HWPort237,HWPort4], 1, [1,1], 2>;
399 defm : X86WriteRes<WriteVecStoreNT, [HWPort237,HWPort4], 1, [1,1], 2>;
400 defm : X86WriteRes<WriteVecStoreNTY, [HWPort237,HWPort4], 1, [1,1], 2>;
401 defm : X86WriteRes<WriteVecMaskedStore32, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>;
402 defm : X86WriteRes<WriteVecMaskedStore32Y, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>;
403 defm : X86WriteRes<WriteVecMaskedStore64, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>;
404 defm : X86WriteRes<WriteVecMaskedStore64Y, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>;
405 defm : X86WriteRes<WriteVecMove, [HWPort015], 1, [1], 1>;
406 defm : X86WriteRes<WriteVecMoveX, [HWPort015], 1, [1], 1>;
407 defm : X86WriteRes<WriteVecMoveY, [HWPort015], 1, [1], 1>;
408 defm : X86WriteRes<WriteVecMoveToGpr, [HWPort0], 1, [1], 1>;
409 defm : X86WriteRes<WriteVecMoveFromGpr, [HWPort5], 1, [1], 1>;
411 defm : HWWriteResPair<WriteVecLogic, [HWPort015], 1, [1], 1, 5>;
412 defm : HWWriteResPair<WriteVecLogicX,[HWPort015], 1, [1], 1, 6>;
413 defm : HWWriteResPair<WriteVecLogicY,[HWPort015], 1, [1], 1, 7>;
414 defm : HWWriteResPair<WriteVecLogicZ,[HWPort015], 1, [1], 1, 7>; // Unsupported = 1
415 defm : HWWriteResPair<WriteVecTest, [HWPort0,HWPort5], 2, [1,1], 2, 6>;
416 defm : HWWriteResPair<WriteVecTestY, [HWPort0,HWPort5], 4, [1,1], 2, 7>;
417 defm : HWWriteResPair<WriteVecTestZ, [HWPort0,HWPort5], 4, [1,1], 2, 7>; // Unsupported = 1
418 defm : HWWriteResPair<WriteVecALU, [HWPort15], 1, [1], 1, 5>;
419 defm : HWWriteResPair<WriteVecALUX, [HWPort15], 1, [1], 1, 6>;
420 defm : HWWriteResPair<WriteVecALUY, [HWPort15], 1, [1], 1, 7>;
421 defm : HWWriteResPair<WriteVecALUZ, [HWPort15], 1, [1], 1, 7>; // Unsupported = 1
422 defm : HWWriteResPair<WriteVecIMul, [HWPort0], 5, [1], 1, 5>;
423 defm : HWWriteResPair<WriteVecIMulX, [HWPort0], 5, [1], 1, 6>;
424 defm : HWWriteResPair<WriteVecIMulY, [HWPort0], 5, [1], 1, 7>;
425 defm : HWWriteResPair<WriteVecIMulZ, [HWPort0], 5, [1], 1, 7>; // Unsupported = 1
426 defm : HWWriteResPair<WritePMULLD, [HWPort0], 10, [2], 2, 6>;
427 defm : HWWriteResPair<WritePMULLDY, [HWPort0], 10, [2], 2, 7>;
428 defm : HWWriteResPair<WritePMULLDZ, [HWPort0], 10, [2], 2, 7>; // Unsupported = 1
429 defm : HWWriteResPair<WriteShuffle, [HWPort5], 1, [1], 1, 5>;
430 defm : HWWriteResPair<WriteShuffleX, [HWPort5], 1, [1], 1, 6>;
431 defm : HWWriteResPair<WriteShuffleY, [HWPort5], 1, [1], 1, 7>;
432 defm : HWWriteResPair<WriteShuffleZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1
433 defm : HWWriteResPair<WriteVarShuffle, [HWPort5], 1, [1], 1, 5>;
434 defm : HWWriteResPair<WriteVarShuffleX,[HWPort5], 1, [1], 1, 6>;
435 defm : HWWriteResPair<WriteVarShuffleY,[HWPort5], 1, [1], 1, 7>;
436 defm : HWWriteResPair<WriteVarShuffleZ,[HWPort5], 1, [1], 1, 7>; // Unsupported = 1
437 defm : HWWriteResPair<WriteBlend, [HWPort5], 1, [1], 1, 6>;
438 defm : HWWriteResPair<WriteBlendY, [HWPort5], 1, [1], 1, 7>;
439 defm : HWWriteResPair<WriteBlendZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1
440 defm : HWWriteResPair<WriteShuffle256, [HWPort5], 3, [1], 1, 7>;
441 defm : HWWriteResPair<WriteVPMOV256, [HWPort5], 3, [1], 1, 7>;
442 defm : HWWriteResPair<WriteVarShuffle256, [HWPort5], 3, [1], 1, 7>;
443 defm : HWWriteResPair<WriteVarBlend, [HWPort5], 2, [2], 2, 6>;
444 defm : HWWriteResPair<WriteVarBlendY, [HWPort5], 2, [2], 2, 7>;
445 defm : HWWriteResPair<WriteVarBlendZ, [HWPort5], 2, [2], 2, 7>; // Unsupported = 1
446 defm : HWWriteResPair<WriteMPSAD, [HWPort0, HWPort5], 7, [1, 2], 3, 6>;
447 defm : HWWriteResPair<WriteMPSADY, [HWPort0, HWPort5], 7, [1, 2], 3, 7>;
448 defm : HWWriteResPair<WriteMPSADZ, [HWPort0, HWPort5], 7, [1, 2], 3, 7>; // Unsupported = 1
449 defm : HWWriteResPair<WritePSADBW, [HWPort0], 5, [1], 1, 5>;
450 defm : HWWriteResPair<WritePSADBWX, [HWPort0], 5, [1], 1, 6>;
451 defm : HWWriteResPair<WritePSADBWY, [HWPort0], 5, [1], 1, 7>;
452 defm : HWWriteResPair<WritePSADBWZ, [HWPort0], 5, [1], 1, 7>; // Unsupported = 1
453 defm : HWWriteResPair<WritePHMINPOS, [HWPort0], 5, [1], 1, 6>;
455 // Vector integer shifts.
456 defm : HWWriteResPair<WriteVecShift, [HWPort0], 1, [1], 1, 5>;
457 defm : HWWriteResPair<WriteVecShiftX, [HWPort0,HWPort5], 2, [1,1], 2, 6>;
458 defm : X86WriteRes<WriteVecShiftY, [HWPort0,HWPort5], 4, [1,1], 2>;
459 defm : X86WriteRes<WriteVecShiftZ, [HWPort0,HWPort5], 4, [1,1], 2>; // Unsupported = 1
460 defm : X86WriteRes<WriteVecShiftYLd, [HWPort0,HWPort23], 8, [1,1], 2>;
461 defm : X86WriteRes<WriteVecShiftZLd, [HWPort0,HWPort23], 8, [1,1], 2>; // Unsupported = 1
463 defm : HWWriteResPair<WriteVecShiftImm, [HWPort0], 1, [1], 1, 5>;
464 defm : HWWriteResPair<WriteVecShiftImmX, [HWPort0], 1, [1], 1, 6>;
465 defm : HWWriteResPair<WriteVecShiftImmY, [HWPort0], 1, [1], 1, 7>;
466 defm : HWWriteResPair<WriteVecShiftImmZ, [HWPort0], 1, [1], 1, 7>; // Unsupported = 1
467 defm : HWWriteResPair<WriteVarVecShift, [HWPort0, HWPort5], 3, [2,1], 3, 6>;
468 defm : HWWriteResPair<WriteVarVecShiftY, [HWPort0, HWPort5], 3, [2,1], 3, 7>;
469 defm : HWWriteResPair<WriteVarVecShiftZ, [HWPort0, HWPort5], 3, [2,1], 3, 7>; // Unsupported = 1
471 // Vector insert/extract operations.
472 def : WriteRes<WriteVecInsert, [HWPort5]> {
475 let ResourceCycles = [2];
477 def : WriteRes<WriteVecInsertLd, [HWPort5,HWPort23]> {
481 def: InstRW<[WriteVecInsertLd], (instregex "(V?)MOV(H|L)(PD|PS)rm")>;
483 def : WriteRes<WriteVecExtract, [HWPort0,HWPort5]> {
487 def : WriteRes<WriteVecExtractSt, [HWPort4,HWPort5,HWPort237]> {
492 // String instructions.
494 // Packed Compare Implicit Length Strings, Return Mask
495 def : WriteRes<WritePCmpIStrM, [HWPort0]> {
498 let ResourceCycles = [3];
500 def : WriteRes<WritePCmpIStrMLd, [HWPort0, HWPort23]> {
503 let ResourceCycles = [3,1];
506 // Packed Compare Explicit Length Strings, Return Mask
507 def : WriteRes<WritePCmpEStrM, [HWPort0, HWPort5, HWPort015, HWPort0156]> {
510 let ResourceCycles = [4,3,1,1];
512 def : WriteRes<WritePCmpEStrMLd, [HWPort0, HWPort5, HWPort23, HWPort015, HWPort0156]> {
514 let NumMicroOps = 10;
515 let ResourceCycles = [4,3,1,1,1];
518 // Packed Compare Implicit Length Strings, Return Index
519 def : WriteRes<WritePCmpIStrI, [HWPort0]> {
522 let ResourceCycles = [3];
524 def : WriteRes<WritePCmpIStrILd, [HWPort0, HWPort23]> {
527 let ResourceCycles = [3,1];
530 // Packed Compare Explicit Length Strings, Return Index
531 def : WriteRes<WritePCmpEStrI, [HWPort0, HWPort5, HWPort0156]> {
534 let ResourceCycles = [4,3,1];
536 def : WriteRes<WritePCmpEStrILd, [HWPort0, HWPort5, HWPort23, HWPort0156]> {
539 let ResourceCycles = [4,3,1,1];
542 // MOVMSK Instructions.
543 def : WriteRes<WriteFMOVMSK, [HWPort0]> { let Latency = 3; }
544 def : WriteRes<WriteVecMOVMSK, [HWPort0]> { let Latency = 3; }
545 def : WriteRes<WriteVecMOVMSKY, [HWPort0]> { let Latency = 3; }
546 def : WriteRes<WriteMMXMOVMSK, [HWPort0]> { let Latency = 1; }
549 def : WriteRes<WriteAESDecEnc, [HWPort5]> {
552 let ResourceCycles = [1];
554 def : WriteRes<WriteAESDecEncLd, [HWPort5, HWPort23]> {
557 let ResourceCycles = [1,1];
560 def : WriteRes<WriteAESIMC, [HWPort5]> {
563 let ResourceCycles = [2];
565 def : WriteRes<WriteAESIMCLd, [HWPort5, HWPort23]> {
568 let ResourceCycles = [2,1];
571 def : WriteRes<WriteAESKeyGen, [HWPort0,HWPort5,HWPort015]> {
573 let NumMicroOps = 11;
574 let ResourceCycles = [2,7,2];
576 def : WriteRes<WriteAESKeyGenLd, [HWPort0,HWPort5,HWPort23,HWPort015]> {
578 let NumMicroOps = 11;
579 let ResourceCycles = [2,7,1,1];
582 // Carry-less multiplication instructions.
583 def : WriteRes<WriteCLMul, [HWPort0, HWPort5]> {
586 let ResourceCycles = [2,1];
588 def : WriteRes<WriteCLMulLd, [HWPort0, HWPort5, HWPort23]> {
591 let ResourceCycles = [2,1,1];
595 def : WriteRes<WriteLDMXCSR, [HWPort0,HWPort23,HWPort0156]> { let Latency = 7; let NumMicroOps = 3; let ResourceCycles = [1,1,1]; }
596 def : WriteRes<WriteSTMXCSR, [HWPort4,HWPort5,HWPort237]> { let Latency = 2; let NumMicroOps = 3; let ResourceCycles = [1,1,1]; }
598 def : WriteRes<WriteSystem, [HWPort0156]> { let Latency = 100; }
599 def : WriteRes<WriteMicrocoded, [HWPort0156]> { let Latency = 100; }
600 def : WriteRes<WriteFence, [HWPort23, HWPort4]>;
601 def : WriteRes<WriteNop, []>;
603 //================ Exceptions ================//
605 //-- Specific Scheduling Models --//
608 def HWWriteP0 : SchedWriteRes<[HWPort0]>;
610 def HWWriteP01 : SchedWriteRes<[HWPort01]>;
612 def HWWrite2P01 : SchedWriteRes<[HWPort01]> {
615 def HWWrite3P01 : SchedWriteRes<[HWPort01]> {
619 def HWWriteP0156_P23 : SchedWriteRes<[HWPort0156, HWPort23]> {
623 def HWWrite2P0156_P23 : SchedWriteRes<[HWPort0156, HWPort23]> {
625 let ResourceCycles = [2, 1];
629 def HWWriteP1 : SchedWriteRes<[HWPort1]>;
632 def HWWrite2P1 : SchedWriteRes<[HWPort1]> {
634 let ResourceCycles = [2];
639 // - mm: 64 bit mmx register.
640 // - x = 128 bit xmm register.
641 // - (x)mm = mmx or xmm register.
642 // - y = 256 bit ymm register.
643 // - v = any vector register.
646 //=== Integer Instructions ===//
647 //-- Move instructions --//
650 def HWWriteXLAT : SchedWriteRes<[]> {
654 def : InstRW<[HWWriteXLAT], (instrs XLAT)>;
657 def HWWritePushA : SchedWriteRes<[]> {
658 let NumMicroOps = 19;
660 def : InstRW<[HWWritePushA], (instregex "PUSHA(16|32)")>;
663 def HWWritePopA : SchedWriteRes<[]> {
664 let NumMicroOps = 18;
666 def : InstRW<[HWWritePopA], (instregex "POPA(16|32)")>;
668 //-- Arithmetic instructions --//
672 def HWWriteBTRSCmr : SchedWriteRes<[]> {
673 let NumMicroOps = 11;
675 def : SchedAlias<WriteBitTestSetRegRMW, HWWriteBTRSCmr>;
677 //-- Control transfer instructions --//
681 def HWWriteRETI : SchedWriteRes<[HWPort23, HWPort6, HWPort015]> {
683 let ResourceCycles = [1, 2, 1];
685 def : InstRW<[HWWriteRETI], (instregex "RETI(L|Q|W)", "LRETI(L|Q|W)")>;
689 def HWWriteBOUND : SchedWriteRes<[]> {
690 let NumMicroOps = 15;
692 def : InstRW<[HWWriteBOUND], (instregex "BOUNDS(16|32)rm")>;
695 def HWWriteINTO : SchedWriteRes<[]> {
698 def : InstRW<[HWWriteINTO], (instrs INTO)>;
700 //-- String instructions --//
703 def : InstRW<[HWWrite2P0156_P23], (instregex "LODS(B|W)")>;
706 def : InstRW<[HWWriteP0156_P23], (instregex "LODS(L|Q)")>;
709 def HWWriteMOVS : SchedWriteRes<[HWPort23, HWPort4, HWPort0156]> {
712 let ResourceCycles = [2, 1, 2];
714 def : InstRW<[HWWriteMOVS], (instrs MOVSB, MOVSL, MOVSQ, MOVSW)>;
717 def HWWriteCMPS : SchedWriteRes<[HWPort23, HWPort0156]> {
720 let ResourceCycles = [2, 3];
722 def : InstRW<[HWWriteCMPS], (instregex "CMPS(B|L|Q|W)")>;
727 def HWWriteRDPMC : SchedWriteRes<[]> {
728 let NumMicroOps = 34;
730 def : InstRW<[HWWriteRDPMC], (instrs RDPMC)>;
733 def HWWriteRDRAND : SchedWriteRes<[HWPort23, HWPort015]> {
734 let NumMicroOps = 17;
735 let ResourceCycles = [1, 16];
737 def : InstRW<[HWWriteRDRAND], (instrs RDRAND16r, RDRAND32r, RDRAND64r)>;
739 //=== Floating Point x87 Instructions ===//
740 //-- Move instructions --//
744 def : InstRW<[HWWriteP01], (instrs LD_Frr)>;
748 def HWWriteFBLD : SchedWriteRes<[]> {
750 let NumMicroOps = 43;
752 def : InstRW<[HWWriteFBLD], (instrs FBLDm)>;
756 def : InstRW<[HWWriteP01], (instregex "ST_(F|FP)rr")>;
759 def : InstRW<[HWWriteP01], (instregex "FFREE")>;
762 def HWWriteFNSAVE : SchedWriteRes<[]> {
763 let NumMicroOps = 147;
765 def : InstRW<[HWWriteFNSAVE], (instrs FSAVEm)>;
768 def HWWriteFRSTOR : SchedWriteRes<[]> {
769 let NumMicroOps = 90;
771 def : InstRW<[HWWriteFRSTOR], (instrs FRSTORm)>;
773 //-- Arithmetic instructions --//
777 def : InstRW<[HWWrite2P01], (instrs FCOMPP, UCOM_FPPr)>;
779 // FCOMI(P) FUCOMI(P).
781 def : InstRW<[HWWrite3P01], (instrs COM_FIPr, COM_FIr, UCOM_FIPr, UCOM_FIr)>;
784 def : InstRW<[HWWriteP1], (instregex "TST_F")>;
787 def : InstRW<[HWWrite2P1], (instrs XAM_F)>;
790 def HWWriteFPREM : SchedWriteRes<[]> {
792 let NumMicroOps = 28;
794 def : InstRW<[HWWriteFPREM], (instrs FPREM)>;
797 def HWWriteFPREM1 : SchedWriteRes<[]> {
799 let NumMicroOps = 41;
801 def : InstRW<[HWWriteFPREM1], (instrs FPREM1)>;
804 def HWWriteFRNDINT : SchedWriteRes<[]> {
806 let NumMicroOps = 17;
808 def : InstRW<[HWWriteFRNDINT], (instrs FRNDINT)>;
810 //-- Math instructions --//
813 def HWWriteFSCALE : SchedWriteRes<[]> {
814 let Latency = 75; // 49-125
815 let NumMicroOps = 50; // 25-75
817 def : InstRW<[HWWriteFSCALE], (instrs FSCALE)>;
820 def HWWriteFXTRACT : SchedWriteRes<[]> {
822 let NumMicroOps = 17;
824 def : InstRW<[HWWriteFXTRACT], (instrs FXTRACT)>;
826 ////////////////////////////////////////////////////////////////////////////////
827 // Horizontal add/sub instructions.
828 ////////////////////////////////////////////////////////////////////////////////
830 defm : HWWriteResPair<WriteFHAdd, [HWPort1, HWPort5], 5, [1,2], 3, 6>;
831 defm : HWWriteResPair<WriteFHAddY, [HWPort1, HWPort5], 5, [1,2], 3, 7>;
832 defm : HWWriteResPair<WritePHAdd, [HWPort5, HWPort15], 3, [2,1], 3, 5>;
833 defm : HWWriteResPair<WritePHAddX, [HWPort5, HWPort15], 3, [2,1], 3, 6>;
834 defm : HWWriteResPair<WritePHAddY, [HWPort5, HWPort15], 3, [2,1], 3, 7>;
836 //=== Floating Point XMM and YMM Instructions ===//
840 def HWWriteResGroup0 : SchedWriteRes<[HWPort23]> {
843 let ResourceCycles = [1];
845 def: InstRW<[HWWriteResGroup0], (instrs VBROADCASTSSrm)>;
846 def: InstRW<[HWWriteResGroup0], (instregex "(V?)MOVSHDUPrm",
848 "VPBROADCAST(D|Q)rm")>;
850 def HWWriteResGroup0_1 : SchedWriteRes<[HWPort23]> {
853 let ResourceCycles = [1];
855 def: InstRW<[HWWriteResGroup0_1], (instrs VBROADCASTF128,
862 def: InstRW<[HWWriteResGroup0_1], (instregex "LD_F(32|64|80)m",
863 "VPBROADCAST(D|Q)Yrm")>;
865 def HWWriteResGroup0_2 : SchedWriteRes<[HWPort23]> {
868 let ResourceCycles = [1];
870 def: InstRW<[HWWriteResGroup0_2], (instregex "MOVSX(16|32|64)rm(8|16|32)",
871 "MOVZX(16|32|64)rm(8|16)",
874 def HWWriteResGroup1 : SchedWriteRes<[HWPort4,HWPort237]> {
877 let ResourceCycles = [1,1];
879 def: InstRW<[HWWriteResGroup1], (instrs FBSTPm, VMPTRSTm)>;
880 def: InstRW<[HWWriteResGroup1], (instregex "ST_FP(32|64|80)m")>;
882 def HWWriteResGroup2 : SchedWriteRes<[HWPort0]> {
885 let ResourceCycles = [1];
887 def: InstRW<[HWWriteResGroup2], (instregex "VPSLLVQ(Y?)rr",
890 def HWWriteResGroup3 : SchedWriteRes<[HWPort1]> {
893 let ResourceCycles = [1];
895 def: InstRW<[HWWriteResGroup3], (instregex "COM(P?)_FST0r",
898 def HWWriteResGroup4 : SchedWriteRes<[HWPort5]> {
901 let ResourceCycles = [1];
903 def: InstRW<[HWWriteResGroup4], (instrs MMX_MOVQ2DQrr)>;
905 def HWWriteResGroup5 : SchedWriteRes<[HWPort6]> {
908 let ResourceCycles = [1];
910 def: InstRW<[HWWriteResGroup5], (instregex "JMP(16|32|64)r")>;
912 def HWWriteResGroup6 : SchedWriteRes<[HWPort01]> {
915 let ResourceCycles = [1];
917 def: InstRW<[HWWriteResGroup6], (instrs FINCSTP, FNOP)>;
919 def HWWriteResGroup7 : SchedWriteRes<[HWPort06]> {
922 let ResourceCycles = [1];
924 def: InstRW<[HWWriteResGroup7], (instrs CDQ, CQO)>;
926 def HWWriteResGroup8 : SchedWriteRes<[HWPort15]> {
929 let ResourceCycles = [1];
931 def: InstRW<[HWWriteResGroup8], (instregex "ANDN(32|64)rr")>;
933 def HWWriteResGroup9 : SchedWriteRes<[HWPort015]> {
936 let ResourceCycles = [1];
938 def: InstRW<[HWWriteResGroup9], (instregex "VPBLENDD(Y?)rri")>;
940 def HWWriteResGroup10 : SchedWriteRes<[HWPort0156]> {
943 let ResourceCycles = [1];
945 def: InstRW<[HWWriteResGroup10], (instrs CBW, CWDE, CDQE,
953 def HWWriteResGroup11 : SchedWriteRes<[HWPort0,HWPort23]> {
956 let ResourceCycles = [1,1];
958 def: InstRW<[HWWriteResGroup11], (instregex "(V?)CVTPS2PDrm")>;
960 def HWWriteResGroup11_1 : SchedWriteRes<[HWPort0,HWPort23]> {
963 let ResourceCycles = [1,1];
965 def: InstRW<[HWWriteResGroup11_1], (instrs VPSLLVQrm, VPSRLVQrm)>;
966 def: InstRW<[HWWriteResGroup11_1], (instregex "(V?)CVTSS2SDrm")>;
968 def HWWriteResGroup11_2 : SchedWriteRes<[HWPort0,HWPort23]> {
971 let ResourceCycles = [1,1];
973 def: InstRW<[HWWriteResGroup11_2], (instrs VPSLLVQYrm, VPSRLVQYrm)>;
975 def HWWriteResGroup12 : SchedWriteRes<[HWPort1,HWPort23]> {
978 let ResourceCycles = [1,1];
980 def: InstRW<[HWWriteResGroup12], (instrs MMX_CVTPI2PSirm)>;
981 def: InstRW<[HWWriteResGroup12], (instregex "P(DEP|EXT)(32|64)rm")>;
983 def HWWriteResGroup13 : SchedWriteRes<[HWPort5,HWPort23]> {
986 let ResourceCycles = [1,1];
988 def: InstRW<[HWWriteResGroup13], (instregex "(V?)PMOV(SX|ZX)BDrm",
989 "(V?)PMOV(SX|ZX)BQrm",
990 "(V?)PMOV(SX|ZX)BWrm",
991 "(V?)PMOV(SX|ZX)DQrm",
992 "(V?)PMOV(SX|ZX)WDrm",
993 "(V?)PMOV(SX|ZX)WQrm")>;
995 def HWWriteResGroup13_1 : SchedWriteRes<[HWPort5,HWPort23]> {
998 let ResourceCycles = [1,1];
1000 def: InstRW<[HWWriteResGroup13_1], (instrs VPMOVSXBDYrm,
1004 def HWWriteResGroup14 : SchedWriteRes<[HWPort6,HWPort23]> {
1006 let NumMicroOps = 2;
1007 let ResourceCycles = [1,1];
1009 def: InstRW<[HWWriteResGroup14], (instrs FARJMP64m)>;
1010 def: InstRW<[HWWriteResGroup14], (instregex "JMP(16|32|64)m")>;
1012 def HWWriteResGroup16 : SchedWriteRes<[HWPort23,HWPort15]> {
1014 let NumMicroOps = 2;
1015 let ResourceCycles = [1,1];
1017 def: InstRW<[HWWriteResGroup16], (instregex "ANDN(32|64)rm",
1018 "MOVBE(16|32|64)rm")>;
1020 def HWWriteResGroup17 : SchedWriteRes<[HWPort23,HWPort015]> {
1022 let NumMicroOps = 2;
1023 let ResourceCycles = [1,1];
1025 def: InstRW<[HWWriteResGroup17], (instrs VINSERTF128rm,
1029 def HWWriteResGroup17_2 : SchedWriteRes<[HWPort23,HWPort015]> {
1031 let NumMicroOps = 2;
1032 let ResourceCycles = [1,1];
1034 def: InstRW<[HWWriteResGroup17_2], (instrs VPBLENDDYrmi)>;
1036 def HWWriteResGroup18 : SchedWriteRes<[HWPort23,HWPort0156]> {
1038 let NumMicroOps = 2;
1039 let ResourceCycles = [1,1];
1041 def: InstRW<[HWWriteResGroup18], (instrs POP16r, POP32r, POP64r)>;
1042 def: InstRW<[HWWriteResGroup18], (instregex "POP(16|32|64)rmr")>;
1044 def HWWriteResGroup19 : SchedWriteRes<[HWPort237,HWPort0156]> {
1046 let NumMicroOps = 2;
1047 let ResourceCycles = [1,1];
1049 def: InstRW<[HWWriteResGroup19], (instrs SFENCE)>;
1051 def HWWriteResGroup21 : SchedWriteRes<[HWPort4,HWPort6,HWPort237]> {
1053 let NumMicroOps = 3;
1054 let ResourceCycles = [1,1,1];
1056 def: InstRW<[HWWriteResGroup21], (instrs FNSTCW16m)>;
1058 def HWWriteResGroup23 : SchedWriteRes<[HWPort4,HWPort237,HWPort15]> {
1060 let NumMicroOps = 3;
1061 let ResourceCycles = [1,1,1];
1063 def: InstRW<[HWWriteResGroup23], (instregex "MOVBE(32|64)mr")>;
1065 def HWWriteResGroup23_16 : SchedWriteRes<[HWPort06, HWPort237, HWPort4]> {
1067 let NumMicroOps = 3;
1068 let ResourceCycles = [1,1,1];
1070 def: InstRW<[HWWriteResGroup23_16], (instrs MOVBE16mr)>;
1072 def HWWriteResGroup24 : SchedWriteRes<[HWPort4,HWPort237,HWPort0156]> {
1074 let NumMicroOps = 3;
1075 let ResourceCycles = [1,1,1];
1077 def: InstRW<[HWWriteResGroup24], (instrs PUSH16r, PUSH32r, PUSH64r, PUSH64i8,
1078 STOSB, STOSL, STOSQ, STOSW)>;
1079 def: InstRW<[HWWriteResGroup24], (instregex "PUSH(16|32|64)rmr")>;
1081 def HWWriteResGroup25 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort06]> {
1083 let NumMicroOps = 4;
1084 let ResourceCycles = [1,1,1,1];
1086 def: InstRW<[HWWriteResGroup25], (instregex "SAR(8|16|32|64)m(1|i)",
1087 "SHL(8|16|32|64)m(1|i)",
1088 "SHR(8|16|32|64)m(1|i)")>;
1090 def HWWriteResGroup26 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort0156]> {
1092 let NumMicroOps = 4;
1093 let ResourceCycles = [1,1,1,1];
1095 def: InstRW<[HWWriteResGroup26], (instregex "POP(16|32|64)rmm",
1096 "PUSH(16|32|64)rmm")>;
1098 def HWWriteResGroup28 : SchedWriteRes<[HWPort01]> {
1100 let NumMicroOps = 2;
1101 let ResourceCycles = [2];
1103 def: InstRW<[HWWriteResGroup28], (instrs FDECSTP)>;
1105 def HWWriteResGroup30 : SchedWriteRes<[HWPort0156]> {
1107 let NumMicroOps = 2;
1108 let ResourceCycles = [2];
1110 def: InstRW<[HWWriteResGroup30], (instrs LFENCE,
1115 def HWWriteResGroup31 : SchedWriteRes<[HWPort0,HWPort5]> {
1117 let NumMicroOps = 2;
1118 let ResourceCycles = [1,1];
1120 def: InstRW<[HWWriteResGroup31], (instregex "(V?)CVTPS2PDrr",
1123 def HWWriteResGroup32 : SchedWriteRes<[HWPort6,HWPort0156]> {
1125 let NumMicroOps = 2;
1126 let ResourceCycles = [1,1];
1128 def: InstRW<[HWWriteResGroup32], (instregex "CLFLUSH")>;
1130 def HWWriteResGroup33 : SchedWriteRes<[HWPort01,HWPort015]> {
1132 let NumMicroOps = 2;
1133 let ResourceCycles = [1,1];
1135 def: InstRW<[HWWriteResGroup33], (instrs MMX_MOVDQ2Qrr)>;
1137 def HWWriteResGroup35 : SchedWriteRes<[HWPort06,HWPort0156]> {
1139 let NumMicroOps = 2;
1140 let ResourceCycles = [1,1];
1142 def: InstRW<[HWWriteResGroup35], (instrs CWD, JCXZ, JECXZ, JRCXZ)>;
1144 def HWWriteResGroup36_2 : SchedWriteRes<[HWPort5,HWPort23]> {
1146 let NumMicroOps = 3;
1147 let ResourceCycles = [2,1];
1149 def: InstRW<[HWWriteResGroup36_2], (instrs MMX_PACKSSDWirm,
1153 def HWWriteResGroup37 : SchedWriteRes<[HWPort23,HWPort0156]> {
1155 let NumMicroOps = 3;
1156 let ResourceCycles = [1,2];
1158 def: InstRW<[HWWriteResGroup37], (instrs LEAVE, LEAVE64,
1159 SCASB, SCASL, SCASQ, SCASW)>;
1161 def HWWriteResGroup39 : SchedWriteRes<[HWPort0,HWPort01,HWPort23]> {
1163 let NumMicroOps = 3;
1164 let ResourceCycles = [1,1,1];
1166 def: InstRW<[HWWriteResGroup39], (instrs FLDCW16m)>;
1168 def HWWriteResGroup41 : SchedWriteRes<[HWPort6,HWPort23,HWPort0156]> {
1170 let NumMicroOps = 3;
1171 let ResourceCycles = [1,1,1];
1173 def: InstRW<[HWWriteResGroup41], (instrs LRETQ, RETL, RETQ)>;
1175 def HWWriteResGroup44 : SchedWriteRes<[HWPort4,HWPort6,HWPort237,HWPort0156]> {
1177 let NumMicroOps = 4;
1178 let ResourceCycles = [1,1,1,1];
1180 def: InstRW<[HWWriteResGroup44], (instregex "CALL(16|32|64)r")>;
1182 def HWWriteResGroup45 : SchedWriteRes<[HWPort4,HWPort237,HWPort06,HWPort0156]> {
1184 let NumMicroOps = 4;
1185 let ResourceCycles = [1,1,1,1];
1187 def: InstRW<[HWWriteResGroup45], (instrs CALL64pcrel32)>;
1189 def HWWriteResGroup46 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort06]> {
1191 let NumMicroOps = 5;
1192 let ResourceCycles = [1,1,1,2];
1194 def: InstRW<[HWWriteResGroup46], (instregex "ROL(8|16|32|64)m(1|i)",
1195 "ROR(8|16|32|64)m(1|i)")>;
1197 def HWWriteResGroup46_1 : SchedWriteRes<[HWPort06]> {
1199 let NumMicroOps = 2;
1200 let ResourceCycles = [2];
1202 def: InstRW<[HWWriteResGroup46_1], (instrs ROL8r1, ROL16r1, ROL32r1, ROL64r1,
1203 ROR8r1, ROR16r1, ROR32r1, ROR64r1)>;
1205 def HWWriteResGroup47 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort0156]> {
1207 let NumMicroOps = 5;
1208 let ResourceCycles = [1,1,1,2];
1210 def: InstRW<[HWWriteResGroup47], (instregex "XADD(8|16|32|64)rm")>;
1212 def HWWriteResGroup48 : SchedWriteRes<[HWPort4,HWPort6,HWPort23,HWPort237,HWPort0156]> {
1214 let NumMicroOps = 5;
1215 let ResourceCycles = [1,1,1,1,1];
1217 def: InstRW<[HWWriteResGroup48], (instregex "CALL(16|32|64)m")>;
1218 def: InstRW<[HWWriteResGroup48], (instrs FARCALL64m)>;
1220 def HWWriteResGroup50 : SchedWriteRes<[HWPort1]> {
1222 let NumMicroOps = 1;
1223 let ResourceCycles = [1];
1225 def: InstRW<[HWWriteResGroup50], (instrs MMX_CVTPI2PSirr)>;
1226 def: InstRW<[HWWriteResGroup50], (instregex "P(DEP|EXT)(32|64)rr",
1227 "(V?)CVTDQ2PS(Y?)rr")>;
1229 def HWWriteResGroup51 : SchedWriteRes<[HWPort5]> {
1231 let NumMicroOps = 1;
1232 let ResourceCycles = [1];
1234 def: InstRW<[HWWriteResGroup51], (instregex "VPBROADCAST(B|W)rr")>;
1236 def HWWriteResGroup52 : SchedWriteRes<[HWPort1,HWPort23]> {
1238 let NumMicroOps = 2;
1239 let ResourceCycles = [1,1];
1241 def: InstRW<[HWWriteResGroup52], (instregex "(V?)CVTPS2DQrm",
1242 "(V?)CVTTPS2DQrm")>;
1244 def HWWriteResGroup52_1 : SchedWriteRes<[HWPort1,HWPort23]> {
1246 let NumMicroOps = 2;
1247 let ResourceCycles = [1,1];
1249 def: InstRW<[HWWriteResGroup52_1], (instregex "(ADD|SUB|SUBR)_F(32|64)m",
1250 "ILD_F(16|32|64)m")>;
1251 def: InstRW<[HWWriteResGroup52_1], (instrs VCVTDQ2PSYrm,
1255 def HWWriteResGroup53_1 : SchedWriteRes<[HWPort5,HWPort23]> {
1257 let NumMicroOps = 2;
1258 let ResourceCycles = [1,1];
1260 def: InstRW<[HWWriteResGroup53_1], (instrs VPMOVSXBWYrm,
1265 def HWWriteResGroup57 : SchedWriteRes<[HWPort5,HWPort0156]> {
1267 let NumMicroOps = 3;
1268 let ResourceCycles = [2,1];
1270 def: InstRW<[HWWriteResGroup57], (instrs MMX_PACKSSDWirr,
1274 def HWWriteResGroup58 : SchedWriteRes<[HWPort6,HWPort0156]> {
1276 let NumMicroOps = 3;
1277 let ResourceCycles = [1,2];
1279 def: InstRW<[HWWriteResGroup58], (instregex "CLD")>;
1281 def HWWriteResGroup59 : SchedWriteRes<[HWPort06,HWPort0156]> {
1283 let NumMicroOps = 3;
1284 let ResourceCycles = [1,2];
1286 def: InstRW<[HWWriteResGroup59], (instregex "RCL(8|16|32|64)r(1|i)",
1287 "RCR(8|16|32|64)r(1|i)")>;
1289 def HWWriteResGroup61 : SchedWriteRes<[HWPort0,HWPort4,HWPort237]> {
1291 let NumMicroOps = 3;
1292 let ResourceCycles = [1,1,1];
1294 def: InstRW<[HWWriteResGroup61], (instrs FNSTSWm)>;
1296 def HWWriteResGroup62 : SchedWriteRes<[HWPort1,HWPort4,HWPort237]> {
1298 let NumMicroOps = 3;
1299 let ResourceCycles = [1,1,1];
1301 def: InstRW<[HWWriteResGroup62], (instregex "IST(T?)_FP(16|32|64)m",
1304 def HWWriteResGroup66 : SchedWriteRes<[HWPort23,HWPort237,HWPort06,HWPort0156]> {
1306 let NumMicroOps = 5;
1307 let ResourceCycles = [1,1,1,2];
1309 def: InstRW<[HWWriteResGroup66], (instregex "RCL(8|16|32|64)m(1|i)",
1310 "RCR(8|16|32|64)m(1|i)")>;
1312 def HWWriteResGroup68 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort0156]> {
1314 let NumMicroOps = 6;
1315 let ResourceCycles = [1,1,1,3];
1317 def: InstRW<[HWWriteResGroup68], (instregex "XCHG(8|16|32|64)rm")>;
1319 def HWWriteResGroup69 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort06,HWPort0156]> {
1321 let NumMicroOps = 6;
1322 let ResourceCycles = [1,1,1,2,1];
1324 def: InstRW<[HWWriteResGroup69], (instregex "ROL(8|16|32|64)mCL",
1325 "ROR(8|16|32|64)mCL",
1326 "SAR(8|16|32|64)mCL",
1327 "SHL(8|16|32|64)mCL",
1328 "SHR(8|16|32|64)mCL")>;
1329 def: SchedAlias<WriteADCRMW, HWWriteResGroup69>;
1331 def HWWriteResGroup70 : SchedWriteRes<[HWPort0,HWPort1]> {
1333 let NumMicroOps = 2;
1334 let ResourceCycles = [1,1];
1336 def: InstRW<[HWWriteResGroup70], (instregex "(V?)CVT(T?)SD2SI(64)?rr",
1337 "(V?)CVT(T?)SS2SI(64)?rr")>;
1339 def HWWriteResGroup71 : SchedWriteRes<[HWPort0,HWPort5]> {
1341 let NumMicroOps = 2;
1342 let ResourceCycles = [1,1];
1344 def: InstRW<[HWWriteResGroup71], (instrs VCVTPS2PDYrr)>;
1346 def HWWriteResGroup72 : SchedWriteRes<[HWPort0,HWPort0156]> {
1348 let NumMicroOps = 2;
1349 let ResourceCycles = [1,1];
1351 def: InstRW<[HWWriteResGroup72], (instrs FNSTSW16r)>;
1353 def HWWriteResGroup73 : SchedWriteRes<[HWPort1,HWPort5]> {
1355 let NumMicroOps = 2;
1356 let ResourceCycles = [1,1];
1358 def: InstRW<[HWWriteResGroup73], (instrs MMX_CVTPI2PDirr,
1363 def: InstRW<[HWWriteResGroup73], (instregex "(V?)CVTDQ2PDrr",
1366 "(V?)CVTSI(64)?2SDrr",
1368 "(V?)CVT(T?)PD2DQrr")>;
1370 def HWWriteResGroup75 : SchedWriteRes<[HWPort1,HWPort23]> {
1372 let NumMicroOps = 3;
1373 let ResourceCycles = [2,1];
1375 def: InstRW<[HWWriteResGroup75], (instregex "FICOM(P?)(16|32)m")>;
1377 def HWWriteResGroup76 : SchedWriteRes<[HWPort0,HWPort1,HWPort23]> {
1379 let NumMicroOps = 3;
1380 let ResourceCycles = [1,1,1];
1382 def: InstRW<[HWWriteResGroup76], (instregex "(V?)CVTSD2SI(64)?rm",
1383 "(V?)CVTSS2SI(64)?rm",
1384 "(V?)CVTTSD2SI(64)?rm",
1386 "(V?)CVTTSS2SIrm")>;
1388 def HWWriteResGroup77 : SchedWriteRes<[HWPort0,HWPort5,HWPort23]> {
1390 let NumMicroOps = 3;
1391 let ResourceCycles = [1,1,1];
1393 def: InstRW<[HWWriteResGroup77], (instrs VCVTPS2PDYrm)>;
1395 def HWWriteResGroup78 : SchedWriteRes<[HWPort1,HWPort5,HWPort23]> {
1397 let NumMicroOps = 3;
1398 let ResourceCycles = [1,1,1];
1400 def: InstRW<[HWWriteResGroup78], (instrs CVTPD2PSrm,
1408 def HWWriteResGroup78_1 : SchedWriteRes<[HWPort1,HWPort5,HWPort23]> {
1410 let NumMicroOps = 3;
1411 let ResourceCycles = [1,1,1];
1413 def: InstRW<[HWWriteResGroup78_1], (instrs MMX_CVTPI2PDirm,
1414 CVTSD2SSrm, CVTSD2SSrm_Int,
1415 VCVTSD2SSrm, VCVTSD2SSrm_Int)>;
1417 def HWWriteResGroup80 : SchedWriteRes<[HWPort5,HWPort23,HWPort015]> {
1419 let NumMicroOps = 3;
1420 let ResourceCycles = [1,1,1];
1422 def: InstRW<[HWWriteResGroup80], (instregex "VPBROADCAST(B|W)(Y?)rm")>;
1424 def HWWriteResGroup81 : SchedWriteRes<[HWPort0156]> {
1426 let NumMicroOps = 4;
1427 let ResourceCycles = [4];
1429 def: InstRW<[HWWriteResGroup81], (instrs FNCLEX)>;
1431 def HWWriteResGroup82 : SchedWriteRes<[]> {
1433 let NumMicroOps = 4;
1434 let ResourceCycles = [];
1436 def: InstRW<[HWWriteResGroup82], (instrs VZEROUPPER)>;
1438 def HWWriteResGroup83 : SchedWriteRes<[HWPort1,HWPort6,HWPort0156]> {
1440 let NumMicroOps = 4;
1441 let ResourceCycles = [1,1,2];
1443 def: InstRW<[HWWriteResGroup83], (instregex "LAR(16|32|64)rr")>;
1445 def HWWriteResGroup87 : SchedWriteRes<[HWPort1,HWPort6,HWPort23,HWPort0156]> {
1447 let NumMicroOps = 5;
1448 let ResourceCycles = [1,2,1,1];
1450 def: InstRW<[HWWriteResGroup87], (instregex "LAR(16|32|64)rm",
1451 "LSL(16|32|64)rm")>;
1453 def HWWriteResGroup88 : SchedWriteRes<[HWPort4,HWPort237,HWPort0156]> {
1455 let NumMicroOps = 6;
1456 let ResourceCycles = [1,1,4];
1458 def: InstRW<[HWWriteResGroup88], (instregex "PUSHF(16|64)")>;
1460 def HWWriteResGroup89 : SchedWriteRes<[HWPort0]> {
1462 let NumMicroOps = 1;
1463 let ResourceCycles = [1];
1465 def: InstRW<[HWWriteResGroup89], (instregex "MUL_(FPrST0|FST0r|FrST0)")>;
1467 def HWWriteResGroup91_2 : SchedWriteRes<[HWPort0,HWPort23]> {
1469 let NumMicroOps = 2;
1470 let ResourceCycles = [1,1];
1472 def: InstRW<[HWWriteResGroup91_2], (instregex "(V?)PCMPGTQrm")>;
1474 def HWWriteResGroup91_3 : SchedWriteRes<[HWPort0,HWPort23]> {
1476 let NumMicroOps = 2;
1477 let ResourceCycles = [1,1];
1479 def: InstRW<[HWWriteResGroup91_3], (instregex "MUL_F(32|64)m")>;
1480 def: InstRW<[HWWriteResGroup91_3], (instrs VPCMPGTQYrm)>;
1482 def HWWriteResGroup93 : SchedWriteRes<[HWPort1,HWPort5]> {
1484 let NumMicroOps = 3;
1485 let ResourceCycles = [1,2];
1487 def: InstRW<[HWWriteResGroup93], (instregex "(V?)CVTSI642SSrr")>;
1489 def HWWriteResGroup94 : SchedWriteRes<[HWPort1,HWPort6,HWPort06]> {
1491 let NumMicroOps = 3;
1492 let ResourceCycles = [1,1,1];
1494 def: InstRW<[HWWriteResGroup94], (instregex "STR(16|32|64)r")>;
1496 def HWWriteResGroup97 : SchedWriteRes<[HWPort0,HWPort1,HWPort5,HWPort23]> {
1498 let NumMicroOps = 4;
1499 let ResourceCycles = [1,1,1,1];
1501 def: InstRW<[HWWriteResGroup97], (instregex "CVTTSS2SI64rm")>;
1503 def HWWriteResGroup99 : SchedWriteRes<[HWPort6,HWPort0156]> {
1505 let NumMicroOps = 5;
1506 let ResourceCycles = [1,4];
1508 def: InstRW<[HWWriteResGroup99], (instrs PAUSE)>;
1510 def HWWriteResGroup100 : SchedWriteRes<[HWPort06,HWPort0156]> {
1512 let NumMicroOps = 5;
1513 let ResourceCycles = [1,4];
1515 def: InstRW<[HWWriteResGroup100], (instrs XSETBV)>;
1517 def HWWriteResGroup102 : SchedWriteRes<[HWPort1,HWPort5]> {
1519 let NumMicroOps = 2;
1520 let ResourceCycles = [1,1];
1522 def: InstRW<[HWWriteResGroup102], (instrs VCVTDQ2PDYrr,
1527 def HWWriteResGroup103 : SchedWriteRes<[HWPort1,HWPort23]> {
1529 let NumMicroOps = 3;
1530 let ResourceCycles = [2,1];
1532 def: InstRW<[HWWriteResGroup103], (instregex "(ADD|SUB|SUBR)_FI(16|32)m")>;
1534 def HWWriteResGroup104 : SchedWriteRes<[HWPort1,HWPort5,HWPort23]> {
1536 let NumMicroOps = 3;
1537 let ResourceCycles = [1,1,1];
1539 def: InstRW<[HWWriteResGroup104], (instrs VCVTDQ2PDYrm)>;
1541 def HWWriteResGroup107 : SchedWriteRes<[HWPort1,HWPort6,HWPort06,HWPort0156]> {
1543 let NumMicroOps = 4;
1544 let ResourceCycles = [1,1,1,1];
1546 def: InstRW<[HWWriteResGroup107], (instregex "SLDT(16|32|64)r")>;
1548 def HWWriteResGroup108 : SchedWriteRes<[HWPort6,HWPort0156]> {
1550 let NumMicroOps = 6;
1551 let ResourceCycles = [1,5];
1553 def: InstRW<[HWWriteResGroup108], (instrs STD)>;
1555 def HWWriteResGroup114 : SchedWriteRes<[HWPort6,HWPort06,HWPort15,HWPort0156]> {
1557 let NumMicroOps = 7;
1558 let ResourceCycles = [2,2,1,2];
1560 def: InstRW<[HWWriteResGroup114], (instrs LOOP)>;
1562 def HWWriteResGroup115 : SchedWriteRes<[HWPort0,HWPort1,HWPort23]> {
1564 let NumMicroOps = 3;
1565 let ResourceCycles = [1,1,1];
1567 def: InstRW<[HWWriteResGroup115], (instregex "MUL_FI(16|32)m")>;
1569 def HWWriteResGroup120 : SchedWriteRes<[HWPort1,HWPort23,HWPort237,HWPort06,HWPort15,HWPort0156]> {
1571 let NumMicroOps = 10;
1572 let ResourceCycles = [1,1,1,4,1,2];
1574 def: InstRW<[HWWriteResGroup120], (instregex "RCL(8|16|32|64)mCL")>;
1576 def HWWriteResGroup129 : SchedWriteRes<[HWPort1,HWPort06,HWPort0156]> {
1578 let NumMicroOps = 7;
1579 let ResourceCycles = [2,2,3];
1581 def: InstRW<[HWWriteResGroup129], (instregex "RCL(16|32|64)rCL",
1582 "RCR(16|32|64)rCL")>;
1584 def HWWriteResGroup130 : SchedWriteRes<[HWPort1,HWPort06,HWPort15,HWPort0156]> {
1586 let NumMicroOps = 9;
1587 let ResourceCycles = [1,4,1,3];
1589 def: InstRW<[HWWriteResGroup130], (instrs RCL8rCL)>;
1591 def HWWriteResGroup131 : SchedWriteRes<[HWPort06,HWPort0156]> {
1593 let NumMicroOps = 11;
1594 let ResourceCycles = [2,9];
1596 def: InstRW<[HWWriteResGroup131], (instrs LOOPE, LOOPNE)>;
1598 def HWWriteResGroup132 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort06,HWPort15,HWPort0156]> {
1600 let NumMicroOps = 14;
1601 let ResourceCycles = [1,1,1,4,2,5];
1603 def: InstRW<[HWWriteResGroup132], (instrs CMPXCHG8B)>;
1605 def HWWriteResGroup135 : SchedWriteRes<[HWPort1,HWPort23,HWPort237,HWPort06,HWPort15,HWPort0156]> {
1607 let NumMicroOps = 11;
1608 let ResourceCycles = [2,1,1,3,1,3];
1610 def: InstRW<[HWWriteResGroup135], (instregex "RCR(8|16|32|64)mCL")>;
1612 def HWWriteResGroup142 : SchedWriteRes<[HWPort1,HWPort06,HWPort15,HWPort0156]> {
1614 let NumMicroOps = 10;
1615 let ResourceCycles = [2,3,1,4];
1617 def: InstRW<[HWWriteResGroup142], (instrs RCR8rCL)>;
1619 def HWWriteResGroup143 : SchedWriteRes<[HWPort23,HWPort0156]> {
1621 let NumMicroOps = 15;
1622 let ResourceCycles = [1,14];
1624 def: InstRW<[HWWriteResGroup143], (instrs POPF16)>;
1626 def HWWriteResGroup144 : SchedWriteRes<[HWPort4,HWPort5,HWPort6,HWPort23,HWPort237,HWPort06,HWPort0156]> {
1628 let NumMicroOps = 8;
1629 let ResourceCycles = [1,1,1,1,1,1,2];
1631 def: InstRW<[HWWriteResGroup144], (instrs INSB, INSL, INSW)>;
1633 def HWWriteResGroup145 : SchedWriteRes<[HWPort5, HWPort6]> {
1635 let NumMicroOps = 20;
1636 let ResourceCycles = [1,1];
1638 def: InstRW<[HWWriteResGroup145], (instrs VZEROALL)>;
1640 def HWWriteResGroup146 : SchedWriteRes<[HWPort0,HWPort4,HWPort5,HWPort23,HWPort237,HWPort06,HWPort0156]> {
1642 let NumMicroOps = 19;
1643 let ResourceCycles = [2,1,4,1,1,4,6];
1645 def: InstRW<[HWWriteResGroup146], (instrs CMPXCHG16B)>;
1647 def HWWriteResGroup147 : SchedWriteRes<[HWPort0,HWPort1,HWPort5,HWPort6,HWPort01,HWPort0156]> {
1649 let NumMicroOps = 15;
1650 let ResourceCycles = [2,1,2,4,2,4];
1652 def: InstRW<[HWWriteResGroup147], (instrs XCH_F)>;
1654 def HWWriteResGroup149 : SchedWriteRes<[HWPort5,HWPort6,HWPort06,HWPort0156]> {
1656 let NumMicroOps = 8;
1657 let ResourceCycles = [1,1,1,5];
1659 def: InstRW<[HWWriteResGroup149], (instrs CPUID, RDTSC)>;
1661 def HWWriteResGroup151 : SchedWriteRes<[HWPort6,HWPort23,HWPort0156]> {
1663 let NumMicroOps = 19;
1664 let ResourceCycles = [3,1,15];
1666 def: InstRW<[HWWriteResGroup151], (instregex "XRSTOR(64)?")>;
1668 def HWWriteResGroup154 : SchedWriteRes<[HWPort0]> {
1670 let NumMicroOps = 1;
1671 let ResourceCycles = [1];
1673 def: InstRW<[HWWriteResGroup154], (instregex "DIV_(FPrST0|FST0r|FrST0)")>;
1675 def HWWriteResGroup155 : SchedWriteRes<[HWPort0,HWPort23]> {
1677 let NumMicroOps = 2;
1678 let ResourceCycles = [1,1];
1680 def: InstRW<[HWWriteResGroup155], (instregex "DIVR_F(32|64)m")>;
1682 def HWWriteResGroup156 : SchedWriteRes<[HWPort5,HWPort6,HWPort0156]> {
1684 let NumMicroOps = 10;
1685 let ResourceCycles = [1,2,7];
1687 def: InstRW<[HWWriteResGroup156], (instrs MWAITrr)>;
1689 def HWWriteResGroup161 : SchedWriteRes<[HWPort0,HWPort1,HWPort23]> {
1691 let NumMicroOps = 3;
1692 let ResourceCycles = [1,1,1];
1694 def: InstRW<[HWWriteResGroup161], (instregex "DIVR_FI(16|32)m")>;
1696 def HWWriteResGroup162 : SchedWriteRes<[HWPort0]> {
1698 let NumMicroOps = 1;
1699 let ResourceCycles = [1];
1701 def: InstRW<[HWWriteResGroup162], (instregex "DIVR_(FPrST0|FST0r|FrST0)")>;
1703 def HWWriteResGroup163 : SchedWriteRes<[HWPort0,HWPort23]> {
1705 let NumMicroOps = 2;
1706 let ResourceCycles = [1,1];
1708 def: InstRW<[HWWriteResGroup163], (instregex "DIV_F(32|64)m")>;
1710 def HWWriteResGroup164 : SchedWriteRes<[HWPort4,HWPort6,HWPort23,HWPort237,HWPort0156]> {
1712 let NumMicroOps = 27;
1713 let ResourceCycles = [1,5,1,1,19];
1715 def: InstRW<[HWWriteResGroup164], (instrs XSAVE64)>;
1717 def HWWriteResGroup165 : SchedWriteRes<[HWPort4,HWPort6,HWPort23,HWPort237,HWPort0156]> {
1719 let NumMicroOps = 28;
1720 let ResourceCycles = [1,6,1,1,19];
1722 def: InstRW<[HWWriteResGroup165], (instrs XSAVE)>;
1723 def: InstRW<[HWWriteResGroup165], (instregex "XSAVEC", "XSAVES", "XSAVEOPT")>;
1725 def HWWriteResGroup166 : SchedWriteRes<[HWPort0,HWPort1,HWPort23]> {
1727 let NumMicroOps = 3;
1728 let ResourceCycles = [1,1,1];
1730 def: InstRW<[HWWriteResGroup166], (instregex "DIV_FI(16|32)m")>;
1732 def HWWriteResGroup170 : SchedWriteRes<[HWPort5,HWPort6,HWPort23,HWPort06,HWPort0156]> {
1734 let NumMicroOps = 23;
1735 let ResourceCycles = [1,5,3,4,10];
1737 def: InstRW<[HWWriteResGroup170], (instregex "IN(8|16|32)ri",
1740 def HWWriteResGroup171 : SchedWriteRes<[HWPort5,HWPort6,HWPort23,HWPort237,HWPort06,HWPort0156]> {
1742 let NumMicroOps = 23;
1743 let ResourceCycles = [1,5,2,1,4,10];
1745 def: InstRW<[HWWriteResGroup171], (instregex "OUT(8|16|32)ir",
1748 def HWWriteResGroup175 : SchedWriteRes<[HWPort1,HWPort4,HWPort5,HWPort6,HWPort23,HWPort237,HWPort15,HWPort0156]> {
1750 let NumMicroOps = 18;
1751 let ResourceCycles = [1,1,2,3,1,1,1,8];
1753 def: InstRW<[HWWriteResGroup175], (instrs VMCLEARm)>;
1755 def HWWriteResGroup176 : SchedWriteRes<[HWPort5,HWPort0156]> {
1757 let NumMicroOps = 22;
1758 let ResourceCycles = [2,20];
1760 def: InstRW<[HWWriteResGroup176], (instrs RDTSCP)>;
1762 def HWWriteResGroup177 : SchedWriteRes<[HWPort0,HWPort01,HWPort23,HWPort05,HWPort06,HWPort015,HWPort0156]> {
1764 let NumMicroOps = 64;
1765 let ResourceCycles = [2,2,8,1,10,2,39];
1767 def: InstRW<[HWWriteResGroup177], (instrs FLDENVm)>;
1769 def HWWriteResGroup178 : SchedWriteRes<[HWPort0,HWPort6,HWPort23,HWPort05,HWPort06,HWPort15,HWPort0156]> {
1771 let NumMicroOps = 88;
1772 let ResourceCycles = [4,4,31,1,2,1,45];
1774 def: InstRW<[HWWriteResGroup178], (instrs FXRSTOR64)>;
1776 def HWWriteResGroup179 : SchedWriteRes<[HWPort0,HWPort6,HWPort23,HWPort05,HWPort06,HWPort15,HWPort0156]> {
1778 let NumMicroOps = 90;
1779 let ResourceCycles = [4,2,33,1,2,1,47];
1781 def: InstRW<[HWWriteResGroup179], (instrs FXRSTOR)>;
1783 def HWWriteResGroup180 : SchedWriteRes<[HWPort5,HWPort01,HWPort0156]> {
1785 let NumMicroOps = 15;
1786 let ResourceCycles = [6,3,6];
1788 def: InstRW<[HWWriteResGroup180], (instrs FNINIT)>;
1790 def HWWriteResGroup183 : SchedWriteRes<[HWPort0,HWPort1,HWPort4,HWPort5,HWPort6,HWPort237,HWPort06,HWPort0156]> {
1792 let NumMicroOps = 100;
1793 let ResourceCycles = [9,9,11,8,1,11,21,30];
1795 def: InstRW<[HWWriteResGroup183], (instrs FSTENVm)>;
1797 def HWWriteResGroup184 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> {
1799 let NumMicroOps = 12;
1800 let ResourceCycles = [2,2,2,1,3,2];
1802 def: InstRW<[HWWriteResGroup184], (instrs VGATHERDPDrm, VPGATHERDQrm)>;
1804 def HWWriteResGroup185 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> {
1806 let NumMicroOps = 20;
1807 let ResourceCycles = [3,3,4,1,5,4];
1809 def: InstRW<[HWWriteResGroup185], (instrs VGATHERDPDYrm, VPGATHERDQYrm)>;
1811 def HWWriteResGroup186 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> {
1813 let NumMicroOps = 20;
1814 let ResourceCycles = [3,3,4,1,5,4];
1816 def: InstRW<[HWWriteResGroup186], (instrs VGATHERDPSrm, VPGATHERDDrm)>;
1818 def HWWriteResGroup187 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> {
1820 let NumMicroOps = 34;
1821 let ResourceCycles = [5,3,8,1,9,8];
1823 def: InstRW<[HWWriteResGroup187], (instrs VGATHERDPSYrm, VPGATHERDDYrm)>;
1825 def HWWriteResGroup188 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> {
1827 let NumMicroOps = 14;
1828 let ResourceCycles = [3,3,2,1,3,2];
1830 def: InstRW<[HWWriteResGroup188], (instrs VGATHERQPDrm, VPGATHERQQrm)>;
1832 def HWWriteResGroup189 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> {
1834 let NumMicroOps = 22;
1835 let ResourceCycles = [5,3,4,1,5,4];
1837 def: InstRW<[HWWriteResGroup189], (instrs VGATHERQPDYrm, VPGATHERQQYrm,
1838 VGATHERQPSYrm, VPGATHERQDYrm)>;
1840 def HWWriteResGroup190 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> {
1842 let NumMicroOps = 15;
1843 let ResourceCycles = [3,3,2,1,4,2];
1845 def: InstRW<[HWWriteResGroup190], (instrs VGATHERQPSrm, VPGATHERQDrm)>;
1847 def: InstRW<[WriteZero], (instrs CLC)>;
1850 // Instruction variants handled by the renamer. These might not need execution
1851 // ports in certain conditions.
1852 // See Agner's Fog "The microarchitecture of Intel, AMD and VIA CPUs",
1853 // section "Haswell and Broadwell Pipeline" > "Register allocation and
1855 // These can be investigated with llvm-exegesis, e.g.
1856 // echo 'pxor %mm0, %mm0' | /tmp/llvm-exegesis -mode=uops -snippets-file=-
1857 // echo 'vxorpd %xmm0, %xmm0, %xmm1' | /tmp/llvm-exegesis -mode=uops -snippets-file=-
1859 def HWWriteZeroLatency : SchedWriteRes<[]> {
1863 def HWWriteZeroIdiom : SchedWriteVariant<[
1864 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>,
1865 SchedVar<NoSchedPred, [WriteALU]>
1867 def : InstRW<[HWWriteZeroIdiom], (instrs SUB32rr, SUB64rr,
1870 def HWWriteFZeroIdiom : SchedWriteVariant<[
1871 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>,
1872 SchedVar<NoSchedPred, [WriteFLogic]>
1874 def : InstRW<[HWWriteFZeroIdiom], (instrs XORPSrr, VXORPSrr, XORPDrr,
1877 def HWWriteFZeroIdiomY : SchedWriteVariant<[
1878 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>,
1879 SchedVar<NoSchedPred, [WriteFLogicY]>
1881 def : InstRW<[HWWriteFZeroIdiomY], (instrs VXORPSYrr, VXORPDYrr)>;
1883 def HWWriteVZeroIdiomLogicX : SchedWriteVariant<[
1884 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>,
1885 SchedVar<NoSchedPred, [WriteVecLogicX]>
1887 def : InstRW<[HWWriteVZeroIdiomLogicX], (instrs PXORrr, VPXORrr)>;
1889 def HWWriteVZeroIdiomLogicY : SchedWriteVariant<[
1890 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>,
1891 SchedVar<NoSchedPred, [WriteVecLogicY]>
1893 def : InstRW<[HWWriteVZeroIdiomLogicY], (instrs VPXORYrr)>;
1895 def HWWriteVZeroIdiomALUX : SchedWriteVariant<[
1896 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>,
1897 SchedVar<NoSchedPred, [WriteVecALUX]>
1899 def : InstRW<[HWWriteVZeroIdiomALUX], (instrs PSUBBrr, VPSUBBrr,
1903 PCMPGTBrr, VPCMPGTBrr,
1904 PCMPGTDrr, VPCMPGTDrr,
1905 PCMPGTWrr, VPCMPGTWrr)>;
1907 def HWWriteVZeroIdiomALUY : SchedWriteVariant<[
1908 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>,
1909 SchedVar<NoSchedPred, [WriteVecALUY]>
1911 def : InstRW<[HWWriteVZeroIdiomALUY], (instrs VPSUBBYrr,
1919 def HWWritePCMPGTQ : SchedWriteRes<[HWPort0]> {
1921 let NumMicroOps = 1;
1922 let ResourceCycles = [1];
1925 def HWWriteVZeroIdiomPCMPGTQ : SchedWriteVariant<[
1926 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>,
1927 SchedVar<NoSchedPred, [HWWritePCMPGTQ]>
1929 def : InstRW<[HWWriteVZeroIdiomPCMPGTQ], (instrs PCMPGTQrr, VPCMPGTQrr,
1933 // The 0x83 ADC/SBB opcodes have special support for immediate 0 to only require
1934 // a single uop. It does not apply to the GR8 encoding. And only applies to the
1935 // 8-bit immediate since using larger immediate for 0 would be silly.
1936 // Unfortunately, this optimization does not apply to the AX/EAX/RAX short
1937 // encodings we convert to in MCInstLowering so we exclude AX/EAX/RAX here since
1938 // we schedule before that point.
1939 // TODO: Should we disable using the short encodings on these CPUs?
1940 def HWFastADC0 : MCSchedPredicate<
1942 CheckImmOperand<2, 0>, // Second MCOperand is Imm and has value 0.
1943 CheckNot<CheckRegOperand<1, AX>>, // First MCOperand is not register AX
1944 CheckNot<CheckRegOperand<1, EAX>>, // First MCOperand is not register EAX
1945 CheckNot<CheckRegOperand<1, RAX>> // First MCOperand is not register RAX
1949 def HWWriteADC0 : SchedWriteRes<[HWPort06]> {
1951 let NumMicroOps = 1;
1952 let ResourceCycles = [1];
1955 def HWWriteADC : SchedWriteVariant<[
1956 SchedVar<HWFastADC0, [HWWriteADC0]>,
1957 SchedVar<NoSchedPred, [WriteADC]>
1960 def : InstRW<[HWWriteADC], (instrs ADC16ri8, ADC32ri8, ADC64ri8,
1961 SBB16ri8, SBB32ri8, SBB64ri8)>;
1963 // CMOVs that use both Z and C flag require an extra uop.
1964 def HWWriteCMOVA_CMOVBErr : SchedWriteRes<[HWPort06,HWPort0156]> {
1966 let ResourceCycles = [1,2];
1967 let NumMicroOps = 3;
1970 def HWWriteCMOVA_CMOVBErm : SchedWriteRes<[HWPort23,HWPort06,HWPort0156]> {
1972 let ResourceCycles = [1,1,2];
1973 let NumMicroOps = 4;
1976 def HWCMOVA_CMOVBErr : SchedWriteVariant<[
1977 SchedVar<MCSchedPredicate<IsCMOVArr_Or_CMOVBErr>, [HWWriteCMOVA_CMOVBErr]>,
1978 SchedVar<NoSchedPred, [WriteCMOV]>
1981 def HWCMOVA_CMOVBErm : SchedWriteVariant<[
1982 SchedVar<MCSchedPredicate<IsCMOVArm_Or_CMOVBErm>, [HWWriteCMOVA_CMOVBErm]>,
1983 SchedVar<NoSchedPred, [WriteCMOV.Folded]>
1986 def : InstRW<[HWCMOVA_CMOVBErr], (instrs CMOV16rr, CMOV32rr, CMOV64rr)>;
1987 def : InstRW<[HWCMOVA_CMOVBErm], (instrs CMOV16rm, CMOV32rm, CMOV64rm)>;
1989 // SETCCs that use both Z and C flag require an extra uop.
1990 def HWWriteSETA_SETBEr : SchedWriteRes<[HWPort06,HWPort0156]> {
1992 let ResourceCycles = [1,1];
1993 let NumMicroOps = 2;
1996 def HWWriteSETA_SETBEm : SchedWriteRes<[HWPort4,HWPort237,HWPort06,HWPort0156]> {
1998 let ResourceCycles = [1,1,1,1];
1999 let NumMicroOps = 4;
2002 def HWSETA_SETBErr : SchedWriteVariant<[
2003 SchedVar<MCSchedPredicate<IsSETAr_Or_SETBEr>, [HWWriteSETA_SETBEr]>,
2004 SchedVar<NoSchedPred, [WriteSETCC]>
2007 def HWSETA_SETBErm : SchedWriteVariant<[
2008 SchedVar<MCSchedPredicate<IsSETAm_Or_SETBEm>, [HWWriteSETA_SETBEm]>,
2009 SchedVar<NoSchedPred, [WriteSETCCStore]>
2012 def : InstRW<[HWSETA_SETBErr], (instrs SETCCr)>;
2013 def : InstRW<[HWSETA_SETBErm], (instrs SETCCm)>;