commit - 73274e21f47e83e0db2fb90aa7f01fa56b1db94f
commit + 1ee10934936c2c6167c18c1553df440a463b8585
blob - 4f2f8af0f3e80103498b0e02a99a9d3497356fdf
blob + 036a435815a2c7df563af0ef0aeac11f18e9200f
--- cc/irc/irc.c
+++ cc/irc/irc.c
} else if (strcmp (lval.s, "udiv") == 0) {
expr_bin (fn, dt, e, EX_UDIV, 0);
} else if (strcmp (lval.s, "sdiv") == 0) {
- expr_bin (fn, dt, e, EX_SDIV, 0);
+ expr_bin (fn, dt, e, EX_SDIV, 1);
} else if (strcmp (lval.s, "lsl") == 0) {
expr_shift (fn, dt, e, EX_LSL);
} else if (strcmp (lval.s, "lsr") == 0) {
call_muldiv (instr, fn, dt, e);
break;
case DT_FLOAT:
- error ("division not implemented for DT_FLOAT");
+ if (ri->is_imm)
+ error ("cannot use immediate values for floating-point operations");
+ load (NULL, acc);
+ load ("fdiv", &fn->regs[ri->reg]);
break;
}
return 0;
blob - aea4ad0dafaf438128f6825918f06cb74ebeb6d3
blob + 432a4c70acf5e0d518e99f8713e6c2cb56f068fc
--- cc/irc/test.ir
+++ cc/irc/test.ir
let $7: float = add $0, $1;
let $8: float = sub $0, $1;
let $9: float = mul $0, $1;
+ let $10: float = sdiv $0, $1;
ret $0;
}