Skip to content

Commit 6c270a8

Browse files
authored
[SPARC][Driver] Add -m(no-)v8plus flags handling (#98713)
Implement handling for `-m(no-)v8plus` flags to allow the user to switch between V8 and V8+ mode with 32-bit code. Currently it only toggles the V8+ feature bit, ABI and codegen changes will be done in future patches.
1 parent 9e0ee0e commit 6c270a8

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

clang/include/clang/Driver/Options.td

+4
Original file line numberDiff line numberDiff line change
@@ -6149,6 +6149,10 @@ def mvis3 : Flag<["-"], "mvis3">, Group<m_sparc_Features_Group>;
61496149
def mno_vis3 : Flag<["-"], "mno-vis3">, Group<m_sparc_Features_Group>;
61506150
def mhard_quad_float : Flag<["-"], "mhard-quad-float">, Group<m_sparc_Features_Group>;
61516151
def msoft_quad_float : Flag<["-"], "msoft-quad-float">, Group<m_sparc_Features_Group>;
6152+
def mv8plus : Flag<["-"], "mv8plus">, Group<m_sparc_Features_Group>,
6153+
HelpText<"Enable V8+ mode, allowing use of 64-bit V9 instructions in 32-bit code">;
6154+
def mno_v8plus : Flag<["-"], "mno-v8plus">, Group<m_sparc_Features_Group>,
6155+
HelpText<"Disable V8+ mode">;
61526156
foreach i = 1 ... 7 in
61536157
def ffixed_g#i : Flag<["-"], "ffixed-g"#i>, Group<m_sparc_Features_Group>,
61546158
HelpText<"Reserve the G"#i#" register (SPARC only)">;

clang/lib/Driver/ToolChains/Arch/Sparc.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ void sparc::getSparcTargetFeatures(const Driver &D, const ArgList &Args,
179179
Features.push_back("-hard-quad-float");
180180
}
181181

182+
if (Arg *A = Args.getLastArg(options::OPT_mv8plus, options::OPT_mno_v8plus)) {
183+
if (A->getOption().matches(options::OPT_mv8plus))
184+
Features.push_back("+v8plus");
185+
}
186+
182187
if (Args.hasArg(options::OPT_ffixed_g1))
183188
Features.push_back("+reserve-g1");
184189

clang/test/Driver/sparc-target-features.c

+3
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@
3232
// RUN: %clang --target=sparc -msoft-quad-float %s -### 2>&1 | FileCheck -check-prefix=SOFT-QUAD-FLOAT %s
3333
// HARD-QUAD-FLOAT: "-target-feature" "+hard-quad-float"
3434
// SOFT-QUAD-FLOAT: "-target-feature" "-hard-quad-float"
35+
36+
// RUN: %clang --target=sparc -mv8plus %s -### 2>&1 | FileCheck -check-prefix=V8PLUS %s
37+
// V8PLUS: "-target-feature" "+v8plus"

0 commit comments

Comments
 (0)