8271366: [REDO] JDK-8266054 VectorAPI rotate operation optimization

Reviewed-by: sviswanathan, psandoz
This commit is contained in:
Jatin Bhateja 2021-08-13 04:33:53 +00:00
parent 4d4ba5c5b4
commit 020aec5318
57 changed files with 4376 additions and 219 deletions

View File

@ -138,6 +138,11 @@
return false;
}
// Does the CPU supports vector constant rotate instructions?
static constexpr bool supports_vector_constant_rotates(int shift) {
return false;
}
// Does the CPU supports vector unsigned comparison instructions?
static const bool supports_vector_comparison_unsigned(int vlen, BasicType bt) {
// Not supported on SVE yet.

View File

@ -131,6 +131,11 @@
return false; // not supported
}
// Does the CPU supports vector constant rotate instructions?
static constexpr bool supports_vector_constant_rotates(int shift) {
return false;
}
// Does the CPU supports vector unsigned comparison instructions?
static constexpr bool supports_vector_comparison_unsigned(int vlen, BasicType bt) {
return false;

View File

@ -138,6 +138,11 @@
return false;
}
// Does the CPU supports vector constant rotate instructions?
static constexpr bool supports_vector_constant_rotates(int shift) {
return false;
}
// Does the CPU supports vector unsigned comparison instructions?
static constexpr bool supports_vector_comparison_unsigned(int vlen, BasicType bt) {
return false;

View File

@ -128,6 +128,11 @@
return false;
}
// Does the CPU supports vector constant rotate instructions?
static constexpr bool supports_vector_constant_rotates(int shift) {
return false;
}
// Does the CPU supports vector unsigned comparison instructions?
static constexpr bool supports_vector_comparison_unsigned(int vlen, BasicType bt) {
return false;

View File

@ -158,6 +158,11 @@
return true;
}
// Does the CPU supports vector constant rotate instructions?
static constexpr bool supports_vector_constant_rotates(int shift) {
return -0x80 <= shift && shift < 0x80;
}
// Does the CPU supports vector unsigned comparison instructions?
static const bool supports_vector_comparison_unsigned(int vlen, BasicType bt) {
int vlen_in_bytes = vlen * type2aelembytes(bt);

View File

@ -1638,6 +1638,9 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType
break;
case Op_RotateRightV:
case Op_RotateLeftV:
if (bt != T_INT && bt != T_LONG) {
return false;
} // fallthrough
case Op_MacroLogicV:
if (!VM_Version::supports_evex() ||
((size_in_bits != 512) && !VM_Version::supports_avx512vl())) {

View File

@ -336,6 +336,7 @@ class LibraryCallKit : public GraphKit {
};
bool arch_supports_vector(int op, int num_elem, BasicType type, VectorMaskUseType mask_use_type, bool has_scalar_args = false);
bool arch_supports_vector_rotate(int opc, int num_elem, BasicType elem_bt, bool has_scalar_args = false);
void clear_upper_avx() {
#ifdef X86

View File

@ -2489,7 +2489,7 @@ void SuperWord::output() {
Node* in1 = low_adr->in(1);
Node* in2 = p->at(0)->in(2);
// If rotation count is non-constant or greater than 8bit value create a vector.
if (!in2->is_Con() || -0x80 > in2->get_int() || in2->get_int() >= 0x80) {
if (!in2->is_Con() || !Matcher::supports_vector_constant_rotates(in2->get_int())) {
in2 = vector_opd(p, 2);
}
vn = VectorNode::make(opc, in1, in2, vlen, velt_basic_type(n));

View File

@ -59,6 +59,48 @@ static bool check_vbox(const TypeInstPtr* vbox_type) {
}
#endif
bool LibraryCallKit::arch_supports_vector_rotate(int opc, int num_elem, BasicType elem_bt, bool has_scalar_args) {
bool is_supported = true;
// has_scalar_args flag is true only for non-constant scalar shift count,
// since in this case shift needs to be broadcasted.
if (!Matcher::match_rule_supported_vector(opc, num_elem, elem_bt) ||
(has_scalar_args &&
!arch_supports_vector(VectorNode::replicate_opcode(elem_bt), num_elem, elem_bt, VecMaskNotUsed))) {
is_supported = false;
}
int lshiftopc, rshiftopc;
switch(elem_bt) {
case T_BYTE:
lshiftopc = Op_LShiftI;
rshiftopc = Op_URShiftB;
break;
case T_SHORT:
lshiftopc = Op_LShiftI;
rshiftopc = Op_URShiftS;
break;
case T_INT:
lshiftopc = Op_LShiftI;
rshiftopc = Op_URShiftI;
break;
case T_LONG:
lshiftopc = Op_LShiftL;
rshiftopc = Op_URShiftL;
break;
default:
assert(false, "Unexpected type");
}
int lshiftvopc = VectorNode::opcode(lshiftopc, elem_bt);
int rshiftvopc = VectorNode::opcode(rshiftopc, elem_bt);
if (!is_supported &&
arch_supports_vector(lshiftvopc, num_elem, elem_bt, VecMaskNotUsed, has_scalar_args) &&
arch_supports_vector(rshiftvopc, num_elem, elem_bt, VecMaskNotUsed, has_scalar_args) &&
arch_supports_vector(Op_OrV, num_elem, elem_bt, VecMaskNotUsed)) {
is_supported = true;
}
return is_supported;
}
Node* GraphKit::box_vector(Node* vector, const TypeInstPtr* vbox_type, BasicType elem_bt, int num_elem, bool deoptimize_on_exception) {
assert(EnableVectorSupport, "");
@ -112,17 +154,29 @@ bool LibraryCallKit::arch_supports_vector(int sopc, int num_elem, BasicType type
return false;
}
// Check that architecture supports this op-size-type combination.
if (!Matcher::match_rule_supported_vector(sopc, num_elem, type)) {
if (VectorNode::is_vector_rotate(sopc)) {
if(!arch_supports_vector_rotate(sopc, num_elem, type, has_scalar_args)) {
#ifndef PRODUCT
if (C->print_intrinsics()) {
tty->print_cr(" ** Rejected vector op (%s,%s,%d) because architecture does not support it",
NodeClassNames[sopc], type2name(type), num_elem);
}
if (C->print_intrinsics()) {
tty->print_cr(" ** Rejected vector op (%s,%s,%d) because architecture does not support variable vector shifts",
NodeClassNames[sopc], type2name(type), num_elem);
}
#endif
return false;
return false;
}
} else {
assert(Matcher::match_rule_supported(sopc), "must be supported");
// Check that architecture supports this op-size-type combination.
if (!Matcher::match_rule_supported_vector(sopc, num_elem, type)) {
#ifndef PRODUCT
if (C->print_intrinsics()) {
tty->print_cr(" ** Rejected vector op (%s,%s,%d) because architecture does not support it",
NodeClassNames[sopc], type2name(type), num_elem);
}
#endif
return false;
} else {
assert(Matcher::match_rule_supported(sopc), "must be supported");
}
}
if (num_elem == 1) {
@ -1500,7 +1554,9 @@ bool LibraryCallKit::inline_vector_broadcast_int() {
BasicType elem_bt = elem_type->basic_type();
int num_elem = vlen->get_con();
int opc = VectorSupport::vop2ideal(opr->get_con(), elem_bt);
if (opc == 0 || !VectorNode::is_shift_opcode(opc)) {
bool is_shift = VectorNode::is_shift_opcode(opc);
bool is_rotate = VectorNode::is_rotate_opcode(opc);
if (opc == 0 || (!is_shift && !is_rotate)) {
if (C->print_intrinsics()) {
tty->print_cr(" ** operation not supported: op=%d bt=%s", opr->get_con(), type2name(elem_bt));
}
@ -1513,10 +1569,16 @@ bool LibraryCallKit::inline_vector_broadcast_int() {
}
return false; // operation not supported
}
Node* cnt = argument(5);
ciKlass* vbox_klass = vector_klass->const_oop()->as_instance()->java_lang_Class_klass();
const TypeInstPtr* vbox_type = TypeInstPtr::make_exact(TypePtr::NotNull, vbox_klass);
const TypeInt* cnt_type = cnt->bottom_type()->isa_int();
if (!arch_supports_vector(sopc, num_elem, elem_bt, VecMaskNotUsed, true /*has_scalar_args*/)) {
// If CPU supports vector constant rotate instructions pass it directly
bool is_const_rotate = is_rotate && cnt_type && cnt_type->is_con() &&
Matcher::supports_vector_constant_rotates(cnt_type->get_con());
bool has_scalar_args = is_rotate ? !is_const_rotate : true;
if (!arch_supports_vector(sopc, num_elem, elem_bt, VecMaskNotUsed, has_scalar_args)) {
if (C->print_intrinsics()) {
tty->print_cr(" ** not supported: arity=0 op=int/%d vlen=%d etype=%s ismask=no",
sopc, num_elem, type2name(elem_bt));
@ -1524,7 +1586,20 @@ bool LibraryCallKit::inline_vector_broadcast_int() {
return false; // not supported
}
Node* opd1 = unbox_vector(argument(4), vbox_type, elem_bt, num_elem);
Node* opd2 = vector_shift_count(argument(5), opc, elem_bt, num_elem);
Node* opd2 = NULL;
if (is_shift) {
opd2 = vector_shift_count(cnt, opc, elem_bt, num_elem);
} else {
assert(is_rotate, "unexpected operation");
if (!is_const_rotate) {
const Type * type_bt = Type::get_const_basic_type(elem_bt);
cnt = elem_bt == T_LONG ? gvn().transform(new ConvI2LNode(cnt)) : cnt;
opd2 = gvn().transform(VectorNode::scalar2vector(cnt, num_elem, type_bt));
} else {
// Constant shift value.
opd2 = cnt;
}
}
if (opd1 == NULL || opd2 == NULL) {
return false;
}

View File

@ -143,9 +143,9 @@ int VectorNode::opcode(int sopc, BasicType bt) {
case Op_RoundDoubleMode:
return (bt == T_DOUBLE ? Op_RoundDoubleModeV : 0);
case Op_RotateLeft:
return (bt == T_LONG || bt == T_INT ? Op_RotateLeftV : 0);
return (is_integral_type(bt) ? Op_RotateLeftV : 0);
case Op_RotateRight:
return (bt == T_LONG || bt == T_INT ? Op_RotateRightV : 0);
return (is_integral_type(bt) ? Op_RotateRightV : 0);
case Op_SqrtF:
return (bt == T_FLOAT ? Op_SqrtVF : 0);
case Op_SqrtD:
@ -262,7 +262,7 @@ bool VectorNode::implemented(int opc, uint vlen, BasicType bt) {
// For rotate operation we will do a lazy de-generation into
// OrV/LShiftV/URShiftV pattern if the target does not support
// vector rotation instruction.
if (vopc == Op_RotateLeftV || vopc == Op_RotateRightV) {
if (VectorNode::is_vector_rotate(vopc)) {
return is_vector_rotate_supported(vopc, vlen, bt);
}
return vopc > 0 && Matcher::match_rule_supported_vector(vopc, vlen, bt);
@ -296,15 +296,8 @@ bool VectorNode::is_roundopD(Node* n) {
return false;
}
bool VectorNode::is_scalar_rotate(Node* n) {
if (n->Opcode() == Op_RotateLeft || n->Opcode() == Op_RotateRight) {
return true;
}
return false;
}
bool VectorNode::is_vector_rotate_supported(int vopc, uint vlen, BasicType bt) {
assert(vopc == Op_RotateLeftV || vopc == Op_RotateRightV, "wrong opcode");
assert(VectorNode::is_vector_rotate(vopc), "wrong opcode");
// If target defines vector rotation patterns then no
// need for degeneration.
@ -356,6 +349,23 @@ bool VectorNode::is_shift(Node* n) {
return is_shift_opcode(n->Opcode());
}
bool VectorNode::is_rotate_opcode(int opc) {
switch (opc) {
case Op_RotateRight:
case Op_RotateLeft:
return true;
default:
return false;
}
}
bool VectorNode::is_scalar_rotate(Node* n) {
if (is_rotate_opcode(n->Opcode())) {
return true;
}
return false;
}
bool VectorNode::is_vshift_cnt(Node* n) {
switch (n->Opcode()) {
case Op_LShiftCntV:
@ -587,6 +597,16 @@ VectorNode* VectorNode::shift_count(int opc, Node* cnt, uint vlen, BasicType bt)
}
}
bool VectorNode::is_vector_rotate(int opc) {
switch (opc) {
case Op_RotateLeftV:
case Op_RotateRightV:
return true;
default:
return false;
}
}
bool VectorNode::is_vector_shift(int opc) {
assert(opc > _last_machine_leaf && opc < _last_opcode, "invalid opcode");
switch (opc) {
@ -1140,12 +1160,21 @@ MacroLogicVNode* MacroLogicVNode::make(PhaseGVN& gvn, Node* in1, Node* in2, Node
Node* VectorNode::degenerate_vector_rotate(Node* src, Node* cnt, bool is_rotate_left,
int vlen, BasicType bt, PhaseGVN* phase) {
assert(bt == T_INT || bt == T_LONG, "sanity");
assert(is_integral_type(bt), "sanity");
const TypeVect* vt = TypeVect::make(bt, vlen);
int shift_mask = (bt == T_INT) ? 0x1F : 0x3F;
int shiftLOpc = (bt == T_INT) ? Op_LShiftI : Op_LShiftL;
int shiftROpc = (bt == T_INT) ? Op_URShiftI: Op_URShiftL;
int shift_mask = (type2aelembytes(bt) * 8) - 1;
int shiftLOpc = (bt == T_LONG) ? Op_LShiftL : Op_LShiftI;
auto urshiftopc = [=]() {
switch(bt) {
case T_INT: return Op_URShiftI;
case T_LONG: return Op_URShiftL;
case T_BYTE: return Op_URShiftB;
case T_SHORT: return Op_URShiftS;
default: return (Opcodes)0;
}
};
int shiftROpc = urshiftopc();
// Compute shift values for right rotation and
// later swap them in case of left rotation.
@ -1174,19 +1203,28 @@ Node* VectorNode::degenerate_vector_rotate(Node* src, Node* cnt, bool is_rotate_
shiftRCnt = phase->transform(new AndINode(cnt, phase->intcon(shift_mask)));
shiftLCnt = phase->transform(new SubINode(phase->intcon(shift_mask + 1), shiftRCnt));
} else {
// Vector variable shift.
// Variable vector rotate count.
assert(Matcher::supports_vector_variable_shifts(), "");
assert(bt == T_INT, "Variable vector case supported for integer type rotation");
int subVopc = 0;
int addVopc = 0;
Node* shift_mask_node = NULL;
Node* const_one_node = NULL;
assert(cnt->bottom_type()->isa_vect(), "Unexpected shift");
const Type* elem_ty = Type::get_const_basic_type(bt);
Node* shift_mask_node = phase->intcon(shift_mask);
Node* const_one_node = phase->intcon(1);
int subVopc = VectorNode::opcode(Op_SubI, bt);
int addVopc = VectorNode::opcode(Op_AddI, bt);
if (bt == T_LONG) {
shift_mask_node = phase->longcon(shift_mask);
const_one_node = phase->longcon(1L);
subVopc = VectorNode::opcode(Op_SubL, bt);
addVopc = VectorNode::opcode(Op_AddL, bt);
} else {
shift_mask_node = phase->intcon(shift_mask);
const_one_node = phase->intcon(1);
subVopc = VectorNode::opcode(Op_SubI, bt);
addVopc = VectorNode::opcode(Op_AddI, bt);
}
Node* vector_mask = phase->transform(VectorNode::scalar2vector(shift_mask_node, vlen, elem_ty));
Node* vector_one = phase->transform(VectorNode::scalar2vector(const_one_node, vlen, elem_ty));

View File

@ -76,6 +76,7 @@ class VectorNode : public TypeNode {
static VectorNode* make(int vopc, Node* n1, Node* n2, Node* n3, const TypeVect* vt);
static bool is_shift_opcode(int opc);
static bool is_rotate_opcode(int opc);
static int opcode(int opc, BasicType bt);
static int replicate_opcode(BasicType bt);
@ -87,7 +88,7 @@ class VectorNode : public TypeNode {
static bool is_muladds2i(Node* n);
static bool is_roundopD(Node* n);
static bool is_scalar_rotate(Node* n);
static bool is_vector_rotate_supported(int vopc, uint vlen, BasicType bt);
static bool is_vector_rotate_supported(int opc, uint vlen, BasicType bt);
static bool is_invariant_vector(Node* n);
static bool is_all_ones_vector(Node* n);
static bool is_vector_bitwise_not_pattern(Node* n);
@ -99,6 +100,7 @@ class VectorNode : public TypeNode {
static bool is_vector_shift(int opc);
static bool is_vector_shift_count(int opc);
static bool is_vector_rotate(int opc);
static bool is_vector_shift(Node* n) {
return is_vector_shift(n->Opcode());

View File

@ -374,6 +374,26 @@ int VectorSupport::vop2ideal(jint id, BasicType bt) {
}
break;
}
case VECTOR_OP_LROTATE: {
switch (bt) {
case T_BYTE: // fall-through
case T_SHORT: // fall-through
case T_INT: // fall-through
case T_LONG: return Op_RotateLeft;
default: fatal("LROTATE: %s", type2name(bt));
}
break;
}
case VECTOR_OP_RROTATE: {
switch (bt) {
case T_BYTE: // fall-through
case T_SHORT: // fall-through
case T_INT: // fall-through
case T_LONG: return Op_RotateRight;
default: fatal("RROTATE: %s", type2name(bt));
}
break;
}
case VECTOR_OP_MASK_LASTTRUE: {
switch (bt) {
case T_BYTE: // fall-through

View File

@ -83,6 +83,10 @@ class VectorSupport : AllStatic {
VECTOR_OP_MASK_FIRSTTRUE = 20,
VECTOR_OP_MASK_LASTTRUE = 21,
// Rotate operations
VECTOR_OP_LROTATE = 22,
VECTOR_OP_RROTATE = 23,
// Vector Math Library
VECTOR_OP_TAN = 101,
VECTOR_OP_TANH = 102,

View File

@ -70,6 +70,10 @@ public class VectorSupport {
public static final int VECTOR_OP_MASK_FIRSTTRUE = 20;
public static final int VECTOR_OP_MASK_LASTTRUE = 21;
// Rotate operations
public static final int VECTOR_OP_LROTATE = 22;
public static final int VECTOR_OP_RROTATE = 23;
// Math routines
public static final int VECTOR_OP_TAN = 101;
public static final int VECTOR_OP_TANH = 102;

View File

@ -380,6 +380,18 @@ public abstract class ByteVector extends AbstractVector<Byte> {
return maskFactory(bits);
}
/*package-private*/
@ForceInline
static byte rotateLeft(byte a, int n) {
return (byte)(((((byte)a) & Byte.toUnsignedInt((byte)-1)) << (n & Byte.SIZE-1)) | ((((byte)a) & Byte.toUnsignedInt((byte)-1)) >>> (Byte.SIZE - (n & Byte.SIZE-1))));
}
/*package-private*/
@ForceInline
static byte rotateRight(byte a, int n) {
return (byte)(((((byte)a) & Byte.toUnsignedInt((byte)-1)) >>> (n & Byte.SIZE-1)) | ((((byte)a) & Byte.toUnsignedInt((byte)-1)) << (Byte.SIZE - (n & Byte.SIZE-1))));
}
/*package-private*/
@Override
abstract ByteSpecies vspecies();
@ -600,12 +612,7 @@ public abstract class ByteVector extends AbstractVector<Byte> {
// This allows the JIT to ignore some ISA details.
that = that.lanewise(AND, SHIFT_MASK);
}
if (op == ROR || op == ROL) { // FIXME: JIT should do this
ByteVector neg = that.lanewise(NEG);
ByteVector hi = this.lanewise(LSHL, (op == ROR) ? neg : that);
ByteVector lo = this.lanewise(LSHR, (op == ROR) ? that : neg);
return hi.lanewise(OR, lo);
} else if (op == AND_NOT) {
if (op == AND_NOT) {
// FIXME: Support this in the JIT.
that = that.lanewise(NOT);
op = AND;
@ -646,6 +653,10 @@ public abstract class ByteVector extends AbstractVector<Byte> {
v0.bOp(v1, (i, a, n) -> (byte)(a >> n));
case VECTOR_OP_URSHIFT: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> (byte)((a & LSHR_SETUP_MASK) >>> n));
case VECTOR_OP_LROTATE: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> rotateLeft(a, (int)n));
case VECTOR_OP_RROTATE: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> rotateRight(a, (int)n));
default: return null;
}}));
}
@ -792,11 +803,6 @@ public abstract class ByteVector extends AbstractVector<Byte> {
assert(opKind(op, VO_SHIFT));
// As per shift specification for Java, mask the shift count.
e &= SHIFT_MASK;
if (op == ROR || op == ROL) { // FIXME: JIT should do this
ByteVector hi = this.lanewise(LSHL, (op == ROR) ? -e : e);
ByteVector lo = this.lanewise(LSHR, (op == ROR) ? e : -e);
return hi.lanewise(OR, lo);
}
int opc = opCode(op);
return VectorSupport.broadcastInt(
opc, getClass(), byte.class, length(),
@ -809,6 +815,10 @@ public abstract class ByteVector extends AbstractVector<Byte> {
v.uOp((i, a) -> (byte)(a >> n));
case VECTOR_OP_URSHIFT: return (v, n) ->
v.uOp((i, a) -> (byte)((a & LSHR_SETUP_MASK) >>> n));
case VECTOR_OP_LROTATE: return (v, n) ->
v.uOp((i, a) -> rotateLeft(a, (int)n));
case VECTOR_OP_RROTATE: return (v, n) ->
v.uOp((i, a) -> rotateRight(a, (int)n));
default: return null;
}}));
}

View File

@ -380,6 +380,7 @@ public abstract class DoubleVector extends AbstractVector<Double> {
return maskFactory(bits);
}
/*package-private*/
@Override
abstract DoubleSpecies vspecies();

View File

@ -380,6 +380,7 @@ public abstract class FloatVector extends AbstractVector<Float> {
return maskFactory(bits);
}
/*package-private*/
@Override
abstract FloatSpecies vspecies();

View File

@ -380,6 +380,18 @@ public abstract class IntVector extends AbstractVector<Integer> {
return maskFactory(bits);
}
/*package-private*/
@ForceInline
static int rotateLeft(int a, int n) {
return Integer.rotateLeft(a, n);
}
/*package-private*/
@ForceInline
static int rotateRight(int a, int n) {
return Integer.rotateRight(a, n);
}
/*package-private*/
@Override
abstract IntSpecies vspecies();
@ -600,12 +612,7 @@ public abstract class IntVector extends AbstractVector<Integer> {
// This allows the JIT to ignore some ISA details.
that = that.lanewise(AND, SHIFT_MASK);
}
if (op == ROR || op == ROL) { // FIXME: JIT should do this
IntVector neg = that.lanewise(NEG);
IntVector hi = this.lanewise(LSHL, (op == ROR) ? neg : that);
IntVector lo = this.lanewise(LSHR, (op == ROR) ? that : neg);
return hi.lanewise(OR, lo);
} else if (op == AND_NOT) {
if (op == AND_NOT) {
// FIXME: Support this in the JIT.
that = that.lanewise(NOT);
op = AND;
@ -646,6 +653,10 @@ public abstract class IntVector extends AbstractVector<Integer> {
v0.bOp(v1, (i, a, n) -> (int)(a >> n));
case VECTOR_OP_URSHIFT: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> (int)((a & LSHR_SETUP_MASK) >>> n));
case VECTOR_OP_LROTATE: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> rotateLeft(a, (int)n));
case VECTOR_OP_RROTATE: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> rotateRight(a, (int)n));
default: return null;
}}));
}
@ -792,11 +803,6 @@ public abstract class IntVector extends AbstractVector<Integer> {
assert(opKind(op, VO_SHIFT));
// As per shift specification for Java, mask the shift count.
e &= SHIFT_MASK;
if (op == ROR || op == ROL) { // FIXME: JIT should do this
IntVector hi = this.lanewise(LSHL, (op == ROR) ? -e : e);
IntVector lo = this.lanewise(LSHR, (op == ROR) ? e : -e);
return hi.lanewise(OR, lo);
}
int opc = opCode(op);
return VectorSupport.broadcastInt(
opc, getClass(), int.class, length(),
@ -809,6 +815,10 @@ public abstract class IntVector extends AbstractVector<Integer> {
v.uOp((i, a) -> (int)(a >> n));
case VECTOR_OP_URSHIFT: return (v, n) ->
v.uOp((i, a) -> (int)((a & LSHR_SETUP_MASK) >>> n));
case VECTOR_OP_LROTATE: return (v, n) ->
v.uOp((i, a) -> rotateLeft(a, (int)n));
case VECTOR_OP_RROTATE: return (v, n) ->
v.uOp((i, a) -> rotateRight(a, (int)n));
default: return null;
}}));
}

View File

@ -380,6 +380,18 @@ public abstract class LongVector extends AbstractVector<Long> {
return maskFactory(bits);
}
/*package-private*/
@ForceInline
static long rotateLeft(long a, int n) {
return Long.rotateLeft(a, n);
}
/*package-private*/
@ForceInline
static long rotateRight(long a, int n) {
return Long.rotateRight(a, n);
}
/*package-private*/
@Override
abstract LongSpecies vspecies();
@ -558,12 +570,7 @@ public abstract class LongVector extends AbstractVector<Long> {
// This allows the JIT to ignore some ISA details.
that = that.lanewise(AND, SHIFT_MASK);
}
if (op == ROR || op == ROL) { // FIXME: JIT should do this
LongVector neg = that.lanewise(NEG);
LongVector hi = this.lanewise(LSHL, (op == ROR) ? neg : that);
LongVector lo = this.lanewise(LSHR, (op == ROR) ? that : neg);
return hi.lanewise(OR, lo);
} else if (op == AND_NOT) {
if (op == AND_NOT) {
// FIXME: Support this in the JIT.
that = that.lanewise(NOT);
op = AND;
@ -604,6 +611,10 @@ public abstract class LongVector extends AbstractVector<Long> {
v0.bOp(v1, (i, a, n) -> (long)(a >> n));
case VECTOR_OP_URSHIFT: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> (long)((a & LSHR_SETUP_MASK) >>> n));
case VECTOR_OP_LROTATE: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> rotateLeft(a, (int)n));
case VECTOR_OP_RROTATE: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> rotateRight(a, (int)n));
default: return null;
}}));
}
@ -710,11 +721,6 @@ public abstract class LongVector extends AbstractVector<Long> {
assert(opKind(op, VO_SHIFT));
// As per shift specification for Java, mask the shift count.
e &= SHIFT_MASK;
if (op == ROR || op == ROL) { // FIXME: JIT should do this
LongVector hi = this.lanewise(LSHL, (op == ROR) ? -e : e);
LongVector lo = this.lanewise(LSHR, (op == ROR) ? e : -e);
return hi.lanewise(OR, lo);
}
int opc = opCode(op);
return VectorSupport.broadcastInt(
opc, getClass(), long.class, length(),
@ -727,6 +733,10 @@ public abstract class LongVector extends AbstractVector<Long> {
v.uOp((i, a) -> (long)(a >> n));
case VECTOR_OP_URSHIFT: return (v, n) ->
v.uOp((i, a) -> (long)((a & LSHR_SETUP_MASK) >>> n));
case VECTOR_OP_LROTATE: return (v, n) ->
v.uOp((i, a) -> rotateLeft(a, (int)n));
case VECTOR_OP_RROTATE: return (v, n) ->
v.uOp((i, a) -> rotateRight(a, (int)n));
default: return null;
}}));
}

View File

@ -380,6 +380,18 @@ public abstract class ShortVector extends AbstractVector<Short> {
return maskFactory(bits);
}
/*package-private*/
@ForceInline
static short rotateLeft(short a, int n) {
return (short)(((((short)a) & Short.toUnsignedInt((short)-1)) << (n & Short.SIZE-1)) | ((((short)a) & Short.toUnsignedInt((short)-1)) >>> (Short.SIZE - (n & Short.SIZE-1))));
}
/*package-private*/
@ForceInline
static short rotateRight(short a, int n) {
return (short)(((((short)a) & Short.toUnsignedInt((short)-1)) >>> (n & Short.SIZE-1)) | ((((short)a) & Short.toUnsignedInt((short)-1)) << (Short.SIZE - (n & Short.SIZE-1))));
}
/*package-private*/
@Override
abstract ShortSpecies vspecies();
@ -600,12 +612,7 @@ public abstract class ShortVector extends AbstractVector<Short> {
// This allows the JIT to ignore some ISA details.
that = that.lanewise(AND, SHIFT_MASK);
}
if (op == ROR || op == ROL) { // FIXME: JIT should do this
ShortVector neg = that.lanewise(NEG);
ShortVector hi = this.lanewise(LSHL, (op == ROR) ? neg : that);
ShortVector lo = this.lanewise(LSHR, (op == ROR) ? that : neg);
return hi.lanewise(OR, lo);
} else if (op == AND_NOT) {
if (op == AND_NOT) {
// FIXME: Support this in the JIT.
that = that.lanewise(NOT);
op = AND;
@ -646,6 +653,10 @@ public abstract class ShortVector extends AbstractVector<Short> {
v0.bOp(v1, (i, a, n) -> (short)(a >> n));
case VECTOR_OP_URSHIFT: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> (short)((a & LSHR_SETUP_MASK) >>> n));
case VECTOR_OP_LROTATE: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> rotateLeft(a, (int)n));
case VECTOR_OP_RROTATE: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> rotateRight(a, (int)n));
default: return null;
}}));
}
@ -792,11 +803,6 @@ public abstract class ShortVector extends AbstractVector<Short> {
assert(opKind(op, VO_SHIFT));
// As per shift specification for Java, mask the shift count.
e &= SHIFT_MASK;
if (op == ROR || op == ROL) { // FIXME: JIT should do this
ShortVector hi = this.lanewise(LSHL, (op == ROR) ? -e : e);
ShortVector lo = this.lanewise(LSHR, (op == ROR) ? e : -e);
return hi.lanewise(OR, lo);
}
int opc = opCode(op);
return VectorSupport.broadcastInt(
opc, getClass(), short.class, length(),
@ -809,6 +815,10 @@ public abstract class ShortVector extends AbstractVector<Short> {
v.uOp((i, a) -> (short)(a >> n));
case VECTOR_OP_URSHIFT: return (v, n) ->
v.uOp((i, a) -> (short)((a & LSHR_SETUP_MASK) >>> n));
case VECTOR_OP_LROTATE: return (v, n) ->
v.uOp((i, a) -> rotateLeft(a, (int)n));
case VECTOR_OP_RROTATE: return (v, n) ->
v.uOp((i, a) -> rotateRight(a, (int)n));
default: return null;
}}));
}

View File

@ -551,9 +551,9 @@ public abstract class VectorOperators {
/** Produce {@code a>>>(n&(ESIZE*8-1))}. Integral only. */
public static final /*bitwise*/ Binary LSHR = binary("LSHR", ">>>", VectorSupport.VECTOR_OP_URSHIFT, VO_SHIFT);
/** Produce {@code rotateLeft(a,n)}. Integral only. */
public static final /*bitwise*/ Binary ROL = binary("ROL", "rotateLeft", -1 /*VectorSupport.VECTOR_OP_LROTATE*/, VO_SHIFT | VO_SPECIAL);
public static final /*bitwise*/ Binary ROL = binary("ROL", "rotateLeft", VectorSupport.VECTOR_OP_LROTATE, VO_SHIFT);
/** Produce {@code rotateRight(a,n)}. Integral only. */
public static final /*bitwise*/ Binary ROR = binary("ROR", "rotateRight", -1 /*VectorSupport.VECTOR_OP_RROTATE*/, VO_SHIFT | VO_SPECIAL);
public static final /*bitwise*/ Binary ROR = binary("ROR", "rotateRight", VectorSupport.VECTOR_OP_RROTATE, VO_SHIFT);
/** Produce {@code atan2(a,b)}. See Floating only.
* Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above

View File

@ -384,6 +384,28 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
return maskFactory(bits);
}
#if[BITWISE]
/*package-private*/
@ForceInline
static $type$ rotateLeft($type$ a, int n) {
#if[intOrLong]
return $Boxtype$.rotateLeft(a, n);
#else[intOrLong]
return ($type$)((((($type$)a) & $Boxtype$.toUnsignedInt(($type$)-1)) << (n & $Boxtype$.SIZE-1)) | (((($type$)a) & $Boxtype$.toUnsignedInt(($type$)-1)) >>> ($Boxtype$.SIZE - (n & $Boxtype$.SIZE-1))));
#end[intOrLong]
}
/*package-private*/
@ForceInline
static $type$ rotateRight($type$ a, int n) {
#if[intOrLong]
return $Boxtype$.rotateRight(a, n);
#else[intOrLong]
return ($type$)((((($type$)a) & $Boxtype$.toUnsignedInt(($type$)-1)) >>> (n & $Boxtype$.SIZE-1)) | (((($type$)a) & $Boxtype$.toUnsignedInt(($type$)-1)) << ($Boxtype$.SIZE - (n & $Boxtype$.SIZE-1))));
#end[intOrLong]
}
#end[BITWISE]
/*package-private*/
@Override
abstract $Type$Species vspecies();
@ -657,12 +679,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
that = that.lanewise(AND, SHIFT_MASK);
}
#end[!FP]
if (op == ROR || op == ROL) { // FIXME: JIT should do this
$abstractvectortype$ neg = that.lanewise(NEG);
$abstractvectortype$ hi = this.lanewise(LSHL, (op == ROR) ? neg : that);
$abstractvectortype$ lo = this.lanewise(LSHR, (op == ROR) ? that : neg);
return hi.lanewise(OR, lo);
} else if (op == AND_NOT) {
if (op == AND_NOT) {
// FIXME: Support this in the JIT.
that = that.lanewise(NOT);
op = AND;
@ -705,6 +722,10 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
v0.bOp(v1, (i, a, n) -> ($type$)(a >> n));
case VECTOR_OP_URSHIFT: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> ($type$)((a & LSHR_SETUP_MASK) >>> n));
case VECTOR_OP_LROTATE: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> rotateLeft(a, (int)n));
case VECTOR_OP_RROTATE: return (v0, v1) ->
v0.bOp(v1, (i, a, n) -> rotateRight(a, (int)n));
#end[BITWISE]
#if[FP]
case VECTOR_OP_ATAN2: return (v0, v1) ->
@ -869,11 +890,6 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
assert(opKind(op, VO_SHIFT));
// As per shift specification for Java, mask the shift count.
e &= SHIFT_MASK;
if (op == ROR || op == ROL) { // FIXME: JIT should do this
$abstractvectortype$ hi = this.lanewise(LSHL, (op == ROR) ? -e : e);
$abstractvectortype$ lo = this.lanewise(LSHR, (op == ROR) ? e : -e);
return hi.lanewise(OR, lo);
}
int opc = opCode(op);
return VectorSupport.broadcastInt(
opc, getClass(), $type$.class, length(),
@ -886,6 +902,10 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
v.uOp((i, a) -> ($type$)(a >> n));
case VECTOR_OP_URSHIFT: return (v, n) ->
v.uOp((i, a) -> ($type$)((a & LSHR_SETUP_MASK) >>> n));
case VECTOR_OP_LROTATE: return (v, n) ->
v.uOp((i, a) -> rotateLeft(a, (int)n));
case VECTOR_OP_RROTATE: return (v, n) ->
v.uOp((i, a) -> rotateRight(a, (int)n));
default: return null;
}}));
}

