Commit 9b260f5d authored by Matthias Braun's avatar Matthias Braun
Browse files

use float_arithmetic mode when lowering fabs calls

parent 6fa4cdf1
...@@ -165,8 +165,17 @@ int i_mapper_abs(ir_node *call) ...@@ -165,8 +165,17 @@ int i_mapper_abs(ir_node *call)
ir_node *block = get_nodes_block(call); ir_node *block = get_nodes_block(call);
ir_node *op = get_Call_param(call, 0); ir_node *op = get_Call_param(call, 0);
ir_graph *irg = get_irn_irg(call); ir_graph *irg = get_irn_irg(call);
ir_mode *mode = get_irn_mode(op); ir_mode *omode = get_irn_mode(op);
dbg_info *dbg = get_irn_dbg_info(call); dbg_info *dbg = get_irn_dbg_info(call);
ir_mode *mode = omode;
if (mode_is_float(mode)) {
ir_mode *float_arith = be_get_mode_float_arithmetic();
if (float_arith != NULL && mode != float_arith) {
mode = float_arith;
op = new_rd_Conv(dbg, block, op, mode);
}
}
ir_node *zero = new_r_Const(irg, get_mode_null(mode)); ir_node *zero = new_r_Const(irg, get_mode_null(mode));
ir_node *cmp = new_rd_Cmp(dbg, block, op, zero, ir_relation_less); ir_node *cmp = new_rd_Cmp(dbg, block, op, zero, ir_relation_less);
ir_node *minus_op = new_rd_Minus(dbg, block, op, mode); ir_node *minus_op = new_rd_Minus(dbg, block, op, mode);
...@@ -179,6 +188,9 @@ int i_mapper_abs(ir_node *call) ...@@ -179,6 +188,9 @@ int i_mapper_abs(ir_node *call)
/* construct Mux */ /* construct Mux */
mux = new_rd_Mux(dbg, block, cmp, op, minus_op, mode); mux = new_rd_Mux(dbg, block, cmp, op, minus_op, mode);
if (omode != mode) {
mux = new_rd_Conv(dbg, block, mux, omode);
}
DBG_OPT_ALGSIM0(call, mux, FS_OPT_RTS_ABS); DBG_OPT_ALGSIM0(call, mux, FS_OPT_RTS_ABS);
replace_call(mux, call, mem, NULL, NULL); replace_call(mux, call, mem, NULL, NULL);
return 1; return 1;
......
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