blob: 65d2746c1b510edbd49784efc36c890ea0df6a62 [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
struct atomic_compare_exchange_result_u32 {
uint old_value;
bool exchanged;
};
atomic_compare_exchange_result_u32 atomicCompareExchangeWeak_1(device atomic_uint* atomic, uint compare, uint value) {
uint 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 atomic_compare_exchange_result_i32 {
int old_value;
bool exchanged;
};
atomic_compare_exchange_result_i32 atomicCompareExchangeWeak_2(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};
}
atomic_compare_exchange_result_u32 atomicCompareExchangeWeak_3(threadgroup atomic_uint* atomic, uint compare, uint value) {
uint old_value = compare;
bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed);
return {old_value, exchanged};
}
atomic_compare_exchange_result_i32 atomicCompareExchangeWeak_4(threadgroup 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};
}
void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol_1, threadgroup atomic_int* const tint_symbol_2) {
if ((local_idx < 1u)) {
atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed);
atomic_store_explicit(tint_symbol_2, 0, memory_order_relaxed);
}
threadgroup_barrier(mem_flags::mem_threadgroup);
}
void tint_symbol_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_3, threadgroup atomic_int* const tint_symbol_4, device atomic_uint* const tint_symbol_5, device atomic_int* const tint_symbol_6) {
tint_zero_workgroup_memory(local_invocation_index, tint_symbol_3, tint_symbol_4);
{
uint value = 42u;
atomic_compare_exchange_result_u32 const r1 = atomicCompareExchangeWeak_1(tint_symbol_5, 0u, value);
atomic_compare_exchange_result_u32 const r2 = atomicCompareExchangeWeak_1(tint_symbol_5, 0u, value);
atomic_compare_exchange_result_u32 const r3 = atomicCompareExchangeWeak_1(tint_symbol_5, 0u, value);
}
{
int value = 42;
atomic_compare_exchange_result_i32 const r1 = atomicCompareExchangeWeak_2(tint_symbol_6, 0, value);
atomic_compare_exchange_result_i32 const r2 = atomicCompareExchangeWeak_2(tint_symbol_6, 0, value);
atomic_compare_exchange_result_i32 const r3 = atomicCompareExchangeWeak_2(tint_symbol_6, 0, value);
}
{
uint value = 42u;
atomic_compare_exchange_result_u32 const r1 = atomicCompareExchangeWeak_3(tint_symbol_3, 0u, value);
atomic_compare_exchange_result_u32 const r2 = atomicCompareExchangeWeak_3(tint_symbol_3, 0u, value);
atomic_compare_exchange_result_u32 const r3 = atomicCompareExchangeWeak_3(tint_symbol_3, 0u, value);
}
{
int value = 42;
atomic_compare_exchange_result_i32 const r1 = atomicCompareExchangeWeak_4(tint_symbol_4, 0, value);
atomic_compare_exchange_result_i32 const r2 = atomicCompareExchangeWeak_4(tint_symbol_4, 0, value);
atomic_compare_exchange_result_i32 const r3 = atomicCompareExchangeWeak_4(tint_symbol_4, 0, value);
}
}
kernel void tint_symbol(device atomic_uint* tint_symbol_9 [[buffer(0)]], device atomic_int* tint_symbol_10 [[buffer(1)]], uint local_invocation_index [[thread_index_in_threadgroup]]) {
threadgroup atomic_uint tint_symbol_7;
threadgroup atomic_int tint_symbol_8;
tint_symbol_inner(local_invocation_index, &(tint_symbol_7), &(tint_symbol_8), tint_symbol_9, tint_symbol_10);
return;
}