[wide-int] Reduce the size of the scratch arrays

Submitted by Richard Sandiford on Oct. 20, 2013, 10:30 a.m.

Details

Message ID 87wql844kz.fsf@talisman.default
State New
Headers show

Commit Message

Richard Sandiford Oct. 20, 2013, 10:30 a.m.
If yesterday's patch goes in, we'll only need the scratch array for
HWI inputs.  We can therefore shrink it to 2 HWIs.

Tested on x86_64-linux-gnu.  OK for wide-int?

Thanks,
Richard

Comments

Richard Guenther Oct. 20, 2013, 12:48 p.m.
Richard Sandiford <rdsandiford@googlemail.com> wrote:
>If yesterday's patch goes in, we'll only need the scratch array for
>HWI inputs.  We can therefore shrink it to 2 HWIs.

>Tested on x86_64-linux-gnu.  OK for wide-int?
>

Ok

Thanks,
Richard.

>Thanks,
>Richard
>
>
>Index: gcc/wide-int.h
>===================================================================
>--- gcc/wide-int.h	2013-10-19 20:08:15.571987579 +0100
>+++ gcc/wide-int.h	2013-10-19 20:09:12.299436972 +0100
>@@ -778,7 +778,7 @@ struct wide_int_ref_storage : public wi:
> private:
>/* Scratch space that can be used when decomposing the original
>integer.
>      It must live as long as this object.  */
>-  HOST_WIDE_INT scratch[WIDE_INT_MAX_ELTS];
>+  HOST_WIDE_INT scratch[2];
> 
> public:
>   template <typename T>
Kenneth Zadeck Oct. 20, 2013, 1:16 p.m.
On 10/20/2013 06:30 AM, Richard Sandiford wrote:
> If yesterday's patch goes in, we'll only need the scratch array for
> HWI inputs.  We can therefore shrink it to 2 HWIs.
>
> Tested on x86_64-linux-gnu.  OK for wide-int?
>
> Thanks,
> Richard
>
>
> Index: gcc/wide-int.h
> ===================================================================
> --- gcc/wide-int.h	2013-10-19 20:08:15.571987579 +0100
> +++ gcc/wide-int.h	2013-10-19 20:09:12.299436972 +0100
> @@ -778,7 +778,7 @@ struct wide_int_ref_storage : public wi:
>   private:
>     /* Scratch space that can be used when decomposing the original integer.
>        It must live as long as this object.  */
> -  HOST_WIDE_INT scratch[WIDE_INT_MAX_ELTS];
> +  HOST_WIDE_INT scratch[2];
>   
>   public:
>     template <typename T>
we now allow partial int precisions that are any size.   this will break 
that.

kenny
Richard Sandiford Oct. 20, 2013, 1:22 p.m.
Kenneth Zadeck <zadeck@naturalbridge.com> writes:
> On 10/20/2013 06:30 AM, Richard Sandiford wrote:
>> If yesterday's patch goes in, we'll only need the scratch array for
>> HWI inputs.  We can therefore shrink it to 2 HWIs.
>>
>> Tested on x86_64-linux-gnu.  OK for wide-int?
>>
>> Thanks,
>> Richard
>>
>>
>> Index: gcc/wide-int.h
>> ===================================================================
>> --- gcc/wide-int.h	2013-10-19 20:08:15.571987579 +0100
>> +++ gcc/wide-int.h	2013-10-19 20:09:12.299436972 +0100
>> @@ -778,7 +778,7 @@ struct wide_int_ref_storage : public wi:
>>   private:
>>     /* Scratch space that can be used when decomposing the original integer.
>>        It must live as long as this object.  */
>> -  HOST_WIDE_INT scratch[WIDE_INT_MAX_ELTS];
>> +  HOST_WIDE_INT scratch[2];
>>   
>>   public:
>>     template <typename T>
> we now allow partial int precisions that are any size.   this will break 
> that.

Note that this was only "if yesterday's patch goes in".  That patch removes
the use of the scratch array from the tree decompose routine.  We already
removed the scratch array from the rtx decompose routine.  So the only
decompose routines left that need scratch space are those for pure HWI inputs.

Thanks,
Richard

Patch hide | download patch | download mbox

Index: gcc/wide-int.h
===================================================================
--- gcc/wide-int.h	2013-10-19 20:08:15.571987579 +0100
+++ gcc/wide-int.h	2013-10-19 20:09:12.299436972 +0100
@@ -778,7 +778,7 @@  struct wide_int_ref_storage : public wi:
 private:
   /* Scratch space that can be used when decomposing the original integer.
      It must live as long as this object.  */
-  HOST_WIDE_INT scratch[WIDE_INT_MAX_ELTS];
+  HOST_WIDE_INT scratch[2];
 
 public:
   template <typename T>