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

Lu Weining via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 20 19:31:08 PDT 2023


SixWeining added a comment.

> In GCC I added the numbers for "loongarch64" and "la464" although they are the same, and GCC does not have "empty".  But yes we can do things later here.

Ah, I just realize `TuneCPU` is always not empty because:

  27 LoongArchSubtarget &LoongArchSubtarget::initializeSubtargetDependencies(
  28     const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS,
  29     StringRef ABIName) {
  30   bool Is64Bit = TT.isArch64Bit();
  31   if (CPU.empty() || CPU == "generic")
  32     CPU = Is64Bit ? "generic-la64" : "generic-la32"; // empty CPU will be converted to generic-la{64,32}
  33 
  34   if (TuneCPU.empty())
  35     TuneCPU = CPU; // empty TuneCPU will be converted to CPU, so TuneCPU is not empty when we all initializeProperties below
  36 
  37   ParseSubtargetFeatures(CPU, TuneCPU, FS);
  38   initializeProperties(TuneCPU);

So, the problem is how to set numbers for `generic-la{64,32}` ? Currenly if we directly use `clang hello.c`, `TuneCPU` is `generic-la64`.


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