On 30/04/13 16:56, Richard Sandiford wrote:
> This patch fixes out the GEN_INT/gen_int_mode that Richard pointed out
> in the wide-int review. It also passes "mode" rather than "VOIDmode"
> to immed_double_int_const. (As discussed in that thread, the latter
> change shouldn't make any difference in practice, but is still more
> correct in principle.)
>
> Bootstrapped & regression-tested on x86_64-linux-gnu. OK to install?
>
> Richard
>
> gcc/
> * explow.c (plus_constant): Pass "mode" to immed_double_int_const.
> Use gen_int_mode rather than GEN_INT.
>
> Index: gcc/explow.c
> ===================================================================
> --- gcc/explow.c 2013-02-25 09:41:58.000000000 +0000
> +++ gcc/explow.c 2013-04-30 15:52:57.270362112 +0100
> @@ -106,10 +106,10 @@ plus_constant (enum machine_mode mode, r
> if (overflow)
> gcc_unreachable ();
>
> - return immed_double_int_const (v, VOIDmode);
> + return immed_double_int_const (v, mode);
> }
>
> - return GEN_INT (INTVAL (x) + c);
> + return gen_int_mode (INTVAL (x) + c, mode);
This calls trunc_int_for_mode which fails for mode == VOIDmode.
On s390x gcc.c-torture/compile/20021008-1.c fails due to this.
-Andreas-
>
> case CONST_DOUBLE:
> {
> @@ -124,7 +124,7 @@ plus_constant (enum machine_mode mode, r
> To fix, add constant support wider than CONST_DOUBLE. */
> gcc_assert (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_DOUBLE_INT);
>
> - return immed_double_int_const (v, VOIDmode);
> + return immed_double_int_const (v, mode);
> }
>
> case MEM:
>