blob: 000994f2b0b3328df70f142df8d98446cd078ffd [file] [log] [blame]
dan sinclair2e2bf672023-11-23 17:28:28 +00001#include <metal_stdlib>
2using namespace metal;
dan sinclairf1f381a2023-11-22 09:44:15 +00003
James Price73fd3742024-09-03 20:31:37 +00004#define TINT_ISOLATE_UB(VOLATILE_NAME) \
5 volatile bool VOLATILE_NAME = true; \
6 if (VOLATILE_NAME)
7
dan sinclair2e2bf672023-11-23 17:28:28 +00008kernel void f() {
9 {
10 int i = 0;
James Price73fd3742024-09-03 20:31:37 +000011 TINT_ISOLATE_UB(tint_volatile_true) while(true) {
dan sinclair2e2bf672023-11-23 17:28:28 +000012 if ((i < 4)) {
13 } else {
14 break;
15 }
16 switch(i) {
17 case 0:
18 {
James Priceb5a904c2024-06-03 20:48:50 +000019 {
James Price2d245582024-09-04 16:04:34 +000020 i = as_type<int>((as_type<uint>(i) + as_type<uint>(1)));
James Priceb5a904c2024-06-03 20:48:50 +000021 }
dan sinclair2e2bf672023-11-23 17:28:28 +000022 continue;
23 }
24 default:
25 {
26 break;
27 }
28 }
James Priceb5a904c2024-06-03 20:48:50 +000029 {
James Price2d245582024-09-04 16:04:34 +000030 i = as_type<int>((as_type<uint>(i) + as_type<uint>(1)));
James Priceb5a904c2024-06-03 20:48:50 +000031 }
dan sinclair2e2bf672023-11-23 17:28:28 +000032 continue;
33 }
34 }
35}