--- old/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java 2019-04-26 14:53:50.592302800 -0700 +++ new/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java 2019-04-26 14:53:49.994698600 -0700 @@ -686,12 +686,12 @@ } - static int shiftR(int a, int b) { - return (int)((a >>> b)); + static int shiftLeft(int a, int b) { + return (int)((a << b)); } @Test(dataProvider = "intBinaryOpProvider") - static void shiftRIntMaxVectorTests(IntFunction fa, IntFunction fb) { + static void shiftLeftIntMaxVectorTests(IntFunction fa, IntFunction fb) { int[] a = fa.apply(SPECIES.length()); int[] b = fb.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); @@ -700,17 +700,17 @@ for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); IntVector bv = IntVector.fromArray(SPECIES, b, i); - av.shiftR(bv).intoArray(r, i); + av.shiftLeft(bv).intoArray(r, i); } } - assertArraysEquals(a, b, r, IntMaxVectorTests::shiftR); + assertArraysEquals(a, b, r, IntMaxVectorTests::shiftLeft); } @Test(dataProvider = "intBinaryOpMaskProvider") - static void shiftRIntMaxVectorTests(IntFunction fa, IntFunction fb, + static void shiftLeftIntMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); int[] b = fb.apply(SPECIES.length()); @@ -722,20 +722,24 @@ for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); IntVector bv = IntVector.fromArray(SPECIES, b, i); - av.shiftR(bv, vmask).intoArray(r, i); + av.shiftLeft(bv, vmask).intoArray(r, i); } } - assertArraysEquals(a, b, r, mask, IntMaxVectorTests::shiftR); + assertArraysEquals(a, b, r, mask, IntMaxVectorTests::shiftLeft); } - static int shiftL(int a, int b) { - return (int)((a << b)); + + + + + static int shiftRight(int a, int b) { + return (int)((a >>> b)); } @Test(dataProvider = "intBinaryOpProvider") - static void shiftLIntMaxVectorTests(IntFunction fa, IntFunction fb) { + static void shiftRightIntMaxVectorTests(IntFunction fa, IntFunction fb) { int[] a = fa.apply(SPECIES.length()); int[] b = fb.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); @@ -744,17 +748,17 @@ for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); IntVector bv = IntVector.fromArray(SPECIES, b, i); - av.shiftL(bv).intoArray(r, i); + av.shiftRight(bv).intoArray(r, i); } } - assertArraysEquals(a, b, r, IntMaxVectorTests::shiftL); + assertArraysEquals(a, b, r, IntMaxVectorTests::shiftRight); } @Test(dataProvider = "intBinaryOpMaskProvider") - static void shiftLIntMaxVectorTests(IntFunction fa, IntFunction fb, + static void shiftRightIntMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); int[] b = fb.apply(SPECIES.length()); @@ -766,20 +770,24 @@ for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); IntVector bv = IntVector.fromArray(SPECIES, b, i); - av.shiftL(bv, vmask).intoArray(r, i); + av.shiftRight(bv, vmask).intoArray(r, i); } } - assertArraysEquals(a, b, r, mask, IntMaxVectorTests::shiftL); + assertArraysEquals(a, b, r, mask, IntMaxVectorTests::shiftRight); } - static int aShiftR(int a, int b) { + + + + + static int shiftArithmeticRight(int a, int b) { return (int)((a >> b)); } @Test(dataProvider = "intBinaryOpProvider") - static void aShiftRIntMaxVectorTests(IntFunction fa, IntFunction fb) { + static void shiftArithmeticRightIntMaxVectorTests(IntFunction fa, IntFunction fb) { int[] a = fa.apply(SPECIES.length()); int[] b = fb.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); @@ -788,17 +796,17 @@ for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); IntVector bv = IntVector.fromArray(SPECIES, b, i); - av.aShiftR(bv).intoArray(r, i); + av.shiftArithmeticRight(bv).intoArray(r, i); } } - assertArraysEquals(a, b, r, IntMaxVectorTests::aShiftR); + assertArraysEquals(a, b, r, IntMaxVectorTests::shiftArithmeticRight); } @Test(dataProvider = "intBinaryOpMaskProvider") - static void aShiftRIntMaxVectorTests(IntFunction fa, IntFunction fb, + static void shiftArithmeticRightIntMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); int[] b = fb.apply(SPECIES.length()); @@ -810,20 +818,24 @@ for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); IntVector bv = IntVector.fromArray(SPECIES, b, i); - av.aShiftR(bv, vmask).intoArray(r, i); + av.shiftArithmeticRight(bv, vmask).intoArray(r, i); } } - assertArraysEquals(a, b, r, mask, IntMaxVectorTests::aShiftR); + assertArraysEquals(a, b, r, mask, IntMaxVectorTests::shiftArithmeticRight); } - static int aShiftR_unary(int a, int b) { - return (int)((a >> b)); + + + + + static int shiftLeft_unary(int a, int b) { + return (int)((a << b)); } @Test(dataProvider = "intBinaryOpProvider") - static void aShiftRIntMaxVectorTestsShift(IntFunction fa, IntFunction fb) { + static void shiftLeftIntMaxVectorTestsShift(IntFunction fa, IntFunction fb) { int[] a = fa.apply(SPECIES.length()); int[] b = fb.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); @@ -831,17 +843,17 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - av.aShiftR((int)b[i]).intoArray(r, i); + av.shiftLeft((int)b[i]).intoArray(r, i); } } - assertShiftArraysEquals(a, b, r, IntMaxVectorTests::aShiftR_unary); + assertShiftArraysEquals(a, b, r, IntMaxVectorTests::shiftLeft_unary); } @Test(dataProvider = "intBinaryOpMaskProvider") - static void aShiftRIntMaxVectorTestsShift(IntFunction fa, IntFunction fb, + static void shiftLeftIntMaxVectorTestsShift(IntFunction fa, IntFunction fb, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); int[] b = fb.apply(SPECIES.length()); @@ -852,20 +864,24 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - av.aShiftR((int)b[i], vmask).intoArray(r, i); + av.shiftLeft((int)b[i], vmask).intoArray(r, i); } } - assertShiftArraysEquals(a, b, r, mask, IntMaxVectorTests::aShiftR_unary); + assertShiftArraysEquals(a, b, r, mask, IntMaxVectorTests::shiftLeft_unary); } - static int shiftR_unary(int a, int b) { + + + + + static int shiftRight_unary(int a, int b) { return (int)((a >>> b)); } @Test(dataProvider = "intBinaryOpProvider") - static void shiftRIntMaxVectorTestsShift(IntFunction fa, IntFunction fb) { + static void shiftRightIntMaxVectorTestsShift(IntFunction fa, IntFunction fb) { int[] a = fa.apply(SPECIES.length()); int[] b = fb.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); @@ -873,17 +889,17 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - av.shiftR((int)b[i]).intoArray(r, i); + av.shiftRight((int)b[i]).intoArray(r, i); } } - assertShiftArraysEquals(a, b, r, IntMaxVectorTests::shiftR_unary); + assertShiftArraysEquals(a, b, r, IntMaxVectorTests::shiftRight_unary); } @Test(dataProvider = "intBinaryOpMaskProvider") - static void shiftRIntMaxVectorTestsShift(IntFunction fa, IntFunction fb, + static void shiftRightIntMaxVectorTestsShift(IntFunction fa, IntFunction fb, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); int[] b = fb.apply(SPECIES.length()); @@ -894,20 +910,24 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - av.shiftR((int)b[i], vmask).intoArray(r, i); + av.shiftRight((int)b[i], vmask).intoArray(r, i); } } - assertShiftArraysEquals(a, b, r, mask, IntMaxVectorTests::shiftR_unary); + assertShiftArraysEquals(a, b, r, mask, IntMaxVectorTests::shiftRight_unary); } - static int shiftL_unary(int a, int b) { - return (int)((a << b)); + + + + + static int shiftArithmeticRight_unary(int a, int b) { + return (int)((a >> b)); } @Test(dataProvider = "intBinaryOpProvider") - static void shiftLIntMaxVectorTestsShift(IntFunction fa, IntFunction fb) { + static void shiftArithmeticRightIntMaxVectorTestsShift(IntFunction fa, IntFunction fb) { int[] a = fa.apply(SPECIES.length()); int[] b = fb.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); @@ -915,17 +935,17 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - av.shiftL((int)b[i]).intoArray(r, i); + av.shiftArithmeticRight((int)b[i]).intoArray(r, i); } } - assertShiftArraysEquals(a, b, r, IntMaxVectorTests::shiftL_unary); + assertShiftArraysEquals(a, b, r, IntMaxVectorTests::shiftArithmeticRight_unary); } @Test(dataProvider = "intBinaryOpMaskProvider") - static void shiftLIntMaxVectorTestsShift(IntFunction fa, IntFunction fb, + static void shiftArithmeticRightIntMaxVectorTestsShift(IntFunction fa, IntFunction fb, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); int[] b = fb.apply(SPECIES.length()); @@ -936,25 +956,17 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - av.shiftL((int)b[i], vmask).intoArray(r, i); + av.shiftArithmeticRight((int)b[i], vmask).intoArray(r, i); } } - assertShiftArraysEquals(a, b, r, mask, IntMaxVectorTests::shiftL_unary); + assertShiftArraysEquals(a, b, r, mask, IntMaxVectorTests::shiftArithmeticRight_unary); } - - - - - - - - static int max(int a, int b) { return (int)(Math.max(a, b)); } @@ -996,7 +1008,7 @@ assertArraysEquals(a, b, r, IntMaxVectorTests::min); } - static int andAll(int[] a, int idx) { + static int andLanes(int[] a, int idx) { int res = -1; for (int i = idx; i < (idx + SPECIES.length()); i++) { res &= a[i]; @@ -1005,7 +1017,7 @@ return res; } - static int andAll(int[] a) { + static int andLanes(int[] a) { int res = -1; for (int i = 0; i < a.length; i += SPECIES.length()) { int tmp = -1; @@ -1020,7 +1032,7 @@ @Test(dataProvider = "intUnaryOpProvider") - static void andAllIntMaxVectorTests(IntFunction fa) { + static void andLanesIntMaxVectorTests(IntFunction fa) { int[] a = fa.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); int ra = -1; @@ -1028,7 +1040,7 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - r[i] = av.andAll(); + r[i] = av.andLanes(); } } @@ -1036,15 +1048,15 @@ ra = -1; for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - ra &= av.andAll(); + ra &= av.andLanes(); } } - assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::andAll, IntMaxVectorTests::andAll); + assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::andLanes, IntMaxVectorTests::andLanes); } - static int orAll(int[] a, int idx) { + static int orLanes(int[] a, int idx) { int res = 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { res |= a[i]; @@ -1053,7 +1065,7 @@ return res; } - static int orAll(int[] a) { + static int orLanes(int[] a) { int res = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { int tmp = 0; @@ -1068,7 +1080,7 @@ @Test(dataProvider = "intUnaryOpProvider") - static void orAllIntMaxVectorTests(IntFunction fa) { + static void orLanesIntMaxVectorTests(IntFunction fa) { int[] a = fa.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); int ra = 0; @@ -1076,7 +1088,7 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - r[i] = av.orAll(); + r[i] = av.orLanes(); } } @@ -1084,15 +1096,15 @@ ra = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - ra |= av.orAll(); + ra |= av.orLanes(); } } - assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::orAll, IntMaxVectorTests::orAll); + assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::orLanes, IntMaxVectorTests::orLanes); } - static int xorAll(int[] a, int idx) { + static int xorLanes(int[] a, int idx) { int res = 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { res ^= a[i]; @@ -1101,7 +1113,7 @@ return res; } - static int xorAll(int[] a) { + static int xorLanes(int[] a) { int res = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { int tmp = 0; @@ -1116,7 +1128,7 @@ @Test(dataProvider = "intUnaryOpProvider") - static void xorAllIntMaxVectorTests(IntFunction fa) { + static void xorLanesIntMaxVectorTests(IntFunction fa) { int[] a = fa.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); int ra = 0; @@ -1124,7 +1136,7 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - r[i] = av.xorAll(); + r[i] = av.xorLanes(); } } @@ -1132,14 +1144,14 @@ ra = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - ra ^= av.xorAll(); + ra ^= av.xorLanes(); } } - assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::xorAll, IntMaxVectorTests::xorAll); + assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::xorLanes, IntMaxVectorTests::xorLanes); } - static int addAll(int[] a, int idx) { + static int addLanes(int[] a, int idx) { int res = 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { res += a[i]; @@ -1148,7 +1160,7 @@ return res; } - static int addAll(int[] a) { + static int addLanes(int[] a) { int res = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { int tmp = 0; @@ -1161,7 +1173,7 @@ return res; } @Test(dataProvider = "intUnaryOpProvider") - static void addAllIntMaxVectorTests(IntFunction fa) { + static void addLanesIntMaxVectorTests(IntFunction fa) { int[] a = fa.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); int ra = 0; @@ -1169,7 +1181,7 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - r[i] = av.addAll(); + r[i] = av.addLanes(); } } @@ -1177,13 +1189,13 @@ ra = 0; for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - ra += av.addAll(); + ra += av.addLanes(); } } - assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::addAll, IntMaxVectorTests::addAll); + assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::addLanes, IntMaxVectorTests::addLanes); } - static int mulAll(int[] a, int idx) { + static int mulLanes(int[] a, int idx) { int res = 1; for (int i = idx; i < (idx + SPECIES.length()); i++) { res *= a[i]; @@ -1192,7 +1204,7 @@ return res; } - static int mulAll(int[] a) { + static int mulLanes(int[] a) { int res = 1; for (int i = 0; i < a.length; i += SPECIES.length()) { int tmp = 1; @@ -1205,7 +1217,7 @@ return res; } @Test(dataProvider = "intUnaryOpProvider") - static void mulAllIntMaxVectorTests(IntFunction fa) { + static void mulLanesIntMaxVectorTests(IntFunction fa) { int[] a = fa.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); int ra = 1; @@ -1213,7 +1225,7 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - r[i] = av.mulAll(); + r[i] = av.mulLanes(); } } @@ -1221,13 +1233,13 @@ ra = 1; for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - ra *= av.mulAll(); + ra *= av.mulLanes(); } } - assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::mulAll, IntMaxVectorTests::mulAll); + assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::mulLanes, IntMaxVectorTests::mulLanes); } - static int minAll(int[] a, int idx) { + static int minLanes(int[] a, int idx) { int res = Integer.MAX_VALUE; for (int i = idx; i < (idx + SPECIES.length()); i++) { res = (int)Math.min(res, a[i]); @@ -1236,7 +1248,7 @@ return res; } - static int minAll(int[] a) { + static int minLanes(int[] a) { int res = Integer.MAX_VALUE; for (int i = 0; i < a.length; i++) { res = (int)Math.min(res, a[i]); @@ -1245,7 +1257,7 @@ return res; } @Test(dataProvider = "intUnaryOpProvider") - static void minAllIntMaxVectorTests(IntFunction fa) { + static void minLanesIntMaxVectorTests(IntFunction fa) { int[] a = fa.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); int ra = Integer.MAX_VALUE; @@ -1253,7 +1265,7 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - r[i] = av.minAll(); + r[i] = av.minLanes(); } } @@ -1261,13 +1273,13 @@ ra = Integer.MAX_VALUE; for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - ra = (int)Math.min(ra, av.minAll()); + ra = (int)Math.min(ra, av.minLanes()); } } - assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::minAll, IntMaxVectorTests::minAll); + assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::minLanes, IntMaxVectorTests::minLanes); } - static int maxAll(int[] a, int idx) { + static int maxLanes(int[] a, int idx) { int res = Integer.MIN_VALUE; for (int i = idx; i < (idx + SPECIES.length()); i++) { res = (int)Math.max(res, a[i]); @@ -1276,7 +1288,7 @@ return res; } - static int maxAll(int[] a) { + static int maxLanes(int[] a) { int res = Integer.MIN_VALUE; for (int i = 0; i < a.length; i++) { res = (int)Math.max(res, a[i]); @@ -1285,7 +1297,7 @@ return res; } @Test(dataProvider = "intUnaryOpProvider") - static void maxAllIntMaxVectorTests(IntFunction fa) { + static void maxLanesIntMaxVectorTests(IntFunction fa) { int[] a = fa.apply(SPECIES.length()); int[] r = fr.apply(SPECIES.length()); int ra = Integer.MIN_VALUE; @@ -1293,7 +1305,7 @@ for (int ic = 0; ic < INVOC_COUNT; ic++) { for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - r[i] = av.maxAll(); + r[i] = av.maxLanes(); } } @@ -1301,11 +1313,11 @@ ra = Integer.MIN_VALUE; for (int i = 0; i < a.length; i += SPECIES.length()) { IntVector av = IntVector.fromArray(SPECIES, a, i); - ra = (int)Math.max(ra, av.maxAll()); + ra = (int)Math.max(ra, av.maxLanes()); } } - assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::maxAll, IntMaxVectorTests::maxAll); + assertReductionArraysEquals(a, r, ra, IntMaxVectorTests::maxLanes, IntMaxVectorTests::maxLanes); } static boolean anyTrue(boolean[] a, int idx) {