@@ -1740,6 +1740,10 @@ def HasVendorXSMTVDot
17401740// LLVM specific features and extensions
17411741//===----------------------------------------------------------------------===//
17421742
1743+ class RISCVTuneFeature<string name, string field_name, string value,
1744+ string description, list<SubtargetFeature> implied = []>
1745+ : SubtargetFeature<name, field_name, value, description, implied>;
1746+
17431747// Feature32Bit exists to mark CPUs that support RV32 to distinguish them from
17441748// tuning CPU names.
17451749def Feature32Bit
@@ -1788,46 +1792,46 @@ def FeatureUnalignedVectorMem
17881792 "loads and stores">;
17891793
17901794def TuneNLogNVRGather
1791- : SubtargetFeature <"log-vrgather", "RISCVVRGatherCostModel", "NLog2N",
1795+ : RISCVTuneFeature <"log-vrgather", "RISCVVRGatherCostModel", "NLog2N",
17921796 "Has vrgather.vv with LMUL*log2(LMUL) latency">;
17931797
1794- def TunePostRAScheduler : SubtargetFeature <"use-postra-scheduler",
1798+ def TunePostRAScheduler : RISCVTuneFeature <"use-postra-scheduler",
17951799 "UsePostRAScheduler", "true", "Schedule again after register allocation">;
17961800
1797- def TuneDisableMISchedLoadClustering : SubtargetFeature <"disable-misched-load-clustering",
1801+ def TuneDisableMISchedLoadClustering : RISCVTuneFeature <"disable-misched-load-clustering",
17981802 "EnableMISchedLoadClustering", "false", "Disable load clustering in the machine scheduler">;
17991803
1800- def TuneDisableMISchedStoreClustering : SubtargetFeature <"disable-misched-store-clustering",
1804+ def TuneDisableMISchedStoreClustering : RISCVTuneFeature <"disable-misched-store-clustering",
18011805 "EnableMISchedStoreClustering", "false", "Disable store clustering in the machine scheduler">;
18021806
1803- def TuneDisablePostMISchedLoadClustering : SubtargetFeature <"disable-postmisched-load-clustering",
1807+ def TuneDisablePostMISchedLoadClustering : RISCVTuneFeature <"disable-postmisched-load-clustering",
18041808 "EnablePostMISchedLoadClustering", "false", "Disable PostRA load clustering in the machine scheduler">;
18051809
1806- def TuneDisablePostMISchedStoreClustering : SubtargetFeature <"disable-postmisched-store-clustering",
1810+ def TuneDisablePostMISchedStoreClustering : RISCVTuneFeature <"disable-postmisched-store-clustering",
18071811 "EnablePostMISchedStoreClustering", "false", "Disable PostRA store clustering in the machine scheduler">;
18081812
18091813def TuneDisableLatencySchedHeuristic
1810- : SubtargetFeature <"disable-latency-sched-heuristic", "DisableLatencySchedHeuristic", "true",
1814+ : RISCVTuneFeature <"disable-latency-sched-heuristic", "DisableLatencySchedHeuristic", "true",
18111815 "Disable latency scheduling heuristic">;
18121816
18131817def TunePredictableSelectIsExpensive
1814- : SubtargetFeature <"predictable-select-expensive", "PredictableSelectIsExpensive", "true",
1818+ : RISCVTuneFeature <"predictable-select-expensive", "PredictableSelectIsExpensive", "true",
18151819 "Prefer likely predicted branches over selects">;
18161820
18171821def TuneOptimizedZeroStrideLoad
1818- : SubtargetFeature <"optimized-zero-stride-load", "HasOptimizedZeroStrideLoad",
1822+ : RISCVTuneFeature <"optimized-zero-stride-load", "HasOptimizedZeroStrideLoad",
18191823 "true", "Optimized (perform fewer memory operations)"
18201824 "zero-stride vector load">;
18211825
18221826foreach nf = {2-8} in
18231827 def TuneOptimizedNF#nf#SegmentLoadStore :
1824- SubtargetFeature <"optimized-nf"#nf#"-segment-load-store",
1828+ RISCVTuneFeature <"optimized-nf"#nf#"-segment-load-store",
18251829 "HasOptimizedNF"#nf#"SegmentLoadStore",
18261830 "true", "vlseg"#nf#"eN.v and vsseg"#nf#"eN.v are "
18271831 "implemented as a wide memory op and shuffle">;
18281832
18291833def TuneVLDependentLatency
1830- : SubtargetFeature <"vl-dependent-latency", "HasVLDependentLatency", "true",
1834+ : RISCVTuneFeature <"vl-dependent-latency", "HasVLDependentLatency", "true",
18311835 "Latency of vector instructions is dependent on the "
18321836 "dynamic value of vl">;
18331837
@@ -1839,50 +1843,50 @@ def Experimental
18391843// and instead split over multiple cycles. DLEN refers to the datapath width
18401844// that can be done in parallel.
18411845def TuneDLenFactor2
1842- : SubtargetFeature <"dlen-factor-2", "DLenFactor2", "true",
1846+ : RISCVTuneFeature <"dlen-factor-2", "DLenFactor2", "true",
18431847 "Vector unit DLEN(data path width) is half of VLEN">;
18441848
18451849def TuneNoDefaultUnroll
1846- : SubtargetFeature <"no-default-unroll", "EnableDefaultUnroll", "false",
1850+ : RISCVTuneFeature <"no-default-unroll", "EnableDefaultUnroll", "false",
18471851 "Disable default unroll preference.">;
18481852
18491853// SiFive 7 is able to fuse integer ALU operations with a preceding branch
18501854// instruction.
18511855def TuneShortForwardBranchOpt
1852- : SubtargetFeature <"short-forward-branch-opt", "HasShortForwardBranchOpt",
1856+ : RISCVTuneFeature <"short-forward-branch-opt", "HasShortForwardBranchOpt",
18531857 "true", "Enable short forward branch optimization">;
18541858def HasShortForwardBranchOpt : Predicate<"Subtarget->hasShortForwardBranchOpt()">;
18551859def NoShortForwardBranchOpt : Predicate<"!Subtarget->hasShortForwardBranchOpt()">;
18561860
18571861def TuneShortForwardBranchIMinMax
1858- : SubtargetFeature <"short-forward-branch-i-minmax", "HasShortForwardBranchIMinMax",
1862+ : RISCVTuneFeature <"short-forward-branch-i-minmax", "HasShortForwardBranchIMinMax",
18591863 "true", "Enable short forward branch optimization for min,max instructions in Zbb",
18601864 [TuneShortForwardBranchOpt]>;
18611865
18621866def TuneShortForwardBranchIMul
1863- : SubtargetFeature <"short-forward-branch-i-mul", "HasShortForwardBranchIMul",
1867+ : RISCVTuneFeature <"short-forward-branch-i-mul", "HasShortForwardBranchIMul",
18641868 "true", "Enable short forward branch optimization for mul instruction",
18651869 [TuneShortForwardBranchOpt]>;
18661870
18671871// Some subtargets require a S2V transfer buffer to move scalars into vectors.
18681872// FIXME: Forming .vx/.vf/.wx/.wf can reduce register pressure.
18691873def TuneNoSinkSplatOperands
1870- : SubtargetFeature <"no-sink-splat-operands", "SinkSplatOperands",
1874+ : RISCVTuneFeature <"no-sink-splat-operands", "SinkSplatOperands",
18711875 "false", "Disable sink splat operands to enable .vx, .vf,"
18721876 ".wx, and .wf instructions">;
18731877
18741878def TunePreferWInst
1875- : SubtargetFeature <"prefer-w-inst", "PreferWInst", "true",
1879+ : RISCVTuneFeature <"prefer-w-inst", "PreferWInst", "true",
18761880 "Prefer instructions with W suffix">;
18771881
18781882def TuneConditionalCompressedMoveFusion
1879- : SubtargetFeature <"conditional-cmv-fusion", "HasConditionalCompressedMoveFusion",
1883+ : RISCVTuneFeature <"conditional-cmv-fusion", "HasConditionalCompressedMoveFusion",
18801884 "true", "Enable branch+c.mv fusion">;
18811885def HasConditionalMoveFusion : Predicate<"Subtarget->hasConditionalMoveFusion()">;
18821886def NoConditionalMoveFusion : Predicate<"!Subtarget->hasConditionalMoveFusion()">;
18831887
18841888def TuneHasSingleElementVecFP64
1885- : SubtargetFeature <"single-element-vec-fp64", "HasSingleElementVectorFP64", "true",
1889+ : RISCVTuneFeature <"single-element-vec-fp64", "HasSingleElementVectorFP64", "true",
18861890 "Certain vector FP64 operations produce a single result "
18871891 "element per cycle">;
18881892
@@ -1899,11 +1903,11 @@ def TuneVentanaVeyron : SubtargetFeature<"ventana-veyron", "RISCVProcFamily", "V
18991903def TuneAndes45 : SubtargetFeature<"andes45", "RISCVProcFamily", "Andes45",
19001904 "Andes 45-Series processors">;
19011905
1902- def TuneVXRMPipelineFlush : SubtargetFeature <"vxrm-pipeline-flush", "HasVXRMPipelineFlush",
1906+ def TuneVXRMPipelineFlush : RISCVTuneFeature <"vxrm-pipeline-flush", "HasVXRMPipelineFlush",
19031907 "true", "VXRM writes causes pipeline flush">;
19041908
19051909def TunePreferVsetvliOverReadVLENB
1906- : SubtargetFeature <"prefer-vsetvli-over-read-vlenb",
1910+ : RISCVTuneFeature <"prefer-vsetvli-over-read-vlenb",
19071911 "PreferVsetvliOverReadVLENB",
19081912 "true",
19091913 "Prefer vsetvli over read vlenb CSR to calculate VLEN">;
0 commit comments