diff options
| author | Yong He <yonghe@outlook.com> | 2022-03-18 09:35:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-18 09:35:23 -0700 |
| commit | 2e1a84add57efd9f8a50a88d0569a48ae4b6d834 (patch) | |
| tree | 3e1ce103fa75a62eb3f1efd3c832e468bc9e8aed /tests/ir | |
| parent | 42ca6758046e11451b0788092f9c95fc7f788da6 (diff) | |
Fix type truncation during SCCP. (#2163)
Diffstat (limited to 'tests/ir')
| -rw-r--r-- | tests/ir/scalar-truncate.slang | 16 | ||||
| -rw-r--r-- | tests/ir/scalar-truncate.slang.expected.txt | 4 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/ir/scalar-truncate.slang b/tests/ir/scalar-truncate.slang new file mode 100644 index 000000000..9d9d33261 --- /dev/null +++ b/tests/ir/scalar-truncate.slang @@ -0,0 +1,16 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<uint> outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + { + int16_t a = 30000; // 0x00007530 -> 0x7530 (30000) in 16-bit. + int16_t b = -200000; // 0xfffcf2c0 -> Truncated to 0xf2c0 (-3392) in 16-bit. + outputBuffer[0] = asuint((int)a); + outputBuffer[1] = asuint((int)b); + } +} diff --git a/tests/ir/scalar-truncate.slang.expected.txt b/tests/ir/scalar-truncate.slang.expected.txt new file mode 100644 index 000000000..edaa32088 --- /dev/null +++ b/tests/ir/scalar-truncate.slang.expected.txt @@ -0,0 +1,4 @@ +7530 +FFFFF2C0 +0 +0 |
