This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch to teach jump.c about jumps in parallels.
- To: egcs-patches at egcs dot cygnus dot com, rth at cygnus dot com
- Subject: patch to teach jump.c about jumps in parallels.
- From: Jan Hubicka <jh at suse dot cz>
- Date: Tue, 16 May 2000 17:39:37 +0200
Hi
This patch changes jump.c to use new jumps in parallels infrastructure.
It uses them at most places except for crossjumping, that may be quite
bit trickier for non-simple jumps.
Also it cleans up a bit the unroll.c to use invert_jump and redirect_jump
instead of doing the trick manually.
I've bootstrapped and regression tested on i386 with --enable-checking
and got no problems after reverting the last toplev.c change that
caused quite a lot of new failures.
Honza
Tue May 16 17:30:14 MET DST 2000 Jan Hubicka <jh@suse.cz>
* jump.c (invert_exp_1): Remove first argument, use pc_set
to get the expression.
(redirect_exp): Make static; redirect only the pc_set expression,
remove first argument.
(invert_exp): Remove first argument, make static.
(jump_optimize): Use any_condjump_p, any_uncondjump_p and
any_onlyjump at most places where we originaly did condjump_p
and simplejump_p.
(jump_back_p, follow_jumps, thread_jumps): Likewise.
(delete_barrier_succesors): Use pc_set.
(invert_jump_1, invert_jump, redirect_jump_1, redirect_jump): Update
calls of invert_exp and redirect_exp.
* rtl.h (redirect_exp, invert_exp): Remove.
* unroll.c (copy_loop_body): Use invert_jump and redirect_jump.
Index: egcs/gcc//jump.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/jump.c,v
retrieving revision 1.123
diff -c -3 -p -r1.123 jump.c
*** jump.c 2000/05/16 06:26:54 1.123
--- jump.c 2000/05/16 15:29:51
*************** static int tension_vector_labels PARAMS
*** 122,128 ****
static void mark_jump_label PARAMS ((rtx, rtx, int, int));
static void delete_computation PARAMS ((rtx));
static void redirect_exp_1 PARAMS ((rtx *, rtx, rtx, rtx));
! static void invert_exp_1 PARAMS ((rtx, rtx));
static void delete_from_jump_chain PARAMS ((rtx));
static int delete_labelref_insn PARAMS ((rtx, rtx, int));
static void mark_modified_reg PARAMS ((rtx, rtx, void *));
--- 122,130 ----
static void mark_jump_label PARAMS ((rtx, rtx, int, int));
static void delete_computation PARAMS ((rtx));
static void redirect_exp_1 PARAMS ((rtx *, rtx, rtx, rtx));
! static int redirect_exp PARAMS ((rtx, rtx, rtx));
! static void invert_exp_1 PARAMS ((rtx));
! static int invert_exp PARAMS ((rtx));
static void delete_from_jump_chain PARAMS ((rtx));
static int delete_labelref_insn PARAMS ((rtx, rtx, int));
static void mark_modified_reg PARAMS ((rtx, rtx, void *));
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 300,307 ****
rtx temp, temp1, temp2 = NULL_RTX;
rtx temp4 ATTRIBUTE_UNUSED;
rtx nlabel;
! int this_is_simplejump, this_is_condjump;
! int this_is_condjump_in_parallel;
next = NEXT_INSN (insn);
--- 302,310 ----
rtx temp, temp1, temp2 = NULL_RTX;
rtx temp4 ATTRIBUTE_UNUSED;
rtx nlabel;
! int this_is_any_uncondjump;
! int this_is_any_condjump;
! int this_is_onlyjump;
next = NEXT_INSN (insn);
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 312,318 ****
if (after_regscan && GET_CODE (insn) == NOTE
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
&& (temp1 = next_nonnote_insn (insn)) != 0
! && simplejump_p (temp1))
{
temp = PREV_INSN (insn);
if (duplicate_loop_exit_test (insn))
--- 315,322 ----
if (after_regscan && GET_CODE (insn) == NOTE
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
&& (temp1 = next_nonnote_insn (insn)) != 0
! && any_uncondjump_p (temp1)
! && onlyjump_p (temp1))
{
temp = PREV_INSN (insn);
if (duplicate_loop_exit_test (insn))
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 326,334 ****
if (GET_CODE (insn) != JUMP_INSN)
continue;
! this_is_simplejump = simplejump_p (insn);
! this_is_condjump = condjump_p (insn);
! this_is_condjump_in_parallel = condjump_in_parallel_p (insn);
/* Tension the labels in dispatch tables. */
--- 330,338 ----
if (GET_CODE (insn) != JUMP_INSN)
continue;
! this_is_any_condjump = any_condjump_p (insn);
! this_is_any_uncondjump = any_uncondjump_p (insn);
! this_is_onlyjump = onlyjump_p (insn);
/* Tension the labels in dispatch tables. */
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 392,398 ****
reallabelprev = prev_active_insn (JUMP_LABEL (insn));
/* Detect jump to following insn. */
! if (reallabelprev == insn && this_is_condjump)
{
next = next_real_insn (JUMP_LABEL (insn));
delete_jump (insn);
--- 396,404 ----
reallabelprev = prev_active_insn (JUMP_LABEL (insn));
/* Detect jump to following insn. */
! if (reallabelprev == insn
! && (this_is_any_condjump || this_is_any_uncondjump)
! && this_is_onlyjump)
{
next = next_real_insn (JUMP_LABEL (insn));
delete_jump (insn);
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 402,408 ****
/* Detect a conditional jump going to the same place
as an immediately following unconditional jump. */
! else if (this_is_condjump
&& (temp = next_active_insn (insn)) != 0
&& simplejump_p (temp)
&& (next_active_insn (JUMP_LABEL (insn))
--- 408,414 ----
/* Detect a conditional jump going to the same place
as an immediately following unconditional jump. */
! else if (this_is_any_condjump && this_is_onlyjump
&& (temp = next_active_insn (insn)) != 0
&& simplejump_p (temp)
&& (next_active_insn (JUMP_LABEL (insn))
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 425,437 ****
/* Detect a conditional jump jumping over an unconditional jump. */
! else if ((this_is_condjump || this_is_condjump_in_parallel)
! && ! this_is_simplejump
&& reallabelprev != 0
&& GET_CODE (reallabelprev) == JUMP_INSN
&& prev_active_insn (reallabelprev) == insn
&& no_labels_between_p (insn, reallabelprev)
! && simplejump_p (reallabelprev))
{
/* When we invert the unconditional jump, we will be
decrementing the usage count of its old label.
--- 431,443 ----
/* Detect a conditional jump jumping over an unconditional jump. */
! else if (this_is_any_condjump
&& reallabelprev != 0
&& GET_CODE (reallabelprev) == JUMP_INSN
&& prev_active_insn (reallabelprev) == insn
&& no_labels_between_p (insn, reallabelprev)
! && any_uncondjump_p (reallabelprev)
! && onlyjump_p (reallabelprev))
{
/* When we invert the unconditional jump, we will be
decrementing the usage count of its old label.
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 482,488 ****
being branch to already has the identical USE or if code
never falls through to that label. */
! else if (this_is_simplejump
&& (temp = prev_nonnote_insn (insn)) != 0
&& GET_CODE (temp) == INSN
&& GET_CODE (PATTERN (temp)) == USE
--- 488,494 ----
being branch to already has the identical USE or if code
never falls through to that label. */
! else if (this_is_any_uncondjump
&& (temp = prev_nonnote_insn (insn)) != 0
&& GET_CODE (temp) == INSN
&& GET_CODE (PATTERN (temp)) == USE
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 515,521 ****
#ifdef HAVE_trap
/* Detect a conditional jump jumping over an unconditional trap. */
if (HAVE_trap
! && this_is_condjump && ! this_is_simplejump
&& reallabelprev != 0
&& GET_CODE (reallabelprev) == INSN
&& GET_CODE (PATTERN (reallabelprev)) == TRAP_IF
--- 521,527 ----
#ifdef HAVE_trap
/* Detect a conditional jump jumping over an unconditional trap. */
if (HAVE_trap
! && this_is_any_condjump && this_is_onlyjump
&& reallabelprev != 0
&& GET_CODE (reallabelprev) == INSN
&& GET_CODE (PATTERN (reallabelprev)) == TRAP_IF
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 539,559 ****
}
}
/* Detect a jump jumping to an unconditional trap. */
! else if (HAVE_trap && this_is_condjump
&& (temp = next_active_insn (JUMP_LABEL (insn)))
&& GET_CODE (temp) == INSN
&& GET_CODE (PATTERN (temp)) == TRAP_IF
! && (this_is_simplejump
! || (temp2 = get_condition (insn, &temp4))))
{
rtx tc = TRAP_CONDITION (PATTERN (temp));
if (tc == const_true_rtx
! || (! this_is_simplejump && rtx_equal_p (temp2, tc)))
{
rtx new;
/* Replace an unconditional jump to a trap with a trap. */
! if (this_is_simplejump)
{
emit_barrier_after (emit_insn_before (gen_trap (), insn));
delete_jump (insn);
--- 545,566 ----
}
}
/* Detect a jump jumping to an unconditional trap. */
! else if (HAVE_trap && this_is_onlyjump
&& (temp = next_active_insn (JUMP_LABEL (insn)))
&& GET_CODE (temp) == INSN
&& GET_CODE (PATTERN (temp)) == TRAP_IF
! && (this_is_any_uncondjump
! || (this_is_any_condjump
! && temp2 = get_condition (insn, &temp4))))
{
rtx tc = TRAP_CONDITION (PATTERN (temp));
if (tc == const_true_rtx
! || (! this_is_uncondjump && rtx_equal_p (temp2, tc)))
{
rtx new;
/* Replace an unconditional jump to a trap with a trap. */
! if (this_is_uncondjump)
{
emit_barrier_after (emit_insn_before (gen_trap (), insn));
delete_jump (insn);
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 574,580 ****
/* If the trap condition and jump condition are mutually
exclusive, redirect the jump to the following insn. */
else if (GET_RTX_CLASS (GET_CODE (tc)) == '<'
! && ! this_is_simplejump
&& swap_condition (GET_CODE (temp2)) == GET_CODE (tc)
&& rtx_equal_p (XEXP (tc, 0), XEXP (temp2, 0))
&& rtx_equal_p (XEXP (tc, 1), XEXP (temp2, 1))
--- 581,587 ----
/* If the trap condition and jump condition are mutually
exclusive, redirect the jump to the following insn. */
else if (GET_RTX_CLASS (GET_CODE (tc)) == '<'
! && this_is_any_condjump
&& swap_condition (GET_CODE (temp2)) == GET_CODE (tc)
&& rtx_equal_p (XEXP (tc, 0), XEXP (temp2, 0))
&& rtx_equal_p (XEXP (tc, 1), XEXP (temp2, 1))
*************** delete_barrier_successors (f)
*** 791,796 ****
--- 798,804 ----
rtx f;
{
rtx insn;
+ rtx set;
for (insn = f; insn;)
{
*************** delete_barrier_successors (f)
*** 815,823 ****
gcse. We eliminate such insns now to avoid having them
cause problems later. */
else if (GET_CODE (insn) == JUMP_INSN
! && GET_CODE (PATTERN (insn)) == SET
! && SET_SRC (PATTERN (insn)) == pc_rtx
! && SET_DEST (PATTERN (insn)) == pc_rtx)
insn = delete_insn (insn);
else
--- 823,832 ----
gcse. We eliminate such insns now to avoid having them
cause problems later. */
else if (GET_CODE (insn) == JUMP_INSN
! && (set = pc_set (insn)) != NULL
! && SET_SRC (set) == pc_rtx
! && SET_DEST (set) == pc_rtx
! && onlyjump_p (insn))
insn = delete_insn (insn);
else
*************** jump_back_p (insn, target)
*** 1701,1726 ****
{
rtx cinsn, ctarget;
enum rtx_code codei, codet;
! if (simplejump_p (insn) || ! condjump_p (insn)
! || simplejump_p (target)
|| target != prev_real_insn (JUMP_LABEL (insn)))
return 0;
! cinsn = XEXP (SET_SRC (PATTERN (insn)), 0);
! ctarget = XEXP (SET_SRC (PATTERN (target)), 0);
codei = GET_CODE (cinsn);
codet = GET_CODE (ctarget);
! if (XEXP (SET_SRC (PATTERN (insn)), 1) == pc_rtx)
{
if (! can_reverse_comparison_p (cinsn, insn))
return 0;
codei = reverse_condition (codei);
}
! if (XEXP (SET_SRC (PATTERN (target)), 2) == pc_rtx)
{
if (! can_reverse_comparison_p (ctarget, target))
return 0;
--- 1710,1738 ----
{
rtx cinsn, ctarget;
enum rtx_code codei, codet;
+ rtx set, tset;
! if (! any_condjump_p (insn)
! || any_uncondjump_p (target)
|| target != prev_real_insn (JUMP_LABEL (insn)))
return 0;
+ set = pc_set (insn);
+ tset = pc_set (target);
! cinsn = XEXP (SET_SRC (set), 0);
! ctarget = XEXP (SET_SRC (tset), 0);
codei = GET_CODE (cinsn);
codet = GET_CODE (ctarget);
! if (XEXP (SET_SRC (set), 1) == pc_rtx)
{
if (! can_reverse_comparison_p (cinsn, insn))
return 0;
codei = reverse_condition (codei);
}
! if (XEXP (SET_SRC (tset), 2) == pc_rtx)
{
if (! can_reverse_comparison_p (ctarget, target))
return 0;
*************** follow_jumps (label)
*** 2341,2347 ****
(depth < 10
&& (insn = next_active_insn (value)) != 0
&& GET_CODE (insn) == JUMP_INSN
! && ((JUMP_LABEL (insn) != 0 && simplejump_p (insn))
|| GET_CODE (PATTERN (insn)) == RETURN)
&& (next = NEXT_INSN (insn))
&& GET_CODE (next) == BARRIER);
--- 2354,2361 ----
(depth < 10
&& (insn = next_active_insn (value)) != 0
&& GET_CODE (insn) == JUMP_INSN
! && ((JUMP_LABEL (insn) != 0 && any_uncondjump_p (insn)
! && onlyjump_p (insn))
|| GET_CODE (PATTERN (insn)) == RETURN)
&& (next = NEXT_INSN (insn))
&& GET_CODE (next) == BARRIER);
*************** redirect_exp_1 (loc, olabel, nlabel, ins
*** 3139,3149 ****
/* Similar, but apply the change group and report success or failure. */
int
! redirect_exp (loc, olabel, nlabel, insn)
! rtx *loc;
rtx olabel, nlabel;
rtx insn;
{
redirect_exp_1 (loc, olabel, nlabel, insn);
if (num_validated_changes () == 0)
return 0;
--- 3153,3167 ----
/* Similar, but apply the change group and report success or failure. */
int
! redirect_exp (olabel, nlabel, insn)
rtx olabel, nlabel;
rtx insn;
{
+ rtx *loc;
+ if (GET_CODE (PATTERN (insn)) == PARALLEL)
+ loc = &XVECEXP (PATTERN (insn), 0, 0);
+ else
+ loc = &PATTERN (insn);
redirect_exp_1 (loc, olabel, nlabel, insn);
if (num_validated_changes () == 0)
return 0;
*************** redirect_jump_1 (jump, nlabel)
*** 3160,3166 ****
rtx jump, nlabel;
{
int ochanges = num_validated_changes ();
! redirect_exp_1 (&PATTERN (jump), JUMP_LABEL (jump), nlabel, jump);
return num_validated_changes () > ochanges;
}
--- 3178,3185 ----
rtx jump, nlabel;
{
int ochanges = num_validated_changes ();
! rtx set = pc_set (jump);
! redirect_exp_1 (&set, JUMP_LABEL (jump), nlabel, jump);
return num_validated_changes () > ochanges;
}
*************** redirect_jump (jump, nlabel)
*** 3183,3189 ****
if (nlabel == olabel)
return 1;
! if (! redirect_exp (&PATTERN (jump), olabel, nlabel, jump))
return 0;
/* If this is an unconditional branch, delete it from the jump_chain of
--- 3202,3208 ----
if (nlabel == olabel)
return 1;
! if (! redirect_exp (olabel, nlabel, jump))
return 0;
/* If this is an unconditional branch, delete it from the jump_chain of
*************** redirect_jump (jump, nlabel)
*** 3224,3236 ****
Accrue the modifications into the change group. */
static void
! invert_exp_1 (x, insn)
! rtx x;
rtx insn;
{
register RTX_CODE code;
! register int i;
! register const char *fmt;
code = GET_CODE (x);
--- 3243,3257 ----
Accrue the modifications into the change group. */
static void
! invert_exp_1 (insn)
rtx insn;
{
register RTX_CODE code;
! rtx x = pc_set (insn);
!
! if (!x)
! abort();
! x = SET_SRC (x);
code = GET_CODE (x);
*************** invert_exp_1 (x, insn)
*** 3257,3290 ****
tem = XEXP (x, 1);
validate_change (insn, &XEXP (x, 1), XEXP (x, 2), 1);
validate_change (insn, &XEXP (x, 2), tem, 1);
- return;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- invert_exp_1 (XEXP (x, i), insn);
- else if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- invert_exp_1 (XVECEXP (x, i, j), insn);
- }
}
}
! /* Invert the jump condition of rtx X contained in jump insn, INSN.
Return 1 if we can do so, 0 if we cannot find a way to do so that
matches a pattern. */
! int
! invert_exp (x, insn)
! rtx x;
rtx insn;
{
! invert_exp_1 (x, insn);
if (num_validated_changes () == 0)
return 0;
--- 3278,3298 ----
tem = XEXP (x, 1);
validate_change (insn, &XEXP (x, 1), XEXP (x, 2), 1);
validate_change (insn, &XEXP (x, 2), tem, 1);
}
+ else
+ abort ();
}
! /* Invert the jump condition of conditional jump insn, INSN.
Return 1 if we can do so, 0 if we cannot find a way to do so that
matches a pattern. */
! static int
! invert_exp (insn)
rtx insn;
{
! invert_exp_1 (insn);
if (num_validated_changes () == 0)
return 0;
*************** invert_jump_1 (jump, nlabel)
*** 3303,3309 ****
int ochanges;
ochanges = num_validated_changes ();
! invert_exp_1 (PATTERN (jump), jump);
if (num_validated_changes () == ochanges)
return 0;
--- 3311,3317 ----
int ochanges;
ochanges = num_validated_changes ();
! invert_exp_1 (jump);
if (num_validated_changes () == ochanges)
return 0;
*************** invert_jump (jump, nlabel)
*** 3322,3328 ****
the jump. If that succeeds, we try changing the label. If that fails,
we invert the jump back to what it was. */
! if (! invert_exp (PATTERN (jump), jump))
return 0;
if (redirect_jump (jump, nlabel))
--- 3330,3336 ----
the jump. If that succeeds, we try changing the label. If that fails,
we invert the jump back to what it was. */
! if (! invert_exp (jump))
return 0;
if (redirect_jump (jump, nlabel))
*************** invert_jump (jump, nlabel)
*** 3338,3344 ****
return 1;
}
! if (! invert_exp (PATTERN (jump), jump))
/* This should just be putting it back the way it was. */
abort ();
--- 3346,3352 ----
return 1;
}
! if (! invert_exp (jump))
/* This should just be putting it back the way it was. */
abort ();
*************** thread_jumps (f, max_reg, flag_before_lo
*** 3776,3785 ****
for (b1 = f; b1; b1 = NEXT_INSN (b1))
{
/* Get to a candidate branch insn. */
if (GET_CODE (b1) != JUMP_INSN
! || ! condjump_p (b1) || simplejump_p (b1)
! || JUMP_LABEL (b1) == 0)
continue;
bzero (modified_regs, max_reg * sizeof (char));
--- 3784,3794 ----
for (b1 = f; b1; b1 = NEXT_INSN (b1))
{
+ rtx set;
+ rtx set2;
/* Get to a candidate branch insn. */
if (GET_CODE (b1) != JUMP_INSN
! || ! any_condjump_p (b1) || JUMP_LABEL (b1) == 0)
continue;
bzero (modified_regs, max_reg * sizeof (char));
*************** thread_jumps (f, max_reg, flag_before_lo
*** 3803,3809 ****
{
/* If this is an unconditional jump and is the only use of
its target label, we can follow it. */
! if (simplejump_p (b2)
&& JUMP_LABEL (b2) != 0
&& LABEL_NUSES (JUMP_LABEL (b2)) == 1)
{
--- 3812,3819 ----
{
/* If this is an unconditional jump and is the only use of
its target label, we can follow it. */
! if (any_uncondjump_p (b2)
! && onlyjump_p (b2)
&& JUMP_LABEL (b2) != 0
&& LABEL_NUSES (JUMP_LABEL (b2)) == 1)
{
*************** thread_jumps (f, max_reg, flag_before_lo
*** 3837,3859 ****
if (b2 == 0
|| GET_CODE (b2) != JUMP_INSN
|| b2 == b1
! || ! condjump_p (b2)
! || simplejump_p (b2))
continue;
/* Get the comparison codes and operands, reversing the
codes if appropriate. If we don't have comparison codes,
we can't do anything. */
! b1op0 = XEXP (XEXP (SET_SRC (PATTERN (b1)), 0), 0);
! b1op1 = XEXP (XEXP (SET_SRC (PATTERN (b1)), 0), 1);
! code1 = GET_CODE (XEXP (SET_SRC (PATTERN (b1)), 0));
! if (XEXP (SET_SRC (PATTERN (b1)), 1) == pc_rtx)
code1 = reverse_condition (code1);
! b2op0 = XEXP (XEXP (SET_SRC (PATTERN (b2)), 0), 0);
! b2op1 = XEXP (XEXP (SET_SRC (PATTERN (b2)), 0), 1);
! code2 = GET_CODE (XEXP (SET_SRC (PATTERN (b2)), 0));
! if (XEXP (SET_SRC (PATTERN (b2)), 1) == pc_rtx)
code2 = reverse_condition (code2);
/* If they test the same things and knowing that B1 branches
--- 3847,3871 ----
if (b2 == 0
|| GET_CODE (b2) != JUMP_INSN
|| b2 == b1
! || !any_condjump_p (b2)
! || !onlyjump_p (b2))
continue;
+ set = pc_set (b1);
+ set2 = pc_set (b2);
/* Get the comparison codes and operands, reversing the
codes if appropriate. If we don't have comparison codes,
we can't do anything. */
! b1op0 = XEXP (XEXP (SET_SRC (set), 0), 0);
! b1op1 = XEXP (XEXP (SET_SRC (set), 0), 1);
! code1 = GET_CODE (XEXP (SET_SRC (set), 0));
! if (XEXP (SET_SRC (set), 1) == pc_rtx)
code1 = reverse_condition (code1);
! b2op0 = XEXP (XEXP (SET_SRC (set2), 0), 0);
! b2op1 = XEXP (XEXP (SET_SRC (set2), 0), 1);
! code2 = GET_CODE (XEXP (SET_SRC (set2), 0));
! if (XEXP (SET_SRC (set2), 1) == pc_rtx)
code2 = reverse_condition (code2);
/* If they test the same things and knowing that B1 branches
*************** thread_jumps (f, max_reg, flag_before_lo
*** 3862,3870 ****
if (rtx_equal_for_thread_p (b1op0, b2op0, b2)
&& rtx_equal_for_thread_p (b1op1, b2op1, b2)
&& (comparison_dominates_p (code1, code2)
! || (can_reverse_comparison_p (XEXP (SET_SRC (PATTERN (b1)),
! 0),
! b1)
&& comparison_dominates_p (code1, reverse_condition (code2)))))
{
--- 3874,3880 ----
if (rtx_equal_for_thread_p (b1op0, b2op0, b2)
&& rtx_equal_for_thread_p (b1op1, b2op1, b2)
&& (comparison_dominates_p (code1, code2)
! || (can_reverse_comparison_p (XEXP (SET_SRC (set), 0), b1)
&& comparison_dominates_p (code1, reverse_condition (code2)))))
{
Index: egcs/gcc//rtl.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.h,v
retrieving revision 1.201
diff -c -3 -p -r1.201 rtl.h
*** rtl.h 2000/05/15 19:53:07 1.201
--- rtl.h 2000/05/16 15:29:51
*************** extern void jump_optimize PARAMS ((rtx,
*** 1530,1538 ****
extern void jump_optimize_minimal PARAMS ((rtx));
extern void rebuild_jump_labels PARAMS ((rtx));
extern void thread_jumps PARAMS ((rtx, int, int));
- extern int redirect_exp PARAMS ((rtx *, rtx, rtx, rtx));
extern int rtx_equal_for_thread_p PARAMS ((rtx, rtx, rtx));
- extern int invert_exp PARAMS ((rtx, rtx));
extern int can_reverse_comparison_p PARAMS ((rtx, rtx));
extern void delete_for_peephole PARAMS ((rtx, rtx));
extern int condjump_in_parallel_p PARAMS ((rtx));
--- 1530,1536 ----
Index: egcs/gcc//unroll.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/unroll.c,v
retrieving revision 1.97
diff -c -3 -p -r1.97 unroll.c
*** unroll.c 2000/05/12 16:26:15 1.97
--- unroll.c 2000/05/16 15:29:58
*************** copy_loop_body (copy_start, copy_end, ma
*** 2035,2057 ****
if (JUMP_LABEL (insn) == start_label && insn == copy_end
&& ! last_iteration)
{
/* This is a branch to the beginning of the loop; this is the
last insn being copied; and this is not the last iteration.
In this case, we want to change the original fall through
case to be a branch past the end of the loop, and the
original jump label case to fall_through. */
! if (invert_exp (pattern, copy))
{
- if (! redirect_exp (&pattern,
- get_label_from_map (map,
- CODE_LABEL_NUMBER
- (JUMP_LABEL (insn))),
- exit_label, copy))
- abort ();
- }
- else
- {
rtx jmp;
rtx lab = gen_label_rtx ();
/* Can't do it by reversing the jump (probably because we
--- 2035,2052 ----
if (JUMP_LABEL (insn) == start_label && insn == copy_end
&& ! last_iteration)
{
+ /* Update JUMP_LABEL correctly to make invert_jump working. */
+ JUMP_LABEL (copy) = get_label_from_map (map,
+ CODE_LABEL_NUMBER
+ (JUMP_LABEL (insn)));
/* This is a branch to the beginning of the loop; this is the
last insn being copied; and this is not the last iteration.
In this case, we want to change the original fall through
case to be a branch past the end of the loop, and the
original jump label case to fall_through. */
! if (!invert_jump (copy, exit_label))
{
rtx jmp;
rtx lab = gen_label_rtx ();
/* Can't do it by reversing the jump (probably because we
*************** copy_loop_body (copy_start, copy_end, ma
*** 2062,2073 ****
jmp = emit_barrier_after (jmp);
emit_label_after (lab, jmp);
LABEL_NUSES (lab) = 0;
! if (! redirect_exp (&pattern,
! get_label_from_map (map,
! CODE_LABEL_NUMBER
! (JUMP_LABEL (insn))),
! lab, copy))
! abort ();
}
}
--- 2057,2064 ----
jmp = emit_barrier_after (jmp);
emit_label_after (lab, jmp);
LABEL_NUSES (lab) = 0;
! if (!redirect_jump (copy, lab))
! abort();
}
}