17ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen//=- X86SchedSandyBridge.td - X86 Sandy Bridge Scheduling ----*- tablegen -*-=//
27ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen//
37ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen//                     The LLVM Compiler Infrastructure
47ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen//
57ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// This file is distributed under the University of Illinois Open Source
67ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// License. See LICENSE.TXT for details.
77ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen//
87ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen//===----------------------------------------------------------------------===//
97ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen//
107ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// This file defines the machine model for Sandy Bridge to support instruction
117ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// scheduling and other instruction cost heuristics.
127ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen//
137ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen//===----------------------------------------------------------------------===//
147ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
157ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef SandyBridgeModel : SchedMachineModel {
167ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  // All x86 instructions are modeled as a single micro-op, and SB can decode 4
177ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  // instructions per cycle.
187ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  // FIXME: Identify instructions that aren't a single fused micro-op.
197ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  let IssueWidth = 4;
20a5ce5f36d3a1e312304e8312ca64a1342f5f55a6Andrew Trick  let MicroOpBufferSize = 168; // Based on the reorder buffer.
217ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  let LoadLatency = 4;
227ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  let MispredictPenalty = 16;
23070156437752179833b1e5fddd50caa03fd7c12fAndrew Trick
24dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines  // Based on the LSD (loop-stream detector) queue size.
25dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines  let LoopMicroOpBufferSize = 28;
26dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines
27070156437752179833b1e5fddd50caa03fd7c12fAndrew Trick  // FIXME: SSE4 and AVX are unimplemented. This flag is set to allow
28070156437752179833b1e5fddd50caa03fd7c12fAndrew Trick  // the scheduler to assign a default model to unrecognized opcodes.
29070156437752179833b1e5fddd50caa03fd7c12fAndrew Trick  let CompleteModel = 0;
307ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen}
317ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
327ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesenlet SchedModel = SandyBridgeModel in {
337ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
347ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// Sandy Bridge can issue micro-ops to 6 different ports in one cycle.
357ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
367ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// Ports 0, 1, and 5 handle all computation.
377ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef SBPort0 : ProcResource<1>;
387ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef SBPort1 : ProcResource<1>;
397ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef SBPort5 : ProcResource<1>;
407ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
417ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// Ports 2 and 3 are identical. They handle loads and the address half of
427ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// stores.
437ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef SBPort23 : ProcResource<2>;
447ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
457ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// Port 4 gets the data half of stores. Store data can be available later than
467ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// the store address, but since we don't model the latency of stores, we can
477ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// ignore that.
487ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef SBPort4 : ProcResource<1>;
497ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
507ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// Many micro-ops are capable of issuing on multiple ports.
517ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef SBPort05  : ProcResGroup<[SBPort0, SBPort5]>;
527ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef SBPort15  : ProcResGroup<[SBPort1, SBPort5]>;
537ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef SBPort015 : ProcResGroup<[SBPort0, SBPort1, SBPort5]>;
547ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
55a3d82ce19fd825cbf3bf85b5969424217fc40b45Andrew Trick// 54 Entry Unified Scheduler
56a3d82ce19fd825cbf3bf85b5969424217fc40b45Andrew Trickdef SBPortAny : ProcResGroup<[SBPort0, SBPort1, SBPort23, SBPort4, SBPort5]> {
57a3d82ce19fd825cbf3bf85b5969424217fc40b45Andrew Trick  let BufferSize=54;
58a3d82ce19fd825cbf3bf85b5969424217fc40b45Andrew Trick}
59a3d82ce19fd825cbf3bf85b5969424217fc40b45Andrew Trick
6092142b327598822fdbeb386e5a5b68ec963be4adAndrew Trick// Integer division issued on port 0.
6192142b327598822fdbeb386e5a5b68ec963be4adAndrew Trickdef SBDivider : ProcResource<1>;
627ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
637ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// Loads are 4 cycles, so ReadAfterLd registers needn't be available until 4
647ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// cycles after the memory operand.
657ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef : ReadAdvance<ReadAfterLd, 4>;
667ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
677ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// Many SchedWrites are defined in pairs with and without a folded load.
687ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// Instructions with folded loads are usually micro-fused, so they only appear
697ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// as two micro-ops when queued in the reservation station.
707ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// This multiclass defines the resource usage for variants with and without
717ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// folded loads.
727ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesenmulticlass SBWriteResPair<X86FoldableSchedWrite SchedRW,
737ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen                          ProcResourceKind ExePort,
747ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen                          int Lat> {
757ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  // Register variant is using a single cycle on ExePort.
767ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  def : WriteRes<SchedRW, [ExePort]> { let Latency = Lat; }
777ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
787ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  // Memory variant also uses a cycle on port 2/3 and adds 4 cycles to the
797ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  // latency.
807ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  def : WriteRes<SchedRW.Folded, [SBPort23, ExePort]> {
817ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen     let Latency = !add(Lat, 4);
827ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  }
837ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen}
847ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
857ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// A folded store needs a cycle on port 4 for the store data, but it does not
867ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// need an extra port 2/3 cycle to recompute the address.
877ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef : WriteRes<WriteRMW, [SBPort4]>;
887ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
897ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef : WriteRes<WriteStore, [SBPort23, SBPort4]>;
907ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef : WriteRes<WriteLoad,  [SBPort23]> { let Latency = 4; }
917ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef : WriteRes<WriteMove,  [SBPort015]>;
927ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef : WriteRes<WriteZero,  []>;
937ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
947ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteALU,   SBPort015, 1>;
957ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteIMul,  SBPort1,   3>;
969b5575d55add0bb2c8769f76db250ff0f4efe8dcAndrew Trickdef  : WriteRes<WriteIMulH, []> { let Latency = 3; }
977ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteShift, SBPort05,  1>;
987ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteJump,  SBPort5,   1>;
997ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
1007ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// This is for simple LEAs with one or two input operands.
1017ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// The complex ones can only execute on port 1, and they require two cycles on
1027ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// the port to read all inputs. We don't model that.
1037ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef : WriteRes<WriteLEA, [SBPort15]>;
1047ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
1057ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// This is quite rough, latency depends on the dividend.
1067ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef : WriteRes<WriteIDiv, [SBPort0, SBDivider]> {
1077ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  let Latency = 25;
1087ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  let ResourceCycles = [1, 10];
1097ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen}
1107ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef : WriteRes<WriteIDivLd, [SBPort23, SBPort0, SBDivider]> {
1117ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  let Latency = 29;
1127ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen  let ResourceCycles = [1, 1, 10];
1137ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen}
1147ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
1157ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// Scalar and vector floating point.
1167ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteFAdd,   SBPort1, 3>;
1177ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteFMul,   SBPort0, 5>;
1187ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteFDiv,   SBPort0, 12>; // 10-14 cycles.
1197ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteFRcp,   SBPort0, 5>;
12037ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hinesdefm : SBWriteResPair<WriteFRsqrt, SBPort0, 5>;
1217ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteFSqrt,  SBPort0, 15>;
1227ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteCvtF2I, SBPort1, 3>;
1237ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteCvtI2F, SBPort1, 4>;
1247ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteCvtF2F, SBPort1, 3>;
12536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdefm : SBWriteResPair<WriteFShuffle,  SBPort5,  1>;
12636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdefm : SBWriteResPair<WriteFBlend,  SBPort05,  1>;
12736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteFVarBlend, [SBPort0, SBPort5]> {
12836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 2;
12936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [1, 1];
13036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
13136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteFVarBlendLd, [SBPort0, SBPort5, SBPort23]> {
13236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 6;
13336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [1, 1, 1];
13436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
1357ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
1367ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen// Vector integer operations.
1377ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteVecShift, SBPort05,  1>;
1387ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteVecLogic, SBPort015, 1>;
1397ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteVecALU,   SBPort15,  1>;
1407ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteVecIMul,  SBPort0,   5>;
1417ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendefm : SBWriteResPair<WriteShuffle,  SBPort15,  1>;
14236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdefm : SBWriteResPair<WriteBlend,  SBPort15,  1>;
14336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteVarBlend, [SBPort1, SBPort5]> {
14436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 2;
14536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [1, 1];
14636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
14736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteVarBlendLd, [SBPort1, SBPort5, SBPort23]> {
14836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 6;
14936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [1, 1, 1];
15036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
15136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteMPSAD, [SBPort0, SBPort1, SBPort5]> {
15236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 6;
15336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [1, 1, 1];
15436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
15536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteMPSADLd, [SBPort0, SBPort1, SBPort5, SBPort23]> {
15636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 6;
15736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [1, 1, 1, 1];
15836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
15936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
16036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// String instructions.
16136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// Packed Compare Implicit Length Strings, Return Mask
16236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WritePCmpIStrM, [SBPort015]> {
16336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 11;
16436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [3];
16536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
16636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WritePCmpIStrMLd, [SBPort015, SBPort23]> {
16736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 11;
16836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [3, 1];
16936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
17036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
17136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// Packed Compare Explicit Length Strings, Return Mask
17236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WritePCmpEStrM, [SBPort015]> {
17336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 11;
17436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [8];
17536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
17636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WritePCmpEStrMLd, [SBPort015, SBPort23]> {
17736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 11;
17836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [7, 1];
17936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
18036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
18136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// Packed Compare Implicit Length Strings, Return Index
18236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WritePCmpIStrI, [SBPort015]> {
18336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 3;
18436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [3];
18536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
18636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WritePCmpIStrILd, [SBPort015, SBPort23]> {
18736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 3;
18836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [3, 1];
18936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
19036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
19136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// Packed Compare Explicit Length Strings, Return Index
19236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WritePCmpEStrI, [SBPort015]> {
19336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 4;
19436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [8];
19536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
19636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WritePCmpEStrILd, [SBPort015, SBPort23]> {
19736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 4;
19836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [7, 1];
19936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
20036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
20136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// AES Instructions.
20236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteAESDecEnc, [SBPort015]> {
20336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 8;
20436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [2];
20536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
20636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteAESDecEncLd, [SBPort015, SBPort23]> {
20736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 8;
20836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [2, 1];
20936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
21036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
21136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteAESIMC, [SBPort015]> {
21236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 8;
21336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [2];
21436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
21536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteAESIMCLd, [SBPort015, SBPort23]> {
21636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 8;
21736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [2, 1];
21836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
21936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
22036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteAESKeyGen, [SBPort015]> {
22136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 8;
22236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [11];
22336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
22436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteAESKeyGenLd, [SBPort015, SBPort23]> {
22536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 8;
22636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [10, 1];
22736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
22836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
22936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// Carry-less multiplication instructions.
23036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteCLMul, [SBPort015]> {
23136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 14;
23236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [18];
23336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
23436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteCLMulLd, [SBPort015, SBPort23]> {
23536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let Latency = 14;
23636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  let ResourceCycles = [17, 1];
23736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines}
23836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
2397ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen
2407ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef : WriteRes<WriteSystem,     [SBPort015]> { let Latency = 100; }
2417ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesendef : WriteRes<WriteMicrocoded, [SBPort015]> { let Latency = 100; }
24236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteFence, [SBPort23, SBPort4]>;
24336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdef : WriteRes<WriteNop, []>;
24436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
24536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// AVX2 is not supported on that architecture, but we should define the basic
24636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// scheduling resources anyway.
24736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdefm : SBWriteResPair<WriteFShuffle256, SBPort0,  1>;
24836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdefm : SBWriteResPair<WriteShuffle256, SBPort0,  1>;
24936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdefm : SBWriteResPair<WriteVarVecShift, SBPort0,  1>;
2507ae14f3d976c6883edcf8d8152c34aa1075710bdJakob Stoklund Olesen} // SchedModel
251