[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

Lu Weining via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 01:32:55 PDT 2023


SixWeining added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Arch/LoongArch.cpp:199-204
+  // Handle CPU name is 'native'.
+  if (CPU == "native") {
+    CPU = llvm::sys::getHostCPUName();
+    if (CPU == "generic")
+      CPU = llvm::LoongArch::getDefaultArch(Triple.isLoongArch64());
+  }
----------------
xen0n wrote:
> This part is identical between `-march=` and `-mtune=` handling. I'd suggest extracting out a common helper for this, or making this function generic over `options::OPT_m*_EQ` (whichever more suitable for you and the Clang maintainers; I don't have a particular preference).
Thanks. Just added.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155824/new/

https://reviews.llvm.org/D155824



More information about the cfe-commits mailing list