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

Xiaohong Gong xgong at openjdk.java.net
Mon Jul 26 10:15:31 UTC 2021


On Mon, 26 Jul 2021 09:33:38 GMT, Jatin Bhateja <jbhateja 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/hotspot/share/opto/vectorIntrinsics.cpp line 1701:

> 1699: 
> 1700:   bool is_masked_op = argument(7)->bottom_type() != TypePtr::NULL_PTR;
> 1701:   Node* mask = is_masked_op ? unbox_vector(argument(7), mbox_type, elem_bt, num_elem) : NULL;

It's better to check whether the` "unbox_vector"` result for `mask` is ` "null"` if "`is_masked_op`" is true. And return false if it is.

src/hotspot/share/opto/vectornode.hpp line 1327:

> 1325: };
> 1326: 
> 1327: 

Cleanup the added new line?

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java line 390:

> 388:     @ForceInline
> 389:     public final Byte128Mask compare(Comparison op, long s) {
> 390:         return super.compareTemplate(Byte128Mask.class, op, broadcast(s), null);  // specialize

Better to add a new template method for the non-masked compare,and set the maskClass and vector mask to "null" in the template method?

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java line 396:

> 394:     @ForceInline
> 395:     public final Byte128Mask compare(Comparison op, Vector<Byte> v, VectorMask<Byte> m) {
> 396:         return compareTemplate(Byte128Mask.class, op, v, ((Byte128Mask)m));

One more space between `(Byte128Mask)m`, and no brackets is needed for it after then.

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

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


More information about the panama-dev mailing list