Skip to content

Commit 1e44e7a

Browse files
authored
[Sparc] Add flags to enable errata workaround pass for GR712RC and UT700 (#104742)
This adds the flags -mfix-gr712rc and -mfix-ut700 which enables the necessary errata workarounds for the GR712RC and UT700 processors. The functionality enabled by the flags is the same as the functionality provided by the corresponding GCC flags.
1 parent 1b664fe commit 1e44e7a

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6155,6 +6155,10 @@ def mv8plus : Flag<["-"], "mv8plus">, Group<m_sparc_Features_Group>,
61556155
HelpText<"Enable V8+ mode, allowing use of 64-bit V9 instructions in 32-bit code">;
61566156
def mno_v8plus : Flag<["-"], "mno-v8plus">, Group<m_sparc_Features_Group>,
61576157
HelpText<"Disable V8+ mode">;
6158+
def mfix_gr712rc : Flag<["-"], "mfix-gr712rc">, Group<m_sparc_Features_Group>,
6159+
HelpText<"Enable workarounds for GR712RC errata">;
6160+
def mfix_ut700 : Flag<["-"], "mfix-ut700">, Group<m_sparc_Features_Group>,
6161+
HelpText<"Enable workarounds for UT700 errata">;
61586162
foreach i = 1 ... 7 in
61596163
def ffixed_g#i : Flag<["-"], "ffixed-g"#i>, Group<m_sparc_Features_Group>,
61606164
HelpText<"Reserve the G"#i#" register (SPARC only)">;

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,17 @@ void sparc::getSparcTargetFeatures(const Driver &D, const ArgList &Args,
264264

265265
if (Args.hasArg(options::OPT_ffixed_i5))
266266
Features.push_back("+reserve-i5");
267+
268+
if (Args.hasArg(options::OPT_mfix_gr712rc)) {
269+
Features.push_back("+fix-tn0009");
270+
Features.push_back("+fix-tn0011");
271+
Features.push_back("+fix-tn0012");
272+
Features.push_back("+fix-tn0013");
273+
}
274+
275+
if (Args.hasArg(options::OPT_mfix_ut700)) {
276+
Features.push_back("+fix-tn0009");
277+
Features.push_back("+fix-tn0010");
278+
Features.push_back("+fix-tn0013");
279+
}
267280
}

clang/test/Driver/sparc-fix.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %clang --target=sparc -mfix-gr712rc -### %s 2>&1 | FileCheck --check-prefix=GR712RC %s
2+
// GR712RC: "-target-feature" "+fix-tn0009" "-target-feature" "+fix-tn0011" "-target-feature" "+fix-tn0012" "-target-feature" "+fix-tn0013"
3+
4+
// RUN: %clang --target=sparc -mfix-ut700 -### %s 2>&1 | FileCheck --check-prefix=UT700 %s
5+
// UT700: "-target-feature" "+fix-tn0009" "-target-feature" "+fix-tn0010" "-target-feature" "+fix-tn0013"

0 commit comments

Comments
 (0)