summaryrefslogtreecommitdiff
path: root/gcc/loop-unroll.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-23 13:48:12 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-23 13:48:12 +0000
commitb99ab2752f0adc47b0606cc3ca31696172bbe36c (patch)
tree74c8ed6896fc763ca39ad07ae90e5c2c28f4727d /gcc/loop-unroll.c
parenta1ccf30d77f65e6b6ae857f18bdbcbb7f996b10e (diff)
downloadgcc-b99ab2752f0adc47b0606cc3ca31696172bbe36c.tar.gz
2014-04-23 Richard Biener <rguenther@suse.de>
* Makefile.in (OBJS): Remove loop-unswitch.o. * loop-unswitch.c: Delete. * tree-pass.h (make_pass_rtl_unswitch): Remove. * passes.def (pass_rtl_unswitch): Likewise. * loop-init.c (gate_rtl_unswitch): Likewise. (rtl_unswitch): Likewise. (pass_data_rtl_unswitch): Likewise. (pass_rtl_unswitch): Likewise. (make_pass_rtl_unswitch): Likewise. * rtl.h (reversed_condition): Likewise. (compare_and_jump_seq): Likewise. * loop-iv.c (reversed_condition): Move here from loop-unswitch.c and make static. * loop-unroll.c (compare_and_jump_seq): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209698 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-unroll.c')
-rw-r--r--gcc/loop-unroll.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 4561ce8cb71..f952d9d1ea3 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -1060,6 +1060,59 @@ split_edge_and_insert (edge e, rtx insns)
return bb;
}
+/* Prepare a sequence comparing OP0 with OP1 using COMP and jumping to LABEL if
+ true, with probability PROB. If CINSN is not NULL, it is the insn to copy
+ in order to create a jump. */
+
+static rtx
+compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, rtx label, int prob,
+ rtx cinsn)
+{
+ rtx seq, jump, cond;
+ enum machine_mode mode;
+
+ mode = GET_MODE (op0);
+ if (mode == VOIDmode)
+ mode = GET_MODE (op1);
+
+ start_sequence ();
+ if (GET_MODE_CLASS (mode) == MODE_CC)
+ {
+ /* A hack -- there seems to be no easy generic way how to make a
+ conditional jump from a ccmode comparison. */
+ gcc_assert (cinsn);
+ cond = XEXP (SET_SRC (pc_set (cinsn)), 0);
+ gcc_assert (GET_CODE (cond) == comp);
+ gcc_assert (rtx_equal_p (op0, XEXP (cond, 0)));
+ gcc_assert (rtx_equal_p (op1, XEXP (cond, 1)));
+ emit_jump_insn (copy_insn (PATTERN (cinsn)));
+ jump = get_last_insn ();
+ gcc_assert (JUMP_P (jump));
+ JUMP_LABEL (jump) = JUMP_LABEL (cinsn);
+ LABEL_NUSES (JUMP_LABEL (jump))++;
+ redirect_jump (jump, label, 0);
+ }
+ else
+ {
+ gcc_assert (!cinsn);
+
+ op0 = force_operand (op0, NULL_RTX);
+ op1 = force_operand (op1, NULL_RTX);
+ do_compare_rtx_and_jump (op0, op1, comp, 0,
+ mode, NULL_RTX, NULL_RTX, label, -1);
+ jump = get_last_insn ();
+ gcc_assert (JUMP_P (jump));
+ JUMP_LABEL (jump) = label;
+ LABEL_NUSES (label)++;
+ }
+ add_int_reg_note (jump, REG_BR_PROB, prob);
+
+ seq = get_insns ();
+ end_sequence ();
+
+ return seq;
+}
+
/* Unroll LOOP for which we are able to count number of iterations in runtime
LOOP->LPT_DECISION.TIMES times. The transformation does this (with some
extra care for case n < 0):