https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85544

--- Comment #13 from Harald Anlauf <anlauf at gmx dot de> ---
(In reply to Thomas Koenig from comment #12)
> (In reply to Harald Anlauf from comment #10)
> 
> > Handling positive powers of 2 should be straightforward:
> > 
> > The condition is sth. like
> > 
> >   if (v > 1 && (v & (v-1) == 0))
> > 
> > and the exponent is derived by bit-counting the number of ones in (v-1)...
> 
> ... which is something I (currently) do not know to do in the
> front end.

Since you already have

      HOST_WIDE_INT v;

you could use wi::popcount (v-1).

> Otherwise: Patches welcome (as always :-)

I'm afraid removing some of your code would cross the magic 10 lines mark...

Reply via email to