[clang] [llvm] [LoongArch] add la v1.1 features for sys::getHostCPUFeatures (PR #115832)

Lu Weining via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 13 00:07:56 PST 2024


================
@@ -135,8 +135,13 @@ void loongarch::getLoongArchTargetFeatures(const Driver &D,
     Features.push_back("+lsx");
 
   std::string ArchName;
-  if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
+  if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
     ArchName = A->getValue();
+    if (ArchName == "native")
+      for (auto &F : llvm::sys::getHostCPUFeatures())
+        Features.push_back(
----------------
SixWeining wrote:

It changes the behavior that `-march` is not specified.

How about:
```
  std::string ArchName;
  const Arg *MArch = Args.getLastArg(options::OPT_march_EQ);
  if (MArch)
    ArchName = A->getValue();
  ArchName = postProcessTargetCPUString(ArchName, Triple);
  llvm::LoongArch::getArchFeatures(ArchName, Features);
  if (MArch->getValue() == "native")
    for(...) push_back(xxx);
```

https://github.com/llvm/llvm-project/pull/115832


More information about the cfe-commits mailing list