| #include <metal_stdlib> |
| |
| using namespace metal; |
| void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol_11) { |
| { |
| atomic_store_explicit(tint_symbol_11, 0, memory_order_relaxed); |
| } |
| threadgroup_barrier(mem_flags::mem_threadgroup); |
| } |
| |
| int tint_ftoi(float v) { |
| return select(2147483647, select(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v < 2147483520.0f)); |
| } |
| |
| struct S { |
| int a; |
| int b; |
| }; |
| |
| int accept_value(int val) { |
| return val; |
| } |
| |
| int accept_ptr_deref_call_func(thread int* const val) { |
| int const tint_symbol_3 = *(val); |
| int const tint_symbol_4 = accept_value(*(val)); |
| return as_type<int>((as_type<uint>(tint_symbol_3) + as_type<uint>(tint_symbol_4))); |
| } |
| |
| int accept_ptr_deref_pass_through(thread int* const val) { |
| int const tint_symbol_1 = *(val); |
| int const tint_symbol_2 = accept_ptr_deref_call_func(val); |
| return as_type<int>((as_type<uint>(tint_symbol_1) + as_type<uint>(tint_symbol_2))); |
| } |
| |
| int accept_ptr_to_struct_and_access(thread S* const val) { |
| return as_type<int>((as_type<uint>((*(val)).a) + as_type<uint>((*(val)).b))); |
| } |
| |
| int accept_ptr_to_struct_access_pass_ptr(thread S* const val) { |
| (*(val)).a = 2; |
| return (*(val)).a; |
| } |
| |
| int accept_ptr_vec_access_elements(thread float3* const v1) { |
| (*(v1))[0] = cross(*(v1), *(v1))[0]; |
| return tint_ftoi((*(v1))[0]); |
| } |
| |
| int call_builtin_with_mod_scope_ptr(threadgroup atomic_int* const tint_symbol_12) { |
| return atomic_load_explicit(tint_symbol_12, memory_order_relaxed); |
| } |
| |
| void tint_symbol_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_13, device int* const tint_symbol_14) { |
| tint_zero_workgroup_memory(local_invocation_index, tint_symbol_13); |
| int v1 = 0; |
| S v2 = S{}; |
| float3 v4 = float3(0.0f); |
| int const t1 = atomic_load_explicit(tint_symbol_13, memory_order_relaxed); |
| int const tint_symbol_5 = accept_ptr_deref_pass_through(&(v1)); |
| int const tint_symbol_6 = accept_ptr_to_struct_and_access(&(v2)); |
| int const tint_symbol_7 = accept_ptr_to_struct_and_access(&(v2)); |
| int const tint_symbol_8 = accept_ptr_vec_access_elements(&(v4)); |
| int const tint_symbol_9 = accept_ptr_to_struct_access_pass_ptr(&(v2)); |
| int const tint_symbol_10 = call_builtin_with_mod_scope_ptr(tint_symbol_13); |
| *(tint_symbol_14) = as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(tint_symbol_5) + as_type<uint>(tint_symbol_6)))) + as_type<uint>(tint_symbol_7)))) + as_type<uint>(tint_symbol_8)))) + as_type<uint>(tint_symbol_9)))) + as_type<uint>(tint_symbol_10)))) + as_type<uint>(t1))); |
| } |
| |
| kernel void tint_symbol(device int* tint_symbol_16 [[buffer(0)]], uint local_invocation_index [[thread_index_in_threadgroup]]) { |
| threadgroup atomic_int tint_symbol_15; |
| tint_symbol_inner(local_invocation_index, &(tint_symbol_15), tint_symbol_16); |
| return; |
| } |
| |