Commit 6de1f4db authored by Tobias Rapp's avatar Tobias Rapp
Browse files

Added imull one operand form, therby fixing a signed/unsigned Mulh bug

parent f6d40622
......@@ -168,6 +168,19 @@ IMul => {
modified_flags => $status_flags,
},
IMul1Op => {
# Do not rematerialize this node
# It produces 2 results and has strict constraints
state => "exc_pinned",
reg_req => { out => [ "rax", "flags", "none", "rdx" ] },
outs => [ "res_low", "flags", "M", "res_high" ],
arity => "variable",
attr_type => "amd64_addr_attr_t",
attr => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
emit => "imul%M %AM",
modified_flags => $status_flags,
},
Mul => {
# Do not rematerialize this node
# It produces 2 results and has strict constraints
......
......@@ -731,13 +731,22 @@ static ir_node *gen_Mul(ir_node *const node)
static ir_node *gen_Mulh(ir_node *const node)
{
ir_node *op1 = get_Mulh_left(node);
ir_node *op2 = get_Mulh_right(node);
ir_node *new_node = gen_binop_rax(node, op1, op2, new_bd_amd64_Mul,
ir_node *op1 = get_Mulh_left(node);
ir_node *op2 = get_Mulh_right(node);
ir_mode *mode = get_irn_mode(op1);
ir_node *new_node;
if(mode_is_signed(mode)) {
new_node = gen_binop_rax(node, op1, op2, new_bd_amd64_IMul1Op,
/* match_am TODO */
match_mode_neutral | match_commutative);
return new_r_Proj(new_node, mode_gp, pn_amd64_IMul1Op_res_high);
} else {
new_node = gen_binop_rax(node, op1, op2, new_bd_amd64_Mul,
/* match_am TODO */
match_mode_neutral | match_commutative);
return new_r_Proj(new_node, mode_gp, pn_amd64_Mul_res_high);
return new_r_Proj(new_node, mode_gp, pn_amd64_Mul_res_high);
}
}
static ir_node *gen_Shl(ir_node *const node)
......
Supports Markdown
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