| #include <metal_stdlib> |
| using namespace metal; |
| |
| struct S { |
| /* 0x0000 */ int a; |
| }; |
| |
| struct tint_module_vars_struct { |
| device S* v; |
| }; |
| |
| int tint_mod_i32(int lhs, int rhs) { |
| uint const v_1 = uint((lhs == (-2147483647 - 1))); |
| bool const v_2 = bool((v_1 & uint((rhs == -1)))); |
| uint const v_3 = uint((rhs == 0)); |
| int const v_4 = select(rhs, 1, bool((v_3 | uint(v_2)))); |
| return as_type<int>((as_type<uint>(lhs) - as_type<uint>(as_type<int>((as_type<uint>((lhs / v_4)) * as_type<uint>(v_4)))))); |
| } |
| |
| [[max_total_threads_per_threadgroup(1)]] |
| kernel void foo(device S* v [[buffer(0)]]) { |
| tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.v=v}; |
| (*tint_module_vars.v).a = tint_mod_i32((*tint_module_vars.v).a, 2); |
| } |