On Sat, May 11, 2013 at 1:41 AM, DJ Delorie <d...@redhat.com> wrote:
>
>> > Note that I had to make a few changes (fixes?)  in the MI portions of
>> > gcc to avoid problems I encountered, I don't know if these changes are
>> > "correct" or if there are better ways to avoid those cases.  Those
>>
>> In any case, they should best be posted in separate messages, each one
>> with its own rationale.
>
> Here's the first of those...  The patch assumes that, "by definition",
> a partial int mode has fewer bits than an int mode of the same size,
> and thus truncation should be used to go from the int mode to the
> partial int mode.

Can you add that (partial int modes have fewer bits than int modes) as
verification
to genmodes.c:make_partial_integer_mode?

> Index: gcc/cfgexpand.c
> ===================================================================
> --- gcc/cfgexpand.c     (revision 198591)
> +++ gcc/cfgexpand.c     (working copy)
> @@ -3090,13 +3090,17 @@ expand_debug_expr (tree exp)
>          size_t, we need to check for mis-matched modes and correct
>          the addend.  */
>        if (op0 && op1
>           && GET_MODE (op0) != VOIDmode && GET_MODE (op1) != VOIDmode
>           && GET_MODE (op0) != GET_MODE (op1))
>         {
> -         if (GET_MODE_BITSIZE (GET_MODE (op0)) < GET_MODE_BITSIZE (GET_MODE 
> (op1)))

I wonder if this should not use GET_MODE_PRECISION - after all it is
the precision that determines whether we have to extend / truncate?  Or
is precision a so much unused term on RTL that this would cause problems?
Thus,

> +         if (GET_MODE_BITSIZE (GET_MODE (op0)) < GET_MODE_BITSIZE (GET_MODE 
> (op1))

             if (GET_MODE_PRECISION (GET_MODE (op0)) <
GET_MODE_PRECISION (GET_MODE (op1)))
               op1 = simplify_gen_unary (TRUNCATE, GET_MODE (op0),
op1, GET_MODE (op1));

?

Richard.

> +             /* Don't try to sign-extend SImode to PSImode, for example.  */
> +             || (GET_MODE_BITSIZE (GET_MODE (op0)) == GET_MODE_BITSIZE 
> (GET_MODE (op1))
> +                 && GET_MODE_CLASS (GET_MODE (op0)) == MODE_PARTIAL_INT
> +                 && GET_MODE_CLASS (GET_MODE (op1)) == MODE_INT))
>             op1 = simplify_gen_unary (TRUNCATE, GET_MODE (op0), op1,
>                                       GET_MODE (op1));
>           else
>             /* We always sign-extend, regardless of the signedness of
>                the operand, because the operand is always unsigned
>                here even if the original C expression is signed.  */

Reply via email to