X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fia32%2Fbearch_ia32.c;h=4bcedb1222d828067923f1008e8400a5bfee9ab9;hb=049531b478ae922e01b9c23d7ad9ed9d4df9a37d;hp=a84af7ca2550077aa4e0262085575b73c954a921;hpb=a3b37b595cec64eb7f9816f64f13649377be95b9;p=libfirm diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index a84af7ca2..4bcedb122 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -1091,7 +1091,7 @@ static void transform_to_Load(ia32_code_gen_t *cg, ir_node *node) { reg = arch_get_irn_register(node); arch_set_irn_register(proj, reg); - SET_IA32_ORIG_NODE(new_op, ia32_get_old_node_name(cg, node)); + SET_IA32_ORIG_NODE(new_op, node); exchange(node, proj); } @@ -1148,7 +1148,7 @@ static void transform_to_Store(ia32_code_gen_t *cg, ir_node *node) { set_ia32_frame_ent(store, ent); set_ia32_use_frame(store); set_ia32_is_spill(store); - SET_IA32_ORIG_NODE(store, ia32_get_old_node_name(cg, node)); + SET_IA32_ORIG_NODE(store, node); DBG_OPT_SPILL2ST(node, store); if (sched_point) { @@ -2049,6 +2049,35 @@ static void ia32_mark_remat(const void *self, ir_node *node) { } } +/** + * Check for Abs or Nabs. + */ +static int is_Abs_or_Nabs(ir_node *cmp, ir_node *sel, ir_node *t, ir_node *f) { + ir_node *l, *r; + pn_Cmp pnc; + + if (cmp == NULL) + return 0; + + /* must be <, <=, >=, > */ + pnc = get_Proj_proj(sel); + if (pnc != pn_Cmp_Ge && pnc != pn_Cmp_Gt && + pnc != pn_Cmp_Le && pnc != pn_Cmp_Lt) + return 0; + + l = get_Cmp_left(cmp); + r = get_Cmp_right(cmp); + + /* must be x cmp 0 */ + if ((l != t && l != f) || !is_Const(r) || !is_Const_null(r)) + return 0; + + if ((!is_Minus(t) || get_Minus_op(t) != f) && + (!is_Minus(f) || get_Minus_op(f) != t)) + return 0; + return 1; +} + /** * Allows or disallows the creation of Psi nodes for the given Phi nodes. * @@ -2118,10 +2147,8 @@ static int ia32_is_psi_allowed(ir_node *sel, ir_node *phi_list, int i, int j) ir_node *t = get_Phi_pred(phi, i); ir_node *f = get_Phi_pred(phi, j); - /* only abs or nabs supported */ - if ((!is_Minus(t) || get_Minus_op(t) != f) && - (!is_Minus(f) || get_Minus_op(f) != t)) - return 0; + if (! is_Abs_or_Nabs(cmp, sel, t, f)) + return 0; } else if (get_mode_size_bits(mode) > 32) return 0; } @@ -2132,7 +2159,7 @@ static int ia32_is_psi_allowed(ir_node *sel, ir_node *phi_list, int i, int j) ir_node *cl, *cr; pn_Cmp pn; - /* No cmov, only some special cases */ + /* No Cmov, only some special cases */ if (cmp == NULL) return 0; @@ -2151,9 +2178,8 @@ static int ia32_is_psi_allowed(ir_node *sel, ir_node *phi_list, int i, int j) if (mode_is_float(mode)) { /* only abs or nabs supported */ - if ((!is_Minus(t) || get_Minus_op(t) != f) && - (!is_Minus(f) || get_Minus_op(f) != t)) - return 0; + if (! is_Abs_or_Nabs(cmp, sel, t, f)) + return 0; } else if (get_mode_size_bits(mode) > 32) { /* no 64bit yet */ return 0;