This is the mail archive of the
mailing list for the GCC project.
Re: [wide-int] int_traits <tree>
- From: Richard Sandiford <rsandifo at linux dot vnet dot ibm dot com>
- To: Kenneth Zadeck <zadeck at naturalbridge dot com>
- Cc: Richard Biener <rguenther at suse dot de>, gcc-patches at gcc dot gnu dot org, Mike Stump <mikestump at comcast dot net>
- Date: Thu, 17 Oct 2013 14:44:19 +0100
- Subject: Re: [wide-int] int_traits <tree>
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LNX dot 2 dot 00 dot 1310161537220 dot 11149 at zhemvz dot fhfr dot qr> <525EB50F dot 2090003 at naturalbridge dot com> <87ppr56on1 dot fsf at talisman dot default> <525EFC33 dot 4010304 at naturalbridge dot com> <87hacg720z dot fsf at talisman dot default> <alpine dot LNX dot 2 dot 00 dot 1310171015000 dot 11149 at zhemvz dot fhfr dot qr> <87k3hc9n9w dot fsf at sandifor-thinkpad dot stglab dot manchester dot uk dot ibm dot com> <alpine dot LNX dot 2 dot 00 dot 1310171309390 dot 11149 at zhemvz dot fhfr dot qr> <87bo2o9kow dot fsf at sandifor-thinkpad dot stglab dot manchester dot uk dot ibm dot com> <alpine dot LNX dot 2 dot 00 dot 1310171406490 dot 11149 at zhemvz dot fhfr dot qr> <525FDAFC dot 2020805 at naturalbridge dot com>
Kenneth Zadeck <firstname.lastname@example.org> writes:
>> it avoids a 2nd copy though, which shows nicely what was rummaging in
>> my head for the last two days - that the int_trais <> abstraction
>> was somehow at the wrong level - it should have been traits that
>> are specific to the storage model? or the above should use
>> int_traits<>::decompose manually with it always doing the
>> copy (that would also optimize away one copy and eventually
>> would make the extra zeros not necessary).
> this came in with richard's storage manager patch. In my older code,
> we tried and succeeded many times to just borrow the underlying rep.
> I think that richard needs to work this out.
Hmm, you mean the patch to introduce all the wi:: stuff? Which cases
do you mean?
That patch didn't change the HWI representation (and therefore when a
copy was needed by the to_shwi*/decompose routines). And it got rid of
quite a few *_wide_int constructions, things like:
- wide_int wi = (max_wide_int (prev_value)
- .add (1, sgn, &overflowed));
+ wide_int wi = wi::add (prev_value, 1, sgn, &overflowed);