[llvm] [RISCV] Convert -mtune=generic to generic-rv32/rv64 in RISCVSubtarget::initializeSubtargetDependencies. (PR #168612)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 18 13:59:39 PST 2025
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/168612
The "generic" entry in tablegen is really a dummy entry. We shouldn't use it for anything. Remap "generic" to either generic-rv32 or generic-rv64 based on the triple.
>From 3581ad99de657213227752c1526e419762fba9bd Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Tue, 18 Nov 2025 13:57:49 -0800
Subject: [PATCH] [RISCV] Convert -mtune=generic to generic-rv32/rv64 in
RISCVSubtarget::initializeSubtargetDependencies.
The "generic" entry in tablegen is really a dummy entry. We shouldn't
use it for anything. Remap "generic" to either generic-rv32 or
generic-rv64 based on the triple.
---
llvm/lib/Target/RISCV/RISCVSubtarget.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/llvm/lib/Target/RISCV/RISCVSubtarget.cpp b/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
index 926cc9ea547a6..f86265a21d17e 100644
--- a/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
+++ b/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
@@ -88,6 +88,8 @@ RISCVSubtarget::initializeSubtargetDependencies(const Triple &TT, StringRef CPU,
if (TuneCPU.empty())
TuneCPU = CPU;
+ if (TuneCPU == "generic")
+ TuneCPU = Is64Bit ? "generic-rv64" : "generic-rv32";
TuneInfo = RISCVTuneInfoTable::getRISCVTuneInfo(TuneCPU);
// If there is no TuneInfo for this CPU, we fail back to generic.
More information about the llvm-commits
mailing list