[clang] [SPARC][clang] Add -m(no-)v8plus flags handling (PR #98713)

Sergei Barannikov via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 31 08:12:46 PDT 2024


================
@@ -179,6 +179,13 @@ void sparc::getSparcTargetFeatures(const Driver &D, const ArgList &Args,
       Features.push_back("-hard-quad-float");
   }
 
+  if (Arg *A = Args.getLastArg(options::OPT_mv8plus, options::OPT_mno_v8plus)) {
+    if (A->getOption().matches(options::OPT_mv8plus))
----------------
s-barannikov wrote:

> on GCC, `-m[no-]v8plus` also implies that V9 instructions are available (or not, in case of `-mno-v8plus`)

Well, no. Not exactly. Whether or not V9 instructions are available is determined strictly by `-mcpu=v9` (which is the default). In both cases by the first godbolt link instructions are V9 instructions and operate on 64-bit registers.
The thing is, you can't use the upper half of these registers, which makes instructions such as MULX useless. There are, however, other instructions introduced in V9 that are useful -- 32-bit atomics for instance.

Also note that `-mno-v8plus` is the default and passing it explicitly won't change the behavior (unless you specified `-mv8plus` prior to it).


https://github.com/llvm/llvm-project/pull/98713


More information about the cfe-commits mailing list