Skip to content

Commit ffe931e

Browse files
authored
Enable 2021 operator intrinsics in older modes (microsoft#4882)
This enables the `select`, `and`, and `or` intrinsics in older HLSL language modes to ease transitioning to HLSL 2021.
1 parent e7aac8e commit ffe931e

File tree

4 files changed

+3
-12
lines changed

4 files changed

+3
-12
lines changed

tools/clang/lib/Sema/SemaHLSL.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4783,18 +4783,6 @@ class HLSLExternalSource : public ExternalSemaSource {
47834783
pIntrinsic->uNumArgs <= g_MaxIntrinsicParamCount + 1,
47844784
"otherwise g_MaxIntrinsicParamCount needs to be updated for wider signatures");
47854785

4786-
// Some intrinsics only optionally exist in later language versions.
4787-
// To prevent collisions with existing functions or templates, exclude
4788-
// intrinsics when they aren't enabled.
4789-
if (IsBuiltinTable(tableName) &&
4790-
m_sema->getLangOpts().HLSLVersion < hlsl::LangStd::v2021) {
4791-
if (pIntrinsic->Op == (UINT)IntrinsicOp::IOP_and ||
4792-
pIntrinsic->Op == (UINT)IntrinsicOp::IOP_or ||
4793-
pIntrinsic->Op == (UINT)IntrinsicOp::IOP_select) {
4794-
continue;
4795-
}
4796-
}
4797-
47984786
std::vector<QualType> functionArgTypes;
47994787
size_t badArgIdx;
48004788
bool argsMatch = MatchArguments(cursor, QualType(), QualType(), Args, &functionArgTypes, badArgIdx);

tools/clang/test/CodeGenSPIRV/intrinsics.and.hlsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %dxc -T ps_6_0 -E main -HV 2021
2+
// RUN: %dxc -T ps_6_0 -E main -HV 2018
23

34
void main() {
45
// CHECK-LABEL: %bb_entry = OpLabel

tools/clang/test/CodeGenSPIRV/intrinsics.or.hlsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %dxc -T ps_6_0 -E main -HV 2021
2+
// RUN: %dxc -T ps_6_0 -E main -HV 2018
23

34
void main() {
45
// CHECK-LABEL: %bb_entry = OpLabel

tools/clang/test/CodeGenSPIRV/intrinsics.select.hlsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %dxc -T ps_6_0 -E main -HV 2021
2+
// RUN: %dxc -T ps_6_0 -E main -HV 2018
23

34
// CHECK: [[v3i0:%\d+]] = OpConstantComposite %v3int %int_0 %int_0 %int_0
45

0 commit comments

Comments
 (0)