| #include <metal_stdlib> |
| using namespace metal; |
| |
| struct atomic_compare_exchange_result_i32 { |
| int old_value; |
| bool exchanged; |
| }; |
| |
| struct tint_module_vars_struct { |
| threadgroup atomic_int* arg_0; |
| }; |
| |
| struct tint_symbol_1 { |
| atomic_int tint_symbol; |
| }; |
| |
| atomic_compare_exchange_result_i32 v(threadgroup atomic_int* const atomic_ptr, int cmp, int val) { |
| int old_value = cmp; |
| bool const v_1 = atomic_compare_exchange_weak_explicit(atomic_ptr, (&old_value), val, memory_order_relaxed, memory_order_relaxed); |
| return atomic_compare_exchange_result_i32{.old_value=old_value, .exchanged=v_1}; |
| } |
| |
| void atomicCompareExchangeWeak_e88938(tint_module_vars_struct tint_module_vars) { |
| int arg_1 = 1; |
| int arg_2 = 1; |
| atomic_compare_exchange_result_i32 res = v(tint_module_vars.arg_0, arg_1, arg_2); |
| } |
| |
| void compute_main_inner(uint tint_local_index, tint_module_vars_struct tint_module_vars) { |
| if ((tint_local_index == 0u)) { |
| atomic_store_explicit(tint_module_vars.arg_0, 0, memory_order_relaxed); |
| } |
| threadgroup_barrier(mem_flags::mem_threadgroup); |
| atomicCompareExchangeWeak_e88938(tint_module_vars); |
| } |
| |
| kernel void compute_main(uint tint_local_index [[thread_index_in_threadgroup]], threadgroup tint_symbol_1* v_2 [[threadgroup(0)]]) { |
| tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=(&(*v_2).tint_symbol)}; |
| compute_main_inner(tint_local_index, tint_module_vars); |
| } |