View File

@ -1153,6 +1153,14 @@ public class Byte128VectorTests extends AbstractVectorTest {
}
}
static byte ROL_scalar(byte a, byte b) {
return (byte)(((((byte)a) & 0xFF) << (b & 7)) | ((((byte)a) & 0xFF) >>> (8 - (b & 7))));
}
static byte ROR_scalar(byte a, byte b) {
return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
}
static boolean eq(byte a, byte b) {
return a == b;
}
@ -2322,7 +2330,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void LSHLByte128VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void LSHLByte128VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2340,7 +2348,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void LSHLByte128VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void LSHLByte128VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2368,7 +2376,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void LSHRByte128VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void LSHRByte128VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2386,7 +2394,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void LSHRByte128VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void LSHRByte128VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2414,7 +2422,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ASHRByte128VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void ASHRByte128VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2432,7 +2440,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ASHRByte128VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void ASHRByte128VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2452,6 +2460,178 @@ public class Byte128VectorTests extends AbstractVectorTest {
static byte ROR(byte a, byte b) {
return (byte)(ROR_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void RORByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Byte128VectorTests::ROR);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void RORByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Byte128VectorTests::ROR);
}
static byte ROL(byte a, byte b) {
return (byte)(ROL_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ROLByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Byte128VectorTests::ROL);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ROLByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Byte128VectorTests::ROL);
}
static byte ROR_unary(byte a, byte b) {
return (byte)(ROR_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void RORByte128VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Byte128VectorTests::ROR_unary);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void RORByte128VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Byte128VectorTests::ROR_unary);
}
static byte ROL_unary(byte a, byte b) {
return (byte)(ROL_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ROLByte128VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Byte128VectorTests::ROL_unary);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ROLByte128VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Byte128VectorTests::ROL_unary);
}
static byte MIN(byte a, byte b) {
return (byte)(Math.min(a, b));
}

