[llvm] [MC] Add support for -mcpu=native. (PR #159414)
Cameron McInally via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 17 17:59:27 PDT 2025
================
@@ -467,6 +467,10 @@ int main(int argc, char **argv) {
FeaturesStr = Features.getString();
}
+ // Replace -mcpu=native with Host CPU.
+ if (MCPU == "native")
+ MCPU = std::string(llvm::sys::getHostCPUName());
+
----------------
mcinally wrote:
> Clang does use getHostCPUFeatures with -mcpu=native. I wrote the code originally. It's here.
That's `-march` now. Maybe changed when `-mcpu` was deprecated on X86.
```
$ clang test.c -mcpu=native
clang: error: unsupported option '-mcpu=' for target 'x86_64-unknown-linux-gnu'
```
https://github.com/llvm/llvm-project/pull/159414
More information about the llvm-commits
mailing list