[vectorIntrinsics] RFR: 8282389: Add new vector operations to count leading and trailing zeros.

Swati Sharma duke at openjdk.java.net
Thu Mar 3 11:47:31 UTC 2022


On Mon, 28 Feb 2022 09:11:27 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

>> Hi All,
>> 
>> Added support for new vector operations CLZ (count number of leading zeros) and CTZ (could number of trailing zeros) for all the integral vector types(Byte/Short/Integer/Long).
>> Added validation and performance tests corresponding the these operations in existing VectorAPI JTREG/JMH suite.
>> 
>> Kindly review and share your feedback.
>> 
>> Thanks and Regards,
>> Swati Sharma
>> Intel
>
> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java line 1798:
> 
>> 1796: 
>> 1797:     static int numberOfTrailingZeros(byte a) {
>> 1798:         return a != 0 ? Integer.numberOfTrailingZeros(a) : 8;
> 
> Integer.numberOfTrailingZeros((int)a & 0xFF) ?

Would it not return incorrect value for a=0.

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

PR: https://git.openjdk.java.net/panama-vector/pull/176


More information about the panama-dev mailing list