diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4cfcc0cd7fc..ba9356f6e6c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-07-16 Roger Sayle + + * simplify-rtx.c (simplify_replace_rtx): Convert constant comparisons + to MODE_FLOAT constants if FLOAT_STORE_FLAG_VALUE is defined. + (simplify_rtx): Likewise. Simplify (lo_sum (high X) X) as X. + 2003-07-16 Andrew Pinski * doc/install.texi (--without-headers): New. diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 27fe4f377b6..3b857673c72 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -269,15 +269,24 @@ simplify_replace_rtx (rtx x, rtx old, rtx new) : GET_MODE (XEXP (x, 1))); rtx op0 = simplify_replace_rtx (XEXP (x, 0), old, new); rtx op1 = simplify_replace_rtx (XEXP (x, 1), old, new); - - return - simplify_gen_relational (code, mode, - (op_mode != VOIDmode - ? op_mode - : GET_MODE (op0) != VOIDmode - ? GET_MODE (op0) - : GET_MODE (op1)), - op0, op1); + rtx temp = simplify_gen_relational (code, mode, + (op_mode != VOIDmode + ? op_mode + : GET_MODE (op0) != VOIDmode + ? GET_MODE (op0) + : GET_MODE (op1)), + op0, op1); +#ifdef FLOAT_STORE_FLAG_VALUE + if (GET_MODE_CLASS (mode) == MODE_FLOAT) + { + if (temp == const0_rtx) + temp = CONST0_RTX (mode); + else if (temp == const_true_rtx) + temp = CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE (mode), + mode); + } +#endif + return temp; } case '3': @@ -3030,6 +3039,7 @@ simplify_rtx (rtx x) { enum rtx_code code = GET_CODE (x); enum machine_mode mode = GET_MODE (x); + rtx temp; switch (GET_RTX_CLASS (code)) { @@ -3058,12 +3068,24 @@ simplify_rtx (rtx x) XEXP (x, 2)); case '<': - return simplify_relational_operation (code, + temp = simplify_relational_operation (code, ((GET_MODE (XEXP (x, 0)) != VOIDmode) ? GET_MODE (XEXP (x, 0)) : GET_MODE (XEXP (x, 1))), XEXP (x, 0), XEXP (x, 1)); +#ifdef FLOAT_STORE_FLAG_VALUE + if (temp != 0 && GET_MODE_CLASS (mode) == MODE_FLOAT) + { + if (temp == const0_rtx) + temp = CONST0_RTX (mode); + else + temp = CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE (mode), + mode); + } +#endif + return temp; + case 'x': if (code == SUBREG) return simplify_gen_subreg (mode, SUBREG_REG (x), @@ -3074,8 +3096,20 @@ simplify_rtx (rtx x) if (CONSTANT_P (XEXP (x, 0))) return const1_rtx; } - return NULL; + break; + + case 'o': + if (code == LO_SUM) + { + /* Convert (lo_sum (high FOO) FOO) to FOO. */ + if (GET_CODE (XEXP (x, 0)) == HIGH + && rtx_equal_p (XEXP (XEXP (x, 0), 0), XEXP (x, 1))) + return XEXP (x, 1); + } + break; + default: - return NULL; + break; } + return NULL; }