| #include <metal_stdlib> |
| |
| using namespace metal; |
| |
| struct atomic_compare_exchange_result_i32 { |
| int old_value; |
| bool exchanged; |
| }; |
| atomic_compare_exchange_result_i32 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}; |
| } |
| |
| kernel void compute_main(device atomic_int* tint_symbol_1 [[buffer(0)]]) { |
| atomic_compare_exchange_result_i32 const tint_symbol = atomicCompareExchangeWeak_1(tint_symbol_1, 1, 1); |
| int const v = tint_symbol.old_value; |
| return; |
| } |
| |