ro created this revision. ro added reviewers: glaubitz, MaskRay, jrtc27. ro added a project: clang. Herald added subscribers: StephenFan, pengfei, fedor.sergeev, jyknight. Herald added a project: All. ro requested review of this revision.
This is the Debian/sparc64 equivalent of D86621 <https://reviews.llvm.org/D86621>: since that distro only supports SPARC V9 CPUs, it should default to `-mcpu=v9`, among others to allow inlining of atomics even in 32-bit code. Tested on `sparc64-pc-linux-gnu`, `sparcv9-sun-solaris2.11`, and `x86_64-pc-linux-gnu`. There's currently one issue, though: while this is the right thing for Debian/sparc64 (I don't think Debian/sparc which ran on non-V9 CPUs is supported any longer), it's wrong for current Linux distributions for 32-bit CPUs (LEON Linux AFAIK, there may be others). While the driver can distringuish between Debian and non-Debian distributions for that, I've found no way to do so in the testsuite. Thus, `clang/test/Preprocessor/predefined-arch-macros.c` currently `FAIL`s the `CHECK_SPARC` tests: it needs to check for `__sparc_v9__` on Debian, but keep `__sparcv8` on others. Any suggestions on how to handle this? Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D130688 Files: clang/lib/Driver/ToolChains/Arch/Sparc.cpp Index: clang/lib/Driver/ToolChains/Arch/Sparc.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/Sparc.cpp +++ clang/lib/Driver/ToolChains/Arch/Sparc.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "Sparc.h" +#include "clang/Driver/Distro.h" #include "clang/Driver/Driver.h" #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Options.h" @@ -134,7 +135,8 @@ return std::string(CPUName); } - if (Triple.getArch() == llvm::Triple::sparc && Triple.isOSSolaris()) + if (Triple.getArch() == llvm::Triple::sparc && + (Triple.isOSSolaris() || Distro(D.getVFS(), Triple).IsDebian())) return "v9"; return ""; }
Index: clang/lib/Driver/ToolChains/Arch/Sparc.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/Sparc.cpp +++ clang/lib/Driver/ToolChains/Arch/Sparc.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "Sparc.h" +#include "clang/Driver/Distro.h" #include "clang/Driver/Driver.h" #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Options.h" @@ -134,7 +135,8 @@ return std::string(CPUName); } - if (Triple.getArch() == llvm::Triple::sparc && Triple.isOSSolaris()) + if (Triple.getArch() == llvm::Triple::sparc && + (Triple.isOSSolaris() || Distro(D.getVFS(), Triple).IsDebian())) return "v9"; return ""; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits