diff options
| author | Yong He <yonghe@outlook.com> | 2023-02-13 10:39:12 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-13 10:39:12 -0800 |
| commit | 977eb925b7e9cb1a763c1e5563b2bc605b6476d6 (patch) | |
| tree | bf4922bdf76e9dbd25a2186c93097b30ffb57432 /tests/ir | |
| parent | 4dbc74a953ae1b34ce64a4eaef3aa7feb73663b9 (diff) | |
Eliminate `continue` to allow unrolling any loops. (#2645)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/ir')
| -rw-r--r-- | tests/ir/loop-unroll-2.slang | 23 | ||||
| -rw-r--r-- | tests/ir/loop-unroll-2.slang.expected.txt | 4 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/ir/loop-unroll-2.slang b/tests/ir/loop-unroll-2.slang new file mode 100644 index 000000000..aff227432 --- /dev/null +++ b/tests/ir/loop-unroll-2.slang @@ -0,0 +1,23 @@ +//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 sum = 0; + [ForceUnroll] + for (int i = 0; i < 2; i++) + { + [ForceUnroll(2)] + for (int j = 1; j < 3; j++) + { + if (i == 1 && j == 1) + continue; + sum += (i+j); + } + } + outputBuffer[0] = sum; +} diff --git a/tests/ir/loop-unroll-2.slang.expected.txt b/tests/ir/loop-unroll-2.slang.expected.txt new file mode 100644 index 000000000..e20d75ba3 --- /dev/null +++ b/tests/ir/loop-unroll-2.slang.expected.txt @@ -0,0 +1,4 @@ +6 +0 +0 +0 |
