Skip to content

Commit 755d630

Browse files
committed
Addressed review comments.
1 parent 8cd6d8b commit 755d630

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,20 +1158,20 @@ defm cx_fortran_rules: BoolOptionWithoutMarshalling<"f", "cx-fortran-rules",
11581158
"for complex arithmetic operations">>;
11591159

11601160
defm offload_fp32_prec_div: BoolOption<"f", "offload-fp32-prec-div",
1161-
LangOpts<"OffloadFp32PrecDiv">, DefaultTrue,
1162-
PosFlag<SetTrue, [], [ClangOption, CC1Option], "fdiv operations in offload device "
1163-
"code are required to return correctly rounded results.">,
1164-
NegFlag<SetFalse, [], [ClangOption, CC1Option], "fdiv operations in offload device "
1165-
"code are not required to return correctly rounded results.">>,
1166-
Group<f_Group>;
1161+
LangOpts<"OffloadFp32PrecDiv">, DefaultTrue,
1162+
PosFlag<SetTrue, [], [ClangOption, CC1Option], "fdiv operations in offload device "
1163+
"code are required to return correctly rounded results.">,
1164+
NegFlag<SetFalse, [], [ClangOption, CC1Option], "fdiv operations in offload device "
1165+
"code are not required to return correctly rounded results.">>,
1166+
Group<f_Group>;
11671167

11681168
defm offload_fp32_prec_sqrt: BoolOption<"f", "offload-fp32-prec-sqrt",
1169-
LangOpts<"OffloadFp32PrecSqrt">, DefaultTrue,
1170-
PosFlag<SetTrue, [], [ClangOption, CC1Option], "sqrt operations in offload device "
1171-
"code are required to return correctly rounded results.">,
1172-
NegFlag<SetFalse, [], [ClangOption, CC1Option], "sqrt operations in offload device "
1173-
"code are not required to return correctly rounded results.">>,
1174-
Group<f_Group>;
1169+
LangOpts<"OffloadFp32PrecSqrt">, DefaultTrue,
1170+
PosFlag<SetTrue, [], [ClangOption, CC1Option], "sqrt operations in offload device "
1171+
"code are required to return correctly rounded results.">,
1172+
NegFlag<SetFalse, [], [ClangOption, CC1Option], "sqrt operations in offload device "
1173+
"code are not required to return correctly rounded results.">>,
1174+
Group<f_Group>;
11751175

11761176
// OpenCL-only Options
11771177
def cl_opt_disable : Flag<["-"], "cl-opt-disable">, Group<opencl_Group>,

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3008,6 +3008,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
30083008
std::string GccRangeComplexOption = "";
30093009
bool NoOffloadFp32PrecDiv = false;
30103010
bool NoOffloadFp32PrecSqrt = false;
3011+
bool IsDeviceOffloading = JA.isDeviceOffloading(Action::OFK_SYCL);
30113012

30123013
// Lambda to set fast-math options. This is also used by -ffp-model=fast
30133014
auto applyFastMath = [&]() {
@@ -3037,8 +3038,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
30373038
: ComplexArithmeticStr(LangOptions::ComplexRangeKind::CX_Basic));
30383039
Range = LangOptions::ComplexRangeKind::CX_Basic;
30393040
SeenUnsafeMathModeOption = true;
3040-
if (JA.isDeviceOffloading(Action::OFK_SYCL) ||
3041-
JA.isDeviceOffloading(Action::OFK_OpenMP)) {
3041+
if (IsDeviceOffloading) {
30423042
// when fp-model=fast is used the default precision for division and
30433043
// sqrt is not precise.
30443044
NoOffloadFp32PrecDiv = true;
@@ -3087,8 +3087,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
30873087
};
30883088

30893089
auto addSPIRVArgs = [&](StringRef SPIRVArg) {
3090-
if (JA.isDeviceOffloading(Action::OFK_SYCL) ||
3091-
JA.isDeviceOffloading(Action::OFK_OpenMP)) {
3090+
if (IsDeviceOffloading) {
30923091
if (!FPAccuracy.empty())
30933092
EmitAccuracyDiag(D, JA, FPAccuracy, SPIRVArg);
30943093

@@ -3621,8 +3620,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
36213620
CmdArgs.push_back("-fno-cx-limited-range");
36223621
if (Args.hasArg(options::OPT_fno_cx_fortran_rules))
36233622
CmdArgs.push_back("-fno-cx-fortran-rules");
3624-
if (JA.isDeviceOffloading(Action::OFK_SYCL) ||
3625-
JA.isDeviceOffloading(Action::OFK_OpenMP)) {
3623+
if (IsDeviceOffloading) {
36263624
if (NoOffloadFp32PrecDiv)
36273625
CmdArgs.push_back("-fno-offload-fp32-prec-div");
36283626
if (NoOffloadFp32PrecSqrt)

0 commit comments

Comments
 (0)