| SKIP: FAILED |
| |
| #include <metal_stdlib> |
| using namespace metal; |
| |
| struct tint_module_vars_struct { |
| thread int* a; |
| thread float* b; |
| }; |
| |
| int tint_mod_i32(int lhs, int rhs) { |
| int const v = select(rhs, 1, ((rhs == 0) | ((lhs == (-2147483647 - 1)) & (rhs == -1)))); |
| return (lhs - ((lhs / v) * v)); |
| } |
| |
| int tint_div_i32(int lhs, int rhs) { |
| return (lhs / select(rhs, 1, ((rhs == 0) | ((lhs == (-2147483647 - 1)) & (rhs == -1))))); |
| } |
| |
| void foo(int maybe_zero, tint_module_vars_struct tint_module_vars) { |
| (*tint_module_vars.a) = tint_div_i32((*tint_module_vars.a), 0); |
| (*tint_module_vars.a) = tint_mod_i32((*tint_module_vars.a), 0); |
| (*tint_module_vars.a) = tint_div_i32((*tint_module_vars.a), maybe_zero); |
| (*tint_module_vars.a) = tint_mod_i32((*tint_module_vars.a), maybe_zero); |
| (*tint_module_vars.b) = ((*tint_module_vars.b) / 0.0f); |
| (*tint_module_vars.b) = ((*tint_module_vars.b) % 0.0f); |
| float const v_1 = float(maybe_zero); |
| (*tint_module_vars.b) = ((*tint_module_vars.b) / v_1); |
| float const v_2 = float(maybe_zero); |
| (*tint_module_vars.b) = ((*tint_module_vars.b) % v_2); |
| } |
| program_source:24:50: error: invalid operands to binary expression ('float' and 'float') |
| (*tint_module_vars.b) = ((*tint_module_vars.b) % 0.0f); |
| ~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~ |
| program_source:28:50: error: invalid operands to binary expression ('float' and 'const float') |
| (*tint_module_vars.b) = ((*tint_module_vars.b) % v_2); |
| ~~~~~~~~~~~~~~~~~~~~~ ^ ~~~ |
| |