View File

@ -1153,6 +1153,14 @@ public class Byte256VectorTests extends AbstractVectorTest {
}
}
static byte ROL_scalar(byte a, byte b) {
return (byte)(((((byte)a) & 0xFF) << (b & 7)) | ((((byte)a) & 0xFF) >>> (8 - (b & 7))));
}
static byte ROR_scalar(byte a, byte b) {
return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
}
static boolean eq(byte a, byte b) {
return a == b;
}
@ -2322,7 +2330,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void LSHLByte256VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void LSHLByte256VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2340,7 +2348,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void LSHLByte256VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void LSHLByte256VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2368,7 +2376,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void LSHRByte256VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void LSHRByte256VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2386,7 +2394,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void LSHRByte256VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void LSHRByte256VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2414,7 +2422,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ASHRByte256VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void ASHRByte256VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2432,7 +2440,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ASHRByte256VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void ASHRByte256VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2452,6 +2460,178 @@ public class Byte256VectorTests extends AbstractVectorTest {
static byte ROR(byte a, byte b) {
return (byte)(ROR_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void RORByte256VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Byte256VectorTests::ROR);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void RORByte256VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Byte256VectorTests::ROR);
}
static byte ROL(byte a, byte b) {
return (byte)(ROL_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ROLByte256VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Byte256VectorTests::ROL);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ROLByte256VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Byte256VectorTests::ROL);
}
static byte ROR_unary(byte a, byte b) {
return (byte)(ROR_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void RORByte256VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Byte256VectorTests::ROR_unary);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void RORByte256VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Byte256VectorTests::ROR_unary);
}
static byte ROL_unary(byte a, byte b) {
return (byte)(ROL_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ROLByte256VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Byte256VectorTests::ROL_unary);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ROLByte256VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Byte256VectorTests::ROL_unary);
}
static byte MIN(byte a, byte b) {
return (byte)(Math.min(a, b));
}

