| #include <metal_stdlib> |
| using namespace metal; |
| |
| struct tint_module_vars_struct { |
| threadgroup int* a; |
| threadgroup int* b; |
| }; |
| |
| #define TINT_ISOLATE_UB(VOLATILE_NAME) \ |
| volatile bool VOLATILE_NAME = true; \ |
| if (VOLATILE_NAME) |
| |
| void foo(tint_module_vars_struct tint_module_vars) { |
| { |
| int i = 0; |
| TINT_ISOLATE_UB(tint_volatile_true) while(true) { |
| int const v = i; |
| threadgroup_barrier(mem_flags::mem_threadgroup); |
| int const v_1 = (*tint_module_vars.a); |
| threadgroup_barrier(mem_flags::mem_threadgroup); |
| if ((v < v_1)) { |
| } else { |
| break; |
| } |
| { |
| threadgroup_barrier(mem_flags::mem_threadgroup); |
| int const v_2 = (*tint_module_vars.b); |
| threadgroup_barrier(mem_flags::mem_threadgroup); |
| i = as_type<int>((as_type<uint>(i) + as_type<uint>(v_2))); |
| } |
| continue; |
| } |
| } |
| } |