Index: lib/Target/X86/X86SchedBroadwell.td =================================================================== --- lib/Target/X86/X86SchedBroadwell.td +++ lib/Target/X86/X86SchedBroadwell.td @@ -212,22 +212,22 @@ //defm : BWWriteResPair; // Floating point division. defm : BWWriteResPair; // Floating point division (XMM). defm : BWWriteResPair; // Floating point division (YMM). -defm : BWWriteResPair; // Floating point division (ZMM). +defm : X86WriteResPairUnsupported; //defm : BWWriteResPair; // Floating point division. defm : BWWriteResPair; // Floating point division (XMM). defm : BWWriteResPair; // Floating point division (YMM). -defm : BWWriteResPair; // Floating point division (ZMM). +defm : X86WriteResPairUnsupported; defm : X86WriteRes; // Floating point square root. defm : X86WriteRes; defm : BWWriteResPair; // Floating point square root (XMM). defm : BWWriteResPair; // Floating point square root (YMM). -defm : BWWriteResPair; // Floating point square root (ZMM). +defm : X86WriteResPairUnsupported; defm : X86WriteRes; // Floating point double square root. defm : X86WriteRes; defm : BWWriteResPair; // Floating point double square root (XMM). defm : BWWriteResPair; // Floating point double square root (YMM). -defm : BWWriteResPair; // Floating point double square root (ZMM). +defm : X86WriteResPairUnsupported; defm : BWWriteResPair; // Floating point long double square root. defm : BWWriteResPair; // Floating point reciprocal estimate. @@ -1688,4 +1688,3 @@ def: InstRW<[WriteZero], (instrs CLC)>; } // SchedModel - Index: lib/Target/X86/X86SchedHaswell.td =================================================================== --- lib/Target/X86/X86SchedHaswell.td +++ lib/Target/X86/X86SchedHaswell.td @@ -10,6 +10,11 @@ // This file defines the machine model for Haswell to support instruction // scheduling and other instruction cost heuristics. // +// Note that we define some instructions here that are not supported by haswell, +// but we still have to define them because KNL uses the HSW model. +// They are currently tagged with a comment `Unsupported = 1`. +// FIXME: Use Unsupported = 1 once KNL has its own model. +// //===----------------------------------------------------------------------===// def HaswellModel : SchedMachineModel { @@ -203,11 +208,11 @@ defm : HWWriteResPair; defm : HWWriteResPair; defm : HWWriteResPair; -defm : HWWriteResPair; +defm : HWWriteResPair; // Unsupported = 1 defm : HWWriteResPair; defm : HWWriteResPair; defm : HWWriteResPair; -defm : HWWriteResPair; +defm : HWWriteResPair; // Unsupported = 1 defm : HWWriteResPair; defm : HWWriteResPair; @@ -220,11 +225,11 @@ defm : HWWriteResPair; defm : HWWriteResPair; defm : HWWriteResPair; -defm : HWWriteResPair; +defm : HWWriteResPair; // Unsupported = 1 defm : HWWriteResPair; defm : HWWriteResPair; defm : HWWriteResPair; -defm : HWWriteResPair; +defm : HWWriteResPair; // Unsupported = 1 defm : HWWriteResPair; defm : HWWriteResPair; Index: lib/Target/X86/X86SchedSandyBridge.td =================================================================== --- lib/Target/X86/X86SchedSandyBridge.td +++ lib/Target/X86/X86SchedSandyBridge.td @@ -10,6 +10,10 @@ // This file defines the machine model for Sandy Bridge to support instruction // scheduling and other instruction cost heuristics. // +// Note that we define some instructions here that are not supported by SNB, +// but we still have to define them because SNB is the default subtarget for +// X86. These instructions are tagged with a comment `Unsupported = 1`. +// //===----------------------------------------------------------------------===// def SandyBridgeModel : SchedMachineModel { @@ -195,11 +199,11 @@ defm : SBWriteResPair; defm : SBWriteResPair; defm : SBWriteResPair; -defm : SBWriteResPair; +defm : SBWriteResPair; // Unsupported = 1 defm : SBWriteResPair; defm : SBWriteResPair; defm : SBWriteResPair; -defm : SBWriteResPair; +defm : SBWriteResPair; // Unsupported = 1 defm : SBWriteResPair; defm : SBWriteResPair; @@ -212,11 +216,11 @@ defm : SBWriteResPair; defm : SBWriteResPair; defm : SBWriteResPair; -defm : SBWriteResPair; +defm : SBWriteResPair; // Unsupported = 1 defm : SBWriteResPair; defm : SBWriteResPair; defm : SBWriteResPair; -defm : SBWriteResPair; +defm : SBWriteResPair; // Unsupported = 1 defm : SBWriteResPair; defm : SBWriteResPair; Index: lib/Target/X86/X86SchedSkylakeClient.td =================================================================== --- lib/Target/X86/X86SchedSkylakeClient.td +++ lib/Target/X86/X86SchedSkylakeClient.td @@ -208,20 +208,20 @@ defm : SKLWriteResPair; // Floating point division. //defm : SKLWriteResPair; // Floating point division (XMM). defm : SKLWriteResPair; // Floating point division (YMM). -defm : SKLWriteResPair; // Floating point division (ZMM). +defm : X86WriteResPairUnsupported; //defm : SKLWriteResPair; // Floating point double division. //defm : SKLWriteResPair; // Floating point double division (XMM). //defm : SKLWriteResPair; // Floating point double division (YMM). -defm : SKLWriteResPair; // Floating point double division (ZMM). +defm : X86WriteResPairUnsupported; defm : SKLWriteResPair; // Floating point square root. defm : SKLWriteResPair; // Floating point square root (XMM). defm : SKLWriteResPair; // Floating point square root (YMM). -defm : SKLWriteResPair; // Floating point square root (ZMM). +defm : X86WriteResPairUnsupported; defm : SKLWriteResPair; // Floating point double square root. defm : SKLWriteResPair; // Floating point double square root (XMM). defm : SKLWriteResPair; // Floating point double square root (YMM). -defm : SKLWriteResPair; // Floating point double square root (ZMM). +defm : X86WriteResPairUnsupported; defm : SKLWriteResPair; // Floating point long double square root. defm : SKLWriteResPair; // Floating point reciprocal estimate. Index: lib/Target/X86/X86Schedule.td =================================================================== --- lib/Target/X86/X86Schedule.td +++ lib/Target/X86/X86Schedule.td @@ -49,6 +49,20 @@ } } +// Helpers to mark SchedWrites as unsupported. +multiclass X86WriteResUnsupported { + let Unsupported = 1 in { + def : WriteRes; + } +} +multiclass X86WriteResPairUnsupported { + let Unsupported = 1 in { + def : WriteRes; + def : WriteRes; + } +} + + // Multiclass that wraps X86FoldableSchedWrite for each vector width. class X86SchedWriteWidths; defm : AtomWriteResPair; -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. +defm : X86WriteResPairUnsupported; defm : AtomWriteResPair; defm : AtomWriteResPair; @@ -102,7 +102,7 @@ let ResourceCycles = [2]; } -def : WriteRes; // NOTE: Doesn't exist on Atom. +defm : X86WriteResUnsupported; // This is for simple LEAs with one or two input operands. def : WriteRes; @@ -128,13 +128,13 @@ // Bit counts. defm : AtomWriteResPair; -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; // BMI1 BEXTR, BMI2 BZHI -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; //////////////////////////////////////////////////////////////////////////////// // Integer shifts and rotates. @@ -235,43 +235,43 @@ defm : AtomWriteResPair; defm : AtomWriteResPair; defm : AtomWriteResPair; -defm : AtomWriteResPair; +defm : X86WriteResPairUnsupported; defm : AtomWriteResPair; defm : AtomWriteResPair; defm : AtomWriteResPair; -defm : AtomWriteResPair; +defm : X86WriteResPairUnsupported; defm : AtomWriteResPair; defm : AtomWriteResPair; defm : AtomWriteResPair; -defm : AtomWriteResPair; +defm : X86WriteResPairUnsupported; defm : AtomWriteResPair; defm : AtomWriteResPair; defm : AtomWriteResPair; -defm : AtomWriteResPair; +defm : X86WriteResPairUnsupported; defm : AtomWriteResPair; defm : AtomWriteResPair; defm : AtomWriteResPair; defm : AtomWriteResPair; defm : AtomWriteResPair; -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. +defm : X86WriteResPairUnsupported; defm : AtomWriteResPair; -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. +defm : X86WriteResPairUnsupported; defm : AtomWriteResPair; -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; //////////////////////////////////////////////////////////////////////////////// // Conversions. @@ -298,12 +298,12 @@ defm : AtomWriteResPair; defm : AtomWriteResPair; -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -def : WriteRes; // NOTE: Doesn't exist on Atom. -def : WriteRes; // NOTE: Doesn't exist on Atom. -def : WriteRes; // NOTE: Doesn't exist on Atom. -def : WriteRes; // NOTE: Doesn't exist on Atom. +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResUnsupported; +defm : X86WriteResUnsupported; +defm : X86WriteResUnsupported; +defm : X86WriteResUnsupported; //////////////////////////////////////////////////////////////////////////////// // Vector integer operations. @@ -362,14 +362,14 @@ defm : AtomWriteResPair; defm : AtomWriteResPair; defm : AtomWriteResPair; -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; //////////////////////////////////////////////////////////////////////////////// // Vector insert/extract operations. @@ -383,10 +383,10 @@ // SSE42 String instructions. //////////////////////////////////////////////////////////////////////////////// -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; //////////////////////////////////////////////////////////////////////////////// // MOVMSK Instructions. @@ -398,12 +398,12 @@ def : WriteRes { let Latency = 3; let ResourceCycles = [3]; } //////////////////////////////////////////////////////////////////////////////// -// AES Instructions. +// AES instructions. //////////////////////////////////////////////////////////////////////////////// -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; //////////////////////////////////////////////////////////////////////////////// // Horizontal add/sub instructions. @@ -419,7 +419,7 @@ // Carry-less multiplication instructions. //////////////////////////////////////////////////////////////////////////////// -defm : AtomWriteResPair; // NOTE: Doesn't exist on Atom. +defm : X86WriteResPairUnsupported; //////////////////////////////////////////////////////////////////////////////// // Load/store MXCSR. Index: lib/Target/X86/X86ScheduleBtVer2.td =================================================================== --- lib/Target/X86/X86ScheduleBtVer2.td +++ lib/Target/X86/X86ScheduleBtVer2.td @@ -190,7 +190,7 @@ // BMI1 BEXTR, BMI2 BZHI defm : JWriteResIntPair; -defm : JWriteResIntPair; // NOTE: Doesn't exist on Jaguar. +defm : X86WriteResPairUnsupported; //////////////////////////////////////////////////////////////////////////////// // Integer shifts and rotates. @@ -314,9 +314,9 @@ defm : JWriteResFpuPair; defm : JWriteResFpuPair; defm : JWriteResYMMPair; -defm : JWriteResFpuPair; // NOTE: Doesn't exist on Jaguar. -defm : JWriteResFpuPair; // NOTE: Doesn't exist on Jaguar. -defm : JWriteResFpuPair; // NOTE: Doesn't exist on Jaguar. +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; defm : JWriteResFpuPair; defm : JWriteResFpuPair; defm : JWriteResYMMPair; @@ -329,19 +329,19 @@ defm : JWriteResFpuPair; defm : JWriteResFpuPair; defm : JWriteResYMMPair; -defm : JWriteResYMMPair; +defm : X86WriteResPairUnsupported; defm : JWriteResFpuPair; defm : JWriteResFpuPair; defm : JWriteResYMMPair; -defm : JWriteResYMMPair; +defm : X86WriteResPairUnsupported; defm : JWriteResFpuPair; defm : JWriteResFpuPair; defm : JWriteResYMMPair; -defm : JWriteResYMMPair; +defm : X86WriteResPairUnsupported; defm : JWriteResFpuPair; defm : JWriteResFpuPair; defm : JWriteResYMMPair; -defm : JWriteResYMMPair; +defm : X86WriteResPairUnsupported; defm : JWriteResFpuPair; defm : JWriteResFpuPair; defm : JWriteResFpuPair; @@ -359,7 +359,7 @@ defm : JWriteResFpuPair; defm : JWriteResYMMPair; defm : JWriteResFpuPair; -defm : JWriteResFpuPair; // NOTE: Doesn't exist on Jaguar. +defm : X86WriteResPairUnsupported; //////////////////////////////////////////////////////////////////////////////// // Conversions. @@ -454,13 +454,13 @@ defm : JWriteResFpuPair; defm : JWriteResFpuPair; defm : JWriteResFpuPair; -defm : JWriteResFpuPair; // NOTE: Doesn't exist on Jaguar. +defm : X86WriteResPairUnsupported; defm : JWriteResFpuPair; defm : JWriteResYMMPair; defm : JWriteResFpuPair; -defm : JWriteResFpuPair; // NOTE: Doesn't exist on Jaguar. -defm : JWriteResFpuPair; // NOTE: Doesn't exist on Jaguar. -defm : JWriteResFpuPair; // NOTE: Doesn't exist on Jaguar. +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; //////////////////////////////////////////////////////////////////////////////// // Vector insert/extract operations. Index: lib/Target/X86/X86ScheduleSLM.td =================================================================== --- lib/Target/X86/X86ScheduleSLM.td +++ lib/Target/X86/X86ScheduleSLM.td @@ -122,9 +122,8 @@ defm : SLMWriteResPair; // BMI1 BEXTR, BMI2 BZHI -// NOTE: These don't exist on Silvermont. Ports are guesses. -defm : SLMWriteResPair; -defm : SLMWriteResPair; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; defm : SLMWriteResPair; defm : SLMWriteResPair; @@ -179,11 +178,11 @@ defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; -defm : SLMWriteResPair; +defm : X86WriteResPairUnsupported; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; -defm : SLMWriteResPair; +defm : X86WriteResPairUnsupported; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; @@ -193,11 +192,11 @@ defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; -defm : SLMWriteResPair; +defm : X86WriteResPairUnsupported; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; -defm : SLMWriteResPair; +defm : X86WriteResPairUnsupported; defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; @@ -407,26 +406,26 @@ // AVX/FMA is not supported on that architecture, but we should define the basic // scheduling resources anyway. def : WriteRes; -defm : SLMWriteResPair; +defm : X86WriteResPairUnsupported; defm : SLMWriteResPair; -defm : SLMWriteResPair; +defm : X86WriteResPairUnsupported; defm : SLMWriteResPair; -defm : SLMWriteResPair; -defm : SLMWriteResPair; -defm : SLMWriteResPair; -defm : SLMWriteResPair; -defm : SLMWriteResPair; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; defm : SLMWriteResPair; -defm : SLMWriteResPair; -defm : SLMWriteResPair; -defm : SLMWriteResPair; -defm : SLMWriteResPair; - -defm : SLMWriteResPair; -defm : SLMWriteResPair; -def : WriteRes; -def : WriteRes; -def : WriteRes; -def : WriteRes; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; + +defm : X86WriteResPairUnsupported; +defm : X86WriteResPairUnsupported; +defm : X86WriteResUnsupported; +defm : X86WriteResUnsupported; +defm : X86WriteResUnsupported; +defm : X86WriteResUnsupported; } // SchedModel Index: lib/Target/X86/X86ScheduleZnver1.td =================================================================== --- lib/Target/X86/X86ScheduleZnver1.td +++ lib/Target/X86/X86ScheduleZnver1.td @@ -243,11 +243,11 @@ defm : ZnWriteResFpuPair; defm : ZnWriteResFpuPair; //defm : ZnWriteResFpuPair; -defm : ZnWriteResFpuPair; +defm : X86WriteResPairUnsupported; defm : ZnWriteResFpuPair; defm : ZnWriteResFpuPair; //defm : ZnWriteResFpuPair; -defm : ZnWriteResFpuPair; +defm : X86WriteResPairUnsupported; defm : ZnWriteResFpuPair; defm : ZnWriteResFpuPair; // FIXME: Should folds require 1 extra uops? defm : ZnWriteResFpuPair; // FIXME: Should folds require 1 extra uops? @@ -277,11 +277,11 @@ defm : ZnWriteResFpuPair; defm : ZnWriteResFpuPair; defm : ZnWriteResFpuPair; -defm : ZnWriteResFpuPair; +defm : X86WriteResPairUnsupported; defm : ZnWriteResFpuPair; defm : ZnWriteResFpuPair; defm : ZnWriteResFpuPair; -defm : ZnWriteResFpuPair; +defm : X86WriteResPairUnsupported; defm : ZnWriteResFpuPair; // Vector integer operations which uses FPU units