8256973: Intrinsic creation for VectorMask query (lastTrue,firstTrue,trueCount) APIs

Reviewed-by: psandoz, vlivanov
This commit is contained in:
Jatin Bhateja 2021-05-19 05:22:02 +00:00
parent 65a8bf58be
commit 7aa65685b8
81 changed files with 1817 additions and 33 deletions

View file

@ -69,6 +69,11 @@ public class VectorSupport {
public static final int VECTOR_OP_CAST = 17;
public static final int VECTOR_OP_REINTERPRET = 18;
// Mask manipulation operations
public static final int VECTOR_OP_MASK_TRUECOUNT = 19;
public static final int VECTOR_OP_MASK_FIRSTTRUE = 20;
public static final int VECTOR_OP_MASK_LASTTRUE = 21;
// enum BoolTest
public static final int BT_eq = 0;
public static final int BT_ne = 4;
@ -453,6 +458,20 @@ public class VectorSupport {
return v;
}
/* ============================================================================ */
public interface VectorMaskOp<M> {
int apply(M m);
}
@IntrinsicCandidate
public static
<E, M>
int maskReductionCoerced(int oper, Class<? extends M> maskClass, Class<?> elemClass, int length, M m,
VectorMaskOp<M> defaultImpl) {
assert isNonCapturingLambda(defaultImpl) : defaultImpl;
return defaultImpl.apply(m);
}
/* ============================================================================ */
// query the JVM's supported vector sizes and types