[Driver][Sparc] Default to -mcpu=v9 for 32-bit Linux/sparc64 (#109278)

While working on supporting PR #109101 on Linux/sparc64, I was reminded
that `clang -m32` still defaults to generating V8 code, although the
64-bit kernel requires a V9 CPU.

This patch corrects that.

Tested on `sparc64-unknown-linux-gnu`, `x86_64-pc-linux-gnu`,
`sparcv9-sun-solaris2.11`, and `amd64-pc-solaris2.11`.
This commit is contained in:
Rainer Orth
2024-09-21 19:53:35 +02:00
committed by GitHub
parent 9b7a22ebb5
commit 39e30508a7
3 changed files with 9 additions and 2 deletions

View File

@@ -39,6 +39,11 @@ code bases.
- The ``le32`` and ``le64`` targets have been removed.
- ``clang -m32`` defaults to ``-mcpu=v9`` on SPARC Linux now. Distros
still supporting SPARC V8 CPUs need to specify ``-mcpu=v8`` with a
`config file
<https://clang.llvm.org/docs/UsersManual.html#configuration-files>`_.
- The ``clang-rename`` tool has been removed.
C/C++ Language Potentially Breaking Changes

View File

@@ -125,7 +125,8 @@ std::string sparc::getSparcTargetCPU(const Driver &D, const ArgList &Args,
return std::string(CPUName);
}
if (Triple.getArch() == llvm::Triple::sparc && Triple.isOSSolaris())
if (Triple.getArch() == llvm::Triple::sparc &&
(Triple.isOSSolaris() || Triple.isOSLinux()))
return "v9";
return "";
}

View File

@@ -4137,7 +4137,8 @@
// CHECK_SPARC: #define __sparc__ 1
// CHECK_SPARC-NOT: #define __sparcv9 1
// CHECK_SPARC-NOT: #define __sparcv9__ 1
// CHECK_SPARC: #define __sparcv8 1
// CHECK_SPARC: #define __sparc_v9__ 1
// CHECK_SPARC-NOT: #define __sparcv8 1
// CHECK_SPARC-NOT: #define __sparcv9 1
// CHECK_SPARC-NOT: #define __sparcv9__ 1