//=- X86ScheduleSLM.td - X86 Silvermont Scheduling -----------*- tablegen -*-=// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the machine model for Intel Silvermont to support // instruction scheduling and other instruction cost heuristics. // //===----------------------------------------------------------------------===// def SLMModel : SchedMachineModel { // All x86 instructions are modeled as a single micro-op, and SLM can decode 2 // instructions per cycle. let IssueWidth = 2; let MicroOpBufferSize = 32; // Based on the reorder buffer. let LoadLatency = 3; let MispredictPenalty = 10; let PostRAScheduler = 1; // For small loops, expand by a small factor to hide the backedge cost. let LoopMicroOpBufferSize = 10; // FIXME: SSE4 is unimplemented. This flag is set to allow // the scheduler to assign a default model to unrecognized opcodes. let CompleteModel = 0; } let SchedModel = SLMModel in { // Silvermont has 5 reservation stations for micro-ops def SLM_IEC_RSV0 : ProcResource<1>; def SLM_IEC_RSV1 : ProcResource<1>; def SLM_FPC_RSV0 : ProcResource<1> { let BufferSize = 1; } def SLM_FPC_RSV1 : ProcResource<1> { let BufferSize = 1; } def SLM_MEC_RSV : ProcResource<1>; // Many micro-ops are capable of issuing on multiple ports. def SLM_IEC_RSV01 : ProcResGroup<[SLM_IEC_RSV0, SLM_IEC_RSV1]>; def SLM_FPC_RSV01 : ProcResGroup<[SLM_FPC_RSV0, SLM_FPC_RSV1]>; def SLMDivider : ProcResource<1>; def SLMFPMultiplier : ProcResource<1>; def SLMFPDivider : ProcResource<1>; // Loads are 3 cycles, so ReadAfterLd registers needn't be available until 3 // cycles after the memory operand. def : ReadAdvance; // Many SchedWrites are defined in pairs with and without a folded load. // Instructions with folded loads are usually micro-fused, so they only appear // as two micro-ops when queued in the reservation station. // This multiclass defines the resource usage for variants with and without // folded loads. multiclass SLMWriteResPair ExePorts, int Lat, list Res = [1], int UOps = 1, int LoadLat = 3> { // Register variant is using a single cycle on ExePort. def : WriteRes { let Latency = Lat; let ResourceCycles = Res; let NumMicroOps = UOps; } // Memory variant also uses a cycle on MEC_RSV and adds LoadLat cycles to // the latency (default = 3). def : WriteRes { let Latency = !add(Lat, LoadLat); let ResourceCycles = !listconcat([1], Res); let NumMicroOps = UOps; } } // A folded store needs a cycle on MEC_RSV for the store data, but it does not // need an extra port cycle to recompute the address. def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes { let Latency = 3; } def : WriteRes; def : WriteRes; // Load/store MXCSR. // FIXME: These are probably wrong. They are copy pasted from WriteStore/Load. def : WriteRes; def : WriteRes { let Latency = 3; } // Treat misc copies as a move. def : InstRW<[WriteMove], (instrs COPY)>; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : X86WriteRes; // x87 conditional move. def : WriteRes; def : WriteRes { // FIXME Latency and NumMicrOps? let ResourceCycles = [2,1]; } // This is for simple LEAs with one or two input operands. // The complex ones can only execute on port 1, and they require two cycles on // the port to read all inputs. We don't model that. def : WriteRes; // Bit counts. defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; // BMI1 BEXTR, BMI2 BZHI // NOTE: These don't exist on Silvermont. Ports are guesses. defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; // Scalar and vector floating point. def : WriteRes { let Latency = 3; } def : WriteRes { let Latency = 3; } def : WriteRes { let Latency = 3; } def : WriteRes { let Latency = 3; } def : WriteRes { let Latency = 3; } def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; defm : X86WriteRes; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; def : WriteRes; // Vector integer operations. def : WriteRes { let Latency = 3; } def : WriteRes { let Latency = 3; } def : WriteRes { let Latency = 3; } def : WriteRes { let Latency = 3; } def : WriteRes { let Latency = 3; } def : WriteRes { let Latency = 3; } def : WriteRes { let Latency = 3; } def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; // FIXME: The below is closer to correct, but caused some perf regressions. //defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; // Vector insert/extract operations. defm : SLMWriteResPair; def : WriteRes; def : WriteRes { let Latency = 4; let NumMicroOps = 2; let ResourceCycles = [1, 2]; } //////////////////////////////////////////////////////////////////////////////// // Horizontal add/sub instructions. //////////////////////////////////////////////////////////////////////////////// defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; // String instructions. // Packed Compare Implicit Length Strings, Return Mask def : WriteRes { let Latency = 13; let ResourceCycles = [13]; } def : WriteRes { let Latency = 13; let ResourceCycles = [13, 1]; } // Packed Compare Explicit Length Strings, Return Mask def : WriteRes { let Latency = 17; let ResourceCycles = [17]; } def : WriteRes { let Latency = 17; let ResourceCycles = [17, 1]; } // Packed Compare Implicit Length Strings, Return Index def : WriteRes { let Latency = 17; let ResourceCycles = [17]; } def : WriteRes { let Latency = 17; let ResourceCycles = [17, 1]; } // Packed Compare Explicit Length Strings, Return Index def : WriteRes { let Latency = 21; let ResourceCycles = [21]; } def : WriteRes { let Latency = 21; let ResourceCycles = [21, 1]; } // MOVMSK Instructions. def : WriteRes { let Latency = 4; } def : WriteRes { let Latency = 4; } def : WriteRes { let Latency = 4; } def : WriteRes { let Latency = 4; } // AES Instructions. def : WriteRes { let Latency = 8; let ResourceCycles = [5]; } def : WriteRes { let Latency = 8; let ResourceCycles = [5, 1]; } def : WriteRes { let Latency = 8; let ResourceCycles = [5]; } def : WriteRes { let Latency = 8; let ResourceCycles = [5, 1]; } def : WriteRes { let Latency = 8; let ResourceCycles = [5]; } def : WriteRes { let Latency = 8; let ResourceCycles = [5, 1]; } // Carry-less multiplication instructions. def : WriteRes { let Latency = 10; let ResourceCycles = [10]; } def : WriteRes { let Latency = 10; let ResourceCycles = [10, 1]; } def : WriteRes { let Latency = 100; } def : WriteRes { let Latency = 100; } def : WriteRes; def : WriteRes; // AVX/FMA is not supported on that architecture, but we should define the basic // scheduling resources anyway. def : WriteRes; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; } // SchedModel