Commit 586fe6fe authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Correct and clean up gen_Abs() for SPARC: The Sub was the wrong way round.

[r27885]
parent ffe5947b
......@@ -442,36 +442,23 @@ static ir_node *gen_Quot(ir_node *node)
new_bd_sparc_fdiv_d, new_bd_sparc_fdiv_q);
}
/**
* transform abs node:
* mov a, b
* sra b, 31, b
* xor a, b
* sub a, b
*
* @return
*/
static ir_node *gen_Abs(ir_node *node) {
ir_node *block = be_transform_node(get_nodes_block(node));
ir_mode *mode = get_irn_mode(node);
dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *op = get_Abs_op(node);
ir_node *mov, *sra, *xor, *sub, *new_op;
static ir_node *gen_Abs(ir_node *node)
{
ir_mode *const mode = get_irn_mode(node);
if (mode_is_float(mode)) {
return gen_helper_binfpop(node, mode, new_bd_sparc_fabs_s,
new_bd_sparc_fdiv_d, new_bd_sparc_fdiv_q);
} else {
ir_node *const block = be_transform_node(get_nodes_block(node));
dbg_info *const dbgi = get_irn_dbg_info(node);
ir_node *const op = get_Abs_op(node);
ir_node *const new_op = be_transform_node(op);
ir_node *const sra = new_bd_sparc_Sra_imm(dbgi, block, new_op, 31);
ir_node *const xor = new_bd_sparc_Xor_reg(dbgi, block, new_op, sra);
ir_node *const sub = new_bd_sparc_Sub_reg(dbgi, block, xor, sra);
return sub;
}
new_op = be_transform_node(op);
mov = new_bd_sparc_Mov_reg(dbgi, block, new_op);
sra = new_bd_sparc_Sra_imm(dbgi, block, mov, 31);
xor = new_bd_sparc_Xor_reg(dbgi, block, new_op, sra);
sub = new_bd_sparc_Sub_reg(dbgi, block, sra, xor);
return sub;
}
/**
......
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