View File

@ -1153,6 +1153,14 @@ public class Byte512VectorTests extends AbstractVectorTest {
}
}
static byte ROL_scalar(byte a, byte b) {
return (byte)(((((byte)a) & 0xFF) << (b & 7)) | ((((byte)a) & 0xFF) >>> (8 - (b & 7))));
}
static byte ROR_scalar(byte a, byte b) {
return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
}
static boolean eq(byte a, byte b) {
return a == b;
}
@ -2322,7 +2330,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void LSHLByte512VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void LSHLByte512VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2340,7 +2348,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void LSHLByte512VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void LSHLByte512VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2368,7 +2376,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void LSHRByte512VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void LSHRByte512VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2386,7 +2394,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void LSHRByte512VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void LSHRByte512VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2414,7 +2422,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ASHRByte512VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void ASHRByte512VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2432,7 +2440,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ASHRByte512VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void ASHRByte512VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2452,6 +2460,178 @@ public class Byte512VectorTests extends AbstractVectorTest {
static byte ROR(byte a, byte b) {
return (byte)(ROR_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void RORByte512VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Byte512VectorTests::ROR);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void RORByte512VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Byte512VectorTests::ROR);
}
static byte ROL(byte a, byte b) {
return (byte)(ROL_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ROLByte512VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Byte512VectorTests::ROL);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ROLByte512VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Byte512VectorTests::ROL);
}
static byte ROR_unary(byte a, byte b) {
return (byte)(ROR_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void RORByte512VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Byte512VectorTests::ROR_unary);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void RORByte512VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Byte512VectorTests::ROR_unary);
}
static byte ROL_unary(byte a, byte b) {
return (byte)(ROL_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ROLByte512VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Byte512VectorTests::ROL_unary);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ROLByte512VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Byte512VectorTests::ROL_unary);
}
static byte MIN(byte a, byte b) {
return (byte)(Math.min(a, b));
}

View File

@ -1153,6 +1153,14 @@ public class Byte64VectorTests extends AbstractVectorTest {
}
}
static byte ROL_scalar(byte a, byte b) {
return (byte)(((((byte)a) & 0xFF) << (b & 7)) | ((((byte)a) & 0xFF) >>> (8 - (b & 7))));
}
static byte ROR_scalar(byte a, byte b) {
return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
}
static boolean eq(byte a, byte b) {
return a == b;
}
@ -2322,7 +2330,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void LSHLByte64VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void LSHLByte64VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2340,7 +2348,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void LSHLByte64VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void LSHLByte64VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2368,7 +2376,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void LSHRByte64VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void LSHRByte64VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2386,7 +2394,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void LSHRByte64VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void LSHRByte64VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2414,7 +2422,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ASHRByte64VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void ASHRByte64VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2432,7 +2440,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ASHRByte64VectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void ASHRByte64VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2452,6 +2460,178 @@ public class Byte64VectorTests extends AbstractVectorTest {
static byte ROR(byte a, byte b) {
return (byte)(ROR_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void RORByte64VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Byte64VectorTests::ROR);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void RORByte64VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Byte64VectorTests::ROR);
}
static byte ROL(byte a, byte b) {
return (byte)(ROL_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ROLByte64VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Byte64VectorTests::ROL);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ROLByte64VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Byte64VectorTests::ROL);
}
static byte ROR_unary(byte a, byte b) {
return (byte)(ROR_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void RORByte64VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Byte64VectorTests::ROR_unary);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void RORByte64VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Byte64VectorTests::ROR_unary);
}
static byte ROL_unary(byte a, byte b) {
return (byte)(ROL_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ROLByte64VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Byte64VectorTests::ROL_unary);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ROLByte64VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Byte64VectorTests::ROL_unary);
}
static byte MIN(byte a, byte b) {
return (byte)(Math.min(a, b));
}

View File

@ -1158,6 +1158,14 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
}
}
static byte ROL_scalar(byte a, byte b) {
return (byte)(((((byte)a) & 0xFF) << (b & 7)) | ((((byte)a) & 0xFF) >>> (8 - (b & 7))));
}
static byte ROR_scalar(byte a, byte b) {
return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
}
static boolean eq(byte a, byte b) {
return a == b;
}
@ -2327,7 +2335,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void LSHLByteMaxVectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void LSHLByteMaxVectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2345,7 +2353,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void LSHLByteMaxVectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void LSHLByteMaxVectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2373,7 +2381,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void LSHRByteMaxVectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void LSHRByteMaxVectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2391,7 +2399,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void LSHRByteMaxVectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void LSHRByteMaxVectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2419,7 +2427,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ASHRByteMaxVectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
static void ASHRByteMaxVectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
@ -2437,7 +2445,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ASHRByteMaxVectorTestsShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
static void ASHRByteMaxVectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
@ -2457,6 +2465,178 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
static byte ROR(byte a, byte b) {
return (byte)(ROR_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void RORByteMaxVectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, ByteMaxVectorTests::ROR);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void RORByteMaxVectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::ROR);
}
static byte ROL(byte a, byte b) {
return (byte)(ROL_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ROLByteMaxVectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, ByteMaxVectorTests::ROL);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ROLByteMaxVectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::ROL);
}
static byte ROR_unary(byte a, byte b) {
return (byte)(ROR_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void RORByteMaxVectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, ByteMaxVectorTests::ROR_unary);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void RORByteMaxVectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, ByteMaxVectorTests::ROR_unary);
}
static byte ROL_unary(byte a, byte b) {
return (byte)(ROL_scalar(a,b));
}
@Test(dataProvider = "byteBinaryOpProvider")
static void ROLByteMaxVectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, ByteMaxVectorTests::ROL_unary);
}
@Test(dataProvider = "byteBinaryOpMaskProvider")
static void ROLByteMaxVectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, ByteMaxVectorTests::ROL_unary);
}
static byte MIN(byte a, byte b) {
return (byte)(Math.min(a, b));
}

View File

@ -1943,6 +1943,14 @@ public class Double128VectorTests extends AbstractVectorTest {

View File

@ -1943,6 +1943,14 @@ public class Double256VectorTests extends AbstractVectorTest {

View File

@ -1943,6 +1943,14 @@ public class Double512VectorTests extends AbstractVectorTest {

View File

@ -1943,6 +1943,14 @@ public class Double64VectorTests extends AbstractVectorTest {

View File

@ -1948,6 +1948,14 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {

View File

@ -1953,6 +1953,14 @@ public class Float128VectorTests extends AbstractVectorTest {

View File

@ -1953,6 +1953,14 @@ public class Float256VectorTests extends AbstractVectorTest {

View File

@ -1953,6 +1953,14 @@ public class Float512VectorTests extends AbstractVectorTest {

View File

@ -1953,6 +1953,14 @@ public class Float64VectorTests extends AbstractVectorTest {

View File

@ -1958,6 +1958,14 @@ public class FloatMaxVectorTests extends AbstractVectorTest {

View File

@ -1113,6 +1113,14 @@ public class Int128VectorTests extends AbstractVectorTest {
}
}
static int ROL_scalar(int a, int b) {
return Integer.rotateLeft(a, ((int)b));
}
static int ROR_scalar(int a, int b) {
return Integer.rotateRight(a, ((int)b));
}
static boolean eq(int a, int b) {
return a == b;
}
@ -2285,7 +2293,7 @@ public class Int128VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void LSHLInt128VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void LSHLInt128VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2303,7 +2311,7 @@ public class Int128VectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void LSHLInt128VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void LSHLInt128VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2331,7 +2339,7 @@ public class Int128VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void LSHRInt128VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void LSHRInt128VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2349,7 +2357,7 @@ public class Int128VectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void LSHRInt128VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void LSHRInt128VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2377,7 +2385,7 @@ public class Int128VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void ASHRInt128VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void ASHRInt128VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2395,7 +2403,7 @@ public class Int128VectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ASHRInt128VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void ASHRInt128VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2417,6 +2425,178 @@ public class Int128VectorTests extends AbstractVectorTest {
static int ROR(int a, int b) {
return (int)(ROR_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void RORInt128VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Int128VectorTests::ROR);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void RORInt128VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Int128VectorTests::ROR);
}
static int ROL(int a, int b) {
return (int)(ROL_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void ROLInt128VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Int128VectorTests::ROL);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ROLInt128VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Int128VectorTests::ROL);
}
static int ROR_unary(int a, int b) {
return (int)(ROR_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void RORInt128VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Int128VectorTests::ROR_unary);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void RORInt128VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Int128VectorTests::ROR_unary);
}
static int ROL_unary(int a, int b) {
return (int)(ROL_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void ROLInt128VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Int128VectorTests::ROL_unary);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ROLInt128VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Int128VectorTests::ROL_unary);
}
static int MIN(int a, int b) {
return (int)(Math.min(a, b));
}

View File

@ -1113,6 +1113,14 @@ public class Int256VectorTests extends AbstractVectorTest {
}
}
static int ROL_scalar(int a, int b) {
return Integer.rotateLeft(a, ((int)b));
}
static int ROR_scalar(int a, int b) {
return Integer.rotateRight(a, ((int)b));
}
static boolean eq(int a, int b) {
return a == b;
}
@ -2285,7 +2293,7 @@ public class Int256VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void LSHLInt256VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void LSHLInt256VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2303,7 +2311,7 @@ public class Int256VectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void LSHLInt256VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void LSHLInt256VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2331,7 +2339,7 @@ public class Int256VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void LSHRInt256VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void LSHRInt256VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2349,7 +2357,7 @@ public class Int256VectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void LSHRInt256VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void LSHRInt256VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2377,7 +2385,7 @@ public class Int256VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void ASHRInt256VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void ASHRInt256VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2395,7 +2403,7 @@ public class Int256VectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ASHRInt256VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void ASHRInt256VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2417,6 +2425,178 @@ public class Int256VectorTests extends AbstractVectorTest {
static int ROR(int a, int b) {
return (int)(ROR_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void RORInt256VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Int256VectorTests::ROR);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void RORInt256VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Int256VectorTests::ROR);
}
static int ROL(int a, int b) {
return (int)(ROL_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void ROLInt256VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Int256VectorTests::ROL);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ROLInt256VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Int256VectorTests::ROL);
}
static int ROR_unary(int a, int b) {
return (int)(ROR_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void RORInt256VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Int256VectorTests::ROR_unary);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void RORInt256VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Int256VectorTests::ROR_unary);
}
static int ROL_unary(int a, int b) {
return (int)(ROL_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void ROLInt256VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Int256VectorTests::ROL_unary);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ROLInt256VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Int256VectorTests::ROL_unary);
}
static int MIN(int a, int b) {
return (int)(Math.min(a, b));
}

View File

@ -1113,6 +1113,14 @@ public class Int512VectorTests extends AbstractVectorTest {
}
}
static int ROL_scalar(int a, int b) {
return Integer.rotateLeft(a, ((int)b));
}
static int ROR_scalar(int a, int b) {
return Integer.rotateRight(a, ((int)b));
}
static boolean eq(int a, int b) {
return a == b;
}
@ -2285,7 +2293,7 @@ public class Int512VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void LSHLInt512VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void LSHLInt512VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2303,7 +2311,7 @@ public class Int512VectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void LSHLInt512VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void LSHLInt512VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2331,7 +2339,7 @@ public class Int512VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void LSHRInt512VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void LSHRInt512VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2349,7 +2357,7 @@ public class Int512VectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void LSHRInt512VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void LSHRInt512VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2377,7 +2385,7 @@ public class Int512VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void ASHRInt512VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void ASHRInt512VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2395,7 +2403,7 @@ public class Int512VectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ASHRInt512VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void ASHRInt512VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2417,6 +2425,178 @@ public class Int512VectorTests extends AbstractVectorTest {
static int ROR(int a, int b) {
return (int)(ROR_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void RORInt512VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Int512VectorTests::ROR);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void RORInt512VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Int512VectorTests::ROR);
}
static int ROL(int a, int b) {
return (int)(ROL_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void ROLInt512VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Int512VectorTests::ROL);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ROLInt512VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Int512VectorTests::ROL);
}
static int ROR_unary(int a, int b) {
return (int)(ROR_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void RORInt512VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Int512VectorTests::ROR_unary);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void RORInt512VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Int512VectorTests::ROR_unary);
}
static int ROL_unary(int a, int b) {
return (int)(ROL_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void ROLInt512VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Int512VectorTests::ROL_unary);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ROLInt512VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Int512VectorTests::ROL_unary);
}
static int MIN(int a, int b) {
return (int)(Math.min(a, b));
}

View File

@ -1113,6 +1113,14 @@ public class Int64VectorTests extends AbstractVectorTest {
}
}
static int ROL_scalar(int a, int b) {
return Integer.rotateLeft(a, ((int)b));
}
static int ROR_scalar(int a, int b) {
return Integer.rotateRight(a, ((int)b));
}
static boolean eq(int a, int b) {
return a == b;
}
@ -2285,7 +2293,7 @@ public class Int64VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void LSHLInt64VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void LSHLInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2303,7 +2311,7 @@ public class Int64VectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void LSHLInt64VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void LSHLInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2331,7 +2339,7 @@ public class Int64VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void LSHRInt64VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void LSHRInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2349,7 +2357,7 @@ public class Int64VectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void LSHRInt64VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void LSHRInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2377,7 +2385,7 @@ public class Int64VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void ASHRInt64VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void ASHRInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2395,7 +2403,7 @@ public class Int64VectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ASHRInt64VectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void ASHRInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2417,6 +2425,178 @@ public class Int64VectorTests extends AbstractVectorTest {
static int ROR(int a, int b) {
return (int)(ROR_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void RORInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Int64VectorTests::ROR);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void RORInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Int64VectorTests::ROR);
}
static int ROL(int a, int b) {
return (int)(ROL_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void ROLInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Int64VectorTests::ROL);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ROLInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Int64VectorTests::ROL);
}
static int ROR_unary(int a, int b) {
return (int)(ROR_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void RORInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Int64VectorTests::ROR_unary);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void RORInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::ROR_unary);
}
static int ROL_unary(int a, int b) {
return (int)(ROL_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void ROLInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Int64VectorTests::ROL_unary);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ROLInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::ROL_unary);
}
static int MIN(int a, int b) {
return (int)(Math.min(a, b));
}

View File

@ -1118,6 +1118,14 @@ public class IntMaxVectorTests extends AbstractVectorTest {
}
}
static int ROL_scalar(int a, int b) {
return Integer.rotateLeft(a, ((int)b));
}
static int ROR_scalar(int a, int b) {
return Integer.rotateRight(a, ((int)b));
}
static boolean eq(int a, int b) {
return a == b;
}
@ -2290,7 +2298,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void LSHLIntMaxVectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void LSHLIntMaxVectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2308,7 +2316,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void LSHLIntMaxVectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void LSHLIntMaxVectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2336,7 +2344,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void LSHRIntMaxVectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void LSHRIntMaxVectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2354,7 +2362,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void LSHRIntMaxVectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void LSHRIntMaxVectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2382,7 +2390,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "intBinaryOpProvider")
static void ASHRIntMaxVectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
static void ASHRIntMaxVectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
@ -2400,7 +2408,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ASHRIntMaxVectorTestsShift(IntFunction<int[]> fa, IntFunction<int[]> fb,
static void ASHRIntMaxVectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
@ -2422,6 +2430,178 @@ public class IntMaxVectorTests extends AbstractVectorTest {
static int ROR(int a, int b) {
return (int)(ROR_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void RORIntMaxVectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, IntMaxVectorTests::ROR);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void RORIntMaxVectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, IntMaxVectorTests::ROR);
}
static int ROL(int a, int b) {
return (int)(ROL_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void ROLIntMaxVectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, IntMaxVectorTests::ROL);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ROLIntMaxVectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
IntVector bv = IntVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, IntMaxVectorTests::ROL);
}
static int ROR_unary(int a, int b) {
return (int)(ROR_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void RORIntMaxVectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, IntMaxVectorTests::ROR_unary);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void RORIntMaxVectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, IntMaxVectorTests::ROR_unary);
}
static int ROL_unary(int a, int b) {
return (int)(ROL_scalar(a,b));
}
@Test(dataProvider = "intBinaryOpProvider")
static void ROLIntMaxVectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, IntMaxVectorTests::ROL_unary);
}
@Test(dataProvider = "intBinaryOpMaskProvider")
static void ROLIntMaxVectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
IntFunction<boolean[]> fm) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, IntMaxVectorTests::ROL_unary);
}
static int MIN(int a, int b) {
return (int)(Math.min(a, b));
}

View File

@ -1135,6 +1135,14 @@ public class Long128VectorTests extends AbstractVectorTest {
}
}
static long ROL_scalar(long a, long b) {
return Long.rotateLeft(a, ((int)b));
}
static long ROR_scalar(long a, long b) {
return Long.rotateRight(a, ((int)b));
}
static boolean eq(long a, long b) {
return a == b;
}
@ -2307,7 +2315,7 @@ public class Long128VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void LSHLLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void LSHLLong128VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2325,7 +2333,7 @@ public class Long128VectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHLLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void LSHLLong128VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2353,7 +2361,7 @@ public class Long128VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void LSHRLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void LSHRLong128VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2371,7 +2379,7 @@ public class Long128VectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHRLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void LSHRLong128VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2399,7 +2407,7 @@ public class Long128VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void ASHRLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void ASHRLong128VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2417,7 +2425,7 @@ public class Long128VectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ASHRLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void ASHRLong128VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2439,6 +2447,178 @@ public class Long128VectorTests extends AbstractVectorTest {
static long ROR(long a, long b) {
return (long)(ROR_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void RORLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Long128VectorTests::ROR);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void RORLong128VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Long128VectorTests::ROR);
}
static long ROL(long a, long b) {
return (long)(ROL_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void ROLLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Long128VectorTests::ROL);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ROLLong128VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Long128VectorTests::ROL);
}
static long ROR_unary(long a, long b) {
return (long)(ROR_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void RORLong128VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Long128VectorTests::ROR_unary);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void RORLong128VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Long128VectorTests::ROR_unary);
}
static long ROL_unary(long a, long b) {
return (long)(ROL_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void ROLLong128VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Long128VectorTests::ROL_unary);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ROLLong128VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Long128VectorTests::ROL_unary);
}
static long MIN(long a, long b) {
return (long)(Math.min(a, b));
}

View File

@ -1135,6 +1135,14 @@ public class Long256VectorTests extends AbstractVectorTest {
}
}
static long ROL_scalar(long a, long b) {
return Long.rotateLeft(a, ((int)b));
}
static long ROR_scalar(long a, long b) {
return Long.rotateRight(a, ((int)b));
}
static boolean eq(long a, long b) {
return a == b;
}
@ -2307,7 +2315,7 @@ public class Long256VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void LSHLLong256VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void LSHLLong256VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2325,7 +2333,7 @@ public class Long256VectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHLLong256VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void LSHLLong256VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2353,7 +2361,7 @@ public class Long256VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void LSHRLong256VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void LSHRLong256VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2371,7 +2379,7 @@ public class Long256VectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHRLong256VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void LSHRLong256VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2399,7 +2407,7 @@ public class Long256VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void ASHRLong256VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void ASHRLong256VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2417,7 +2425,7 @@ public class Long256VectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ASHRLong256VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void ASHRLong256VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2439,6 +2447,178 @@ public class Long256VectorTests extends AbstractVectorTest {
static long ROR(long a, long b) {
return (long)(ROR_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void RORLong256VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Long256VectorTests::ROR);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void RORLong256VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Long256VectorTests::ROR);
}
static long ROL(long a, long b) {
return (long)(ROL_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void ROLLong256VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Long256VectorTests::ROL);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ROLLong256VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Long256VectorTests::ROL);
}
static long ROR_unary(long a, long b) {
return (long)(ROR_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void RORLong256VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Long256VectorTests::ROR_unary);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void RORLong256VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Long256VectorTests::ROR_unary);
}
static long ROL_unary(long a, long b) {
return (long)(ROL_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void ROLLong256VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Long256VectorTests::ROL_unary);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ROLLong256VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Long256VectorTests::ROL_unary);
}
static long MIN(long a, long b) {
return (long)(Math.min(a, b));
}

View File

@ -1135,6 +1135,14 @@ public class Long512VectorTests extends AbstractVectorTest {
}
}
static long ROL_scalar(long a, long b) {
return Long.rotateLeft(a, ((int)b));
}
static long ROR_scalar(long a, long b) {
return Long.rotateRight(a, ((int)b));
}
static boolean eq(long a, long b) {
return a == b;
}
@ -2307,7 +2315,7 @@ public class Long512VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void LSHLLong512VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void LSHLLong512VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2325,7 +2333,7 @@ public class Long512VectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHLLong512VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void LSHLLong512VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2353,7 +2361,7 @@ public class Long512VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void LSHRLong512VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void LSHRLong512VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2371,7 +2379,7 @@ public class Long512VectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHRLong512VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void LSHRLong512VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2399,7 +2407,7 @@ public class Long512VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void ASHRLong512VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void ASHRLong512VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2417,7 +2425,7 @@ public class Long512VectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ASHRLong512VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void ASHRLong512VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2439,6 +2447,178 @@ public class Long512VectorTests extends AbstractVectorTest {
static long ROR(long a, long b) {
return (long)(ROR_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void RORLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Long512VectorTests::ROR);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void RORLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::ROR);
}
static long ROL(long a, long b) {
return (long)(ROL_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void ROLLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Long512VectorTests::ROL);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ROLLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::ROL);
}
static long ROR_unary(long a, long b) {
return (long)(ROR_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void RORLong512VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Long512VectorTests::ROR_unary);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void RORLong512VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Long512VectorTests::ROR_unary);
}
static long ROL_unary(long a, long b) {
return (long)(ROL_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void ROLLong512VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Long512VectorTests::ROL_unary);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ROLLong512VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Long512VectorTests::ROL_unary);
}
static long MIN(long a, long b) {
return (long)(Math.min(a, b));
}

View File

@ -1135,6 +1135,14 @@ public class Long64VectorTests extends AbstractVectorTest {
}
}
static long ROL_scalar(long a, long b) {
return Long.rotateLeft(a, ((int)b));
}
static long ROR_scalar(long a, long b) {
return Long.rotateRight(a, ((int)b));
}
static boolean eq(long a, long b) {
return a == b;
}
@ -2307,7 +2315,7 @@ public class Long64VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void LSHLLong64VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void LSHLLong64VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2325,7 +2333,7 @@ public class Long64VectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHLLong64VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void LSHLLong64VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2353,7 +2361,7 @@ public class Long64VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void LSHRLong64VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void LSHRLong64VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2371,7 +2379,7 @@ public class Long64VectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHRLong64VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void LSHRLong64VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2399,7 +2407,7 @@ public class Long64VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void ASHRLong64VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void ASHRLong64VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2417,7 +2425,7 @@ public class Long64VectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ASHRLong64VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void ASHRLong64VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2439,6 +2447,178 @@ public class Long64VectorTests extends AbstractVectorTest {
static long ROR(long a, long b) {
return (long)(ROR_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void RORLong64VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Long64VectorTests::ROR);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void RORLong64VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Long64VectorTests::ROR);
}
static long ROL(long a, long b) {
return (long)(ROL_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void ROLLong64VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Long64VectorTests::ROL);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ROLLong64VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Long64VectorTests::ROL);
}
static long ROR_unary(long a, long b) {
return (long)(ROR_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void RORLong64VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Long64VectorTests::ROR_unary);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void RORLong64VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Long64VectorTests::ROR_unary);
}
static long ROL_unary(long a, long b) {
return (long)(ROL_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void ROLLong64VectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Long64VectorTests::ROL_unary);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ROLLong64VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Long64VectorTests::ROL_unary);
}
static long MIN(long a, long b) {
return (long)(Math.min(a, b));
}

View File

