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

Swati Sharma duke at openjdk.java.net
Thu Mar 3 11:43:25 UTC 2022


On Mon, 28 Feb 2022 09:24:55 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
>
> test/jdk/jdk/incubator/vector/Byte128VectorTests.java line 5323:
> 
>> 5321: 
>> 5322:     static byte CTZ(byte a) {
>> 5323:         return (byte)(CTZ_scalar(a));
> 
> Why not directly `return (byte) (a != 0 ? Integer.numberOfTrailingZeros(a) : 8);` in this method?

To keep minimal changes in the test generation template, we want to keep one interface which caters to all the primitive types.

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

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


More information about the panama-dev mailing list