This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: remove wrong code in immed_double_const
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Mike Stump <mikestump at comcast dot net>
- Cc: gcc-patches Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 17 Mar 2012 07:37:22 +0000
- Subject: Re: remove wrong code in immed_double_const
- References: <5FF5A724-3FE1-4E97-8124-542A0B8259FE@comcast.net>
Mike Stump <mikestump@comcast.net> writes:
> This removes some wrong code.
>
> Ok?
>
> Index: gcc/emit-rtl.c
> ===================================================================
> --- gcc/emit-rtl.c (revision 184563)
> +++ gcc/emit-rtl.c (working copy)
> @@ -540,8 +540,6 @@ immed_double_const (HOST_WIDE_INT i0, HO
>
> if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
> return gen_int_mode (i0, mode);
> -
> - gcc_assert (GET_MODE_BITSIZE (mode) == 2 * HOST_BITS_PER_WIDE_INT);
> }
>
> /* If this integer fits in one word, return a CONST_INT. */
Is this because you have an integer mode between HOST_BITS_PER_WIDE_INT and
2 * HOST_BITS_PER_WIDE_INT? (I.e. a partial one?) If so, I can see an
argument for changing the "==" to "<=", although we'd need to think
carefully about what CONST_DOUBLE means in that case. (Endianness, etc.)
Or is this because you have an integer mode wider than
2*OST_BITS_PER_WIDE_INT? We currently only support constant integer
widths <= 2*HOST_BITS_PER_WIDE_INT, and the assert is correctly
triggering if we try to build a wider constant. Obviously it'd be
nice if we supported arbitrary widths, e.g. by replacing CONST_INT and
CONST_DOUBLE with a single n-HOST_WIDE_INT rtx (and immed_double_const
with some kind of nary builder, etc.). It won't be easy though.
Removing the assert seems like papering over the problem.
FWIW, here's another case where this came up:
http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01220.html
Richard