diff --git a/llvm/lib/Target/PowerPC/PPC.td b/llvm/lib/Target/PowerPC/PPC.td --- a/llvm/lib/Target/PowerPC/PPC.td +++ b/llvm/lib/Target/PowerPC/PPC.td @@ -211,52 +211,94 @@ // came before them, the idea is to make implementations of new processors // less error prone and easier to read. // Namely: -// list Power8FeatureList = ... -// list FutureProcessorSpecificFeatureList = -// [ features that Power8 does not support ] -// list FutureProcessorFeatureList = -// !listconcat(Power8FeatureList, FutureProcessorSpecificFeatureList) +// list P8InheritableFeatures = ... +// list FutureProcessorAddtionalFeatures = +// [ features that Power8 does not support but inheritable ] +// list FutureProcessorSpecificFeatures = +// [ features that Power8 does not support and not inheritable ] +// list FutureProcessorInheritableFeatures = +// !listconcat(P8InheritableFeatures, FutureProcessorAddtionalFeatures) +// list FutureProcessorFeatures = +// !listconcat(FutureProcessorInheritableFeatures, +// FutureProcessorSpecificFeatures) // Makes it explicit and obvious what is new in FutureProcesor vs. Power8 as // well as providing a single point of definition if the feature set will be // used elsewhere. def ProcessorFeatures { - list Power7FeatureList = - [DirectivePwr7, FeatureAltivec, FeatureVSX, - FeatureMFOCRF, FeatureFCPSGN, FeatureFSqrt, FeatureFRE, - FeatureFRES, FeatureFRSQRTE, FeatureFRSQRTES, - FeatureRecipPrec, FeatureSTFIWX, FeatureLFIWAX, - FeatureFPRND, FeatureFPCVT, FeatureISEL, - FeaturePOPCNTD, FeatureCMPB, FeatureLDBRX, - Feature64Bit /*, Feature64BitRegs */, - FeatureBPERMD, FeatureExtDiv, - FeatureMFTB, DeprecatedDST, FeatureTwoConstNR]; - list Power8SpecificFeatures = - [DirectivePwr8, FeatureP8Altivec, FeatureP8Vector, FeatureP8Crypto, - FeatureHTM, FeatureDirectMove, FeatureICBT, FeaturePartwordAtomic]; - list Power8FeatureList = - !listconcat(Power7FeatureList, Power8SpecificFeatures); - list Power9SpecificFeatures = - [DirectivePwr9, FeatureP9Altivec, FeatureP9Vector, FeatureISA3_0]; - + // Power7 + list P7InheritableFeatures = [DirectivePwr7, + FeatureAltivec, + FeatureVSX, + FeatureMFOCRF, + FeatureFCPSGN, + FeatureFSqrt, + FeatureFRE, + FeatureFRES, + FeatureFRSQRTE, + FeatureFRSQRTES, + FeatureRecipPrec, + FeatureSTFIWX, + FeatureLFIWAX, + FeatureFPRND, + FeatureFPCVT, + FeatureISEL, + FeaturePOPCNTD, + FeatureCMPB, + FeatureLDBRX, + Feature64Bit, + /* Feature64BitRegs, */ + FeatureBPERMD, + FeatureExtDiv, + FeatureMFTB, + DeprecatedDST, + FeatureTwoConstNR]; + list P7SpecificFeatures = []; + list P7Features = + !listconcat(P7InheritableFeatures, P7SpecificFeatures); + + // Power8 + list P8AdditionalFeatures = [DirectivePwr8, + FeatureP8Altivec, + FeatureP8Vector, + FeatureP8Crypto, + FeatureHTM, + FeatureDirectMove, + FeatureICBT, + FeaturePartwordAtomic]; + list P8SpecificFeatures = []; + list P8InheritableFeatures = + !listconcat(P7InheritableFeatures, P8AdditionalFeatures); + list P8Features = + !listconcat(P8InheritableFeatures, P8SpecificFeatures); + + // Power9 + list P9AdditionalFeatures = [DirectivePwr9, + FeatureP9Altivec, + FeatureP9Vector, + FeatureISA3_0]; // Some features are unique to Power9 and there is no reason to assume // they will be part of any future CPUs. One example is the narrower // dispatch for vector operations than scalar ones. For the time being, // this list also includes scheduling-related features since we do not have // enough info to create custom scheduling strategies for future CPUs. - list Power9OnlyFeatures = - [FeatureVectorsUseTwoUnits, FeaturePPCPreRASched, FeaturePPCPostRASched]; - list Power9FeatureList = - !listconcat(Power8FeatureList, Power9SpecificFeatures); - list Power9ImplList = - !listconcat(Power9FeatureList, Power9OnlyFeatures); - + list P9SpecificFeatures = [FeatureVectorsUseTwoUnits, + FeaturePPCPreRASched, + FeaturePPCPostRASched]; + list P9InheritableFeatures = + !listconcat(P8InheritableFeatures, P9AdditionalFeatures); + list P9Features = + !listconcat(P9InheritableFeatures, P9SpecificFeatures); + + // Future // For future CPU we assume that all of the existing features from Power 9 // still exist with the exception of those we know are Power 9 specific. - list FutureSpecificFeatures = - []; - list FutureFeatureList = - !listconcat(Power9FeatureList, FutureSpecificFeatures); + list FutureAdditionalFeatures = []; + list FutureSpecificFeatures = []; + list FutureInheritableFeatures = + !listconcat(P9InheritableFeatures, FutureAdditionalFeatures); + list FutureFeatures = + !listconcat(FutureInheritableFeatures, FutureSpecificFeatures); } // Note: Future features to add when support is extended to more @@ -456,12 +498,12 @@ FeatureSTFIWX, FeatureLFIWAX, FeatureCMPB, FeatureFPRND, Feature64Bit, FeatureMFTB, DeprecatedDST]>; -def : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.Power7FeatureList>; -def : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.Power8FeatureList>; -def : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.Power9ImplList>; +def : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.P7Features>; +def : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.P8Features>; +def : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.P9Features>; // No scheduler model for future CPU. def : ProcessorModel<"future", NoSchedModel, - ProcessorFeatures.FutureFeatureList>; + ProcessorFeatures.FutureFeatures>; def : Processor<"ppc", G3Itineraries, [Directive32, FeatureHardFloat, FeatureMFTB]>; def : Processor<"ppc32", G3Itineraries, [Directive32, FeatureHardFloat, @@ -472,7 +514,7 @@ FeatureFRSQRTE, FeatureSTFIWX, Feature64Bit /*, Feature64BitRegs */, FeatureMFTB]>; -def : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.Power8FeatureList>; +def : ProcessorModel<"ppc64le", P8Model, ProcessorFeatures.P8Features>; //===----------------------------------------------------------------------===// // Calling Conventions