projects
/
libfirm
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
969f52a
)
Implement -(a * const) -> a * -const.
author
Christoph Mallon
<christoph.mallon@gmx.de>
Thu, 20 Sep 2007 09:56:06 +0000
(09:56 +0000)
committer
Christoph Mallon
<christoph.mallon@gmx.de>
Thu, 20 Sep 2007 09:56:06 +0000
(09:56 +0000)
[r15897]
ir/ir/iropt.c
patch
|
blob
|
history
diff --git
a/ir/ir/iropt.c
b/ir/ir/iropt.c
index
724a634
..
9b22543
100644
(file)
--- a/
ir/ir/iropt.c
+++ b/
ir/ir/iropt.c
@@
-3186,6
+3186,20
@@
static ir_node *transform_node_Minus(ir_node *n) {
return n;
}
return n;
}
+ if (is_Mul(a)) { /* -(a * const) -> a * -const */
+ ir_node *mul_l = get_Mul_left(a);
+ ir_node *mul_r = get_Mul_right(a);
+ if (is_Const(mul_r)) {
+ tarval *tv = tarval_neg(get_Const_tarval(mul_r));
+ ir_node *cnst = new_Const(mode, tv);
+ dbg_info *dbg = get_irn_dbg_info(a);
+ ir_graph *irg = current_ir_graph;
+ ir_node *block = get_nodes_block(a);
+ n = new_rd_Mul(dbg, irg, block, mul_l, cnst, mode);
+ return n;
+ }
+ }
+
return n;
} /* transform_node_Minus */
return n;
} /* transform_node_Minus */