[vectorIntrinsics+mask] RFR: 8271273: Java API and IR changes for masked compare operation

Paul Sandoz psandoz at openjdk.java.net
Mon Jul 26 17:10:47 UTC 2021


On Mon, 26 Jul 2021 10:16:36 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

>> - Re-organized the Java API implementation to use one common entry point of masked/non-masked vector compare operation.
>> - Intrinsic side changes to absorb newly passed mask if target support predicated instructions else handled appropriately by performing vector AND b/w comparison result and explicit mask.
>
> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java line 1889:
> 
>> 1887:     <M extends VectorMask<Byte>>
>> 1888:     M compareTemplate(Class<M> maskType, Comparison op, Vector<Byte> v, M m) {
>> 1889:         Objects.requireNonNull(v);
> 
> It's better to check the argument `M m` for masked API, since we'd better to make sure it is not "null" when going into hotspot intrinsics. Calling `m.check(maskType, this)` can guarantee this.

Yes, please follow the pattern for the other templates, where we move the default Java implementation to a method that is shared by both templates. It helps to be consistent and also uniformly apply the mask checking only where needed (we know that works).
Perhaps it might be possible to uniformly collapse the pattern later as we push more mask cases into the JIT.

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

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


More information about the panama-dev mailing list