mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-24 04:54:40 +02:00
8001183: incorrect results of char vectors right shift operaiton
Do vector right shift operation for small int types only after loads Reviewed-by: jrose, dlong
This commit is contained in:
parent
65c20a5492
commit
a9c2b6a900
8 changed files with 2380 additions and 14 deletions
|
@ -4102,9 +4102,158 @@ instruct vsll4L_reg_imm(vecY dst, vecY src, immI8 shift) %{
|
||||||
|
|
||||||
// ----------------------- LogicalRightShift -----------------------------------
|
// ----------------------- LogicalRightShift -----------------------------------
|
||||||
|
|
||||||
// Shorts/Chars vector logical right shift produces incorrect Java result
|
// Shorts vector logical right shift produces incorrect Java result
|
||||||
// for negative data because java code convert short value into int with
|
// for negative data because java code convert short value into int with
|
||||||
// sign extension before a shift.
|
// sign extension before a shift. But char vectors are fine since chars are
|
||||||
|
// unsigned values.
|
||||||
|
|
||||||
|
instruct vsrl2S(vecS dst, vecS shift) %{
|
||||||
|
predicate(n->as_Vector()->length() == 2);
|
||||||
|
match(Set dst (URShiftVS dst shift));
|
||||||
|
format %{ "psrlw $dst,$shift\t! logical right shift packed2S" %}
|
||||||
|
ins_encode %{
|
||||||
|
__ psrlw($dst$$XMMRegister, $shift$$XMMRegister);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl2S_imm(vecS dst, immI8 shift) %{
|
||||||
|
predicate(n->as_Vector()->length() == 2);
|
||||||
|
match(Set dst (URShiftVS dst shift));
|
||||||
|
format %{ "psrlw $dst,$shift\t! logical right shift packed2S" %}
|
||||||
|
ins_encode %{
|
||||||
|
__ psrlw($dst$$XMMRegister, (int)$shift$$constant);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl2S_reg(vecS dst, vecS src, vecS shift) %{
|
||||||
|
predicate(UseAVX > 0 && n->as_Vector()->length() == 2);
|
||||||
|
match(Set dst (URShiftVS src shift));
|
||||||
|
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed2S" %}
|
||||||
|
ins_encode %{
|
||||||
|
bool vector256 = false;
|
||||||
|
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector256);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl2S_reg_imm(vecS dst, vecS src, immI8 shift) %{
|
||||||
|
predicate(UseAVX > 0 && n->as_Vector()->length() == 2);
|
||||||
|
match(Set dst (URShiftVS src shift));
|
||||||
|
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed2S" %}
|
||||||
|
ins_encode %{
|
||||||
|
bool vector256 = false;
|
||||||
|
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector256);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl4S(vecD dst, vecS shift) %{
|
||||||
|
predicate(n->as_Vector()->length() == 4);
|
||||||
|
match(Set dst (URShiftVS dst shift));
|
||||||
|
format %{ "psrlw $dst,$shift\t! logical right shift packed4S" %}
|
||||||
|
ins_encode %{
|
||||||
|
__ psrlw($dst$$XMMRegister, $shift$$XMMRegister);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl4S_imm(vecD dst, immI8 shift) %{
|
||||||
|
predicate(n->as_Vector()->length() == 4);
|
||||||
|
match(Set dst (URShiftVS dst shift));
|
||||||
|
format %{ "psrlw $dst,$shift\t! logical right shift packed4S" %}
|
||||||
|
ins_encode %{
|
||||||
|
__ psrlw($dst$$XMMRegister, (int)$shift$$constant);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl4S_reg(vecD dst, vecD src, vecS shift) %{
|
||||||
|
predicate(UseAVX > 0 && n->as_Vector()->length() == 4);
|
||||||
|
match(Set dst (URShiftVS src shift));
|
||||||
|
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed4S" %}
|
||||||
|
ins_encode %{
|
||||||
|
bool vector256 = false;
|
||||||
|
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector256);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl4S_reg_imm(vecD dst, vecD src, immI8 shift) %{
|
||||||
|
predicate(UseAVX > 0 && n->as_Vector()->length() == 4);
|
||||||
|
match(Set dst (URShiftVS src shift));
|
||||||
|
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed4S" %}
|
||||||
|
ins_encode %{
|
||||||
|
bool vector256 = false;
|
||||||
|
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector256);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl8S(vecX dst, vecS shift) %{
|
||||||
|
predicate(n->as_Vector()->length() == 8);
|
||||||
|
match(Set dst (URShiftVS dst shift));
|
||||||
|
format %{ "psrlw $dst,$shift\t! logical right shift packed8S" %}
|
||||||
|
ins_encode %{
|
||||||
|
__ psrlw($dst$$XMMRegister, $shift$$XMMRegister);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl8S_imm(vecX dst, immI8 shift) %{
|
||||||
|
predicate(n->as_Vector()->length() == 8);
|
||||||
|
match(Set dst (URShiftVS dst shift));
|
||||||
|
format %{ "psrlw $dst,$shift\t! logical right shift packed8S" %}
|
||||||
|
ins_encode %{
|
||||||
|
__ psrlw($dst$$XMMRegister, (int)$shift$$constant);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl8S_reg(vecX dst, vecX src, vecS shift) %{
|
||||||
|
predicate(UseAVX > 0 && n->as_Vector()->length() == 8);
|
||||||
|
match(Set dst (URShiftVS src shift));
|
||||||
|
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed8S" %}
|
||||||
|
ins_encode %{
|
||||||
|
bool vector256 = false;
|
||||||
|
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector256);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl8S_reg_imm(vecX dst, vecX src, immI8 shift) %{
|
||||||
|
predicate(UseAVX > 0 && n->as_Vector()->length() == 8);
|
||||||
|
match(Set dst (URShiftVS src shift));
|
||||||
|
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed8S" %}
|
||||||
|
ins_encode %{
|
||||||
|
bool vector256 = false;
|
||||||
|
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector256);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl16S_reg(vecY dst, vecY src, vecS shift) %{
|
||||||
|
predicate(UseAVX > 1 && n->as_Vector()->length() == 16);
|
||||||
|
match(Set dst (URShiftVS src shift));
|
||||||
|
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed16S" %}
|
||||||
|
ins_encode %{
|
||||||
|
bool vector256 = true;
|
||||||
|
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector256);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
|
instruct vsrl16S_reg_imm(vecY dst, vecY src, immI8 shift) %{
|
||||||
|
predicate(UseAVX > 1 && n->as_Vector()->length() == 16);
|
||||||
|
match(Set dst (URShiftVS src shift));
|
||||||
|
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed16S" %}
|
||||||
|
ins_encode %{
|
||||||
|
bool vector256 = true;
|
||||||
|
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector256);
|
||||||
|
%}
|
||||||
|
ins_pipe( pipe_slow );
|
||||||
|
%}
|
||||||
|
|
||||||
// Integers vector logical right shift
|
// Integers vector logical right shift
|
||||||
instruct vsrl2I(vecD dst, vecS shift) %{
|
instruct vsrl2I(vecD dst, vecS shift) %{
|
||||||
|
|
|
@ -1776,16 +1776,15 @@ void SuperWord::compute_vector_element_type() {
|
||||||
set_velt_type(n, container_type(n));
|
set_velt_type(n, container_type(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Propagate narrowed type backwards through operations
|
// Propagate integer narrowed type backwards through operations
|
||||||
// that don't depend on higher order bits
|
// that don't depend on higher order bits
|
||||||
for (int i = _block.length() - 1; i >= 0; i--) {
|
for (int i = _block.length() - 1; i >= 0; i--) {
|
||||||
Node* n = _block.at(i);
|
Node* n = _block.at(i);
|
||||||
// Only integer types need be examined
|
// Only integer types need be examined
|
||||||
const Type* vt = velt_type(n);
|
const Type* vtn = velt_type(n);
|
||||||
if (vt->basic_type() == T_INT) {
|
if (vtn->basic_type() == T_INT) {
|
||||||
uint start, end;
|
uint start, end;
|
||||||
VectorNode::vector_operands(n, &start, &end);
|
VectorNode::vector_operands(n, &start, &end);
|
||||||
const Type* vt = velt_type(n);
|
|
||||||
|
|
||||||
for (uint j = start; j < end; j++) {
|
for (uint j = start; j < end; j++) {
|
||||||
Node* in = n->in(j);
|
Node* in = n->in(j);
|
||||||
|
@ -1801,6 +1800,24 @@ void SuperWord::compute_vector_element_type() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (same_type) {
|
if (same_type) {
|
||||||
|
// For right shifts of small integer types (bool, byte, char, short)
|
||||||
|
// we need precise information about sign-ness. Only Load nodes have
|
||||||
|
// this information because Store nodes are the same for signed and
|
||||||
|
// unsigned values. And any arithmetic operation after a load may
|
||||||
|
// expand a value to signed Int so such right shifts can't be used
|
||||||
|
// because vector elements do not have upper bits of Int.
|
||||||
|
const Type* vt = vtn;
|
||||||
|
if (VectorNode::is_shift(in)) {
|
||||||
|
Node* load = in->in(1);
|
||||||
|
if (load->is_Load() && (velt_type(load)->basic_type() == T_INT)) {
|
||||||
|
vt = velt_type(load);
|
||||||
|
} else if (in->Opcode() != Op_LShiftI) {
|
||||||
|
// Widen type to Int to avoid creation of right shift vector
|
||||||
|
// (align + data_size(s1) check in stmts_can_pack() will fail).
|
||||||
|
// Note, left shifts work regardless type.
|
||||||
|
vt = TypeInt::INT;
|
||||||
|
}
|
||||||
|
}
|
||||||
set_velt_type(in, vt);
|
set_velt_type(in, vt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1841,7 +1858,20 @@ int SuperWord::memory_alignment(MemNode* s, int iv_adjust) {
|
||||||
// Smallest type containing range of values
|
// Smallest type containing range of values
|
||||||
const Type* SuperWord::container_type(Node* n) {
|
const Type* SuperWord::container_type(Node* n) {
|
||||||
if (n->is_Mem()) {
|
if (n->is_Mem()) {
|
||||||
return Type::get_const_basic_type(n->as_Mem()->memory_type());
|
BasicType bt = n->as_Mem()->memory_type();
|
||||||
|
if (n->is_Store() && (bt == T_CHAR)) {
|
||||||
|
// Use T_SHORT type instead of T_CHAR for stored values because any
|
||||||
|
// preceding arithmetic operation extends values to signed Int.
|
||||||
|
bt = T_SHORT;
|
||||||
|
}
|
||||||
|
if (n->Opcode() == Op_LoadUB) {
|
||||||
|
// Adjust type for unsigned byte loads, it is important for right shifts.
|
||||||
|
// T_BOOLEAN is used because there is no basic type representing type
|
||||||
|
// TypeInt::UBYTE. Use of T_BOOLEAN for vectors is fine because only
|
||||||
|
// size (one byte) and sign is important.
|
||||||
|
bt = T_BOOLEAN;
|
||||||
|
}
|
||||||
|
return Type::get_const_basic_type(bt);
|
||||||
}
|
}
|
||||||
const Type* t = _igvn.type(n);
|
const Type* t = _igvn.type(n);
|
||||||
if (t->basic_type() == T_INT) {
|
if (t->basic_type() == T_INT) {
|
||||||
|
|
|
@ -103,9 +103,9 @@ int VectorNode::opcode(int sopc, BasicType bt) {
|
||||||
return Op_LShiftVL;
|
return Op_LShiftVL;
|
||||||
case Op_RShiftI:
|
case Op_RShiftI:
|
||||||
switch (bt) {
|
switch (bt) {
|
||||||
case T_BOOLEAN:
|
case T_BOOLEAN:return Op_URShiftVB; // boolean is unsigned value
|
||||||
|
case T_CHAR: return Op_URShiftVS; // char is unsigned value
|
||||||
case T_BYTE: return Op_RShiftVB;
|
case T_BYTE: return Op_RShiftVB;
|
||||||
case T_CHAR:
|
|
||||||
case T_SHORT: return Op_RShiftVS;
|
case T_SHORT: return Op_RShiftVS;
|
||||||
case T_INT: return Op_RShiftVI;
|
case T_INT: return Op_RShiftVI;
|
||||||
}
|
}
|
||||||
|
@ -115,10 +115,14 @@ int VectorNode::opcode(int sopc, BasicType bt) {
|
||||||
return Op_RShiftVL;
|
return Op_RShiftVL;
|
||||||
case Op_URShiftI:
|
case Op_URShiftI:
|
||||||
switch (bt) {
|
switch (bt) {
|
||||||
case T_BOOLEAN:
|
case T_BOOLEAN:return Op_URShiftVB;
|
||||||
case T_BYTE: return Op_URShiftVB;
|
case T_CHAR: return Op_URShiftVS;
|
||||||
case T_CHAR:
|
case T_BYTE:
|
||||||
case T_SHORT: return Op_URShiftVS;
|
case T_SHORT: return 0; // Vector logical right shift for signed short
|
||||||
|
// values produces incorrect Java result for
|
||||||
|
// negative data because java code should convert
|
||||||
|
// a short value into int value with sign
|
||||||
|
// extension before a shift.
|
||||||
case T_INT: return Op_URShiftVI;
|
case T_INT: return Op_URShiftVI;
|
||||||
}
|
}
|
||||||
ShouldNotReachHere();
|
ShouldNotReachHere();
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
public class TestByteVect {
|
public class TestByteVect {
|
||||||
private static final int ARRLEN = 997;
|
private static final int ARRLEN = 997;
|
||||||
private static final int ITERS = 11000;
|
private static final int ITERS = 11000;
|
||||||
private static final int ADD_INIT = 0;
|
private static final int ADD_INIT = 63;
|
||||||
private static final int BIT_MASK = 0xB7;
|
private static final int BIT_MASK = 0xB7;
|
||||||
private static final int VALUE = 3;
|
private static final int VALUE = 3;
|
||||||
private static final int SHIFT = 8;
|
private static final int SHIFT = 8;
|
||||||
|
@ -76,6 +76,7 @@ public class TestByteVect {
|
||||||
test_subc(a0, a1);
|
test_subc(a0, a1);
|
||||||
test_subv(a0, a1, (byte)VALUE);
|
test_subv(a0, a1, (byte)VALUE);
|
||||||
test_suba(a0, a1, a2);
|
test_suba(a0, a1, a2);
|
||||||
|
|
||||||
test_mulc(a0, a1);
|
test_mulc(a0, a1);
|
||||||
test_mulv(a0, a1, (byte)VALUE);
|
test_mulv(a0, a1, (byte)VALUE);
|
||||||
test_mula(a0, a1, a2);
|
test_mula(a0, a1, a2);
|
||||||
|
@ -88,6 +89,7 @@ public class TestByteVect {
|
||||||
test_divc_n(a0, a1);
|
test_divc_n(a0, a1);
|
||||||
test_divv(a0, a1, (byte)-VALUE);
|
test_divv(a0, a1, (byte)-VALUE);
|
||||||
test_diva(a0, a1, a3);
|
test_diva(a0, a1, a3);
|
||||||
|
|
||||||
test_andc(a0, a1);
|
test_andc(a0, a1);
|
||||||
test_andv(a0, a1, (byte)BIT_MASK);
|
test_andv(a0, a1, (byte)BIT_MASK);
|
||||||
test_anda(a0, a1, a4);
|
test_anda(a0, a1, a4);
|
||||||
|
@ -97,30 +99,49 @@ public class TestByteVect {
|
||||||
test_xorc(a0, a1);
|
test_xorc(a0, a1);
|
||||||
test_xorv(a0, a1, (byte)BIT_MASK);
|
test_xorv(a0, a1, (byte)BIT_MASK);
|
||||||
test_xora(a0, a1, a4);
|
test_xora(a0, a1, a4);
|
||||||
|
|
||||||
test_sllc(a0, a1);
|
test_sllc(a0, a1);
|
||||||
test_sllv(a0, a1, VALUE);
|
test_sllv(a0, a1, VALUE);
|
||||||
test_srlc(a0, a1);
|
test_srlc(a0, a1);
|
||||||
test_srlv(a0, a1, VALUE);
|
test_srlv(a0, a1, VALUE);
|
||||||
test_srac(a0, a1);
|
test_srac(a0, a1);
|
||||||
test_srav(a0, a1, VALUE);
|
test_srav(a0, a1, VALUE);
|
||||||
|
|
||||||
test_sllc_n(a0, a1);
|
test_sllc_n(a0, a1);
|
||||||
test_sllv(a0, a1, -VALUE);
|
test_sllv(a0, a1, -VALUE);
|
||||||
test_srlc_n(a0, a1);
|
test_srlc_n(a0, a1);
|
||||||
test_srlv(a0, a1, -VALUE);
|
test_srlv(a0, a1, -VALUE);
|
||||||
test_srac_n(a0, a1);
|
test_srac_n(a0, a1);
|
||||||
test_srav(a0, a1, -VALUE);
|
test_srav(a0, a1, -VALUE);
|
||||||
|
|
||||||
test_sllc_o(a0, a1);
|
test_sllc_o(a0, a1);
|
||||||
test_sllv(a0, a1, SHIFT);
|
test_sllv(a0, a1, SHIFT);
|
||||||
test_srlc_o(a0, a1);
|
test_srlc_o(a0, a1);
|
||||||
test_srlv(a0, a1, SHIFT);
|
test_srlv(a0, a1, SHIFT);
|
||||||
test_srac_o(a0, a1);
|
test_srac_o(a0, a1);
|
||||||
test_srav(a0, a1, SHIFT);
|
test_srav(a0, a1, SHIFT);
|
||||||
|
|
||||||
test_sllc_on(a0, a1);
|
test_sllc_on(a0, a1);
|
||||||
test_sllv(a0, a1, -SHIFT);
|
test_sllv(a0, a1, -SHIFT);
|
||||||
test_srlc_on(a0, a1);
|
test_srlc_on(a0, a1);
|
||||||
test_srlv(a0, a1, -SHIFT);
|
test_srlv(a0, a1, -SHIFT);
|
||||||
test_srac_on(a0, a1);
|
test_srac_on(a0, a1);
|
||||||
test_srav(a0, a1, -SHIFT);
|
test_srav(a0, a1, -SHIFT);
|
||||||
|
|
||||||
|
test_sllc_add(a0, a1);
|
||||||
|
test_sllv_add(a0, a1, ADD_INIT);
|
||||||
|
test_srlc_add(a0, a1);
|
||||||
|
test_srlv_add(a0, a1, ADD_INIT);
|
||||||
|
test_srac_add(a0, a1);
|
||||||
|
test_srav_add(a0, a1, ADD_INIT);
|
||||||
|
|
||||||
|
test_sllc_and(a0, a1);
|
||||||
|
test_sllv_and(a0, a1, BIT_MASK);
|
||||||
|
test_srlc_and(a0, a1);
|
||||||
|
test_srlv_and(a0, a1, BIT_MASK);
|
||||||
|
test_srac_and(a0, a1);
|
||||||
|
test_srav_and(a0, a1, BIT_MASK);
|
||||||
|
|
||||||
test_pack2(p2, a1);
|
test_pack2(p2, a1);
|
||||||
test_unpack2(a0, p2);
|
test_unpack2(a0, p2);
|
||||||
test_pack2_swap(p2, a1);
|
test_pack2_swap(p2, a1);
|
||||||
|
@ -369,6 +390,60 @@ public class TestByteVect {
|
||||||
errn += verify("test_srav_on: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>(-SHIFT)));
|
errn += verify("test_srav_on: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>(-SHIFT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_sllc_add(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllc_add: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) + ADD_INIT)<<VALUE));
|
||||||
|
}
|
||||||
|
test_sllv_add(a0, a1, ADD_INIT);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllv_add: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) + ADD_INIT)<<VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srlc_add(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlc_add: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) + ADD_INIT)>>>VALUE));
|
||||||
|
}
|
||||||
|
test_srlv_add(a0, a1, ADD_INIT);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlv_add: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) + ADD_INIT)>>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srac_add(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srac_add: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) + ADD_INIT)>>VALUE));
|
||||||
|
}
|
||||||
|
test_srav_add(a0, a1, ADD_INIT);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srav_add: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) + ADD_INIT)>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_sllc_and(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllc_and: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) & BIT_MASK)<<VALUE));
|
||||||
|
}
|
||||||
|
test_sllv_and(a0, a1, BIT_MASK);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllv_and: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) & BIT_MASK)<<VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srlc_and(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlc_and: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) & BIT_MASK)>>>VALUE));
|
||||||
|
}
|
||||||
|
test_srlv_and(a0, a1, BIT_MASK);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlv_and: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) & BIT_MASK)>>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srac_and(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srac_and: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) & BIT_MASK)>>VALUE));
|
||||||
|
}
|
||||||
|
test_srav_and(a0, a1, BIT_MASK);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srav_and: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) & BIT_MASK)>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
test_pack2(p2, a1);
|
test_pack2(p2, a1);
|
||||||
for (int i=0; i<ARRLEN/2; i++) {
|
for (int i=0; i<ARRLEN/2; i++) {
|
||||||
errn += verify("test_pack2: ", i, p2[i], (short)(((short)(ADD_INIT+2*i) & 0xFF) | ((short)(ADD_INIT+2*i+1) << 8)));
|
errn += verify("test_pack2: ", i, p2[i], (short)(((short)(ADD_INIT+2*i) & 0xFF) | ((short)(ADD_INIT+2*i+1) << 8)));
|
||||||
|
@ -803,6 +878,84 @@ public class TestByteVect {
|
||||||
end = System.currentTimeMillis();
|
end = System.currentTimeMillis();
|
||||||
System.out.println("test_srav_on: " + (end - start));
|
System.out.println("test_srav_on: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllc_add(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllc_add: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllv_add(a0, a1, ADD_INIT);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllv_add: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlc_add(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlc_add: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlv_add(a0, a1, ADD_INIT);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlv_add: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srac_add(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srac_add: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srav_add(a0, a1, ADD_INIT);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srav_add: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllc_and(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllc_and: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllv_and(a0, a1, BIT_MASK);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllv_and: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlc_and(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlc_and: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlv_and(a0, a1, BIT_MASK);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlv_and: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srac_and(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srac_and: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srav_and(a0, a1, BIT_MASK);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srav_and: " + (end - start));
|
||||||
|
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
for (int i=0; i<ITERS; i++) {
|
for (int i=0; i<ITERS; i++) {
|
||||||
test_pack2(p2, a1);
|
test_pack2(p2, a1);
|
||||||
|
@ -1036,6 +1189,26 @@ public class TestByteVect {
|
||||||
a0[i] = (byte)(a1[i]<<b);
|
a0[i] = (byte)(a1[i]<<b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void test_sllc_add(byte[] a0, byte[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (byte)((a1[i] + ADD_INIT)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_sllv_add(byte[] a0, byte[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (byte)((a1[i] + b)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_sllc_and(byte[] a0, byte[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (byte)((a1[i] & BIT_MASK)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_sllv_and(byte[] a0, byte[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (byte)((a1[i] & b)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_srlc(byte[] a0, byte[] a1) {
|
static void test_srlc(byte[] a0, byte[] a1) {
|
||||||
for (int i = 0; i < a0.length; i+=1) {
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
@ -1062,6 +1235,26 @@ public class TestByteVect {
|
||||||
a0[i] = (byte)(a1[i]>>>b);
|
a0[i] = (byte)(a1[i]>>>b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void test_srlc_add(byte[] a0, byte[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (byte)((a1[i] + ADD_INIT)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srlv_add(byte[] a0, byte[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (byte)((a1[i] + b)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srlc_and(byte[] a0, byte[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (byte)((a1[i] & BIT_MASK)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srlv_and(byte[] a0, byte[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (byte)((a1[i] & b)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_srac(byte[] a0, byte[] a1) {
|
static void test_srac(byte[] a0, byte[] a1) {
|
||||||
for (int i = 0; i < a0.length; i+=1) {
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
@ -1088,6 +1281,26 @@ public class TestByteVect {
|
||||||
a0[i] = (byte)(a1[i]>>b);
|
a0[i] = (byte)(a1[i]>>b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void test_srac_add(byte[] a0, byte[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (byte)((a1[i] + ADD_INIT)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srav_add(byte[] a0, byte[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (byte)((a1[i] + b)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srac_and(byte[] a0, byte[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (byte)((a1[i] & BIT_MASK)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srav_and(byte[] a0, byte[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (byte)((a1[i] & b)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_pack2(short[] p2, byte[] a1) {
|
static void test_pack2(short[] p2, byte[] a1) {
|
||||||
if (p2.length*2 > a1.length) return;
|
if (p2.length*2 > a1.length) return;
|
||||||
|
|
|
@ -74,6 +74,7 @@ public class TestIntVect {
|
||||||
test_subc(a0, a1);
|
test_subc(a0, a1);
|
||||||
test_subv(a0, a1, (int)VALUE);
|
test_subv(a0, a1, (int)VALUE);
|
||||||
test_suba(a0, a1, a2);
|
test_suba(a0, a1, a2);
|
||||||
|
|
||||||
test_mulc(a0, a1);
|
test_mulc(a0, a1);
|
||||||
test_mulv(a0, a1, (int)VALUE);
|
test_mulv(a0, a1, (int)VALUE);
|
||||||
test_mula(a0, a1, a2);
|
test_mula(a0, a1, a2);
|
||||||
|
@ -86,6 +87,7 @@ public class TestIntVect {
|
||||||
test_divc_n(a0, a1);
|
test_divc_n(a0, a1);
|
||||||
test_divv(a0, a1, (int)-VALUE);
|
test_divv(a0, a1, (int)-VALUE);
|
||||||
test_diva(a0, a1, a3);
|
test_diva(a0, a1, a3);
|
||||||
|
|
||||||
test_andc(a0, a1);
|
test_andc(a0, a1);
|
||||||
test_andv(a0, a1, (int)BIT_MASK);
|
test_andv(a0, a1, (int)BIT_MASK);
|
||||||
test_anda(a0, a1, a4);
|
test_anda(a0, a1, a4);
|
||||||
|
@ -95,30 +97,49 @@ public class TestIntVect {
|
||||||
test_xorc(a0, a1);
|
test_xorc(a0, a1);
|
||||||
test_xorv(a0, a1, (int)BIT_MASK);
|
test_xorv(a0, a1, (int)BIT_MASK);
|
||||||
test_xora(a0, a1, a4);
|
test_xora(a0, a1, a4);
|
||||||
|
|
||||||
test_sllc(a0, a1);
|
test_sllc(a0, a1);
|
||||||
test_sllv(a0, a1, VALUE);
|
test_sllv(a0, a1, VALUE);
|
||||||
test_srlc(a0, a1);
|
test_srlc(a0, a1);
|
||||||
test_srlv(a0, a1, VALUE);
|
test_srlv(a0, a1, VALUE);
|
||||||
test_srac(a0, a1);
|
test_srac(a0, a1);
|
||||||
test_srav(a0, a1, VALUE);
|
test_srav(a0, a1, VALUE);
|
||||||
|
|
||||||
test_sllc_n(a0, a1);
|
test_sllc_n(a0, a1);
|
||||||
test_sllv(a0, a1, -VALUE);
|
test_sllv(a0, a1, -VALUE);
|
||||||
test_srlc_n(a0, a1);
|
test_srlc_n(a0, a1);
|
||||||
test_srlv(a0, a1, -VALUE);
|
test_srlv(a0, a1, -VALUE);
|
||||||
test_srac_n(a0, a1);
|
test_srac_n(a0, a1);
|
||||||
test_srav(a0, a1, -VALUE);
|
test_srav(a0, a1, -VALUE);
|
||||||
|
|
||||||
test_sllc_o(a0, a1);
|
test_sllc_o(a0, a1);
|
||||||
test_sllv(a0, a1, SHIFT);
|
test_sllv(a0, a1, SHIFT);
|
||||||
test_srlc_o(a0, a1);
|
test_srlc_o(a0, a1);
|
||||||
test_srlv(a0, a1, SHIFT);
|
test_srlv(a0, a1, SHIFT);
|
||||||
test_srac_o(a0, a1);
|
test_srac_o(a0, a1);
|
||||||
test_srav(a0, a1, SHIFT);
|
test_srav(a0, a1, SHIFT);
|
||||||
|
|
||||||
test_sllc_on(a0, a1);
|
test_sllc_on(a0, a1);
|
||||||
test_sllv(a0, a1, -SHIFT);
|
test_sllv(a0, a1, -SHIFT);
|
||||||
test_srlc_on(a0, a1);
|
test_srlc_on(a0, a1);
|
||||||
test_srlv(a0, a1, -SHIFT);
|
test_srlv(a0, a1, -SHIFT);
|
||||||
test_srac_on(a0, a1);
|
test_srac_on(a0, a1);
|
||||||
test_srav(a0, a1, -SHIFT);
|
test_srav(a0, a1, -SHIFT);
|
||||||
|
|
||||||
|
test_sllc_add(a0, a1);
|
||||||
|
test_sllv_add(a0, a1, ADD_INIT);
|
||||||
|
test_srlc_add(a0, a1);
|
||||||
|
test_srlv_add(a0, a1, ADD_INIT);
|
||||||
|
test_srac_add(a0, a1);
|
||||||
|
test_srav_add(a0, a1, ADD_INIT);
|
||||||
|
|
||||||
|
test_sllc_and(a0, a1);
|
||||||
|
test_sllv_and(a0, a1, BIT_MASK);
|
||||||
|
test_srlc_and(a0, a1);
|
||||||
|
test_srlv_and(a0, a1, BIT_MASK);
|
||||||
|
test_srac_and(a0, a1);
|
||||||
|
test_srav_and(a0, a1, BIT_MASK);
|
||||||
|
|
||||||
test_pack2(p2, a1);
|
test_pack2(p2, a1);
|
||||||
test_unpack2(a0, p2);
|
test_unpack2(a0, p2);
|
||||||
test_pack2_swap(p2, a1);
|
test_pack2_swap(p2, a1);
|
||||||
|
@ -359,6 +380,60 @@ public class TestIntVect {
|
||||||
errn += verify("test_srav_on: ", i, a0[i], (int)((int)(ADD_INIT+i)>>(-SHIFT)));
|
errn += verify("test_srav_on: ", i, a0[i], (int)((int)(ADD_INIT+i)>>(-SHIFT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_sllc_add(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllc_add: ", i, a0[i], (int)(((int)(ADD_INIT+i) + ADD_INIT)<<VALUE));
|
||||||
|
}
|
||||||
|
test_sllv_add(a0, a1, ADD_INIT);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllv_add: ", i, a0[i], (int)(((int)(ADD_INIT+i) + ADD_INIT)<<VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srlc_add(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlc_add: ", i, a0[i], (int)(((int)(ADD_INIT+i) + ADD_INIT)>>>VALUE));
|
||||||
|
}
|
||||||
|
test_srlv_add(a0, a1, ADD_INIT);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlv_add: ", i, a0[i], (int)(((int)(ADD_INIT+i) + ADD_INIT)>>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srac_add(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srac_add: ", i, a0[i], (int)(((int)(ADD_INIT+i) + ADD_INIT)>>VALUE));
|
||||||
|
}
|
||||||
|
test_srav_add(a0, a1, ADD_INIT);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srav_add: ", i, a0[i], (int)(((int)(ADD_INIT+i) + ADD_INIT)>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_sllc_and(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllc_and: ", i, a0[i], (int)(((int)(ADD_INIT+i) & BIT_MASK)<<VALUE));
|
||||||
|
}
|
||||||
|
test_sllv_and(a0, a1, BIT_MASK);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllv_and: ", i, a0[i], (int)(((int)(ADD_INIT+i) & BIT_MASK)<<VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srlc_and(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlc_and: ", i, a0[i], (int)(((int)(ADD_INIT+i) & BIT_MASK)>>>VALUE));
|
||||||
|
}
|
||||||
|
test_srlv_and(a0, a1, BIT_MASK);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlv_and: ", i, a0[i], (int)(((int)(ADD_INIT+i) & BIT_MASK)>>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srac_and(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srac_and: ", i, a0[i], (int)(((int)(ADD_INIT+i) & BIT_MASK)>>VALUE));
|
||||||
|
}
|
||||||
|
test_srav_and(a0, a1, BIT_MASK);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srav_and: ", i, a0[i], (int)(((int)(ADD_INIT+i) & BIT_MASK)>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
test_pack2(p2, a1);
|
test_pack2(p2, a1);
|
||||||
for (int i=0; i<ARRLEN/2; i++) {
|
for (int i=0; i<ARRLEN/2; i++) {
|
||||||
errn += verify("test_pack2: ", i, p2[i], ((long)(ADD_INIT+2*i) & 0xFFFFFFFFl) | ((long)(ADD_INIT+2*i+1) << 32));
|
errn += verify("test_pack2: ", i, p2[i], ((long)(ADD_INIT+2*i) & 0xFFFFFFFFl) | ((long)(ADD_INIT+2*i+1) << 32));
|
||||||
|
@ -725,6 +800,84 @@ public class TestIntVect {
|
||||||
end = System.currentTimeMillis();
|
end = System.currentTimeMillis();
|
||||||
System.out.println("test_srav_on: " + (end - start));
|
System.out.println("test_srav_on: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllc_add(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllc_add: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllv_add(a0, a1, ADD_INIT);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllv_add: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlc_add(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlc_add: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlv_add(a0, a1, ADD_INIT);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlv_add: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srac_add(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srac_add: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srav_add(a0, a1, ADD_INIT);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srav_add: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllc_and(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllc_and: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllv_and(a0, a1, BIT_MASK);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllv_and: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlc_and(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlc_and: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlv_and(a0, a1, BIT_MASK);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlv_and: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srac_and(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srac_and: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srav_and(a0, a1, BIT_MASK);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srav_and: " + (end - start));
|
||||||
|
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
for (int i=0; i<ITERS; i++) {
|
for (int i=0; i<ITERS; i++) {
|
||||||
test_pack2(p2, a1);
|
test_pack2(p2, a1);
|
||||||
|
@ -908,6 +1061,26 @@ public class TestIntVect {
|
||||||
a0[i] = (int)(a1[i]<<b);
|
a0[i] = (int)(a1[i]<<b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void test_sllc_add(int[] a0, int[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (int)((a1[i] + ADD_INIT)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_sllv_add(int[] a0, int[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (int)((a1[i] + b)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_sllc_and(int[] a0, int[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (int)((a1[i] & BIT_MASK)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_sllv_and(int[] a0, int[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (int)((a1[i] & b)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_srlc(int[] a0, int[] a1) {
|
static void test_srlc(int[] a0, int[] a1) {
|
||||||
for (int i = 0; i < a0.length; i+=1) {
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
@ -934,6 +1107,26 @@ public class TestIntVect {
|
||||||
a0[i] = (int)(a1[i]>>>b);
|
a0[i] = (int)(a1[i]>>>b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void test_srlc_add(int[] a0, int[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (int)((a1[i] + ADD_INIT)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srlv_add(int[] a0, int[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (int)((a1[i] + b)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srlc_and(int[] a0, int[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (int)((a1[i] & BIT_MASK)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srlv_and(int[] a0, int[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (int)((a1[i] & b)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_srac(int[] a0, int[] a1) {
|
static void test_srac(int[] a0, int[] a1) {
|
||||||
for (int i = 0; i < a0.length; i+=1) {
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
@ -960,6 +1153,26 @@ public class TestIntVect {
|
||||||
a0[i] = (int)(a1[i]>>b);
|
a0[i] = (int)(a1[i]>>b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void test_srac_add(int[] a0, int[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (int)((a1[i] + ADD_INIT)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srav_add(int[] a0, int[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (int)((a1[i] + b)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srac_and(int[] a0, int[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (int)((a1[i] & BIT_MASK)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srav_and(int[] a0, int[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (int)((a1[i] & b)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_pack2(long[] p2, int[] a1) {
|
static void test_pack2(long[] p2, int[] a1) {
|
||||||
if (p2.length*2 > a1.length) return;
|
if (p2.length*2 > a1.length) return;
|
||||||
|
|
|
@ -73,6 +73,7 @@ public class TestLongVect {
|
||||||
test_subc(a0, a1);
|
test_subc(a0, a1);
|
||||||
test_subv(a0, a1, (long)VALUE);
|
test_subv(a0, a1, (long)VALUE);
|
||||||
test_suba(a0, a1, a2);
|
test_suba(a0, a1, a2);
|
||||||
|
|
||||||
test_mulc(a0, a1);
|
test_mulc(a0, a1);
|
||||||
test_mulv(a0, a1, (long)VALUE);
|
test_mulv(a0, a1, (long)VALUE);
|
||||||
test_mula(a0, a1, a2);
|
test_mula(a0, a1, a2);
|
||||||
|
@ -85,6 +86,7 @@ public class TestLongVect {
|
||||||
test_divc_n(a0, a1);
|
test_divc_n(a0, a1);
|
||||||
test_divv(a0, a1, (long)-VALUE);
|
test_divv(a0, a1, (long)-VALUE);
|
||||||
test_diva(a0, a1, a3);
|
test_diva(a0, a1, a3);
|
||||||
|
|
||||||
test_andc(a0, a1);
|
test_andc(a0, a1);
|
||||||
test_andv(a0, a1, (long)BIT_MASK);
|
test_andv(a0, a1, (long)BIT_MASK);
|
||||||
test_anda(a0, a1, a4);
|
test_anda(a0, a1, a4);
|
||||||
|
@ -94,30 +96,48 @@ public class TestLongVect {
|
||||||
test_xorc(a0, a1);
|
test_xorc(a0, a1);
|
||||||
test_xorv(a0, a1, (long)BIT_MASK);
|
test_xorv(a0, a1, (long)BIT_MASK);
|
||||||
test_xora(a0, a1, a4);
|
test_xora(a0, a1, a4);
|
||||||
|
|
||||||
test_sllc(a0, a1);
|
test_sllc(a0, a1);
|
||||||
test_sllv(a0, a1, VALUE);
|
test_sllv(a0, a1, VALUE);
|
||||||
test_srlc(a0, a1);
|
test_srlc(a0, a1);
|
||||||
test_srlv(a0, a1, VALUE);
|
test_srlv(a0, a1, VALUE);
|
||||||
test_srac(a0, a1);
|
test_srac(a0, a1);
|
||||||
test_srav(a0, a1, VALUE);
|
test_srav(a0, a1, VALUE);
|
||||||
|
|
||||||
test_sllc_n(a0, a1);
|
test_sllc_n(a0, a1);
|
||||||
test_sllv(a0, a1, -VALUE);
|
test_sllv(a0, a1, -VALUE);
|
||||||
test_srlc_n(a0, a1);
|
test_srlc_n(a0, a1);
|
||||||
test_srlv(a0, a1, -VALUE);
|
test_srlv(a0, a1, -VALUE);
|
||||||
test_srac_n(a0, a1);
|
test_srac_n(a0, a1);
|
||||||
test_srav(a0, a1, -VALUE);
|
test_srav(a0, a1, -VALUE);
|
||||||
|
|
||||||
test_sllc_o(a0, a1);
|
test_sllc_o(a0, a1);
|
||||||
test_sllv(a0, a1, SHIFT);
|
test_sllv(a0, a1, SHIFT);
|
||||||
test_srlc_o(a0, a1);
|
test_srlc_o(a0, a1);
|
||||||
test_srlv(a0, a1, SHIFT);
|
test_srlv(a0, a1, SHIFT);
|
||||||
test_srac_o(a0, a1);
|
test_srac_o(a0, a1);
|
||||||
test_srav(a0, a1, SHIFT);
|
test_srav(a0, a1, SHIFT);
|
||||||
|
|
||||||
test_sllc_on(a0, a1);
|
test_sllc_on(a0, a1);
|
||||||
test_sllv(a0, a1, -SHIFT);
|
test_sllv(a0, a1, -SHIFT);
|
||||||
test_srlc_on(a0, a1);
|
test_srlc_on(a0, a1);
|
||||||
test_srlv(a0, a1, -SHIFT);
|
test_srlv(a0, a1, -SHIFT);
|
||||||
test_srac_on(a0, a1);
|
test_srac_on(a0, a1);
|
||||||
test_srav(a0, a1, -SHIFT);
|
test_srav(a0, a1, -SHIFT);
|
||||||
|
|
||||||
|
test_sllc_add(a0, a1);
|
||||||
|
test_sllv_add(a0, a1, ADD_INIT);
|
||||||
|
test_srlc_add(a0, a1);
|
||||||
|
test_srlv_add(a0, a1, ADD_INIT);
|
||||||
|
test_srac_add(a0, a1);
|
||||||
|
test_srav_add(a0, a1, ADD_INIT);
|
||||||
|
|
||||||
|
test_sllc_and(a0, a1);
|
||||||
|
test_sllv_and(a0, a1, BIT_MASK);
|
||||||
|
test_srlc_and(a0, a1);
|
||||||
|
test_srlv_and(a0, a1, BIT_MASK);
|
||||||
|
test_srac_and(a0, a1);
|
||||||
|
test_srav_and(a0, a1, BIT_MASK);
|
||||||
}
|
}
|
||||||
// Test and verify results
|
// Test and verify results
|
||||||
System.out.println("Verification");
|
System.out.println("Verification");
|
||||||
|
@ -354,6 +374,60 @@ public class TestLongVect {
|
||||||
errn += verify("test_srav_on: ", i, a0[i], (long)((long)(ADD_INIT+i)>>(-SHIFT)));
|
errn += verify("test_srav_on: ", i, a0[i], (long)((long)(ADD_INIT+i)>>(-SHIFT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_sllc_add(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllc_add: ", i, a0[i], (long)(((long)(ADD_INIT+i) + ADD_INIT)<<VALUE));
|
||||||
|
}
|
||||||
|
test_sllv_add(a0, a1, ADD_INIT);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllv_add: ", i, a0[i], (long)(((long)(ADD_INIT+i) + ADD_INIT)<<VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srlc_add(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlc_add: ", i, a0[i], (long)(((long)(ADD_INIT+i) + ADD_INIT)>>>VALUE));
|
||||||
|
}
|
||||||
|
test_srlv_add(a0, a1, ADD_INIT);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlv_add: ", i, a0[i], (long)(((long)(ADD_INIT+i) + ADD_INIT)>>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srac_add(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srac_add: ", i, a0[i], (long)(((long)(ADD_INIT+i) + ADD_INIT)>>VALUE));
|
||||||
|
}
|
||||||
|
test_srav_add(a0, a1, ADD_INIT);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srav_add: ", i, a0[i], (long)(((long)(ADD_INIT+i) + ADD_INIT)>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_sllc_and(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllc_and: ", i, a0[i], (long)(((long)(ADD_INIT+i) & BIT_MASK)<<VALUE));
|
||||||
|
}
|
||||||
|
test_sllv_and(a0, a1, BIT_MASK);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllv_and: ", i, a0[i], (long)(((long)(ADD_INIT+i) & BIT_MASK)<<VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srlc_and(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlc_and: ", i, a0[i], (long)(((long)(ADD_INIT+i) & BIT_MASK)>>>VALUE));
|
||||||
|
}
|
||||||
|
test_srlv_and(a0, a1, BIT_MASK);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlv_and: ", i, a0[i], (long)(((long)(ADD_INIT+i) & BIT_MASK)>>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srac_and(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srac_and: ", i, a0[i], (long)(((long)(ADD_INIT+i) & BIT_MASK)>>VALUE));
|
||||||
|
}
|
||||||
|
test_srav_and(a0, a1, BIT_MASK);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srav_and: ", i, a0[i], (long)(((long)(ADD_INIT+i) & BIT_MASK)>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errn > 0)
|
if (errn > 0)
|
||||||
|
@ -696,6 +770,84 @@ public class TestLongVect {
|
||||||
end = System.currentTimeMillis();
|
end = System.currentTimeMillis();
|
||||||
System.out.println("test_srav_on: " + (end - start));
|
System.out.println("test_srav_on: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllc_add(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllc_add: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllv_add(a0, a1, ADD_INIT);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllv_add: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlc_add(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlc_add: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlv_add(a0, a1, ADD_INIT);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlv_add: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srac_add(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srac_add: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srav_add(a0, a1, ADD_INIT);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srav_add: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllc_and(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllc_and: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllv_and(a0, a1, BIT_MASK);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllv_and: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlc_and(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlc_and: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlv_and(a0, a1, BIT_MASK);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlv_and: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srac_and(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srac_and: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srav_and(a0, a1, BIT_MASK);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srav_and: " + (end - start));
|
||||||
|
|
||||||
return errn;
|
return errn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -854,6 +1006,26 @@ public class TestLongVect {
|
||||||
a0[i] = (long)(a1[i]<<b);
|
a0[i] = (long)(a1[i]<<b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void test_sllc_add(long[] a0, long[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (long)((a1[i] + ADD_INIT)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_sllv_add(long[] a0, long[] a1, long b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (long)((a1[i] + b)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_sllc_and(long[] a0, long[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (long)((a1[i] & BIT_MASK)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_sllv_and(long[] a0, long[] a1, long b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (long)((a1[i] & b)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_srlc(long[] a0, long[] a1) {
|
static void test_srlc(long[] a0, long[] a1) {
|
||||||
for (int i = 0; i < a0.length; i+=1) {
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
@ -880,6 +1052,26 @@ public class TestLongVect {
|
||||||
a0[i] = (long)(a1[i]>>>b);
|
a0[i] = (long)(a1[i]>>>b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void test_srlc_add(long[] a0, long[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (long)((a1[i] + ADD_INIT)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srlv_add(long[] a0, long[] a1, long b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (long)((a1[i] + b)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srlc_and(long[] a0, long[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (long)((a1[i] & BIT_MASK)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srlv_and(long[] a0, long[] a1, long b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (long)((a1[i] & b)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_srac(long[] a0, long[] a1) {
|
static void test_srac(long[] a0, long[] a1) {
|
||||||
for (int i = 0; i < a0.length; i+=1) {
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
@ -906,6 +1098,26 @@ public class TestLongVect {
|
||||||
a0[i] = (long)(a1[i]>>b);
|
a0[i] = (long)(a1[i]>>b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void test_srac_add(long[] a0, long[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (long)((a1[i] + ADD_INIT)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srav_add(long[] a0, long[] a1, long b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (long)((a1[i] + b)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srac_and(long[] a0, long[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (long)((a1[i] & BIT_MASK)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srav_and(long[] a0, long[] a1, long b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (long)((a1[i] & b)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int verify(String text, int i, long elem, long val) {
|
static int verify(String text, int i, long elem, long val) {
|
||||||
if (elem != val) {
|
if (elem != val) {
|
||||||
|
|
|
@ -75,6 +75,7 @@ public class TestShortVect {
|
||||||
test_subc(a0, a1);
|
test_subc(a0, a1);
|
||||||
test_subv(a0, a1, (short)VALUE);
|
test_subv(a0, a1, (short)VALUE);
|
||||||
test_suba(a0, a1, a2);
|
test_suba(a0, a1, a2);
|
||||||
|
|
||||||
test_mulc(a0, a1);
|
test_mulc(a0, a1);
|
||||||
test_mulv(a0, a1, (short)VALUE);
|
test_mulv(a0, a1, (short)VALUE);
|
||||||
test_mula(a0, a1, a2);
|
test_mula(a0, a1, a2);
|
||||||
|
@ -87,6 +88,7 @@ public class TestShortVect {
|
||||||
test_divc_n(a0, a1);
|
test_divc_n(a0, a1);
|
||||||
test_divv(a0, a1, (short)-VALUE);
|
test_divv(a0, a1, (short)-VALUE);
|
||||||
test_diva(a0, a1, a3);
|
test_diva(a0, a1, a3);
|
||||||
|
|
||||||
test_andc(a0, a1);
|
test_andc(a0, a1);
|
||||||
test_andv(a0, a1, (short)BIT_MASK);
|
test_andv(a0, a1, (short)BIT_MASK);
|
||||||
test_anda(a0, a1, a4);
|
test_anda(a0, a1, a4);
|
||||||
|
@ -96,30 +98,49 @@ public class TestShortVect {
|
||||||
test_xorc(a0, a1);
|
test_xorc(a0, a1);
|
||||||
test_xorv(a0, a1, (short)BIT_MASK);
|
test_xorv(a0, a1, (short)BIT_MASK);
|
||||||
test_xora(a0, a1, a4);
|
test_xora(a0, a1, a4);
|
||||||
|
|
||||||
test_sllc(a0, a1);
|
test_sllc(a0, a1);
|
||||||
test_sllv(a0, a1, VALUE);
|
test_sllv(a0, a1, VALUE);
|
||||||
test_srlc(a0, a1);
|
test_srlc(a0, a1);
|
||||||
test_srlv(a0, a1, VALUE);
|
test_srlv(a0, a1, VALUE);
|
||||||
test_srac(a0, a1);
|
test_srac(a0, a1);
|
||||||
test_srav(a0, a1, VALUE);
|
test_srav(a0, a1, VALUE);
|
||||||
|
|
||||||
test_sllc_n(a0, a1);
|
test_sllc_n(a0, a1);
|
||||||
test_sllv(a0, a1, -VALUE);
|
test_sllv(a0, a1, -VALUE);
|
||||||
test_srlc_n(a0, a1);
|
test_srlc_n(a0, a1);
|
||||||
test_srlv(a0, a1, -VALUE);
|
test_srlv(a0, a1, -VALUE);
|
||||||
test_srac_n(a0, a1);
|
test_srac_n(a0, a1);
|
||||||
test_srav(a0, a1, -VALUE);
|
test_srav(a0, a1, -VALUE);
|
||||||
|
|
||||||
test_sllc_o(a0, a1);
|
test_sllc_o(a0, a1);
|
||||||
test_sllv(a0, a1, SHIFT);
|
test_sllv(a0, a1, SHIFT);
|
||||||
test_srlc_o(a0, a1);
|
test_srlc_o(a0, a1);
|
||||||
test_srlv(a0, a1, SHIFT);
|
test_srlv(a0, a1, SHIFT);
|
||||||
test_srac_o(a0, a1);
|
test_srac_o(a0, a1);
|
||||||
test_srav(a0, a1, SHIFT);
|
test_srav(a0, a1, SHIFT);
|
||||||
|
|
||||||
test_sllc_on(a0, a1);
|
test_sllc_on(a0, a1);
|
||||||
test_sllv(a0, a1, -SHIFT);
|
test_sllv(a0, a1, -SHIFT);
|
||||||
test_srlc_on(a0, a1);
|
test_srlc_on(a0, a1);
|
||||||
test_srlv(a0, a1, -SHIFT);
|
test_srlv(a0, a1, -SHIFT);
|
||||||
test_srac_on(a0, a1);
|
test_srac_on(a0, a1);
|
||||||
test_srav(a0, a1, -SHIFT);
|
test_srav(a0, a1, -SHIFT);
|
||||||
|
|
||||||
|
test_sllc_add(a0, a1);
|
||||||
|
test_sllv_add(a0, a1, ADD_INIT);
|
||||||
|
test_srlc_add(a0, a1);
|
||||||
|
test_srlv_add(a0, a1, ADD_INIT);
|
||||||
|
test_srac_add(a0, a1);
|
||||||
|
test_srav_add(a0, a1, ADD_INIT);
|
||||||
|
|
||||||
|
test_sllc_and(a0, a1);
|
||||||
|
test_sllv_and(a0, a1, BIT_MASK);
|
||||||
|
test_srlc_and(a0, a1);
|
||||||
|
test_srlv_and(a0, a1, BIT_MASK);
|
||||||
|
test_srac_and(a0, a1);
|
||||||
|
test_srav_and(a0, a1, BIT_MASK);
|
||||||
|
|
||||||
test_pack2(p2, a1);
|
test_pack2(p2, a1);
|
||||||
test_unpack2(a0, p2);
|
test_unpack2(a0, p2);
|
||||||
test_pack2_swap(p2, a1);
|
test_pack2_swap(p2, a1);
|
||||||
|
@ -364,6 +385,60 @@ public class TestShortVect {
|
||||||
errn += verify("test_srav_on: ", i, a0[i], (short)((short)(ADD_INIT+i)>>(-SHIFT)));
|
errn += verify("test_srav_on: ", i, a0[i], (short)((short)(ADD_INIT+i)>>(-SHIFT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_sllc_add(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllc_add: ", i, a0[i], (short)(((short)(ADD_INIT+i) + ADD_INIT)<<VALUE));
|
||||||
|
}
|
||||||
|
test_sllv_add(a0, a1, ADD_INIT);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllv_add: ", i, a0[i], (short)(((short)(ADD_INIT+i) + ADD_INIT)<<VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srlc_add(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlc_add: ", i, a0[i], (short)(((short)(ADD_INIT+i) + ADD_INIT)>>>VALUE));
|
||||||
|
}
|
||||||
|
test_srlv_add(a0, a1, ADD_INIT);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlv_add: ", i, a0[i], (short)(((short)(ADD_INIT+i) + ADD_INIT)>>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srac_add(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srac_add: ", i, a0[i], (short)(((short)(ADD_INIT+i) + ADD_INIT)>>VALUE));
|
||||||
|
}
|
||||||
|
test_srav_add(a0, a1, ADD_INIT);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srav_add: ", i, a0[i], (short)(((short)(ADD_INIT+i) + ADD_INIT)>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_sllc_and(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllc_and: ", i, a0[i], (short)(((short)(ADD_INIT+i) & BIT_MASK)<<VALUE));
|
||||||
|
}
|
||||||
|
test_sllv_and(a0, a1, BIT_MASK);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_sllv_and: ", i, a0[i], (short)(((short)(ADD_INIT+i) & BIT_MASK)<<VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srlc_and(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlc_and: ", i, a0[i], (short)(((short)(ADD_INIT+i) & BIT_MASK)>>>VALUE));
|
||||||
|
}
|
||||||
|
test_srlv_and(a0, a1, BIT_MASK);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srlv_and: ", i, a0[i], (short)(((short)(ADD_INIT+i) & BIT_MASK)>>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
test_srac_and(a0, a1);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srac_and: ", i, a0[i], (short)(((short)(ADD_INIT+i) & BIT_MASK)>>VALUE));
|
||||||
|
}
|
||||||
|
test_srav_and(a0, a1, BIT_MASK);
|
||||||
|
for (int i=0; i<ARRLEN; i++) {
|
||||||
|
errn += verify("test_srav_and: ", i, a0[i], (short)(((short)(ADD_INIT+i) & BIT_MASK)>>VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
test_pack2(p2, a1);
|
test_pack2(p2, a1);
|
||||||
for (int i=0; i<ARRLEN/2; i++) {
|
for (int i=0; i<ARRLEN/2; i++) {
|
||||||
errn += verify("test_pack2: ", i, p2[i], ((int)(ADD_INIT+2*i) & 0xFFFF) | ((int)(ADD_INIT+2*i+1) << 16));
|
errn += verify("test_pack2: ", i, p2[i], ((int)(ADD_INIT+2*i) & 0xFFFF) | ((int)(ADD_INIT+2*i+1) << 16));
|
||||||
|
@ -760,6 +835,84 @@ public class TestShortVect {
|
||||||
end = System.currentTimeMillis();
|
end = System.currentTimeMillis();
|
||||||
System.out.println("test_srav_on: " + (end - start));
|
System.out.println("test_srav_on: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllc_add(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllc_add: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllv_add(a0, a1, ADD_INIT);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllv_add: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlc_add(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlc_add: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlv_add(a0, a1, ADD_INIT);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlv_add: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srac_add(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srac_add: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srav_add(a0, a1, ADD_INIT);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srav_add: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllc_and(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllc_and: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_sllv_and(a0, a1, BIT_MASK);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_sllv_and: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlc_and(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlc_and: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srlv_and(a0, a1, BIT_MASK);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srlv_and: " + (end - start));
|
||||||
|
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srac_and(a0, a1);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srac_and: " + (end - start));
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
for (int i=0; i<ITERS; i++) {
|
||||||
|
test_srav_and(a0, a1, BIT_MASK);
|
||||||
|
}
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
System.out.println("test_srav_and: " + (end - start));
|
||||||
|
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
for (int i=0; i<ITERS; i++) {
|
for (int i=0; i<ITERS; i++) {
|
||||||
test_pack2(p2, a1);
|
test_pack2(p2, a1);
|
||||||
|
@ -968,6 +1121,26 @@ public class TestShortVect {
|
||||||
a0[i] = (short)(a1[i]<<b);
|
a0[i] = (short)(a1[i]<<b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void test_sllc_add(short[] a0, short[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (short)((a1[i] + ADD_INIT)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_sllv_add(short[] a0, short[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (short)((a1[i] + b)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_sllc_and(short[] a0, short[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (short)((a1[i] & BIT_MASK)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_sllv_and(short[] a0, short[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (short)((a1[i] & b)<<VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_srlc(short[] a0, short[] a1) {
|
static void test_srlc(short[] a0, short[] a1) {
|
||||||
for (int i = 0; i < a0.length; i+=1) {
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
@ -994,6 +1167,26 @@ public class TestShortVect {
|
||||||
a0[i] = (short)(a1[i]>>>b);
|
a0[i] = (short)(a1[i]>>>b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void test_srlc_add(short[] a0, short[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (short)((a1[i] + ADD_INIT)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srlv_add(short[] a0, short[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (short)((a1[i] + b)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srlc_and(short[] a0, short[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (short)((a1[i] & BIT_MASK)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srlv_and(short[] a0, short[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (short)((a1[i] & b)>>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_srac(short[] a0, short[] a1) {
|
static void test_srac(short[] a0, short[] a1) {
|
||||||
for (int i = 0; i < a0.length; i+=1) {
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
@ -1020,6 +1213,26 @@ public class TestShortVect {
|
||||||
a0[i] = (short)(a1[i]>>b);
|
a0[i] = (short)(a1[i]>>b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void test_srac_add(short[] a0, short[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (short)((a1[i] + ADD_INIT)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srav_add(short[] a0, short[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (short)((a1[i] + b)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srac_and(short[] a0, short[] a1) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (short)((a1[i] & BIT_MASK)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void test_srav_and(short[] a0, short[] a1, int b) {
|
||||||
|
for (int i = 0; i < a0.length; i+=1) {
|
||||||
|
a0[i] = (short)((a1[i] & b)>>VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_pack2(int[] p2, short[] a1) {
|
static void test_pack2(int[] p2, short[] a1) {
|
||||||
if (p2.length*2 > a1.length) return;
|
if (p2.length*2 > a1.length) return;
|
||||||
|
|
1332
hotspot/test/compiler/8001183/TestCharVect.java
Normal file
1332
hotspot/test/compiler/8001183/TestCharVect.java
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue