8256973: Intrinsic creation for VectorMask query (lastTrue,firstTrue,trueCount) APIs
Reviewed-by: psandoz, vlivanov
This commit is contained in:
parent
65a8bf58be
commit
7aa65685b8
43
mask.incr
Normal file
43
mask.incr
Normal file
@ -0,0 +1,43 @@
|
||||
diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp
|
||||
index 3b8261d91d0..ad4bfd57f53 100644
|
||||
--- a/src/hotspot/share/opto/vectorIntrinsics.cpp
|
||||
+++ b/src/hotspot/share/opto/vectorIntrinsics.cpp
|
||||
@@ -429,8 +429,12 @@ bool LibraryCallKit::inline_vector_mask_operation() {
|
||||
ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type();
|
||||
BasicType elem_bt = elem_type->basic_type();
|
||||
|
||||
- if (num_elem <= 2) {
|
||||
- return false;
|
||||
+ if (!arch_supports_vector(Op_LoadVector, num_elem, T_BOOLEAN, VecMaskNotUsed)) {
|
||||
+ if (C->print_intrinsics()) {
|
||||
+ tty->print_cr(" ** not supported: arity=1 op=cast#%d/3 vlen2=%d etype2=%s",
|
||||
+ Op_LoadVector, num_elem, type2name(T_BOOLEAN));
|
||||
+ }
|
||||
+ return false; // not supported
|
||||
}
|
||||
|
||||
int mopc = VectorSupport::vop2ideal(oper->get_con(), elem_bt);
|
||||
@@ -439,7 +443,7 @@ bool LibraryCallKit::inline_vector_mask_operation() {
|
||||
tty->print_cr(" ** not supported: arity=1 op=cast#%d/3 vlen2=%d etype2=%s",
|
||||
mopc, num_elem, type2name(elem_bt));
|
||||
}
|
||||
- return false;
|
||||
+ return false; // not supported
|
||||
}
|
||||
|
||||
const Type* elem_ty = Type::get_const_basic_type(elem_bt);
|
||||
diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskQueryOperationsBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskQueryOperationsBenchmark.java
|
||||
index 50add676c62..6f9df1800f6 100644
|
||||
--- a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskQueryOperationsBenchmark.java
|
||||
+++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskQueryOperationsBenchmark.java
|
||||
@@ -84,8 +84,8 @@ public class MaskQueryOperationsBenchmark {
|
||||
|
||||
@Setup(Level.Trial)
|
||||
public void BmSetup() {
|
||||
- bspecies = VectorSpecies.of(int.class, VectorShape.forBitSize(bits));
|
||||
- sspecies = VectorSpecies.of(int.class, VectorShape.forBitSize(bits));
|
||||
+ bspecies = VectorSpecies.of(byte.class, VectorShape.forBitSize(bits));
|
||||
+ sspecies = VectorSpecies.of(short.class, VectorShape.forBitSize(bits));
|
||||
ispecies = VectorSpecies.of(int.class, VectorShape.forBitSize(bits));
|
||||
lspecies = VectorSpecies.of(long.class, VectorShape.forBitSize(bits));
|
||||
|
@ -9393,6 +9393,14 @@ void Assembler::shrxq(Register dst, Register src1, Register src2) {
|
||||
emit_int16((unsigned char)0xF7, (0xC0 | encode));
|
||||
}
|
||||
|
||||
void Assembler::evpmovb2m(KRegister dst, XMMRegister src, int vector_len) {
|
||||
assert(VM_Version::supports_avx512vlbw(), "");
|
||||
InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
|
||||
attributes.set_is_evex_instruction();
|
||||
int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F_38, &attributes);
|
||||
emit_int16(0x29, (0xC0 | encode));
|
||||
}
|
||||
|
||||
#ifndef _LP64
|
||||
|
||||
void Assembler::incl(Register dst) {
|
||||
|
@ -2516,6 +2516,8 @@ private:
|
||||
void evpcmpw(KRegister kdst, KRegister mask, XMMRegister nds, Address src,
|
||||
int comparison, int vector_len);
|
||||
|
||||
void evpmovb2m(KRegister dst, XMMRegister src, int vector_len);
|
||||
|
||||
// Vector blends
|
||||
void blendvps(XMMRegister dst, XMMRegister src);
|
||||
void blendvpd(XMMRegister dst, XMMRegister src);
|
||||
|
@ -3750,3 +3750,54 @@ void C2_MacroAssembler::arrays_equals(bool is_array_equ, Register ary1, Register
|
||||
vpxor(vec2, vec2);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _LP64
|
||||
void C2_MacroAssembler::vector_mask_operation(int opc, Register dst, XMMRegister mask, XMMRegister xtmp,
|
||||
Register tmp, KRegister ktmp, int masklen, int vec_enc) {
|
||||
assert(VM_Version::supports_avx512vlbw(), "");
|
||||
vpxor(xtmp, xtmp, xtmp, vec_enc);
|
||||
vpsubb(xtmp, xtmp, mask, vec_enc);
|
||||
evpmovb2m(ktmp, xtmp, vec_enc);
|
||||
kmovql(tmp, ktmp);
|
||||
switch(opc) {
|
||||
case Op_VectorMaskTrueCount:
|
||||
popcntq(dst, tmp);
|
||||
break;
|
||||
case Op_VectorMaskLastTrue:
|
||||
mov64(dst, -1);
|
||||
bsrq(tmp, tmp);
|
||||
cmov(Assembler::notZero, dst, tmp);
|
||||
break;
|
||||
case Op_VectorMaskFirstTrue:
|
||||
mov64(dst, masklen);
|
||||
bsfq(tmp, tmp);
|
||||
cmov(Assembler::notZero, dst, tmp);
|
||||
break;
|
||||
default: assert(false, "Unhandled mask operation");
|
||||
}
|
||||
}
|
||||
|
||||
void C2_MacroAssembler::vector_mask_operation(int opc, Register dst, XMMRegister mask, XMMRegister xtmp,
|
||||
XMMRegister xtmp1, Register tmp, int masklen, int vec_enc) {
|
||||
assert(VM_Version::supports_avx(), "");
|
||||
vpxor(xtmp, xtmp, xtmp, vec_enc);
|
||||
vpsubb(xtmp, xtmp, mask, vec_enc);
|
||||
vpmovmskb(tmp, xtmp);
|
||||
switch(opc) {
|
||||
case Op_VectorMaskTrueCount:
|
||||
popcntq(dst, tmp);
|
||||
break;
|
||||
case Op_VectorMaskLastTrue:
|
||||
mov64(dst, -1);
|
||||
bsrq(tmp, tmp);
|
||||
cmov(Assembler::notZero, dst, tmp);
|
||||
break;
|
||||
case Op_VectorMaskFirstTrue:
|
||||
mov64(dst, masklen);
|
||||
bsfq(tmp, tmp);
|
||||
cmov(Assembler::notZero, dst, tmp);
|
||||
break;
|
||||
default: assert(false, "Unhandled mask operation");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -215,7 +215,13 @@ public:
|
||||
void reduce_operation_256(BasicType typ, int opcode, XMMRegister dst, XMMRegister src1, XMMRegister src2);
|
||||
|
||||
public:
|
||||
#ifdef _LP64
|
||||
void vector_mask_operation(int opc, Register dst, XMMRegister mask, XMMRegister xtmp, Register tmp,
|
||||
KRegister ktmp, int masklen, int vec_enc);
|
||||
|
||||
void vector_mask_operation(int opc, Register dst, XMMRegister mask, XMMRegister xtmp, XMMRegister xtmp1,
|
||||
Register tmp, int masklen, int vec_enc);
|
||||
#endif
|
||||
void string_indexof_char(Register str1, Register cnt1, Register ch, Register result,
|
||||
XMMRegister vec1, XMMRegister vec2, XMMRegister vec3, Register tmp);
|
||||
|
||||
|
@ -1581,6 +1581,13 @@ const bool Matcher::match_rule_supported(int opcode) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case Op_VectorMaskFirstTrue:
|
||||
case Op_VectorMaskLastTrue:
|
||||
case Op_VectorMaskTrueCount:
|
||||
if (!is_LP64 || UseAVX < 1) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
#ifndef _LP64
|
||||
case Op_AddReductionVF:
|
||||
case Op_AddReductionVD:
|
||||
@ -8057,4 +8064,66 @@ instruct vmasked_store64(memory mem, vec src, kReg mask) %{
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
instruct vmask_truecount_evex(rRegI dst, vec mask, rRegL tmp, kReg ktmp, vec xtmp) %{
|
||||
predicate(VM_Version::supports_avx512vlbw());
|
||||
match(Set dst (VectorMaskTrueCount mask));
|
||||
effect(TEMP_DEF dst, TEMP tmp, TEMP ktmp, TEMP xtmp);
|
||||
format %{ "vector_truecount_evex $mask \t! vector mask true count" %}
|
||||
ins_encode %{
|
||||
int opcode = this->ideal_Opcode();
|
||||
int vlen_enc = vector_length_encoding(this, $mask);
|
||||
int mask_len = vector_length(this, $mask);
|
||||
__ vector_mask_operation(opcode, $dst$$Register, $mask$$XMMRegister, $xtmp$$XMMRegister,
|
||||
$tmp$$Register, $ktmp$$KRegister, mask_len, vlen_enc);
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
instruct vmask_first_or_last_true_evex(rRegI dst, vec mask, rRegL tmp, kReg ktmp, vec xtmp, rFlagsReg cr) %{
|
||||
predicate(VM_Version::supports_avx512vlbw());
|
||||
match(Set dst (VectorMaskFirstTrue mask));
|
||||
match(Set dst (VectorMaskLastTrue mask));
|
||||
effect(TEMP_DEF dst, TEMP tmp, TEMP ktmp, TEMP xtmp, KILL cr);
|
||||
format %{ "vector_mask_first_or_last_true_evex $mask \t! vector first/last true location" %}
|
||||
ins_encode %{
|
||||
int opcode = this->ideal_Opcode();
|
||||
int vlen_enc = vector_length_encoding(this, $mask);
|
||||
int mask_len = vector_length(this, $mask);
|
||||
__ vector_mask_operation(opcode, $dst$$Register, $mask$$XMMRegister, $xtmp$$XMMRegister,
|
||||
$tmp$$Register, $ktmp$$KRegister, mask_len, vlen_enc);
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
instruct vmask_truecount_avx(rRegI dst, vec mask, rRegL tmp, vec xtmp, vec xtmp1) %{
|
||||
predicate(!VM_Version::supports_avx512vlbw());
|
||||
match(Set dst (VectorMaskTrueCount mask));
|
||||
effect(TEMP_DEF dst, TEMP tmp, TEMP xtmp, TEMP xtmp1);
|
||||
format %{ "vector_truecount_avx $mask \t! vector mask true count" %}
|
||||
ins_encode %{
|
||||
int opcode = this->ideal_Opcode();
|
||||
int vlen_enc = vector_length_encoding(this, $mask);
|
||||
int mask_len = vector_length(this, $mask);
|
||||
__ vector_mask_operation(opcode, $dst$$Register, $mask$$XMMRegister, $xtmp$$XMMRegister,
|
||||
$xtmp1$$XMMRegister, $tmp$$Register, mask_len, vlen_enc);
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
instruct vmask_first_or_last_true_avx(rRegI dst, vec mask, rRegL tmp, vec xtmp, vec xtmp1, rFlagsReg cr) %{
|
||||
predicate(!VM_Version::supports_avx512vlbw());
|
||||
match(Set dst (VectorMaskFirstTrue mask));
|
||||
match(Set dst (VectorMaskLastTrue mask));
|
||||
effect(TEMP_DEF dst, TEMP tmp, TEMP xtmp, TEMP xtmp1, KILL cr);
|
||||
format %{ "vector_mask_first_or_last_true_avx $mask \t! vector first/last true location" %}
|
||||
ins_encode %{
|
||||
int opcode = this->ideal_Opcode();
|
||||
int vlen_enc = vector_length_encoding(this, $mask);
|
||||
int mask_len = vector_length(this, $mask);
|
||||
__ vector_mask_operation(opcode, $dst$$Register, $mask$$XMMRegister, $xtmp$$XMMRegister,
|
||||
$xtmp1$$XMMRegister, $tmp$$Register, mask_len, vlen_enc);
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
#endif // _LP64
|
||||
|
@ -925,7 +925,11 @@ class methodHandle;
|
||||
do_alias(vector_rebox_sig, object_object_signature) \
|
||||
do_name(vector_rebox_name, "maybeRebox") \
|
||||
\
|
||||
\
|
||||
do_intrinsic(_VectorMaskOp, jdk_internal_vm_vector_VectorSupport, vector_mask_oper_name, vector_mask_oper_sig, F_S) \
|
||||
do_signature(vector_mask_oper_sig, "(ILjava/lang/Class;Ljava/lang/Class;ILjava/lang/Object;" \
|
||||
"Ljdk/internal/vm/vector/VectorSupport$VectorMaskOp;)I") \
|
||||
do_name(vector_mask_oper_name, "maskReductionCoerced") \
|
||||
\
|
||||
/* (2) Bytecode intrinsics */ \
|
||||
\
|
||||
do_intrinsic(_park, jdk_internal_misc_Unsafe, park_name, park_signature, F_R) \
|
||||
@ -1034,7 +1038,7 @@ enum class vmIntrinsicID : int {
|
||||
__IGNORE_CLASS, __IGNORE_NAME, __IGNORE_SIGNATURE, __IGNORE_ALIAS)
|
||||
|
||||
ID_LIMIT,
|
||||
LAST_COMPILER_INLINE = _VectorScatterOp,
|
||||
LAST_COMPILER_INLINE = _VectorMaskOp,
|
||||
FIRST_MH_SIG_POLY = _invokeGeneric,
|
||||
FIRST_MH_STATIC = _linkToVirtual,
|
||||
LAST_MH_SIG_POLY = _linkToNative,
|
||||
|
@ -676,6 +676,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
|
||||
case vmIntrinsics::_VectorConvert:
|
||||
case vmIntrinsics::_VectorInsert:
|
||||
case vmIntrinsics::_VectorExtract:
|
||||
case vmIntrinsics::_VectorMaskOp:
|
||||
return EnableVectorSupport;
|
||||
case vmIntrinsics::_blackhole:
|
||||
break;
|
||||
|
@ -414,6 +414,10 @@ macro(StoreVectorScatter)
|
||||
macro(LoadVectorMasked)
|
||||
macro(StoreVectorMasked)
|
||||
macro(VectorMaskGen)
|
||||
macro(VectorMaskOp)
|
||||
macro(VectorMaskTrueCount)
|
||||
macro(VectorMaskFirstTrue)
|
||||
macro(VectorMaskLastTrue)
|
||||
macro(Pack)
|
||||
macro(PackB)
|
||||
macro(PackS)
|
||||
|
@ -637,6 +637,8 @@ bool LibraryCallKit::try_to_inline(int predicate) {
|
||||
return inline_vector_broadcast_coerced();
|
||||
case vmIntrinsics::_VectorShuffleIota:
|
||||
return inline_vector_shuffle_iota();
|
||||
case vmIntrinsics::_VectorMaskOp:
|
||||
return inline_vector_mask_operation();
|
||||
case vmIntrinsics::_VectorShuffleToVector:
|
||||
return inline_vector_shuffle_to_vector();
|
||||
case vmIntrinsics::_VectorLoadOp:
|
||||
|
@ -314,6 +314,7 @@ class LibraryCallKit : public GraphKit {
|
||||
bool inline_vector_broadcast_coerced();
|
||||
bool inline_vector_shuffle_to_vector();
|
||||
bool inline_vector_shuffle_iota();
|
||||
bool inline_vector_mask_operation();
|
||||
bool inline_vector_mem_operation(bool is_store);
|
||||
bool inline_vector_gather_scatter(bool is_scatter);
|
||||
bool inline_vector_reduction();
|
||||
|
@ -405,6 +405,60 @@ bool LibraryCallKit::inline_vector_shuffle_iota() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// <E, M>
|
||||
// int maskReductionCoerced(int oper, Class<? extends M> maskClass, Class<?> elemClass,
|
||||
// int length, M m, VectorMaskOp<M> defaultImpl)
|
||||
bool LibraryCallKit::inline_vector_mask_operation() {
|
||||
const TypeInt* oper = gvn().type(argument(0))->isa_int();
|
||||
const TypeInstPtr* mask_klass = gvn().type(argument(1))->isa_instptr();
|
||||
const TypeInstPtr* elem_klass = gvn().type(argument(2))->isa_instptr();
|
||||
const TypeInt* vlen = gvn().type(argument(3))->isa_int();
|
||||
Node* mask = argument(4);
|
||||
|
||||
if (mask_klass == NULL || elem_klass == NULL || mask->is_top() || vlen == NULL) {
|
||||
return false; // dead code
|
||||
}
|
||||
|
||||
if (!is_klass_initialized(mask_klass)) {
|
||||
if (C->print_intrinsics()) {
|
||||
tty->print_cr(" ** klass argument not initialized");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int num_elem = vlen->get_con();
|
||||
ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type();
|
||||
BasicType elem_bt = elem_type->basic_type();
|
||||
|
||||
if (!arch_supports_vector(Op_LoadVector, num_elem, T_BOOLEAN, VecMaskNotUsed)) {
|
||||
if (C->print_intrinsics()) {
|
||||
tty->print_cr(" ** not supported: arity=1 op=cast#%d/3 vlen2=%d etype2=%s",
|
||||
Op_LoadVector, num_elem, type2name(T_BOOLEAN));
|
||||
}
|
||||
return false; // not supported
|
||||
}
|
||||
|
||||
int mopc = VectorSupport::vop2ideal(oper->get_con(), elem_bt);
|
||||
if (!arch_supports_vector(mopc, num_elem, elem_bt, VecMaskNotUsed)) {
|
||||
if (C->print_intrinsics()) {
|
||||
tty->print_cr(" ** not supported: arity=1 op=cast#%d/3 vlen2=%d etype2=%s",
|
||||
mopc, num_elem, type2name(elem_bt));
|
||||
}
|
||||
return false; // not supported
|
||||
}
|
||||
|
||||
const Type* elem_ty = Type::get_const_basic_type(elem_bt);
|
||||
ciKlass* mbox_klass = mask_klass->const_oop()->as_instance()->java_lang_Class_klass();
|
||||
const TypeInstPtr* mask_box_type = TypeInstPtr::make_exact(TypePtr::NotNull, mbox_klass);
|
||||
Node* mask_vec = unbox_vector(mask, mask_box_type, elem_bt, num_elem, true);
|
||||
Node* store_mask = gvn().transform(VectorStoreMaskNode::make(gvn(), mask_vec, elem_bt, num_elem));
|
||||
Node* maskoper = gvn().transform(VectorMaskOpNode::make(store_mask, TypeInt::INT, mopc));
|
||||
set_result(maskoper);
|
||||
|
||||
C->set_max_vector_size(MAX2(C->max_vector_size(), (uint)(num_elem * type2aelembytes(elem_bt))));
|
||||
return true;
|
||||
}
|
||||
|
||||
// <VM ,Sh extends VectorShuffle<E>, E>
|
||||
// VM shuffleToVector(Class<VM> VecClass, Class<?>E , Class<?> ShuffleClass, Sh s, int length,
|
||||
// ShuffleToVectorOperation<VM,Sh,E> defaultImpl)
|
||||
|
@ -1294,6 +1294,21 @@ Node* ShiftVNode::Identity(PhaseGVN* phase) {
|
||||
return this;
|
||||
}
|
||||
|
||||
Node* VectorMaskOpNode::make(Node* mask, const Type* ty, int mopc) {
|
||||
switch(mopc) {
|
||||
case Op_VectorMaskTrueCount:
|
||||
return new VectorMaskTrueCountNode(mask, ty);
|
||||
case Op_VectorMaskLastTrue:
|
||||
return new VectorMaskLastTrueNode(mask, ty);
|
||||
case Op_VectorMaskFirstTrue:
|
||||
return new VectorMaskFirstTrueNode(mask, ty);
|
||||
default:
|
||||
assert(false, "Unhandled operation");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifndef PRODUCT
|
||||
void VectorBoxAllocateNode::dump_spec(outputStream *st) const {
|
||||
CallStaticJavaNode::dump_spec(st);
|
||||
|
@ -853,6 +853,45 @@ class VectorMaskGenNode : public TypeNode {
|
||||
const Type* _elemType;
|
||||
};
|
||||
|
||||
class VectorMaskOpNode : public TypeNode {
|
||||
public:
|
||||
VectorMaskOpNode(Node* mask, const Type* ty, int mopc):
|
||||
TypeNode(ty, 2), _mopc(mopc) {
|
||||
assert(mask->Opcode() == Op_VectorStoreMask, "");
|
||||
init_req(1, mask);
|
||||
}
|
||||
|
||||
virtual int Opcode() const;
|
||||
virtual uint size_of() const { return sizeof(VectorMaskOpNode); }
|
||||
virtual uint ideal_reg() const { return Op_RegI; }
|
||||
int get_mask_Opcode() const { return _mopc;}
|
||||
static Node* make(Node* mask, const Type* ty, int mopc);
|
||||
|
||||
private:
|
||||
int _mopc;
|
||||
};
|
||||
|
||||
class VectorMaskTrueCountNode : public VectorMaskOpNode {
|
||||
public:
|
||||
VectorMaskTrueCountNode(Node* mask, const Type* ty):
|
||||
VectorMaskOpNode(mask, ty, Op_VectorMaskTrueCount) {}
|
||||
virtual int Opcode() const;
|
||||
};
|
||||
|
||||
class VectorMaskFirstTrueNode : public VectorMaskOpNode {
|
||||
public:
|
||||
VectorMaskFirstTrueNode(Node* mask, const Type* ty):
|
||||
VectorMaskOpNode(mask, ty, Op_VectorMaskFirstTrue) {}
|
||||
virtual int Opcode() const;
|
||||
};
|
||||
|
||||
class VectorMaskLastTrueNode : public VectorMaskOpNode {
|
||||
public:
|
||||
VectorMaskLastTrueNode(Node* mask, const Type* ty):
|
||||
VectorMaskOpNode(mask, ty, Op_VectorMaskLastTrue) {}
|
||||
virtual int Opcode() const;
|
||||
};
|
||||
|
||||
//=========================Promote_Scalar_to_Vector============================
|
||||
|
||||
//------------------------------ReplicateBNode---------------------------------
|
||||
|
@ -349,6 +349,42 @@ int VectorSupport::vop2ideal(jint id, BasicType bt) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VECTOR_OP_MASK_LASTTRUE: {
|
||||
switch (bt) {
|
||||
case T_BYTE: // fall-through
|
||||
case T_SHORT: // fall-through
|
||||
case T_INT: // fall-through
|
||||
case T_LONG: // fall-through
|
||||
case T_FLOAT: // fall-through
|
||||
case T_DOUBLE: return Op_VectorMaskLastTrue;
|
||||
default: fatal("MASK_LASTTRUE: %s", type2name(bt));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VECTOR_OP_MASK_FIRSTTRUE: {
|
||||
switch (bt) {
|
||||
case T_BYTE: // fall-through
|
||||
case T_SHORT: // fall-through
|
||||
case T_INT: // fall-through
|
||||
case T_LONG: // fall-through
|
||||
case T_FLOAT: // fall-through
|
||||
case T_DOUBLE: return Op_VectorMaskFirstTrue;
|
||||
default: fatal("MASK_FIRSTTRUE: %s", type2name(bt));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VECTOR_OP_MASK_TRUECOUNT: {
|
||||
switch (bt) {
|
||||
case T_BYTE: // fall-through
|
||||
case T_SHORT: // fall-through
|
||||
case T_INT: // fall-through
|
||||
case T_LONG: // fall-through
|
||||
case T_FLOAT: // fall-through
|
||||
case T_DOUBLE: return Op_VectorMaskTrueCount;
|
||||
default: fatal("MASK_TRUECOUNT: %s", type2name(bt));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: fatal("unknown op: %d", vop);
|
||||
}
|
||||
return 0; // Unimplemented
|
||||
|
@ -77,7 +77,12 @@ class VectorSupport : AllStatic {
|
||||
|
||||
// Convert
|
||||
VECTOR_OP_CAST = 17,
|
||||
VECTOR_OP_REINTERPRET = 18
|
||||
VECTOR_OP_REINTERPRET = 18,
|
||||
|
||||
// Mask manipulation operations
|
||||
VECTOR_OP_MASK_TRUECOUNT = 19,
|
||||
VECTOR_OP_MASK_FIRSTTRUE = 20,
|
||||
VECTOR_OP_MASK_LASTTRUE = 21
|
||||
};
|
||||
|
||||
static int vop2ideal(jint vop, BasicType bt);
|
||||
|
@ -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
|
||||
|
@ -114,36 +114,6 @@ abstract class AbstractMask<E> extends VectorMask<E> {
|
||||
return (VectorMask<F>) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int trueCount() {
|
||||
//FIXME: use a population count intrinsic here
|
||||
int c = 0;
|
||||
for (boolean i : getBits()) {
|
||||
if (i) c++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int firstTrue() {
|
||||
//FIXME: use a count trailing zeros intrinsic here
|
||||
boolean[] bits = getBits();
|
||||
for (int i = 0; i < bits.length; i++) {
|
||||
if (bits[i]) return i;
|
||||
}
|
||||
return bits.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastTrue() {
|
||||
//FIXME: use a count leading zeros intrinsic here
|
||||
boolean[] bits = getBits();
|
||||
for (int i = bits.length-1; i >= 0; i--) {
|
||||
if (bits[i]) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VectorMask<E> eq(VectorMask<E> m) {
|
||||
// FIXME: Generate good code here.
|
||||
@ -173,6 +143,31 @@ abstract class AbstractMask<E> extends VectorMask<E> {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*package-private*/
|
||||
static int trueCountHelper(boolean[] bits) {
|
||||
int c = 0;
|
||||
for (boolean i : bits) {
|
||||
if (i) c++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/*package-private*/
|
||||
static int firstTrueHelper(boolean[] bits) {
|
||||
for (int i = 0; i < bits.length; i++) {
|
||||
if (bits[i]) return i;
|
||||
}
|
||||
return bits.length;
|
||||
}
|
||||
|
||||
/*package-private*/
|
||||
static int lastTrueHelper(boolean[] bits) {
|
||||
for (int i = bits.length-1; i >= 0; i--) {
|
||||
if (bits[i]) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public VectorMask<E> indexInRange(int offset, int limit) {
|
||||
|
@ -666,6 +666,29 @@ final class Byte128Vector extends ByteVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Byte128Mask.class, byte.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Byte128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Byte128Mask.class, byte.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Byte128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Byte128Mask.class, byte.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Byte128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -698,6 +698,29 @@ final class Byte256Vector extends ByteVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Byte256Mask.class, byte.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Byte256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Byte256Mask.class, byte.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Byte256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Byte256Mask.class, byte.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Byte256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -762,6 +762,29 @@ final class Byte512Vector extends ByteVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Byte512Mask.class, byte.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Byte512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Byte512Mask.class, byte.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Byte512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Byte512Mask.class, byte.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Byte512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -650,6 +650,29 @@ final class Byte64Vector extends ByteVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Byte64Mask.class, byte.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Byte64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Byte64Mask.class, byte.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Byte64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Byte64Mask.class, byte.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Byte64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -636,6 +636,29 @@ final class ByteMaxVector extends ByteVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, ByteMaxMask.class, byte.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((ByteMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, ByteMaxMask.class, byte.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((ByteMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, ByteMaxMask.class, byte.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((ByteMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -634,6 +634,29 @@ final class Double128Vector extends DoubleVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Double128Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Double128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Double128Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Double128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Double128Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Double128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -638,6 +638,29 @@ final class Double256Vector extends DoubleVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Double256Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Double256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Double256Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Double256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Double256Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Double256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -646,6 +646,29 @@ final class Double512Vector extends DoubleVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Double512Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Double512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Double512Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Double512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Double512Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Double512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -632,6 +632,29 @@ final class Double64Vector extends DoubleVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Double64Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Double64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Double64Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Double64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Double64Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Double64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -631,6 +631,29 @@ final class DoubleMaxVector extends DoubleVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, DoubleMaxMask.class, long.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((DoubleMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, DoubleMaxMask.class, long.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((DoubleMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, DoubleMaxMask.class, long.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((DoubleMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -638,6 +638,29 @@ final class Float128Vector extends FloatVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Float128Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Float128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Float128Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Float128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Float128Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Float128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -646,6 +646,29 @@ final class Float256Vector extends FloatVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Float256Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Float256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Float256Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Float256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Float256Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Float256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -662,6 +662,29 @@ final class Float512Vector extends FloatVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Float512Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Float512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Float512Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Float512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Float512Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Float512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -634,6 +634,29 @@ final class Float64Vector extends FloatVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Float64Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Float64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Float64Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Float64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Float64Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Float64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -631,6 +631,29 @@ final class FloatMaxVector extends FloatVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, FloatMaxMask.class, int.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((FloatMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, FloatMaxMask.class, int.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((FloatMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, FloatMaxMask.class, int.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((FloatMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -642,6 +642,29 @@ final class Int128Vector extends IntVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Int128Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Int128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Int128Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Int128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Int128Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Int128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -650,6 +650,29 @@ final class Int256Vector extends IntVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Int256Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Int256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Int256Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Int256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Int256Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Int256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -666,6 +666,29 @@ final class Int512Vector extends IntVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Int512Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Int512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Int512Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Int512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Int512Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Int512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -638,6 +638,29 @@ final class Int64Vector extends IntVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Int64Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Int64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Int64Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Int64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Int64Mask.class, int.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Int64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -636,6 +636,29 @@ final class IntMaxVector extends IntVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, IntMaxMask.class, int.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((IntMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, IntMaxMask.class, int.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((IntMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, IntMaxMask.class, int.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((IntMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -628,6 +628,29 @@ final class Long128Vector extends LongVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long128Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Long128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long128Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Long128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long128Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Long128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -632,6 +632,29 @@ final class Long256Vector extends LongVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long256Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Long256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long256Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Long256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long256Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Long256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -640,6 +640,29 @@ final class Long512Vector extends LongVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long512Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Long512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long512Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Long512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long512Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Long512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -626,6 +626,29 @@ final class Long64Vector extends LongVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long64Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Long64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long64Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Long64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long64Mask.class, long.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Long64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -626,6 +626,29 @@ final class LongMaxVector extends LongVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, LongMaxMask.class, long.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((LongMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, LongMaxMask.class, long.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((LongMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, LongMaxMask.class, long.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((LongMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -650,6 +650,29 @@ final class Short128Vector extends ShortVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Short128Mask.class, short.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Short128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Short128Mask.class, short.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Short128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Short128Mask.class, short.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Short128Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -666,6 +666,29 @@ final class Short256Vector extends ShortVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Short256Mask.class, short.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Short256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Short256Mask.class, short.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Short256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Short256Mask.class, short.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Short256Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -698,6 +698,29 @@ final class Short512Vector extends ShortVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Short512Mask.class, short.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Short512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Short512Mask.class, short.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Short512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Short512Mask.class, short.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Short512Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -642,6 +642,29 @@ final class Short64Vector extends ShortVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Short64Mask.class, short.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((Short64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Short64Mask.class, short.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((Short64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Short64Mask.class, short.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((Short64Mask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -636,6 +636,29 @@ final class ShortMaxVector extends ShortVector {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, ShortMaxMask.class, short.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper(((ShortMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, ShortMaxMask.class, short.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper(((ShortMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, ShortMaxMask.class, short.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper(((ShortMaxMask)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -909,6 +909,29 @@ final class $vectortype$ extends $abstractvectortype$ {
|
||||
(m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
|
||||
}
|
||||
|
||||
// Mask Query operations
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int trueCount() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, $masktype$.class, $bitstype$.class, VLENGTH, this,
|
||||
(m) -> trueCountHelper((($masktype$)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int firstTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, $masktype$.class, $bitstype$.class, VLENGTH, this,
|
||||
(m) -> firstTrueHelper((($masktype$)m).getBits()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ForceInline
|
||||
public int lastTrue() {
|
||||
return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, $masktype$.class, $bitstype$.class, VLENGTH, this,
|
||||
(m) -> lastTrueHelper((($masktype$)m).getBits()));
|
||||
}
|
||||
|
||||
// Reductions
|
||||
|
||||
@Override
|
||||
|
@ -5178,6 +5178,24 @@ public class Byte128VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueByte128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5178,6 +5178,24 @@ public class Byte256VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueByte256VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5178,6 +5178,24 @@ public class Byte512VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueByte512VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5178,6 +5178,24 @@ public class Byte64VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueByte64VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5183,6 +5183,24 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueByteMaxVectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] offsetProvider() {
|
||||
|
@ -4924,6 +4924,24 @@ public class Double128VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueDouble128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -4924,6 +4924,24 @@ public class Double256VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueDouble256VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -4924,6 +4924,24 @@ public class Double512VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueDouble512VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -4924,6 +4924,24 @@ public class Double64VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueDouble64VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -4929,6 +4929,24 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueDoubleMaxVectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] offsetProvider() {
|
||||
|
@ -4902,6 +4902,24 @@ public class Float128VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueFloat128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -4902,6 +4902,24 @@ public class Float256VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueFloat256VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -4902,6 +4902,24 @@ public class Float512VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueFloat512VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -4902,6 +4902,24 @@ public class Float64VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueFloat64VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -4907,6 +4907,24 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueFloatMaxVectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] offsetProvider() {
|
||||
|
@ -5133,6 +5133,24 @@ public class Int128VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueInt128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5133,6 +5133,24 @@ public class Int256VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueInt256VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5133,6 +5133,24 @@ public class Int512VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueInt512VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5133,6 +5133,24 @@ public class Int64VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueInt64VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5138,6 +5138,24 @@ public class IntMaxVectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueIntMaxVectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] offsetProvider() {
|
||||
|
@ -5016,6 +5016,24 @@ public class Long128VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueLong128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5016,6 +5016,24 @@ public class Long256VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueLong256VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5016,6 +5016,24 @@ public class Long512VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueLong512VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5016,6 +5016,24 @@ public class Long64VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueLong64VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5021,6 +5021,24 @@ public class LongMaxVectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueLongMaxVectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] offsetProvider() {
|
||||
|
@ -5157,6 +5157,24 @@ public class Short128VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueShort128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5157,6 +5157,24 @@ public class Short256VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueShort256VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5157,6 +5157,24 @@ public class Short512VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueShort512VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5157,6 +5157,24 @@ public class Short64VectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueShort64VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
return new Object[][]{
|
||||
|
@ -5162,6 +5162,24 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrueShortMaxVectorTestsSmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@DataProvider
|
||||
public static Object[][] offsetProvider() {
|
||||
|
@ -444,6 +444,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "maskProvider")
|
||||
static void maskFirstTrue$vectorteststype$SmokeTest(IntFunction<boolean[]> fa) {
|
||||
boolean[] a = fa.apply(SPECIES.length());
|
||||
|
||||
for (int i = 0; i < a.length; i += SPECIES.length()) {
|
||||
var vmask = SPECIES.loadMask(a, i);
|
||||
int ftrue = vmask.firstTrue();
|
||||
int j = i;
|
||||
for (; j < i + SPECIES.length() ; j++) {
|
||||
if (a[j]) break;
|
||||
}
|
||||
int expectedFtrue = j - i;
|
||||
|
||||
Assert.assertTrue(ftrue == expectedFtrue, "at index " + i +
|
||||
", firstTrue should be = " + expectedFtrue + ", but is = " + ftrue);
|
||||
}
|
||||
}
|
||||
|
||||
#if[!MaxBit]
|
||||
@DataProvider
|
||||
public static Object[][] longMaskProvider() {
|
||||
|
@ -0,0 +1,159 @@
|
||||
//
|
||||
// Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
//
|
||||
// This code is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU General Public License version 2 only, as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
// version 2 for more details (a copy is included in the LICENSE file that
|
||||
// accompanied this code).
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License version
|
||||
// 2 along with this work; if not, write to the Free Software Foundation,
|
||||
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
// or visit www.oracle.com if you need additional information or have any
|
||||
// questions.
|
||||
//
|
||||
//
|
||||
package org.openjdk.bench.jdk.incubator.vector;
|
||||
|
||||
import java.util.Random;
|
||||
import jdk.incubator.vector.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.openjdk.jmh.annotations.*;
|
||||
import org.openjdk.jmh.infra.Blackhole;
|
||||
|
||||
@OutputTimeUnit(TimeUnit.MILLISECONDS)
|
||||
@State(Scope.Thread)
|
||||
public class MaskQueryOperationsBenchmark {
|
||||
@Param({"128","256","512"})
|
||||
int bits;
|
||||
|
||||
@Param({"1","2","3"})
|
||||
int inputs;
|
||||
|
||||
VectorSpecies bspecies;
|
||||
VectorSpecies sspecies;
|
||||
VectorSpecies ispecies;
|
||||
VectorSpecies lspecies;
|
||||
VectorMask bmask;
|
||||
VectorMask smask;
|
||||
VectorMask imask;
|
||||
VectorMask lmask;
|
||||
boolean [] mask_arr;
|
||||
|
||||
|
||||
static final boolean [] mask_avg_case = {
|
||||
false, false, false, true, false, false, false, false,
|
||||
false, false, false, true, false, false, false, false,
|
||||
false, false, false, true, false, false, false, false,
|
||||
true, true, true, true, true, true, true, true,
|
||||
true, true, true, true, true, true, true, true,
|
||||
false, false, false, true, false, false, false, false,
|
||||
false, false, false, true, false, false, false, false,
|
||||
false, false, false, true, false, false, false, false
|
||||
};
|
||||
|
||||
static final boolean [] mask_best_case = {
|
||||
true, true, true, true, true, true, true, true,
|
||||
true, true, true, true, true, true, true, true,
|
||||
true, true, true, true, true, true, true, true,
|
||||
true, true, true, true, true, true, true, true,
|
||||
true, true, true, true, true, true, true, true,
|
||||
true, true, true, true, true, true, true, true,
|
||||
true, true, true, true, true, true, true, true,
|
||||
true, true, true, true, true, true, true, true
|
||||
};
|
||||
|
||||
static final boolean [] mask_worst_case = {
|
||||
false, false, false, false, false, false, false, false,
|
||||
false, false, false, false, false, false, false, false,
|
||||
false, false, false, false, false, false, false, false,
|
||||
false, false, false, false, false, false, false, false,
|
||||
false, false, false, false, false, false, false, false,
|
||||
false, false, false, false, false, false, false, false,
|
||||
false, false, false, false, false, false, false, false,
|
||||
false, false, false, false, false, false, false, false
|
||||
};
|
||||
|
||||
@Setup(Level.Trial)
|
||||
public void BmSetup() {
|
||||
bspecies = VectorSpecies.of(byte.class, VectorShape.forBitSize(bits));
|
||||
sspecies = VectorSpecies.of(short.class, VectorShape.forBitSize(bits));
|
||||
ispecies = VectorSpecies.of(int.class, VectorShape.forBitSize(bits));
|
||||
lspecies = VectorSpecies.of(long.class, VectorShape.forBitSize(bits));
|
||||
|
||||
if( 1 == inputs) {
|
||||
mask_arr = mask_best_case;
|
||||
} else if ( 2 == inputs ) {
|
||||
mask_arr = mask_worst_case;
|
||||
} else {
|
||||
mask_arr = mask_avg_case;
|
||||
}
|
||||
|
||||
bmask = VectorMask.fromArray(bspecies, mask_arr, 0);
|
||||
smask = VectorMask.fromArray(sspecies, mask_arr, 0);
|
||||
imask = VectorMask.fromArray(ispecies, mask_arr, 0);
|
||||
lmask = VectorMask.fromArray(lspecies, mask_arr, 0);
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public int testTrueCountByte(Blackhole bh) {
|
||||
return bmask.trueCount();
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public int testTrueCountShort(Blackhole bh) {
|
||||
return smask.trueCount();
|
||||
}
|
||||
@Benchmark
|
||||
public int testTrueCountInt(Blackhole bh) {
|
||||
return imask.trueCount();
|
||||
}
|
||||
@Benchmark
|
||||
public int testTrueCountLong(Blackhole bh) {
|
||||
return lmask.trueCount();
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public int testFirstTrueByte(Blackhole bh) {
|
||||
return bmask.firstTrue();
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public int testFirstTrueShort(Blackhole bh) {
|
||||
return smask.firstTrue();
|
||||
}
|
||||
@Benchmark
|
||||
public int testFirstTrueInt(Blackhole bh) {
|
||||
return imask.firstTrue();
|
||||
}
|
||||
@Benchmark
|
||||
public int testFirstTrueLong(Blackhole bh) {
|
||||
return lmask.firstTrue();
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public int testLastTrueByte(Blackhole bh) {
|
||||
return bmask.lastTrue();
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public int testLastTrueShort(Blackhole bh) {
|
||||
return smask.lastTrue();
|
||||
}
|
||||
@Benchmark
|
||||
public int testLastTrueInt(Blackhole bh) {
|
||||
return imask.lastTrue();
|
||||
}
|
||||
@Benchmark
|
||||
public int testLastTrueLong(Blackhole bh) {
|
||||
return lmask.lastTrue();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user