--- old/test/jdk/jdk/incubator/vector/Short64VectorTests.java 2019-04-26 14:54:32.181022600 -0700 +++ new/test/jdk/jdk/incubator/vector/Short64VectorTests.java 2019-04-26 14:54:31.591576800 -0700 @@ -662,26 +662,108 @@ + static short shiftLeft(short a, short b) { + return (short)((a << (b & 0xF))); + } + @Test(dataProvider = "shortBinaryOpProvider") + static void shiftLeftShort64VectorTests(IntFunction fa, IntFunction 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, Short64VectorTests::shiftLeft); + } + @Test(dataProvider = "shortBinaryOpMaskProvider") + static void shiftLeftShort64VectorTests(IntFunction fa, IntFunction fb, + IntFunction 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 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, Short64VectorTests::shiftLeft); + } + static short shiftRight(short a, short b) { + return (short)((a >>> (b & 0xF))); + } - static short aShiftR_unary(short a, short b) { - return (short)((a >> (b & 15))); + @Test(dataProvider = "shortBinaryOpProvider") + static void shiftRightShort64VectorTests(IntFunction fa, IntFunction 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, Short64VectorTests::shiftRight); + } + + + + @Test(dataProvider = "shortBinaryOpMaskProvider") + static void shiftRightShort64VectorTests(IntFunction fa, IntFunction fb, + IntFunction 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 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, Short64VectorTests::shiftRight); + } + + + + + + + static short shiftArithmeticRight(short a, short b) { + return (short)((a >> (b & 0xF))); } @Test(dataProvider = "shortBinaryOpProvider") - static void aShiftRShort64VectorTestsShift(IntFunction fa, IntFunction fb) { + static void shiftArithmeticRightShort64VectorTests(IntFunction fa, IntFunction fb) { short[] a = fa.apply(SPECIES.length()); short[] b = fb.apply(SPECIES.length()); short[] r = fr.apply(SPECIES.length()); @@ -689,17 +771,18 @@ 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); + ShortVector bv = ShortVector.fromArray(SPECIES, b, i); + av.shiftArithmeticRight(bv).intoArray(r, i); } } - assertShiftArraysEquals(a, b, r, Short64VectorTests::aShiftR_unary); + assertArraysEquals(a, b, r, Short64VectorTests::shiftArithmeticRight); } @Test(dataProvider = "shortBinaryOpMaskProvider") - static void aShiftRShort64VectorTestsShift(IntFunction fa, IntFunction fb, + static void shiftArithmeticRightShort64VectorTests(IntFunction fa, IntFunction fb, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); short[] b = fb.apply(SPECIES.length()); @@ -710,20 +793,25 @@ 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); + ShortVector bv = ShortVector.fromArray(SPECIES, b, i); + av.shiftArithmeticRight(bv, vmask).intoArray(r, i); } } - assertShiftArraysEquals(a, b, r, mask, Short64VectorTests::aShiftR_unary); + assertArraysEquals(a, b, r, mask, Short64VectorTests::shiftArithmeticRight); } - static short shiftL_unary(short a, short b) { + + + + + static short shiftLeft_unary(short a, short b) { return (short)((a << (b & 15))); } @Test(dataProvider = "shortBinaryOpProvider") - static void shiftLShort64VectorTestsShift(IntFunction fa, IntFunction fb) { + static void shiftLeftShort64VectorTestsShift(IntFunction fa, IntFunction fb) { short[] a = fa.apply(SPECIES.length()); short[] b = fb.apply(SPECIES.length()); short[] r = fr.apply(SPECIES.length()); @@ -731,17 +819,17 @@ 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); + av.shiftLeft((int)b[i]).intoArray(r, i); } } - assertShiftArraysEquals(a, b, r, Short64VectorTests::shiftL_unary); + assertShiftArraysEquals(a, b, r, Short64VectorTests::shiftLeft_unary); } @Test(dataProvider = "shortBinaryOpMaskProvider") - static void shiftLShort64VectorTestsShift(IntFunction fa, IntFunction fb, + static void shiftLeftShort64VectorTestsShift(IntFunction fa, IntFunction fb, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); short[] b = fb.apply(SPECIES.length()); @@ -752,20 +840,70 @@ 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); + av.shiftLeft((int)b[i], vmask).intoArray(r, i); } } - assertShiftArraysEquals(a, b, r, mask, Short64VectorTests::shiftL_unary); + assertShiftArraysEquals(a, b, r, mask, Short64VectorTests::shiftLeft_unary); } - static short shiftR_unary(short a, short b) { + + + + + static short shiftRight_unary(short a, short b) { return (short)(((a & 0xFFFF) >>> (b & 15))); } @Test(dataProvider = "shortBinaryOpProvider") - static void shiftRShort64VectorTestsShift(IntFunction fa, IntFunction fb) { + static void shiftRightShort64VectorTestsShift(IntFunction fa, IntFunction 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, Short64VectorTests::shiftRight_unary); + } + + + + @Test(dataProvider = "shortBinaryOpMaskProvider") + static void shiftRightShort64VectorTestsShift(IntFunction fa, IntFunction fb, + IntFunction 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 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, Short64VectorTests::shiftRight_unary); + } + + + + + + + static short shiftArithmeticRight_unary(short a, short b) { + return (short)((a >> (b & 15))); + } + + @Test(dataProvider = "shortBinaryOpProvider") + static void shiftArithmeticRightShort64VectorTestsShift(IntFunction fa, IntFunction fb) { short[] a = fa.apply(SPECIES.length()); short[] b = fb.apply(SPECIES.length()); short[] r = fr.apply(SPECIES.length()); @@ -773,17 +911,17 @@ 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); + av.shiftArithmeticRight((int)b[i]).intoArray(r, i); } } - assertShiftArraysEquals(a, b, r, Short64VectorTests::shiftR_unary); + assertShiftArraysEquals(a, b, r, Short64VectorTests::shiftArithmeticRight_unary); } @Test(dataProvider = "shortBinaryOpMaskProvider") - static void shiftRShort64VectorTestsShift(IntFunction fa, IntFunction fb, + static void shiftArithmeticRightShort64VectorTestsShift(IntFunction fa, IntFunction fb, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); short[] b = fb.apply(SPECIES.length()); @@ -794,11 +932,11 @@ 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); + av.shiftArithmeticRight((int)b[i], vmask).intoArray(r, i); } } - assertShiftArraysEquals(a, b, r, mask, Short64VectorTests::shiftR_unary); + assertShiftArraysEquals(a, b, r, mask, Short64VectorTests::shiftArithmeticRight_unary); } static short max(short a, short b) { @@ -842,7 +980,7 @@ assertArraysEquals(a, b, r, Short64VectorTests::min); } - static short andAll(short[] a, int idx) { + static short andLanes(short[] a, int idx) { short res = -1; for (int i = idx; i < (idx + SPECIES.length()); i++) { res &= a[i]; @@ -851,7 +989,7 @@ return res; } - static short andAll(short[] a) { + static short andLanes(short[] a) { short res = -1; for (int i = 0; i < a.length; i += SPECIES.length()) { short tmp = -1; @@ -866,7 +1004,7 @@ @Test(dataProvider = "shortUnaryOpProvider") - static void andAllShort64VectorTests(IntFunction fa) { + static void andLanesShort64VectorTests(IntFunction fa) { short[] a = fa.apply(SPECIES.length()); short[] r = fr.apply(SPECIES.length()); short ra = -1; @@ -874,7 +1012,7 @@ 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(); + r[i] = av.andLanes(); } } @@ -882,15 +1020,15 @@ ra = -1; for (int i = 0; i < a.length; i += SPECIES.length()) { ShortVector av = ShortVector.fromArray(SPECIES, a, i); - ra &= av.andAll(); + ra &= av.andLanes(); } } - assertReductionArraysEquals(a, r, ra, Short64VectorTests::andAll, Short64VectorTests::andAll); + assertReductionArraysEquals(a, r, ra, Short64VectorTests::andLanes, Short64VectorTests::andLanes); } - static short orAll(short[] a, int idx) { + static short orLanes(short[] a, int idx) { short res = 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { res |= a[i]; @@ -899,7 +1037,7 @@ return res; } - static short orAll(short[] a) { + static short orLanes(short[] a) { short res = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { short tmp = 0; @@ -914,7 +1052,7 @@ @Test(dataProvider = "shortUnaryOpProvider") - static void orAllShort64VectorTests(IntFunction fa) { + static void orLanesShort64VectorTests(IntFunction fa) { short[] a = fa.apply(SPECIES.length()); short[] r = fr.apply(SPECIES.length()); short ra = 0; @@ -922,7 +1060,7 @@ 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(); + r[i] = av.orLanes(); } } @@ -930,15 +1068,15 @@ ra = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { ShortVector av = ShortVector.fromArray(SPECIES, a, i); - ra |= av.orAll(); + ra |= av.orLanes(); } } - assertReductionArraysEquals(a, r, ra, Short64VectorTests::orAll, Short64VectorTests::orAll); + assertReductionArraysEquals(a, r, ra, Short64VectorTests::orLanes, Short64VectorTests::orLanes); } - static short xorAll(short[] a, int idx) { + static short xorLanes(short[] a, int idx) { short res = 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { res ^= a[i]; @@ -947,7 +1085,7 @@ return res; } - static short xorAll(short[] a) { + static short xorLanes(short[] a) { short res = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { short tmp = 0; @@ -962,7 +1100,7 @@ @Test(dataProvider = "shortUnaryOpProvider") - static void xorAllShort64VectorTests(IntFunction fa) { + static void xorLanesShort64VectorTests(IntFunction fa) { short[] a = fa.apply(SPECIES.length()); short[] r = fr.apply(SPECIES.length()); short ra = 0; @@ -970,7 +1108,7 @@ 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(); + r[i] = av.xorLanes(); } } @@ -978,14 +1116,14 @@ ra = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { ShortVector av = ShortVector.fromArray(SPECIES, a, i); - ra ^= av.xorAll(); + ra ^= av.xorLanes(); } } - assertReductionArraysEquals(a, r, ra, Short64VectorTests::xorAll, Short64VectorTests::xorAll); + assertReductionArraysEquals(a, r, ra, Short64VectorTests::xorLanes, Short64VectorTests::xorLanes); } - static short addAll(short[] a, int idx) { + static short addLanes(short[] a, int idx) { short res = 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { res += a[i]; @@ -994,7 +1132,7 @@ return res; } - static short addAll(short[] a) { + static short addLanes(short[] a) { short res = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { short tmp = 0; @@ -1007,7 +1145,7 @@ return res; } @Test(dataProvider = "shortUnaryOpProvider") - static void addAllShort64VectorTests(IntFunction fa) { + static void addLanesShort64VectorTests(IntFunction fa) { short[] a = fa.apply(SPECIES.length()); short[] r = fr.apply(SPECIES.length()); short ra = 0; @@ -1015,7 +1153,7 @@ 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(); + r[i] = av.addLanes(); } } @@ -1023,13 +1161,13 @@ ra = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { ShortVector av = ShortVector.fromArray(SPECIES, a, i); - ra += av.addAll(); + ra += av.addLanes(); } } - assertReductionArraysEquals(a, r, ra, Short64VectorTests::addAll, Short64VectorTests::addAll); + assertReductionArraysEquals(a, r, ra, Short64VectorTests::addLanes, Short64VectorTests::addLanes); } - static short mulAll(short[] a, int idx) { + static short mulLanes(short[] a, int idx) { short res = 1; for (int i = idx; i < (idx + SPECIES.length()); i++) { res *= a[i]; @@ -1038,7 +1176,7 @@ return res; } - static short mulAll(short[] a) { + static short mulLanes(short[] a) { short res = 1; for (int i = 0; i < a.length; i += SPECIES.length()) { short tmp = 1; @@ -1051,7 +1189,7 @@ return res; } @Test(dataProvider = "shortUnaryOpProvider") - static void mulAllShort64VectorTests(IntFunction fa) { + static void mulLanesShort64VectorTests(IntFunction fa) { short[] a = fa.apply(SPECIES.length()); short[] r = fr.apply(SPECIES.length()); short ra = 1; @@ -1059,7 +1197,7 @@ 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(); + r[i] = av.mulLanes(); } } @@ -1067,13 +1205,13 @@ ra = 1; for (int i = 0; i < a.length; i += SPECIES.length()) { ShortVector av = ShortVector.fromArray(SPECIES, a, i); - ra *= av.mulAll(); + ra *= av.mulLanes(); } } - assertReductionArraysEquals(a, r, ra, Short64VectorTests::mulAll, Short64VectorTests::mulAll); + assertReductionArraysEquals(a, r, ra, Short64VectorTests::mulLanes, Short64VectorTests::mulLanes); } - static short minAll(short[] a, int idx) { + 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]); @@ -1082,7 +1220,7 @@ return res; } - static short minAll(short[] a) { + 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]); @@ -1091,7 +1229,7 @@ return res; } @Test(dataProvider = "shortUnaryOpProvider") - static void minAllShort64VectorTests(IntFunction fa) { + static void minLanesShort64VectorTests(IntFunction fa) { short[] a = fa.apply(SPECIES.length()); short[] r = fr.apply(SPECIES.length()); short ra = Short.MAX_VALUE; @@ -1099,7 +1237,7 @@ 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(); + r[i] = av.minLanes(); } } @@ -1107,13 +1245,13 @@ 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()); + ra = (short)Math.min(ra, av.minLanes()); } } - assertReductionArraysEquals(a, r, ra, Short64VectorTests::minAll, Short64VectorTests::minAll); + assertReductionArraysEquals(a, r, ra, Short64VectorTests::minLanes, Short64VectorTests::minLanes); } - static short maxAll(short[] a, int idx) { + 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]); @@ -1122,7 +1260,7 @@ return res; } - static short maxAll(short[] a) { + 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]); @@ -1131,7 +1269,7 @@ return res; } @Test(dataProvider = "shortUnaryOpProvider") - static void maxAllShort64VectorTests(IntFunction fa) { + static void maxLanesShort64VectorTests(IntFunction fa) { short[] a = fa.apply(SPECIES.length()); short[] r = fr.apply(SPECIES.length()); short ra = Short.MIN_VALUE; @@ -1139,7 +1277,7 @@ 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(); + r[i] = av.maxLanes(); } } @@ -1147,11 +1285,11 @@ 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()); + ra = (short)Math.max(ra, av.maxLanes()); } } - assertReductionArraysEquals(a, r, ra, Short64VectorTests::maxAll, Short64VectorTests::maxAll); + assertReductionArraysEquals(a, r, ra, Short64VectorTests::maxLanes, Short64VectorTests::maxLanes); } static boolean anyTrue(boolean[] a, int idx) {