[PATCH] D140693: [Driver][RISCV] Adjust the priority between -mcpu, -mtune and -march
Craig Topper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 27 10:24:37 PST 2022
craig.topper added a comment.
This doesn't seem correct
What's the priority among those options for now(w/o this patch)?
Pipeline model:
Take from -mtune if present.
Take from -mcpu if present
Use the default pipeline model: generic-rv32 or generic-rv64
Architecture extension:
Take from -mcpu if present.
Take from -march if present.
Use the default architecture depending on the target triple
The code in `riscv::getRISCVArch` prioritizes -march over -mcpu for architecture extensions for setting -target-features.
But the backend still applies extensions from -target-cpu via the tablegen features from RISCV.td.
So its not even a "priority", we end up with a union.
================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:5457
+ // RISC-V will handle -mcpu option in Clang::AddRISCVTargetArgs.
+ if (!Triple.isRISCV()) {
+ // Add the target cpu
----------------
I wonder if we should stop getCPUName from calling `getRISCVTargetCPU` instead? Have you audited all callers of getCPUName?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140693/new/
https://reviews.llvm.org/D140693
More information about the cfe-commits
mailing list