On Wed, Sep 11, 2013 at 8:39 PM, Richard Sandiford
<rdsandif...@googlemail.com> wrote:
> Graham Stott <graham.st...@btinternet.com> writes:
>> Hi Richard,
>>
>> There is some minor testsuite fallout with these patches on MIPS a
>> couple of tests (see below)ICE ingen_int_mode () in both these ICE the
>> mode is CCmode.
>
> Hmm, interesting.  I suppose gen_int_mode should handle CC modes,
> since there's no other constant rtx that can be used instead.  OTOH,
> like you say, it doesn't really make sense to apply try_const_anchor
> to CCmode.

Can we statically identify the places that build CCmode integers?  In that
case a gen_cc_const () function would be more appropriate ...

Do we know that CCmode fits into a HWI btw?

(what about partial integer modes which have weird precision (none)?)

Thanks,
Richard.

> How does the following patch look?
>
> Thanks,
> Richard
>
>
> gcc/
>         * emit-rtl.c (gen_int_mode): Handle CC modes.
>         * cse.c (try_const_anchors): ...but punt on them here.
>
> Index: gcc/emit-rtl.c
> ===================================================================
> --- gcc/emit-rtl.c      2013-09-08 11:52:15.000000000 +0100
> +++ gcc/emit-rtl.c      2013-09-11 19:32:35.702377902 +0100
> @@ -417,6 +417,11 @@ gen_rtx_CONST_INT (enum machine_mode mod
>  rtx
>  gen_int_mode (HOST_WIDE_INT c, enum machine_mode mode)
>  {
> +  /* CONST_INT is used for CC modes too.  We can't make any assumptions
> +     about the precision or bitsize in that case, so just pass the value
> +     through unchanged.  */
> +  if (GET_MODE_CLASS (mode) == MODE_CC)
> +    return GEN_INT (c);
>    return GEN_INT (trunc_int_for_mode (c, mode));
>  }
>
> Index: gcc/cse.c
> ===================================================================
> --- gcc/cse.c   2013-09-08 11:52:15.000000000 +0100
> +++ gcc/cse.c   2013-09-11 19:38:17.664399826 +0100
> @@ -1354,6 +1354,11 @@ try_const_anchors (rtx src_const, enum m
>    rtx lower_exp = NULL_RTX, upper_exp = NULL_RTX;
>    unsigned lower_old, upper_old;
>
> +  /* CONST_INT is used for CC modes, but we should leave those alone.  */
> +  if (GET_MODE_CLASS (mode) == MODE_CC)
> +    return NULL_RTX;
> +
> +  gcc_assert (SCALAR_INT_MODE_P (mode));
>    if (!compute_const_anchors (src_const, &lower_base, &lower_offs,
>                               &upper_base, &upper_offs))
>      return NULL_RTX;

Reply via email to