| #include <metal_stdlib> |
| using namespace metal; |
| |
| template<typename T, size_t N> |
| struct tint_array { |
| const constant T& operator[](size_t i) const constant { return elements[i]; } |
| device T& operator[](size_t i) device { return elements[i]; } |
| const device T& operator[](size_t i) const device { return elements[i]; } |
| thread T& operator[](size_t i) thread { return elements[i]; } |
| const thread T& operator[](size_t i) const thread { return elements[i]; } |
| threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } |
| const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } |
| T elements[N]; |
| }; |
| |
| struct S { |
| tint_array<int4, 4> a; |
| }; |
| |
| struct tint_module_vars_struct { |
| device tint_array<S, 1>* tint_symbol; |
| thread uint* v; |
| }; |
| |
| #define TINT_ISOLATE_UB(VOLATILE_NAME) \ |
| {volatile bool VOLATILE_NAME = false; if (VOLATILE_NAME) break;} |
| |
| int idx1(tint_module_vars_struct tint_module_vars) { |
| (*tint_module_vars.v) = ((*tint_module_vars.v) - 1u); |
| return 1; |
| } |
| |
| int idx2(tint_module_vars_struct tint_module_vars) { |
| (*tint_module_vars.v) = ((*tint_module_vars.v) - 1u); |
| return 2; |
| } |
| |
| int idx3(tint_module_vars_struct tint_module_vars) { |
| (*tint_module_vars.v) = ((*tint_module_vars.v) - 1u); |
| return 3; |
| } |
| |
| int idx4(tint_module_vars_struct tint_module_vars) { |
| (*tint_module_vars.v) = ((*tint_module_vars.v) - 1u); |
| return 4; |
| } |
| |
| int idx5(tint_module_vars_struct tint_module_vars) { |
| (*tint_module_vars.v) = ((*tint_module_vars.v) - 1u); |
| return 0; |
| } |
| |
| int idx6(tint_module_vars_struct tint_module_vars) { |
| (*tint_module_vars.v) = ((*tint_module_vars.v) - 1u); |
| return 2; |
| } |
| |
| void tint_symbol_1(tint_module_vars_struct tint_module_vars) { |
| { |
| int const v_1 = idx1(tint_module_vars); |
| device int4* const v_2 = (&(*tint_module_vars.tint_symbol)[v_1].a[idx2(tint_module_vars)]); |
| int const v_3 = idx3(tint_module_vars); |
| (*v_2)[v_3] = as_type<int>((as_type<uint>((*v_2)[v_3]) - as_type<uint>(1))); |
| while(true) { |
| TINT_ISOLATE_UB(tint_volatile_false) |
| if (((*tint_module_vars.v) < 10u)) { |
| } else { |
| break; |
| } |
| { |
| int const v_4 = idx4(tint_module_vars); |
| device int4* const v_5 = (&(*tint_module_vars.tint_symbol)[v_4].a[idx5(tint_module_vars)]); |
| int const v_6 = idx6(tint_module_vars); |
| (*v_5)[v_6] = as_type<int>((as_type<uint>((*v_5)[v_6]) - as_type<uint>(1))); |
| } |
| continue; |
| } |
| } |
| } |