< prev index next >

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

*** 660,806 **** ! static short aShiftR_unary(short a, short b) { ! return (short)((a >> (b & 15))); } @Test(dataProvider = "shortBinaryOpProvider") ! static void aShiftRShort512VectorTestsShift(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, Short512VectorTests::aShiftR_unary); } @Test(dataProvider = "shortBinaryOpMaskProvider") ! static void aShiftRShort512VectorTestsShift(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, Short512VectorTests::aShiftR_unary); } ! static short shiftL_unary(short a, short b) { return (short)((a << (b & 15))); } @Test(dataProvider = "shortBinaryOpProvider") ! static void shiftLShort512VectorTestsShift(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, Short512VectorTests::shiftL_unary); } @Test(dataProvider = "shortBinaryOpMaskProvider") ! static void shiftLShort512VectorTestsShift(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, Short512VectorTests::shiftL_unary); } ! static short shiftR_unary(short a, short b) { return (short)(((a & 0xFFFF) >>> (b & 15))); } @Test(dataProvider = "shortBinaryOpProvider") ! static void shiftRShort512VectorTestsShift(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, Short512VectorTests::shiftR_unary); } @Test(dataProvider = "shortBinaryOpMaskProvider") ! static void shiftRShort512VectorTestsShift(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, Short512VectorTests::shiftR_unary); } static short max(short a, short b) { return (short)(Math.max(a, b)); } --- 660,944 ---- + static short shiftLeft(short a, short b) { + return (short)((a << (b & 0xF))); + } + @Test(dataProvider = "shortBinaryOpProvider") + static void shiftLeftShort512VectorTests(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, Short512VectorTests::shiftLeft); + } + @Test(dataProvider = "shortBinaryOpMaskProvider") + static void shiftLeftShort512VectorTests(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, Short512VectorTests::shiftLeft); + } + static short shiftRight(short a, short b) { + return (short)((a >>> (b & 0xF))); + } ! @Test(dataProvider = "shortBinaryOpProvider") ! static void shiftRightShort512VectorTests(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, Short512VectorTests::shiftRight); ! } ! ! ! ! @Test(dataProvider = "shortBinaryOpMaskProvider") ! static void shiftRightShort512VectorTests(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, Short512VectorTests::shiftRight); ! } ! ! ! ! ! ! ! static short shiftArithmeticRight(short a, short b) { ! return (short)((a >> (b & 0xF))); } @Test(dataProvider = "shortBinaryOpProvider") ! static void shiftArithmeticRightShort512VectorTests(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, Short512VectorTests::shiftArithmeticRight); } @Test(dataProvider = "shortBinaryOpMaskProvider") ! static void shiftArithmeticRightShort512VectorTests(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, Short512VectorTests::shiftArithmeticRight); } ! ! ! ! ! static short shiftLeft_unary(short a, short b) { return (short)((a << (b & 15))); } @Test(dataProvider = "shortBinaryOpProvider") ! static void shiftLeftShort512VectorTestsShift(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, Short512VectorTests::shiftLeft_unary); } @Test(dataProvider = "shortBinaryOpMaskProvider") ! static void shiftLeftShort512VectorTestsShift(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, Short512VectorTests::shiftLeft_unary); } ! ! ! ! ! static short shiftRight_unary(short a, short b) { return (short)(((a & 0xFFFF) >>> (b & 15))); } @Test(dataProvider = "shortBinaryOpProvider") ! static void shiftRightShort512VectorTestsShift(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, Short512VectorTests::shiftRight_unary); ! } ! ! ! ! @Test(dataProvider = "shortBinaryOpMaskProvider") ! static void shiftRightShort512VectorTestsShift(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, Short512VectorTests::shiftRight_unary); ! } ! ! ! ! ! ! ! static short shiftArithmeticRight_unary(short a, short b) { ! return (short)((a >> (b & 15))); ! } ! ! @Test(dataProvider = "shortBinaryOpProvider") ! static void shiftArithmeticRightShort512VectorTestsShift(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, Short512VectorTests::shiftArithmeticRight_unary); } @Test(dataProvider = "shortBinaryOpMaskProvider") ! static void shiftArithmeticRightShort512VectorTestsShift(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, Short512VectorTests::shiftArithmeticRight_unary); } static short max(short a, short b) { return (short)(Math.max(a, b)); }
*** 840,859 **** } assertArraysEquals(a, b, r, Short512VectorTests::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]; --- 978,997 ---- } assertArraysEquals(a, b, r, Short512VectorTests::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];
*** 864,907 **** return res; } @Test(dataProvider = "shortUnaryOpProvider") ! static void andAllShort512VectorTests(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, Short512VectorTests::andAll, Short512VectorTests::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]; --- 1002,1045 ---- return res; } @Test(dataProvider = "shortUnaryOpProvider") ! static void andLanesShort512VectorTests(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, Short512VectorTests::andLanes, Short512VectorTests::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];
*** 912,955 **** return res; } @Test(dataProvider = "shortUnaryOpProvider") ! static void orAllShort512VectorTests(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, Short512VectorTests::orAll, Short512VectorTests::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]; --- 1050,1093 ---- return res; } @Test(dataProvider = "shortUnaryOpProvider") ! static void orLanesShort512VectorTests(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, Short512VectorTests::orLanes, Short512VectorTests::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];
*** 960,1002 **** return res; } @Test(dataProvider = "shortUnaryOpProvider") ! static void xorAllShort512VectorTests(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, Short512VectorTests::xorAll, Short512VectorTests::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]; --- 1098,1140 ---- return res; } @Test(dataProvider = "shortUnaryOpProvider") ! static void xorLanesShort512VectorTests(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, Short512VectorTests::xorLanes, Short512VectorTests::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];
*** 1005,1046 **** } return res; } @Test(dataProvider = "shortUnaryOpProvider") ! static void addAllShort512VectorTests(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, Short512VectorTests::addAll, Short512VectorTests::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]; --- 1143,1184 ---- } return res; } @Test(dataProvider = "shortUnaryOpProvider") ! static void addLanesShort512VectorTests(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, Short512VectorTests::addLanes, Short512VectorTests::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];
*** 1049,1159 **** } return res; } @Test(dataProvider = "shortUnaryOpProvider") ! static void mulAllShort512VectorTests(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, Short512VectorTests::mulAll, Short512VectorTests::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 minAllShort512VectorTests(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, Short512VectorTests::minAll, Short512VectorTests::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 maxAllShort512VectorTests(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, Short512VectorTests::maxAll, Short512VectorTests::maxAll); } static boolean anyTrue(boolean[] a, int idx) { boolean res = false; for (int i = idx; i < (idx + SPECIES.length()); i++) { --- 1187,1297 ---- } return res; } @Test(dataProvider = "shortUnaryOpProvider") ! static void mulLanesShort512VectorTests(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, Short512VectorTests::mulLanes, Short512VectorTests::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 minLanesShort512VectorTests(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, Short512VectorTests::minLanes, Short512VectorTests::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 maxLanesShort512VectorTests(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, Short512VectorTests::maxLanes, Short512VectorTests::maxLanes); } static boolean anyTrue(boolean[] a, int idx) { boolean res = false; for (int i = idx; i < (idx + SPECIES.length()); i++) {
< prev index next >