summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel/gcc/files/gcc-2.96.20000731/gcc-relational.patch')
-rw-r--r--sys-devel/gcc/files/gcc-2.96.20000731/gcc-relational.patch738
1 files changed, 0 insertions, 738 deletions
diff --git a/sys-devel/gcc/files/gcc-2.96.20000731/gcc-relational.patch b/sys-devel/gcc/files/gcc-2.96.20000731/gcc-relational.patch
deleted file mode 100644
index 1d67da85c892..000000000000
--- a/sys-devel/gcc/files/gcc-2.96.20000731/gcc-relational.patch
+++ /dev/null
@@ -1,738 +0,0 @@
-Thu Aug 3 20:18:53 MET DST 2000 Jan Hubicka <jh@suse.cz>
-
- * combine.c (gen_binary): Refuse relational operations.
- (gen_relational): New
- (combine_splify_rtx): Keep track of mode of the comparsion,
- avoid creating VOIDmode comparisons.
- (simplify_if_then_else): Use gen_relational at the place
- we create relational operations.
- (simplify_set): Avoid creating of VOIDmode compares.
- (if_then_else_cond): Keep track of the comparison mode.
- (simplify_comparison): New parameter pmode, update it when
- mode has changed.
- * recog.c (validate_replace_rtx_1): Simplify relational
- operations, avoid VOIDmode compares.
- * simplify-rtx.c (simplify_relational_operation): Require
- mode to be valid; get valid mode from the COMPARE
- expression; strip down the CONST.
-
---- gcc/recog.c.jj Wed Aug 2 21:34:09 2000
-+++ gcc/recog.c Fri Aug 18 15:26:59 2000
-@@ -456,12 +456,45 @@ validate_replace_rtx_1 (loc, from, to, o
-
- switch (code)
- {
-+ case COMPARE:
-+ /* Comparison of two VOIDmode values is incorrect. We get around
-+ by embedding first VOIDmode value by CONST with proper mode.
-+ Resulting insn would not match, but this is usefull for keeping
-+ the information in REG_EQUAL notes constructed by gcse. */
-+ if (GET_MODE (to) == VOIDmode)
-+ {
-+ enum machine_mode mode;
-+ rtx op0, op1;
-+ op0 = XEXP (x, 0);
-+ op1 = XEXP (x, 1);
-+ mode = GET_MODE (GET_MODE (op0) != VOIDmode ? op0 : op1);
-+ /* Comparison of two VOIDmode values in incorrect. */
-+ if (mode == VOIDmode)
-+ abort();
-+ if (rtx_equal_p (op0, from))
-+ op0 = to;
-+ if (rtx_equal_p (op1, from))
-+ op1 = to;
-+ if (GET_MODE (op0) == VOIDmode
-+ && GET_MODE (op1) == VOIDmode)
-+ {
-+ validate_change (object, &XEXP (*loc, 0),
-+ gen_rtx_CONST (mode, op0), 1);
-+ validate_change (object, &XEXP (*loc, 1),
-+ op1, 1);
-+ return;
-+ }
-+ }
-+ break;
- case PLUS:
- /* If we have a PLUS whose second operand is now a CONST_INT, use
- plus_constant to try to simplify it. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT && XEXP (x, 1) == to)
-- validate_change (object, loc, plus_constant (XEXP (x, 0), INTVAL (to)),
-- 1);
-+ {
-+ validate_change (object, loc, plus_constant (XEXP (x, 0),
-+ INTVAL (to)),
-+ 1);
-+ }
- return;
-
- case MINUS:
-@@ -638,6 +671,25 @@ validate_replace_rtx_1 (loc, from, to, o
- break;
-
- default:
-+ /* We need to take care for simplifying the comparisons. In case we replace
-+ both operands by VOIDmode constants, the information about the rtx type is
-+ lost. */
-+ if (GET_RTX_CLASS (code) == '<'
-+ && (rtx_equal_p (XEXP (x, 0), from)
-+ || rtx_equal_p (XEXP (x, 1), from)))
-+ {
-+ rtx y;
-+ enum machine_mode mode = GET_MODE (GET_MODE (XEXP (x, 0)) != VOIDmode
-+ ? XEXP (x, 0) : XEXP (x, 1));
-+ y = simplify_relational_operation (code, mode,
-+ rtx_equal_p (XEXP (x, 0), from) ? to : XEXP (x, 0),
-+ rtx_equal_p (XEXP (x, 1), from) ? to : XEXP (x, 1));
-+ if (y)
-+ {
-+ validate_change (object, loc, y, 1);
-+ return;
-+ }
-+ }
- break;
- }
-
---- gcc/combine.c.jj Wed Aug 2 21:34:06 2000
-+++ gcc/combine.c Fri Aug 18 15:44:01 2000
-@@ -414,9 +414,14 @@ static rtx gen_rtx_combine PARAMS ((enum
- ...));
- static rtx gen_binary PARAMS ((enum rtx_code, enum machine_mode,
- rtx, rtx));
-+static rtx gen_relational PARAMS ((enum rtx_code, enum machine_mode,
-+ enum machine_mode,
-+ rtx, rtx));
- static rtx gen_unary PARAMS ((enum rtx_code, enum machine_mode,
- enum machine_mode, rtx));
--static enum rtx_code simplify_comparison PARAMS ((enum rtx_code, rtx *, rtx *));
-+static enum rtx_code simplify_comparison PARAMS ((enum rtx_code,
-+ enum machine_mode *,
-+ rtx *, rtx *));
- static int reversible_comparison_p PARAMS ((rtx));
- static void update_table_tick PARAMS ((rtx));
- static void record_value_for_reg PARAMS ((rtx, rtx, rtx));
-@@ -3579,7 +3584,10 @@ combine_simplify_rtx (x, op0_mode, last,
- || GET_RTX_CLASS (GET_CODE (false)) == '<')))
- {
- rtx cop1 = const0_rtx;
-- enum rtx_code cond_code = simplify_comparison (NE, &cond, &cop1);
-+ enum machine_mode cond_mode = GET_MODE (cond);
-+ enum rtx_code cond_code;
-+
-+ cond_code = simplify_comparison (NE, &cond_mode, &cond, &cop1);
-
- if (cond_code == NE && GET_RTX_CLASS (GET_CODE (cond)) == '<')
- return x;
-@@ -3600,10 +3608,10 @@ combine_simplify_rtx (x, op0_mode, last,
- /* 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);
-+ x = gen_relational (cond_code, mode, cond_mode, cond, cop1);
- else if (true == const0_rtx && false == const_true_rtx)
-- x = gen_binary (reverse_condition (cond_code),
-- mode, cond, cop1);
-+ x = gen_relational (reverse_condition (cond_code),
-+ mode, cond_mode, cond, cop1);
-
- /* Likewise, we can make the negate of a comparison operation
- if the result values are - STORE_FLAG_VALUE and zero. */
-@@ -3611,17 +3619,18 @@ combine_simplify_rtx (x, op0_mode, last,
- && INTVAL (true) == - STORE_FLAG_VALUE
- && false == const0_rtx)
- x = gen_unary (NEG, mode, mode,
-- gen_binary (cond_code, mode, cond, cop1));
-+ gen_relational (cond_code, mode, cond_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));
-+ gen_relational (reverse_condition (cond_code),
-+ mode, cond_mode, cond, cop1));
- else
- return gen_rtx_IF_THEN_ELSE (mode,
-- gen_binary (cond_code, VOIDmode,
-- cond, cop1),
-+ gen_relational (cond_code, VOIDmode,
-+ cond_mode, cond, cop1),
- true, false);
-
- code = GET_CODE (x);
-@@ -3643,6 +3652,8 @@ combine_simplify_rtx (x, op0_mode, last,
- enum machine_mode cmp_mode = GET_MODE (XEXP (x, 0));
- if (cmp_mode == VOIDmode)
- cmp_mode = GET_MODE (XEXP (x, 1));
-+ if (cmp_mode == VOIDmode)
-+ cmp_mode = op0_mode;
- temp = simplify_relational_operation (code, cmp_mode,
- XEXP (x, 0), XEXP (x, 1));
- }
-@@ -4165,8 +4176,8 @@ combine_simplify_rtx (x, op0_mode, last,
- return SUBREG_REG (XEXP (x, 0));
- break;
-
--#ifdef HAVE_cc0
- case COMPARE:
-+#ifdef HAVE_cc0
- /* Convert (compare FOO (const_int 0)) to FOO unless we aren't
- using cc0, in which case we want to leave it as a COMPARE
- so we can distinguish it from a register-register-copy. */
-@@ -4179,8 +4190,22 @@ combine_simplify_rtx (x, op0_mode, last,
- || flag_fast_math)
- && XEXP (x, 1) == CONST0_RTX (GET_MODE (XEXP (x, 0))))
- return XEXP (x, 0);
-- break;
- #endif
-+ /* Comparisons in VOIDmode are not allowed and we will get into
-+ deep problem in the next iteration if COMPARE was nested inside
-+ comparison operator. We avoid this by placing extra CONST with
-+ proper mode and taking care in simplify_condition to eliminate it
-+ when it is not necesary - ugly but workable. */
-+ if (GET_MODE (XEXP (x, 0)) == VOIDmode
-+ && GET_MODE (XEXP (x, 1)) == VOIDmode)
-+ {
-+ if (op0_mode == VOIDmode)
-+ abort();
-+ SUBST (XEXP (x, 0), gen_rtx_CONST (op0_mode, XEXP (x, 0)));
-+ return x;
-+ }
-+ break;
-+
-
- case CONST:
- /* (const (const X)) can become (const X). Do it this way rather than
-@@ -4249,9 +4274,9 @@ combine_simplify_rtx (x, op0_mode, last,
- || (STORE_FLAG_VALUE == 1 && XEXP (x, 1) == constm1_rtx)))
- return
- gen_unary (NEG, mode, mode,
-- gen_binary (reverse_condition (GET_CODE (XEXP (x, 0))),
-- mode, XEXP (XEXP (x, 0), 0),
-- XEXP (XEXP (x, 0), 1)));
-+ gen_relational (reverse_condition (GET_CODE (XEXP (x, 0))),
-+ mode, VOIDmode, XEXP (XEXP (x, 0), 0),
-+ XEXP (XEXP (x, 0), 1)));
-
- /* If only the low-order bit of X is possibly nonzero, (plus x -1)
- can become (ashiftrt (ashift (xor x 1) C) C) where C is
-@@ -4297,9 +4322,9 @@ combine_simplify_rtx (x, op0_mode, last,
- && XEXP (x, 0) == const1_rtx
- && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) == '<'
- && reversible_comparison_p (XEXP (x, 1)))
-- return gen_binary (reverse_condition (GET_CODE (XEXP (x, 1))),
-- mode, XEXP (XEXP (x, 1), 0),
-- XEXP (XEXP (x, 1), 1));
-+ return gen_relational (reverse_condition (GET_CODE (XEXP (x, 1))),
-+ mode, VOIDmode, XEXP (XEXP (x, 1), 0),
-+ XEXP (XEXP (x, 1), 1));
-
- /* (minus <foo> (and <foo> (const_int -pow2))) becomes
- (and <foo> (const_int pow2-1)) */
-@@ -4370,9 +4395,10 @@ combine_simplify_rtx (x, op0_mode, last,
-
- if (GET_CODE (op0) == COMPARE)
- op1 = XEXP (op0, 1), op0 = XEXP (op0, 0);
-+ op0_mode = GET_MODE (GET_MODE (op0) != VOIDmode ? op0 : op1);
-
- /* Simplify our comparison, if possible. */
-- new_code = simplify_comparison (code, &op0, &op1);
-+ new_code = simplify_comparison (code, &op0_mode, &op0, &op1);
-
- /* If STORE_FLAG_VALUE is 1, we can convert (ne x 0) to simply X
- if only the low-order bit is possibly nonzero in X (such as when
-@@ -4489,7 +4515,13 @@ combine_simplify_rtx (x, op0_mode, last,
-
- /* If the code changed, return a whole new comparison. */
- if (new_code != code)
-- return gen_rtx_combine (new_code, mode, op0, op1);
-+ return gen_relational (new_code, mode, op0_mode, op0, op1);
-+
-+ /* Make sure that we won't create comparison of two
-+ VOIDmodes. */
-+ temp = simplify_relational_operation (code, op0_mode, op0, op1);
-+ if (temp)
-+ return temp;
-
- /* Otherwise, keep this operation, but maybe change its operands.
- This also converts (ne (compare FOO BAR) 0) to (ne FOO BAR). */
-@@ -4605,13 +4637,14 @@ simplify_if_then_else (x)
-
- /* Simplify storing of the truth value. */
- if (comparison_p && true == const_true_rtx && false == const0_rtx)
-- return gen_binary (true_code, mode, XEXP (cond, 0), XEXP (cond, 1));
-+ return gen_relational (true_code, mode, VOIDmode,
-+ XEXP (cond, 0), XEXP (cond, 1));
-
- /* Also when the truth value has to be reversed. */
- if (comparison_p && reversible_comparison_p (cond)
- && true == const0_rtx && false == const_true_rtx)
-- return gen_binary (reverse_condition (true_code),
-- mode, XEXP (cond, 0), XEXP (cond, 1));
-+ return gen_relational (reverse_condition (true_code), mode,
-+ VOIDmode, XEXP (cond, 0), XEXP (cond, 1));
-
- /* Sometimes we can simplify the arm of an IF_THEN_ELSE if a register used
- in it is being compared against certain values. Get the true and false
-@@ -4686,8 +4719,8 @@ simplify_if_then_else (x)
- {
- true_code = reverse_condition (true_code);
- SUBST (XEXP (x, 0),
-- gen_binary (true_code, GET_MODE (cond), XEXP (cond, 0),
-- XEXP (cond, 1)));
-+ gen_relational (true_code, GET_MODE (cond), VOIDmode,
-+ XEXP (cond, 0), XEXP (cond, 1)));
-
- SUBST (XEXP (x, 1), false);
- SUBST (XEXP (x, 2), true);
-@@ -4863,7 +4896,7 @@ simplify_if_then_else (x)
-
- if (z)
- {
-- temp = subst (gen_binary (true_code, m, cond_op0, cond_op1),
-+ temp = subst (gen_relational (true_code, m, VOIDmode, cond_op0, cond_op1),
- pc_rtx, pc_rtx, 0, 0);
- temp = gen_binary (MULT, m, temp,
- gen_binary (MULT, m, c1, const_true_rtx));
-@@ -4938,17 +4971,27 @@ simplify_set (x)
- {
- enum rtx_code old_code = GET_CODE (*cc_use);
- enum rtx_code new_code;
-+ enum machine_mode mode;
- rtx op0, op1;
- int other_changed = 0;
- enum machine_mode compare_mode = GET_MODE (dest);
-
- if (GET_CODE (src) == COMPARE)
-- op0 = XEXP (src, 0), op1 = XEXP (src, 1);
-+ {
-+ op0 = XEXP (src, 0), op1 = XEXP (src, 1);
-+ mode = GET_MODE (op0);
-+ if (mode == VOIDmode)
-+ mode = GET_MODE (op1);
-+ }
- else
-- op0 = src, op1 = const0_rtx;
-+ {
-+ op0 = src, op1 = const0_rtx;
-+ mode = GET_MODE (dest);
-+ }
-+ if (mode == VOIDmode)
-+ abort();
-
-- /* Simplify our comparison, if possible. */
-- new_code = simplify_comparison (old_code, &op0, &op1);
-+ new_code = simplify_comparison (old_code, &mode, &op0, &op1);
-
- #ifdef EXTRA_CC_MODES
- /* If this machine has CC modes other than CCmode, check to see if we
-@@ -5032,19 +5075,27 @@ simplify_set (x)
- else
- #endif
-
-- /* Otherwise, if we didn't previously have a COMPARE in the
-- correct mode, we need one. */
-- if (GET_CODE (src) != COMPARE || GET_MODE (src) != compare_mode)
-- {
-- SUBST (SET_SRC (x),
-- gen_rtx_combine (COMPARE, compare_mode, op0, op1));
-- src = SET_SRC (x);
-- }
-- else
-- {
-- /* Otherwise, update the COMPARE if needed. */
-- SUBST (XEXP (src, 0), op0);
-- SUBST (XEXP (src, 1), op1);
-+ /* Otherwise, update the COMPARE if needed
-+ unless both operands are VOIDmode constants. IN case
-+ they are, resulting RTL is incorect and the insn won't match
-+ anyway. In the next iteration combine will probably remove
-+ the test entirely. */
-+ if (GET_MODE (op0) != VOIDmode
-+ || GET_MODE (op1) != VOIDmode)
-+ {
-+ /* If we didn't previously have a COMPARE in the correct mode,
-+ we need one. */
-+ if (GET_CODE (src) != COMPARE || GET_MODE (src) != compare_mode)
-+ {
-+ SUBST (SET_SRC (x),
-+ gen_rtx_combine (COMPARE, compare_mode, op0, op1));
-+ src = SET_SRC (x);
-+ }
-+ else
-+ {
-+ SUBST (XEXP (src, 0), op0);
-+ SUBST (XEXP (src, 1), op1);
-+ }
- }
- }
- else
-@@ -7295,6 +7346,9 @@ if_then_else_cond (x, ptrue, pfalse)
- if ((cond0 != 0 || cond1 != 0)
- && ! (cond0 != 0 && cond1 != 0 && ! rtx_equal_p (cond0, cond1)))
- {
-+ enum machine_mode cmp_mode
-+ = GET_MODE (GET_MODE (XEXP (x, 0)) != VOIDmode
-+ ? XEXP (x, 0) : XEXP (x, 1));
- /* If if_then_else_cond returned zero, then true/false are the
- same rtl. We must copy one of them to prevent invalid rtl
- sharing. */
-@@ -7303,8 +7357,16 @@ if_then_else_cond (x, ptrue, pfalse)
- else if (cond1 == 0)
- true1 = copy_rtx (true1);
-
-- *ptrue = gen_binary (code, mode, true0, true1);
-- *pfalse = gen_binary (code, mode, false0, false1);
-+ if (GET_RTX_CLASS (code) == '<')
-+ {
-+ *ptrue = gen_relational (code, mode, cmp_mode, true0, true1);
-+ *pfalse = gen_relational (code, mode, cmp_mode, false0, false1);
-+ }
-+ else
-+ {
-+ *ptrue = gen_binary (code, mode, true0, true1);
-+ *pfalse = gen_binary (code, mode, false0, false1);
-+ }
- return cond0 ? cond0 : cond1;
- }
-
-@@ -9897,53 +9959,69 @@ gen_binary (code, mode, op0, op1)
- rtx tem;
-
- if (GET_RTX_CLASS (code) == 'c'
-- && (GET_CODE (op0) == CONST_INT
-- || (CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT)))
-+ && swap_commutative_operands_p (op0, op1))
- tem = op0, op0 = op1, op1 = tem;
-
-- if (GET_RTX_CLASS (code) == '<')
-- {
-- enum machine_mode op_mode = GET_MODE (op0);
--
-- /* Strip the COMPARE from (REL_OP (compare X Y) 0) to get
-- just (REL_OP X Y). */
-- if (GET_CODE (op0) == COMPARE && op1 == const0_rtx)
-- {
-- op1 = XEXP (op0, 1);
-- op0 = XEXP (op0, 0);
-- op_mode = GET_MODE (op0);
-- }
-+ if (GET_RTX_CLASS (code) == '<')
-+ abort ();
-
-- if (op_mode == VOIDmode)
-- op_mode = GET_MODE (op1);
-- result = simplify_relational_operation (code, op_mode, op0, op1);
-- }
-- else
-- result = simplify_binary_operation (code, mode, op0, op1);
-+ result = simplify_binary_operation (code, mode, op0, op1);
-
- if (result)
- return result;
-
-- /* Put complex operands first and constants second. */
-- if (GET_RTX_CLASS (code) == 'c'
-- && ((CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT)
-- || (GET_RTX_CLASS (GET_CODE (op0)) == 'o'
-- && GET_RTX_CLASS (GET_CODE (op1)) != 'o')
-- || (GET_CODE (op0) == SUBREG
-- && GET_RTX_CLASS (GET_CODE (SUBREG_REG (op0))) == 'o'
-- && GET_RTX_CLASS (GET_CODE (op1)) != 'o')))
-- return gen_rtx_combine (code, mode, op1, op0);
--
- /* If we are turning off bits already known off in OP0, we need not do
- an AND. */
-- else if (code == AND && GET_CODE (op1) == CONST_INT
-- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
-- && (nonzero_bits (op0, mode) & ~ INTVAL (op1)) == 0)
-+ if (code == AND && GET_CODE (op1) == CONST_INT
-+ && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
-+ && (nonzero_bits (op0, mode) & ~ INTVAL (op1)) == 0)
- return op0;
-
- return gen_rtx_combine (code, mode, op0, op1);
- }
-
-+/* Like gen_binary, but for relational operations. The op_mode is mode
-+ of the operands. It may be VOIDmode in case we are certain, that one
-+ of operands is non-VOIDmode. This holds for existing patterns since
-+ relationals with two VOIDmode operands are improper. */
-+static rtx
-+gen_relational (code, mode, op_mode, op0, op1)
-+ enum rtx_code code;
-+ enum machine_mode mode, op_mode;
-+ rtx op0, op1;
-+{
-+ rtx result;
-+
-+ if (GET_RTX_CLASS (code) != '<')
-+ abort();
-+
-+ /* Strip the COMPARE from (REL_OP (compare X Y) 0) to get
-+ just (REL_OP X Y). */
-+ if (GET_CODE (op0) == COMPARE && op1 == const0_rtx)
-+ {
-+ op1 = XEXP (op0, 1);
-+ op0 = XEXP (op0, 0);
-+ /* Previous pass of combine_simplify_rtx may have but
-+ extra CONST to the first operator in order to avoid
-+ losing of mode information - strip it. */
-+ if (GET_CODE (op0) == CONST
-+ && GET_CODE (XEXP (op0, 0)) == VOIDmode)
-+ op0 = XEXP (op0, 0);
-+ op_mode = GET_MODE (op0);
-+ }
-+ if (op_mode == VOIDmode)
-+ op_mode = GET_MODE (GET_MODE (op0) != VOIDmode ? op0 : op1);
-+ if (op_mode == VOIDmode)
-+ abort();
-+
-+ result = simplify_relational_operation (code, op_mode, op0, op1);
-+
-+ if (result)
-+ return result;
-+
-+ return gen_rtx_combine (code, mode, op0, op1);
-+}
-+
- static rtx
- gen_unary (code, mode, op0_mode, op0)
- enum rtx_code code;
-@@ -9970,8 +10048,9 @@ gen_unary (code, mode, op0_mode, op0)
- should have been detected earlier. Hence we ignore all such cases. */
-
- static enum rtx_code
--simplify_comparison (code, pop0, pop1)
-+simplify_comparison (code, pmode, pop0, pop1)
- enum rtx_code code;
-+ enum machine_mode *pmode;
- rtx *pop0;
- rtx *pop1;
- {
-@@ -10009,6 +10088,9 @@ simplify_comparison (code, pop0, pop1)
- {
- op0 = SUBREG_REG (XEXP (XEXP (op0, 0), 0));
- op1 = SUBREG_REG (XEXP (XEXP (op1, 0), 0));
-+ *pmode = GET_MODE (op0);
-+ if (*pmode == VOIDmode)
-+ abort();
- }
- #endif
-
-@@ -10029,7 +10111,7 @@ simplify_comparison (code, pop0, pop1)
- && INTVAL (XEXP (op0, 1)) < HOST_BITS_PER_WIDE_INT
- && XEXP (op0, 1) == XEXP (op1, 1))
- {
-- enum machine_mode mode = GET_MODE (op0);
-+ enum machine_mode mode = *pmode;
- unsigned HOST_WIDE_INT mask = GET_MODE_MASK (mode);
- int shift_count = INTVAL (XEXP (op0, 1));
-
-@@ -10082,6 +10164,9 @@ simplify_comparison (code, pop0, pop1)
- {
- op0 = SUBREG_REG (inner_op0);
- op1 = SUBREG_REG (inner_op1);
-+ *pmode = GET_MODE (op0);
-+ if (*pmode == VOIDmode)
-+ abort();
-
- /* The resulting comparison is always unsigned since we masked
- off the original sign bit. */
-@@ -10099,6 +10184,7 @@ simplify_comparison (code, pop0, pop1)
- op0 = gen_lowpart_for_combine (tmode, inner_op0);
- op1 = gen_lowpart_for_combine (tmode, inner_op1);
- code = unsigned_condition (code);
-+ *pmode = tmode;
- changed = 1;
- break;
- }
-@@ -10135,7 +10221,7 @@ simplify_comparison (code, pop0, pop1)
-
- while (GET_CODE (op1) == CONST_INT)
- {
-- enum machine_mode mode = GET_MODE (op0);
-+ enum machine_mode mode = *pmode;
- unsigned int mode_width = GET_MODE_BITSIZE (mode);
- unsigned HOST_WIDE_INT mask = GET_MODE_MASK (mode);
- int equality_comparison_p;
-@@ -10373,6 +10459,7 @@ simplify_comparison (code, pop0, pop1)
- op0 = XEXP (op0, 2);
- op1 = GEN_INT (i);
- const_op = i;
-+ *pmode = GET_MODE (op0);
-
- /* Result is nonzero iff shift count is equal to I. */
- code = reverse_condition (code);
-@@ -10386,6 +10473,7 @@ simplify_comparison (code, pop0, pop1)
- if (tem != op0)
- {
- op0 = tem;
-+ *pmode = GET_MODE (op0);
- continue;
- }
- break;
-@@ -10500,6 +10588,7 @@ simplify_comparison (code, pop0, pop1)
- << (GET_MODE_BITSIZE (GET_MODE (XEXP (op0, 0))) - 1)))))
- {
- op0 = XEXP (op0, 0);
-+ *pmode = GET_MODE (op0);
- continue;
- }
- break;
-@@ -10531,6 +10620,7 @@ simplify_comparison (code, pop0, pop1)
- - GET_MODE_BITSIZE (mode)))))
- {
- op0 = SUBREG_REG (op0);
-+ *pmode = GET_MODE (op0);
- continue;
- }
-
-@@ -10552,6 +10642,7 @@ simplify_comparison (code, pop0, pop1)
- < GET_MODE_MASK (GET_MODE (XEXP (op0, 0)))))
- {
- op0 = XEXP (op0, 0);
-+ *pmode = GET_MODE (op0);
- continue;
- }
- break;
-@@ -10647,7 +10738,15 @@ simplify_comparison (code, pop0, pop1)
-
- /* Get the two operands being compared. */
- if (GET_CODE (XEXP (op0, 0)) == COMPARE)
-- tem = XEXP (XEXP (op0, 0), 0), tem1 = XEXP (XEXP (op0, 0), 1);
-+ {
-+ tem = XEXP (XEXP (op0, 0), 0), tem1 = XEXP (XEXP (op0, 0), 1);
-+ /* Previous pass of combine_simplify_rtx may have but
-+ extra CONST to the first operator in order to avoid
-+ losing of mode information - strip it. */
-+ if (GET_CODE (tem) == CONST
-+ && GET_CODE (XEXP (tem, 0)) == VOIDmode)
-+ tem = XEXP (tem, 0);
-+ }
- else
- tem = XEXP (op0, 0), tem1 = XEXP (op0, 1);
-
-@@ -10666,6 +10765,7 @@ simplify_comparison (code, pop0, pop1)
- code = (code == LT || code == NE
- ? GET_CODE (op0) : reverse_condition (GET_CODE (op0)));
- op0 = tem, op1 = tem1;
-+ *pmode = GET_MODE (GET_MODE (op0) != VOIDmode ? op0 : op1);
- continue;
- }
- break;
-@@ -10749,6 +10849,7 @@ simplify_comparison (code, pop0, pop1)
- && (tmode = mode_for_size (i, MODE_INT, 1)) != BLKmode)
- {
- op0 = gen_lowpart_for_combine (tmode, XEXP (op0, 0));
-+ *pmode = tmode;
- continue;
- }
-
-@@ -10878,6 +10979,7 @@ simplify_comparison (code, pop0, pop1)
- <= GET_MODE_MASK (tmode))))
- {
- op0 = gen_lowpart_for_combine (tmode, XEXP (XEXP (op0, 0), 0));
-+ *pmode = tmode;
- continue;
- }
-
-@@ -10904,6 +11006,7 @@ simplify_comparison (code, pop0, pop1)
- op0 = gen_binary (PLUS, tmode,
- gen_lowpart_for_combine (tmode, inner),
- new_const);
-+ *pmode = tmode;
- continue;
- }
-
-@@ -10967,6 +11070,7 @@ simplify_comparison (code, pop0, pop1)
- {
- op0 = SUBREG_REG (op0);
- op1 = gen_lowpart_for_combine (GET_MODE (op0), op1);
-+ *pmode = GET_MODE (op0);
- }
-
- else if (GET_CODE (op0) == SUBREG && subreg_lowpart_p (op0)
-@@ -10980,7 +11084,10 @@ simplify_comparison (code, pop0, pop1)
- op1),
- (nonzero_bits (tem, GET_MODE (SUBREG_REG (op0)))
- & ~ GET_MODE_MASK (GET_MODE (op0))) == 0))
-- op0 = SUBREG_REG (op0), op1 = tem;
-+ {
-+ op0 = SUBREG_REG (op0), op1 = tem;
-+ *pmode = GET_MODE (op0);
-+ }
-
- /* We now do the opposite procedure: Some machines don't have compare
- insns in all modes. If OP0's mode is an integer mode smaller than a
-@@ -10988,7 +11095,7 @@ simplify_comparison (code, pop0, pop1)
- mode for which we can do the compare. There are a number of cases in
- which we can use the wider mode. */
-
-- mode = GET_MODE (op0);
-+ mode = *pmode;
- if (mode != VOIDmode && GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_SIZE (mode) < UNITS_PER_WORD
- && cmp_optab->handlers[(int) mode].insn_code == CODE_FOR_nothing)
-@@ -11024,6 +11131,7 @@ simplify_comparison (code, pop0, pop1)
-
- op0 = gen_lowpart_for_combine (tmode, op0);
- op1 = gen_lowpart_for_combine (tmode, op1);
-+ *pmode = tmode;
- break;
- }
-
-@@ -11037,6 +11145,7 @@ simplify_comparison (code, pop0, pop1)
- gen_lowpart_for_combine (tmode, op0),
- GEN_INT ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (mode) - 1)));
-+ *pmode = tmode;
- code = (code == LT) ? NE : EQ;
- break;
- }
---- gcc/simplify-rtx.c.jj Mon Jul 31 20:02:12 2000
-+++ gcc/simplify-rtx.c Fri Aug 18 15:26:59 2000
-@@ -1691,14 +1691,39 @@ simplify_relational_operation (code, mod
- int equal, op0lt, op0ltu, op1lt, op1ltu;
- rtx tem;
-
-- if (mode == VOIDmode
-- && (GET_MODE (op0) != VOIDmode
-- || GET_MODE (op1) != VOIDmode))
-+ /* Do simple checking of mode. The mode should be never VOIDmode, since we
-+ don't know the mode of operands in case they are both VOIDmode and mode
-+ of the operands must match. */
-+ if (mode == VOIDmode)
-+ abort();
-+ if (GET_MODE (op0) != VOIDmode && GET_MODE (op0) != mode)
-+ abort();
-+ if (GET_MODE (op1) != VOIDmode && GET_MODE (op1) != mode)
- abort();
-
- /* If op0 is a compare, extract the comparison arguments from it. */
- if (GET_CODE (op0) == COMPARE && op1 == const0_rtx)
-- op1 = XEXP (op0, 1), op0 = XEXP (op0, 0);
-+ {
-+ op1 = XEXP (op0, 1), op0 = XEXP (op0, 0);
-+ if (GET_MODE (op0) != VOIDmode)
-+ mode = GET_MODE (op0);
-+ else
-+ mode = GET_MODE (op1);
-+ /* We can't have both operands of COMPARE VOIDmode, since we would
-+ not be able to determine the mode of comparison them, we create
-+ fake CONST with proper mode when such expression needs to be
-+ created temporarily - this happends in the combine and in gcse
-+ when we happen to propagate constant into comparison. */
-+ if (GET_CODE (op0) == CONST
-+ && GET_MODE (XEXP (op0, 0)) == VOIDmode)
-+ op0 = XEXP (op0, 0);
-+ }
-+ /* We can handle comparison only in the integral or floating point modes.
-+ When CCmode or VOIDmode appears here, it means mistake elsewhere
-+ most probably because the real mode of comparison got lost by replacing
-+ by VOIDmode constants. */
-+ if (!INTEGRAL_MODE_P (mode)
-+ && !FLOAT_MODE_P (mode))
-
- /* We can't simplify MODE_CC values since we don't know what the
- actual comparison is. */