< prev index next >

test/jdk/jdk/incubator/vector/LongMaxVectorTests.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

*** 684,718 **** assertArraysEquals(a, b, r, mask, LongMaxVectorTests::xor); } ! static long shiftR(long a, long b) { ! return (long)((a >>> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftRLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); LongVector bv = LongVector.fromArray(SPECIES, b, i); ! av.shiftR(bv).intoArray(r, i); } } ! assertArraysEquals(a, b, r, LongMaxVectorTests::shiftR); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftRLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<boolean[]> fm) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); --- 684,718 ---- assertArraysEquals(a, b, r, mask, LongMaxVectorTests::xor); } ! static long shiftLeft(long a, long b) { ! return (long)((a << b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftLeftLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); LongVector bv = LongVector.fromArray(SPECIES, b, i); ! av.shiftLeft(bv).intoArray(r, i); } } ! assertArraysEquals(a, b, r, LongMaxVectorTests::shiftLeft); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftLeftLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<boolean[]> fm) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length());
*** 720,762 **** for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); LongVector bv = LongVector.fromArray(SPECIES, b, i); ! av.shiftR(bv, vmask).intoArray(r, i); } } ! assertArraysEquals(a, b, r, mask, LongMaxVectorTests::shiftR); } ! static long shiftL(long a, long b) { ! return (long)((a << b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftLLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); LongVector bv = LongVector.fromArray(SPECIES, b, i); ! av.shiftL(bv).intoArray(r, i); } } ! assertArraysEquals(a, b, r, LongMaxVectorTests::shiftL); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftLLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<boolean[]> fm) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); --- 720,766 ---- for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); LongVector bv = LongVector.fromArray(SPECIES, b, i); ! av.shiftLeft(bv, vmask).intoArray(r, i); } } ! assertArraysEquals(a, b, r, mask, LongMaxVectorTests::shiftLeft); } ! ! ! ! ! static long shiftRight(long a, long b) { ! return (long)((a >>> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftRightLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); LongVector bv = LongVector.fromArray(SPECIES, b, i); ! av.shiftRight(bv).intoArray(r, i); } } ! assertArraysEquals(a, b, r, LongMaxVectorTests::shiftRight); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftRightLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<boolean[]> fm) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length());
*** 764,806 **** for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); LongVector bv = LongVector.fromArray(SPECIES, b, i); ! av.shiftL(bv, vmask).intoArray(r, i); } } ! assertArraysEquals(a, b, r, mask, LongMaxVectorTests::shiftL); } ! static long aShiftR(long a, long b) { return (long)((a >> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void aShiftRLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); LongVector bv = LongVector.fromArray(SPECIES, b, i); ! av.aShiftR(bv).intoArray(r, i); } } ! assertArraysEquals(a, b, r, LongMaxVectorTests::aShiftR); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void aShiftRLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<boolean[]> fm) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); --- 768,814 ---- for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); LongVector bv = LongVector.fromArray(SPECIES, b, i); ! av.shiftRight(bv, vmask).intoArray(r, i); } } ! assertArraysEquals(a, b, r, mask, LongMaxVectorTests::shiftRight); } ! ! ! ! ! static long shiftArithmeticRight(long a, long b) { return (long)((a >> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftArithmeticRightLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); LongVector bv = LongVector.fromArray(SPECIES, b, i); ! av.shiftArithmeticRight(bv).intoArray(r, i); } } ! assertArraysEquals(a, b, r, LongMaxVectorTests::shiftArithmeticRight); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftArithmeticRightLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<boolean[]> fm) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length());
*** 808,962 **** for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); LongVector bv = LongVector.fromArray(SPECIES, b, i); ! av.aShiftR(bv, vmask).intoArray(r, i); } } ! assertArraysEquals(a, b, r, mask, LongMaxVectorTests::aShiftR); } ! static long aShiftR_unary(long a, long b) { ! return (long)((a >> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void aShiftRLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! av.aShiftR((int)b[i]).intoArray(r, i); } } ! assertShiftArraysEquals(a, b, r, LongMaxVectorTests::aShiftR_unary); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void aShiftRLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<boolean[]> fm) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! av.aShiftR((int)b[i], vmask).intoArray(r, i); } } ! assertShiftArraysEquals(a, b, r, mask, LongMaxVectorTests::aShiftR_unary); } ! static long shiftR_unary(long a, long b) { return (long)((a >>> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftRLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! av.shiftR((int)b[i]).intoArray(r, i); } } ! assertShiftArraysEquals(a, b, r, LongMaxVectorTests::shiftR_unary); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftRLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<boolean[]> fm) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! av.shiftR((int)b[i], vmask).intoArray(r, i); } } ! assertShiftArraysEquals(a, b, r, mask, LongMaxVectorTests::shiftR_unary); } ! static long shiftL_unary(long a, long b) { ! return (long)((a << b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftLLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! av.shiftL((int)b[i]).intoArray(r, i); } } ! assertShiftArraysEquals(a, b, r, LongMaxVectorTests::shiftL_unary); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftLLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<boolean[]> fm) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! av.shiftL((int)b[i], vmask).intoArray(r, i); } } ! assertShiftArraysEquals(a, b, r, mask, LongMaxVectorTests::shiftL_unary); } - - - - - - - - static long max(long a, long b) { return (long)(Math.max(a, b)); } @Test(dataProvider = "longBinaryOpProvider") --- 816,974 ---- for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); LongVector bv = LongVector.fromArray(SPECIES, b, i); ! av.shiftArithmeticRight(bv, vmask).intoArray(r, i); } } ! assertArraysEquals(a, b, r, mask, LongMaxVectorTests::shiftArithmeticRight); } ! ! ! ! ! static long shiftLeft_unary(long a, long b) { ! return (long)((a << b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftLeftLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! av.shiftLeft((int)b[i]).intoArray(r, i); } } ! assertShiftArraysEquals(a, b, r, LongMaxVectorTests::shiftLeft_unary); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftLeftLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<boolean[]> fm) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! av.shiftLeft((int)b[i], vmask).intoArray(r, i); } } ! assertShiftArraysEquals(a, b, r, mask, LongMaxVectorTests::shiftLeft_unary); } ! ! ! ! ! static long shiftRight_unary(long a, long b) { return (long)((a >>> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftRightLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! av.shiftRight((int)b[i]).intoArray(r, i); } } ! assertShiftArraysEquals(a, b, r, LongMaxVectorTests::shiftRight_unary); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftRightLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<boolean[]> fm) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! av.shiftRight((int)b[i], vmask).intoArray(r, i); } } ! assertShiftArraysEquals(a, b, r, mask, LongMaxVectorTests::shiftRight_unary); } ! ! ! ! ! static long shiftArithmeticRight_unary(long a, long b) { ! return (long)((a >> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftArithmeticRightLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! av.shiftArithmeticRight((int)b[i]).intoArray(r, i); } } ! assertShiftArraysEquals(a, b, r, LongMaxVectorTests::shiftArithmeticRight_unary); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftArithmeticRightLongMaxVectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<boolean[]> fm) { long[] a = fa.apply(SPECIES.length()); long[] b = fb.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask); for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! av.shiftArithmeticRight((int)b[i], vmask).intoArray(r, i); } } ! assertShiftArraysEquals(a, b, r, mask, LongMaxVectorTests::shiftArithmeticRight_unary); } static long max(long a, long b) { return (long)(Math.max(a, b)); } @Test(dataProvider = "longBinaryOpProvider")
*** 994,1013 **** } assertArraysEquals(a, b, r, LongMaxVectorTests::min); } ! static long andAll(long[] a, int idx) { long res = -1; for (int i = idx; i < (idx + SPECIES.length()); i++) { res &= a[i]; } return res; } ! static long andAll(long[] a) { long res = -1; for (int i = 0; i < a.length; i += SPECIES.length()) { long tmp = -1; for (int j = 0; j < SPECIES.length(); j++) { tmp &= a[i + j]; --- 1006,1025 ---- } assertArraysEquals(a, b, r, LongMaxVectorTests::min); } ! static long andLanes(long[] a, int idx) { long res = -1; for (int i = idx; i < (idx + SPECIES.length()); i++) { res &= a[i]; } return res; } ! static long andLanes(long[] a) { long res = -1; for (int i = 0; i < a.length; i += SPECIES.length()) { long tmp = -1; for (int j = 0; j < SPECIES.length(); j++) { tmp &= a[i + j];
*** 1018,1061 **** return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void andAllLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = -1; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.andAll(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = -1; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra &= av.andAll(); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::andAll, LongMaxVectorTests::andAll); } ! static long orAll(long[] a, int idx) { long res = 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { res |= a[i]; } return res; } ! static long orAll(long[] a) { long res = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { long tmp = 0; for (int j = 0; j < SPECIES.length(); j++) { tmp |= a[i + j]; --- 1030,1073 ---- return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void andLanesLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = -1; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.andLanes(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = -1; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra &= av.andLanes(); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::andLanes, LongMaxVectorTests::andLanes); } ! static long orLanes(long[] a, int idx) { long res = 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { res |= a[i]; } return res; } ! static long orLanes(long[] a) { long res = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { long tmp = 0; for (int j = 0; j < SPECIES.length(); j++) { tmp |= a[i + j];
*** 1066,1109 **** return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void orAllLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = 0; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.orAll(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra |= av.orAll(); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::orAll, LongMaxVectorTests::orAll); } ! static long xorAll(long[] a, int idx) { long res = 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { res ^= a[i]; } return res; } ! static long xorAll(long[] a) { long res = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { long tmp = 0; for (int j = 0; j < SPECIES.length(); j++) { tmp ^= a[i + j]; --- 1078,1121 ---- return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void orLanesLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = 0; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.orLanes(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra |= av.orLanes(); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::orLanes, LongMaxVectorTests::orLanes); } ! static long xorLanes(long[] a, int idx) { long res = 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { res ^= a[i]; } return res; } ! static long xorLanes(long[] a) { long res = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { long tmp = 0; for (int j = 0; j < SPECIES.length(); j++) { tmp ^= a[i + j];
*** 1114,1156 **** return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void xorAllLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = 0; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.xorAll(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra ^= av.xorAll(); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::xorAll, LongMaxVectorTests::xorAll); } ! static long addAll(long[] a, int idx) { long res = 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { res += a[i]; } return res; } ! static long addAll(long[] a) { long res = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { long tmp = 0; for (int j = 0; j < SPECIES.length(); j++) { tmp += a[i + j]; --- 1126,1168 ---- return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void xorLanesLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = 0; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.xorLanes(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra ^= av.xorLanes(); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::xorLanes, LongMaxVectorTests::xorLanes); } ! static long addLanes(long[] a, int idx) { long res = 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { res += a[i]; } return res; } ! static long addLanes(long[] a) { long res = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { long tmp = 0; for (int j = 0; j < SPECIES.length(); j++) { tmp += a[i + j];
*** 1159,1200 **** } return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void addAllLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = 0; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.addAll(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra += av.addAll(); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::addAll, LongMaxVectorTests::addAll); } ! static long mulAll(long[] a, int idx) { long res = 1; for (int i = idx; i < (idx + SPECIES.length()); i++) { res *= a[i]; } return res; } ! static long mulAll(long[] a) { long res = 1; for (int i = 0; i < a.length; i += SPECIES.length()) { long tmp = 1; for (int j = 0; j < SPECIES.length(); j++) { tmp *= a[i + j]; --- 1171,1212 ---- } return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void addLanesLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = 0; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.addLanes(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra += av.addLanes(); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::addLanes, LongMaxVectorTests::addLanes); } ! static long mulLanes(long[] a, int idx) { long res = 1; for (int i = idx; i < (idx + SPECIES.length()); i++) { res *= a[i]; } return res; } ! static long mulLanes(long[] a) { long res = 1; for (int i = 0; i < a.length; i += SPECIES.length()) { long tmp = 1; for (int j = 0; j < SPECIES.length(); j++) { tmp *= a[i + j];
*** 1203,1313 **** } return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void mulAllLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = 1; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.mulAll(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = 1; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra *= av.mulAll(); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::mulAll, LongMaxVectorTests::mulAll); } ! static long minAll(long[] a, int idx) { long res = Long.MAX_VALUE; for (int i = idx; i < (idx + SPECIES.length()); i++) { res = (long)Math.min(res, a[i]); } return res; } ! static long minAll(long[] a) { long res = Long.MAX_VALUE; for (int i = 0; i < a.length; i++) { res = (long)Math.min(res, a[i]); } return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void minAllLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = Long.MAX_VALUE; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.minAll(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = Long.MAX_VALUE; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra = (long)Math.min(ra, av.minAll()); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::minAll, LongMaxVectorTests::minAll); } ! static long maxAll(long[] a, int idx) { long res = Long.MIN_VALUE; for (int i = idx; i < (idx + SPECIES.length()); i++) { res = (long)Math.max(res, a[i]); } return res; } ! static long maxAll(long[] a) { long res = Long.MIN_VALUE; for (int i = 0; i < a.length; i++) { res = (long)Math.max(res, a[i]); } return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void maxAllLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = Long.MIN_VALUE; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.maxAll(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = Long.MIN_VALUE; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra = (long)Math.max(ra, av.maxAll()); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::maxAll, LongMaxVectorTests::maxAll); } static boolean anyTrue(boolean[] a, int idx) { boolean res = false; for (int i = idx; i < (idx + SPECIES.length()); i++) { --- 1215,1325 ---- } return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void mulLanesLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = 1; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.mulLanes(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = 1; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra *= av.mulLanes(); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::mulLanes, LongMaxVectorTests::mulLanes); } ! static long minLanes(long[] a, int idx) { long res = Long.MAX_VALUE; for (int i = idx; i < (idx + SPECIES.length()); i++) { res = (long)Math.min(res, a[i]); } return res; } ! static long minLanes(long[] a) { long res = Long.MAX_VALUE; for (int i = 0; i < a.length; i++) { res = (long)Math.min(res, a[i]); } return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void minLanesLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = Long.MAX_VALUE; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.minLanes(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = Long.MAX_VALUE; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra = (long)Math.min(ra, av.minLanes()); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::minLanes, LongMaxVectorTests::minLanes); } ! static long maxLanes(long[] a, int idx) { long res = Long.MIN_VALUE; for (int i = idx; i < (idx + SPECIES.length()); i++) { res = (long)Math.max(res, a[i]); } return res; } ! static long maxLanes(long[] a) { long res = Long.MIN_VALUE; for (int i = 0; i < a.length; i++) { res = (long)Math.max(res, a[i]); } return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void maxLanesLongMaxVectorTests(IntFunction<long[]> fa) { long[] a = fa.apply(SPECIES.length()); long[] r = fr.apply(SPECIES.length()); long ra = Long.MIN_VALUE; for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! r[i] = av.maxLanes(); } } for (int ic = 0; ic < INVOC_COUNT; ic++) { ra = Long.MIN_VALUE; for (int i = 0; i < a.length; i += SPECIES.length()) { LongVector av = LongVector.fromArray(SPECIES, a, i); ! ra = (long)Math.max(ra, av.maxLanes()); } } ! assertReductionArraysEquals(a, r, ra, LongMaxVectorTests::maxLanes, LongMaxVectorTests::maxLanes); } static boolean anyTrue(boolean[] a, int idx) { boolean res = false; for (int i = idx; i < (idx + SPECIES.length()); i++) {
< prev index next >