[vectorIntrinsics+mask] RFR: 8273949: Intrinsic creation for VectorMask.toLong operation. [v2]
Jatin Bhateja
jbhateja at openjdk.java.net
Mon Sep 20 19:28:41 UTC 2021
On Mon, 20 Sep 2021 15:41:04 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
>> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8273949: Review comments resolution
>
> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java line 68:
>
>> 66: if (i < 0 || i >= length()) {
>> 67: throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + length());
>> 68: }
>
> Apologies i should have previously said use `Objects.checkIndex(i, length())`. In fact lets call `length` once:
>
> int length = length();
> Objects.checkIndex(i, length);
> if (length <= Long.SIZE) {
> ...
>
>
> Separately i wonder if the second bounds check should be `if i <= Long.SIZE`, since the first bounds check should dominate in many cases?
>
> (I know there are other areas where we should `Objects.checkIndex` e.g. `*MaxVector.lane/withLane` but we can fix those later.)
With length <= Long.SIZE there is a better possibility of optimizing out else part and thus only fast path gets generated. length is final static values and hence in most of the cases due to in-lining this constant may get propagated.
-------------
PR: https://git.openjdk.java.net/panama-vector/pull/126
More information about the panama-dev
mailing list