Commit 3bd0255f authored by Christoph Mallon's avatar Christoph Mallon
Browse files

When making a 'Mulh', automatically infer its mode from its left operand.

parent 550c63db
......@@ -832,7 +832,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, ir_tarval *tv)
/* generate the Mulh instruction */
ir_node *c = new_r_Const(irg, mag.M);
ir_node *q = new_rd_Mulh(dbg, block, n, c, mode);
ir_node *q = new_rd_Mulh(dbg, block, n, c);
/* do we need an Add or Sub */
if (mag.need_add)
......@@ -871,7 +871,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, ir_tarval *tv)
/* generate the Mulh instruction */
ir_node *c = new_r_Const(irg, mafo.multiplier);
ir_node *q = new_rd_Mulh(dbg, block, n, c, mode);
ir_node *q = new_rd_Mulh(dbg, block, n, c);
c = new_r_Const_long(irg, mode_Iu, get_mode_size_bits(get_tarval_mode(tv)));
res = new_rd_Shr(dbg, block, q, c, mode);
if (mafo.post_shift > 0) {
......
......@@ -596,6 +596,7 @@ class Mul(Binop):
class Mulh(Binop):
"""returns the upper word of the product of its operands (the part which
would not fit into the result mode of a normal Mul anymore)"""
mode = "get_irn_mode(irn_left)"
flags = [ "commutative" ]
@op
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment