On Fri, Sep 13, 2013 at 10:23 PM, Mike Stump <mikest...@comcast.net> wrote:
> On Sep 13, 2013, at 1:08 AM, Richard Sandiford <rdsandif...@googlemail.com> 
> wrote:
>>>> We don't really model that properly yet.  Partial modes are just defined
>>>> using something like:
>>>>
>>>> PARTIAL_INT_MODE (SI);
>
> True, but, all ports are trivial to fix so that the precision is included and 
> for the interface to change to include the precision.
>
>>> Well I was asking because if you change a GEN_INT (x) to
>>> gen_int_mode (PSImode, x) then you'll end up in trunc_int_for_mode with
>>> PSImode which looks at GET_MODE_PRECISION (PSImode is still
>>> a SCALAR_INT_MODE_P ...).  We set precision of PSImode to -1U
>
> Easy to fix.
>
>> Yeah.  I don't think it makes sense to canonise PSI to 32 bits when we
>> know it has fewer than 32 bits.
>
> Agreed.
>
>
> Here is the patch to add precision to partial int modes.  I included 
> switching over the rs6000 port to the new scheme so one can get a feel for 
> that it would look like.
>
> I could trivially convert the remaining ports:
>
> config/bfin/bfin-modes.def:PARTIAL_INT_MODE (DI);
> config/m32c/m32c-modes.def:PARTIAL_INT_MODE (SI);
> config/msp430/msp430-modes.def:PARTIAL_INT_MODE (SI);
> config/rs6000/rs6000-modes.def:PARTIAL_INT_MODE_N (TI, 128);
> config/sh/sh-modes.def:PARTIAL_INT_MODE (SI);
> config/sh/sh-modes.def:PARTIAL_INT_MODE (DI);
>
> to the new scheme so that _all_ ports would have a precision with all partial 
> int modes.  The newest port that I had not audited for how they use it 
> (msp430):
>
> /* 20-bit address */
> PARTIAL_INT_MODE (SI);
>
> So, this, trivially would be SI, 20…  I would define PARTIAL_INT_MODE with 
> two parameters and not define PARTIAL_INT_MODE_N, if we did it for real.  No 
> need for partial conversions here, too easy to convert things.
>
> Ok for the non-powerpc bits?

Can you instead of adding PARTIAL_INT_MODE_N change all existing
PARTIAL_INT_MODE ()s to PARTIAL_INT_MODE_LEGACY () and change
PARTIAL_INT_MODE behavior?

> Want me to convert all the ports and change the interface instead of merely 
> extending it and submit those?  I'd hate to do the work, if no one wants to 
> review/approve it.

I volunteer to approve it (after giving target maintainers time to do
so on their own).

So, if you send a whole conversion patch then we don't have to play games
with having both variants recognized.  (now it just occurs to me we can use
a variadic macro here ...?)

Richard.

> We've been using this scheme on our port for a while and it seems to work 
> nicely.
>
>

Reply via email to