< prev index next >
test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java
Print this page
rev 55894 : 8222897: [vector] Renaming of shift, rotate operations. Few other api changes.
Summary: Renaming of shift, rotate operations. Few other api changes.
Reviewed-by: jrose, briangoetz
*** 664,810 ****
! static short aShiftR_unary(short a, short b) {
! return (short)((a >> (b & 15)));
}
@Test(dataProvider = "shortBinaryOpProvider")
! static void aShiftRShortMaxVectorTestsShift(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.aShiftR((int)b[i]).intoArray(r, i);
}
}
! assertShiftArraysEquals(a, b, r, ShortMaxVectorTests::aShiftR_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
! static void aShiftRShortMaxVectorTestsShift(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.fromValues(SPECIES, mask);
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.aShiftR((int)b[i], vmask).intoArray(r, i);
}
}
! assertShiftArraysEquals(a, b, r, mask, ShortMaxVectorTests::aShiftR_unary);
}
! static short shiftL_unary(short a, short b) {
return (short)((a << (b & 15)));
}
@Test(dataProvider = "shortBinaryOpProvider")
! static void shiftLShortMaxVectorTestsShift(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.shiftL((int)b[i]).intoArray(r, i);
}
}
! assertShiftArraysEquals(a, b, r, ShortMaxVectorTests::shiftL_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
! static void shiftLShortMaxVectorTestsShift(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.fromValues(SPECIES, mask);
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.shiftL((int)b[i], vmask).intoArray(r, i);
}
}
! assertShiftArraysEquals(a, b, r, mask, ShortMaxVectorTests::shiftL_unary);
}
! static short shiftR_unary(short a, short b) {
return (short)(((a & 0xFFFF) >>> (b & 15)));
}
@Test(dataProvider = "shortBinaryOpProvider")
! static void shiftRShortMaxVectorTestsShift(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.shiftR((int)b[i]).intoArray(r, i);
}
}
! assertShiftArraysEquals(a, b, r, ShortMaxVectorTests::shiftR_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
! static void shiftRShortMaxVectorTestsShift(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.fromValues(SPECIES, mask);
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.shiftR((int)b[i], vmask).intoArray(r, i);
}
}
! assertShiftArraysEquals(a, b, r, mask, ShortMaxVectorTests::shiftR_unary);
}
static short max(short a, short b) {
return (short)(Math.max(a, b));
}
--- 664,948 ----
+ static short shiftLeft(short a, short b) {
+ return (short)((a << (b & 0xF)));
+ }
+ @Test(dataProvider = "shortBinaryOpProvider")
+ static void shiftLeftShortMaxVectorTests(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.shiftLeft(bv).intoArray(r, i);
+ }
+ }
+ assertArraysEquals(a, b, r, ShortMaxVectorTests::shiftLeft);
+ }
+ @Test(dataProvider = "shortBinaryOpMaskProvider")
+ static void shiftLeftShortMaxVectorTests(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.fromValues(SPECIES, mask);
+
+ 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.shiftLeft(bv, vmask).intoArray(r, i);
+ }
+ }
+ assertArraysEquals(a, b, r, mask, ShortMaxVectorTests::shiftLeft);
+ }
+ static short shiftRight(short a, short b) {
+ return (short)((a >>> (b & 0xF)));
+ }
! @Test(dataProvider = "shortBinaryOpProvider")
! static void shiftRightShortMaxVectorTests(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.shiftRight(bv).intoArray(r, i);
! }
! }
!
! assertArraysEquals(a, b, r, ShortMaxVectorTests::shiftRight);
! }
!
!
!
! @Test(dataProvider = "shortBinaryOpMaskProvider")
! static void shiftRightShortMaxVectorTests(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.fromValues(SPECIES, mask);
!
! 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.shiftRight(bv, vmask).intoArray(r, i);
! }
! }
!
! assertArraysEquals(a, b, r, mask, ShortMaxVectorTests::shiftRight);
! }
!
!
!
!
!
!
! static short shiftArithmeticRight(short a, short b) {
! return (short)((a >> (b & 0xF)));
}
@Test(dataProvider = "shortBinaryOpProvider")
! static void shiftArithmeticRightShortMaxVectorTests(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.shiftArithmeticRight(bv).intoArray(r, i);
}
}
! assertArraysEquals(a, b, r, ShortMaxVectorTests::shiftArithmeticRight);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
! static void shiftArithmeticRightShortMaxVectorTests(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.fromValues(SPECIES, mask);
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.shiftArithmeticRight(bv, vmask).intoArray(r, i);
}
}
! assertArraysEquals(a, b, r, mask, ShortMaxVectorTests::shiftArithmeticRight);
}
!
!
!
!
! static short shiftLeft_unary(short a, short b) {
return (short)((a << (b & 15)));
}
@Test(dataProvider = "shortBinaryOpProvider")
! static void shiftLeftShortMaxVectorTestsShift(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.shiftLeft((int)b[i]).intoArray(r, i);
}
}
! assertShiftArraysEquals(a, b, r, ShortMaxVectorTests::shiftLeft_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
! static void shiftLeftShortMaxVectorTestsShift(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.fromValues(SPECIES, mask);
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.shiftLeft((int)b[i], vmask).intoArray(r, i);
}
}
! assertShiftArraysEquals(a, b, r, mask, ShortMaxVectorTests::shiftLeft_unary);
}
!
!
!
!
! static short shiftRight_unary(short a, short b) {
return (short)(((a & 0xFFFF) >>> (b & 15)));
}
@Test(dataProvider = "shortBinaryOpProvider")
! static void shiftRightShortMaxVectorTestsShift(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.shiftRight((int)b[i]).intoArray(r, i);
! }
! }
!
! assertShiftArraysEquals(a, b, r, ShortMaxVectorTests::shiftRight_unary);
! }
!
!
!
! @Test(dataProvider = "shortBinaryOpMaskProvider")
! static void shiftRightShortMaxVectorTestsShift(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.fromValues(SPECIES, mask);
!
! 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.shiftRight((int)b[i], vmask).intoArray(r, i);
! }
! }
!
! assertShiftArraysEquals(a, b, r, mask, ShortMaxVectorTests::shiftRight_unary);
! }
!
!
!
!
!
!
! static short shiftArithmeticRight_unary(short a, short b) {
! return (short)((a >> (b & 15)));
! }
!
! @Test(dataProvider = "shortBinaryOpProvider")
! static void shiftArithmeticRightShortMaxVectorTestsShift(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.shiftArithmeticRight((int)b[i]).intoArray(r, i);
}
}
! assertShiftArraysEquals(a, b, r, ShortMaxVectorTests::shiftArithmeticRight_unary);
}
@Test(dataProvider = "shortBinaryOpMaskProvider")
! static void shiftArithmeticRightShortMaxVectorTestsShift(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.fromValues(SPECIES, mask);
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.shiftArithmeticRight((int)b[i], vmask).intoArray(r, i);
}
}
! assertShiftArraysEquals(a, b, r, mask, ShortMaxVectorTests::shiftArithmeticRight_unary);
}
static short max(short a, short b) {
return (short)(Math.max(a, b));
}
*** 844,863 ****
}
assertArraysEquals(a, b, r, ShortMaxVectorTests::min);
}
! static short andAll(short[] a, int idx) {
short res = -1;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res &= a[i];
}
return res;
}
! static short andAll(short[] a) {
short res = -1;
for (int i = 0; i < a.length; i += SPECIES.length()) {
short tmp = -1;
for (int j = 0; j < SPECIES.length(); j++) {
tmp &= a[i + j];
--- 982,1001 ----
}
assertArraysEquals(a, b, r, ShortMaxVectorTests::min);
}
! static short andLanes(short[] a, int idx) {
short res = -1;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res &= a[i];
}
return res;
}
! static short andLanes(short[] a) {
short res = -1;
for (int i = 0; i < a.length; i += SPECIES.length()) {
short tmp = -1;
for (int j = 0; j < SPECIES.length(); j++) {
tmp &= a[i + j];
*** 868,911 ****
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void andAllShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = -1;
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);
! r[i] = av.andAll();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = -1;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra &= av.andAll();
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::andAll, ShortMaxVectorTests::andAll);
}
! static short orAll(short[] a, int idx) {
short res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res |= a[i];
}
return res;
}
! static short orAll(short[] a) {
short res = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
short tmp = 0;
for (int j = 0; j < SPECIES.length(); j++) {
tmp |= a[i + j];
--- 1006,1049 ----
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void andLanesShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = -1;
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);
! r[i] = av.andLanes();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = -1;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra &= av.andLanes();
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::andLanes, ShortMaxVectorTests::andLanes);
}
! static short orLanes(short[] a, int idx) {
short res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res |= a[i];
}
return res;
}
! static short orLanes(short[] a) {
short res = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
short tmp = 0;
for (int j = 0; j < SPECIES.length(); j++) {
tmp |= a[i + j];
*** 916,959 ****
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void orAllShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = 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);
! r[i] = av.orAll();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra |= av.orAll();
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::orAll, ShortMaxVectorTests::orAll);
}
! static short xorAll(short[] a, int idx) {
short res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res ^= a[i];
}
return res;
}
! static short xorAll(short[] a) {
short res = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
short tmp = 0;
for (int j = 0; j < SPECIES.length(); j++) {
tmp ^= a[i + j];
--- 1054,1097 ----
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void orLanesShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = 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);
! r[i] = av.orLanes();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra |= av.orLanes();
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::orLanes, ShortMaxVectorTests::orLanes);
}
! static short xorLanes(short[] a, int idx) {
short res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res ^= a[i];
}
return res;
}
! static short xorLanes(short[] a) {
short res = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
short tmp = 0;
for (int j = 0; j < SPECIES.length(); j++) {
tmp ^= a[i + j];
*** 964,1006 ****
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void xorAllShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = 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);
! r[i] = av.xorAll();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra ^= av.xorAll();
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::xorAll, ShortMaxVectorTests::xorAll);
}
! static short addAll(short[] a, int idx) {
short res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res += a[i];
}
return res;
}
! static short addAll(short[] a) {
short res = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
short tmp = 0;
for (int j = 0; j < SPECIES.length(); j++) {
tmp += a[i + j];
--- 1102,1144 ----
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void xorLanesShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = 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);
! r[i] = av.xorLanes();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra ^= av.xorLanes();
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::xorLanes, ShortMaxVectorTests::xorLanes);
}
! static short addLanes(short[] a, int idx) {
short res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res += a[i];
}
return res;
}
! static short addLanes(short[] a) {
short res = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
short tmp = 0;
for (int j = 0; j < SPECIES.length(); j++) {
tmp += a[i + j];
*** 1009,1050 ****
}
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void addAllShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = 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);
! r[i] = av.addAll();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra += av.addAll();
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::addAll, ShortMaxVectorTests::addAll);
}
! static short mulAll(short[] a, int idx) {
short res = 1;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res *= a[i];
}
return res;
}
! static short mulAll(short[] a) {
short res = 1;
for (int i = 0; i < a.length; i += SPECIES.length()) {
short tmp = 1;
for (int j = 0; j < SPECIES.length(); j++) {
tmp *= a[i + j];
--- 1147,1188 ----
}
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void addLanesShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = 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);
! r[i] = av.addLanes();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra += av.addLanes();
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::addLanes, ShortMaxVectorTests::addLanes);
}
! static short mulLanes(short[] a, int idx) {
short res = 1;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res *= a[i];
}
return res;
}
! static short mulLanes(short[] a) {
short res = 1;
for (int i = 0; i < a.length; i += SPECIES.length()) {
short tmp = 1;
for (int j = 0; j < SPECIES.length(); j++) {
tmp *= a[i + j];
*** 1053,1163 ****
}
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void mulAllShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = 1;
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);
! r[i] = av.mulAll();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = 1;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra *= av.mulAll();
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::mulAll, ShortMaxVectorTests::mulAll);
}
! static short minAll(short[] a, int idx) {
short res = Short.MAX_VALUE;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res = (short)Math.min(res, a[i]);
}
return res;
}
! static short minAll(short[] a) {
short res = Short.MAX_VALUE;
for (int i = 0; i < a.length; i++) {
res = (short)Math.min(res, a[i]);
}
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void minAllShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = Short.MAX_VALUE;
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);
! r[i] = av.minAll();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = Short.MAX_VALUE;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra = (short)Math.min(ra, av.minAll());
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::minAll, ShortMaxVectorTests::minAll);
}
! static short maxAll(short[] a, int idx) {
short res = Short.MIN_VALUE;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res = (short)Math.max(res, a[i]);
}
return res;
}
! static short maxAll(short[] a) {
short res = Short.MIN_VALUE;
for (int i = 0; i < a.length; i++) {
res = (short)Math.max(res, a[i]);
}
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void maxAllShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = Short.MIN_VALUE;
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);
! r[i] = av.maxAll();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = Short.MIN_VALUE;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra = (short)Math.max(ra, av.maxAll());
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::maxAll, ShortMaxVectorTests::maxAll);
}
static boolean anyTrue(boolean[] a, int idx) {
boolean res = false;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
--- 1191,1301 ----
}
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void mulLanesShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = 1;
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);
! r[i] = av.mulLanes();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = 1;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra *= av.mulLanes();
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::mulLanes, ShortMaxVectorTests::mulLanes);
}
! static short minLanes(short[] a, int idx) {
short res = Short.MAX_VALUE;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res = (short)Math.min(res, a[i]);
}
return res;
}
! static short minLanes(short[] a) {
short res = Short.MAX_VALUE;
for (int i = 0; i < a.length; i++) {
res = (short)Math.min(res, a[i]);
}
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void minLanesShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = Short.MAX_VALUE;
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);
! r[i] = av.minLanes();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = Short.MAX_VALUE;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra = (short)Math.min(ra, av.minLanes());
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::minLanes, ShortMaxVectorTests::minLanes);
}
! static short maxLanes(short[] a, int idx) {
short res = Short.MIN_VALUE;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res = (short)Math.max(res, a[i]);
}
return res;
}
! static short maxLanes(short[] a) {
short res = Short.MIN_VALUE;
for (int i = 0; i < a.length; i++) {
res = (short)Math.max(res, a[i]);
}
return res;
}
@Test(dataProvider = "shortUnaryOpProvider")
! static void maxLanesShortMaxVectorTests(IntFunction<short[]> fa) {
short[] a = fa.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
short ra = Short.MIN_VALUE;
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);
! r[i] = av.maxLanes();
}
}
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = Short.MIN_VALUE;
for (int i = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
! ra = (short)Math.max(ra, av.maxLanes());
}
}
! assertReductionArraysEquals(a, r, ra, ShortMaxVectorTests::maxLanes, ShortMaxVectorTests::maxLanes);
}
static boolean anyTrue(boolean[] a, int idx) {
boolean res = false;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
< prev index next >