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

Paul Sandoz psandoz at openjdk.java.net
Mon Feb 28 21:37:02 UTC 2022


On Fri, 25 Feb 2022 18:59:34 GMT, Swati Sharma <duke at openjdk.java.net> 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/VectorOperators.java line 456:

> 454:     public static final Unary BIT_COUNT = unary("BIT_COUNT", "bitCount", VectorSupport.VECTOR_OP_BIT_COUNT, VO_NOFP);
> 455:     /** Produce {@code numberOfTrailingZeros(a)} */
> 456:     public static final Unary CTZ = unary("CTZ", "numberOfTrailingZeros", VectorSupport.VECTOR_OP_CTZ, VO_NOFP);

I think we should be more verbose in the names, as they will not be well understood by developers. Specifically `TRAILING_ZEROS_COUNT` and `LEADING_ZEROS_COUNT`, and be consistent in other places. Internally we could shorten to `VECTOR_OP_TZ_COUNT` etc. to reduce the horizontal width.

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

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


More information about the panama-dev mailing list