X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fir%2Firopt.c;h=d80880bd88d40656779211dbdebfce48b3432646;hb=2fd09004a61ad8af1655627a55ab16e803c58b0c;hp=85bee0800c446d4e6fd6d4e1235f873a195d944a;hpb=f80c2581282158d2c148640d9425e83fcd8cfa14;p=libfirm diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 85bee0800..d80880bd8 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -429,7 +429,7 @@ static tarval *computed_value_Mux(const ir_node *n) { static tarval *computed_value_Confirm(const ir_node *n) { /* * Beware: we might produce Phi(Confirm(x == true), Confirm(x == false)). - * Do NOT optimize them away (CondEval wants them), so wait until + * Do NOT optimize them away (jump threading wants them), so wait until * remove_confirm is activated. */ if (get_opt_remove_confirm()) { @@ -2775,6 +2775,28 @@ static ir_node *transform_node_Mul(ir_node *n) { DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_MUL_MINUS); return n; } + } else if (is_Shl(a)) { + ir_node *const shl_l = get_Shl_left(a); + if (is_Const(shl_l) && is_Const_one(shl_l)) { + /* (1 << x) * b -> b << x */ + dbg_info *const dbgi = get_irn_dbg_info(n); + ir_node *const block = get_nodes_block(n); + ir_node *const shl_r = get_Shl_right(a); + n = new_rd_Shl(dbgi, block, b, shl_r, mode); + // TODO add me DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_MUL_SHIFT); + return n; + } + } else if (is_Shl(b)) { + ir_node *const shl_l = get_Shl_left(b); + if (is_Const(shl_l) && is_Const_one(shl_l)) { + /* a * (1 << x) -> a << x */ + dbg_info *const dbgi = get_irn_dbg_info(n); + ir_node *const block = get_nodes_block(n); + ir_node *const shl_r = get_Shl_right(b); + n = new_rd_Shl(dbgi, block, a, shl_r, mode); + // TODO add me DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_MUL_SHIFT); + return n; + } } if (get_mode_arithmetic(mode) == irma_ieee754) { if (is_Const(a)) {