This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Setting precision for a PSImode type


On Wed, Apr 11, 2012 at 11:55 AM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> On 04/11/2012 06:53 PM, Peter Bigot wrote:
>> On Mon, Mar 5, 2012 at 10:38 AM, Bernd Schmidt <bernds@codesourcery.com> wrote:
>>> On 03/05/2012 05:24 PM, Peter Bigot wrote:
>>>> And is there any reason (other than it doesn't seem to have been done
>>>> before) to believe PSImode is the wrong way to support a
>>>> general-purpose 20-bit integral type in gcc?
>>>
>>> If you're using 4.7.0, it should be possible to use FRACTIONAL_INT_MODE
>>> and get reasonable results. However, it hasn't been tested much, since
>>> the final bits of the patch series which would have added 40 bit int
>>> support to the C frontend didn't make it in. See the discussion following
>>> ?http://gcc.gnu.org/ml/gcc-patches/2011-07/msg00079.html
>>
>> I stuck with PARTIAL_INT_MODE instead of FRACTIONAL_INT_MODE because
>> in my case the new type should not appear in the widen/narrow
>> hierarchy of MODE_INT,
>
> May I ask why not? Which problems do you run into?

The biggest one is that widening from 20-bit to 32-bit is an extremely
expensive operation: it was a 16-bit ISA, but some newer MCUs support
an extension with 20 bits in each register and a set of new
instructions that must be used to preserve the upper 4 bits.  Getting
bits 19..16 of a 20-bit register down into the low bits of a 16 bit
register requires a five-position rotate-through-carry.  The 20-bit
enhancement to the ISA was really intended only to support a larger
address space; to simplify validation of the machine description I've
chosen to allow it to be used for any integer operation, but I have no
reason to think that'll be common.

Narrowing from 32 to 20 is similarly expensive.

(It may be that the problems were simply that, because those
operations are so complex, my initial implementation doesn't support
them, and MODE_INT caused them to be generated too many times to make
progress.)

>> I've filed two bug reports for cases where BITSIZE needs to be updated
>> to PRECISION.
>
> Patches are best submitted to gcc-patches directly. Do you have a
> copyright assignment?

Not yet, though these are trivial.  I just started that process in a
separate email.

Peter

>
> Bernd


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]