Integer specialisation of BitScanForwardNode

D.Sturm D.Sturm42 at gmail.com
Sat Oct 12 04:41:33 PDT 2013


Sure.

Before patch for a Integer.numberOfTrailingZeros() invocation:
cmp    edx,0x0
je     0x11
movsxd rax,edx
bsf    rax,rax

after:
cmp    edx,0x0
je     0xe
bsf    rax,rdx


Note that it doesn't matter that we still use the 64bit instruction since
at least one bit in the first 32bit will be nonzero, due to the check for 0
before.

-Daniel


On 12 October 2013 05:22, Thomas Wuerthinger
<thomas.wuerthinger at oracle.com>wrote:

> Yes, absolutely. Could you create a patch for this?
>
> Thanks, thomas
>
> On Oct 11, 2013, at 4:51 PM, D.Sturm <D.Sturm42 at gmail.com> wrote:
>
> > BitScanForwardNode only has a single @NodeIntrinsic method that takes a
> > long. As a consequence when computing it for an int we first sign-extend
> it
> > to a long, e.g.:
> >
> > cmp    edx,0x0
> > je     0x11
> > movsxd rax,edx
> > bsf    rax,rax
> >
> >
> > Could we introduce a new method taking an int to avoid this?
>
>


More information about the graal-dev mailing list