diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/branch-attribute.slang | 29 | ||||
| -rw-r--r-- | tests/bugs/branch-switch-attribute.slang | 24 |
2 files changed, 53 insertions, 0 deletions
diff --git a/tests/bugs/branch-attribute.slang b/tests/bugs/branch-attribute.slang new file mode 100644 index 000000000..17e30a278 --- /dev/null +++ b/tests/bugs/branch-attribute.slang @@ -0,0 +1,29 @@ +//TEST:SIMPLE(filecheck=CHECK): -target hlsl -profile cs_5_0 -entry computeMain + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +// CHECK: [branch] +// CHECK: [flatten] + +[numthreads(4, 1, 1)] +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) +{ + int idx = dispatchThreadID.x; + + int v = idx; + + [branch] + if (idx != 0) + { + ++v; + } + + [flatten] + if (idx > 2) + { + v += v; + } + + outputBuffer[dispatchThreadID.x] = v; +}
\ No newline at end of file diff --git a/tests/bugs/branch-switch-attribute.slang b/tests/bugs/branch-switch-attribute.slang new file mode 100644 index 000000000..761b80e9e --- /dev/null +++ b/tests/bugs/branch-switch-attribute.slang @@ -0,0 +1,24 @@ +//TEST:SIMPLE(filecheck=CHECK): -target hlsl -profile cs_5_0 -entry computeMain + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +// CHECK: [branch] + +[numthreads(4, 1, 1)] +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) +{ + int idx = dispatchThreadID.x; + + int v = idx; + + [branch] + switch (idx) + { + case 0: v ++; break; + case 2: v -= 7; break; + default: v--; + } + + outputBuffer[dispatchThreadID.x] = v; +}
\ No newline at end of file |