@ -1140,6 +1140,14 @@ public class LongMaxVectorTests extends AbstractVectorTest {
}
}
static long ROL_scalar(long a, long b) {
return Long.rotateLeft(a, ((int)b));
}
static long ROR_scalar(long a, long b) {
return Long.rotateRight(a, ((int)b));
}
static boolean eq(long a, long b) {
return a == b;
}
@ -2312,7 +2320,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void LSHLLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void LSHLLongMaxVectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2330,7 +2338,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHLLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void LSHLLongMaxVectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2358,7 +2366,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void LSHRLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void LSHRLongMaxVectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2376,7 +2384,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHRLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void LSHRLongMaxVectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2404,7 +2412,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "longBinaryOpProvider")
static void ASHRLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
static void ASHRLongMaxVectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@ -2422,7 +2430,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ASHRLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
static void ASHRLongMaxVectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
@ -2444,6 +2452,178 @@ public class LongMaxVectorTests extends AbstractVectorTest {
static long ROR(long a, long b) {
return (long)(ROR_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void RORLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, LongMaxVectorTests::ROR);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void RORLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, LongMaxVectorTests::ROR);
}
static long ROL(long a, long b) {
return (long)(ROL_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void ROLLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, LongMaxVectorTests::ROL);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ROLLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, LongMaxVectorTests::ROL);
}
static long ROR_unary(long a, long b) {
return (long)(ROR_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void RORLongMaxVectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, LongMaxVectorTests::ROR_unary);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void RORLongMaxVectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, LongMaxVectorTests::ROR_unary);
}
static long ROL_unary(long a, long b) {
return (long)(ROL_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
static void ROLLongMaxVectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, LongMaxVectorTests::ROL_unary);
}
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ROLLongMaxVectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, LongMaxVectorTests::ROL_unary);
}
static long MIN(long a, long b) {
return (long)(Math.min(a, b));
}

View File

@ -1143,6 +1143,14 @@ public class Short128VectorTests extends AbstractVectorTest {
}
}
static short ROL_scalar(short a, short b) {
return (short)(((((short)a) & 0xFFFF) << (b & 15)) | ((((short)a) & 0xFFFF) >>> (16 - (b & 15))));
}
static short ROR_scalar(short a, short b) {
return (short)(((((short)a) & 0xFFFF) >>> (b & 15)) | ((((short)a) & 0xFFFF) << (16 - (b & 15))));
}
static boolean eq(short a, short b) {
return a == b;
}
@ -2314,7 +2322,7 @@ public class Short128VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void LSHLShort128VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void LSHLShort128VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2332,7 +2340,7 @@ public class Short128VectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void LSHLShort128VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void LSHLShort128VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2360,7 +2368,7 @@ public class Short128VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void LSHRShort128VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void LSHRShort128VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2378,7 +2386,7 @@ public class Short128VectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void LSHRShort128VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void LSHRShort128VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2406,7 +2414,7 @@ public class Short128VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ASHRShort128VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void ASHRShort128VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2424,7 +2432,7 @@ public class Short128VectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ASHRShort128VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void ASHRShort128VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2442,6 +2450,178 @@ public class Short128VectorTests extends AbstractVectorTest {
assertShiftArraysEquals(r, a, b, mask, Short128VectorTests::ASHR_unary);
}
static short ROR(short a, short b) {
return (short)(ROR_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void RORShort128VectorTests(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Short128VectorTests::ROR);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void RORShort128VectorTestsMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Short128VectorTests::ROR);
}
static short ROL(short a, short b) {
return (short)(ROL_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ROLShort128VectorTests(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Short128VectorTests::ROL);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ROLShort128VectorTestsMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Short128VectorTests::ROL);
}
static short ROR_unary(short a, short b) {
return (short)(ROR_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void RORShort128VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Short128VectorTests::ROR_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void RORShort128VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Short128VectorTests::ROR_unary);
}
static short ROL_unary(short a, short b) {
return (short)(ROL_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ROLShort128VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Short128VectorTests::ROL_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ROLShort128VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Short128VectorTests::ROL_unary);
}
static short MIN(short a, short b) {
return (short)(Math.min(a, b));
}

View File

@ -1143,6 +1143,14 @@ public class Short256VectorTests extends AbstractVectorTest {
}
}
static short ROL_scalar(short a, short b) {
return (short)(((((short)a) & 0xFFFF) << (b & 15)) | ((((short)a) & 0xFFFF) >>> (16 - (b & 15))));
}
static short ROR_scalar(short a, short b) {
return (short)(((((short)a) & 0xFFFF) >>> (b & 15)) | ((((short)a) & 0xFFFF) << (16 - (b & 15))));
}
static boolean eq(short a, short b) {
return a == b;
}
@ -2314,7 +2322,7 @@ public class Short256VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void LSHLShort256VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void LSHLShort256VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2332,7 +2340,7 @@ public class Short256VectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void LSHLShort256VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void LSHLShort256VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2360,7 +2368,7 @@ public class Short256VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void LSHRShort256VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void LSHRShort256VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2378,7 +2386,7 @@ public class Short256VectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void LSHRShort256VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void LSHRShort256VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2406,7 +2414,7 @@ public class Short256VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ASHRShort256VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void ASHRShort256VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2424,7 +2432,7 @@ public class Short256VectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ASHRShort256VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void ASHRShort256VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2442,6 +2450,178 @@ public class Short256VectorTests extends AbstractVectorTest {
assertShiftArraysEquals(r, a, b, mask, Short256VectorTests::ASHR_unary);
}
static short ROR(short a, short b) {
return (short)(ROR_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void RORShort256VectorTests(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Short256VectorTests::ROR);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void RORShort256VectorTestsMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Short256VectorTests::ROR);
}
static short ROL(short a, short b) {
return (short)(ROL_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ROLShort256VectorTests(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Short256VectorTests::ROL);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ROLShort256VectorTestsMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Short256VectorTests::ROL);
}
static short ROR_unary(short a, short b) {
return (short)(ROR_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void RORShort256VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Short256VectorTests::ROR_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void RORShort256VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Short256VectorTests::ROR_unary);
}
static short ROL_unary(short a, short b) {
return (short)(ROL_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ROLShort256VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Short256VectorTests::ROL_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ROLShort256VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Short256VectorTests::ROL_unary);
}
static short MIN(short a, short b) {
return (short)(Math.min(a, b));
}

View File

@ -1143,6 +1143,14 @@ public class Short512VectorTests extends AbstractVectorTest {
}
}
static short ROL_scalar(short a, short b) {
return (short)(((((short)a) & 0xFFFF) << (b & 15)) | ((((short)a) & 0xFFFF) >>> (16 - (b & 15))));
}
static short ROR_scalar(short a, short b) {
return (short)(((((short)a) & 0xFFFF) >>> (b & 15)) | ((((short)a) & 0xFFFF) << (16 - (b & 15))));
}
static boolean eq(short a, short b) {
return a == b;
}
@ -2314,7 +2322,7 @@ public class Short512VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void LSHLShort512VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void LSHLShort512VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2332,7 +2340,7 @@ public class Short512VectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void LSHLShort512VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void LSHLShort512VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2360,7 +2368,7 @@ public class Short512VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void LSHRShort512VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void LSHRShort512VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2378,7 +2386,7 @@ public class Short512VectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void LSHRShort512VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void LSHRShort512VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2406,7 +2414,7 @@ public class Short512VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ASHRShort512VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void ASHRShort512VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2424,7 +2432,7 @@ public class Short512VectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ASHRShort512VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void ASHRShort512VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2442,6 +2450,178 @@ public class Short512VectorTests extends AbstractVectorTest {
assertShiftArraysEquals(r, a, b, mask, Short512VectorTests::ASHR_unary);
}
static short ROR(short a, short b) {
return (short)(ROR_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void RORShort512VectorTests(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Short512VectorTests::ROR);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void RORShort512VectorTestsMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Short512VectorTests::ROR);
}
static short ROL(short a, short b) {
return (short)(ROL_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ROLShort512VectorTests(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Short512VectorTests::ROL);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ROLShort512VectorTestsMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Short512VectorTests::ROL);
}
static short ROR_unary(short a, short b) {
return (short)(ROR_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void RORShort512VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Short512VectorTests::ROR_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void RORShort512VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Short512VectorTests::ROR_unary);
}
static short ROL_unary(short a, short b) {
return (short)(ROL_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ROLShort512VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Short512VectorTests::ROL_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ROLShort512VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Short512VectorTests::ROL_unary);
}
static short MIN(short a, short b) {
return (short)(Math.min(a, b));
}

View File

@ -1143,6 +1143,14 @@ public class Short64VectorTests extends AbstractVectorTest {
}
}
static short ROL_scalar(short a, short b) {
return (short)(((((short)a) & 0xFFFF) << (b & 15)) | ((((short)a) & 0xFFFF) >>> (16 - (b & 15))));
}
static short ROR_scalar(short a, short b) {
return (short)(((((short)a) & 0xFFFF) >>> (b & 15)) | ((((short)a) & 0xFFFF) << (16 - (b & 15))));
}
static boolean eq(short a, short b) {
return a == b;
}
@ -2314,7 +2322,7 @@ public class Short64VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void LSHLShort64VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void LSHLShort64VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2332,7 +2340,7 @@ public class Short64VectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void LSHLShort64VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void LSHLShort64VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2360,7 +2368,7 @@ public class Short64VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void LSHRShort64VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void LSHRShort64VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2378,7 +2386,7 @@ public class Short64VectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void LSHRShort64VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void LSHRShort64VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2406,7 +2414,7 @@ public class Short64VectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ASHRShort64VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void ASHRShort64VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2424,7 +2432,7 @@ public class Short64VectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ASHRShort64VectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void ASHRShort64VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2442,6 +2450,178 @@ public class Short64VectorTests extends AbstractVectorTest {
assertShiftArraysEquals(r, a, b, mask, Short64VectorTests::ASHR_unary);
}
static short ROR(short a, short b) {
return (short)(ROR_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void RORShort64VectorTests(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Short64VectorTests::ROR);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void RORShort64VectorTestsMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Short64VectorTests::ROR);
}
static short ROL(short a, short b) {
return (short)(ROL_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ROLShort64VectorTests(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, Short64VectorTests::ROL);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ROLShort64VectorTestsMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, Short64VectorTests::ROL);
}
static short ROR_unary(short a, short b) {
return (short)(ROR_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void RORShort64VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Short64VectorTests::ROR_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void RORShort64VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Short64VectorTests::ROR_unary);
}
static short ROL_unary(short a, short b) {
return (short)(ROL_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ROLShort64VectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, Short64VectorTests::ROL_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ROLShort64VectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, Short64VectorTests::ROL_unary);
}
static short MIN(short a, short b) {
return (short)(Math.min(a, b));
}

