[PATCH] D86621: [clang][Sparc] Default to -mcpu=v9 for SparcV8 on Solaris

Rainer Orth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 05:37:10 PDT 2020


ro added a comment.

In D86621#2249240 <https://reviews.llvm.org/D86621#2249240>, @jrtc27 wrote:

> Actually, `__sparcv8` is only for V8; if you have 32-bit V9 on Solaris it defines `__sparcv8plus` _instead_:
>
>   jrtc27 at gcc-solaris11:~$ /opt/solarisstudio12.4/bin/cc -E - -xarch=v9 -m32 -xdumpmacros </dev/null 2>&1 | grep sparc
>   #define __sparcv8plus 1
>   #define __sparc 1
>   #define sparc 1

That's only true up to Studio 12.4: 12.5 and 12.6 define both `__sparcv8` and `__sparcv8plus`, and strangely even the 12.4 and 12.3 `cc(1)` man pages only documents `__sparcv8` while 12.2 only has `__sparc`.  We could also define `__sparcv8plus`, but `gcc` doesn't do that, so it would only help people compiling with `cc`.

> In fact, -xarch=v9 + -m32 is a bit weird because -xarch=v9 implies -m64 so the argument order matters, and the modern way to do it is (if you read the man page, -xarch=sparc means V9 and -xarch=v9 is an alias for -m64 -xarch=sparc...):

Right; 12.5 and 12.6 `cc` even warn

  cc: Warning: -xarch=v9 is deprecated, use -m64 -xarch=sparc instead



>   jrtc27 at gcc-solaris11:~$ /opt/solarisstudio12.4/bin/cc -E - -m32 -xarch=sparc -xdumpmacros </dev/null 2>&1 | grep sparc
>   #define __sparcv8plus 1
>   #define __sparc 1
>   #define sparc 1
>
> (gcc211 on the GCC compile farm; any open-source developer can register, it's not specific to GCC developers despite the name)

I do have a cfarm account already.  However, there's no need for that: I do have every version of Studio back to 11 installed locally.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86621



More information about the cfe-commits mailing list