Request for reviews (L): 6823354: Add intrinsics for{Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()

Christian Thalinger Christian.Thalinger at Sun.COM
Thu Apr 23 03:39:55 PDT 2009

On Wed, 2009-04-22 at 18:33 -0700, Vladimir Kozlov wrote:
> On sparc:
> Why do you use different registers for popc() in countTrailingZeros

Hmm, good question, I think I didn't see that.  Thanks.

> and in countLeadingZerosL?

I wasn't sure I can use a iRegL as iRegI, since the return value is an
int.  Thinking about that again I see that the register usage is not in
the scope of the matcher and shouldn't matter, as long as the hardware
does the correct thing.

> You can use the same register (as you do in countLeadingZerosI)
> and avoid using tmp register in countTrailingZeros and tmp2 in
> countLeadingZerosL.
> -----------------------
> Use the next code to avoid using tmp register on x86:
>      bsrl    $dst, $src
>      jnz     skip
>      movl    $dst, -1
> skip:
>      negl    $dst
>      addl    $dst, 31

Much better!  Thanks!

-- Christian

More information about the hotspot-compiler-dev mailing list