diff --git a/stage0/sema.c b/stage0/sema.c index 7651e0f8d2..88fcf62000 100644 --- a/stage0/sema.c +++ b/stage0/sema.c @@ -2471,9 +2471,18 @@ static AirInstRef zirRem(Sema* sema, SemaBlock* block, uint32_t inst) { // zirModRem: handle plain '%' operator (may be mod or rem depending on types). // Ported from src/Sema.zig zirModRem. static AirInstRef zirModRem(Sema* sema, SemaBlock* block, uint32_t inst) { - // Ported from Sema.zig zirModRem: for unsigned types, same as @rem. - // Signed types would need distinct handling (mod vs rem ambiguity). - // TODO: check signedness and UNIMPLEMENTED for signed types. + // Ported from Sema.zig zirModRem: for unsigned integers, '%' is + // equivalent to @rem. For signed integers, '%' is @mod which + // needs distinct handling (not yet ported). + uint32_t payload_index = sema->code.inst_datas[inst].pl_node.payload_index; + AirInstRef lhs = resolveInst(sema, sema->code.extra[payload_index]); + TypeIndex lhs_ty = semaTypeOf(sema, lhs); + if (lhs_ty != IP_INDEX_COMPTIME_INT_TYPE + && sema->ip->items[lhs_ty].tag == IP_KEY_INT_TYPE) { + InternPoolKey k = ipIndexToKey(sema->ip, lhs_ty); + if (k.data.int_type.signedness == 1) + UNIMPLEMENTED("zirModRem: signed integer mod"); + } return zirRem(sema, block, inst); } @@ -11324,8 +11333,8 @@ static AirInstRef zirExtended(Sema* sema, SemaBlock* block, uint32_t inst) { } } } - // TODO: implement remaining builtin_value kinds - return AIR_REF_FROM_IP(IP_INDEX_VOID_VALUE); + UNIMPLEMENTED("zirBuiltinValue: unimplemented builtin_value kind"); + return AIR_REF_FROM_IP(IP_INDEX_VOID_VALUE); // unreachable } UNIMPLEMENTED("zirExtended: unimplemented extended opcode"); return AIR_REF_FROM_IP(IP_INDEX_VOID_VALUE); // unreachable