Skip to content

Commit 70dd63b

Browse files
authored
[RISCV] Move tuning features below non-tuning features. Put CPU family in their own section. NFC (llvm#170352)
We had 4 features after all the tuning features, but there didn't seem to be particular reason for it. Put the CPU family tuning features in their own section after the tuning features instead of in the middle.
1 parent 9383246 commit 70dd63b

File tree

1 file changed

+54
-45
lines changed

1 file changed

+54
-45
lines changed

llvm/lib/Target/RISCV/RISCVFeatures.td

Lines changed: 54 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,45 @@ def FeatureUnalignedVectorMem
17911791
"true", "Has reasonably performant unaligned vector "
17921792
"loads and stores">;
17931793

1794+
// Assume that lock-free native-width atomics are available, even if the target
1795+
// and operating system combination would not usually provide them. The user
1796+
// is responsible for providing any necessary __sync implementations. Code
1797+
// built with this feature is not ABI-compatible with code built without this
1798+
// feature, if atomic variables are exposed across the ABI boundary.
1799+
def FeatureForcedAtomics : SubtargetFeature<
1800+
"forced-atomics", "HasForcedAtomics", "true",
1801+
"Assume that lock-free native-width atomics are available">;
1802+
def HasAtomicLdSt
1803+
: Predicate<"Subtarget->hasStdExtZalrsc() || Subtarget->hasForcedAtomics()">;
1804+
1805+
// The RISC-V Unprivileged Architecture - ISA Volume 1 (Version: 20250508)
1806+
// [https://docs.riscv.org/reference/isa/_attachments/riscv-unprivileged.pdf]
1807+
// in section 13.3. Eventual Success of Store-Conditional Instructions, defines
1808+
// _constrained_ LR/SC loops:
1809+
// The dynamic code executed between the LR and SC instructions can only
1810+
// contain instructions from the base ''I'' instruction set, excluding loads,
1811+
// stores, backward jumps, taken backward branches, JALR, FENCE, and SYSTEM
1812+
// instructions. Compressed forms of the aforementioned ''I'' instructions in
1813+
// the Zca and Zcb extensions are also permitted.
1814+
// LR/SC loops that do not adhere to the above are _unconstrained_ LR/SC loops,
1815+
// and success is implementation specific. For implementations which know that
1816+
// non-base instructions (such as the ''B'' extension) will not violate any
1817+
// forward progress guarantees, using these instructions to reduce the LR/SC
1818+
// sequence length is desirable.
1819+
def FeaturePermissiveZalrsc
1820+
: SubtargetFeature<
1821+
"permissive-zalrsc", "HasPermissiveZalrsc", "true",
1822+
"Implementation permits non-base instructions between LR/SC pairs">;
1823+
1824+
def FeatureTaggedGlobals : SubtargetFeature<"tagged-globals",
1825+
"AllowTaggedGlobals",
1826+
"true", "Use an instruction sequence for taking the address of a global "
1827+
"that allows a memory tag in the upper address bits">;
1828+
1829+
//===----------------------------------------------------------------------===//
1830+
// Tuning features
1831+
//===----------------------------------------------------------------------===//
1832+
17941833
def TuneNLogNVRGather
17951834
: SubtargetFeature<"log-vrgather", "RISCVVRGatherCostModel", "NLog2N",
17961835
"Has vrgather.vv with LMUL*log2(LMUL) latency">;
@@ -1911,19 +1950,6 @@ def TuneHasSingleElementVecFP64
19111950
"Certain vector FP64 operations produce a single result "
19121951
"element per cycle">;
19131952

1914-
def TuneMIPSP8700
1915-
: SubtargetFeature<"mips-p8700", "RISCVProcFamily", "MIPSP8700",
1916-
"MIPS p8700 processor">;
1917-
1918-
def TuneSiFive7 : SubtargetFeature<"sifive7", "RISCVProcFamily", "SiFive7",
1919-
"SiFive 7-Series processors">;
1920-
1921-
def TuneVentanaVeyron : SubtargetFeature<"ventana-veyron", "RISCVProcFamily", "VentanaVeyron",
1922-
"Ventana Veyron-Series processors">;
1923-
1924-
def TuneAndes45 : SubtargetFeature<"andes45", "RISCVProcFamily", "Andes45",
1925-
"Andes 45-Series processors">;
1926-
19271953
def TuneVXRMPipelineFlush : SubtargetFeature<"vxrm-pipeline-flush", "HasVXRMPipelineFlush",
19281954
"true", "VXRM writes causes pipeline flush">;
19291955

@@ -1933,37 +1959,20 @@ def TunePreferVsetvliOverReadVLENB
19331959
"true",
19341960
"Prefer vsetvli over read vlenb CSR to calculate VLEN">;
19351961

1936-
// Assume that lock-free native-width atomics are available, even if the target
1937-
// and operating system combination would not usually provide them. The user
1938-
// is responsible for providing any necessary __sync implementations. Code
1939-
// built with this feature is not ABI-compatible with code built without this
1940-
// feature, if atomic variables are exposed across the ABI boundary.
1941-
def FeatureForcedAtomics : SubtargetFeature<
1942-
"forced-atomics", "HasForcedAtomics", "true",
1943-
"Assume that lock-free native-width atomics are available">;
1944-
def HasAtomicLdSt
1945-
: Predicate<"Subtarget->hasStdExtZalrsc() || Subtarget->hasForcedAtomics()">;
1962+
//===----------------------------------------------------------------------===//
1963+
// CPU Families (alphabetized by vendor).
1964+
//===----------------------------------------------------------------------===//
19461965

1947-
// The RISC-V Unprivileged Architecture - ISA Volume 1 (Version: 20250508)
1948-
// [https://docs.riscv.org/reference/isa/_attachments/riscv-unprivileged.pdf]
1949-
// in section 13.3. Eventual Success of Store-Conditional Instructions, defines
1950-
// _constrained_ LR/SC loops:
1951-
// The dynamic code executed between the LR and SC instructions can only
1952-
// contain instructions from the base ''I'' instruction set, excluding loads,
1953-
// stores, backward jumps, taken backward branches, JALR, FENCE, and SYSTEM
1954-
// instructions. Compressed forms of the aforementioned ''I'' instructions in
1955-
// the Zca and Zcb extensions are also permitted.
1956-
// LR/SC loops that do not adhere to the above are _unconstrained_ LR/SC loops,
1957-
// and success is implementation specific. For implementations which know that
1958-
// non-base instructions (such as the ''B'' extension) will not violate any
1959-
// forward progress guarantees, using these instructions to reduce the LR/SC
1960-
// sequence length is desirable.
1961-
def FeaturePermissiveZalrsc
1962-
: SubtargetFeature<
1963-
"permissive-zalrsc", "HasPermissiveZalrsc", "true",
1964-
"Implementation permits non-base instructions between LR/SC pairs">;
1966+
def TuneAndes45 : SubtargetFeature<"andes45", "RISCVProcFamily", "Andes45",
1967+
"Andes 45-Series processors">;
1968+
1969+
def TuneMIPSP8700
1970+
: SubtargetFeature<"mips-p8700", "RISCVProcFamily", "MIPSP8700",
1971+
"MIPS p8700 processor">;
1972+
1973+
def TuneSiFive7 : SubtargetFeature<"sifive7", "RISCVProcFamily", "SiFive7",
1974+
"SiFive 7-Series processors">;
1975+
1976+
def TuneVentanaVeyron : SubtargetFeature<"ventana-veyron", "RISCVProcFamily", "VentanaVeyron",
1977+
"Ventana Veyron-Series processors">;
19651978

1966-
def FeatureTaggedGlobals : SubtargetFeature<"tagged-globals",
1967-
"AllowTaggedGlobals",
1968-
"true", "Use an instruction sequence for taking the address of a global "
1969-
"that allows a memory tag in the upper address bits">;

0 commit comments

Comments
 (0)