Skip to content

Commit aab3f93

Browse files
committed
first attempt
1 parent d078ce7 commit aab3f93

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9306,6 +9306,8 @@ def dxc_validator_path_EQ : Joined<["--"], "dxv-path=">, Group<dxc_Group>,
93069306
HelpText<"DXIL validator installation path">;
93079307
def dxc_disable_validation : DXCFlag<"Vd">,
93089308
HelpText<"Disable validation">;
9309+
def dxc_gis : DXCFlag<"Gis">,
9310+
HelpText<"Enable IEEE strict mode (equivalent to -ffp-model=strict)">;
93099311
def : Option<["/", "-"], "Qembed_debug", KIND_FLAG>, Group<dxc_Group>,
93109312
Flags<[Ignored]>, Visibility<[DXCOption]>,
93119313
HelpText<"Embed PDB in shader container (ignored)">;

clang/lib/Driver/ToolChains/HLSL.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,14 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
330330
A->claim();
331331
continue;
332332
}
333+
if (A->getOption().getID() == options::OPT_dxc_gis) {
334+
// Translate -Gis into -ffp_model_EQ=strict
335+
DAL->AddSeparateArg(nullptr, Opts.getOption(options::OPT_ffp_model_EQ),
336+
"strict");
337+
A->claim();
338+
continue;
339+
}
340+
333341
DAL->append(A);
334342
}
335343

clang/test/Options/Gis.hlsl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %clang_dxc -T lib_6_4 -Gis %s 2>&1 -### | FileCheck -check-prefix=Gis %s
2+
// RUN: %clang_dxc -T lib_6_4 %s 2>&1 -### | FileCheck -check-prefix=NO_Gis %s
3+
// RUN: not %clang_dxc -T lib_6_4 /Gis gibberish -### %s 2>&1 | FileCheck -check-prefix=CHECK-ERR %s
4+
5+
// Gis: "-fmath-errno" "-ffp-contract=off" "-frounding-math" "-ffp-exception-behavior=strict" "-complex-range=full"
6+
// assert expected floating point options are present
7+
// NO_Gis-NOT: "-fmath-errno" "-ffp-contract=off" "-frounding-math" "-ffp-exception-behavior=strict" "-complex-range=full"
8+
// CHECK-ERR: error: no such file or directory: 'gibberish'
9+
float4 main(float4 a : A) : SV_TARGET
10+
{
11+
return -a.yxxx;
12+
}

0 commit comments

Comments
 (0)