From: Michael Beck Date: Sat, 18 Mar 2006 22:37:11 +0000 (+0000) Subject: Handle Cmp(And(x,y) != 0) ==> Test(x,y) X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=79fc960be9a8feaf05fc529fd594723146bb0234;p=libfirm Handle Cmp(And(x,y) != 0) ==> Test(x,y) --- diff --git a/ir/be/ia32/ia32_transform.c b/ir/be/ia32/ia32_transform.c index 7f7645743..7a41a31d1 100644 --- a/ir/be/ia32/ia32_transform.c +++ b/ir/be/ia32/ia32_transform.c @@ -1275,9 +1275,25 @@ static ir_node *gen_Cond(ia32_transform_env_t *env) { if (mode_is_int(get_irn_mode(expr))) { if (classify_tarval(get_ia32_Immop_tarval(cnst)) == TV_CLASSIFY_NULL) { /* a Cmp A, 0 */ - res = new_rd_ia32_TestJmp(dbg, irg, block, expr, expr, mode_T); + ir_node *op1 = expr; + ir_node *op2 = expr; + ir_node *and = skip_Proj(expr); + char *cnst = NULL; + + /* check, if expr is an only once used And operation */ + if (get_irn_n_edges(expr) == 1 && is_ia32_And(and)) { + op1 = get_irn_n(and, 2); + op2 = get_irn_n(and, 3); + + cnst = get_ia32_cnst(and); + } + res = new_rd_ia32_TestJmp(dbg, irg, block, op1, op2, mode_T); set_ia32_pncode(res, get_Proj_proj(sel)); + if (cnst) { + copy_ia32_Immop_attr(res, and); + } + SET_IA32_ORIG_NODE(res, get_old_node_name(env)); return res; }