[RFC] Changes to the wide-int classes

Richard Biener rguenther@suse.de
Mon Sep 2 09:35:00 GMT 2013


On Mon, 2 Sep 2013, Richard Sandiford wrote:

> Kenneth Zadeck <zadeck@naturalbridge.com> writes:
> > There is no place for exactly two HWIs in the machine independent parts 
> > of the compiler,
> 
> I totally agree.  In fact I was taking that so much for granted that
> I didn't even think to add a rider about it, sorry.  I didn't mean
> to imply that we should keep double_int around.
> 
> I think the reason for doing this is to prove that it can be done
> (so that the wide_int code isn't too big a change for the tree level)
> and to make it easier to merge the wide-int patches into trunk piecemeal
> if we need to.

Note that changing the tree rep to non-double_int is easy.  Also note
that I only want 'double_int' to stay around to have a fast type
that can work on two HWIs for the code that need more precision
than a HWI.  The only important cases I know of are in
get_inner_reference and get_ref_base_and_extent and friends.  Those
are heavily used (and the only double-int function callers that
even show up in regular cc1 profiles).

So if wide_int_fixed<2> ('2' better be replaced with
'number-that-gets-me-twice-target-sizetype-precision')
works for those cases then fine (and we can drop double-ints).

Richard.

> > ==== small bugs below this line.
> > bottom of frag 3 of gcc/cp/init.c is wrong:   you replaced 
> > rshift...lshift with lshift...lshift.
> 
> Do you mean this bit:
> 
>  	unsigned shift = (max_outer_nelts.get_precision ()) - 7
> -	  - max_outer_nelts.clz ().to_shwi ();
> -	max_outer_nelts = max_outer_nelts.rshiftu (shift).lshift (shift);
> +	  - wi::clz (max_outer_nelts);
> +	max_outer_nelts = wi::lshift (wi::lrshift (max_outer_nelts, shift),
> +				      shift);
> 
> ?  That's lrshift (logical right shift).  I ended up using the double-int
> names for right shifts.
> 
> That does remind me of another thing though.  I notice some of the wide-int
> code assumes that shifting a signed HWI right gives an arithmetic shift,
> but the language doesn't guarantee that.  We probably need to go through
> and fix those.
> 
> > i will finish reading this tomorrow, but i wanted to get some comments 
> > in for the early shift.    i stopped reading at line 1275.
> 
> Thanks.  TBH I've not really been through the third part myself to
> double-check.  Will try to do that while waiting for comments on the
> first part.
> 
> Richard
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend



More information about the Gcc-patches mailing list