< prev index next >

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

*** 680,714 **** assertArraysEquals(a, b, r, mask, Long128VectorTests::xor); } ! static long shiftR(long a, long b) { ! return (long)((a >>> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftRLong128VectorTests(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, Long128VectorTests::shiftR); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftRLong128VectorTests(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()); --- 680,714 ---- assertArraysEquals(a, b, r, mask, Long128VectorTests::xor); } ! static long shiftLeft(long a, long b) { ! return (long)((a << b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftLeftLong128VectorTests(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, Long128VectorTests::shiftLeft); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftLeftLong128VectorTests(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());
*** 716,758 **** 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, Long128VectorTests::shiftR); } ! static long shiftL(long a, long b) { ! return (long)((a << b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftLLong128VectorTests(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, Long128VectorTests::shiftL); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftLLong128VectorTests(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()); --- 716,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.shiftLeft(bv, vmask).intoArray(r, i); } } ! assertArraysEquals(a, b, r, mask, Long128VectorTests::shiftLeft); } ! ! ! ! ! static long shiftRight(long a, long b) { ! return (long)((a >>> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftRightLong128VectorTests(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, Long128VectorTests::shiftRight); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftRightLong128VectorTests(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());
*** 760,802 **** 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, Long128VectorTests::shiftL); } ! static long aShiftR(long a, long b) { return (long)((a >> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void aShiftRLong128VectorTests(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, Long128VectorTests::aShiftR); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void aShiftRLong128VectorTests(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,810 ---- 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, Long128VectorTests::shiftRight); } ! ! ! ! ! static long shiftArithmeticRight(long a, long b) { return (long)((a >> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftArithmeticRightLong128VectorTests(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, Long128VectorTests::shiftArithmeticRight); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftArithmeticRightLong128VectorTests(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());
*** 804,958 **** 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, Long128VectorTests::aShiftR); } ! static long aShiftR_unary(long a, long b) { ! return (long)((a >> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void aShiftRLong128VectorTestsShift(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, Long128VectorTests::aShiftR_unary); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void aShiftRLong128VectorTestsShift(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, Long128VectorTests::aShiftR_unary); } ! static long shiftR_unary(long a, long b) { return (long)((a >>> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftRLong128VectorTestsShift(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, Long128VectorTests::shiftR_unary); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftRLong128VectorTestsShift(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, Long128VectorTests::shiftR_unary); } ! static long shiftL_unary(long a, long b) { ! return (long)((a << b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftLLong128VectorTestsShift(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, Long128VectorTests::shiftL_unary); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftLLong128VectorTestsShift(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, Long128VectorTests::shiftL_unary); } - - - - - - - - static long max(long a, long b) { return (long)(Math.max(a, b)); } @Test(dataProvider = "longBinaryOpProvider") --- 812,970 ---- 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, Long128VectorTests::shiftArithmeticRight); } ! ! ! ! ! static long shiftLeft_unary(long a, long b) { ! return (long)((a << b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftLeftLong128VectorTestsShift(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, Long128VectorTests::shiftLeft_unary); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftLeftLong128VectorTestsShift(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, Long128VectorTests::shiftLeft_unary); } ! ! ! ! ! static long shiftRight_unary(long a, long b) { return (long)((a >>> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftRightLong128VectorTestsShift(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, Long128VectorTests::shiftRight_unary); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftRightLong128VectorTestsShift(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, Long128VectorTests::shiftRight_unary); } ! ! ! ! ! static long shiftArithmeticRight_unary(long a, long b) { ! return (long)((a >> b)); } @Test(dataProvider = "longBinaryOpProvider") ! static void shiftArithmeticRightLong128VectorTestsShift(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, Long128VectorTests::shiftArithmeticRight_unary); } @Test(dataProvider = "longBinaryOpMaskProvider") ! static void shiftArithmeticRightLong128VectorTestsShift(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, Long128VectorTests::shiftArithmeticRight_unary); } static long max(long a, long b) { return (long)(Math.max(a, b)); } @Test(dataProvider = "longBinaryOpProvider")
*** 990,1009 **** } assertArraysEquals(a, b, r, Long128VectorTests::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]; --- 1002,1021 ---- } assertArraysEquals(a, b, r, Long128VectorTests::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];
*** 1014,1057 **** return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void andAllLong128VectorTests(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, Long128VectorTests::andAll, Long128VectorTests::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]; --- 1026,1069 ---- return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void andLanesLong128VectorTests(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, Long128VectorTests::andLanes, Long128VectorTests::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];
*** 1062,1105 **** return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void orAllLong128VectorTests(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, Long128VectorTests::orAll, Long128VectorTests::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]; --- 1074,1117 ---- return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void orLanesLong128VectorTests(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, Long128VectorTests::orLanes, Long128VectorTests::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];
*** 1110,1152 **** return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void xorAllLong128VectorTests(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, Long128VectorTests::xorAll, Long128VectorTests::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]; --- 1122,1164 ---- return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void xorLanesLong128VectorTests(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, Long128VectorTests::xorLanes, Long128VectorTests::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];
*** 1155,1196 **** } return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void addAllLong128VectorTests(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, Long128VectorTests::addAll, Long128VectorTests::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]; --- 1167,1208 ---- } return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void addLanesLong128VectorTests(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, Long128VectorTests::addLanes, Long128VectorTests::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];
*** 1199,1309 **** } return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void mulAllLong128VectorTests(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, Long128VectorTests::mulAll, Long128VectorTests::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 minAllLong128VectorTests(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, Long128VectorTests::minAll, Long128VectorTests::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 maxAllLong128VectorTests(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, Long128VectorTests::maxAll, Long128VectorTests::maxAll); } static boolean anyTrue(boolean[] a, int idx) { boolean res = false; for (int i = idx; i < (idx + SPECIES.length()); i++) { --- 1211,1321 ---- } return res; } @Test(dataProvider = "longUnaryOpProvider") ! static void mulLanesLong128VectorTests(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, Long128VectorTests::mulLanes, Long128VectorTests::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 minLanesLong128VectorTests(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, Long128VectorTests::minLanes, Long128VectorTests::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 maxLanesLong128VectorTests(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, Long128VectorTests::maxLanes, Long128VectorTests::maxLanes); } static boolean anyTrue(boolean[] a, int idx) { boolean res = false; for (int i = idx; i < (idx + SPECIES.length()); i++) {
< prev index next >