RFR: 8269725: AArch64: Add VectorMask query implementation for NEON [v2]

Andrew Haley aph at openjdk.java.net
Thu Jul 8 09:55:54 UTC 2021


On Thu, 8 Jul 2021 09:36:17 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

>> src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 line 2299:
>> 
>>> 2297:   ins_encode %{
>>> 2298:     // Revert the bits and count the leading zero bytes.
>>> 2299:     __ negr(as_FloatRegister($tmp$$reg), __ T8B, as_FloatRegister($src$$reg));
>> 
>> Should that be "Reverse the bits?" But in any case, we can see that the code calls rbit then clz, presumably because you want to count the trailing bits. What does the negr do here?
>
> Thanks for your comment @theRealAph !  Yeah, it's "Reverse the bits".  Thanks for pointing out this!
> `negr` is used to convert the original mask values from `0/1` to `0/-1`. So that we can firstly calculate the trailing zero numbers in bits, and then divide it by 8. Note that the mask input for these operations are different from others. It is actually a boolean vector with `0/1` as the element value.

Yes, but you reverse the bits in $dst, which reverses the byte order and changes each 0x01 byte to 0x80. You then count the leading zeroes. What, then, is the point of negating each 0x01 byte to 0xff first?

-------------

PR: https://git.openjdk.java.net/jdk/pull/4699


More information about the hotspot-compiler-dev mailing list