View File

@ -1148,6 +1148,14 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
}
}
static short ROL_scalar(short a, short b) {
return (short)(((((short)a) & 0xFFFF) << (b & 15)) | ((((short)a) & 0xFFFF) >>> (16 - (b & 15))));
}
static short ROR_scalar(short a, short b) {
return (short)(((((short)a) & 0xFFFF) >>> (b & 15)) | ((((short)a) & 0xFFFF) << (16 - (b & 15))));
}
static boolean eq(short a, short b) {
return a == b;
}
@ -2319,7 +2327,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void LSHLShortMaxVectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void LSHLShortMaxVectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2337,7 +2345,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void LSHLShortMaxVectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void LSHLShortMaxVectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2365,7 +2373,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void LSHRShortMaxVectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void LSHRShortMaxVectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2383,7 +2391,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void LSHRShortMaxVectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void LSHRShortMaxVectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2411,7 +2419,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ASHRShortMaxVectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
static void ASHRShortMaxVectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
@ -2429,7 +2437,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ASHRShortMaxVectorTestsShift(IntFunction<short[]> fa, IntFunction<short[]> fb,
static void ASHRShortMaxVectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
@ -2447,6 +2455,178 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
assertShiftArraysEquals(r, a, b, mask, ShortMaxVectorTests::ASHR_unary);
}
static short ROR(short a, short b) {
return (short)(ROR_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void RORShortMaxVectorTests(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, ShortMaxVectorTests::ROR);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void RORShortMaxVectorTestsMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::ROR);
}
static short ROL(short a, short b) {
return (short)(ROL_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ROLShortMaxVectorTests(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, ShortMaxVectorTests::ROL);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ROLShortMaxVectorTestsMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
ShortVector bv = ShortVector.fromArray(SPECIES, b, i);
av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::ROL);
}
static short ROR_unary(short a, short b) {
return (short)(ROR_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void RORShortMaxVectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, ShortMaxVectorTests::ROR_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void RORShortMaxVectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, ShortMaxVectorTests::ROR_unary);
}
static short ROL_unary(short a, short b) {
return (short)(ROL_scalar(a,b));
}
@Test(dataProvider = "shortBinaryOpProvider")
static void ROLShortMaxVectorTestsScalarShift(IntFunction<short[]> fa, IntFunction<short[]> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, ShortMaxVectorTests::ROL_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
static void ROLShortMaxVectorTestsScalarShiftMasked(IntFunction<short[]> fa, IntFunction<short[]> fb,
IntFunction<boolean[]> fm) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
}
}
assertShiftArraysEquals(r, a, b, mask, ShortMaxVectorTests::ROL_unary);
}
static short MIN(short a, short b) {
return (short)(Math.min(a, b));
}

View File

@ -99,9 +99,9 @@ function replace_variables {
local kernel_smoke=${10}
if [ "x${kernel}" != "x" ]; then
local kernel_escaped=$(echo -e "$kernel" | tr '\n' '|')
local kernel_escaped=$(echo -e "$kernel" | tr '\n' '`')
sed "s/\[\[KERNEL\]\]/${kernel_escaped}/g" $filename > ${filename}.current1
cat ${filename}.current1 | tr '|' "\n" > ${filename}.current
cat ${filename}.current1 | tr '`' "\n" > ${filename}.current
rm -f "${filename}.current1"
else
cp $filename ${filename}.current
@ -156,9 +156,9 @@ function replace_variables {
if [[ "$filename" == *"Unit"* ]] && [ "$test_func" != "" ]; then
if [ "$masked" == "" ] || [ "$withMask" != "" ]; then
if [ ! -z "$kernel_smoke" ]; then
local kernel_smoke_escaped=$(echo -e "$kernel_smoke" | tr '\n' '|')
local kernel_smoke_escaped=$(echo -e "$kernel_smoke" | tr '\n' '`')
sed "s/\[\[KERNEL\]\]/${kernel_smoke_escaped}/g" $filename > ${filename}.scurrent1
cat ${filename}.scurrent1 | tr '|' "\n" > ${filename}.scurrent
cat ${filename}.scurrent1 | tr '`' "\n" > ${filename}.scurrent
rm -f "${filename}.scurrent1"
else
cp $filename.current ${filename}.scurrent
@ -445,6 +445,10 @@ gen_shift_cst_op "LSHR" "((a \& 0xFFFF) >>> (b \& 15))" "short"
gen_shift_cst_op "ASHR" "(a >> b)" "intOrLong"
gen_shift_cst_op "ASHR" "(a >> (b \& 7))" "byte"
gen_shift_cst_op "ASHR" "(a >> (b \& 15))" "short"
gen_binary_alu_op "ROR" "ROR_scalar(a,b)" "BITWISE"
gen_binary_alu_op "ROL" "ROL_scalar(a,b)" "BITWISE"
gen_shift_cst_op "ROR" "ROR_scalar(a,b)" "BITWISE"
gen_shift_cst_op "ROL" "ROL_scalar(a,b)" "BITWISE"
# Masked reductions.
gen_binary_op_no_masked "MIN+min" "Math.min(a, b)"

View File

@ -1,6 +1,6 @@
@Test(dataProvider = "$type$BinaryOpMaskProvider")
static void [[TEST]]$vectorteststype$Shift(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb,
static void [[TEST]]$vectorteststype$ScalarShiftMasked(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb,
IntFunction<boolean[]> fm) {
[[KERNEL]]
assertShiftArraysEquals(r, a, b, mask, $vectorteststype$::[[TEST]]_unary);

View File

@ -3,7 +3,7 @@
}
@Test(dataProvider = "$type$BinaryOpProvider")
static void [[TEST]]$vectorteststype$Shift(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb) {
static void [[TEST]]$vectorteststype$ScalarShift(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb) {
[[KERNEL]]
assertShiftArraysEquals(r, a, b, $vectorteststype$::[[TEST]]_unary);
}

View File

@ -1383,6 +1383,30 @@ public class $vectorteststype$ extends AbstractVectorTest {
}
}
}
static $type$ ROL_scalar($type$ a, $type$ b) {
#if[intOrLong]
return $Wideboxtype$.rotateLeft(a, ((int)b));
#else[intOrLong]
#if[short]
return (short)(((((short)a) & 0xFFFF) << (b & 15)) | ((((short)a) & 0xFFFF) >>> (16 - (b & 15))));
#else[short]
return (byte)(((((byte)a) & 0xFF) << (b & 7)) | ((((byte)a) & 0xFF) >>> (8 - (b & 7))));
#end[short]
#end[intOrLong]
}
static $type$ ROR_scalar($type$ a, $type$ b) {
#if[intOrLong]
return $Wideboxtype$.rotateRight(a, ((int)b));
#else[intOrLong]
#if[short]
return (short)(((((short)a) & 0xFFFF) >>> (b & 15)) | ((((short)a) & 0xFFFF) << (16 - (b & 15))));
#else[short]
return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
#end[short]
#end[intOrLong]
}
#end[BITWISE]
static boolean eq($type$ a, $type$ b) {

View File

@ -0,0 +1,215 @@
/*
* Copyright (c) 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 RotateBenchmark {
@Param({"256","512"})
int size;
@Param({"128","256", "512"})
int bits;
@Param({"7","15","31"})
int shift;
byte[] byteinp;
byte[] byteres;
short[] shortinp;
short[] shortres;
int[] intinp;
int[] intres;
long[] longinp;
long[] longres;
VectorSpecies<Byte> bspecies;
VectorSpecies<Short> sspecies;
VectorSpecies<Integer> ispecies;
VectorSpecies<Long> lspecies;
static final byte[] specialvalsbyte = {0, -0, Byte.MIN_VALUE, Byte.MAX_VALUE};
static final short[] specialvalsshort = {0, -0, Short.MIN_VALUE, Short.MAX_VALUE};
static final int[] specialvalsint = {0, -0, Integer.MIN_VALUE, Integer.MAX_VALUE};
static final long[] specialvalslong = {0L, -0L, Long.MIN_VALUE, Long.MAX_VALUE};
@Setup(Level.Trial)
public void BmSetup() {
Random r = new Random(1024);
byteinp = new byte[size];
byteres = new byte[size];
shortinp = new short[size];
shortres = new short[size];
intinp = new int[size];
intres = new int[size];
longinp = new long[size];
longres = new long[size];
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));
for (int i = 4; i < size; i++) {
byteinp[i] = (byte)i;
shortinp[i] = (short)i;
intinp[i] = i;
longinp[i] = i;
}
for (int i = 0; i < specialvalsbyte.length; i++) {
byteinp[i] = specialvalsbyte[i];
}
for (int i = 0; i < specialvalsshort.length; i++) {
shortinp[i] = specialvalsshort[i];
}
for (int i = 0; i < specialvalsint.length; i++) {
intinp[i] = specialvalsint[i];
}
for (int i = 0; i < specialvalslong.length; i++) {
longinp[i] = specialvalslong[i];
}
}
@Benchmark
public void testRotateLeftB() {
for (int j = 0; j < size; j += bspecies.length()) {
ByteVector.fromArray(bspecies, byteinp, j)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift).intoArray(byteres, j);
}
}
@Benchmark
public void testRotateRightB() {
for (int j = 0; j < size; j += bspecies.length()) {
ByteVector.fromArray(bspecies, byteinp, j)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift).intoArray(byteres, j);
}
}
@Benchmark
public void testRotateLeftS() {
for (int j = 0; j < size; j += sspecies.length()) {
ShortVector.fromArray(sspecies, shortinp, j)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift).intoArray(shortres, j);
}
}
@Benchmark
public void testRotateRightS() {
for (int j = 0; j < size; j += sspecies.length()) {
ShortVector.fromArray(sspecies, shortinp, j)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift).intoArray(shortres, j);
}
}
@Benchmark
public void testRotateLeftI() {
for (int j = 0; j < size; j += ispecies.length()) {
IntVector.fromArray(ispecies, intinp, j)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift).intoArray(intres, j);
}
}
@Benchmark
public void testRotateRightI() {
for (int j = 0; j < size; j += ispecies.length()) {
IntVector.fromArray(ispecies, intinp, j)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift).intoArray(intres, j);
}
}
@Benchmark
public void testRotateLeftL() {
for (int j = 0; j < size; j += lspecies.length()) {
LongVector.fromArray(lspecies, longinp, j)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift)
.lanewise(VectorOperators.ROL, shift).intoArray(longres, j);
}
}
@Benchmark
public void testRotateRightL() {
for (int j = 0; j < size; j += lspecies.length()) {
LongVector.fromArray(lspecies, longinp, j)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift)
.lanewise(VectorOperators.ROR, shift).intoArray(longres, j);
}
}
}