dan sinclair | 49d1a2d | 2022-06-16 12:01:27 +0000 | [diff] [blame] | 1 | #include <metal_stdlib> |
| 2 | |
| 3 | using namespace metal; |
Ben Clayton | 9be037c | 2024-01-19 20:58:56 +0000 | [diff] [blame] | 4 | |
Ben Clayton | 02262d8 | 2024-01-23 18:09:39 +0000 | [diff] [blame] | 5 | #define TINT_ISOLATE_UB(VOLATILE_NAME) \ |
| 6 | volatile bool VOLATILE_NAME = true; \ |
| 7 | if (VOLATILE_NAME) |
Ben Clayton | 9be037c | 2024-01-19 20:58:56 +0000 | [diff] [blame] | 8 | |
dan sinclair | 49d1a2d | 2022-06-16 12:01:27 +0000 | [diff] [blame] | 9 | int f() { |
| 10 | int i = 0; |
Ben Clayton | 02262d8 | 2024-01-23 18:09:39 +0000 | [diff] [blame] | 11 | TINT_ISOLATE_UB(tint_volatile_true) while((i < 4)) { |
dan sinclair | 49d1a2d | 2022-06-16 12:01:27 +0000 | [diff] [blame] | 12 | i = as_type<int>((as_type<uint>(i) + as_type<uint>(1))); |
| 13 | } |
| 14 | return i; |
| 15 | } |
| 16 | |