commit efcdc2f735a18fd0f4f7708ec523641c96179ad9 from: Benjamin Stürz date: Wed Oct 02 21:45:15 2024 UTC irc: allow IR_MUL for DT_FLOAT commit - 82f7044d260ba86c4ed3b94c90f95ef93a3424da commit + efcdc2f735a18fd0f4f7708ec523641c96179ad9 blob - 9504f77484f3e758af98278e26a2ff6c7a1a2a2a blob + 0fabf1f2b0d0e80d7a6ff4473bcaeb33f27b0a07 --- cc/irc/irc.c +++ cc/irc/irc.c @@ -725,7 +725,7 @@ struct expr *e; } else if (strcmp (lval.s, "xor") == 0) { expr_bin (fn, dt, e, EX_XOR, 0); } else if (strcmp (lval.s, "mul") == 0) { - expr_bin (fn, dt, e, EX_MUL, 0); + expr_bin (fn, dt, e, EX_MUL, 1); } else if (strcmp (lval.s, "udiv") == 0) { expr_bin (fn, dt, e, EX_UDIV, 0); } else if (strcmp (lval.s, "sdiv") == 0) { @@ -1975,7 +1975,10 @@ struct expr *e; call_muldiv ("mul", fn, dt, e); break; case DT_FLOAT: - error ("multiplication not implemented for DT_FLOAT"); + load (NULL, r); + if (ri->is_imm) + error ("cannot use immediate values for floating-point operations"); + load ("fmul", &fn->regs[ri->reg]); break; } break; blob - db86c91d6e1dc50b6a6904583a518e608eb3ce78 blob + aea4ad0dafaf438128f6825918f06cb74ebeb6d3 --- cc/irc/test.ir +++ cc/irc/test.ir @@ -202,5 +202,6 @@ fn floats (): float { let $6: float = $5; let $7: float = add $0, $1; let $8: float = sub $0, $1; + let $9: float = mul $0, $1; ret $0; }