[llvm] r182667 - [Support] Add type generic bit utilities to MathExtras.h

Michael Spencer bigcheesegs at gmail.com
Fri May 24 14:04:56 PDT 2013


On Fri, May 24, 2013 at 1:57 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> > +  // Use ^ instead of - because both gcc and llvm can remove the
> associated ^
> > +  // in the __builtin_clz intrinsic on x86.
> > +  return countLeadingZeros(Val, ZB_Undefined) ^
> > +         (std::numeric_limits<T>::digits - 1);
> > +}
>
>
> Hi, Michael,
>
> have you noticed: http://llvm.org/bugs/show_bug.cgi?id=16115#c3 Is it
> correct to use ^ in here? If so, I guess the testcase in the bug was
> incorrectly reduced.
>

Yeah, it was 31 -, not 32 -. However gcc 4.8 doesn't optimize the 31 -
case, so I left it as ^ 31.


>
> Can you pleas add a FIXME about removing CountLeadingZeros_32 and
> CountLeadingZeros_64 and using countLeadingZeros instead?
>

I'm going to remove them in a few min.


>
> Cheers,
> Rafael
>

- Michael Spencer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130524/e0f51e93/attachment.html>


More information about the llvm-commits mailing list