| #include <metal_stdlib> |
| using namespace metal; |
| |
| struct atomic_compare_exchange_result_i32 { |
| int old_value; |
| bool exchanged; |
| }; |
| |
| struct SB_RW { |
| /* 0x0000 */ atomic_int arg_0; |
| }; |
| |
| struct tint_module_vars_struct { |
| device SB_RW* sb_rw; |
| }; |
| |
| atomic_compare_exchange_result_i32 v(device 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_1bd40a(tint_module_vars_struct tint_module_vars) { |
| atomic_compare_exchange_result_i32 res = v((&(*tint_module_vars.sb_rw).arg_0), 1, 1); |
| } |
| |
| fragment void fragment_main(device SB_RW* sb_rw [[buffer(0)]]) { |
| tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.sb_rw=sb_rw}; |
| atomicCompareExchangeWeak_1bd40a(tint_module_vars); |
| } |
| |
| kernel void compute_main(device SB_RW* sb_rw [[buffer(0)]]) { |
| tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.sb_rw=sb_rw}; |
| atomicCompareExchangeWeak_1bd40a(tint_module_vars); |
| } |