| #include <metal_stdlib> |
| |
| using namespace metal; |
| |
| struct atomic_compare_exchange_resulti32 { |
| int old_value; |
| bool exchanged; |
| }; |
| atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(device atomic_int* atomic, int compare, int value) { |
| int old_value = compare; |
| bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); |
| return {old_value, exchanged}; |
| } |
| |
| struct SB_RW_atomic { |
| /* 0x0000 */ atomic_int arg_0; |
| }; |
| |
| struct SB_RW { |
| int arg_0; |
| }; |
| |
| struct x__atomic_compare_exchange_resulti32 { |
| int old_value; |
| bool exchanged; |
| }; |
| |
| void atomicCompareExchangeWeak_1bd40a(device SB_RW_atomic* const tint_symbol_2) { |
| x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32{}; |
| atomic_compare_exchange_resulti32 const tint_symbol = atomicCompareExchangeWeak_1(&((*(tint_symbol_2)).arg_0), 1, 1); |
| int const old_value_1 = tint_symbol.old_value; |
| int const x_19 = old_value_1; |
| x__atomic_compare_exchange_resulti32 const tint_symbol_1 = {.old_value=x_19, .exchanged=(x_19 == 1)}; |
| res = tint_symbol_1; |
| return; |
| } |
| |
| void fragment_main_1(device SB_RW_atomic* const tint_symbol_3) { |
| atomicCompareExchangeWeak_1bd40a(tint_symbol_3); |
| return; |
| } |
| |
| fragment void fragment_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { |
| fragment_main_1(tint_symbol_4); |
| return; |
| } |
| |
| void compute_main_1(device SB_RW_atomic* const tint_symbol_5) { |
| atomicCompareExchangeWeak_1bd40a(tint_symbol_5); |
| return; |
| } |
| |
| kernel void compute_main(device SB_RW_atomic* tint_symbol_6 [[buffer(0)]]) { |
| compute_main_1(tint_symbol_6); |
| return; |
| } |
| |