diff options
Diffstat (limited to 'tests/ir')
| -rw-r--r-- | tests/ir/loop-unroll-0.slang | 19 | ||||
| -rw-r--r-- | tests/ir/loop-unroll-0.slang.expected.txt | 4 | ||||
| -rw-r--r-- | tests/ir/loop-unroll-1.slang | 25 | ||||
| -rw-r--r-- | tests/ir/loop-unroll-1.slang.expected.txt | 1 | ||||
| -rw-r--r-- | tests/ir/string-literal.slang.expected | 2 |
5 files changed, 50 insertions, 1 deletions
diff --git a/tests/ir/loop-unroll-0.slang b/tests/ir/loop-unroll-0.slang new file mode 100644 index 000000000..d97acac0e --- /dev/null +++ b/tests/ir/loop-unroll-0.slang @@ -0,0 +1,19 @@ +//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) +{ + int i = 0; + [ForceUnroll] + while (i < 5 && dispatchThreadID.x == 0) + { + if (i >= 3) + break; + outputBuffer[i] = i; + i++; + } +} diff --git a/tests/ir/loop-unroll-0.slang.expected.txt b/tests/ir/loop-unroll-0.slang.expected.txt new file mode 100644 index 000000000..d2a5eee71 --- /dev/null +++ b/tests/ir/loop-unroll-0.slang.expected.txt @@ -0,0 +1,4 @@ +0 +1 +2 +0 diff --git a/tests/ir/loop-unroll-1.slang b/tests/ir/loop-unroll-1.slang new file mode 100644 index 000000000..562cd3713 --- /dev/null +++ b/tests/ir/loop-unroll-1.slang @@ -0,0 +1,25 @@ +//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) +{ + int i = 0; + int sum = 0; + [ForceUnroll] + while (i < 2) + { + int j = 1; + [ForceUnroll(2)] + while (j < 3) + { + sum += (i+j); + j++; + } + i++; + } + outputBuffer[0] = sum; +} diff --git a/tests/ir/loop-unroll-1.slang.expected.txt b/tests/ir/loop-unroll-1.slang.expected.txt new file mode 100644 index 000000000..45a4fb75d --- /dev/null +++ b/tests/ir/loop-unroll-1.slang.expected.txt @@ -0,0 +1 @@ +8 diff --git a/tests/ir/string-literal.slang.expected b/tests/ir/string-literal.slang.expected index 48836cae6..6f414b0da 100644 --- a/tests/ir/string-literal.slang.expected +++ b/tests/ir/string-literal.slang.expected @@ -1,6 +1,7 @@ result code = 0 standard error = { ### LOWER-TO-IR: +undefined [entryPoint(6 : Int, "main", "string-literal")] [numThreads(1 : Int, 1 : Int, 1 : Int)] [export("_S3tu04mainp1puV")] @@ -13,7 +14,6 @@ block %1( return_val(void_constant) } global_hashed_string_literals("Hello \t\n\0x083 World") -undefined ### } standard output = { |
