diff options
| author | Yong He <yonghe@outlook.com> | 2023-09-07 23:01:53 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-07 23:01:53 -0700 |
| commit | cb5dd19992fb77ca2be866d9c6f2f4436c8b1c1e (patch) | |
| tree | 4a24573f9da79618c0e65e7462101ab3d0b640c4 /tests/language-feature | |
| parent | a7fa215e81e510de34ac96778ac6320cbb642d64 (diff) | |
Incur l-value conversion cost during overload resolution. (#3195)
* Incur l-value conversion cost during overload resolution.
* Fix compile error.
* cleanup.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/language-feature')
| -rw-r--r-- | tests/language-feature/overload-resolution.slang | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/language-feature/overload-resolution.slang b/tests/language-feature/overload-resolution.slang new file mode 100644 index 000000000..9c135137a --- /dev/null +++ b/tests/language-feature/overload-resolution.slang @@ -0,0 +1,45 @@ +//TEST:SIMPLE(filecheck=CHECK): -target hlsl -stage compute -entry main +RWStructuredBuffer<float> result; + +[ForceInline] +float myF(inout int a, int b) +{ + return a + b; +} + +[ForceInline] +float myF(inout uint a, uint b) +{ + return a - b; +} + +[ForceInline] +T myGenF<T : __BuiltinIntegerType>(inout T a, T b) +{ + if (__isSignedInt<T>()) + { + return a + b; + } + else + { + return a - b; + } +} +// CHECK: result{{.*}}[0{{U?}}] = 1 +// CHECK: result{{.*}}[1{{U?}}] = 4 +// CHECK: result{{.*}}[2{{U?}}] = 1 +// CHECK: result{{.*}}[3{{U?}}] = 4 +[numthreads(1,1,1)] +void main() +{ + int ic = 1; + uint a = 2; + result[0] = myF(a, ic); + + int b = 3; + uint uc = 1; + result[1] = myF(b, uc); + + result[2] = myGenF(a, ic); + result[3] = myGenF(b, uc); +}
\ No newline at end of file |
