Skip to content

Commit 795dd38

Browse files
committed
Renamed the options accordingly.
1 parent 00ffb5a commit 795dd38

File tree

9 files changed

+104
-104
lines changed

9 files changed

+104
-104
lines changed

clang/include/clang/Basic/FPOptions.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ OPTION(BFloat16ExcessPrecision, LangOptions::ExcessPrecisionKind, 2, Float16Exce
3030
OPTION(FPAccuracy, LangOptions::FPAccuracyKind, 3, BFloat16ExcessPrecision)
3131
OPTION(MathErrno, bool, 1, FPAccuracy)
3232
OPTION(ComplexRange, LangOptions::ComplexRangeKind, 2, MathErrno)
33-
OPTION(TargetPrecDiv, bool, 1, ComplexRange)
34-
OPTION(TargetPrecSqrt, bool, 1, TargetPrecDiv)
33+
OPTION(OffloadFp32PrecDiv, bool, 1, ComplexRange)
34+
OPTION(OffloadFp32PrecSqrt, bool, 1, OffloadFp32PrecDiv)
3535
#undef OPTION

clang/include/clang/Basic/LangOptions.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ BENIGN_ENUM_LANGOPT(FPEvalMethod, FPEvalMethodKind, 2, FEM_UnsetOnCommandLine, "
372372
ENUM_LANGOPT(Float16ExcessPrecision, ExcessPrecisionKind, 2, FPP_Standard, "Intermediate truncation behavior for Float16 arithmetic")
373373
ENUM_LANGOPT(BFloat16ExcessPrecision, ExcessPrecisionKind, 2, FPP_Standard, "Intermediate truncation behavior for BFloat16 arithmetic")
374374
BENIGN_ENUM_LANGOPT(FPAccuracy, FPAccuracyKind, 3, FPA_Default, "Accuracy for floating point operations and library functions")
375-
LANGOPT(TargetPrecDiv, 1, 1, "Return correctly rounded results of fdiv")
376-
LANGOPT(TargetPrecSqrt, 1, 1, "Return correctly rounded results of sqrt")
375+
LANGOPT(OffloadFp32PrecDiv, 1, 1, "Return correctly rounded results of fdiv")
376+
LANGOPT(OffloadFp32PrecSqrt, 1, 1, "Return correctly rounded results of sqrt")
377377
LANGOPT(NoBitFieldTypeAlign , 1, 0, "bit-field type alignment")
378378
LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility")
379379
LANGOPT(ObjCAutoRefCount , 1, 0, "Objective-C automated reference counting")

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,16 +1157,16 @@ defm cx_fortran_rules: BoolOptionWithoutMarshalling<"f", "cx-fortran-rules",
11571157
NegFlag<SetFalse, [], [ClangOption, CC1Option], "Range reduction is disabled "
11581158
"for complex arithmetic operations">>;
11591159

1160-
defm target_prec_div: BoolOption<"f", "target-prec-div",
1161-
LangOpts<"TargetPrecDiv">, DefaultTrue,
1160+
defm offload_fp32_prec_div: BoolOption<"f", "offload-fp32-prec-div",
1161+
LangOpts<"OffloadFp32PrecDiv">, DefaultTrue,
11621162
PosFlag<SetTrue, [], [ClangOption, CC1Option], "fdiv operations in offload device "
11631163
"code are required to return correctly rounded results.">,
11641164
NegFlag<SetFalse, [], [ClangOption, CC1Option], "fdiv operations in offload device "
11651165
"code are not required to return correctly rounded results.">>,
11661166
Group<f_Group>;
11671167

1168-
defm target_prec_sqrt: BoolOption<"f", "target-prec-sqrt",
1169-
LangOpts<"TargetPrecSqrt">, DefaultTrue,
1168+
defm offload_fp32_prec_sqrt: BoolOption<"f", "offload-fp32-prec-sqrt",
1169+
LangOpts<"OffloadFp32PrecSqrt">, DefaultTrue,
11701170
PosFlag<SetTrue, [], [ClangOption, CC1Option], "sqrt operations in offload device "
11711171
"code are required to return correctly rounded results.">,
11721172
NegFlag<SetFalse, [], [ClangOption, CC1Option], "sqrt operations in offload device "

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24201,8 +24201,8 @@ llvm::CallInst *CodeGenFunction::MaybeEmitFPBuiltinofFD(
2420124201
// a TU fp-accuracy requested.
2420224202
const LangOptions &LangOpts = getLangOpts();
2420324203
if (hasFuncNameRequestedFPAccuracy(Name, LangOpts) ||
24204-
!LangOpts.FPAccuracyVal.empty() || !LangOpts.TargetPrecDiv ||
24205-
!LangOpts.TargetPrecSqrt) {
24204+
!LangOpts.FPAccuracyVal.empty() || !LangOpts.OffloadFp32PrecDiv ||
24205+
!LangOpts.OffloadFp32PrecSqrt) {
2420624206
llvm::Function *Func =
2420724207
CGM.getIntrinsic(FPAccuracyIntrinsicID, IRArgs[0]->getType());
2420824208
return CreateBuiltinCallWithAttr(*this, Name, Func, ArrayRef(IRArgs),

clang/lib/CodeGen/CGCall.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,9 +1899,9 @@ void CodeGenModule::getDefaultFunctionFPAccuracyAttributes(
18991899
MD = llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
19001900
Int32Ty, convertFPAccuracyToAspect(getLangOpts().FPAccuracyVal)));
19011901
}
1902-
if (Name == "sqrt" && !getLangOpts().TargetPrecSqrt)
1902+
if (Name == "sqrt" && !getLangOpts().OffloadFp32PrecSqrt)
19031903
FPAccuracyVal = "3.0";
1904-
if (Name == "fdiv" && !getLangOpts().TargetPrecDiv)
1904+
if (Name == "fdiv" && !getLangOpts().OffloadFp32PrecDiv)
19051905
FPAccuracyVal = "2.5";
19061906
if (!FPAccuracyVal.empty())
19071907
FuncAttrs.addAttribute("fpbuiltin-max-error", FPAccuracyVal);
@@ -5804,9 +5804,9 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
58045804
const bool IsFloat32Type = FD->getReturnType()->isFloat32Type();
58055805
if (!getLangOpts().FPAccuracyFuncMap.empty() ||
58065806
!getLangOpts().FPAccuracyVal.empty() ||
5807-
(FuncName == "sqrt" && !getLangOpts().TargetPrecSqrt &&
5807+
(FuncName == "sqrt" && !getLangOpts().OffloadFp32PrecSqrt &&
58085808
IsFloat32Type) ||
5809-
(FuncName == "fdiv" && !getLangOpts().TargetPrecDiv &&
5809+
(FuncName == "fdiv" && !getLangOpts().OffloadFp32PrecDiv &&
58105810
IsFloat32Type)) {
58115811
CI = MaybeEmitFPBuiltinofFD(IRFuncTy, IRCallArgs, CalleePtr,
58125812
FD->getName(), FD->getBuiltinID());

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3006,8 +3006,8 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
30063006
LangOptions::ComplexRangeKind Range = LangOptions::ComplexRangeKind::CX_None;
30073007
std::string ComplexRangeStr = "";
30083008
std::string GccRangeComplexOption = "";
3009-
bool NoTargetPrecDiv = false;
3010-
bool NoTargetPrecSqrt = false;
3009+
bool NoOffloadFp32PrecDiv = false;
3010+
bool NoOffloadFp32PrecSqrt = false;
30113011

30123012
// Lambda to set fast-math options. This is also used by -ffp-model=fast
30133013
auto applyFastMath = [&]() {
@@ -3040,8 +3040,8 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
30403040
if (JA.isDeviceOffloading(Action::OFK_SYCL)) {
30413041
// when fp-model=fast is used the default precision for division and
30423042
// sqrt is not precise.
3043-
NoTargetPrecDiv = true;
3044-
NoTargetPrecSqrt = true;
3043+
NoOffloadFp32PrecDiv = true;
3044+
NoOffloadFp32PrecSqrt = true;
30453045
}
30463046
};
30473047

@@ -3076,18 +3076,18 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
30763076
// If this isn't an FP option skip the claim below
30773077
default: continue;
30783078

3079-
case options::OPT_ftarget_prec_div:
3080-
case options::OPT_ftarget_prec_sqrt:
3079+
case options::OPT_foffload_fp32_prec_div:
3080+
case options::OPT_foffload_fp32_prec_sqrt:
30813081
break;
3082-
case options::OPT_fno_target_prec_sqrt:
3082+
case options::OPT_fno_offload_fp32_prec_sqrt:
30833083
if (!FPAccuracy.empty())
3084-
EmitAccuracyDiag(D, JA, FPAccuracy, "-fno-target-prec-sqrt");
3085-
NoTargetPrecSqrt = true;
3084+
EmitAccuracyDiag(D, JA, FPAccuracy, "-fno-offload-fp32-prec-sqrt");
3085+
NoOffloadFp32PrecSqrt = true;
30863086
break;
3087-
case options::OPT_fno_target_prec_div:
3087+
case options::OPT_fno_offload_fp32_prec_div:
30883088
if (!FPAccuracy.empty())
3089-
EmitAccuracyDiag(D, JA, FPAccuracy, "-fno-target-prec-div");
3090-
NoTargetPrecDiv = true;
3089+
EmitAccuracyDiag(D, JA, FPAccuracy, "-fno-offload-fp32-prec-div");
3090+
NoOffloadFp32PrecDiv = true;
30913091
break;
30923092
case options::OPT_fcx_limited_range:
30933093
if (GccRangeComplexOption.empty()) {
@@ -3173,10 +3173,10 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
31733173
case options::OPT_ffp_accuracy_EQ: {
31743174
StringRef Val = A->getValue();
31753175
FPAccuracy = Val;
3176-
if (NoTargetPrecDiv)
3177-
EmitAccuracyDiag(D, JA, FPAccuracy, "-fno-target-prec-div");
3178-
if (NoTargetPrecSqrt)
3179-
EmitAccuracyDiag(D, JA, FPAccuracy, "-fno-target-prec-sqrt");
3176+
if (NoOffloadFp32PrecDiv)
3177+
EmitAccuracyDiag(D, JA, FPAccuracy, "-fno-offload-fp32-prec-div");
3178+
if (NoOffloadFp32PrecSqrt)
3179+
EmitAccuracyDiag(D, JA, FPAccuracy, "-fno-offload-fp32-prec-sqrt");
31803180
break;
31813181
}
31823182
case options::OPT_ffp_model_EQ: {
@@ -3591,14 +3591,14 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
35913591
if (Args.hasArg(options::OPT_fno_cx_fortran_rules))
35923592
CmdArgs.push_back("-fno-cx-fortran-rules");
35933593
if (JA.isDeviceOffloading(Action::OFK_SYCL)) {
3594-
if (NoTargetPrecDiv)
3595-
CmdArgs.push_back("-fno-target-prec-div");
3594+
if (NoOffloadFp32PrecDiv)
3595+
CmdArgs.push_back("-fno-offload-fp32-prec-div");
35963596
else
3597-
CmdArgs.push_back("-ftarget-prec-div");
3598-
if (NoTargetPrecSqrt)
3599-
CmdArgs.push_back("-fno-target-prec-sqrt");
3597+
CmdArgs.push_back("-foffload-fp32-prec-div");
3598+
if (NoOffloadFp32PrecSqrt)
3599+
CmdArgs.push_back("-fno-offload-fp32-prec-sqrt");
36003600
else
3601-
CmdArgs.push_back("-ftarget-prec-sqrt");
3601+
CmdArgs.push_back("-foffload-fp32-prec-sqrt");
36023602
}
36033603
}
36043604

clang/test/CodeGenSYCL/target-prec-sycl-device.cpp renamed to clang/test/CodeGenSYCL/offload-fp32-div-sqrt.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44
// RUN: %clang_cc1 %{common_opts} %s -o - \
55
// RUN: | FileCheck --check-prefix PREC-SQRT %s
66

7-
// RUN: %clang_cc1 %{common_opts} -ftarget-prec-sqrt %s -o - \
7+
// RUN: %clang_cc1 %{common_opts} -foffload-fp32-prec-sqrt %s -o - \
88
// RUN: | FileCheck --check-prefix PREC-SQRT %s
99

10-
// RUN: %clang_cc1 %{common_opts} -fno-target-prec-sqrt %s -o - \
10+
// RUN: %clang_cc1 %{common_opts} -fno-offload-fp32-prec-sqrt %s -o - \
1111
// RUN: | FileCheck --check-prefix ROUNDED-SQRT %s
1212

13-
// RUN: %clang_cc1 %{common_opts} -ftarget-prec-div %s -o - \
13+
// RUN: %clang_cc1 %{common_opts} -foffload-fp32-prec-div %s -o - \
1414
// RUN: | FileCheck --check-prefix PREC-DIV %s
1515

16-
// RUN: %clang_cc1 %{common_opts} -fno-target-prec-div %s -o - \
16+
// RUN: %clang_cc1 %{common_opts} -fno-offload-fp32-prec-div %s -o - \
1717
// RUN: | FileCheck --check-prefix ROUNDED-DIV %s
1818

19-
// RUN: %clang_cc1 %{common_opts} -ffast-math -fno-target-prec-div \
20-
// RUN: -fno-target-prec-sqrt %s -o - \
19+
// RUN: %clang_cc1 %{common_opts} -ffast-math -fno-offload-fp32-prec-div \
20+
// RUN: -fno-offload-fp32-prec-sqrt %s -o - \
2121
// RUN: | FileCheck --check-prefix ROUNDED-SQRT-FAST %s
2222

23-
// RUN: %clang_cc1 %{common_opts} -ffast-math -fno-target-prec-div \
24-
// RUN: -fno-target-prec-sqrt %s -o - \
23+
// RUN: %clang_cc1 %{common_opts} -ffast-math -fno-offload-fp32-prec-div \
24+
// RUN: -fno-offload-fp32-prec-sqrt %s -o - \
2525
// RUN: | FileCheck --check-prefix ROUNDED-DIV-FAST %s
2626

2727
#include "sycl.hpp"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// RUN: %clang -c -fsycl -### %s 2>&1 | FileCheck %s
2+
3+
// RUN: %clang -c -fsycl -foffload-fp32-prec-div -### %s 2>&1 | FileCheck %s
4+
5+
// RUN: %clang -c -fsycl -foffload-fp32-prec-sqrt -### %s 2>&1 | FileCheck %s
6+
7+
// RUN: %clang -c -fsycl -foffload-fp32-prec-div -foffload-fp32-prec-sqrt -### %s 2>&1 \
8+
// RUN: | FileCheck %s
9+
10+
// RUN: %clang -c -fsycl -foffload-fp32-prec-sqrt -foffload-fp32-prec-div -### %s 2>&1 \
11+
// RUN: | FileCheck %s
12+
13+
// RUN: %clang -c -fsycl -fno-offload-fp32-prec-div -### %s 2>&1 \
14+
// RUN: | FileCheck --check-prefix=NO_PREC_DIV %s
15+
16+
// RUN: %clang -c -fsycl -fno-offload-fp32-prec-sqrt -### %s 2>&1 \
17+
// RUN: | FileCheck --check-prefix=NO_PREC_SQRT %s
18+
19+
// RUN: %clang -c -fsycl -fno-offload-fp32-prec-div -fno-offload-fp32-prec-sqrt -### %s 2>&1\
20+
// RUN: | FileCheck --check-prefix=NO_PREC_DIV_SQRT %s
21+
22+
// RUN: %clang -c -fsycl -fno-offload-fp32-prec-sqrt -fno-offload-fp32-prec-div -### %s 2>&1\
23+
// RUN: | FileCheck --check-prefix=NO_PREC_DIV_SQRT %s
24+
25+
// RUN: %clang -c -fsycl -ffp-accuracy=high -fno-math-errno \
26+
// RUN: -fno-offload-fp32-prec-div -### %s 2>&1 \
27+
// RUN: | FileCheck %s --check-prefix=WARN-HIGH-DIV
28+
29+
// RUN: %clang -c -fsycl -fno-offload-fp32-prec-div -ffp-accuracy=high \
30+
// RUN: -fno-math-errno -### %s 2>&1 \
31+
// RUN: | FileCheck %s --check-prefix=WARN-HIGH-DIV
32+
33+
// RUN: %clang -c -fsycl -fno-offload-fp32-prec-sqrt -ffp-accuracy=high \
34+
// RUN: -fno-math-errno -### %s 2>&1 \
35+
// RUN: | FileCheck %s --check-prefix=WARN-HIGH-SQRT
36+
37+
// RUN: %clang -c -fsycl -ffp-accuracy=high -fno-math-errno \
38+
// RUN: -fno-offload-fp32-prec-sqrt -### %s 2>&1 \
39+
// RUN: | FileCheck %s --check-prefix=WARN-HIGH-SQRT
40+
41+
// RUN: %clang -c -fsycl -ffp-accuracy=low -fno-math-errno -fno-offload-fp32-prec-div \
42+
// RUN: -### %s 2>&1 | FileCheck %s --check-prefix=WARN-LOW-DIV
43+
44+
// RUN: %clang -c -fsycl -ffp-accuracy=low -fno-math-errno \
45+
// RUN: -fno-offload-fp32-prec-sqrt -### %s 2>&1 \
46+
// RUN: | FileCheck %s --check-prefix=WARN-LOW-SQRT
47+
48+
// CHECK: "-triple" "spir64{{.*}}" "-fsycl-is-device"{{.*}} "-foffload-fp32-prec-div" "-foffload-fp32-prec-sqrt"
49+
// CHECK-NOT: "-triple{{.*}}" "-fsycl-is-host"{{.*}} "-foffload-fp32-prec-div" "-foffload-fp32-prec-sqrt"
50+
// NO_PREC_DIV: "-triple" "spir64{{.*}}"{{.*}} "-fsycl-is-device"{{.*}} "-fno-offload-fp32-prec-div" "-foffload-fp32-prec-sqrt"
51+
// NO_PREC_SQRT: "-triple" "spir64{{.*}}" "-fsycl-is-device"{{.*}} "-foffload-fp32-prec-div" "-fno-offload-fp32-prec-sqrt"
52+
// NO_PREC_DIV_SQRT: "-triple" "spir64{{.*}}" "-fsycl-is-device"{{.*}} "-fno-offload-fp32-prec-div" "-fno-offload-fp32-prec-sqrt"
53+
// RUN: %clang -c -fsycl -ffp-model=fast -### %s 2>&1 | FileCheck --check-prefix=FAST %s
54+
55+
// WARN-HIGH-DIV: floating point accuracy control 'high' conflicts with explicit target precision option '-fno-offload-fp32-prec-div'
56+
// WARN-HIGH-SQRT: floating point accuracy control 'high' conflicts with explicit target precision option '-fno-offload-fp32-prec-sqrt'
57+
// WARN-LOW-DIV: floating point accuracy control 'low' conflicts with explicit target precision option '-fno-offload-fp32-prec-div'
58+
// WARN-LOW-SQRT: floating point accuracy control 'low' conflicts with explicit target precision option '-fno-offload-fp32-prec-sqrt'
59+
// FAST: "-triple" "spir64{{.*}}"{{.*}} "-fsycl-is-device"{{.*}} "-fno-offload-fp32-prec-div" "-fno-offload-fp32-prec-sqrt"
60+

clang/test/Driver/target-prec-sycl-device.cpp

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)