Subject: tester needed for egcs patches
To: None <port-m68k@netbsd.org>
From: SAITOH Masanobu <masanobu@iij.ad.jp>
List: port-m68k
Date: 12/22/2000 22:51:04
Hello.
I'm going to apply following patches to src/gnu/dist/gcc/.
These patches fixes some problems (it contains PR#11696 and 11697, too).
I've tested most CPU architectures except m68k. At lease, it doesn't
got worse for me.
If it got worse, please report to me.
Thanks.
Index: combine.c
===================================================================
RCS file: /cvsroot/stone/src/gnu/dist/gcc/combine.c,v
retrieving revision 1.2
diff -c -r1.2 combine.c
*** combine.c 2000/12/15 23:36:01 1.2
--- combine.c 2000/12/20 12:51:50
***************
*** 3355,3391 ****
true = subst (true, pc_rtx, pc_rtx, 0, 0);
false = subst (false, pc_rtx, pc_rtx, 0, 0);
! /* Restarting if we generate a store-flag expression will cause
! us to loop. Just drop through in this case. */
/* If the result values are STORE_FLAG_VALUE and zero, we can
just make the comparison operation. */
! if (true == const_true_rtx && false == const0_rtx)
! x = gen_binary (cond_code, mode, cond, cop1);
! else if (true == const0_rtx && false == const_true_rtx)
! x = gen_binary (reverse_condition (cond_code), mode, cond, cop1);
/* Likewise, we can make the negate of a comparison operation
if the result values are - STORE_FLAG_VALUE and zero. */
! else if (GET_CODE (true) == CONST_INT
! && INTVAL (true) == - STORE_FLAG_VALUE
! && false == const0_rtx)
! x = gen_unary (NEG, mode, mode,
! gen_binary (cond_code, mode, cond, cop1));
! else if (GET_CODE (false) == CONST_INT
! && INTVAL (false) == - STORE_FLAG_VALUE
! && true == const0_rtx)
! x = gen_unary (NEG, mode, mode,
! gen_binary (reverse_condition (cond_code),
! mode, cond, cop1));
! else
! return gen_rtx_IF_THEN_ELSE (mode,
! gen_binary (cond_code, VOIDmode,
! cond, cop1),
! true, false);
! code = GET_CODE (x);
! op0_mode = VOIDmode;
}
}
--- 3355,3398 ----
true = subst (true, pc_rtx, pc_rtx, 0, 0);
false = subst (false, pc_rtx, pc_rtx, 0, 0);
! /* If true and false are not general_operands, an if_then_else
! is unlikely to be simpler. */
! if (general_operand (true, VOIDmode)
! && general_operand (false, VOIDmode))
! {
! /* Restarting if we generate a store-flag expression will cause
! us to loop. Just drop through in this case. */
/* If the result values are STORE_FLAG_VALUE and zero, we can
just make the comparison operation. */
! if (true == const_true_rtx && false == const0_rtx)
! x = gen_binary (cond_code, mode, cond, cop1);
! else if (true == const0_rtx && false == const_true_rtx)
! x = gen_binary (reverse_condition (cond_code),
! mode, cond, cop1);
/* Likewise, we can make the negate of a comparison operation
if the result values are - STORE_FLAG_VALUE and zero. */
! else if (GET_CODE (true) == CONST_INT
! && INTVAL (true) == - STORE_FLAG_VALUE
! && false == const0_rtx)
! x = gen_unary (NEG, mode, mode,
! gen_binary (cond_code, mode, cond, cop1));
! else if (GET_CODE (false) == CONST_INT
! && INTVAL (false) == - STORE_FLAG_VALUE
! && true == const0_rtx)
! x = gen_unary (NEG, mode, mode,
! gen_binary (reverse_condition (cond_code),
! mode, cond, cop1));
! else
! return gen_rtx_IF_THEN_ELSE (mode,
! gen_binary (cond_code, VOIDmode,
! cond, cop1),
! true, false);
! code = GET_CODE (x);
! op0_mode = VOIDmode;
! }
}
}
***************
*** 6738,6746 ****
rtx cond0, cond1, true0, true1, false0, false1;
unsigned HOST_WIDE_INT nz;
/* If this is a unary operation whose operand has one of two values, apply
our opcode to compute those values. */
! if (GET_RTX_CLASS (code) == '1'
&& (cond0 = if_then_else_cond (XEXP (x, 0), &true0, &false0)) != 0)
{
*ptrue = gen_unary (code, mode, GET_MODE (XEXP (x, 0)), true0);
--- 6745,6762 ----
rtx cond0, cond1, true0, true1, false0, false1;
unsigned HOST_WIDE_INT nz;
+ /* If we are comparing a value against zero, we are done. */
+ if ((code == NE || code == EQ)
+ && GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) == 0)
+ {
+ *ptrue = (code == NE) ? const_true_rtx : const0_rtx;
+ *pfalse = (code == NE) ? const0_rtx : const_true_rtx;
+ return XEXP (x, 0);
+ }
+
/* If this is a unary operation whose operand has one of two values, apply
our opcode to compute those values. */
! else if (GET_RTX_CLASS (code) == '1'
&& (cond0 = if_then_else_cond (XEXP (x, 0), &true0, &false0)) != 0)
{
*ptrue = gen_unary (code, mode, GET_MODE (XEXP (x, 0)), true0);
Index: rtlanal.c
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/gcc/rtlanal.c,v
retrieving revision 1.1.1.2
diff -p -p -r1.1.1.2 rtlanal.c
*** rtlanal.c 1998/08/16 17:38:20 1.1.1.2
--- rtlanal.c 2000/12/11 23:41:35
*************** reg_set_p (reg, insn)
*** 500,505 ****
--- 500,551 ----
}
/* Similar to reg_set_between_p, but check all registers in X. Return 0
+ only if none of them are modified between START and END. Do not
+ consider non-registers one way or the other. */
+
+ int
+ regs_set_between_p (x, start, end)
+ rtx x;
+ rtx start, end;
+ {
+ enum rtx_code code = GET_CODE (x);
+ char *fmt;
+ int i, j;
+
+ switch (code)
+ {
+ case CONST_INT:
+ case CONST_DOUBLE:
+ case CONST:
+ case SYMBOL_REF:
+ case LABEL_REF:
+ case PC:
+ case CC0:
+ return 0;
+
+ case REG:
+ return reg_set_between_p (x, start, end);
+
+ default:
+ break;
+ }
+
+ fmt = GET_RTX_FORMAT (code);
+ for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
+ {
+ if (fmt[i] == 'e' && regs_set_between_p (XEXP (x, i), start, end))
+ return 1;
+
+ else if (fmt[i] == 'E')
+ for (j = XVECLEN (x, i) - 1; j >= 0; j--)
+ if (regs_set_between_p (XVECEXP (x, i, j), start, end))
+ return 1;
+ }
+
+ return 0;
+ }
+
+ /* Similar to reg_set_between_p, but check all registers in X. Return 0
only if none of them are modified between START and END. Return 1 if
X contains a MEM; this routine does not perform any memory aliasing. */
Index: rtl.h
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/gcc/rtl.h,v
retrieving revision 1.1.1.2
diff -p -p -r1.1.1.2 rtl.h
*** rtl.h 1998/08/16 17:38:19 1.1.1.2
--- rtl.h 2000/12/11 23:41:58
*************** extern int reg_referenced_p PROTO((rtx,
*** 973,978 ****
--- 973,979 ----
extern int reg_used_between_p PROTO((rtx, rtx, rtx));
extern int reg_referenced_between_p PROTO((rtx, rtx, rtx));
extern int reg_set_between_p PROTO((rtx, rtx, rtx));
+ extern int regs_set_between_p PROTO((rtx, rtx, rtx));
extern int modified_between_p PROTO((rtx, rtx, rtx));
extern int no_labels_between_p PROTO((rtx, rtx));
extern int modified_in_p PROTO((rtx, rtx));
Index: jump.c
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/gcc/jump.c,v
retrieving revision 1.1.1.4
diff -p -p -r1.1.1.4 jump.c
*** jump.c 1999/04/06 15:08:13 1.1.1.4
--- jump.c 2000/12/11 23:42:50
*************** jump_optimize (f, cross_jump, noop_moves
*** 862,868 ****
&& ! reg_referenced_between_p (temp1, p, NEXT_INSN (temp3))
&& ! reg_set_between_p (temp1, p, temp3)
&& (GET_CODE (SET_SRC (temp4)) == CONST_INT
! || ! modified_between_p (SET_SRC (temp4), p, temp2)))
{
emit_insn_after_with_line_notes (PATTERN (temp2), p, temp2);
delete_insn (temp2);
--- 866,877 ----
&& ! reg_referenced_between_p (temp1, p, NEXT_INSN (temp3))
&& ! reg_set_between_p (temp1, p, temp3)
&& (GET_CODE (SET_SRC (temp4)) == CONST_INT
! || ! modified_between_p (SET_SRC (temp4), p, temp2))
! /* Verify that registers used by the jump are not clobbered
! by the instruction being moved. */
! && ! regs_set_between_p (PATTERN (temp),
! PREV_INSN (temp2),
! NEXT_INSN (temp2)))
{
emit_insn_after_with_line_notes (PATTERN (temp2), p, temp2);
delete_insn (temp2);
*************** jump_optimize (f, cross_jump, noop_moves
*** 960,965 ****
--- 969,979 ----
NEXT_INSN (temp2))
&& ! reg_set_between_p (temp1, insert_after, temp)
&& ! modified_between_p (SET_SRC (temp4), insert_after, temp)
+ /* Verify that registers used by the jump are not clobbered
+ by the instruction being moved. */
+ && ! regs_set_between_p (PATTERN (temp),
+ PREV_INSN (temp3),
+ NEXT_INSN (temp3))
&& invert_jump (temp, JUMP_LABEL (insn)))
{
emit_insn_after_with_line_notes (PATTERN (temp3),
Index: jump.c
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/gcc/jump.c,v
retrieving revision 1.1.1.4
diff -p -p -r1.1.1.4 jump.c
*** jump.c 1999/04/06 15:08:13 1.1.1.4
--- jump.c 2000/12/11 23:42:50
*************** jump_optimize (f, cross_jump, noop_moves
*** 676,694 ****
int diff_vec_p = GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC;
int len = XVECLEN (pat, diff_vec_p);
rtx dispatch = prev_real_insn (insn);
for (i = 0; i < len; i++)
if (XEXP (XVECEXP (pat, diff_vec_p, i), 0)
!= XEXP (XVECEXP (pat, diff_vec_p, 0), 0))
break;
if (i == len
&& dispatch != 0
&& GET_CODE (dispatch) == JUMP_INSN
&& JUMP_LABEL (dispatch) != 0
! /* Don't mess with a casesi insn. */
! && !(GET_CODE (PATTERN (dispatch)) == SET
! && (GET_CODE (SET_SRC (PATTERN (dispatch)))
! == IF_THEN_ELSE))
&& next_real_insn (JUMP_LABEL (dispatch)) == insn)
{
redirect_tablejump (dispatch,
--- 676,698 ----
int diff_vec_p = GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC;
int len = XVECLEN (pat, diff_vec_p);
rtx dispatch = prev_real_insn (insn);
+ rtx set;
for (i = 0; i < len; i++)
if (XEXP (XVECEXP (pat, diff_vec_p, i), 0)
!= XEXP (XVECEXP (pat, diff_vec_p, 0), 0))
break;
+
if (i == len
&& dispatch != 0
&& GET_CODE (dispatch) == JUMP_INSN
&& JUMP_LABEL (dispatch) != 0
! /* Don't mess with a casesi insn.
! XXX according to the comment before computed_jump_p(),
! all casesi insns should be a parallel of the jump
! and a USE of a LABEL_REF. */
! && ! ((set = single_set (dispatch)) != NULL
! && (GET_CODE (SET_SRC (set)) == IF_THEN_ELSE))
&& next_real_insn (JUMP_LABEL (dispatch)) == insn)
{
redirect_tablejump (dispatch,