[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 02:34:00 PDT 2020


ro added a comment.

In D86621#2247786 <https://reviews.llvm.org/D86621#2247786>, @efriedma wrote:

> 



> For compiler-rt, the XFAILs should probably reflect whatever config the bot is running.  (Alternatively, you could use UNSUPPORTED, but that doesn't seem warranted here.)

That's been my guess, too (with the goal of getting the bot green eventually in mind).  Once the underlying `clang` bug is fixed, the tests will pass with both compilers, so I agree that `UNSUPPORTED` isn't warranted here.



================
Comment at: clang/lib/Basic/Targets/Sparc.cpp:224
+    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
+  }
 }
----------------
efriedma wrote:
> This probably should be refactored so the target-independent code generates it based on MaxAtomicInlineWidth, instead of duplicating it for each target.  But I guess you don't need to do that here.
> 
> From the other code, the `getCPUGeneration(CPU) == CG_V9` check should only guard the definition of __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8?
> This probably should be refactored so the target-independent code generates it based on MaxAtomicInlineWidth, instead of duplicating it for each target.  But I guess you don't need to do that here.

Good: one issue at a time ;-)

> From the other code, the `getCPUGeneration(CPU) == CG_V9` check should only guard the definition of __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8?

I don't think so: at least `gcc` defines none of the four with `-m32 -mcpu=v8` and all with `-m32 -mcpu=v9`.


================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:350
       return A->getValue();
+    if (T.getArch() == llvm::Triple::sparc && T.isOSSolaris())
+      return "v9";
----------------
efriedma wrote:
> Do we want to make sparc and sparcel behave differently here?
The only thing about little-endian SPARC is that UltraSPARC CPUs can be run in little-endian  mode, presumably to ease a Windows NT port that never materialized.

I could barely find any info on sparcel: the triplet isn't in `config.guess`, there's very little else about such CPUs and certainly no specification or even an ABI. That's why I tend to leave sparcel-specific code alone unless someone who knows these beasts tells me otherwise.

What I can say for certain that Solaris never ran on little-endian SPARC.


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