X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Floop-doloop.c;h=d1bd28559154bfc2c0bff4ecfd22a540347b68a4;hb=586b67ff8d8d77d079ac25b46afed07aa2eaf0f4;hp=25369dd4a4d611aa7274b35c27bf96b109955e7e;hpb=560a2fa67aa7ea4fe3ebc813837d7276b2e42e5e;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c index 25369dd4a4d..d1bd2855915 100644 --- a/gcc/loop-doloop.c +++ b/gcc/loop-doloop.c @@ -1,6 +1,6 @@ /* Perform doloop optimizations - Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, - Inc. + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 + Free Software Foundation, Inc. Based on code by Michael P. Hayes (m.hayes@elec.canterbury.ac.nz) This file is part of GCC. @@ -291,7 +291,8 @@ add_test (rtx cond, edge *e, basic_block dest) op0 = force_operand (op0, NULL_RTX); op1 = force_operand (op1, NULL_RTX); label = block_label (dest); - do_compare_rtx_and_jump (op0, op1, code, 0, mode, NULL_RTX, NULL_RTX, label); + do_compare_rtx_and_jump (op0, op1, code, 0, mode, NULL_RTX, + NULL_RTX, label, -1); jump = get_last_insn (); if (!jump || !JUMP_P (jump)) @@ -317,7 +318,7 @@ add_test (rtx cond, edge *e, basic_block dest) redirect_edge_and_branch_force (*e, dest); return false; } - + JUMP_LABEL (jump) = label; /* The jump is supposed to handle an unlikely special case. */ @@ -335,11 +336,12 @@ add_test (rtx cond, edge *e, basic_block dest) end of the loop. CONDITION is the condition separated from the DOLOOP_SEQ. COUNT is the number of iterations of the LOOP. ZERO_EXTEND_P says to zero extend COUNT after the increment of it to - word_mode. */ + word_mode from FROM_MODE. */ static void doloop_modify (struct loop *loop, struct niter_desc *desc, - rtx doloop_seq, rtx condition, rtx count, bool zero_extend_p) + rtx doloop_seq, rtx condition, rtx count, + bool zero_extend_p, enum machine_mode from_mode) { rtx counter_reg; rtx tmp, noloop = NULL_RTX; @@ -413,11 +415,11 @@ doloop_modify (struct loop *loop, struct niter_desc *desc, } if (increment_count) - count = simplify_gen_binary (PLUS, mode, count, const1_rtx); + count = simplify_gen_binary (PLUS, from_mode, count, const1_rtx); if (zero_extend_p) count = simplify_gen_unary (ZERO_EXTEND, word_mode, - count, mode); + count, from_mode); /* Insert initialization of the count register into the loop header. */ start_sequence (); @@ -461,7 +463,7 @@ doloop_modify (struct loop *loop, struct niter_desc *desc, set_zero->count = preheader->count; set_zero->frequency = preheader->frequency; } - + if (EDGE_COUNT (set_zero->preds) == 0) { /* All the conditions were simplified to false, remove the @@ -476,7 +478,7 @@ doloop_modify (struct loop *loop, struct niter_desc *desc, sequence = get_insns (); end_sequence (); emit_insn_after (sequence, BB_END (set_zero)); - + set_immediate_dominator (CDI_DOMINATORS, set_zero, recompute_dominator (CDI_DOMINATORS, set_zero)); @@ -529,7 +531,7 @@ doloop_modify (struct loop *loop, struct niter_desc *desc, if (true_prob_val) { /* Seems safer to use the branch probability. */ - add_reg_note (jump_insn, REG_BR_PROB, + add_reg_note (jump_insn, REG_BR_PROB, GEN_INT (desc->in_edge->probability)); } } @@ -672,7 +674,8 @@ doloop_optimize (struct loop *loop) return false; } - doloop_modify (loop, desc, doloop_seq, condition, count, zero_extend_p); + doloop_modify (loop, desc, doloop_seq, condition, count, + zero_extend_p, mode); return true; }