AMDGPU: Mark test as XFAIL in expensive_checks builds
[llvm-project.git] / llvm / lib / Target / X86 / X86SchedBroadwell.td
blob4b697c43363418d51aacfef414176b844a20c57a
1 //=- X86SchedBroadwell.td - X86 Broadwell Scheduling ---------*- tablegen -*-=//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the machine model for Broadwell to support instruction
10 // scheduling and other instruction cost heuristics.
12 //===----------------------------------------------------------------------===//
14 def BroadwellModel : SchedMachineModel {
15   // All x86 instructions are modeled as a single micro-op, and BW can decode 4
16   // instructions per cycle.
17   let IssueWidth = 4;
18   let MicroOpBufferSize = 192; // Based on the reorder buffer.
19   let LoadLatency = 5;
20   let MispredictPenalty = 16;
22   // Based on the LSD (loop-stream detector) queue size and benchmarking data.
23   let LoopMicroOpBufferSize = 50;
25   // This flag is set to allow the scheduler to assign a default model to
26   // unrecognized opcodes.
27   let CompleteModel = 0;
30 let SchedModel = BroadwellModel in {
32 // Broadwell can issue micro-ops to 8 different ports in one cycle.
34 // Ports 0, 1, 5, and 6 handle all computation.
35 // Port 4 gets the data half of stores. Store data can be available later than
36 // the store address, but since we don't model the latency of stores, we can
37 // ignore that.
38 // Ports 2 and 3 are identical. They handle loads and the address half of
39 // stores. Port 7 can handle address calculations.
40 def BWPort0 : ProcResource<1>;
41 def BWPort1 : ProcResource<1>;
42 def BWPort2 : ProcResource<1>;
43 def BWPort3 : ProcResource<1>;
44 def BWPort4 : ProcResource<1>;
45 def BWPort5 : ProcResource<1>;
46 def BWPort6 : ProcResource<1>;
47 def BWPort7 : ProcResource<1>;
49 // Many micro-ops are capable of issuing on multiple ports.
50 def BWPort01  : ProcResGroup<[BWPort0, BWPort1]>;
51 def BWPort23  : ProcResGroup<[BWPort2, BWPort3]>;
52 def BWPort237 : ProcResGroup<[BWPort2, BWPort3, BWPort7]>;
53 def BWPort04  : ProcResGroup<[BWPort0, BWPort4]>;
54 def BWPort05  : ProcResGroup<[BWPort0, BWPort5]>;
55 def BWPort06  : ProcResGroup<[BWPort0, BWPort6]>;
56 def BWPort15  : ProcResGroup<[BWPort1, BWPort5]>;
57 def BWPort16  : ProcResGroup<[BWPort1, BWPort6]>;
58 def BWPort56  : ProcResGroup<[BWPort5, BWPort6]>;
59 def BWPort015 : ProcResGroup<[BWPort0, BWPort1, BWPort5]>;
60 def BWPort056 : ProcResGroup<[BWPort0, BWPort5, BWPort6]>;
61 def BWPort0156: ProcResGroup<[BWPort0, BWPort1, BWPort5, BWPort6]>;
63 // 60 Entry Unified Scheduler
64 def BWPortAny : ProcResGroup<[BWPort0, BWPort1, BWPort2, BWPort3, BWPort4,
65                               BWPort5, BWPort6, BWPort7]> {
66   let BufferSize=60;
69 // Integer division issued on port 0.
70 def BWDivider : ProcResource<1>;
71 // FP division and sqrt on port 0.
72 def BWFPDivider : ProcResource<1>;
74 // Integer loads are 5 cycles, so ReadAfterLd registers needn't be available until 5
75 // cycles after the memory operand.
76 def : ReadAdvance<ReadAfterLd, 5>;
78 // Vector loads are 5/5/6 cycles, so ReadAfterVec*Ld registers needn't be available
79 // until 5/5/6 cycles after the memory operand.
80 def : ReadAdvance<ReadAfterVecLd, 5>;
81 def : ReadAdvance<ReadAfterVecXLd, 5>;
82 def : ReadAdvance<ReadAfterVecYLd, 6>;
84 def : ReadAdvance<ReadInt2Fpu, 0>;
86 // Many SchedWrites are defined in pairs with and without a folded load.
87 // Instructions with folded loads are usually micro-fused, so they only appear
88 // as two micro-ops when queued in the reservation station.
89 // This multiclass defines the resource usage for variants with and without
90 // folded loads.
91 multiclass BWWriteResPair<X86FoldableSchedWrite SchedRW,
92                           list<ProcResourceKind> ExePorts,
93                           int Lat, list<int> Res = [1], int UOps = 1,
94                           int LoadLat = 5, int LoadUOps = 1> {
95   // Register variant is using a single cycle on ExePort.
96   def : WriteRes<SchedRW, ExePorts> {
97     let Latency = Lat;
98     let ReleaseAtCycles = Res;
99     let NumMicroOps = UOps;
100   }
102   // Memory variant also uses a cycle on port 2/3 and adds LoadLat cycles to
103   // the latency (default = 5).
104   def : WriteRes<SchedRW.Folded, !listconcat([BWPort23], ExePorts)> {
105     let Latency = !add(Lat, LoadLat);
106     let ReleaseAtCycles = !listconcat([1], Res);
107     let NumMicroOps = !add(UOps, LoadUOps);
108   }
111 // A folded store needs a cycle on port 4 for the store data, and an extra port
112 // 2/3/7 cycle to recompute the address.
113 def : WriteRes<WriteRMW, [BWPort237,BWPort4]>;
115 // Loads, stores, and moves, not folded with other operations.
116 // Store_addr on 237.
117 // Store_data on 4.
118 defm : X86WriteRes<WriteStore,   [BWPort237, BWPort4], 1, [1,1], 1>;
119 defm : X86WriteRes<WriteStoreNT, [BWPort237, BWPort4], 1, [1,1], 2>;
120 defm : X86WriteRes<WriteLoad,    [BWPort23], 5, [1], 1>;
121 defm : X86WriteRes<WriteMove,    [BWPort0156], 1, [1], 1>;
123 // Treat misc copies as a move.
124 def  : InstRW<[WriteMove], (instrs COPY)>;
126 // Idioms that clear a register, like xorps %xmm0, %xmm0.
127 // These can often bypass execution ports completely.
128 def  : WriteRes<WriteZero,       []>;
130 // Model the effect of clobbering the read-write mask operand of the GATHER operation.
131 // Does not cost anything by itself, only has latency, matching that of the WriteLoad,
132 defm : X86WriteRes<WriteVecMaskedGatherWriteback, [], 5, [], 0>;
134 // Arithmetic.
135 defm : BWWriteResPair<WriteALU,    [BWPort0156], 1>; // Simple integer ALU op.
136 defm : BWWriteResPair<WriteADC,    [BWPort06], 1>; // Integer ALU + flags op.
138 // Integer multiplication.
139 defm : BWWriteResPair<WriteIMul8,     [BWPort1],   3>;
140 defm : BWWriteResPair<WriteIMul16,    [BWPort1,BWPort06,BWPort0156], 4, [1,1,2], 4>;
141 defm : X86WriteRes<WriteIMul16Imm,    [BWPort1,BWPort0156], 4, [1,1], 2>;
142 defm : X86WriteRes<WriteIMul16ImmLd,  [BWPort1,BWPort0156,BWPort23], 8, [1,1,1], 3>;
143 defm : BWWriteResPair<WriteIMul16Reg, [BWPort1],   3>;
144 defm : BWWriteResPair<WriteIMul32,    [BWPort1,BWPort06,BWPort0156], 4, [1,1,1], 3>;
145 defm : BWWriteResPair<WriteMULX32,    [BWPort1,BWPort06,BWPort0156], 3, [1,1,1], 3>;
146 defm : BWWriteResPair<WriteIMul32Imm, [BWPort1],   3>;
147 defm : BWWriteResPair<WriteIMul32Reg, [BWPort1],   3>;
148 defm : BWWriteResPair<WriteIMul64,    [BWPort1,BWPort5], 4, [1,1], 2>;
149 defm : BWWriteResPair<WriteMULX64,    [BWPort1,BWPort5], 3, [1,1], 2>;
150 defm : BWWriteResPair<WriteIMul64Imm, [BWPort1],   3>;
151 defm : BWWriteResPair<WriteIMul64Reg, [BWPort1],   3>;
152 def BWWriteIMulH : WriteRes<WriteIMulH, []> { let Latency = 4; }
153 def  : WriteRes<WriteIMulHLd, []> {
154   let Latency = !add(BWWriteIMulH.Latency, BroadwellModel.LoadLatency);
157 defm : X86WriteRes<WriteBSWAP32,   [BWPort15], 1, [1], 1>;
158 defm : X86WriteRes<WriteBSWAP64,   [BWPort06, BWPort15], 2, [1, 1], 2>;
159 defm : X86WriteRes<WriteCMPXCHG,[BWPort06, BWPort0156], 5, [2, 3], 5>;
160 defm : X86WriteRes<WriteCMPXCHGRMW,[BWPort23, BWPort06, BWPort0156, BWPort237, BWPort4], 8, [1, 2, 1, 1, 1], 6>;
161 defm : X86WriteRes<WriteXCHG,      [BWPort0156], 2, [3], 3>;
163 // Integer shifts and rotates.
164 defm : BWWriteResPair<WriteShift,    [BWPort06],  1>;
165 defm : BWWriteResPair<WriteShiftCL,  [BWPort06],  3, [3], 3>;
166 defm : BWWriteResPair<WriteRotate,   [BWPort06],  1, [1], 1>;
167 defm : BWWriteResPair<WriteRotateCL, [BWPort06],  3, [3], 3>;
169 // SHLD/SHRD.
170 defm : X86WriteRes<WriteSHDrri, [BWPort1], 3, [1], 1>;
171 defm : X86WriteRes<WriteSHDrrcl,[BWPort1,BWPort06,BWPort0156], 6, [1, 1, 2], 4>;
172 defm : X86WriteRes<WriteSHDmri, [BWPort1,BWPort23,BWPort237,BWPort0156], 9, [1, 1, 1, 1], 4>;
173 defm : X86WriteRes<WriteSHDmrcl,[BWPort1,BWPort23,BWPort237,BWPort06,BWPort0156], 11, [1, 1, 1, 1, 2], 6>;
175 // Branches don't produce values, so they have no latency, but they still
176 // consume resources. Indirect branches can fold loads.
177 defm : BWWriteResPair<WriteJump,  [BWPort06],   1>;
179 defm : BWWriteResPair<WriteCRC32, [BWPort1],   3>;
181 defm : BWWriteResPair<WriteCMOV,  [BWPort06], 1>; // Conditional move.
182 defm : X86WriteRes<WriteFCMOV, [BWPort1], 3, [1], 1>; // x87 conditional move.
184 def  : WriteRes<WriteSETCC, [BWPort06]>; // Setcc.
185 def  : WriteRes<WriteSETCCStore, [BWPort06,BWPort4,BWPort237]> {
186   let Latency = 2;
187   let NumMicroOps = 3;
190 defm : X86WriteRes<WriteLAHFSAHF,        [BWPort06], 1, [1], 1>;
191 defm : X86WriteRes<WriteBitTest,         [BWPort06], 1, [1], 1>; // Bit Test instrs
192 defm : X86WriteRes<WriteBitTestImmLd,    [BWPort06,BWPort23], 6, [1,1], 2>;
193 defm : X86WriteRes<WriteBitTestRegLd,    [BWPort0156,BWPort23], 6, [1,1], 2>;
194 defm : X86WriteRes<WriteBitTestSet,      [BWPort06], 1, [1], 1>; // Bit Test + Set instrs
195 defm : X86WriteRes<WriteBitTestSetImmLd, [BWPort06,BWPort23], 5, [1,1], 3>;
196 defm : X86WriteRes<WriteBitTestSetRegLd, [BWPort0156,BWPort23], 5, [1,1], 2>;
198 // This is for simple LEAs with one or two input operands.
199 // The complex ones can only execute on port 1, and they require two cycles on
200 // the port to read all inputs. We don't model that.
201 def : WriteRes<WriteLEA, [BWPort15]>;
203 // Bit counts.
204 defm : BWWriteResPair<WriteBSF, [BWPort1], 3>;
205 defm : BWWriteResPair<WriteBSR, [BWPort1], 3>;
206 defm : BWWriteResPair<WriteLZCNT,          [BWPort1], 3>;
207 defm : BWWriteResPair<WriteTZCNT,          [BWPort1], 3>;
208 defm : BWWriteResPair<WritePOPCNT,         [BWPort1], 3>;
210 // BMI1 BEXTR/BLS, BMI2 BZHI
211 defm : BWWriteResPair<WriteBEXTR, [BWPort06,BWPort15], 2, [1,1], 2>;
212 defm : BWWriteResPair<WriteBLS,   [BWPort15], 1>;
213 defm : BWWriteResPair<WriteBZHI,  [BWPort15], 1>;
215 // TODO: Why isn't the BWDivider used consistently?
216 defm : X86WriteRes<WriteDiv8,     [BWPort0, BWDivider], 25, [1, 10], 1>;
217 defm : X86WriteRes<WriteDiv16,    [BWPort0,BWPort1,BWPort5,BWPort6,BWPort01,BWPort0156], 80, [7,7,3,3,1,11], 32>;
218 defm : X86WriteRes<WriteDiv32,    [BWPort0,BWPort1,BWPort5,BWPort6,BWPort01,BWPort0156], 80, [7,7,3,3,1,11], 32>;
219 defm : X86WriteRes<WriteDiv64,    [BWPort0,BWPort1,BWPort5,BWPort6,BWPort01,BWPort0156], 80, [7,7,3,3,1,11], 32>;
220 defm : X86WriteRes<WriteDiv8Ld,   [BWPort0,BWPort1,BWPort5,BWPort23,BWPort0156], 34, [2,2,2,1,1], 8>;
221 defm : X86WriteRes<WriteDiv16Ld,  [BWPort0,BWPort1,BWPort5,BWPort23,BWPort0156], 34, [2,2,2,1,1], 8>;
222 defm : X86WriteRes<WriteDiv32Ld,  [BWPort0,BWPort1,BWPort5,BWPort23,BWPort0156], 34, [2,2,2,1,1], 8>;
223 defm : X86WriteRes<WriteDiv64Ld,  [BWPort0,BWPort1,BWPort5,BWPort23,BWPort0156], 34, [2,2,2,1,1], 8>;
225 defm : X86WriteRes<WriteIDiv8,    [BWPort0, BWDivider], 25, [1,10], 1>;
226 defm : X86WriteRes<WriteIDiv16,   [BWPort0, BWDivider], 25, [1,10], 1>;
227 defm : X86WriteRes<WriteIDiv32,   [BWPort0, BWDivider], 25, [1,10], 1>;
228 defm : X86WriteRes<WriteIDiv64,   [BWPort0, BWDivider], 25, [1,10], 1>;
229 defm : X86WriteRes<WriteIDiv8Ld,  [BWPort0,BWPort1,BWPort5,BWPort23,BWPort0156], 35, [2,2,2,1,1], 8>;
230 defm : X86WriteRes<WriteIDiv16Ld, [BWPort0,BWPort1,BWPort5,BWPort23,BWPort0156], 35, [2,2,2,1,1], 8>;
231 defm : X86WriteRes<WriteIDiv32Ld, [BWPort0,BWPort1,BWPort5,BWPort23,BWPort0156], 35, [2,2,2,1,1], 8>;
232 defm : X86WriteRes<WriteIDiv64Ld, [BWPort0,BWPort1,BWPort5,BWPort23,BWPort0156], 35, [2,2,2,1,1], 8>;
234 // Floating point. This covers both scalar and vector operations.
235 defm : X86WriteRes<WriteFLD0,          [BWPort01], 1, [1], 1>;
236 defm : X86WriteRes<WriteFLD1,          [BWPort01], 1, [2], 2>;
237 defm : X86WriteRes<WriteFLDC,          [BWPort01], 1, [2], 2>;
238 defm : X86WriteRes<WriteFLoad,         [BWPort23], 5, [1], 1>;
239 defm : X86WriteRes<WriteFLoadX,        [BWPort23], 5, [1], 1>;
240 defm : X86WriteRes<WriteFLoadY,        [BWPort23], 6, [1], 1>;
241 defm : X86WriteRes<WriteFMaskedLoad,   [BWPort23,BWPort5], 7, [1,2], 3>;
242 defm : X86WriteRes<WriteFMaskedLoadY,  [BWPort23,BWPort5], 8, [1,2], 3>;
243 defm : X86WriteRes<WriteFStore,        [BWPort237,BWPort4], 1, [1,1], 2>;
244 defm : X86WriteRes<WriteFStoreX,       [BWPort237,BWPort4], 1, [1,1], 2>;
245 defm : X86WriteRes<WriteFStoreY,       [BWPort237,BWPort4], 1, [1,1], 2>;
246 defm : X86WriteRes<WriteFStoreNT,      [BWPort237,BWPort4], 1, [1,1], 2>;
247 defm : X86WriteRes<WriteFStoreNTX,     [BWPort237,BWPort4], 1, [1,1], 2>;
248 defm : X86WriteRes<WriteFStoreNTY,     [BWPort237,BWPort4], 1, [1,1], 2>;
250 defm : X86WriteRes<WriteFMaskedStore32,  [BWPort0,BWPort4,BWPort23,BWPort1], 5, [1,1,1,1], 4>;
251 defm : X86WriteRes<WriteFMaskedStore32Y, [BWPort0,BWPort4,BWPort23,BWPort1], 5, [1,1,1,1], 4>;
252 defm : X86WriteRes<WriteFMaskedStore64,  [BWPort0,BWPort4,BWPort23,BWPort1], 5, [1,1,1,1], 4>;
253 defm : X86WriteRes<WriteFMaskedStore64Y, [BWPort0,BWPort4,BWPort23,BWPort1], 5, [1,1,1,1], 4>;
255 defm : X86WriteRes<WriteFMove,         [BWPort5], 1, [1], 1>;
256 defm : X86WriteRes<WriteFMoveX,        [BWPort5], 1, [1], 1>;
257 defm : X86WriteRes<WriteFMoveY,        [BWPort5], 1, [1], 1>;
258 defm : X86WriteResUnsupported<WriteFMoveZ>;
259 defm : X86WriteRes<WriteEMMS,          [BWPort01,BWPort15,BWPort015,BWPort0156], 31, [8,1,21,1], 31>;
261 defm : BWWriteResPair<WriteFAdd,    [BWPort1],  3, [1], 1, 5>; // Floating point add/sub.
262 defm : BWWriteResPair<WriteFAddX,   [BWPort1],  3, [1], 1, 5>; // Floating point add/sub (XMM).
263 defm : BWWriteResPair<WriteFAddY,   [BWPort1],  3, [1], 1, 6>; // Floating point add/sub (YMM/ZMM).
264 defm : X86WriteResPairUnsupported<WriteFAddZ>;
265 defm : BWWriteResPair<WriteFAdd64,  [BWPort1],  3, [1], 1, 5>; // Floating point double add/sub.
266 defm : BWWriteResPair<WriteFAdd64X, [BWPort1],  3, [1], 1, 5>; // Floating point double add/sub (XMM).
267 defm : BWWriteResPair<WriteFAdd64Y, [BWPort1],  3, [1], 1, 6>; // Floating point double add/sub (YMM/ZMM).
268 defm : X86WriteResPairUnsupported<WriteFAdd64Z>;
270 defm : BWWriteResPair<WriteFCmp,    [BWPort1],  3, [1], 1, 5>; // Floating point compare.
271 defm : BWWriteResPair<WriteFCmpX,   [BWPort1],  3, [1], 1, 5>; // Floating point compare (XMM).
272 defm : BWWriteResPair<WriteFCmpY,   [BWPort1],  3, [1], 1, 6>; // Floating point compare (YMM/ZMM).
273 defm : X86WriteResPairUnsupported<WriteFCmpZ>;
274 defm : BWWriteResPair<WriteFCmp64,  [BWPort1],  3, [1], 1, 5>; // Floating point double compare.
275 defm : BWWriteResPair<WriteFCmp64X, [BWPort1],  3, [1], 1, 5>; // Floating point double compare (XMM).
276 defm : BWWriteResPair<WriteFCmp64Y, [BWPort1],  3, [1], 1, 6>; // Floating point double compare (YMM/ZMM).
277 defm : X86WriteResPairUnsupported<WriteFCmp64Z>;
279 defm : BWWriteResPair<WriteFCom,    [BWPort1],  3>; // Floating point compare to flags (X87).
280 defm : BWWriteResPair<WriteFComX,   [BWPort1],  3>; // Floating point compare to flags (SSE).
282 defm : BWWriteResPair<WriteFMul,    [BWPort01], 3, [1], 1, 5>; // Floating point multiplication.
283 defm : BWWriteResPair<WriteFMulX,   [BWPort01], 3, [1], 1, 5>; // Floating point multiplication (XMM).
284 defm : BWWriteResPair<WriteFMulY,   [BWPort01], 3, [1], 1, 6>; // Floating point multiplication (YMM/ZMM).
285 defm : X86WriteResPairUnsupported<WriteFMulZ>;
286 defm : BWWriteResPair<WriteFMul64,  [BWPort01], 3, [1], 1, 5>; // Floating point double multiplication.
287 defm : BWWriteResPair<WriteFMul64X, [BWPort01], 3, [1], 1, 5>; // Floating point double multiplication (XMM).
288 defm : BWWriteResPair<WriteFMul64Y, [BWPort01], 3, [1], 1, 6>; // Floating point double multiplication (YMM/ZMM).
289 defm : X86WriteResPairUnsupported<WriteFMul64Z>;
291 //defm : BWWriteResPair<WriteFDiv,     [BWPort0,BWFPDivider], 11, [1,3], 1, 5>; // Floating point division.
292 defm : BWWriteResPair<WriteFDivX,    [BWPort0,BWFPDivider], 11, [1,5], 1, 5>; // Floating point division (XMM).
293 defm : BWWriteResPair<WriteFDivY,    [BWPort0,BWPort015,BWFPDivider], 17, [2,1,10], 3, 6>; // Floating point division (YMM).
294 defm : X86WriteResPairUnsupported<WriteFDivZ>;
295 //defm : BWWriteResPair<WriteFDiv64,   [BWPort0,BWFPDivider], 14, [1,8], 1, 5>; // Floating point division.
296 defm : BWWriteResPair<WriteFDiv64X,  [BWPort0,BWFPDivider], 14, [1,8], 1, 5>; // Floating point division (XMM).
297 defm : BWWriteResPair<WriteFDiv64Y,  [BWPort0,BWPort015,BWFPDivider], 23, [2,1,16], 3, 6>; // Floating point division (YMM).
298 defm : X86WriteResPairUnsupported<WriteFDiv64Z>;
300 defm : BWWriteResPair<WriteFRcp,   [BWPort0],  5, [1], 1, 5>; // Floating point reciprocal estimate.
301 defm : BWWriteResPair<WriteFRcpX,  [BWPort0],  5, [1], 1, 5>; // Floating point reciprocal estimate (XMM).
302 defm : BWWriteResPair<WriteFRcpY,  [BWPort0,BWPort015], 11, [2,1], 3, 6>; // Floating point reciprocal estimate (YMM/ZMM).
303 defm : X86WriteResPairUnsupported<WriteFRcpZ>;
305 defm : BWWriteResPair<WriteFRsqrt, [BWPort0],  5, [1], 1, 5>; // Floating point reciprocal square root estimate.
306 defm : BWWriteResPair<WriteFRsqrtX,[BWPort0],  5, [1], 1, 5>; // Floating point reciprocal square root estimate (XMM).
307 defm : BWWriteResPair<WriteFRsqrtY,[BWPort0,BWPort015], 11, [2,1], 3, 6>; // Floating point reciprocal square root estimate (YMM/ZMM).
308 defm : X86WriteResPairUnsupported<WriteFRsqrtZ>;
310 defm : X86WriteRes<WriteFSqrt,       [BWPort0,BWFPDivider], 11, [1,4], 1>; // Floating point square root.
311 defm : X86WriteRes<WriteFSqrtLd,     [BWPort0,BWPort23,BWFPDivider], 16, [1,1,7], 2>;
312 defm : BWWriteResPair<WriteFSqrtX,   [BWPort0,BWFPDivider], 11, [1,7], 1, 5>; // Floating point square root (XMM).
313 defm : BWWriteResPair<WriteFSqrtY,   [BWPort0,BWPort015,BWFPDivider], 21, [2,1,14], 3, 6>; // Floating point square root (YMM).
314 defm : X86WriteResPairUnsupported<WriteFSqrtZ>;
315 defm : X86WriteRes<WriteFSqrt64,     [BWPort0,BWFPDivider], 16, [1,8], 1>; // Floating point double square root.
316 defm : X86WriteRes<WriteFSqrt64Ld,   [BWPort0,BWPort23,BWFPDivider], 21, [1,1,14], 2>;
317 defm : BWWriteResPair<WriteFSqrt64X, [BWPort0,BWFPDivider], 16, [1,14],1, 5>; // Floating point double square root (XMM).
318 defm : BWWriteResPair<WriteFSqrt64Y, [BWPort0,BWPort015,BWFPDivider], 29, [2,1,28], 3, 6>; // Floating point double square root (YMM).
319 defm : X86WriteResPairUnsupported<WriteFSqrt64Z>;
320 defm : BWWriteResPair<WriteFSqrt80,  [BWPort0,BWFPDivider], 23, [1,9]>; // Floating point long double square root.
322 defm : BWWriteResPair<WriteFMA,    [BWPort01], 5, [1], 1, 5>; // Fused Multiply Add.
323 defm : BWWriteResPair<WriteFMAX,   [BWPort01], 5, [1], 1, 5>; // Fused Multiply Add (XMM).
324 defm : BWWriteResPair<WriteFMAY,   [BWPort01], 5, [1], 1, 6>; // Fused Multiply Add (YMM/ZMM).
325 defm : X86WriteResPairUnsupported<WriteFMAZ>;
326 defm : BWWriteResPair<WriteDPPD,   [BWPort0,BWPort1,BWPort5],  9, [1,1,1], 3, 5>; // Floating point double dot product.
327 defm : X86WriteRes<WriteDPPS,      [BWPort0,BWPort1,BWPort5], 14, [2,1,1], 4>;
328 defm : X86WriteRes<WriteDPPSY,     [BWPort0,BWPort1,BWPort5], 14, [2,1,1], 4>;
329 defm : X86WriteRes<WriteDPPSLd,    [BWPort0,BWPort1,BWPort5,BWPort06,BWPort23], 19, [2,1,1,1,1], 6>;
330 defm : X86WriteRes<WriteDPPSYLd,   [BWPort0,BWPort1,BWPort5,BWPort06,BWPort23], 20, [2,1,1,1,1], 6>;
331 defm : BWWriteResPair<WriteFSign,     [BWPort5], 1>; // Floating point fabs/fchs.
332 defm : BWWriteResPair<WriteFRnd,      [BWPort1], 6, [2], 2, 5>; // Floating point rounding.
333 defm : BWWriteResPair<WriteFRndY,     [BWPort1], 6, [2], 2, 6>; // Floating point rounding (YMM/ZMM).
334 defm : X86WriteResPairUnsupported<WriteFRndZ>;
335 defm : BWWriteResPair<WriteFLogic,    [BWPort5], 1, [1], 1, 5>; // Floating point and/or/xor logicals.
336 defm : BWWriteResPair<WriteFLogicY,   [BWPort5], 1, [1], 1, 6>; // Floating point and/or/xor logicals (YMM/ZMM).
337 defm : X86WriteResPairUnsupported<WriteFLogicZ>;
338 defm : BWWriteResPair<WriteFTest,     [BWPort0], 1, [1], 1, 5>; // Floating point TEST instructions.
339 defm : BWWriteResPair<WriteFTestY,    [BWPort0], 1, [1], 1, 6>; // Floating point TEST instructions (YMM/ZMM).
340 defm : X86WriteResPairUnsupported<WriteFTestZ>;
341 defm : BWWriteResPair<WriteFShuffle,  [BWPort5], 1, [1], 1, 5>; // Floating point vector shuffles.
342 defm : BWWriteResPair<WriteFShuffleY, [BWPort5], 1, [1], 1, 6>; // Floating point vector shuffles (YMM/ZMM).
343 defm : X86WriteResPairUnsupported<WriteFShuffleZ>;
344 defm : BWWriteResPair<WriteFVarShuffle,  [BWPort5], 1, [1], 1, 5>; // Floating point vector variable shuffles.
345 defm : BWWriteResPair<WriteFVarShuffleY, [BWPort5], 1, [1], 1, 6>; // Floating point vector variable shuffles.
346 defm : X86WriteResPairUnsupported<WriteFVarShuffleZ>;
347 defm : BWWriteResPair<WriteFBlend,  [BWPort015], 1, [1], 1, 5>; // Floating point vector blends.
348 defm : BWWriteResPair<WriteFBlendY, [BWPort015], 1, [1], 1, 6>; // Floating point vector blends.
349 defm : X86WriteResPairUnsupported<WriteFBlendZ>;
350 defm : BWWriteResPair<WriteFShuffle256, [BWPort5], 3, [1], 1, 6>; // Fp 256-bit width vector shuffles.
351 defm : BWWriteResPair<WriteFVarShuffle256, [BWPort5], 3, [1], 1, 6>; // Fp 256-bit width vector variable shuffles.
352 defm : BWWriteResPair<WriteFVarBlend,  [BWPort5], 2, [2], 2, 5>; // Fp vector variable blends.
353 defm : BWWriteResPair<WriteFVarBlendY, [BWPort5], 2, [2], 2, 6>; // Fp vector variable blends.
354 defm : X86WriteResPairUnsupported<WriteFVarBlendZ>;
356 // FMA Scheduling helper class.
357 // class FMASC { X86FoldableSchedWrite Sched = WriteFAdd; }
359 // Conversion between integer and float.
360 defm : BWWriteResPair<WriteCvtSS2I,   [BWPort1,BWPort0], 4, [1,1], 2, 5>;
361 defm : BWWriteResPair<WriteCvtPS2I,   [BWPort1], 3, [1], 1, 5>;
362 defm : BWWriteResPair<WriteCvtPS2IY,  [BWPort1], 3, [1], 1, 6>;
363 defm : X86WriteResPairUnsupported<WriteCvtPS2IZ>;
364 defm : BWWriteResPair<WriteCvtSD2I,   [BWPort1,BWPort0], 4, [1,1], 2, 5>;
365 defm : BWWriteResPair<WriteCvtPD2I,   [BWPort1,BWPort5], 4, [1,1], 2, 5>;
366 defm : BWWriteResPair<WriteCvtPD2IY,  [BWPort1,BWPort5], 6, [1,1], 2, 6>;
367 defm : X86WriteResPairUnsupported<WriteCvtPD2IZ>;
369 defm : X86WriteRes<WriteCvtI2SS,      [BWPort1,BWPort5], 4, [1,1], 2>;
370 defm : X86WriteRes<WriteCvtI2PS,              [BWPort1], 3,   [1], 1>;
371 defm : X86WriteRes<WriteCvtI2PSY,             [BWPort1], 3,   [1], 1>;
372 defm : X86WriteRes<WriteCvtI2SSLd,   [BWPort1,BWPort23], 9, [1,1], 2>;
373 defm : X86WriteRes<WriteCvtI2PSLd,   [BWPort1,BWPort23], 8, [1,1], 2>;
374 defm : X86WriteRes<WriteCvtI2PSYLd,  [BWPort1,BWPort23], 9, [1,1], 2>;
375 defm : X86WriteResPairUnsupported<WriteCvtI2PSZ>;
376 defm : X86WriteRes<WriteCvtI2SD,      [BWPort1,BWPort5], 4, [1,1], 2>;
377 defm : X86WriteRes<WriteCvtI2PD,      [BWPort1,BWPort5], 4, [1,1], 2>;
378 defm : X86WriteRes<WriteCvtI2PDY,     [BWPort1,BWPort5], 6, [1,1], 2>;
379 defm : X86WriteRes<WriteCvtI2SDLd,   [BWPort1,BWPort23], 9, [1,1], 2>;
380 defm : X86WriteRes<WriteCvtI2PDLd,   [BWPort1,BWPort23], 9, [1,1], 2>;
381 defm : X86WriteRes<WriteCvtI2PDYLd,  [BWPort1,BWPort23],11, [1,1], 2>;
382 defm : X86WriteResPairUnsupported<WriteCvtI2PDZ>;
384 defm : X86WriteRes<WriteCvtSS2SD,     [BWPort0,BWPort5], 2, [1,1], 2>;
385 defm : X86WriteRes<WriteCvtPS2PD,     [BWPort0,BWPort5], 2, [1,1], 2>;
386 defm : X86WriteRes<WriteCvtPS2PDY,    [BWPort0,BWPort5], 4, [1,1], 2>;
387 defm : X86WriteRes<WriteCvtSS2SDLd,  [BWPort0,BWPort23], 6, [1,1], 2>;
388 defm : X86WriteRes<WriteCvtPS2PDLd,  [BWPort0,BWPort23], 6, [1,1], 2>;
389 defm : X86WriteRes<WriteCvtPS2PDYLd, [BWPort0,BWPort23], 9, [1,1], 2>;
390 defm : X86WriteResPairUnsupported<WriteCvtPS2PDZ>;
391 defm : BWWriteResPair<WriteCvtSD2SS,  [BWPort1,BWPort5], 4, [1,1], 2, 5>;
392 defm : BWWriteResPair<WriteCvtPD2PS,  [BWPort1,BWPort5], 4, [1,1], 2, 5>;
393 defm : BWWriteResPair<WriteCvtPD2PSY, [BWPort1,BWPort5], 6, [1,1], 2, 6>;
394 defm : X86WriteResPairUnsupported<WriteCvtPD2PSZ>;
396 defm : X86WriteRes<WriteCvtPH2PS,     [BWPort1,BWPort5], 2, [1,1], 2>;
397 defm : X86WriteRes<WriteCvtPH2PSY,    [BWPort1,BWPort5], 2, [1,1], 2>;
398 defm : X86WriteResUnsupported<WriteCvtPH2PSZ>;
399 defm : X86WriteRes<WriteCvtPH2PSLd,  [BWPort1,BWPort23], 6, [1,1], 2>;
400 defm : X86WriteRes<WriteCvtPH2PSYLd, [BWPort1,BWPort23], 6, [1,1], 2>;
401 defm : X86WriteResUnsupported<WriteCvtPH2PSZLd>;
403 defm : X86WriteRes<WriteCvtPS2PH,    [BWPort1,BWPort5], 4, [1,1], 2>;
404 defm : X86WriteRes<WriteCvtPS2PHY,   [BWPort1,BWPort5], 6, [1,1], 2>;
405 defm : X86WriteResUnsupported<WriteCvtPS2PHZ>;
406 defm : X86WriteRes<WriteCvtPS2PHSt,  [BWPort1,BWPort4,BWPort237], 5, [1,1,1], 3>;
407 defm : X86WriteRes<WriteCvtPS2PHYSt, [BWPort1,BWPort4,BWPort237], 7, [1,1,1], 3>;
408 defm : X86WriteResUnsupported<WriteCvtPS2PHZSt>;
410 // Vector integer operations.
411 defm : X86WriteRes<WriteVecLoad,         [BWPort23], 5, [1], 1>;
412 defm : X86WriteRes<WriteVecLoadX,        [BWPort23], 5, [1], 1>;
413 defm : X86WriteRes<WriteVecLoadY,        [BWPort23], 6, [1], 1>;
414 defm : X86WriteRes<WriteVecLoadNT,       [BWPort23], 5, [1], 1>;
415 defm : X86WriteRes<WriteVecLoadNTY,      [BWPort23], 6, [1], 1>;
416 defm : X86WriteRes<WriteVecMaskedLoad,   [BWPort23,BWPort5], 7, [1,2], 3>;
417 defm : X86WriteRes<WriteVecMaskedLoadY,  [BWPort23,BWPort5], 8, [1,2], 3>;
418 defm : X86WriteRes<WriteVecStore,        [BWPort237,BWPort4], 1, [1,1], 2>;
419 defm : X86WriteRes<WriteVecStoreX,       [BWPort237,BWPort4], 1, [1,1], 2>;
420 defm : X86WriteRes<WriteVecStoreY,       [BWPort237,BWPort4], 1, [1,1], 2>;
421 defm : X86WriteRes<WriteVecStoreNT,      [BWPort237,BWPort4], 1, [1,1], 2>;
422 defm : X86WriteRes<WriteVecStoreNTY,     [BWPort237,BWPort4], 1, [1,1], 2>;
423 defm : X86WriteRes<WriteVecMaskedStore32,  [BWPort0,BWPort4,BWPort23,BWPort1], 5, [1,1,1,1], 4>;
424 defm : X86WriteRes<WriteVecMaskedStore32Y, [BWPort0,BWPort4,BWPort23,BWPort1], 5, [1,1,1,1], 4>;
425 defm : X86WriteRes<WriteVecMaskedStore64,  [BWPort0,BWPort4,BWPort23,BWPort1], 5, [1,1,1,1], 4>;
426 defm : X86WriteRes<WriteVecMaskedStore64Y, [BWPort0,BWPort4,BWPort23,BWPort1], 5, [1,1,1,1], 4>;
427 defm : X86WriteRes<WriteVecMove,         [BWPort015], 1, [1], 1>;
428 defm : X86WriteRes<WriteVecMoveX,        [BWPort015], 1, [1], 1>;
429 defm : X86WriteRes<WriteVecMoveY,        [BWPort015], 1, [1], 1>;
430 defm : X86WriteResUnsupported<WriteVecMoveZ>;
431 defm : X86WriteRes<WriteVecMoveToGpr,    [BWPort0], 1, [1], 1>;
432 defm : X86WriteRes<WriteVecMoveFromGpr,  [BWPort5], 1, [1], 1>;
434 defm : BWWriteResPair<WriteVecLogic, [BWPort015], 1, [1], 1, 5>; // Vector integer and/or/xor.
435 defm : BWWriteResPair<WriteVecLogicX,[BWPort015], 1, [1], 1, 5>; // Vector integer and/or/xor.
436 defm : BWWriteResPair<WriteVecLogicY,[BWPort015], 1, [1], 1, 6>; // Vector integer and/or/xor (YMM/ZMM).
437 defm : X86WriteResPairUnsupported<WriteVecLogicZ>;
438 defm : BWWriteResPair<WriteVecTest,  [BWPort0,BWPort5], 2, [1,1], 2, 5>; // Vector integer TEST instructions.
439 defm : BWWriteResPair<WriteVecTestY, [BWPort0,BWPort5], 4, [1,1], 2, 6>; // Vector integer TEST instructions (YMM/ZMM).
440 defm : X86WriteResPairUnsupported<WriteVecTestZ>;
441 defm : BWWriteResPair<WriteVecALU,   [BWPort15], 1, [1], 1, 5>; // Vector integer ALU op, no logicals.
442 defm : BWWriteResPair<WriteVecALUX,  [BWPort15], 1, [1], 1, 5>; // Vector integer ALU op, no logicals.
443 defm : BWWriteResPair<WriteVecALUY,  [BWPort15], 1, [1], 1, 6>; // Vector integer ALU op, no logicals (YMM/ZMM).
444 defm : X86WriteResPairUnsupported<WriteVecALUZ>;
445 defm : BWWriteResPair<WriteVecIMul,  [BWPort0],  5, [1], 1, 5>; // Vector integer multiply.
446 defm : BWWriteResPair<WriteVecIMulX, [BWPort0],  5, [1], 1, 5>; // Vector integer multiply.
447 defm : BWWriteResPair<WriteVecIMulY, [BWPort0],  5, [1], 1, 6>; // Vector integer multiply.
448 defm : X86WriteResPairUnsupported<WriteVecIMulZ>;
449 defm : BWWriteResPair<WritePMULLD,   [BWPort0], 10, [2], 2, 5>; // Vector PMULLD.
450 defm : BWWriteResPair<WritePMULLDY,  [BWPort0], 10, [2], 2, 6>; // Vector PMULLD (YMM/ZMM).
451 defm : X86WriteResPairUnsupported<WritePMULLDZ>;
452 defm : BWWriteResPair<WriteShuffle,  [BWPort5], 1, [1], 1, 5>; // Vector shuffles.
453 defm : BWWriteResPair<WriteShuffleX, [BWPort5], 1, [1], 1, 5>; // Vector shuffles.
454 defm : BWWriteResPair<WriteShuffleY, [BWPort5], 1, [1], 1, 6>; // Vector shuffles (YMM/ZMM).
455 defm : X86WriteResPairUnsupported<WriteShuffleZ>;
456 defm : BWWriteResPair<WriteVarShuffle, [BWPort5], 1, [1], 1, 5>; // Vector variable shuffles.
457 defm : BWWriteResPair<WriteVarShuffleX,[BWPort5], 1, [1], 1, 5>; // Vector variable shuffles.
458 defm : BWWriteResPair<WriteVarShuffleY,[BWPort5], 1, [1], 1, 6>; // Vector variable shuffles (YMM/ZMM).
459 defm : X86WriteResPairUnsupported<WriteVarShuffleZ>;
460 defm : BWWriteResPair<WriteBlend,  [BWPort5], 1, [1], 1, 5>; // Vector blends.
461 defm : BWWriteResPair<WriteBlendY, [BWPort5], 1, [1], 1, 6>; // Vector blends (YMM/ZMM).
462 defm : X86WriteResPairUnsupported<WriteBlendZ>;
463 defm : BWWriteResPair<WriteShuffle256, [BWPort5], 3, [1], 1, 6>;  // 256-bit width vector shuffles.
464 defm : BWWriteResPair<WriteVPMOV256, [BWPort5], 3, [1], 1, 6>;  // 256-bit width packed vector width-changing move.
465 defm : BWWriteResPair<WriteVarShuffle256, [BWPort5], 3, [1], 1, 6>;  // 256-bit width vector variable shuffles.
466 defm : BWWriteResPair<WriteVarBlend,  [BWPort5], 2, [2], 2, 5>; // Vector variable blends.
467 defm : BWWriteResPair<WriteVarBlendY, [BWPort5], 2, [2], 2, 6>; // Vector variable blends (YMM/ZMM).
468 defm : X86WriteResPairUnsupported<WriteVarBlendZ>;
469 defm : BWWriteResPair<WriteMPSAD,  [BWPort0, BWPort5], 7, [1, 2], 3, 5>; // Vector MPSAD.
470 defm : BWWriteResPair<WriteMPSADY, [BWPort0, BWPort5], 7, [1, 2], 3, 6>; // Vector MPSAD.
471 defm : X86WriteResPairUnsupported<WriteMPSADZ>;
472 defm : BWWriteResPair<WritePSADBW,   [BWPort0], 5, [1], 1, 5>; // Vector PSADBW.
473 defm : BWWriteResPair<WritePSADBWX,  [BWPort0], 5, [1], 1, 5>; // Vector PSADBW.
474 defm : BWWriteResPair<WritePSADBWY,  [BWPort0], 5, [1], 1, 6>; // Vector PSADBW (YMM/ZMM).
475 defm : X86WriteResPairUnsupported<WritePSADBWZ>;
476 defm : BWWriteResPair<WritePHMINPOS, [BWPort0], 5>; // Vector PHMINPOS.
478 // Vector integer shifts.
479 defm : X86WriteRes<WriteVecShift,        [BWPort0], 1, [1], 1>;
480 defm : X86WriteRes<WriteVecShiftX,       [BWPort0,BWPort5],  2, [1,1], 2>;
481 defm : X86WriteRes<WriteVecShiftY,       [BWPort0,BWPort5],  4, [1,1], 2>;
482 defm : X86WriteRes<WriteVecShiftLd,      [BWPort0,BWPort23], 6, [1,1], 2>;
483 defm : X86WriteRes<WriteVecShiftXLd,     [BWPort0,BWPort23], 7, [1,1], 2>;
484 defm : X86WriteRes<WriteVecShiftYLd,     [BWPort0,BWPort23], 7, [1,1], 2>;
485 defm : X86WriteResPairUnsupported<WriteVecShiftZ>;
487 defm : BWWriteResPair<WriteVecShiftImm,  [BWPort0],  1, [1], 1, 5>;
488 defm : BWWriteResPair<WriteVecShiftImmX, [BWPort0],  1, [1], 1, 5>; // Vector integer immediate shifts (XMM).
489 defm : BWWriteResPair<WriteVecShiftImmY, [BWPort0],  1, [1], 1, 6>; // Vector integer immediate shifts (YMM/ZMM).
490 defm : X86WriteResPairUnsupported<WriteVecShiftImmZ>;
491 defm : BWWriteResPair<WriteVarVecShift,  [BWPort0, BWPort5], 3, [2,1], 3, 5>; // Variable vector shifts.
492 defm : BWWriteResPair<WriteVarVecShiftY, [BWPort0, BWPort5], 3, [2,1], 3, 6>; // Variable vector shifts (YMM/ZMM).
493 defm : X86WriteResPairUnsupported<WriteVarVecShiftZ>;
495 // Vector insert/extract operations.
496 def : WriteRes<WriteVecInsert, [BWPort5]> {
497   let Latency = 2;
498   let NumMicroOps = 2;
499   let ReleaseAtCycles = [2];
501 def : WriteRes<WriteVecInsertLd, [BWPort5,BWPort23]> {
502   let Latency = 6;
503   let NumMicroOps = 2;
506 def : WriteRes<WriteVecExtract, [BWPort0,BWPort5]> {
507   let Latency = 2;
508   let NumMicroOps = 2;
510 def : WriteRes<WriteVecExtractSt, [BWPort4,BWPort5,BWPort237]> {
511   let Latency = 2;
512   let NumMicroOps = 3;
515 // String instructions.
517 // Packed Compare Implicit Length Strings, Return Mask
518 def : WriteRes<WritePCmpIStrM, [BWPort0]> {
519   let Latency = 11;
520   let NumMicroOps = 3;
521   let ReleaseAtCycles = [3];
523 def : WriteRes<WritePCmpIStrMLd, [BWPort0, BWPort23]> {
524   let Latency = 16;
525   let NumMicroOps = 4;
526   let ReleaseAtCycles = [3,1];
529 // Packed Compare Explicit Length Strings, Return Mask
530 def : WriteRes<WritePCmpEStrM, [BWPort0, BWPort5, BWPort015, BWPort0156]> {
531   let Latency = 19;
532   let NumMicroOps = 9;
533   let ReleaseAtCycles = [4,3,1,1];
535 def : WriteRes<WritePCmpEStrMLd, [BWPort0, BWPort5, BWPort23, BWPort015, BWPort0156]> {
536   let Latency = 24;
537   let NumMicroOps = 10;
538   let ReleaseAtCycles = [4,3,1,1,1];
541 // Packed Compare Implicit Length Strings, Return Index
542 def : WriteRes<WritePCmpIStrI, [BWPort0]> {
543   let Latency = 11;
544   let NumMicroOps = 3;
545   let ReleaseAtCycles = [3];
547 def : WriteRes<WritePCmpIStrILd, [BWPort0, BWPort23]> {
548   let Latency = 16;
549   let NumMicroOps = 4;
550   let ReleaseAtCycles = [3,1];
553 // Packed Compare Explicit Length Strings, Return Index
554 def : WriteRes<WritePCmpEStrI, [BWPort0, BWPort5, BWPort0156]> {
555   let Latency = 18;
556   let NumMicroOps = 8;
557   let ReleaseAtCycles = [4,3,1];
559 def : WriteRes<WritePCmpEStrILd, [BWPort0, BWPort5, BWPort23, BWPort0156]> {
560   let Latency = 23;
561   let NumMicroOps = 9;
562   let ReleaseAtCycles = [4,3,1,1];
565 // MOVMSK Instructions.
566 def : WriteRes<WriteFMOVMSK,    [BWPort0]> { let Latency = 3; }
567 def : WriteRes<WriteVecMOVMSK,  [BWPort0]> { let Latency = 3; }
568 def : WriteRes<WriteVecMOVMSKY, [BWPort0]> { let Latency = 3; }
569 def : WriteRes<WriteMMXMOVMSK,  [BWPort0]> { let Latency = 1; }
571 // AES Instructions.
572 def : WriteRes<WriteAESDecEnc, [BWPort5]> { // Decryption, encryption.
573   let Latency = 7;
574   let NumMicroOps = 1;
575   let ReleaseAtCycles = [1];
577 def : WriteRes<WriteAESDecEncLd, [BWPort5, BWPort23]> {
578   let Latency = 12;
579   let NumMicroOps = 2;
580   let ReleaseAtCycles = [1,1];
583 def : WriteRes<WriteAESIMC, [BWPort5]> { // InvMixColumn.
584   let Latency = 14;
585   let NumMicroOps = 2;
586   let ReleaseAtCycles = [2];
588 def : WriteRes<WriteAESIMCLd, [BWPort5, BWPort23]> {
589   let Latency = 19;
590   let NumMicroOps = 3;
591   let ReleaseAtCycles = [2,1];
594 def : WriteRes<WriteAESKeyGen, [BWPort0, BWPort5, BWPort015]> { // Key Generation.
595   let Latency = 29;
596   let NumMicroOps = 11;
597   let ReleaseAtCycles = [2,7,2];
599 def : WriteRes<WriteAESKeyGenLd, [BWPort0, BWPort5, BWPort23, BWPort015]> {
600   let Latency = 33;
601   let NumMicroOps = 11;
602   let ReleaseAtCycles = [2,7,1,1];
605 // Carry-less multiplication instructions.
606 defm : BWWriteResPair<WriteCLMul,  [BWPort0], 5>;
607 // Load/store MXCSR.
608 def : WriteRes<WriteLDMXCSR, [BWPort0,BWPort23,BWPort0156]> { let Latency = 7; let NumMicroOps = 3; let ReleaseAtCycles = [1,1,1]; }
609 def : WriteRes<WriteSTMXCSR, [BWPort4,BWPort5,BWPort237]> { let Latency = 2; let NumMicroOps = 3; let ReleaseAtCycles = [1,1,1]; }
611 // Catch-all for expensive system instructions.
612 def : WriteRes<WriteSystem,     [BWPort0156]> { let Latency = 100; }
614 // Old microcoded instructions that nobody use.
615 def : WriteRes<WriteMicrocoded, [BWPort0156]> { let Latency = 100; }
617 // Fence instructions.
618 def : WriteRes<WriteFence,  [BWPort23, BWPort4]> { let NumMicroOps = 2; let ReleaseAtCycles = [1,1]; }
620 // Nop, not very useful expect it provides a model for nops!
621 def : WriteRes<WriteNop, []>;
623 ////////////////////////////////////////////////////////////////////////////////
624 // Horizontal add/sub  instructions.
625 ////////////////////////////////////////////////////////////////////////////////
627 defm : BWWriteResPair<WriteFHAdd,   [BWPort1,BWPort5], 5, [1,2], 3, 5>;
628 defm : BWWriteResPair<WriteFHAddY,  [BWPort1,BWPort5], 5, [1,2], 3, 6>;
629 defm : BWWriteResPair<WritePHAdd,  [BWPort5,BWPort15], 3, [2,1], 3, 5>;
630 defm : BWWriteResPair<WritePHAddX, [BWPort5,BWPort15], 3, [2,1], 3, 5>;
631 defm : BWWriteResPair<WritePHAddY, [BWPort5,BWPort15], 3, [2,1], 3, 6>;
633 // Remaining instrs.
635 def BWWriteResGroup1 : SchedWriteRes<[BWPort0]> {
636   let Latency = 1;
637   let NumMicroOps = 1;
638   let ReleaseAtCycles = [1];
640 def: InstRW<[BWWriteResGroup1], (instregex "VPSLLVQ(Y?)rr",
641                                            "VPSRLVQ(Y?)rr")>;
643 def BWWriteResGroup2 : SchedWriteRes<[BWPort1]> {
644   let Latency = 1;
645   let NumMicroOps = 1;
646   let ReleaseAtCycles = [1];
648 def: InstRW<[BWWriteResGroup2], (instregex "COM(P?)_FST0r",
649                                            "UCOM_F(P?)r")>;
651 def BWWriteResGroup4 : SchedWriteRes<[BWPort6]> {
652   let Latency = 1;
653   let NumMicroOps = 1;
654   let ReleaseAtCycles = [1];
656 def: InstRW<[BWWriteResGroup4], (instregex "JMP(16|32|64)r")>;
658 def BWWriteResGroup5 : SchedWriteRes<[BWPort01]> {
659   let Latency = 1;
660   let NumMicroOps = 1;
661   let ReleaseAtCycles = [1];
663 def: InstRW<[BWWriteResGroup5], (instrs FINCSTP, FNOP)>;
665 def BWWriteResGroup6 : SchedWriteRes<[BWPort06]> {
666   let Latency = 1;
667   let NumMicroOps = 1;
668   let ReleaseAtCycles = [1];
670 def: InstRW<[BWWriteResGroup6], (instrs CDQ, CQO)>;
672 def BWWriteResGroup7 : SchedWriteRes<[BWPort15]> {
673   let Latency = 1;
674   let NumMicroOps = 1;
675   let ReleaseAtCycles = [1];
677 def: InstRW<[BWWriteResGroup7], (instregex "ANDN(32|64)rr")>;
679 def BWWriteResGroup8 : SchedWriteRes<[BWPort015]> {
680   let Latency = 1;
681   let NumMicroOps = 1;
682   let ReleaseAtCycles = [1];
684 def: InstRW<[BWWriteResGroup8], (instregex "VPBLENDD(Y?)rri")>;
686 def BWWriteResGroup9 : SchedWriteRes<[BWPort0156]> {
687   let Latency = 1;
688   let NumMicroOps = 1;
689   let ReleaseAtCycles = [1];
691 def: InstRW<[BWWriteResGroup9], (instrs SGDT64m,
692                                         SIDT64m,
693                                         SMSW16m,
694                                         STRm,
695                                         SYSCALL)>;
697 def BWWriteResGroup10 : SchedWriteRes<[BWPort4,BWPort237]> {
698   let Latency = 1;
699   let NumMicroOps = 2;
700   let ReleaseAtCycles = [1,1];
702 def: InstRW<[BWWriteResGroup10], (instrs FBSTPm)>;
703 def: InstRW<[BWWriteResGroup10], (instregex "ST_FP(32|64|80)m")>;
705 def BWWriteResGroup12 : SchedWriteRes<[BWPort01]> {
706   let Latency = 2;
707   let NumMicroOps = 2;
708   let ReleaseAtCycles = [2];
710 def: InstRW<[BWWriteResGroup12], (instrs FDECSTP)>;
712 def BWWriteResGroup14 : SchedWriteRes<[BWPort0156]> {
713   let Latency = 2;
714   let NumMicroOps = 2;
715   let ReleaseAtCycles = [2];
717 def: InstRW<[BWWriteResGroup14], (instrs LFENCE,
718                                          WAIT,
719                                          XGETBV)>;
721 def BWWriteResGroup16 : SchedWriteRes<[BWPort6,BWPort0156]> {
722   let Latency = 2;
723   let NumMicroOps = 2;
724   let ReleaseAtCycles = [1,1];
726 def: InstRW<[BWWriteResGroup16], (instregex "CLFLUSH")>;
728 def BWWriteResGroup17 : SchedWriteRes<[BWPort01,BWPort015]> {
729   let Latency = 2;
730   let NumMicroOps = 2;
731   let ReleaseAtCycles = [1,1];
733 def: InstRW<[BWWriteResGroup17], (instrs MMX_MOVDQ2Qrr)>;
735 def BWWriteResGroup20 : SchedWriteRes<[BWPort06,BWPort0156]> {
736   let Latency = 2;
737   let NumMicroOps = 2;
738   let ReleaseAtCycles = [1,1];
740 def: InstRW<[BWWriteResGroup20], (instrs CWD,
741                                          JCXZ, JECXZ, JRCXZ,
742                                          ADC8i8, SBB8i8,
743                                          ADC16i16, SBB16i16,
744                                          ADC32i32, SBB32i32,
745                                          ADC64i32, SBB64i32)>;
747 def BWWriteResGroup22 : SchedWriteRes<[BWPort4,BWPort6,BWPort237]> {
748   let Latency = 2;
749   let NumMicroOps = 3;
750   let ReleaseAtCycles = [1,1,1];
752 def: InstRW<[BWWriteResGroup22], (instrs FNSTCW16m)>;
754 def BWWriteResGroup24 : SchedWriteRes<[BWPort4,BWPort237,BWPort15]> {
755   let Latency = 2;
756   let NumMicroOps = 3;
757   let ReleaseAtCycles = [1,1,1];
759 def: InstRW<[BWWriteResGroup24], (instregex "MOVBE(16|32|64)mr")>;
761 def BWWriteResGroup25 : SchedWriteRes<[BWPort4,BWPort237,BWPort0156]> {
762   let Latency = 2;
763   let NumMicroOps = 3;
764   let ReleaseAtCycles = [1,1,1];
766 def: InstRW<[BWWriteResGroup25], (instrs PUSH16r, PUSH32r, PUSH64r, PUSH64i8,
767                                          STOSB, STOSL, STOSQ, STOSW)>;
768 def: InstRW<[BWWriteResGroup25], (instregex "PUSH(16|32|64)rmr")>;
770 def BWWriteResGroup27 : SchedWriteRes<[BWPort1]> {
771   let Latency = 3;
772   let NumMicroOps = 1;
773   let ReleaseAtCycles = [1];
775 def: InstRW<[BWWriteResGroup27], (instregex "P(DEP|EXT)(32|64)rr")>;
777 def BWWriteResGroup28 : SchedWriteRes<[BWPort5]> {
778   let Latency = 3;
779   let NumMicroOps = 1;
780   let ReleaseAtCycles = [1];
782 def: InstRW<[BWWriteResGroup28], (instrs VPBROADCASTBrr,
783                                          VPBROADCASTWrr)>;
785 def BWWriteResGroup33 : SchedWriteRes<[BWPort5]> {
786   let Latency = 3;
787   let NumMicroOps = 2;
788   let ReleaseAtCycles = [2];
790 def: InstRW<[BWWriteResGroup33], (instrs MMX_PACKSSDWrr,
791                                          MMX_PACKSSWBrr,
792                                          MMX_PACKUSWBrr)>;
794 def BWWriteResGroup34 : SchedWriteRes<[BWPort6,BWPort0156]> {
795   let Latency = 3;
796   let NumMicroOps = 3;
797   let ReleaseAtCycles = [1,2];
799 def: InstRW<[BWWriteResGroup34], (instregex "CLD")>;
801 def BWWriteResGroup35 : SchedWriteRes<[BWPort06,BWPort0156]> {
802   let Latency = 2;
803   let NumMicroOps = 3;
804   let ReleaseAtCycles = [1,2];
806 def: InstRW<[BWWriteResGroup35], (instrs RCL8r1, RCL16r1, RCL32r1, RCL64r1,
807                                          RCR8r1, RCR16r1, RCR32r1, RCR64r1)>;
809 def BWWriteResGroup36 : SchedWriteRes<[BWPort1,BWPort06,BWPort0156]> {
810   let Latency = 5;
811   let NumMicroOps = 8;
812   let ReleaseAtCycles = [2,4,2];
814 def: InstRW<[BWWriteResGroup36], (instrs RCR8ri, RCR16ri, RCR32ri, RCR64ri)>;
816 def BWWriteResGroup36b : SchedWriteRes<[BWPort1,BWPort06,BWPort0156]> {
817   let Latency = 6;
818   let NumMicroOps = 8;
819   let ReleaseAtCycles = [2,4,2];
821 def: InstRW<[BWWriteResGroup36b], (instrs RCL8ri, RCL16ri, RCL32ri, RCL64ri)>;
823 def BWWriteResGroup37 : SchedWriteRes<[BWPort4,BWPort6,BWPort237,BWPort0156]> {
824   let Latency = 3;
825   let NumMicroOps = 4;
826   let ReleaseAtCycles = [1,1,1,1];
828 def: InstRW<[BWWriteResGroup37], (instregex "CALL(16|32|64)r")>;
830 def BWWriteResGroup38 : SchedWriteRes<[BWPort4,BWPort237,BWPort06,BWPort0156]> {
831   let Latency = 3;
832   let NumMicroOps = 4;
833   let ReleaseAtCycles = [1,1,1,1];
835 def: InstRW<[BWWriteResGroup38], (instrs CALL64pcrel32)>;
838 def BWWriteResGroup41 : SchedWriteRes<[BWPort0,BWPort0156]> {
839   let Latency = 4;
840   let NumMicroOps = 2;
841   let ReleaseAtCycles = [1,1];
843 def: InstRW<[BWWriteResGroup41], (instrs FNSTSW16r)>;
845 def BWWriteResGroup42 : SchedWriteRes<[BWPort1,BWPort5]> {
846   let Latency = 4;
847   let NumMicroOps = 2;
848   let ReleaseAtCycles = [1,1];
850 def: InstRW<[BWWriteResGroup42], (instregex "MMX_CVT(T?)PS2PIrr")>;
852 def BWWriteResGroup43 : SchedWriteRes<[BWPort0,BWPort4,BWPort237]> {
853   let Latency = 4;
854   let NumMicroOps = 3;
855   let ReleaseAtCycles = [1,1,1];
857 def: InstRW<[BWWriteResGroup43], (instrs FNSTSWm)>;
859 def BWWriteResGroup44 : SchedWriteRes<[BWPort1,BWPort4,BWPort237]> {
860   let Latency = 4;
861   let NumMicroOps = 3;
862   let ReleaseAtCycles = [1,1,1];
864 def: InstRW<[BWWriteResGroup44], (instregex "IST(T?)_FP(16|32|64)m",
865                                             "IST_F(16|32)m")>;
867 def BWWriteResGroup45 : SchedWriteRes<[BWPort0156]> {
868   let Latency = 4;
869   let NumMicroOps = 4;
870   let ReleaseAtCycles = [4];
872 def: InstRW<[BWWriteResGroup45], (instrs FNCLEX)>;
874 def BWWriteResGroup46 : SchedWriteRes<[]> {
875   let Latency = 0;
876   let NumMicroOps = 4;
877   let ReleaseAtCycles = [];
879 def: InstRW<[BWWriteResGroup46], (instrs VZEROUPPER)>;
881 def BWWriteResGroup47 : SchedWriteRes<[BWPort0]> {
882   let Latency = 5;
883   let NumMicroOps = 1;
884   let ReleaseAtCycles = [1];
886 def: InstRW<[BWWriteResGroup47], (instregex "MUL_(FPrST0|FST0r|FrST0)")>;
888 def BWWriteResGroup49 : SchedWriteRes<[BWPort23]> {
889   let Latency = 5;
890   let NumMicroOps = 1;
891   let ReleaseAtCycles = [1];
893 def: InstRW<[BWWriteResGroup49], (instrs VBROADCASTSSrm,
894                                          VMOVDDUPrm, MOVDDUPrm,
895                                          VMOVSHDUPrm, MOVSHDUPrm,
896                                          VMOVSLDUPrm, MOVSLDUPrm,
897                                          VPBROADCASTDrm,
898                                          VPBROADCASTQrm)>;
900 def BWWriteResGroup50 : SchedWriteRes<[BWPort1,BWPort5]> {
901   let Latency = 5;
902   let NumMicroOps = 3;
903   let ReleaseAtCycles = [1,2];
905 def: InstRW<[BWWriteResGroup50], (instregex "(V?)CVTSI642SSrr")>;
907 def BWWriteResGroup51 : SchedWriteRes<[BWPort1,BWPort6,BWPort06]> {
908   let Latency = 5;
909   let NumMicroOps = 3;
910   let ReleaseAtCycles = [1,1,1];
912 def: InstRW<[BWWriteResGroup51], (instregex "STR(16|32|64)r")>;
914 def BWWriteResGroup54 : SchedWriteRes<[BWPort6,BWPort0156]> {
915   let Latency = 5;
916   let NumMicroOps = 5;
917   let ReleaseAtCycles = [1,4];
919 def: InstRW<[BWWriteResGroup54], (instrs PAUSE)>;
921 def BWWriteResGroup55 : SchedWriteRes<[BWPort06,BWPort0156]> {
922   let Latency = 5;
923   let NumMicroOps = 5;
924   let ReleaseAtCycles = [1,4];
926 def: InstRW<[BWWriteResGroup55], (instrs XSETBV)>;
928 def BWWriteResGroup57 : SchedWriteRes<[BWPort4,BWPort237,BWPort0156]> {
929   let Latency = 5;
930   let NumMicroOps = 6;
931   let ReleaseAtCycles = [1,1,4];
933 def: InstRW<[BWWriteResGroup57], (instregex "PUSHF(16|64)")>;
935 def BWWriteResGroup58 : SchedWriteRes<[BWPort23]> {
936   let Latency = 6;
937   let NumMicroOps = 1;
938   let ReleaseAtCycles = [1];
940 def: InstRW<[BWWriteResGroup58], (instregex "LD_F(32|64|80)m")>;
941 def: InstRW<[BWWriteResGroup58], (instrs VBROADCASTF128rm,
942                                          VBROADCASTI128rm,
943                                          VBROADCASTSDYrm,
944                                          VBROADCASTSSYrm,
945                                          VMOVDDUPYrm,
946                                          VMOVSHDUPYrm,
947                                          VMOVSLDUPYrm,
948                                          VPBROADCASTDYrm,
949                                          VPBROADCASTQYrm)>;
951 def BWWriteResGroup59 : SchedWriteRes<[BWPort0,BWPort23]> {
952   let Latency = 6;
953   let NumMicroOps = 2;
954   let ReleaseAtCycles = [1,1];
956 def: InstRW<[BWWriteResGroup59], (instrs VPSLLVQrm, VPSRLVQrm)>;
958 def BWWriteResGroup62 : SchedWriteRes<[BWPort6,BWPort23]> {
959   let Latency = 6;
960   let NumMicroOps = 2;
961   let ReleaseAtCycles = [1,1];
963 def: InstRW<[BWWriteResGroup62], (instrs FARJMP64m)>;
964 def: InstRW<[BWWriteResGroup62], (instregex "JMP(16|32|64)m")>;
966 def BWWriteResGroup64 : SchedWriteRes<[BWPort23,BWPort15]> {
967   let Latency = 6;
968   let NumMicroOps = 2;
969   let ReleaseAtCycles = [1,1];
971 def: InstRW<[BWWriteResGroup64], (instregex "ANDN(32|64)rm",
972                                             "MOVBE(16|32|64)rm")>;
974 def BWWriteResGroup65 : SchedWriteRes<[BWPort23,BWPort015]> {
975   let Latency = 6;
976   let NumMicroOps = 2;
977   let ReleaseAtCycles = [1,1];
979 def: InstRW<[BWWriteResGroup65], (instrs VINSERTF128rmi,
980                                          VINSERTI128rmi,
981                                          VPBLENDDrmi)>;
983 def BWWriteResGroup66 : SchedWriteRes<[BWPort23,BWPort0156]> {
984   let Latency = 6;
985   let NumMicroOps = 2;
986   let ReleaseAtCycles = [1,1];
988 def: InstRW<[BWWriteResGroup66], (instrs POP16r, POP32r, POP64r)>;
989 def: InstRW<[BWWriteResGroup66], (instregex "POP(16|32|64)rmr")>;
991 def BWWriteResGroup68 : SchedWriteRes<[BWPort1,BWPort6,BWPort06,BWPort0156]> {
992   let Latency = 6;
993   let NumMicroOps = 4;
994   let ReleaseAtCycles = [1,1,1,1];
996 def: InstRW<[BWWriteResGroup68], (instregex "SLDT(16|32|64)r")>;
998 def BWWriteResGroup69 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort06]> {
999   let Latency = 6;
1000   let NumMicroOps = 4;
1001   let ReleaseAtCycles = [1,1,1,1];
1003 def: InstRW<[BWWriteResGroup69], (instregex "SAR(8|16|32|64)m(1|i)",
1004                                             "SHL(8|16|32|64)m(1|i)",
1005                                             "SHR(8|16|32|64)m(1|i)")>;
1007 def BWWriteResGroup70 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort0156]> {
1008   let Latency = 6;
1009   let NumMicroOps = 4;
1010   let ReleaseAtCycles = [1,1,1,1];
1012 def: InstRW<[BWWriteResGroup70], (instregex "POP(16|32|64)rmm",
1013                                             "PUSH(16|32|64)rmm")>;
1015 def BWWriteResGroup71 : SchedWriteRes<[BWPort6,BWPort0156]> {
1016   let Latency = 6;
1017   let NumMicroOps = 6;
1018   let ReleaseAtCycles = [1,5];
1020 def: InstRW<[BWWriteResGroup71], (instrs STD)>;
1022 def BWWriteResGroup73 : SchedWriteRes<[BWPort0,BWPort23]> {
1023   let Latency = 7;
1024   let NumMicroOps = 2;
1025   let ReleaseAtCycles = [1,1];
1027 def: InstRW<[BWWriteResGroup73], (instrs VPSLLVQYrm,
1028                                          VPSRLVQYrm)>;
1030 def BWWriteResGroup74 : SchedWriteRes<[BWPort1,BWPort23]> {
1031   let Latency = 7;
1032   let NumMicroOps = 2;
1033   let ReleaseAtCycles = [1,1];
1035 def: InstRW<[BWWriteResGroup74], (instregex "FCOM(P?)(32|64)m")>;
1037 def BWWriteResGroup77 : SchedWriteRes<[BWPort23,BWPort015]> {
1038   let Latency = 7;
1039   let NumMicroOps = 2;
1040   let ReleaseAtCycles = [1,1];
1042 def: InstRW<[BWWriteResGroup77], (instrs VPBLENDDYrmi)>;
1044 def BWWriteResGroup79 : SchedWriteRes<[BWPort5,BWPort23]> {
1045   let Latency = 7;
1046   let NumMicroOps = 3;
1047   let ReleaseAtCycles = [2,1];
1049 def: InstRW<[BWWriteResGroup79], (instrs MMX_PACKSSDWrm,
1050                                          MMX_PACKSSWBrm,
1051                                          MMX_PACKUSWBrm)>;
1053 def BWWriteResGroup80 : SchedWriteRes<[BWPort23,BWPort0156]> {
1054   let Latency = 7;
1055   let NumMicroOps = 3;
1056   let ReleaseAtCycles = [1,2];
1058 def: InstRW<[BWWriteResGroup80], (instrs LEAVE, LEAVE64,
1059                                          SCASB, SCASL, SCASQ, SCASW)>;
1061 def BWWriteResGroup82 : SchedWriteRes<[BWPort0,BWPort01,BWPort23]> {
1062   let Latency = 7;
1063   let NumMicroOps = 3;
1064   let ReleaseAtCycles = [1,1,1];
1066 def: InstRW<[BWWriteResGroup82], (instrs FLDCW16m)>;
1068 def BWWriteResGroup84 : SchedWriteRes<[BWPort6,BWPort23,BWPort0156]> {
1069   let Latency = 7;
1070   let NumMicroOps = 3;
1071   let ReleaseAtCycles = [1,1,1];
1073 def: InstRW<[BWWriteResGroup84], (instrs LRET64, RET64)>;
1075 def BWWriteResGroup87 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort06]> {
1076   let Latency = 7;
1077   let NumMicroOps = 5;
1078   let ReleaseAtCycles = [1,1,1,2];
1080 def: InstRW<[BWWriteResGroup87], (instregex "ROL(8|16|32|64)m(1|i)",
1081                                             "ROR(8|16|32|64)m(1|i)")>;
1083 def BWWriteResGroup87_1 : SchedWriteRes<[BWPort06]> {
1084   let Latency = 2;
1085   let NumMicroOps = 2;
1086   let ReleaseAtCycles = [2];
1088 def: InstRW<[BWWriteResGroup87_1], (instrs ROL8r1, ROL16r1, ROL32r1, ROL64r1,
1089                                            ROR8r1, ROR16r1, ROR32r1, ROR64r1)>;
1091 def BWWriteResGroup88 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort0156]> {
1092   let Latency = 7;
1093   let NumMicroOps = 5;
1094   let ReleaseAtCycles = [1,1,1,2];
1096 def: InstRW<[BWWriteResGroup88], (instregex "XADD(8|16|32|64)rm")>;
1098 def BWWriteResGroup89 : SchedWriteRes<[BWPort4,BWPort6,BWPort23,BWPort237,BWPort0156]> {
1099   let Latency = 7;
1100   let NumMicroOps = 5;
1101   let ReleaseAtCycles = [1,1,1,1,1];
1103 def: InstRW<[BWWriteResGroup89], (instregex "CALL(16|32|64)m")>;
1104 def: InstRW<[BWWriteResGroup89], (instrs FARCALL64m)>;
1106 def BWWriteResGroup90 : SchedWriteRes<[BWPort6,BWPort06,BWPort15,BWPort0156]> {
1107   let Latency = 7;
1108   let NumMicroOps = 7;
1109   let ReleaseAtCycles = [2,2,1,2];
1111 def: InstRW<[BWWriteResGroup90], (instrs LOOP)>;
1113 def BWWriteResGroup91 : SchedWriteRes<[BWPort1,BWPort23]> {
1114   let Latency = 8;
1115   let NumMicroOps = 2;
1116   let ReleaseAtCycles = [1,1];
1118 def: InstRW<[BWWriteResGroup91], (instregex "P(DEP|EXT)(32|64)rm")>;
1120 def BWWriteResGroup92 : SchedWriteRes<[BWPort5,BWPort23]> {
1121   let Latency = 8;
1122   let NumMicroOps = 2;
1123   let ReleaseAtCycles = [1,1];
1125 def: InstRW<[BWWriteResGroup92], (instrs VPMOVSXBDYrm,
1126                                          VPMOVSXBQYrm,
1127                                          VPMOVSXBWYrm,
1128                                          VPMOVSXDQYrm,
1129                                          VPMOVSXWDYrm,
1130                                          VPMOVSXWQYrm,
1131                                          VPMOVZXWDYrm)>;
1133 def BWWriteResGroup97 : SchedWriteRes<[BWPort23,BWPort237,BWPort06,BWPort0156]> {
1134   let Latency = 8;
1135   let NumMicroOps = 5;
1136   let ReleaseAtCycles = [1,1,1,2];
1138 def: InstRW<[BWWriteResGroup97], (instregex "RCL(8|16|32|64)m(1|i)",
1139                                             "RCR(8|16|32|64)m(1|i)")>;
1141 def BWWriteResGroup99 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort0156]> {
1142   let Latency = 8;
1143   let NumMicroOps = 6;
1144   let ReleaseAtCycles = [1,1,1,3];
1146 def: InstRW<[BWWriteResGroup99], (instregex "XCHG(8|16|32|64)rm")>;
1148 def BWWriteResGroup100 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort06,BWPort0156]> {
1149   let Latency = 8;
1150   let NumMicroOps = 6;
1151   let ReleaseAtCycles = [1,1,1,2,1];
1153 def : SchedAlias<WriteADCRMW, BWWriteResGroup100>;
1154 def: InstRW<[BWWriteResGroup100], (instregex "ROL(8|16|32|64)mCL",
1155                                              "ROR(8|16|32|64)mCL",
1156                                              "SAR(8|16|32|64)mCL",
1157                                              "SHL(8|16|32|64)mCL",
1158                                              "SHR(8|16|32|64)mCL")>;
1160 def BWWriteResGroup101 : SchedWriteRes<[BWPort1,BWPort23]> {
1161   let Latency = 9;
1162   let NumMicroOps = 2;
1163   let ReleaseAtCycles = [1,1];
1165 def: InstRW<[BWWriteResGroup101], (instregex "(ADD|SUB|SUBR)_F(32|64)m",
1166                                              "ILD_F(16|32|64)m")>;
1168 def BWWriteResGroup108 : SchedWriteRes<[BWPort5,BWPort23,BWPort015]> {
1169   let Latency = 9;
1170   let NumMicroOps = 3;
1171   let ReleaseAtCycles = [1,1,1];
1173 def: InstRW<[BWWriteResGroup108], (instregex "VPBROADCASTB(Y?)rm",
1174                                              "VPBROADCASTW(Y?)rm")>;
1176 def BWWriteResGroup112 : SchedWriteRes<[BWPort23,BWPort06,BWPort0156]> {
1177   let Latency = 9;
1178   let NumMicroOps = 5;
1179   let ReleaseAtCycles = [1,1,3];
1181 def: InstRW<[BWWriteResGroup112], (instrs RDRAND16r, RDRAND32r, RDRAND64r)>;
1183 def BWWriteResGroup113 : SchedWriteRes<[BWPort1,BWPort6,BWPort23,BWPort0156]> {
1184   let Latency = 9;
1185   let NumMicroOps = 5;
1186   let ReleaseAtCycles = [1,2,1,1];
1188 def: InstRW<[BWWriteResGroup113], (instregex "LAR(16|32|64)rm",
1189                                              "LSL(16|32|64)rm")>;
1191 def BWWriteResGroup115 : SchedWriteRes<[BWPort0,BWPort23]> {
1192   let Latency = 10;
1193   let NumMicroOps = 2;
1194   let ReleaseAtCycles = [1,1];
1196 def: InstRW<[BWWriteResGroup115], (instregex "(V?)PCMPGTQrm")>;
1198 def BWWriteResGroup117 : SchedWriteRes<[BWPort1,BWPort23]> {
1199   let Latency = 10;
1200   let NumMicroOps = 3;
1201   let ReleaseAtCycles = [2,1];
1203 def: InstRW<[BWWriteResGroup117], (instregex "FICOM(P?)(16|32)m")>;
1205 def BWWriteResGroup122_1 : SchedWriteRes<[BWPort0,BWFPDivider]> {
1206   let Latency = 11;
1207   let NumMicroOps = 1;
1208   let ReleaseAtCycles = [1,3]; // Really 2.5 cycle throughput
1210 def : SchedAlias<WriteFDiv, BWWriteResGroup122_1>; // TODO - convert to ZnWriteResFpuPair
1212 def BWWriteResGroup123 : SchedWriteRes<[BWPort0,BWPort23]> {
1213   let Latency = 11;
1214   let NumMicroOps = 2;
1215   let ReleaseAtCycles = [1,1];
1217 def: InstRW<[BWWriteResGroup123], (instregex "MUL_F(32|64)m")>;
1218 def: InstRW<[BWWriteResGroup123], (instrs VPCMPGTQYrm)>;
1220 def BWWriteResGroup131 : SchedWriteRes<[BWPort1,BWPort06,BWPort0156]> {
1221   let Latency = 11;
1222   let NumMicroOps = 7;
1223   let ReleaseAtCycles = [2,2,3];
1225 def: InstRW<[BWWriteResGroup131], (instregex "RCL(16|32|64)rCL",
1226                                              "RCR(16|32|64)rCL")>;
1228 def BWWriteResGroup132 : SchedWriteRes<[BWPort1,BWPort06,BWPort15,BWPort0156]> {
1229   let Latency = 11;
1230   let NumMicroOps = 9;
1231   let ReleaseAtCycles = [1,4,1,3];
1233 def: InstRW<[BWWriteResGroup132], (instrs RCL8rCL)>;
1235 def BWWriteResGroup133 : SchedWriteRes<[BWPort06,BWPort0156]> {
1236   let Latency = 11;
1237   let NumMicroOps = 11;
1238   let ReleaseAtCycles = [2,9];
1240 def: InstRW<[BWWriteResGroup133], (instrs LOOPE)>;
1241 def: InstRW<[BWWriteResGroup133], (instrs LOOPNE)>;
1243 def BWWriteResGroup135 : SchedWriteRes<[BWPort1,BWPort23]> {
1244   let Latency = 12;
1245   let NumMicroOps = 3;
1246   let ReleaseAtCycles = [2,1];
1248 def: InstRW<[BWWriteResGroup135], (instregex "(ADD|SUB|SUBR)_FI(16|32)m")>;
1250 def BWWriteResGroup139_1 : SchedWriteRes<[BWPort0,BWFPDivider]> {
1251   let Latency = 14;
1252   let NumMicroOps = 1;
1253   let ReleaseAtCycles = [1,4];
1255 def : SchedAlias<WriteFDiv64, BWWriteResGroup139_1>; // TODO - convert to ZnWriteResFpuPair
1257 def BWWriteResGroup141 : SchedWriteRes<[BWPort0,BWPort1,BWPort23]> {
1258   let Latency = 14;
1259   let NumMicroOps = 3;
1260   let ReleaseAtCycles = [1,1,1];
1262 def: InstRW<[BWWriteResGroup141], (instregex "MUL_FI(16|32)m")>;
1264 def BWWriteResGroup144 : SchedWriteRes<[BWPort1,BWPort6,BWPort23,BWPort0156]> {
1265   let Latency = 14;
1266   let NumMicroOps = 8;
1267   let ReleaseAtCycles = [2,2,1,3];
1269 def: InstRW<[BWWriteResGroup144], (instregex "LAR(16|32|64)rr")>;
1271 def BWWriteResGroup145 : SchedWriteRes<[BWPort1,BWPort06,BWPort15,BWPort0156]> {
1272   let Latency = 14;
1273   let NumMicroOps = 10;
1274   let ReleaseAtCycles = [2,3,1,4];
1276 def: InstRW<[BWWriteResGroup145], (instrs RCR8rCL)>;
1278 def BWWriteResGroup146 : SchedWriteRes<[BWPort0,BWPort1,BWPort6,BWPort0156]> {
1279   let Latency = 14;
1280   let NumMicroOps = 12;
1281   let ReleaseAtCycles = [2,1,4,5];
1283 def: InstRW<[BWWriteResGroup146], (instrs XCH_F)>;
1285 def BWWriteResGroup147 : SchedWriteRes<[BWPort0]> {
1286   let Latency = 15;
1287   let NumMicroOps = 1;
1288   let ReleaseAtCycles = [1];
1290 def: InstRW<[BWWriteResGroup147], (instregex "DIVR_(FPrST0|FST0r|FrST0)")>;
1292 def BWWriteResGroup149 : SchedWriteRes<[BWPort1,BWPort23,BWPort237,BWPort06,BWPort15,BWPort0156]> {
1293   let Latency = 15;
1294   let NumMicroOps = 10;
1295   let ReleaseAtCycles = [1,1,1,4,1,2];
1297 def: InstRW<[BWWriteResGroup149], (instregex "RCL(8|16|32|64)mCL")>;
1299 def BWWriteResGroup150 : SchedWriteRes<[BWPort0,BWPort23,BWFPDivider]> {
1300   let Latency = 16;
1301   let NumMicroOps = 2;
1302   let ReleaseAtCycles = [1,1,5];
1304 def : SchedAlias<WriteFDivLd, BWWriteResGroup150>; // TODO - convert to ZnWriteResFpuPair
1306 def BWWriteResGroup153 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort06,BWPort15,BWPort0156]> {
1307   let Latency = 16;
1308   let NumMicroOps = 14;
1309   let ReleaseAtCycles = [1,1,1,4,2,5];
1311 def: InstRW<[BWWriteResGroup153], (instrs CMPXCHG8B)>;
1313 def BWWriteResGroup154 : SchedWriteRes<[BWPort5,BWPort6]> {
1314   let Latency = 8;
1315   let NumMicroOps = 20;
1316   let ReleaseAtCycles = [1,1];
1318 def: InstRW<[BWWriteResGroup154], (instrs VZEROALL)>;
1320 def BWWriteResGroup159 : SchedWriteRes<[BWPort5,BWPort6,BWPort06,BWPort0156]> {
1321   let Latency = 18;
1322   let NumMicroOps = 8;
1323   let ReleaseAtCycles = [1,1,1,5];
1325 def: InstRW<[BWWriteResGroup159], (instrs CPUID)>;
1326 def: InstRW<[BWWriteResGroup159], (instrs RDTSC)>;
1328 def BWWriteResGroup160 : SchedWriteRes<[BWPort1,BWPort23,BWPort237,BWPort06,BWPort15,BWPort0156]> {
1329   let Latency = 18;
1330   let NumMicroOps = 11;
1331   let ReleaseAtCycles = [2,1,1,3,1,3];
1333 def: InstRW<[BWWriteResGroup160], (instregex "RCR(8|16|32|64)mCL")>;
1335 def BWWriteResGroup161 : SchedWriteRes<[BWPort0,BWPort23,BWFPDivider]> {
1336   let Latency = 19;
1337   let NumMicroOps = 2;
1338   let ReleaseAtCycles = [1,1,8];
1340 def : SchedAlias<WriteFDiv64Ld, BWWriteResGroup161>; // TODO - convert to ZnWriteResFpuPair
1342 def BWWriteResGroup165 : SchedWriteRes<[BWPort0]> {
1343   let Latency = 20;
1344   let NumMicroOps = 1;
1345   let ReleaseAtCycles = [1];
1347 def: InstRW<[BWWriteResGroup165], (instregex "DIV_(FPrST0|FST0r|FrST0)")>;
1349 def BWWriteResGroup167 : SchedWriteRes<[BWPort4,BWPort5,BWPort6,BWPort23,BWPort237,BWPort06,BWPort0156]> {
1350   let Latency = 20;
1351   let NumMicroOps = 8;
1352   let ReleaseAtCycles = [1,1,1,1,1,1,2];
1354 def: InstRW<[BWWriteResGroup167], (instrs INSB, INSL, INSW)>;
1356 def BWWriteResGroup169 : SchedWriteRes<[BWPort0,BWPort23]> {
1357   let Latency = 21;
1358   let NumMicroOps = 2;
1359   let ReleaseAtCycles = [1,1];
1361 def: InstRW<[BWWriteResGroup169], (instregex "DIV_F(32|64)m")>;
1363 def BWWriteResGroup171 : SchedWriteRes<[BWPort0,BWPort4,BWPort5,BWPort23,BWPort237,BWPort06,BWPort0156]> {
1364   let Latency = 21;
1365   let NumMicroOps = 19;
1366   let ReleaseAtCycles = [2,1,4,1,1,4,6];
1368 def: InstRW<[BWWriteResGroup171], (instrs CMPXCHG16B)>;
1370 def BWWriteResGroup172 : SchedWriteRes<[BWPort6,BWPort23,BWPort0156]> {
1371   let Latency = 22;
1372   let NumMicroOps = 18;
1373   let ReleaseAtCycles = [1,1,16];
1375 def: InstRW<[BWWriteResGroup172], (instrs POPF64)>;
1377 def BWWriteResGroup176 : SchedWriteRes<[BWPort6,BWPort23,BWPort0156]> {
1378   let Latency = 23;
1379   let NumMicroOps = 19;
1380   let ReleaseAtCycles = [3,1,15];
1382 def: InstRW<[BWWriteResGroup176], (instregex "XRSTOR(64)?")>;
1384 def BWWriteResGroup177 : SchedWriteRes<[BWPort0,BWPort1,BWPort23]> {
1385   let Latency = 24;
1386   let NumMicroOps = 3;
1387   let ReleaseAtCycles = [1,1,1];
1389 def: InstRW<[BWWriteResGroup177], (instregex "DIV_FI(16|32)m")>;
1391 def BWWriteResGroup180 : SchedWriteRes<[BWPort0,BWPort23]> {
1392   let Latency = 26;
1393   let NumMicroOps = 2;
1394   let ReleaseAtCycles = [1,1];
1396 def: InstRW<[BWWriteResGroup180], (instregex "DIVR_F(32|64)m")>;
1398 def BWWriteResGroup182 : SchedWriteRes<[BWPort0,BWPort1,BWPort23]> {
1399   let Latency = 29;
1400   let NumMicroOps = 3;
1401   let ReleaseAtCycles = [1,1,1];
1403 def: InstRW<[BWWriteResGroup182], (instregex "DIVR_FI(16|32)m")>;
1405 def BWWriteResGroup183_1 : SchedWriteRes<[BWPort4, BWPort5, BWPort23, BWPort0156]> {
1406   let Latency = 17;
1407   let NumMicroOps = 7;
1408   let ReleaseAtCycles = [1,3,2,1];
1410 def: InstRW<[BWWriteResGroup183_1], (instrs VGATHERDPDrm, VPGATHERDQrm,
1411                                             VGATHERQPDrm, VPGATHERQQrm)>;
1413 def BWWriteResGroup183_2 : SchedWriteRes<[BWPort4, BWPort5, BWPort23, BWPort0156]> {
1414   let Latency = 18;
1415   let NumMicroOps = 9;
1416   let ReleaseAtCycles = [1,3,4,1];
1418 def: InstRW<[BWWriteResGroup183_2], (instrs VGATHERDPDYrm, VPGATHERDQYrm,
1419                                             VGATHERQPDYrm, VPGATHERQQYrm)>;
1421 def BWWriteResGroup183_3 : SchedWriteRes<[BWPort4, BWPort5, BWPort23, BWPort0156]> {
1422   let Latency = 19;
1423   let NumMicroOps = 9;
1424   let ReleaseAtCycles = [1,5,2,1];
1426 def: InstRW<[BWWriteResGroup183_3], (instrs VGATHERQPSrm, VPGATHERQDrm)>;
1428 def BWWriteResGroup183_4 : SchedWriteRes<[BWPort4, BWPort5, BWPort23, BWPort0156]> {
1429   let Latency = 19;
1430   let NumMicroOps = 10;
1431   let ReleaseAtCycles = [1,4,4,1];
1433 def: InstRW<[BWWriteResGroup183_4], (instrs VGATHERDPSrm, VPGATHERDDrm,
1434                                             VGATHERQPSYrm, VPGATHERQDYrm)>;
1436 def BWWriteResGroup183_5 : SchedWriteRes<[BWPort4, BWPort5, BWPort23, BWPort0156]> {
1437   let Latency = 21;
1438   let NumMicroOps = 14;
1439   let ReleaseAtCycles = [1,4,8,1];
1441 def: InstRW<[BWWriteResGroup183_5], (instrs VGATHERDPSYrm, VPGATHERDDYrm)>;
1443 def BWWriteResGroup185 : SchedWriteRes<[BWPort4,BWPort6,BWPort23,BWPort237,BWPort0156]> {
1444   let Latency = 29;
1445   let NumMicroOps = 27;
1446   let ReleaseAtCycles = [1,5,1,1,19];
1448 def: InstRW<[BWWriteResGroup185], (instrs XSAVE64)>;
1450 def BWWriteResGroup186 : SchedWriteRes<[BWPort4,BWPort6,BWPort23,BWPort237,BWPort0156]> {
1451   let Latency = 30;
1452   let NumMicroOps = 28;
1453   let ReleaseAtCycles = [1,6,1,1,19];
1455 def: InstRW<[BWWriteResGroup186], (instrs XSAVE)>;
1456 def: InstRW<[BWWriteResGroup186], (instregex "XSAVEC", "XSAVES", "XSAVEOPT")>;
1458 def BWWriteResGroup191 : SchedWriteRes<[BWPort5,BWPort6,BWPort23,BWPort06,BWPort0156]> {
1459   let Latency = 34;
1460   let NumMicroOps = 23;
1461   let ReleaseAtCycles = [1,5,3,4,10];
1463 def: InstRW<[BWWriteResGroup191], (instregex "IN(8|16|32)ri",
1464                                              "IN(8|16|32)rr")>;
1466 def BWWriteResGroup194 : SchedWriteRes<[BWPort5,BWPort6,BWPort23,BWPort237,BWPort06,BWPort0156]> {
1467   let Latency = 35;
1468   let NumMicroOps = 23;
1469   let ReleaseAtCycles = [1,5,2,1,4,10];
1471 def: InstRW<[BWWriteResGroup194], (instregex "OUT(8|16|32)ir",
1472                                              "OUT(8|16|32)rr")>;
1474 def BWWriteResGroup196 : SchedWriteRes<[BWPort5,BWPort0156]> {
1475   let Latency = 42;
1476   let NumMicroOps = 22;
1477   let ReleaseAtCycles = [2,20];
1479 def: InstRW<[BWWriteResGroup196], (instrs RDTSCP)>;
1481 def BWWriteResGroup197 : SchedWriteRes<[BWPort0,BWPort01,BWPort23,BWPort05,BWPort06,BWPort015,BWPort0156]> {
1482   let Latency = 60;
1483   let NumMicroOps = 64;
1484   let ReleaseAtCycles = [2,2,8,1,10,2,39];
1486 def: InstRW<[BWWriteResGroup197], (instrs FLDENVm)>;
1488 def BWWriteResGroup198 : SchedWriteRes<[BWPort0,BWPort6,BWPort23,BWPort05,BWPort06,BWPort15,BWPort0156]> {
1489   let Latency = 63;
1490   let NumMicroOps = 88;
1491   let ReleaseAtCycles = [4,4,31,1,2,1,45];
1493 def: InstRW<[BWWriteResGroup198], (instrs FXRSTOR64)>;
1495 def BWWriteResGroup199 : SchedWriteRes<[BWPort0,BWPort6,BWPort23,BWPort05,BWPort06,BWPort15,BWPort0156]> {
1496   let Latency = 63;
1497   let NumMicroOps = 90;
1498   let ReleaseAtCycles = [4,2,33,1,2,1,47];
1500 def: InstRW<[BWWriteResGroup199], (instrs FXRSTOR)>;
1502 def BWWriteResGroup200 : SchedWriteRes<[BWPort5,BWPort01,BWPort0156]> {
1503   let Latency = 75;
1504   let NumMicroOps = 15;
1505   let ReleaseAtCycles = [6,3,6];
1507 def: InstRW<[BWWriteResGroup200], (instrs FNINIT)>;
1509 def BWWriteResGroup202 : SchedWriteRes<[BWPort0,BWPort1,BWPort4,BWPort5,BWPort6,BWPort237,BWPort06,BWPort0156]> {
1510   let Latency = 115;
1511   let NumMicroOps = 100;
1512   let ReleaseAtCycles = [9,9,11,8,1,11,21,30];
1514 def: InstRW<[BWWriteResGroup202], (instrs FSTENVm)>;
1516 def: InstRW<[WriteZero], (instrs CLC)>;
1519 // Instruction variants handled by the renamer. These might not need execution
1520 // ports in certain conditions.
1521 // See Agner's Fog "The microarchitecture of Intel, AMD and VIA CPUs",
1522 // section "Haswell and Broadwell Pipeline" > "Register allocation and
1523 // renaming".
1524 // These can be investigated with llvm-exegesis, e.g.
1525 // echo 'pxor %mm0, %mm0' | /tmp/llvm-exegesis -mode=uops -snippets-file=-
1526 // echo 'vxorpd %xmm0, %xmm0, %xmm1' | /tmp/llvm-exegesis -mode=uops -snippets-file=-
1528 def BWWriteZeroLatency : SchedWriteRes<[]> {
1529   let Latency = 0;
1532 def BWWriteZeroIdiom : SchedWriteVariant<[
1533     SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
1534     SchedVar<NoSchedPred,                          [WriteALU]>
1536 def : InstRW<[BWWriteZeroIdiom], (instrs SUB32rr, SUB64rr,
1537                                          XOR32rr, XOR64rr)>;
1539 def BWWriteFZeroIdiom : SchedWriteVariant<[
1540     SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
1541     SchedVar<NoSchedPred,                          [WriteFLogic]>
1543 def : InstRW<[BWWriteFZeroIdiom], (instrs XORPSrr, VXORPSrr, XORPDrr,
1544                                           VXORPDrr)>;
1546 def BWWriteFZeroIdiomY : SchedWriteVariant<[
1547     SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
1548     SchedVar<NoSchedPred,                          [WriteFLogicY]>
1550 def : InstRW<[BWWriteFZeroIdiomY], (instrs VXORPSYrr, VXORPDYrr)>;
1552 def BWWriteVZeroIdiomLogicX : SchedWriteVariant<[
1553     SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
1554     SchedVar<NoSchedPred,                          [WriteVecLogicX]>
1556 def : InstRW<[BWWriteVZeroIdiomLogicX], (instrs PXORrr, VPXORrr)>;
1558 def BWWriteVZeroIdiomLogicY : SchedWriteVariant<[
1559     SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
1560     SchedVar<NoSchedPred,                          [WriteVecLogicY]>
1562 def : InstRW<[BWWriteVZeroIdiomLogicY], (instrs VPXORYrr)>;
1564 def BWWriteVZeroIdiomALUX : SchedWriteVariant<[
1565     SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
1566     SchedVar<NoSchedPred,                          [WriteVecALUX]>
1568 def : InstRW<[BWWriteVZeroIdiomALUX], (instrs PSUBBrr, VPSUBBrr,
1569                                               PSUBDrr, VPSUBDrr,
1570                                               PSUBQrr, VPSUBQrr,
1571                                               PSUBWrr, VPSUBWrr,
1572                                               PCMPGTBrr, VPCMPGTBrr,
1573                                               PCMPGTDrr, VPCMPGTDrr,
1574                                               PCMPGTWrr, VPCMPGTWrr)>;
1576 def BWWriteVZeroIdiomALUY : SchedWriteVariant<[
1577     SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
1578     SchedVar<NoSchedPred,                          [WriteVecALUY]>
1580 def : InstRW<[BWWriteVZeroIdiomALUY], (instrs VPSUBBYrr,
1581                                               VPSUBDYrr,
1582                                               VPSUBQYrr,
1583                                               VPSUBWYrr,
1584                                               VPCMPGTBYrr,
1585                                               VPCMPGTDYrr,
1586                                               VPCMPGTWYrr)>;
1588 def BWWritePCMPGTQ : SchedWriteRes<[BWPort0]> {
1589   let Latency = 5;
1590   let NumMicroOps = 1;
1591   let ReleaseAtCycles = [1];
1594 def BWWriteVZeroIdiomPCMPGTQ : SchedWriteVariant<[
1595     SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
1596     SchedVar<NoSchedPred,                          [BWWritePCMPGTQ]>
1598 def : InstRW<[BWWriteVZeroIdiomPCMPGTQ], (instrs PCMPGTQrr, VPCMPGTQrr,
1599                                                  VPCMPGTQYrr)>;
1602 // CMOVs that use both Z and C flag require an extra uop.
1603 def BWWriteCMOVA_CMOVBErr : SchedWriteRes<[BWPort06,BWPort0156]> {
1604   let Latency = 2;
1605   let ReleaseAtCycles = [1,1];
1606   let NumMicroOps = 2;
1609 def BWWriteCMOVA_CMOVBErm : SchedWriteRes<[BWPort23,BWPort06,BWPort0156]> {
1610   let Latency = 7;
1611   let ReleaseAtCycles = [1,1,1];
1612   let NumMicroOps = 3;
1615 def BWCMOVA_CMOVBErr :  SchedWriteVariant<[
1616   SchedVar<MCSchedPredicate<IsCMOVArr_Or_CMOVBErr>, [BWWriteCMOVA_CMOVBErr]>,
1617   SchedVar<NoSchedPred,                             [WriteCMOV]>
1620 def BWCMOVA_CMOVBErm :  SchedWriteVariant<[
1621   SchedVar<MCSchedPredicate<IsCMOVArm_Or_CMOVBErm>, [BWWriteCMOVA_CMOVBErm]>,
1622   SchedVar<NoSchedPred,                             [WriteCMOV.Folded]>
1625 def : InstRW<[BWCMOVA_CMOVBErr], (instrs CMOV16rr, CMOV32rr, CMOV64rr)>;
1626 def : InstRW<[BWCMOVA_CMOVBErm], (instrs CMOV16rm, CMOV32rm, CMOV64rm)>;
1628 // SETCCs that use both Z and C flag require an extra uop.
1629 def BWWriteSETA_SETBEr : SchedWriteRes<[BWPort06,BWPort0156]> {
1630   let Latency = 2;
1631   let ReleaseAtCycles = [1,1];
1632   let NumMicroOps = 2;
1635 def BWWriteSETA_SETBEm : SchedWriteRes<[BWPort4,BWPort237,BWPort06,BWPort0156]> {
1636   let Latency = 3;
1637   let ReleaseAtCycles = [1,1,1,1];
1638   let NumMicroOps = 4;
1641 def BWSETA_SETBErr :  SchedWriteVariant<[
1642   SchedVar<MCSchedPredicate<IsSETAr_Or_SETBEr>, [BWWriteSETA_SETBEr]>,
1643   SchedVar<NoSchedPred,                         [WriteSETCC]>
1646 def BWSETA_SETBErm :  SchedWriteVariant<[
1647   SchedVar<MCSchedPredicate<IsSETAm_Or_SETBEm>, [BWWriteSETA_SETBEm]>,
1648   SchedVar<NoSchedPred,                         [WriteSETCCStore]>
1651 def : InstRW<[BWSETA_SETBErr], (instrs SETCCr)>;
1652 def : InstRW<[BWSETA_SETBErm], (instrs SETCCm)>;
1654 ///////////////////////////////////////////////////////////////////////////////
1655 // Dependency breaking instructions.
1656 ///////////////////////////////////////////////////////////////////////////////
1658 def : IsZeroIdiomFunction<[
1659   // GPR Zero-idioms.
1660   DepBreakingClass<[ SUB32rr, SUB64rr, XOR32rr, XOR64rr ], ZeroIdiomPredicate>,
1662   // SSE Zero-idioms.
1663   DepBreakingClass<[
1664     // fp variants.
1665     XORPSrr, XORPDrr,
1667     // int variants.
1668     PXORrr,
1669     PSUBBrr, PSUBWrr, PSUBDrr, PSUBQrr,
1670     PCMPGTBrr, PCMPGTDrr, PCMPGTQrr, PCMPGTWrr
1671   ], ZeroIdiomPredicate>,
1673   // AVX Zero-idioms.
1674   DepBreakingClass<[
1675     // xmm fp variants.
1676     VXORPSrr, VXORPDrr,
1678     // xmm int variants.
1679     VPXORrr,
1680     VPSUBBrr, VPSUBWrr, VPSUBDrr, VPSUBQrr,
1681     VPCMPGTBrr, VPCMPGTWrr, VPCMPGTDrr, VPCMPGTQrr,
1683     // ymm variants.
1684     VXORPSYrr, VXORPDYrr, VPXORYrr,
1685     VPSUBBYrr, VPSUBWYrr, VPSUBDYrr, VPSUBQYrr,
1686     VPCMPGTBYrr, VPCMPGTWYrr, VPCMPGTDYrr, VPCMPGTQYrr
1687   ], ZeroIdiomPredicate>,
1690 } // SchedModel