dan sinclair | 2e2bf67 | 2023-11-23 17:28:28 +0000 | [diff] [blame] | 1 | #include <metal_stdlib> |
| 2 | using namespace metal; |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 3 | |
James Price | 73fd374 | 2024-09-03 20:31:37 +0000 | [diff] [blame] | 4 | #define TINT_ISOLATE_UB(VOLATILE_NAME) \ |
| 5 | volatile bool VOLATILE_NAME = true; \ |
| 6 | if (VOLATILE_NAME) |
| 7 | |
dan sinclair | 2e2bf67 | 2023-11-23 17:28:28 +0000 | [diff] [blame] | 8 | kernel void f() { |
| 9 | { |
| 10 | int i = 0; |
James Price | 73fd374 | 2024-09-03 20:31:37 +0000 | [diff] [blame] | 11 | TINT_ISOLATE_UB(tint_volatile_true) while(true) { |
dan sinclair | 2e2bf67 | 2023-11-23 17:28:28 +0000 | [diff] [blame] | 12 | if ((i < 4)) { |
| 13 | } else { |
| 14 | break; |
| 15 | } |
| 16 | switch(i) { |
| 17 | case 0: |
| 18 | { |
James Price | b5a904c | 2024-06-03 20:48:50 +0000 | [diff] [blame] | 19 | { |
James Price | 2d24558 | 2024-09-04 16:04:34 +0000 | [diff] [blame] | 20 | i = as_type<int>((as_type<uint>(i) + as_type<uint>(1))); |
James Price | b5a904c | 2024-06-03 20:48:50 +0000 | [diff] [blame] | 21 | } |
dan sinclair | 2e2bf67 | 2023-11-23 17:28:28 +0000 | [diff] [blame] | 22 | continue; |
| 23 | } |
| 24 | default: |
| 25 | { |
| 26 | break; |
| 27 | } |
| 28 | } |
James Price | b5a904c | 2024-06-03 20:48:50 +0000 | [diff] [blame] | 29 | { |
James Price | 2d24558 | 2024-09-04 16:04:34 +0000 | [diff] [blame] | 30 | i = as_type<int>((as_type<uint>(i) + as_type<uint>(1))); |
James Price | b5a904c | 2024-06-03 20:48:50 +0000 | [diff] [blame] | 31 | } |
dan sinclair | 2e2bf67 | 2023-11-23 17:28:28 +0000 | [diff] [blame] | 32 | continue; |
| 33 | } |
| 34 | } |
| 35 | } |