diff options
Diffstat (limited to 'tests')
| -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 |
