| 1 |
#pragma clang diagnostic ignored "-Wunused-variable" |
| 2 |
|
| 3 |
#include <metal_stdlib> |
| 4 |
#include <simd/simd.h> |
| 5 |
#include <metal_atomic> |
| 6 |
|
| 7 |
using namespace metal; |
| 8 |
|
| 9 |
struct SSBO |
| 10 |
{ |
| 11 |
uint u32; |
| 12 |
int i32; |
| 13 |
}; |
| 14 |
|
| 15 |
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); |
| 16 |
|
| 17 |
kernel void main0(device SSBO& ssbo [[buffer(0)]]) |
| 18 |
{ |
| 19 |
threadgroup uint shared_u32; |
| 20 |
threadgroup int shared_i32; |
| 21 |
uint _16 = atomic_fetch_add_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); |
| 22 |
uint _18 = atomic_fetch_or_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); |
| 23 |
uint _20 = atomic_fetch_xor_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); |
| 24 |
uint _22 = atomic_fetch_and_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); |
| 25 |
uint _24 = atomic_fetch_min_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); |
| 26 |
uint _26 = atomic_fetch_max_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); |
| 27 |
uint _28 = atomic_exchange_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); |
| 28 |
uint _32; |
| 29 |
do |
| 30 |
{ |
| 31 |
_32 = 10u; |
| 32 |
} while (!atomic_compare_exchange_weak_explicit((device atomic_uint*)&ssbo.u32, &_32, 2u, memory_order_relaxed, memory_order_relaxed) && _32 == 10u); |
| 33 |
int _36 = atomic_fetch_add_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); |
| 34 |
int _38 = atomic_fetch_or_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); |
| 35 |
int _40 = atomic_fetch_xor_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); |
| 36 |
int _42 = atomic_fetch_and_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); |
| 37 |
int _44 = atomic_fetch_min_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); |
| 38 |
int _46 = atomic_fetch_max_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); |
| 39 |
int _48 = atomic_exchange_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); |
| 40 |
int _52; |
| 41 |
do |
| 42 |
{ |
| 43 |
_52 = 10; |
| 44 |
} while (!atomic_compare_exchange_weak_explicit((device atomic_int*)&ssbo.i32, &_52, 2, memory_order_relaxed, memory_order_relaxed) && _52 == 10); |
| 45 |
shared_u32 = 10u; |
| 46 |
shared_i32 = 10; |
| 47 |
uint _57 = atomic_fetch_add_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); |
| 48 |
uint _58 = atomic_fetch_or_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); |
| 49 |
uint _59 = atomic_fetch_xor_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); |
| 50 |
uint _60 = atomic_fetch_and_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); |
| 51 |
uint _61 = atomic_fetch_min_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); |
| 52 |
uint _62 = atomic_fetch_max_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); |
| 53 |
uint _63 = atomic_exchange_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); |
| 54 |
uint _64; |
| 55 |
do |
| 56 |
{ |
| 57 |
_64 = 10u; |
| 58 |
} while (!atomic_compare_exchange_weak_explicit((threadgroup atomic_uint*)&shared_u32, &_64, 2u, memory_order_relaxed, memory_order_relaxed) && _64 == 10u); |
| 59 |
int _65 = atomic_fetch_add_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); |
| 60 |
int _66 = atomic_fetch_or_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); |
| 61 |
int _67 = atomic_fetch_xor_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); |
| 62 |
int _68 = atomic_fetch_and_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); |
| 63 |
int _69 = atomic_fetch_min_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); |
| 64 |
int _70 = atomic_fetch_max_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); |
| 65 |
int _71 = atomic_exchange_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); |
| 66 |
int _72; |
| 67 |
do |
| 68 |
{ |
| 69 |
_72 = 10; |
| 70 |
} while (!atomic_compare_exchange_weak_explicit((threadgroup atomic_int*)&shared_i32, &_72, 2, memory_order_relaxed, memory_order_relaxed) && _72 == 10); |
| 71 |
} |
| 72 |
|