Skip to content

Commit 9064f10

Browse files
committed
WIP fix double/int overloads
1 parent d9d1731 commit 9064f10

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

clang/lib/Headers/hlsl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222

2323
// HLSL standard library function declarations/definitions.
2424
#include "hlsl/hlsl_alias_intrinsics.h"
25+
#include "hlsl/hlsl_intrinsics.h"
2526
#if __HLSL_VERSION <= __HLSL_202x
2627
#include "hlsl/hlsl_compat_overloads.h"
2728
#endif
28-
#include "hlsl/hlsl_intrinsics.h"
2929

3030
#if defined(__clang__)
3131
#pragma clang diagnostic pop

clang/lib/Headers/hlsl/hlsl_compat_overloads.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,19 +288,19 @@ _DXC_COMPAT_TERNARY_INTEGER_OVERLOADS(lerp)
288288

289289
// Note: calling lit_impl because calling lit directly causes infinite recursion
290290
constexpr float4 lit(double V1, double V2, double V3) {
291-
return __detail::lit_impl((float)V1, (float)V2, (float)V3);
291+
return lit((float)V1, (float)V2, (float)V3);
292292
}
293293
constexpr float4 lit(int V1, int V2, int V3) {
294-
return __detail::lit_impl((float)V1, (float)V2, (float)V3);
294+
return lit((float)V1, (float)V2, (float)V3);
295295
}
296296
constexpr float4 lit(uint V1, uint V2, uint V3) {
297-
return __detail::lit_impl((float)V1, (float)V2, (float)V3);
297+
return lit((float)V1, (float)V2, (float)V3);
298298
}
299299
constexpr float4 lit(int64_t V1, int64_t V2, int64_t V3) {
300-
return __detail::lit_impl((float)V1, (float)V2, (float)V3);
300+
return lit((float)V1, (float)V2, (float)V3);
301301
}
302302
constexpr float4 lit(uint64_t V1, uint64_t V2, uint64_t V3) {
303-
return __detail::lit_impl((float)V1, (float)V2, (float)V3);
303+
return lit((float)V1, (float)V2, (float)V3);
304304
}
305305

306306
//===----------------------------------------------------------------------===//

clang/test/CodeGenHLSL/builtins/lit-overloads.hlsl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
// RUN: FileCheck %s --check-prefixes=CHECK
44

55
// CHECK-LABEL: define linkonce_odr noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl3litEddd(
6-
// CHECK: call reassoc nnan ninf nsz arcp afn noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl8__detail8lit_implIfEEDv4_T_S2_S2_S2_(
6+
// CHECK: call reassoc nnan ninf nsz arcp afn noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl3litIfEEKNS_8__detail9enable_ifIXaasr8__detail13is_arithmeticIT_EE5Valuesr8__detail7is_sameIfS3_EE5valueEDv4_S3_E4TypeES3_S3_S3_(
77
float4 test_lit_double(double NDotL, double NDotH, double M) { return lit(NDotL, NDotH, M); }
88

99
// CHECK-LABEL: define linkonce_odr noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl3litEiii(
10-
// CHECK: call reassoc nnan ninf nsz arcp afn noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl8__detail8lit_implIfEEDv4_T_S2_S2_S2_(
10+
// CHECK: call reassoc nnan ninf nsz arcp afn noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl3litIfEEKNS_8__detail9enable_ifIXaasr8__detail13is_arithmeticIT_EE5Valuesr8__detail7is_sameIfS3_EE5valueEDv4_S3_E4TypeES3_S3_S3_(
1111
float4 test_lit_int(int NDotL, int NDotH, int M) { return lit(NDotL, NDotH, M); }
1212

1313
// CHECK-LABEL: define linkonce_odr noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl3litEjjj(
14-
// CHECK: call reassoc nnan ninf nsz arcp afn noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl8__detail8lit_implIfEEDv4_T_S2_S2_S2_(
14+
// CHECK: call reassoc nnan ninf nsz arcp afn noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl3litIfEEKNS_8__detail9enable_ifIXaasr8__detail13is_arithmeticIT_EE5Valuesr8__detail7is_sameIfS3_EE5valueEDv4_S3_E4TypeES3_S3_S3_(
1515
float4 test_lit_uint(uint NDotL, uint NDotH, uint M) { return lit(NDotL, NDotH, M); }
1616

1717
// CHECK-LABEL: define linkonce_odr noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl3litElll(
18-
// CHECK: call reassoc nnan ninf nsz arcp afn noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl8__detail8lit_implIfEEDv4_T_S2_S2_S2_(
18+
// CHECK: call reassoc nnan ninf nsz arcp afn noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl3litIfEEKNS_8__detail9enable_ifIXaasr8__detail13is_arithmeticIT_EE5Valuesr8__detail7is_sameIfS3_EE5valueEDv4_S3_E4TypeES3_S3_S3_(
1919
float4 test_lit_int64_t(int64_t NDotL, int64_t NDotH, int64_t M) { return lit(NDotL, NDotH, M); }
2020

2121
// CHECK-LABEL: define linkonce_odr noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl3litEmmm(
22-
// CHECK: call reassoc nnan ninf nsz arcp afn noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl8__detail8lit_implIfEEDv4_T_S2_S2_S2_(
22+
// CHECK: call reassoc nnan ninf nsz arcp afn noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl3litIfEEKNS_8__detail9enable_ifIXaasr8__detail13is_arithmeticIT_EE5Valuesr8__detail7is_sameIfS3_EE5valueEDv4_S3_E4TypeES3_S3_S3_(
2323
float4 test_lit_uint64_t(uint64_t NDotL, uint64_t NDotH, uint64_t M) { return lit(NDotL, NDotH, M); }

clang/test/SemaHLSL/BuiltIns/lit-errors.hlsl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ float4 test_too_many_arg(float p0) {
3636
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not viable: requires 3 arguments, but 4 were provided}}
3737
}
3838

39-
// float4 test_vec_inputs(float2 p0, float2 p1, float2 p2) {
40-
// return lit(p0, p1, p2);
41-
// // expected-error@-1 {{no matching function for call to 'lit'}}
42-
// // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float2]: invalid vector element type 'vector<float, 2>' (vector of 2 'float' values)}}
43-
// // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float2]: invalid vector element type 'vector<float, 2>' (vector of 2 'float' values)}}
44-
// }
39+
float4 test_vec_inputs(float2 p0, float2 p1, float2 p2) {
40+
return lit(p0, p1, p2);
41+
// expected-error@-1 {{no matching function for call to 'lit'}}
42+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float2]: invalid vector element type 'vector<float, 2>' (vector of 2 'float' values)}}
43+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float2]: invalid vector element type 'vector<float, 2>' (vector of 2 'float' values)}}
44+
}
4545

46-
// float4 test_vec1_inputs(float1 p0, float1 p1, float1 p2) {
47-
// return lit(p0, p1, p2);
48-
// // expected-error@-1 {{no matching function for call to 'lit'}}
49-
// // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float1]: invalid vector element type 'vector<float, 1>' (vector of 1 'float' value)}}
50-
// // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float1]: invalid vector element type 'vector<float, 1>' (vector of 1 'float' value)}}
51-
// }
46+
float4 test_vec1_inputs(float1 p0, float1 p1, float1 p2) {
47+
return lit(p0, p1, p2);
48+
// expected-error@-1 {{no matching function for call to 'lit'}}
49+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float1]: invalid vector element type 'vector<float, 1>' (vector of 1 'float' value)}}
50+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float1]: invalid vector element type 'vector<float, 1>' (vector of 1 'float' value)}}
51+
}

0 commit comments

Comments
 (0)