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

Jatin Bhateja jbhateja at openjdk.java.net
Thu Mar 3 13:04:29 UTC 2022


On Thu, 3 Mar 2022 12:01:30 GMT, Quan Anh Mai <duke at openjdk.java.net> wrote:

>> This could be `Integer.numberOfTrailingZeros(a | 0x100);`
>
> And I think what he meant was the calculation of the `numberOfLeadingZeros` below

> numberOfTrailingZeros

Having a special case for zero will be better from performance perspective in slow path.
We may incur one additional comparison but given that C2 will intrinsify at a VectorSupport.unaryOp level it will not  hurt compiled code performance but special handlings improve fallback code performance.

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

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


More information about the panama-dev mailing list