Re: Speedup int_bit_from_pos

2014-09-23 Thread Jan Hubicka
> Jan Hubicka writes: > > +/* Like bit_position, but return as an integer. It must be representable > > in > > + that way (since it could be a signed value, we don't have the > > + option of returning -1 like int_size_in_byte can. */ > > + > > +static inline HOST_WIDE_INT > > +int_bit_posit

Re: Speedup int_bit_from_pos

2014-09-23 Thread Richard Sandiford
Jan Hubicka writes: > +/* Like bit_position, but return as an integer. It must be representable in > + that way (since it could be a signed value, we don't have the > + option of returning -1 like int_size_in_byte can. */ > + > +static inline HOST_WIDE_INT > +int_bit_position (const_tree fie

Re: Speedup int_bit_from_pos

2014-09-23 Thread Richard Biener
On Mon, 22 Sep 2014, Jan Hubicka wrote: > Hi, > it now seems to work, finaly :) > Bootstrapped/regtested x86_64-linux, OK? > > * tree.c (int_bit_position): Move to... > * tree.h (int_bit_position): ... here; implement using > direct wide_int calculation instead of folding. > Ind

Re: Speedup int_bit_from_pos

2014-09-22 Thread Jan Hubicka
Hi, it now seems to work, finaly :) Bootstrapped/regtested x86_64-linux, OK? * tree.c (int_bit_position): Move to... * tree.h (int_bit_position): ... here; implement using direct wide_int calculation instead of folding. Index: tree.c

Re: Speedup int_bit_from_pos

2014-09-22 Thread Jan Hubicka
> On Sep 22, 2014, at 11:22 AM, Jan Hubicka wrote: > >> Not quite: > >> > >> offset_int woffset > >>= (wi::to_offset (xoffset) > >> + wi::lrshift (wi::to_offset (DECL_FIELD_BIT_OFFSET (field)), > >> LOG2_BITS_PER_UNIT)); > >> > >> offset_int is the

Re: Speedup int_bit_from_pos

2014-09-22 Thread Mike Stump
On Sep 22, 2014, at 11:22 AM, Jan Hubicka wrote: >> Not quite: >> >> offset_int woffset >>= (wi::to_offset (xoffset) >> + wi::lrshift (wi::to_offset (DECL_FIELD_BIT_OFFSET (field)), >> LOG2_BITS_PER_UNIT)); >> >> offset_int is the type that can hol

Re: Speedup int_bit_from_pos

2014-09-22 Thread Jan Hubicka
> Not quite: > > offset_int woffset > = (wi::to_offset (xoffset) >+ wi::lrshift (wi::to_offset (DECL_FIELD_BIT_OFFSET (field)), > LOG2_BITS_PER_UNIT)); > > offset_int is the type that can hold all bit positions, byte positions, byte > sizes and

Re: Speedup int_bit_from_pos

2014-09-22 Thread Mike Stump
On Sep 22, 2014, at 8:51 AM, Jan Hubicka wrote: >> On Sun, 21 Sep 2014, Jan Hubicka wrote: >> Please omit static from inline functions. >>> >>> Yep, I suppose we want to drop static in all inlines? I can make patch for >>> that. Also one notable difference with your patche

Re: Speedup int_bit_from_pos

2014-09-22 Thread Jan Hubicka
> > On Sun, 21 Sep 2014, Jan Hubicka wrote: > > > > > > > > > > Please omit static from inline functions. > > > > > > Yep, I suppose we want to drop static in all inlines? I can make patch > > > for that. > > > > > > > > Also one notable difference with your patches is that the fits hwi is >

Re: Speedup int_bit_from_pos

2014-09-22 Thread Jan Hubicka
> On Sun, 21 Sep 2014, Jan Hubicka wrote: > > > > > > > Please omit static from inline functions. > > > > Yep, I suppose we want to drop static in all inlines? I can make patch for > > that. > > > > > > Also one notable difference with your patches is that the fits hwi is now > > > not tested

Re: Speedup int_bit_from_pos

2014-09-22 Thread Richard Biener
On Sun, 21 Sep 2014, Jan Hubicka wrote: > > > > Please omit static from inline functions. > > Yep, I suppose we want to drop static in all inlines? I can make patch for > that. > > > > Also one notable difference with your patches is that the fits hwi is now > > not tested on the result but o

Re: Speedup int_bit_from_pos

2014-09-21 Thread Jan Hubicka
> > Please omit static from inline functions. Yep, I suppose we want to drop static in all inlines? I can make patch for that. > > Also one notable difference with your patches is that the fits hwi is now not > tested on the result but on the result input which, multiplied by 8, might > not fi

Re: Speedup int_bit_from_pos

2014-09-21 Thread Richard Biener
On September 20, 2014 6:07:52 PM CEST, Jan Hubicka wrote: >> On 09/19/14 22:04, Jan Hubicka wrote: >> >Hi, >> >int_bit_position is used by ipa-devirt's type walking code. It is >currently a bottleneck >> >since I introduced speculation into contextes (I plan to solve this >by changing the >> >way

Re: Speedup int_bit_from_pos

2014-09-20 Thread Jan Hubicka
> > Yep, tree_to_shwi will check it. The old code did generic expression folding > and > called tree_to_shwi on result, so the only difference is that old code will > accept > unfolded expressions that miraculously folds into constant. I think it is > bug to > have those in IL especially on p

Re: Speedup int_bit_from_pos

2014-09-20 Thread Jan Hubicka
> On 09/19/14 22:04, Jan Hubicka wrote: > >Hi, > >int_bit_position is used by ipa-devirt's type walking code. It is currently > >a bottleneck > >since I introduced speculation into contextes (I plan to solve this by > >changing the > >way i cache results). But this patch seems to make sense anyw

Re: Speedup int_bit_from_pos

2014-09-20 Thread Jeff Law
On 09/19/14 22:04, Jan Hubicka wrote: Hi, int_bit_position is used by ipa-devirt's type walking code. It is currently a bottleneck since I introduced speculation into contextes (I plan to solve this by changing the way i cache results). But this patch seems to make sense anyway: we do not need