< prev index next >

test/jdk/jdk/incubator/vector/Int64VectorTests.java

Print this page

 244             } else {
 245                 Assert.assertEquals(r[i], a[i], "at index #" + i);
 246             }
 247         }
 248     }
 249 
 250     static void assertRearrangeArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
 251         int i = 0, j = 0;
 252         try {
 253             for (; i < a.length; i += vector_len) {
 254                 for (j = 0; j < vector_len; j++) {
 255                     Assert.assertEquals(r[i+j], a[i+order[i+j]]);
 256                 }
 257             }
 258         } catch (AssertionError e) {
 259             int idx = i + j;
 260             Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]);
 261         }
 262     }
 263 

















































 264     static void assertSelectFromArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
 265         int i = 0, j = 0;
 266         try {
 267             for (; i < a.length; i += vector_len) {
 268                 for (j = 0; j < vector_len; j++) {
 269                     Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]);
 270                 }
 271             }
 272         } catch (AssertionError e) {
 273             int idx = i + j;
 274             Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]);
 275         }
 276     }
 277 
 278     static void assertRearrangeArraysEquals(int[] r, int[] a, int[] order, boolean[] mask, int vector_len) {
 279         int i = 0, j = 0;
 280         try {
 281             for (; i < a.length; i += vector_len) {
 282                 for (j = 0; j < vector_len; j++) {
 283                     if (mask[j % SPECIES.length()])

 867         try {
 868             for (; i < r.length; i++) {
 869                 Assert.assertEquals(r[i], (long)(a[i+offs]));
 870             }
 871         } catch (AssertionError e) {
 872             Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
 873         }
 874     }
 875 
 876     static void assertArraysEquals(double[] r, int[] a, int offs) {
 877         int i = 0;
 878         try {
 879             for (; i < r.length; i++) {
 880                 Assert.assertEquals(r[i], (double)(a[i+offs]));
 881             }
 882         } catch (AssertionError e) {
 883             Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
 884         }
 885     }
 886 
 887 
 888     static int bits(int e) {
 889         return  e;
 890     }
 891 
 892     static final List<IntFunction<int[]>> INT_GENERATORS = List.of(
 893             withToString("int[-i * 5]", (int s) -> {
 894                 return fill(s * BUFFER_REPS,
 895                             i -> (int)(-i * 5));
 896             }),
 897             withToString("int[i * 5]", (int s) -> {
 898                 return fill(s * BUFFER_REPS,
 899                             i -> (int)(i * 5));
 900             }),
 901             withToString("int[i + 1]", (int s) -> {
 902                 return fill(s * BUFFER_REPS,
 903                             i -> (((int)(i + 1) == 0) ? 1 : (int)(i + 1)));
 904             }),
 905             withToString("int[cornerCaseValue(i)]", (int s) -> {
 906                 return fill(s * BUFFER_REPS,
 907                             i -> cornerCaseValue(i));

 962                 })).
 963                 toArray(Object[][]::new);
 964     }
 965 
 966     @DataProvider
 967     public Object[][] intUnaryOpProvider() {
 968         return INT_GENERATORS.stream().
 969                 map(f -> new Object[]{f}).
 970                 toArray(Object[][]::new);
 971     }
 972 
 973     @DataProvider
 974     public Object[][] intUnaryOpMaskProvider() {
 975         return BOOLEAN_MASK_GENERATORS.stream().
 976                 flatMap(fm -> INT_GENERATORS.stream().map(fa -> {
 977                     return new Object[] {fa, fm};
 978                 })).
 979                 toArray(Object[][]::new);
 980     }
 981 
 982 
 983 
 984     @DataProvider
 985     public Object[][] maskProvider() {
 986         return BOOLEAN_MASK_GENERATORS.stream().
 987                 map(f -> new Object[]{f}).
 988                 toArray(Object[][]::new);
 989     }
 990 
 991     @DataProvider
 992     public Object[][] maskCompareOpProvider() {
 993         return BOOLEAN_MASK_COMPARE_GENERATOR_PAIRS.stream().map(List::toArray).
 994                 toArray(Object[][]::new);
 995     }
 996 
 997     @DataProvider
 998     public Object[][] shuffleProvider() {
 999         return INT_SHUFFLE_GENERATORS.stream().
1000                 map(f -> new Object[]{f}).
1001                 toArray(Object[][]::new);
1002     }
1003 

1009 
1010     @DataProvider
1011     public Object[][] intUnaryOpShuffleProvider() {
1012         return INT_SHUFFLE_GENERATORS.stream().
1013                 flatMap(fs -> INT_GENERATORS.stream().map(fa -> {
1014                     return new Object[] {fa, fs};
1015                 })).
1016                 toArray(Object[][]::new);
1017     }
1018 
1019     @DataProvider
1020     public Object[][] intUnaryOpShuffleMaskProvider() {
1021         return BOOLEAN_MASK_GENERATORS.stream().
1022                 flatMap(fm -> INT_SHUFFLE_GENERATORS.stream().
1023                     flatMap(fs -> INT_GENERATORS.stream().map(fa -> {
1024                         return new Object[] {fa, fs, fm};
1025                 }))).
1026                 toArray(Object[][]::new);
1027     }
1028 
1029 
1030     static final List<IntFunction<int[]>> INT_COMPARE_GENERATORS = List.of(
1031             withToString("int[i]", (int s) -> {
1032                 return fill(s * BUFFER_REPS,
1033                             i -> (int)i);
1034             }),
1035             withToString("int[i - length / 2]", (int s) -> {
1036                 return fill(s * BUFFER_REPS,
1037                             i -> (int)(i - (s * BUFFER_REPS / 2)));
1038             }),
1039             withToString("int[i + 1]", (int s) -> {
1040                 return fill(s * BUFFER_REPS,
1041                             i -> (int)(i + 1));
1042             }),
1043             withToString("int[i - 2]", (int s) -> {
1044                 return fill(s * BUFFER_REPS,
1045                             i -> (int)(i - 2));
1046             }),
1047             withToString("int[zigZag(i)]", (int s) -> {
1048                 return fill(s * BUFFER_REPS,
1049                             i -> i%3 == 0 ? (int)i : (i%3 == 1 ? (int)(i + 1) : (int)(i - 2)));

1150             }
1151         }
1152     }
1153 
1154     static void replaceZero(int[] a, boolean[] mask, int v) {
1155         for (int i = 0; i < a.length; i++) {
1156             if (mask[i % mask.length] && a[i] == 0) {
1157                 a[i] = v;
1158             }
1159         }
1160     }
1161 
1162     static int ROL_scalar(int a, int b) {
1163         return Integer.rotateLeft(a, ((int)b));
1164     }
1165 
1166     static int ROR_scalar(int a, int b) {
1167         return Integer.rotateRight(a, ((int)b));
1168     }
1169 












1170     static boolean eq(int a, int b) {
1171         return a == b;
1172     }
1173 
1174     static boolean neq(int a, int b) {
1175         return a != b;
1176     }
1177 
1178     static boolean lt(int a, int b) {
1179         return a < b;
1180     }
1181 
1182     static boolean le(int a, int b) {
1183         return a <= b;
1184     }
1185 
1186     static boolean gt(int a, int b) {
1187         return a > b;
1188     }
1189 

1304     @Test
1305     // Test div by 0.
1306     static void bitwiseDivByZeroSmokeTest() {
1307         try {
1308             IntVector a = (IntVector) SPECIES.broadcast(0).addIndex(1);
1309             IntVector b = (IntVector) SPECIES.broadcast(0);
1310             a.div(b);
1311             Assert.fail();
1312         } catch (ArithmeticException e) {
1313         }
1314 
1315         try {
1316             IntVector a = (IntVector) SPECIES.broadcast(0).addIndex(1);
1317             IntVector b = (IntVector) SPECIES.broadcast(0);
1318             VectorMask<Integer> m = a.lt((int) 1);
1319             a.div(b, m);
1320             Assert.fail();
1321         } catch (ArithmeticException e) {
1322         }
1323     }

1324     static int ADD(int a, int b) {
1325         return (int)(a + b);
1326     }
1327 
1328     @Test(dataProvider = "intBinaryOpProvider")
1329     static void ADDInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1330         int[] a = fa.apply(SPECIES.length());
1331         int[] b = fb.apply(SPECIES.length());
1332         int[] r = fr.apply(SPECIES.length());
1333 
1334         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1335             for (int i = 0; i < a.length; i += SPECIES.length()) {
1336                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1337                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1338                 av.lanewise(VectorOperators.ADD, bv).intoArray(r, i);
1339             }
1340         }
1341 
1342         assertArraysEquals(r, a, b, Int64VectorTests::ADD);
1343     }

1344     static int add(int a, int b) {
1345         return (int)(a + b);
1346     }
1347 
1348     @Test(dataProvider = "intBinaryOpProvider")
1349     static void addInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1350         int[] a = fa.apply(SPECIES.length());
1351         int[] b = fb.apply(SPECIES.length());
1352         int[] r = fr.apply(SPECIES.length());
1353 
1354         for (int i = 0; i < a.length; i += SPECIES.length()) {
1355             IntVector av = IntVector.fromArray(SPECIES, a, i);
1356             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1357             av.add(bv).intoArray(r, i);
1358         }
1359 
1360         assertArraysEquals(r, a, b, Int64VectorTests::add);
1361     }
1362 
1363     @Test(dataProvider = "intBinaryOpMaskProvider")

1380         assertArraysEquals(r, a, b, mask, Int64VectorTests::ADD);
1381     }
1382 
1383     @Test(dataProvider = "intBinaryOpMaskProvider")
1384     static void addInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1385                                           IntFunction<boolean[]> fm) {
1386         int[] a = fa.apply(SPECIES.length());
1387         int[] b = fb.apply(SPECIES.length());
1388         int[] r = fr.apply(SPECIES.length());
1389         boolean[] mask = fm.apply(SPECIES.length());
1390         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1391 
1392         for (int i = 0; i < a.length; i += SPECIES.length()) {
1393             IntVector av = IntVector.fromArray(SPECIES, a, i);
1394             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1395             av.add(bv, vmask).intoArray(r, i);
1396         }
1397 
1398         assertArraysEquals(r, a, b, mask, Int64VectorTests::add);
1399     }

1400     static int SUB(int a, int b) {
1401         return (int)(a - b);
1402     }
1403 
1404     @Test(dataProvider = "intBinaryOpProvider")
1405     static void SUBInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1406         int[] a = fa.apply(SPECIES.length());
1407         int[] b = fb.apply(SPECIES.length());
1408         int[] r = fr.apply(SPECIES.length());
1409 
1410         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1411             for (int i = 0; i < a.length; i += SPECIES.length()) {
1412                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1413                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1414                 av.lanewise(VectorOperators.SUB, bv).intoArray(r, i);
1415             }
1416         }
1417 
1418         assertArraysEquals(r, a, b, Int64VectorTests::SUB);
1419     }

1420     static int sub(int a, int b) {
1421         return (int)(a - b);
1422     }
1423 
1424     @Test(dataProvider = "intBinaryOpProvider")
1425     static void subInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1426         int[] a = fa.apply(SPECIES.length());
1427         int[] b = fb.apply(SPECIES.length());
1428         int[] r = fr.apply(SPECIES.length());
1429 
1430         for (int i = 0; i < a.length; i += SPECIES.length()) {
1431             IntVector av = IntVector.fromArray(SPECIES, a, i);
1432             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1433             av.sub(bv).intoArray(r, i);
1434         }
1435 
1436         assertArraysEquals(r, a, b, Int64VectorTests::sub);
1437     }
1438 
1439     @Test(dataProvider = "intBinaryOpMaskProvider")

1456         assertArraysEquals(r, a, b, mask, Int64VectorTests::SUB);
1457     }
1458 
1459     @Test(dataProvider = "intBinaryOpMaskProvider")
1460     static void subInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1461                                           IntFunction<boolean[]> fm) {
1462         int[] a = fa.apply(SPECIES.length());
1463         int[] b = fb.apply(SPECIES.length());
1464         int[] r = fr.apply(SPECIES.length());
1465         boolean[] mask = fm.apply(SPECIES.length());
1466         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1467 
1468         for (int i = 0; i < a.length; i += SPECIES.length()) {
1469             IntVector av = IntVector.fromArray(SPECIES, a, i);
1470             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1471             av.sub(bv, vmask).intoArray(r, i);
1472         }
1473 
1474         assertArraysEquals(r, a, b, mask, Int64VectorTests::sub);
1475     }

1476     static int MUL(int a, int b) {
1477         return (int)(a * b);
1478     }
1479 
1480     @Test(dataProvider = "intBinaryOpProvider")
1481     static void MULInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1482         int[] a = fa.apply(SPECIES.length());
1483         int[] b = fb.apply(SPECIES.length());
1484         int[] r = fr.apply(SPECIES.length());
1485 
1486         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1487             for (int i = 0; i < a.length; i += SPECIES.length()) {
1488                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1489                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1490                 av.lanewise(VectorOperators.MUL, bv).intoArray(r, i);
1491             }
1492         }
1493 
1494         assertArraysEquals(r, a, b, Int64VectorTests::MUL);
1495     }

1496     static int mul(int a, int b) {
1497         return (int)(a * b);
1498     }
1499 
1500     @Test(dataProvider = "intBinaryOpProvider")
1501     static void mulInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1502         int[] a = fa.apply(SPECIES.length());
1503         int[] b = fb.apply(SPECIES.length());
1504         int[] r = fr.apply(SPECIES.length());
1505 
1506         for (int i = 0; i < a.length; i += SPECIES.length()) {
1507             IntVector av = IntVector.fromArray(SPECIES, a, i);
1508             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1509             av.mul(bv).intoArray(r, i);
1510         }
1511 
1512         assertArraysEquals(r, a, b, Int64VectorTests::mul);
1513     }
1514 
1515     @Test(dataProvider = "intBinaryOpMaskProvider")

1533     }
1534 
1535     @Test(dataProvider = "intBinaryOpMaskProvider")
1536     static void mulInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1537                                           IntFunction<boolean[]> fm) {
1538         int[] a = fa.apply(SPECIES.length());
1539         int[] b = fb.apply(SPECIES.length());
1540         int[] r = fr.apply(SPECIES.length());
1541         boolean[] mask = fm.apply(SPECIES.length());
1542         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1543 
1544         for (int i = 0; i < a.length; i += SPECIES.length()) {
1545             IntVector av = IntVector.fromArray(SPECIES, a, i);
1546             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1547             av.mul(bv, vmask).intoArray(r, i);
1548         }
1549 
1550         assertArraysEquals(r, a, b, mask, Int64VectorTests::mul);
1551     }
1552 
1553 
1554 
1555     static int DIV(int a, int b) {
1556         return (int)(a / b);
1557     }
1558 
1559     @Test(dataProvider = "intBinaryOpProvider")
1560     static void DIVInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1561         int[] a = fa.apply(SPECIES.length());
1562         int[] b = fb.apply(SPECIES.length());
1563         int[] r = fr.apply(SPECIES.length());
1564 
1565         replaceZero(b, (int) 1);
1566 
1567         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1568             for (int i = 0; i < a.length; i += SPECIES.length()) {
1569                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1570                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1571                 av.lanewise(VectorOperators.DIV, bv).intoArray(r, i);
1572             }
1573         }
1574 
1575         assertArraysEquals(r, a, b, Int64VectorTests::DIV);
1576     }

1577     static int div(int a, int b) {
1578         return (int)(a / b);
1579     }
1580 
1581     @Test(dataProvider = "intBinaryOpProvider")
1582     static void divInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1583         int[] a = fa.apply(SPECIES.length());
1584         int[] b = fb.apply(SPECIES.length());
1585         int[] r = fr.apply(SPECIES.length());
1586 
1587         replaceZero(b, (int) 1);
1588 
1589         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1590             for (int i = 0; i < a.length; i += SPECIES.length()) {
1591                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1592                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1593                 av.div(bv).intoArray(r, i);
1594             }
1595         }
1596 
1597         assertArraysEquals(r, a, b, Int64VectorTests::div);
1598     }
1599 
1600 
1601 
1602     @Test(dataProvider = "intBinaryOpMaskProvider")
1603     static void DIVInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1604                                           IntFunction<boolean[]> fm) {
1605         int[] a = fa.apply(SPECIES.length());
1606         int[] b = fb.apply(SPECIES.length());
1607         int[] r = fr.apply(SPECIES.length());
1608         boolean[] mask = fm.apply(SPECIES.length());
1609         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1610 
1611         replaceZero(b, mask, (int) 1);
1612 
1613         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1614             for (int i = 0; i < a.length; i += SPECIES.length()) {
1615                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1616                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1617                 av.lanewise(VectorOperators.DIV, bv, vmask).intoArray(r, i);
1618             }
1619         }
1620 
1621         assertArraysEquals(r, a, b, mask, Int64VectorTests::DIV);

1687     static int AND(int a, int b) {
1688         return (int)(a & b);
1689     }
1690 
1691     @Test(dataProvider = "intBinaryOpProvider")
1692     static void ANDInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1693         int[] a = fa.apply(SPECIES.length());
1694         int[] b = fb.apply(SPECIES.length());
1695         int[] r = fr.apply(SPECIES.length());
1696 
1697         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1698             for (int i = 0; i < a.length; i += SPECIES.length()) {
1699                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1700                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1701                 av.lanewise(VectorOperators.AND, bv).intoArray(r, i);
1702             }
1703         }
1704 
1705         assertArraysEquals(r, a, b, Int64VectorTests::AND);
1706     }

1707     static int and(int a, int b) {
1708         return (int)(a & b);
1709     }
1710 
1711     @Test(dataProvider = "intBinaryOpProvider")
1712     static void andInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1713         int[] a = fa.apply(SPECIES.length());
1714         int[] b = fb.apply(SPECIES.length());
1715         int[] r = fr.apply(SPECIES.length());
1716 
1717         for (int i = 0; i < a.length; i += SPECIES.length()) {
1718             IntVector av = IntVector.fromArray(SPECIES, a, i);
1719             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1720             av.and(bv).intoArray(r, i);
1721         }
1722 
1723         assertArraysEquals(r, a, b, Int64VectorTests::and);
1724     }
1725 
1726 
1727 
1728     @Test(dataProvider = "intBinaryOpMaskProvider")
1729     static void ANDInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1730                                           IntFunction<boolean[]> fm) {
1731         int[] a = fa.apply(SPECIES.length());
1732         int[] b = fb.apply(SPECIES.length());
1733         int[] r = fr.apply(SPECIES.length());
1734         boolean[] mask = fm.apply(SPECIES.length());
1735         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1736 
1737         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1738             for (int i = 0; i < a.length; i += SPECIES.length()) {
1739                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1740                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1741                 av.lanewise(VectorOperators.AND, bv, vmask).intoArray(r, i);
1742             }
1743         }
1744 
1745         assertArraysEquals(r, a, b, mask, Int64VectorTests::AND);
1746     }
1747 
1748 
1749     static int AND_NOT(int a, int b) {
1750         return (int)(a & ~b);
1751     }
1752 
1753     @Test(dataProvider = "intBinaryOpProvider")
1754     static void AND_NOTInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1755         int[] a = fa.apply(SPECIES.length());
1756         int[] b = fb.apply(SPECIES.length());
1757         int[] r = fr.apply(SPECIES.length());
1758 
1759         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1760             for (int i = 0; i < a.length; i += SPECIES.length()) {
1761                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1762                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1763                 av.lanewise(VectorOperators.AND_NOT, bv).intoArray(r, i);
1764             }
1765         }
1766 
1767         assertArraysEquals(r, a, b, Int64VectorTests::AND_NOT);
1768     }
1769 
1770 
1771 
1772     @Test(dataProvider = "intBinaryOpMaskProvider")
1773     static void AND_NOTInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1774                                           IntFunction<boolean[]> fm) {
1775         int[] a = fa.apply(SPECIES.length());
1776         int[] b = fb.apply(SPECIES.length());
1777         int[] r = fr.apply(SPECIES.length());
1778         boolean[] mask = fm.apply(SPECIES.length());
1779         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1780 
1781         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1782             for (int i = 0; i < a.length; i += SPECIES.length()) {
1783                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1784                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1785                 av.lanewise(VectorOperators.AND_NOT, bv, vmask).intoArray(r, i);
1786             }
1787         }
1788 
1789         assertArraysEquals(r, a, b, mask, Int64VectorTests::AND_NOT);
1790     }
1791 
1792 
1793     static int OR(int a, int b) {
1794         return (int)(a | b);
1795     }
1796 
1797     @Test(dataProvider = "intBinaryOpProvider")
1798     static void ORInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1799         int[] a = fa.apply(SPECIES.length());
1800         int[] b = fb.apply(SPECIES.length());
1801         int[] r = fr.apply(SPECIES.length());
1802 
1803         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1804             for (int i = 0; i < a.length; i += SPECIES.length()) {
1805                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1806                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1807                 av.lanewise(VectorOperators.OR, bv).intoArray(r, i);
1808             }
1809         }
1810 
1811         assertArraysEquals(r, a, b, Int64VectorTests::OR);
1812     }

1813     static int or(int a, int b) {
1814         return (int)(a | b);
1815     }
1816 
1817     @Test(dataProvider = "intBinaryOpProvider")
1818     static void orInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1819         int[] a = fa.apply(SPECIES.length());
1820         int[] b = fb.apply(SPECIES.length());
1821         int[] r = fr.apply(SPECIES.length());
1822 
1823         for (int i = 0; i < a.length; i += SPECIES.length()) {
1824             IntVector av = IntVector.fromArray(SPECIES, a, i);
1825             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1826             av.or(bv).intoArray(r, i);
1827         }
1828 
1829         assertArraysEquals(r, a, b, Int64VectorTests::or);
1830     }
1831 
1832 
1833 
1834     @Test(dataProvider = "intBinaryOpMaskProvider")
1835     static void ORInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1836                                           IntFunction<boolean[]> fm) {
1837         int[] a = fa.apply(SPECIES.length());
1838         int[] b = fb.apply(SPECIES.length());
1839         int[] r = fr.apply(SPECIES.length());
1840         boolean[] mask = fm.apply(SPECIES.length());
1841         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1842 
1843         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1844             for (int i = 0; i < a.length; i += SPECIES.length()) {
1845                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1846                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1847                 av.lanewise(VectorOperators.OR, bv, vmask).intoArray(r, i);
1848             }
1849         }
1850 
1851         assertArraysEquals(r, a, b, mask, Int64VectorTests::OR);
1852     }
1853 
1854 
1855     static int XOR(int a, int b) {
1856         return (int)(a ^ b);
1857     }
1858 
1859     @Test(dataProvider = "intBinaryOpProvider")
1860     static void XORInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1861         int[] a = fa.apply(SPECIES.length());
1862         int[] b = fb.apply(SPECIES.length());
1863         int[] r = fr.apply(SPECIES.length());
1864 
1865         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1866             for (int i = 0; i < a.length; i += SPECIES.length()) {
1867                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1868                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1869                 av.lanewise(VectorOperators.XOR, bv).intoArray(r, i);
1870             }
1871         }
1872 
1873         assertArraysEquals(r, a, b, Int64VectorTests::XOR);
1874     }
1875 
1876 
1877 
1878     @Test(dataProvider = "intBinaryOpMaskProvider")
1879     static void XORInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1880                                           IntFunction<boolean[]> fm) {
1881         int[] a = fa.apply(SPECIES.length());
1882         int[] b = fb.apply(SPECIES.length());
1883         int[] r = fr.apply(SPECIES.length());
1884         boolean[] mask = fm.apply(SPECIES.length());
1885         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1886 
1887         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1888             for (int i = 0; i < a.length; i += SPECIES.length()) {
1889                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1890                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1891                 av.lanewise(VectorOperators.XOR, bv, vmask).intoArray(r, i);
1892             }
1893         }
1894 
1895         assertArraysEquals(r, a, b, mask, Int64VectorTests::XOR);
1896     }
1897 

















































































1898 
1899     @Test(dataProvider = "intBinaryOpProvider")
1900     static void addInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1901         int[] a = fa.apply(SPECIES.length());
1902         int[] b = fb.apply(SPECIES.length());
1903         int[] r = fr.apply(SPECIES.length());
1904 
1905         for (int i = 0; i < a.length; i += SPECIES.length()) {
1906             IntVector av = IntVector.fromArray(SPECIES, a, i);
1907             av.add(b[i]).intoArray(r, i);
1908         }
1909 
1910         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::add);
1911     }
1912 
1913     @Test(dataProvider = "intBinaryOpMaskProvider")
1914     static void addInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
1915                                           IntFunction<boolean[]> fm) {
1916         int[] a = fa.apply(SPECIES.length());
1917         int[] b = fb.apply(SPECIES.length());

1972         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::mul);
1973     }
1974 
1975     @Test(dataProvider = "intBinaryOpMaskProvider")
1976     static void mulInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
1977                                           IntFunction<boolean[]> fm) {
1978         int[] a = fa.apply(SPECIES.length());
1979         int[] b = fb.apply(SPECIES.length());
1980         int[] r = fr.apply(SPECIES.length());
1981         boolean[] mask = fm.apply(SPECIES.length());
1982         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1983 
1984         for (int i = 0; i < a.length; i += SPECIES.length()) {
1985             IntVector av = IntVector.fromArray(SPECIES, a, i);
1986             av.mul(b[i], vmask).intoArray(r, i);
1987         }
1988 
1989         assertBroadcastArraysEquals(r, a, b, mask, Int64VectorTests::mul);
1990     }
1991 
1992 
1993 
1994 
1995     @Test(dataProvider = "intBinaryOpProvider")
1996     static void divInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1997         int[] a = fa.apply(SPECIES.length());
1998         int[] b = fb.apply(SPECIES.length());
1999         int[] r = fr.apply(SPECIES.length());
2000 
2001         replaceZero(b, (int) 1);
2002 
2003         for (int i = 0; i < a.length; i += SPECIES.length()) {
2004             IntVector av = IntVector.fromArray(SPECIES, a, i);
2005             av.div(b[i]).intoArray(r, i);
2006         }
2007 
2008         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::div);
2009     }
2010 
2011 
2012 
2013     @Test(dataProvider = "intBinaryOpMaskProvider")
2014     static void divInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
2015                                           IntFunction<boolean[]> fm) {
2016         int[] a = fa.apply(SPECIES.length());
2017         int[] b = fb.apply(SPECIES.length());
2018         int[] r = fr.apply(SPECIES.length());
2019         boolean[] mask = fm.apply(SPECIES.length());
2020         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2021 
2022         replaceZero(b, (int) 1);
2023 
2024         for (int i = 0; i < a.length; i += SPECIES.length()) {
2025             IntVector av = IntVector.fromArray(SPECIES, a, i);
2026             av.div(b[i], vmask).intoArray(r, i);
2027         }
2028 
2029         assertBroadcastArraysEquals(r, a, b, mask, Int64VectorTests::div);
2030     }
2031 
2032 
2033 
2034     @Test(dataProvider = "intBinaryOpProvider")
2035     static void ORInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2036         int[] a = fa.apply(SPECIES.length());
2037         int[] b = fb.apply(SPECIES.length());
2038         int[] r = fr.apply(SPECIES.length());
2039 
2040         for (int i = 0; i < a.length; i += SPECIES.length()) {
2041             IntVector av = IntVector.fromArray(SPECIES, a, i);
2042             av.lanewise(VectorOperators.OR, b[i]).intoArray(r, i);
2043         }
2044 
2045         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::OR);
2046     }
2047 
2048     @Test(dataProvider = "intBinaryOpProvider")
2049     static void orInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2050         int[] a = fa.apply(SPECIES.length());
2051         int[] b = fb.apply(SPECIES.length());
2052         int[] r = fr.apply(SPECIES.length());
2053 
2054         for (int i = 0; i < a.length; i += SPECIES.length()) {
2055             IntVector av = IntVector.fromArray(SPECIES, a, i);
2056             av.or(b[i]).intoArray(r, i);
2057         }
2058 
2059         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::or);
2060     }
2061 
2062 
2063 
2064     @Test(dataProvider = "intBinaryOpMaskProvider")
2065     static void ORInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
2066                                           IntFunction<boolean[]> fm) {
2067         int[] a = fa.apply(SPECIES.length());
2068         int[] b = fb.apply(SPECIES.length());
2069         int[] r = fr.apply(SPECIES.length());
2070         boolean[] mask = fm.apply(SPECIES.length());
2071         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2072 
2073         for (int i = 0; i < a.length; i += SPECIES.length()) {
2074             IntVector av = IntVector.fromArray(SPECIES, a, i);
2075             av.lanewise(VectorOperators.OR, b[i], vmask).intoArray(r, i);
2076         }
2077 
2078         assertBroadcastArraysEquals(r, a, b, mask, Int64VectorTests::OR);
2079     }
2080 
2081 
2082 
2083     @Test(dataProvider = "intBinaryOpProvider")
2084     static void ANDInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2085         int[] a = fa.apply(SPECIES.length());
2086         int[] b = fb.apply(SPECIES.length());
2087         int[] r = fr.apply(SPECIES.length());
2088 
2089         for (int i = 0; i < a.length; i += SPECIES.length()) {
2090             IntVector av = IntVector.fromArray(SPECIES, a, i);
2091             av.lanewise(VectorOperators.AND, b[i]).intoArray(r, i);
2092         }
2093 
2094         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::AND);
2095     }
2096 
2097     @Test(dataProvider = "intBinaryOpProvider")
2098     static void andInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2099         int[] a = fa.apply(SPECIES.length());
2100         int[] b = fb.apply(SPECIES.length());
2101         int[] r = fr.apply(SPECIES.length());
2102 
2103         for (int i = 0; i < a.length; i += SPECIES.length()) {
2104             IntVector av = IntVector.fromArray(SPECIES, a, i);
2105             av.and(b[i]).intoArray(r, i);
2106         }
2107 
2108         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::and);
2109     }
2110 
2111 
2112 
2113     @Test(dataProvider = "intBinaryOpMaskProvider")
2114     static void ANDInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
2115                                           IntFunction<boolean[]> fm) {
2116         int[] a = fa.apply(SPECIES.length());
2117         int[] b = fb.apply(SPECIES.length());
2118         int[] r = fr.apply(SPECIES.length());
2119         boolean[] mask = fm.apply(SPECIES.length());
2120         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2121 
2122         for (int i = 0; i < a.length; i += SPECIES.length()) {
2123             IntVector av = IntVector.fromArray(SPECIES, a, i);
2124             av.lanewise(VectorOperators.AND, b[i], vmask).intoArray(r, i);
2125         }
2126 
2127         assertBroadcastArraysEquals(r, a, b, mask, Int64VectorTests::AND);
2128     }
2129 
2130 
2131 
2132     @Test(dataProvider = "intBinaryOpProvider")
2133     static void ORInt64VectorTestsBroadcastLongSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2134         int[] a = fa.apply(SPECIES.length());
2135         int[] b = fb.apply(SPECIES.length());
2136         int[] r = fr.apply(SPECIES.length());
2137 
2138         for (int i = 0; i < a.length; i += SPECIES.length()) {
2139             IntVector av = IntVector.fromArray(SPECIES, a, i);
2140             av.lanewise(VectorOperators.OR, (long)b[i]).intoArray(r, i);
2141         }
2142 
2143         assertBroadcastLongArraysEquals(r, a, b, Int64VectorTests::OR);
2144     }
2145 
2146 
2147 
2148     @Test(dataProvider = "intBinaryOpMaskProvider")
2149     static void ORInt64VectorTestsBroadcastMaskedLongSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
2150                                           IntFunction<boolean[]> fm) {
2151         int[] a = fa.apply(SPECIES.length());
2152         int[] b = fb.apply(SPECIES.length());
2153         int[] r = fr.apply(SPECIES.length());
2154         boolean[] mask = fm.apply(SPECIES.length());
2155         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2156 
2157         for (int i = 0; i < a.length; i += SPECIES.length()) {
2158             IntVector av = IntVector.fromArray(SPECIES, a, i);
2159             av.lanewise(VectorOperators.OR, (long)b[i], vmask).intoArray(r, i);
2160         }
2161 
2162         assertBroadcastLongArraysEquals(r, a, b, mask, Int64VectorTests::OR);
2163     }
2164 
2165 
2166     @Test(dataProvider = "intBinaryOpProvider")
2167     static void ADDInt64VectorTestsBroadcastLongSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2168         int[] a = fa.apply(SPECIES.length());
2169         int[] b = fb.apply(SPECIES.length());
2170         int[] r = fr.apply(SPECIES.length());
2171 
2172         for (int i = 0; i < a.length; i += SPECIES.length()) {
2173             IntVector av = IntVector.fromArray(SPECIES, a, i);
2174             av.lanewise(VectorOperators.ADD, (long)b[i]).intoArray(r, i);
2175         }
2176 
2177         assertBroadcastLongArraysEquals(r, a, b, Int64VectorTests::ADD);
2178     }
2179 
2180     @Test(dataProvider = "intBinaryOpMaskProvider")
2181     static void ADDInt64VectorTestsBroadcastMaskedLongSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
2182                                           IntFunction<boolean[]> fm) {
2183         int[] a = fa.apply(SPECIES.length());
2184         int[] b = fb.apply(SPECIES.length());
2185         int[] r = fr.apply(SPECIES.length());

2198         return (int)((a << b));
2199     }
2200 
2201     @Test(dataProvider = "intBinaryOpProvider")
2202     static void LSHLInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2203         int[] a = fa.apply(SPECIES.length());
2204         int[] b = fb.apply(SPECIES.length());
2205         int[] r = fr.apply(SPECIES.length());
2206 
2207         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2208             for (int i = 0; i < a.length; i += SPECIES.length()) {
2209                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2210                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2211                 av.lanewise(VectorOperators.LSHL, bv).intoArray(r, i);
2212             }
2213         }
2214 
2215         assertArraysEquals(r, a, b, Int64VectorTests::LSHL);
2216     }
2217 
2218 
2219 
2220     @Test(dataProvider = "intBinaryOpMaskProvider")
2221     static void LSHLInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2222                                           IntFunction<boolean[]> fm) {
2223         int[] a = fa.apply(SPECIES.length());
2224         int[] b = fb.apply(SPECIES.length());
2225         int[] r = fr.apply(SPECIES.length());
2226         boolean[] mask = fm.apply(SPECIES.length());
2227         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2228 
2229         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2230             for (int i = 0; i < a.length; i += SPECIES.length()) {
2231                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2232                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2233                 av.lanewise(VectorOperators.LSHL, bv, vmask).intoArray(r, i);
2234             }
2235         }
2236 
2237         assertArraysEquals(r, a, b, mask, Int64VectorTests::LSHL);
2238     }
2239 
2240 
2241 
2242 
2243 
2244 
2245     static int ASHR(int a, int b) {
2246         return (int)((a >> b));
2247     }
2248 
2249     @Test(dataProvider = "intBinaryOpProvider")
2250     static void ASHRInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2251         int[] a = fa.apply(SPECIES.length());
2252         int[] b = fb.apply(SPECIES.length());
2253         int[] r = fr.apply(SPECIES.length());
2254 
2255         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2256             for (int i = 0; i < a.length; i += SPECIES.length()) {
2257                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2258                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2259                 av.lanewise(VectorOperators.ASHR, bv).intoArray(r, i);
2260             }
2261         }
2262 
2263         assertArraysEquals(r, a, b, Int64VectorTests::ASHR);
2264     }
2265 
2266 
2267 
2268     @Test(dataProvider = "intBinaryOpMaskProvider")
2269     static void ASHRInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2270                                           IntFunction<boolean[]> fm) {
2271         int[] a = fa.apply(SPECIES.length());
2272         int[] b = fb.apply(SPECIES.length());
2273         int[] r = fr.apply(SPECIES.length());
2274         boolean[] mask = fm.apply(SPECIES.length());
2275         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2276 
2277         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2278             for (int i = 0; i < a.length; i += SPECIES.length()) {
2279                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2280                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2281                 av.lanewise(VectorOperators.ASHR, bv, vmask).intoArray(r, i);
2282             }
2283         }
2284 
2285         assertArraysEquals(r, a, b, mask, Int64VectorTests::ASHR);
2286     }
2287 
2288 
2289 
2290 
2291 
2292 
2293     static int LSHR(int a, int b) {
2294         return (int)((a >>> b));
2295     }
2296 
2297     @Test(dataProvider = "intBinaryOpProvider")
2298     static void LSHRInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2299         int[] a = fa.apply(SPECIES.length());
2300         int[] b = fb.apply(SPECIES.length());
2301         int[] r = fr.apply(SPECIES.length());
2302 
2303         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2304             for (int i = 0; i < a.length; i += SPECIES.length()) {
2305                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2306                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2307                 av.lanewise(VectorOperators.LSHR, bv).intoArray(r, i);
2308             }
2309         }
2310 
2311         assertArraysEquals(r, a, b, Int64VectorTests::LSHR);
2312     }
2313 
2314 
2315 
2316     @Test(dataProvider = "intBinaryOpMaskProvider")
2317     static void LSHRInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2318                                           IntFunction<boolean[]> fm) {
2319         int[] a = fa.apply(SPECIES.length());
2320         int[] b = fb.apply(SPECIES.length());
2321         int[] r = fr.apply(SPECIES.length());
2322         boolean[] mask = fm.apply(SPECIES.length());
2323         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2324 
2325         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2326             for (int i = 0; i < a.length; i += SPECIES.length()) {
2327                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2328                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2329                 av.lanewise(VectorOperators.LSHR, bv, vmask).intoArray(r, i);
2330             }
2331         }
2332 
2333         assertArraysEquals(r, a, b, mask, Int64VectorTests::LSHR);
2334     }
2335 
2336 
2337 
2338 
2339 
2340 
2341     static int LSHL_unary(int a, int b) {
2342         return (int)((a << b));
2343     }
2344 
2345     @Test(dataProvider = "intBinaryOpProvider")
2346     static void LSHLInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2347         int[] a = fa.apply(SPECIES.length());
2348         int[] b = fb.apply(SPECIES.length());
2349         int[] r = fr.apply(SPECIES.length());
2350 
2351         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2352             for (int i = 0; i < a.length; i += SPECIES.length()) {
2353                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2354                 av.lanewise(VectorOperators.LSHL, (int)b[i]).intoArray(r, i);
2355             }
2356         }
2357 
2358         assertShiftArraysEquals(r, a, b, Int64VectorTests::LSHL_unary);
2359     }
2360 
2361 
2362 
2363     @Test(dataProvider = "intBinaryOpMaskProvider")
2364     static void LSHLInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2365                                           IntFunction<boolean[]> fm) {
2366         int[] a = fa.apply(SPECIES.length());
2367         int[] b = fb.apply(SPECIES.length());
2368         int[] r = fr.apply(SPECIES.length());
2369         boolean[] mask = fm.apply(SPECIES.length());
2370         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2371 
2372         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2373             for (int i = 0; i < a.length; i += SPECIES.length()) {
2374                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2375                 av.lanewise(VectorOperators.LSHL, (int)b[i], vmask).intoArray(r, i);
2376             }
2377         }
2378 
2379         assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::LSHL_unary);
2380     }
2381 
2382 
2383 
2384 
2385 
2386 
2387     static int LSHR_unary(int a, int b) {
2388         return (int)((a >>> b));
2389     }
2390 
2391     @Test(dataProvider = "intBinaryOpProvider")
2392     static void LSHRInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2393         int[] a = fa.apply(SPECIES.length());
2394         int[] b = fb.apply(SPECIES.length());
2395         int[] r = fr.apply(SPECIES.length());
2396 
2397         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2398             for (int i = 0; i < a.length; i += SPECIES.length()) {
2399                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2400                 av.lanewise(VectorOperators.LSHR, (int)b[i]).intoArray(r, i);
2401             }
2402         }
2403 
2404         assertShiftArraysEquals(r, a, b, Int64VectorTests::LSHR_unary);
2405     }
2406 
2407 
2408 
2409     @Test(dataProvider = "intBinaryOpMaskProvider")
2410     static void LSHRInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2411                                           IntFunction<boolean[]> fm) {
2412         int[] a = fa.apply(SPECIES.length());
2413         int[] b = fb.apply(SPECIES.length());
2414         int[] r = fr.apply(SPECIES.length());
2415         boolean[] mask = fm.apply(SPECIES.length());
2416         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2417 
2418         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2419             for (int i = 0; i < a.length; i += SPECIES.length()) {
2420                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2421                 av.lanewise(VectorOperators.LSHR, (int)b[i], vmask).intoArray(r, i);
2422             }
2423         }
2424 
2425         assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::LSHR_unary);
2426     }
2427 
2428 
2429 
2430 
2431 
2432 
2433     static int ASHR_unary(int a, int b) {
2434         return (int)((a >> b));
2435     }
2436 
2437     @Test(dataProvider = "intBinaryOpProvider")
2438     static void ASHRInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2439         int[] a = fa.apply(SPECIES.length());
2440         int[] b = fb.apply(SPECIES.length());
2441         int[] r = fr.apply(SPECIES.length());
2442 
2443         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2444             for (int i = 0; i < a.length; i += SPECIES.length()) {
2445                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2446                 av.lanewise(VectorOperators.ASHR, (int)b[i]).intoArray(r, i);
2447             }
2448         }
2449 
2450         assertShiftArraysEquals(r, a, b, Int64VectorTests::ASHR_unary);
2451     }
2452 
2453 
2454 
2455     @Test(dataProvider = "intBinaryOpMaskProvider")
2456     static void ASHRInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2457                                           IntFunction<boolean[]> fm) {
2458         int[] a = fa.apply(SPECIES.length());
2459         int[] b = fb.apply(SPECIES.length());
2460         int[] r = fr.apply(SPECIES.length());
2461         boolean[] mask = fm.apply(SPECIES.length());
2462         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2463 
2464         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2465             for (int i = 0; i < a.length; i += SPECIES.length()) {
2466                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2467                 av.lanewise(VectorOperators.ASHR, (int)b[i], vmask).intoArray(r, i);
2468             }
2469         }
2470 
2471         assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::ASHR_unary);
2472     }
2473 
2474 
2475 
2476 
2477 
2478 
2479     static int ROR(int a, int b) {
2480         return (int)(ROR_scalar(a,b));
2481     }
2482 
2483     @Test(dataProvider = "intBinaryOpProvider")
2484     static void RORInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2485         int[] a = fa.apply(SPECIES.length());
2486         int[] b = fb.apply(SPECIES.length());
2487         int[] r = fr.apply(SPECIES.length());
2488 
2489         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2490             for (int i = 0; i < a.length; i += SPECIES.length()) {
2491                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2492                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2493                 av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
2494             }
2495         }
2496 
2497         assertArraysEquals(r, a, b, Int64VectorTests::ROR);
2498     }
2499 
2500 
2501 
2502     @Test(dataProvider = "intBinaryOpMaskProvider")
2503     static void RORInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2504                                           IntFunction<boolean[]> fm) {
2505         int[] a = fa.apply(SPECIES.length());
2506         int[] b = fb.apply(SPECIES.length());
2507         int[] r = fr.apply(SPECIES.length());
2508         boolean[] mask = fm.apply(SPECIES.length());
2509         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2510 
2511         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2512             for (int i = 0; i < a.length; i += SPECIES.length()) {
2513                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2514                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2515                 av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
2516             }
2517         }
2518 
2519         assertArraysEquals(r, a, b, mask, Int64VectorTests::ROR);
2520     }
2521 
2522 
2523     static int ROL(int a, int b) {
2524         return (int)(ROL_scalar(a,b));
2525     }
2526 
2527     @Test(dataProvider = "intBinaryOpProvider")
2528     static void ROLInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2529         int[] a = fa.apply(SPECIES.length());
2530         int[] b = fb.apply(SPECIES.length());
2531         int[] r = fr.apply(SPECIES.length());
2532 
2533         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2534             for (int i = 0; i < a.length; i += SPECIES.length()) {
2535                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2536                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2537                 av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
2538             }
2539         }
2540 
2541         assertArraysEquals(r, a, b, Int64VectorTests::ROL);
2542     }
2543 
2544 
2545 
2546     @Test(dataProvider = "intBinaryOpMaskProvider")
2547     static void ROLInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2548                                           IntFunction<boolean[]> fm) {
2549         int[] a = fa.apply(SPECIES.length());
2550         int[] b = fb.apply(SPECIES.length());
2551         int[] r = fr.apply(SPECIES.length());
2552         boolean[] mask = fm.apply(SPECIES.length());
2553         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2554 
2555         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2556             for (int i = 0; i < a.length; i += SPECIES.length()) {
2557                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2558                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2559                 av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
2560             }
2561         }
2562 
2563         assertArraysEquals(r, a, b, mask, Int64VectorTests::ROL);
2564     }
2565 
2566 
2567     static int ROR_unary(int a, int b) {
2568         return (int)(ROR_scalar(a, b));
2569     }
2570 
2571     @Test(dataProvider = "intBinaryOpProvider")
2572     static void RORInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2573         int[] a = fa.apply(SPECIES.length());
2574         int[] b = fb.apply(SPECIES.length());
2575         int[] r = fr.apply(SPECIES.length());
2576 
2577         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2578             for (int i = 0; i < a.length; i += SPECIES.length()) {
2579                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2580                 av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
2581             }
2582         }
2583 
2584         assertShiftArraysEquals(r, a, b, Int64VectorTests::ROR_unary);
2585     }
2586 
2587 
2588 
2589     @Test(dataProvider = "intBinaryOpMaskProvider")
2590     static void RORInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2591                                           IntFunction<boolean[]> fm) {
2592         int[] a = fa.apply(SPECIES.length());
2593         int[] b = fb.apply(SPECIES.length());
2594         int[] r = fr.apply(SPECIES.length());
2595         boolean[] mask = fm.apply(SPECIES.length());
2596         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2597 
2598         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2599             for (int i = 0; i < a.length; i += SPECIES.length()) {
2600                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2601                 av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
2602             }
2603         }
2604 
2605         assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::ROR_unary);
2606     }
2607 
2608 
2609     static int ROL_unary(int a, int b) {
2610         return (int)(ROL_scalar(a, b));
2611     }
2612 
2613     @Test(dataProvider = "intBinaryOpProvider")
2614     static void ROLInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2615         int[] a = fa.apply(SPECIES.length());
2616         int[] b = fb.apply(SPECIES.length());
2617         int[] r = fr.apply(SPECIES.length());
2618 
2619         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2620             for (int i = 0; i < a.length; i += SPECIES.length()) {
2621                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2622                 av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
2623             }
2624         }
2625 
2626         assertShiftArraysEquals(r, a, b, Int64VectorTests::ROL_unary);
2627     }
2628 
2629 
2630 
2631     @Test(dataProvider = "intBinaryOpMaskProvider")
2632     static void ROLInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2633                                           IntFunction<boolean[]> fm) {
2634         int[] a = fa.apply(SPECIES.length());
2635         int[] b = fb.apply(SPECIES.length());
2636         int[] r = fr.apply(SPECIES.length());
2637         boolean[] mask = fm.apply(SPECIES.length());
2638         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2639 
2640         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2641             for (int i = 0; i < a.length; i += SPECIES.length()) {
2642                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2643                 av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
2644             }
2645         }
2646 
2647         assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::ROL_unary);
2648     }
2649 
2650 
2651     static int LSHR_binary_const(int a) {
2652         return (int)((a >>> CONST_SHIFT));
2653     }
2654 
2655     @Test(dataProvider = "intUnaryOpProvider")
2656     static void LSHRInt64VectorTestsScalarShiftConst(IntFunction<int[]> fa) {
2657         int[] a = fa.apply(SPECIES.length());
2658         int[] r = fr.apply(SPECIES.length());
2659 
2660         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2661             for (int i = 0; i < a.length; i += SPECIES.length()) {
2662                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2663                 av.lanewise(VectorOperators.LSHR, CONST_SHIFT).intoArray(r, i);
2664             }
2665         }
2666 
2667         assertShiftConstEquals(r, a, Int64VectorTests::LSHR_binary_const);
2668     }
2669 
2670 
2671 
2672     @Test(dataProvider = "intUnaryOpMaskProvider")
2673     static void LSHRInt64VectorTestsScalarShiftMaskedConst(IntFunction<int[]> fa,
2674                                           IntFunction<boolean[]> fm) {
2675         int[] a = fa.apply(SPECIES.length());
2676         int[] r = fr.apply(SPECIES.length());
2677         boolean[] mask = fm.apply(SPECIES.length());
2678         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2679 
2680         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2681             for (int i = 0; i < a.length; i += SPECIES.length()) {
2682                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2683                 av.lanewise(VectorOperators.LSHR, CONST_SHIFT, vmask).intoArray(r, i);
2684             }
2685         }
2686 
2687         assertShiftConstEquals(r, a, mask, Int64VectorTests::LSHR_binary_const);
2688     }
2689 
2690 
2691 
2692 
2693 
2694 
2695 
2696     static int LSHL_binary_const(int a) {
2697         return (int)((a << CONST_SHIFT));
2698     }
2699 
2700     @Test(dataProvider = "intUnaryOpProvider")
2701     static void LSHLInt64VectorTestsScalarShiftConst(IntFunction<int[]> fa) {
2702         int[] a = fa.apply(SPECIES.length());
2703         int[] r = fr.apply(SPECIES.length());
2704 
2705         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2706             for (int i = 0; i < a.length; i += SPECIES.length()) {
2707                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2708                 av.lanewise(VectorOperators.LSHL, CONST_SHIFT).intoArray(r, i);
2709             }
2710         }
2711 
2712         assertShiftConstEquals(r, a, Int64VectorTests::LSHL_binary_const);
2713     }
2714 
2715 
2716 
2717     @Test(dataProvider = "intUnaryOpMaskProvider")
2718     static void LSHLInt64VectorTestsScalarShiftMaskedConst(IntFunction<int[]> fa,
2719                                           IntFunction<boolean[]> fm) {
2720         int[] a = fa.apply(SPECIES.length());
2721         int[] r = fr.apply(SPECIES.length());
2722         boolean[] mask = fm.apply(SPECIES.length());
2723         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2724 
2725         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2726             for (int i = 0; i < a.length; i += SPECIES.length()) {
2727                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2728                 av.lanewise(VectorOperators.LSHL, CONST_SHIFT, vmask).intoArray(r, i);
2729             }
2730         }
2731 
2732         assertShiftConstEquals(r, a, mask, Int64VectorTests::LSHL_binary_const);
2733     }
2734 
2735 
2736 
2737     static int ASHR_binary_const(int a) {
2738         return (int)((a >> CONST_SHIFT));
2739     }
2740 
2741     @Test(dataProvider = "intUnaryOpProvider")
2742     static void ASHRInt64VectorTestsScalarShiftConst(IntFunction<int[]> fa) {
2743         int[] a = fa.apply(SPECIES.length());
2744         int[] r = fr.apply(SPECIES.length());
2745 
2746         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2747             for (int i = 0; i < a.length; i += SPECIES.length()) {
2748                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2749                 av.lanewise(VectorOperators.ASHR, CONST_SHIFT).intoArray(r, i);
2750             }
2751         }
2752 
2753         assertShiftConstEquals(r, a, Int64VectorTests::ASHR_binary_const);
2754     }
2755 
2756 
2757 
2758     @Test(dataProvider = "intUnaryOpMaskProvider")
2759     static void ASHRInt64VectorTestsScalarShiftMaskedConst(IntFunction<int[]> fa,
2760                                           IntFunction<boolean[]> fm) {
2761         int[] a = fa.apply(SPECIES.length());
2762         int[] r = fr.apply(SPECIES.length());
2763         boolean[] mask = fm.apply(SPECIES.length());
2764         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2765 
2766         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2767             for (int i = 0; i < a.length; i += SPECIES.length()) {
2768                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2769                 av.lanewise(VectorOperators.ASHR, CONST_SHIFT, vmask).intoArray(r, i);
2770             }
2771         }
2772 
2773         assertShiftConstEquals(r, a, mask, Int64VectorTests::ASHR_binary_const);
2774     }
2775 
2776 
2777 
2778     static int ROR_binary_const(int a) {
2779         return (int)(ROR_scalar(a, CONST_SHIFT));
2780     }
2781 
2782     @Test(dataProvider = "intUnaryOpProvider")
2783     static void RORInt64VectorTestsScalarShiftConst(IntFunction<int[]> fa) {
2784         int[] a = fa.apply(SPECIES.length());
2785         int[] r = fr.apply(SPECIES.length());
2786 
2787         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2788             for (int i = 0; i < a.length; i += SPECIES.length()) {
2789                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2790                 av.lanewise(VectorOperators.ROR, CONST_SHIFT).intoArray(r, i);
2791             }
2792         }
2793 
2794         assertShiftConstEquals(r, a, Int64VectorTests::ROR_binary_const);
2795     }
2796 
2797 
2798 
2799     @Test(dataProvider = "intUnaryOpMaskProvider")
2800     static void RORInt64VectorTestsScalarShiftMaskedConst(IntFunction<int[]> fa,
2801                                           IntFunction<boolean[]> fm) {
2802         int[] a = fa.apply(SPECIES.length());
2803         int[] r = fr.apply(SPECIES.length());
2804         boolean[] mask = fm.apply(SPECIES.length());
2805         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2806 
2807         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2808             for (int i = 0; i < a.length; i += SPECIES.length()) {
2809                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2810                 av.lanewise(VectorOperators.ROR, CONST_SHIFT, vmask).intoArray(r, i);
2811             }
2812         }
2813 
2814         assertShiftConstEquals(r, a, mask, Int64VectorTests::ROR_binary_const);
2815     }
2816 
2817 
2818 
2819     static int ROL_binary_const(int a) {
2820         return (int)(ROL_scalar(a, CONST_SHIFT));
2821     }
2822 
2823     @Test(dataProvider = "intUnaryOpProvider")
2824     static void ROLInt64VectorTestsScalarShiftConst(IntFunction<int[]> fa) {
2825         int[] a = fa.apply(SPECIES.length());
2826         int[] r = fr.apply(SPECIES.length());
2827 
2828         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2829             for (int i = 0; i < a.length; i += SPECIES.length()) {
2830                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2831                 av.lanewise(VectorOperators.ROL, CONST_SHIFT).intoArray(r, i);
2832             }
2833         }
2834 
2835         assertShiftConstEquals(r, a, Int64VectorTests::ROL_binary_const);
2836     }
2837 
2838 
2839 
2840     @Test(dataProvider = "intUnaryOpMaskProvider")
2841     static void ROLInt64VectorTestsScalarShiftMaskedConst(IntFunction<int[]> fa,
2842                                           IntFunction<boolean[]> fm) {
2843         int[] a = fa.apply(SPECIES.length());
2844         int[] r = fr.apply(SPECIES.length());
2845         boolean[] mask = fm.apply(SPECIES.length());
2846         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2847 
2848         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2849             for (int i = 0; i < a.length; i += SPECIES.length()) {
2850                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2851                 av.lanewise(VectorOperators.ROL, CONST_SHIFT, vmask).intoArray(r, i);
2852             }
2853         }
2854 
2855         assertShiftConstEquals(r, a, mask, Int64VectorTests::ROL_binary_const);
2856     }
2857 
2858 
2859     static int MIN(int a, int b) {
2860         return (int)(Math.min(a, b));
2861     }
2862 
2863     @Test(dataProvider = "intBinaryOpProvider")
2864     static void MINInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2865         int[] a = fa.apply(SPECIES.length());
2866         int[] b = fb.apply(SPECIES.length());
2867         int[] r = fr.apply(SPECIES.length());
2868 
2869         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2870             for (int i = 0; i < a.length; i += SPECIES.length()) {
2871                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2872                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2873                 av.lanewise(VectorOperators.MIN, bv).intoArray(r, i);
2874             }
2875         }
2876 
2877         assertArraysEquals(r, a, b, Int64VectorTests::MIN);
2878     }

2879     static int min(int a, int b) {
2880         return (int)(Math.min(a, b));
2881     }
2882 
2883     @Test(dataProvider = "intBinaryOpProvider")
2884     static void minInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2885         int[] a = fa.apply(SPECIES.length());
2886         int[] b = fb.apply(SPECIES.length());
2887         int[] r = fr.apply(SPECIES.length());
2888 
2889         for (int i = 0; i < a.length; i += SPECIES.length()) {
2890             IntVector av = IntVector.fromArray(SPECIES, a, i);
2891             IntVector bv = IntVector.fromArray(SPECIES, b, i);
2892             av.min(bv).intoArray(r, i);
2893         }
2894 
2895         assertArraysEquals(r, a, b, Int64VectorTests::min);
2896     }

2897     static int MAX(int a, int b) {
2898         return (int)(Math.max(a, b));
2899     }
2900 
2901     @Test(dataProvider = "intBinaryOpProvider")
2902     static void MAXInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2903         int[] a = fa.apply(SPECIES.length());
2904         int[] b = fb.apply(SPECIES.length());
2905         int[] r = fr.apply(SPECIES.length());
2906 
2907         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2908             for (int i = 0; i < a.length; i += SPECIES.length()) {
2909                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2910                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2911                 av.lanewise(VectorOperators.MAX, bv).intoArray(r, i);
2912             }
2913         }
2914 
2915         assertArraysEquals(r, a, b, Int64VectorTests::MAX);
2916     }

2917     static int max(int a, int b) {
2918         return (int)(Math.max(a, b));
2919     }
2920 
2921     @Test(dataProvider = "intBinaryOpProvider")
2922     static void maxInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2923         int[] a = fa.apply(SPECIES.length());
2924         int[] b = fb.apply(SPECIES.length());
2925         int[] r = fr.apply(SPECIES.length());
2926 
2927         for (int i = 0; i < a.length; i += SPECIES.length()) {
2928             IntVector av = IntVector.fromArray(SPECIES, a, i);
2929             IntVector bv = IntVector.fromArray(SPECIES, b, i);
2930             av.max(bv).intoArray(r, i);
2931         }
2932 
2933         assertArraysEquals(r, a, b, Int64VectorTests::max);
2934     }
2935 
2936     @Test(dataProvider = "intBinaryOpProvider")

2990     }
2991 
2992     static int ANDReduce(int[] a, int idx) {
2993         int res = -1;
2994         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2995             res &= a[i];
2996         }
2997 
2998         return res;
2999     }
3000 
3001     static int ANDReduceAll(int[] a) {
3002         int res = -1;
3003         for (int i = 0; i < a.length; i += SPECIES.length()) {
3004             res &= ANDReduce(a, i);
3005         }
3006 
3007         return res;
3008     }
3009 
3010 
3011     @Test(dataProvider = "intUnaryOpProvider")
3012     static void ANDReduceInt64VectorTests(IntFunction<int[]> fa) {
3013         int[] a = fa.apply(SPECIES.length());
3014         int[] r = fr.apply(SPECIES.length());
3015         int ra = -1;
3016 
3017         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3018             for (int i = 0; i < a.length; i += SPECIES.length()) {
3019                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3020                 r[i] = av.reduceLanes(VectorOperators.AND);
3021             }
3022         }
3023 
3024         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3025             ra = -1;
3026             for (int i = 0; i < a.length; i += SPECIES.length()) {
3027                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3028                 ra &= av.reduceLanes(VectorOperators.AND);
3029             }
3030         }
3031 
3032         assertReductionArraysEquals(r, ra, a,
3033                 Int64VectorTests::ANDReduce, Int64VectorTests::ANDReduceAll);
3034     }
3035 
3036 
3037     static int ANDReduceMasked(int[] a, int idx, boolean[] mask) {
3038         int res = -1;
3039         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3040             if (mask[i % SPECIES.length()])
3041                 res &= a[i];
3042         }
3043 
3044         return res;
3045     }
3046 
3047     static int ANDReduceAllMasked(int[] a, boolean[] mask) {
3048         int res = -1;
3049         for (int i = 0; i < a.length; i += SPECIES.length()) {
3050             res &= ANDReduceMasked(a, i, mask);
3051         }
3052 
3053         return res;
3054     }
3055 
3056 
3057     @Test(dataProvider = "intUnaryOpMaskProvider")
3058     static void ANDReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3059         int[] a = fa.apply(SPECIES.length());
3060         int[] r = fr.apply(SPECIES.length());
3061         boolean[] mask = fm.apply(SPECIES.length());
3062         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3063         int ra = -1;
3064 
3065         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3066             for (int i = 0; i < a.length; i += SPECIES.length()) {
3067                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3068                 r[i] = av.reduceLanes(VectorOperators.AND, vmask);
3069             }
3070         }
3071 
3072         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3073             ra = -1;
3074             for (int i = 0; i < a.length; i += SPECIES.length()) {
3075                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3076                 ra &= av.reduceLanes(VectorOperators.AND, vmask);
3077             }
3078         }
3079 
3080         assertReductionArraysEqualsMasked(r, ra, a, mask,
3081                 Int64VectorTests::ANDReduceMasked, Int64VectorTests::ANDReduceAllMasked);
3082     }
3083 
3084 
3085     static int ORReduce(int[] a, int idx) {
3086         int res = 0;
3087         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3088             res |= a[i];
3089         }
3090 
3091         return res;
3092     }
3093 
3094     static int ORReduceAll(int[] a) {
3095         int res = 0;
3096         for (int i = 0; i < a.length; i += SPECIES.length()) {
3097             res |= ORReduce(a, i);
3098         }
3099 
3100         return res;
3101     }
3102 
3103 
3104     @Test(dataProvider = "intUnaryOpProvider")
3105     static void ORReduceInt64VectorTests(IntFunction<int[]> fa) {
3106         int[] a = fa.apply(SPECIES.length());
3107         int[] r = fr.apply(SPECIES.length());
3108         int ra = 0;
3109 
3110         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3111             for (int i = 0; i < a.length; i += SPECIES.length()) {
3112                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3113                 r[i] = av.reduceLanes(VectorOperators.OR);
3114             }
3115         }
3116 
3117         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3118             ra = 0;
3119             for (int i = 0; i < a.length; i += SPECIES.length()) {
3120                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3121                 ra |= av.reduceLanes(VectorOperators.OR);
3122             }
3123         }
3124 
3125         assertReductionArraysEquals(r, ra, a,
3126                 Int64VectorTests::ORReduce, Int64VectorTests::ORReduceAll);
3127     }
3128 
3129 
3130     static int ORReduceMasked(int[] a, int idx, boolean[] mask) {
3131         int res = 0;
3132         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3133             if (mask[i % SPECIES.length()])
3134                 res |= a[i];
3135         }
3136 
3137         return res;
3138     }
3139 
3140     static int ORReduceAllMasked(int[] a, boolean[] mask) {
3141         int res = 0;
3142         for (int i = 0; i < a.length; i += SPECIES.length()) {
3143             res |= ORReduceMasked(a, i, mask);
3144         }
3145 
3146         return res;
3147     }
3148 
3149 
3150     @Test(dataProvider = "intUnaryOpMaskProvider")
3151     static void ORReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3152         int[] a = fa.apply(SPECIES.length());
3153         int[] r = fr.apply(SPECIES.length());
3154         boolean[] mask = fm.apply(SPECIES.length());
3155         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3156         int ra = 0;
3157 
3158         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3159             for (int i = 0; i < a.length; i += SPECIES.length()) {
3160                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3161                 r[i] = av.reduceLanes(VectorOperators.OR, vmask);
3162             }
3163         }
3164 
3165         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3166             ra = 0;
3167             for (int i = 0; i < a.length; i += SPECIES.length()) {
3168                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3169                 ra |= av.reduceLanes(VectorOperators.OR, vmask);
3170             }
3171         }
3172 
3173         assertReductionArraysEqualsMasked(r, ra, a, mask,
3174                 Int64VectorTests::ORReduceMasked, Int64VectorTests::ORReduceAllMasked);
3175     }
3176 
3177 
3178     static int XORReduce(int[] a, int idx) {
3179         int res = 0;
3180         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3181             res ^= a[i];
3182         }
3183 
3184         return res;
3185     }
3186 
3187     static int XORReduceAll(int[] a) {
3188         int res = 0;
3189         for (int i = 0; i < a.length; i += SPECIES.length()) {
3190             res ^= XORReduce(a, i);
3191         }
3192 
3193         return res;
3194     }
3195 
3196 
3197     @Test(dataProvider = "intUnaryOpProvider")
3198     static void XORReduceInt64VectorTests(IntFunction<int[]> fa) {
3199         int[] a = fa.apply(SPECIES.length());
3200         int[] r = fr.apply(SPECIES.length());
3201         int ra = 0;
3202 
3203         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3204             for (int i = 0; i < a.length; i += SPECIES.length()) {
3205                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3206                 r[i] = av.reduceLanes(VectorOperators.XOR);
3207             }
3208         }
3209 
3210         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3211             ra = 0;
3212             for (int i = 0; i < a.length; i += SPECIES.length()) {
3213                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3214                 ra ^= av.reduceLanes(VectorOperators.XOR);
3215             }
3216         }
3217 
3218         assertReductionArraysEquals(r, ra, a,
3219                 Int64VectorTests::XORReduce, Int64VectorTests::XORReduceAll);
3220     }
3221 
3222 
3223     static int XORReduceMasked(int[] a, int idx, boolean[] mask) {
3224         int res = 0;
3225         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3226             if (mask[i % SPECIES.length()])
3227                 res ^= a[i];
3228         }
3229 
3230         return res;
3231     }
3232 
3233     static int XORReduceAllMasked(int[] a, boolean[] mask) {
3234         int res = 0;
3235         for (int i = 0; i < a.length; i += SPECIES.length()) {
3236             res ^= XORReduceMasked(a, i, mask);
3237         }
3238 
3239         return res;
3240     }
3241 
3242 
3243     @Test(dataProvider = "intUnaryOpMaskProvider")
3244     static void XORReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3245         int[] a = fa.apply(SPECIES.length());
3246         int[] r = fr.apply(SPECIES.length());
3247         boolean[] mask = fm.apply(SPECIES.length());
3248         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3249         int ra = 0;
3250 
3251         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3252             for (int i = 0; i < a.length; i += SPECIES.length()) {
3253                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3254                 r[i] = av.reduceLanes(VectorOperators.XOR, vmask);
3255             }
3256         }
3257 
3258         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3259             ra = 0;
3260             for (int i = 0; i < a.length; i += SPECIES.length()) {
3261                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3262                 ra ^= av.reduceLanes(VectorOperators.XOR, vmask);

3267                 Int64VectorTests::XORReduceMasked, Int64VectorTests::XORReduceAllMasked);
3268     }
3269 
3270     static int ADDReduce(int[] a, int idx) {
3271         int res = 0;
3272         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3273             res += a[i];
3274         }
3275 
3276         return res;
3277     }
3278 
3279     static int ADDReduceAll(int[] a) {
3280         int res = 0;
3281         for (int i = 0; i < a.length; i += SPECIES.length()) {
3282             res += ADDReduce(a, i);
3283         }
3284 
3285         return res;
3286     }

3287     @Test(dataProvider = "intUnaryOpProvider")
3288     static void ADDReduceInt64VectorTests(IntFunction<int[]> fa) {
3289         int[] a = fa.apply(SPECIES.length());
3290         int[] r = fr.apply(SPECIES.length());
3291         int ra = 0;
3292 
3293         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3294             for (int i = 0; i < a.length; i += SPECIES.length()) {
3295                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3296                 r[i] = av.reduceLanes(VectorOperators.ADD);
3297             }
3298         }
3299 
3300         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3301             ra = 0;
3302             for (int i = 0; i < a.length; i += SPECIES.length()) {
3303                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3304                 ra += av.reduceLanes(VectorOperators.ADD);
3305             }
3306         }
3307 
3308         assertReductionArraysEquals(r, ra, a,
3309                 Int64VectorTests::ADDReduce, Int64VectorTests::ADDReduceAll);
3310     }

3311     static int ADDReduceMasked(int[] a, int idx, boolean[] mask) {
3312         int res = 0;
3313         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3314             if (mask[i % SPECIES.length()])
3315                 res += a[i];
3316         }
3317 
3318         return res;
3319     }
3320 
3321     static int ADDReduceAllMasked(int[] a, boolean[] mask) {
3322         int res = 0;
3323         for (int i = 0; i < a.length; i += SPECIES.length()) {
3324             res += ADDReduceMasked(a, i, mask);
3325         }
3326 
3327         return res;
3328     }

3329     @Test(dataProvider = "intUnaryOpMaskProvider")
3330     static void ADDReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3331         int[] a = fa.apply(SPECIES.length());
3332         int[] r = fr.apply(SPECIES.length());
3333         boolean[] mask = fm.apply(SPECIES.length());
3334         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3335         int ra = 0;
3336 
3337         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3338             for (int i = 0; i < a.length; i += SPECIES.length()) {
3339                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3340                 r[i] = av.reduceLanes(VectorOperators.ADD, vmask);
3341             }
3342         }
3343 
3344         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3345             ra = 0;
3346             for (int i = 0; i < a.length; i += SPECIES.length()) {
3347                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3348                 ra += av.reduceLanes(VectorOperators.ADD, vmask);
3349             }
3350         }
3351 
3352         assertReductionArraysEqualsMasked(r, ra, a, mask,
3353                 Int64VectorTests::ADDReduceMasked, Int64VectorTests::ADDReduceAllMasked);
3354     }

3355     static int MULReduce(int[] a, int idx) {
3356         int res = 1;
3357         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3358             res *= a[i];
3359         }
3360 
3361         return res;
3362     }
3363 
3364     static int MULReduceAll(int[] a) {
3365         int res = 1;
3366         for (int i = 0; i < a.length; i += SPECIES.length()) {
3367             res *= MULReduce(a, i);
3368         }
3369 
3370         return res;
3371     }

3372     @Test(dataProvider = "intUnaryOpProvider")
3373     static void MULReduceInt64VectorTests(IntFunction<int[]> fa) {
3374         int[] a = fa.apply(SPECIES.length());
3375         int[] r = fr.apply(SPECIES.length());
3376         int ra = 1;
3377 
3378         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3379             for (int i = 0; i < a.length; i += SPECIES.length()) {
3380                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3381                 r[i] = av.reduceLanes(VectorOperators.MUL);
3382             }
3383         }
3384 
3385         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3386             ra = 1;
3387             for (int i = 0; i < a.length; i += SPECIES.length()) {
3388                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3389                 ra *= av.reduceLanes(VectorOperators.MUL);
3390             }
3391         }
3392 
3393         assertReductionArraysEquals(r, ra, a,
3394                 Int64VectorTests::MULReduce, Int64VectorTests::MULReduceAll);
3395     }

3396     static int MULReduceMasked(int[] a, int idx, boolean[] mask) {
3397         int res = 1;
3398         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3399             if (mask[i % SPECIES.length()])
3400                 res *= a[i];
3401         }
3402 
3403         return res;
3404     }
3405 
3406     static int MULReduceAllMasked(int[] a, boolean[] mask) {
3407         int res = 1;
3408         for (int i = 0; i < a.length; i += SPECIES.length()) {
3409             res *= MULReduceMasked(a, i, mask);
3410         }
3411 
3412         return res;
3413     }

3414     @Test(dataProvider = "intUnaryOpMaskProvider")
3415     static void MULReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3416         int[] a = fa.apply(SPECIES.length());
3417         int[] r = fr.apply(SPECIES.length());
3418         boolean[] mask = fm.apply(SPECIES.length());
3419         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3420         int ra = 1;
3421 
3422         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3423             for (int i = 0; i < a.length; i += SPECIES.length()) {
3424                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3425                 r[i] = av.reduceLanes(VectorOperators.MUL, vmask);
3426             }
3427         }
3428 
3429         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3430             ra = 1;
3431             for (int i = 0; i < a.length; i += SPECIES.length()) {
3432                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3433                 ra *= av.reduceLanes(VectorOperators.MUL, vmask);
3434             }
3435         }
3436 
3437         assertReductionArraysEqualsMasked(r, ra, a, mask,
3438                 Int64VectorTests::MULReduceMasked, Int64VectorTests::MULReduceAllMasked);
3439     }

3440     static int MINReduce(int[] a, int idx) {
3441         int res = Integer.MAX_VALUE;
3442         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3443             res = (int) Math.min(res, a[i]);
3444         }
3445 
3446         return res;
3447     }
3448 
3449     static int MINReduceAll(int[] a) {
3450         int res = Integer.MAX_VALUE;
3451         for (int i = 0; i < a.length; i += SPECIES.length()) {
3452             res = (int) Math.min(res, MINReduce(a, i));
3453         }
3454 
3455         return res;
3456     }

3457     @Test(dataProvider = "intUnaryOpProvider")
3458     static void MINReduceInt64VectorTests(IntFunction<int[]> fa) {
3459         int[] a = fa.apply(SPECIES.length());
3460         int[] r = fr.apply(SPECIES.length());
3461         int ra = Integer.MAX_VALUE;
3462 
3463         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3464             for (int i = 0; i < a.length; i += SPECIES.length()) {
3465                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3466                 r[i] = av.reduceLanes(VectorOperators.MIN);
3467             }
3468         }
3469 
3470         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3471             ra = Integer.MAX_VALUE;
3472             for (int i = 0; i < a.length; i += SPECIES.length()) {
3473                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3474                 ra = (int) Math.min(ra, av.reduceLanes(VectorOperators.MIN));
3475             }
3476         }
3477 
3478         assertReductionArraysEquals(r, ra, a,
3479                 Int64VectorTests::MINReduce, Int64VectorTests::MINReduceAll);
3480     }

3481     static int MINReduceMasked(int[] a, int idx, boolean[] mask) {
3482         int res = Integer.MAX_VALUE;
3483         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3484             if (mask[i % SPECIES.length()])
3485                 res = (int) Math.min(res, a[i]);
3486         }
3487 
3488         return res;
3489     }
3490 
3491     static int MINReduceAllMasked(int[] a, boolean[] mask) {
3492         int res = Integer.MAX_VALUE;
3493         for (int i = 0; i < a.length; i += SPECIES.length()) {
3494             res = (int) Math.min(res, MINReduceMasked(a, i, mask));
3495         }
3496 
3497         return res;
3498     }

3499     @Test(dataProvider = "intUnaryOpMaskProvider")
3500     static void MINReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3501         int[] a = fa.apply(SPECIES.length());
3502         int[] r = fr.apply(SPECIES.length());
3503         boolean[] mask = fm.apply(SPECIES.length());
3504         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3505         int ra = Integer.MAX_VALUE;
3506 
3507         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3508             for (int i = 0; i < a.length; i += SPECIES.length()) {
3509                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3510                 r[i] = av.reduceLanes(VectorOperators.MIN, vmask);
3511             }
3512         }
3513 
3514         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3515             ra = Integer.MAX_VALUE;
3516             for (int i = 0; i < a.length; i += SPECIES.length()) {
3517                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3518                 ra = (int) Math.min(ra, av.reduceLanes(VectorOperators.MIN, vmask));
3519             }
3520         }
3521 
3522         assertReductionArraysEqualsMasked(r, ra, a, mask,
3523                 Int64VectorTests::MINReduceMasked, Int64VectorTests::MINReduceAllMasked);
3524     }

3525     static int MAXReduce(int[] a, int idx) {
3526         int res = Integer.MIN_VALUE;
3527         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3528             res = (int) Math.max(res, a[i]);
3529         }
3530 
3531         return res;
3532     }
3533 
3534     static int MAXReduceAll(int[] a) {
3535         int res = Integer.MIN_VALUE;
3536         for (int i = 0; i < a.length; i += SPECIES.length()) {
3537             res = (int) Math.max(res, MAXReduce(a, i));
3538         }
3539 
3540         return res;
3541     }

3542     @Test(dataProvider = "intUnaryOpProvider")
3543     static void MAXReduceInt64VectorTests(IntFunction<int[]> fa) {
3544         int[] a = fa.apply(SPECIES.length());
3545         int[] r = fr.apply(SPECIES.length());
3546         int ra = Integer.MIN_VALUE;
3547 
3548         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3549             for (int i = 0; i < a.length; i += SPECIES.length()) {
3550                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3551                 r[i] = av.reduceLanes(VectorOperators.MAX);
3552             }
3553         }
3554 
3555         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3556             ra = Integer.MIN_VALUE;
3557             for (int i = 0; i < a.length; i += SPECIES.length()) {
3558                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3559                 ra = (int) Math.max(ra, av.reduceLanes(VectorOperators.MAX));
3560             }
3561         }
3562 
3563         assertReductionArraysEquals(r, ra, a,
3564                 Int64VectorTests::MAXReduce, Int64VectorTests::MAXReduceAll);
3565     }

3566     static int MAXReduceMasked(int[] a, int idx, boolean[] mask) {
3567         int res = Integer.MIN_VALUE;
3568         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3569             if (mask[i % SPECIES.length()])
3570                 res = (int) Math.max(res, a[i]);
3571         }
3572 
3573         return res;
3574     }
3575 
3576     static int MAXReduceAllMasked(int[] a, boolean[] mask) {
3577         int res = Integer.MIN_VALUE;
3578         for (int i = 0; i < a.length; i += SPECIES.length()) {
3579             res = (int) Math.max(res, MAXReduceMasked(a, i, mask));
3580         }
3581 
3582         return res;
3583     }

3584     @Test(dataProvider = "intUnaryOpMaskProvider")
3585     static void MAXReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3586         int[] a = fa.apply(SPECIES.length());
3587         int[] r = fr.apply(SPECIES.length());
3588         boolean[] mask = fm.apply(SPECIES.length());
3589         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3590         int ra = Integer.MIN_VALUE;
3591 
3592         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3593             for (int i = 0; i < a.length; i += SPECIES.length()) {
3594                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3595                 r[i] = av.reduceLanes(VectorOperators.MAX, vmask);
3596             }
3597         }
3598 
3599         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3600             ra = Integer.MIN_VALUE;
3601             for (int i = 0; i < a.length; i += SPECIES.length()) {
3602                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3603                 ra = (int) Math.max(ra, av.reduceLanes(VectorOperators.MAX, vmask));
3604             }
3605         }
3606 
3607         assertReductionArraysEqualsMasked(r, ra, a, mask,
3608                 Int64VectorTests::MAXReduceMasked, Int64VectorTests::MAXReduceAllMasked);
3609     }

3610     static int FIRST_NONZEROReduce(int[] a, int idx) {
3611         int res = (int) 0;
3612         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3613             res = firstNonZero(res, a[i]);
3614         }
3615 
3616         return res;
3617     }
3618 
3619     static int FIRST_NONZEROReduceAll(int[] a) {
3620         int res = (int) 0;
3621         for (int i = 0; i < a.length; i += SPECIES.length()) {
3622             res = firstNonZero(res, FIRST_NONZEROReduce(a, i));
3623         }
3624 
3625         return res;
3626     }

3627     @Test(dataProvider = "intUnaryOpProvider")
3628     static void FIRST_NONZEROReduceInt64VectorTests(IntFunction<int[]> fa) {
3629         int[] a = fa.apply(SPECIES.length());
3630         int[] r = fr.apply(SPECIES.length());
3631         int ra = (int) 0;
3632 
3633         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3634             for (int i = 0; i < a.length; i += SPECIES.length()) {
3635                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3636                 r[i] = av.reduceLanes(VectorOperators.FIRST_NONZERO);
3637             }
3638         }
3639 
3640         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3641             ra = (int) 0;
3642             for (int i = 0; i < a.length; i += SPECIES.length()) {
3643                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3644                 ra = firstNonZero(ra, av.reduceLanes(VectorOperators.FIRST_NONZERO));
3645             }
3646         }
3647 
3648         assertReductionArraysEquals(r, ra, a,
3649                 Int64VectorTests::FIRST_NONZEROReduce, Int64VectorTests::FIRST_NONZEROReduceAll);
3650     }

3651     static int FIRST_NONZEROReduceMasked(int[] a, int idx, boolean[] mask) {
3652         int res = (int) 0;
3653         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3654             if (mask[i % SPECIES.length()])
3655                 res = firstNonZero(res, a[i]);
3656         }
3657 
3658         return res;
3659     }
3660 
3661     static int FIRST_NONZEROReduceAllMasked(int[] a, boolean[] mask) {
3662         int res = (int) 0;
3663         for (int i = 0; i < a.length; i += SPECIES.length()) {
3664             res = firstNonZero(res, FIRST_NONZEROReduceMasked(a, i, mask));
3665         }
3666 
3667         return res;
3668     }

3669     @Test(dataProvider = "intUnaryOpMaskProvider")
3670     static void FIRST_NONZEROReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3671         int[] a = fa.apply(SPECIES.length());
3672         int[] r = fr.apply(SPECIES.length());
3673         boolean[] mask = fm.apply(SPECIES.length());
3674         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3675         int ra = (int) 0;
3676 
3677         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3678             for (int i = 0; i < a.length; i += SPECIES.length()) {
3679                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3680                 r[i] = av.reduceLanes(VectorOperators.FIRST_NONZERO, vmask);
3681             }
3682         }
3683 
3684         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3685             ra = (int) 0;
3686             for (int i = 0; i < a.length; i += SPECIES.length()) {
3687                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3688                 ra = firstNonZero(ra, av.reduceLanes(VectorOperators.FIRST_NONZERO, vmask));
3689             }
3690         }
3691 
3692         assertReductionArraysEqualsMasked(r, ra, a, mask,
3693                 Int64VectorTests::FIRST_NONZEROReduceMasked, Int64VectorTests::FIRST_NONZEROReduceAllMasked);
3694     }
3695 
3696     static boolean anyTrue(boolean[] a, int idx) {
3697         boolean res = false;
3698         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3699             res |= a[i];
3700         }
3701 
3702         return res;
3703     }
3704 
3705 
3706     @Test(dataProvider = "boolUnaryOpProvider")
3707     static void anyTrueInt64VectorTests(IntFunction<boolean[]> fm) {
3708         boolean[] mask = fm.apply(SPECIES.length());
3709         boolean[] r = fmr.apply(SPECIES.length());
3710 
3711         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3712             for (int i = 0; i < mask.length; i += SPECIES.length()) {
3713                 VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, i);
3714                 r[i] = vmask.anyTrue();
3715             }
3716         }
3717 
3718         assertReductionBoolArraysEquals(r, mask, Int64VectorTests::anyTrue);
3719     }
3720 
3721 
3722     static boolean allTrue(boolean[] a, int idx) {
3723         boolean res = true;
3724         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3725             res &= a[i];
3726         }
3727 
3728         return res;
3729     }
3730 
3731 
3732     @Test(dataProvider = "boolUnaryOpProvider")
3733     static void allTrueInt64VectorTests(IntFunction<boolean[]> fm) {
3734         boolean[] mask = fm.apply(SPECIES.length());
3735         boolean[] r = fmr.apply(SPECIES.length());
3736 
3737         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3738             for (int i = 0; i < mask.length; i += SPECIES.length()) {
3739                 VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, i);
3740                 r[i] = vmask.allTrue();
3741             }
3742         }
3743 
3744         assertReductionBoolArraysEquals(r, mask, Int64VectorTests::allTrue);
3745     }
3746 
3747 
3748     @Test(dataProvider = "intUnaryOpProvider")
3749     static void withInt64VectorTests(IntFunction<int []> fa) {
3750         int[] a = fa.apply(SPECIES.length());
3751         int[] r = fr.apply(SPECIES.length());
3752 
3753         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3754             for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
3755                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3756                 av.withLane((j++ & (SPECIES.length()-1)), (int)(65535+i)).intoArray(r, i);
3757             }
3758         }
3759 
3760 
3761         for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
3762             assertInsertArraysEquals(r, a, (int)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
3763         }
3764     }

3765     static boolean testIS_DEFAULT(int a) {
3766         return bits(a)==0;
3767     }
3768 
3769     @Test(dataProvider = "intTestOpProvider")
3770     static void IS_DEFAULTInt64VectorTests(IntFunction<int[]> fa) {
3771         int[] a = fa.apply(SPECIES.length());
3772 
3773         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3774             for (int i = 0; i < a.length; i += SPECIES.length()) {
3775                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3776                 VectorMask<Integer> mv = av.test(VectorOperators.IS_DEFAULT);
3777 
3778                 // Check results as part of computation.
3779                 for (int j = 0; j < SPECIES.length(); j++) {
3780                     Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j]));
3781                 }
3782             }
3783         }
3784     }
3785 
3786     @Test(dataProvider = "intTestOpMaskProvider")
3787     static void IS_DEFAULTMaskedInt64VectorTests(IntFunction<int[]> fa,
3788                                           IntFunction<boolean[]> fm) {
3789         int[] a = fa.apply(SPECIES.length());
3790         boolean[] mask = fm.apply(SPECIES.length());
3791         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3792 
3793         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3794             for (int i = 0; i < a.length; i += SPECIES.length()) {
3795                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3796                 VectorMask<Integer> mv = av.test(VectorOperators.IS_DEFAULT, vmask);
3797 
3798                 // Check results as part of computation.
3799                 for (int j = 0; j < SPECIES.length(); j++) {
3800                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j]));
3801                 }
3802             }
3803         }
3804     }

3805     static boolean testIS_NEGATIVE(int a) {
3806         return bits(a)<0;
3807     }
3808 
3809     @Test(dataProvider = "intTestOpProvider")
3810     static void IS_NEGATIVEInt64VectorTests(IntFunction<int[]> fa) {
3811         int[] a = fa.apply(SPECIES.length());
3812 
3813         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3814             for (int i = 0; i < a.length; i += SPECIES.length()) {
3815                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3816                 VectorMask<Integer> mv = av.test(VectorOperators.IS_NEGATIVE);
3817 
3818                 // Check results as part of computation.
3819                 for (int j = 0; j < SPECIES.length(); j++) {
3820                     Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j]));
3821                 }
3822             }
3823         }
3824     }

3826     @Test(dataProvider = "intTestOpMaskProvider")
3827     static void IS_NEGATIVEMaskedInt64VectorTests(IntFunction<int[]> fa,
3828                                           IntFunction<boolean[]> fm) {
3829         int[] a = fa.apply(SPECIES.length());
3830         boolean[] mask = fm.apply(SPECIES.length());
3831         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3832 
3833         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3834             for (int i = 0; i < a.length; i += SPECIES.length()) {
3835                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3836                 VectorMask<Integer> mv = av.test(VectorOperators.IS_NEGATIVE, vmask);
3837 
3838                 // Check results as part of computation.
3839                 for (int j = 0; j < SPECIES.length(); j++) {
3840                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j]));
3841                 }
3842             }
3843         }
3844     }
3845 
3846 
3847 
3848 
3849     @Test(dataProvider = "intCompareOpProvider")
3850     static void LTInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
3851         int[] a = fa.apply(SPECIES.length());
3852         int[] b = fb.apply(SPECIES.length());
3853 
3854         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3855             for (int i = 0; i < a.length; i += SPECIES.length()) {
3856                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3857                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
3858                 VectorMask<Integer> mv = av.compare(VectorOperators.LT, bv);
3859 
3860                 // Check results as part of computation.
3861                 for (int j = 0; j < SPECIES.length(); j++) {
3862                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
3863                 }
3864             }
3865         }
3866     }
3867 
3868 
3869     @Test(dataProvider = "intCompareOpProvider")
3870     static void ltInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
3871         int[] a = fa.apply(SPECIES.length());
3872         int[] b = fb.apply(SPECIES.length());
3873 
3874         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3875             for (int i = 0; i < a.length; i += SPECIES.length()) {
3876                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3877                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
3878                 VectorMask<Integer> mv = av.lt(bv);
3879 
3880                 // Check results as part of computation.
3881                 for (int j = 0; j < SPECIES.length(); j++) {
3882                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
3883                 }
3884             }
3885         }
3886     }
3887 
3888     @Test(dataProvider = "intCompareOpMaskProvider")

3891         int[] a = fa.apply(SPECIES.length());
3892         int[] b = fb.apply(SPECIES.length());
3893         boolean[] mask = fm.apply(SPECIES.length());
3894 
3895         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3896 
3897         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3898             for (int i = 0; i < a.length; i += SPECIES.length()) {
3899                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3900                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
3901                 VectorMask<Integer> mv = av.compare(VectorOperators.LT, bv, vmask);
3902 
3903                 // Check results as part of computation.
3904                 for (int j = 0; j < SPECIES.length(); j++) {
3905                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j]));
3906                 }
3907             }
3908         }
3909     }
3910 
3911 
3912     @Test(dataProvider = "intCompareOpProvider")
3913     static void GTInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
3914         int[] a = fa.apply(SPECIES.length());
3915         int[] b = fb.apply(SPECIES.length());
3916 
3917         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3918             for (int i = 0; i < a.length; i += SPECIES.length()) {
3919                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3920                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
3921                 VectorMask<Integer> mv = av.compare(VectorOperators.GT, bv);
3922 
3923                 // Check results as part of computation.
3924                 for (int j = 0; j < SPECIES.length(); j++) {
3925                     Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j]));
3926                 }
3927             }
3928         }
3929     }
3930 
3931     @Test(dataProvider = "intCompareOpMaskProvider")

3934         int[] a = fa.apply(SPECIES.length());
3935         int[] b = fb.apply(SPECIES.length());
3936         boolean[] mask = fm.apply(SPECIES.length());
3937 
3938         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3939 
3940         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3941             for (int i = 0; i < a.length; i += SPECIES.length()) {
3942                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3943                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
3944                 VectorMask<Integer> mv = av.compare(VectorOperators.GT, bv, vmask);
3945 
3946                 // Check results as part of computation.
3947                 for (int j = 0; j < SPECIES.length(); j++) {
3948                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j]));
3949                 }
3950             }
3951         }
3952     }
3953 
3954 
3955     @Test(dataProvider = "intCompareOpProvider")
3956     static void EQInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
3957         int[] a = fa.apply(SPECIES.length());
3958         int[] b = fb.apply(SPECIES.length());
3959 
3960         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3961             for (int i = 0; i < a.length; i += SPECIES.length()) {
3962                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3963                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
3964                 VectorMask<Integer> mv = av.compare(VectorOperators.EQ, bv);
3965 
3966                 // Check results as part of computation.
3967                 for (int j = 0; j < SPECIES.length(); j++) {
3968                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
3969                 }
3970             }
3971         }
3972     }
3973 
3974 
3975     @Test(dataProvider = "intCompareOpProvider")
3976     static void eqInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
3977         int[] a = fa.apply(SPECIES.length());
3978         int[] b = fb.apply(SPECIES.length());
3979 
3980         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3981             for (int i = 0; i < a.length; i += SPECIES.length()) {
3982                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3983                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
3984                 VectorMask<Integer> mv = av.eq(bv);
3985 
3986                 // Check results as part of computation.
3987                 for (int j = 0; j < SPECIES.length(); j++) {
3988                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
3989                 }
3990             }
3991         }
3992     }
3993 
3994     @Test(dataProvider = "intCompareOpMaskProvider")

3997         int[] a = fa.apply(SPECIES.length());
3998         int[] b = fb.apply(SPECIES.length());
3999         boolean[] mask = fm.apply(SPECIES.length());
4000 
4001         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4002 
4003         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4004             for (int i = 0; i < a.length; i += SPECIES.length()) {
4005                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4006                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4007                 VectorMask<Integer> mv = av.compare(VectorOperators.EQ, bv, vmask);
4008 
4009                 // Check results as part of computation.
4010                 for (int j = 0; j < SPECIES.length(); j++) {
4011                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j]));
4012                 }
4013             }
4014         }
4015     }
4016 
4017 
4018     @Test(dataProvider = "intCompareOpProvider")
4019     static void NEInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4020         int[] a = fa.apply(SPECIES.length());
4021         int[] b = fb.apply(SPECIES.length());
4022 
4023         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4024             for (int i = 0; i < a.length; i += SPECIES.length()) {
4025                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4026                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4027                 VectorMask<Integer> mv = av.compare(VectorOperators.NE, bv);
4028 
4029                 // Check results as part of computation.
4030                 for (int j = 0; j < SPECIES.length(); j++) {
4031                     Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j]));
4032                 }
4033             }
4034         }
4035     }
4036 
4037     @Test(dataProvider = "intCompareOpMaskProvider")

4040         int[] a = fa.apply(SPECIES.length());
4041         int[] b = fb.apply(SPECIES.length());
4042         boolean[] mask = fm.apply(SPECIES.length());
4043 
4044         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4045 
4046         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4047             for (int i = 0; i < a.length; i += SPECIES.length()) {
4048                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4049                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4050                 VectorMask<Integer> mv = av.compare(VectorOperators.NE, bv, vmask);
4051 
4052                 // Check results as part of computation.
4053                 for (int j = 0; j < SPECIES.length(); j++) {
4054                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j]));
4055                 }
4056             }
4057         }
4058     }
4059 
4060 
4061     @Test(dataProvider = "intCompareOpProvider")
4062     static void LEInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4063         int[] a = fa.apply(SPECIES.length());
4064         int[] b = fb.apply(SPECIES.length());
4065 
4066         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4067             for (int i = 0; i < a.length; i += SPECIES.length()) {
4068                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4069                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4070                 VectorMask<Integer> mv = av.compare(VectorOperators.LE, bv);
4071 
4072                 // Check results as part of computation.
4073                 for (int j = 0; j < SPECIES.length(); j++) {
4074                     Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j]));
4075                 }
4076             }
4077         }
4078     }
4079 
4080     @Test(dataProvider = "intCompareOpMaskProvider")

4083         int[] a = fa.apply(SPECIES.length());
4084         int[] b = fb.apply(SPECIES.length());
4085         boolean[] mask = fm.apply(SPECIES.length());
4086 
4087         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4088 
4089         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4090             for (int i = 0; i < a.length; i += SPECIES.length()) {
4091                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4092                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4093                 VectorMask<Integer> mv = av.compare(VectorOperators.LE, bv, vmask);
4094 
4095                 // Check results as part of computation.
4096                 for (int j = 0; j < SPECIES.length(); j++) {
4097                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j]));
4098                 }
4099             }
4100         }
4101     }
4102 
4103 
4104     @Test(dataProvider = "intCompareOpProvider")
4105     static void GEInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4106         int[] a = fa.apply(SPECIES.length());
4107         int[] b = fb.apply(SPECIES.length());
4108 
4109         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4110             for (int i = 0; i < a.length; i += SPECIES.length()) {
4111                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4112                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4113                 VectorMask<Integer> mv = av.compare(VectorOperators.GE, bv);
4114 
4115                 // Check results as part of computation.
4116                 for (int j = 0; j < SPECIES.length(); j++) {
4117                     Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j]));
4118                 }
4119             }
4120         }
4121     }
4122 
4123     @Test(dataProvider = "intCompareOpMaskProvider")

4126         int[] a = fa.apply(SPECIES.length());
4127         int[] b = fb.apply(SPECIES.length());
4128         boolean[] mask = fm.apply(SPECIES.length());
4129 
4130         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4131 
4132         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4133             for (int i = 0; i < a.length; i += SPECIES.length()) {
4134                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4135                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4136                 VectorMask<Integer> mv = av.compare(VectorOperators.GE, bv, vmask);
4137 
4138                 // Check results as part of computation.
4139                 for (int j = 0; j < SPECIES.length(); j++) {
4140                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j]));
4141                 }
4142             }
4143         }
4144     }
4145 
4146 
4147 
4148     @Test(dataProvider = "intCompareOpProvider")
4149     static void UNSIGNED_LTInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4150         int[] a = fa.apply(SPECIES.length());
4151         int[] b = fb.apply(SPECIES.length());
4152 
4153         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4154             for (int i = 0; i < a.length; i += SPECIES.length()) {
4155                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4156                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4157                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_LT, bv);
4158 
4159                 // Check results as part of computation.
4160                 for (int j = 0; j < SPECIES.length(); j++) {
4161                     Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j]));
4162                 }
4163             }
4164         }
4165     }
4166 
4167 
4168 
4169     @Test(dataProvider = "intCompareOpMaskProvider")
4170     static void UNSIGNED_LTInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
4171                                                 IntFunction<boolean[]> fm) {
4172         int[] a = fa.apply(SPECIES.length());
4173         int[] b = fb.apply(SPECIES.length());
4174         boolean[] mask = fm.apply(SPECIES.length());
4175 
4176         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4177 
4178         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4179             for (int i = 0; i < a.length; i += SPECIES.length()) {
4180                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4181                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4182                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_LT, bv, vmask);
4183 
4184                 // Check results as part of computation.
4185                 for (int j = 0; j < SPECIES.length(); j++) {
4186                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j]));
4187                 }
4188             }
4189         }
4190     }
4191 
4192 
4193 
4194 
4195     @Test(dataProvider = "intCompareOpProvider")
4196     static void UNSIGNED_GTInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4197         int[] a = fa.apply(SPECIES.length());
4198         int[] b = fb.apply(SPECIES.length());
4199 
4200         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4201             for (int i = 0; i < a.length; i += SPECIES.length()) {
4202                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4203                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4204                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_GT, bv);
4205 
4206                 // Check results as part of computation.
4207                 for (int j = 0; j < SPECIES.length(); j++) {
4208                     Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j]));
4209                 }
4210             }
4211         }
4212     }
4213 
4214 
4215 
4216     @Test(dataProvider = "intCompareOpMaskProvider")
4217     static void UNSIGNED_GTInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
4218                                                 IntFunction<boolean[]> fm) {
4219         int[] a = fa.apply(SPECIES.length());
4220         int[] b = fb.apply(SPECIES.length());
4221         boolean[] mask = fm.apply(SPECIES.length());
4222 
4223         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4224 
4225         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4226             for (int i = 0; i < a.length; i += SPECIES.length()) {
4227                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4228                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4229                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_GT, bv, vmask);
4230 
4231                 // Check results as part of computation.
4232                 for (int j = 0; j < SPECIES.length(); j++) {
4233                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j]));
4234                 }
4235             }
4236         }
4237     }
4238 
4239 
4240 
4241 
4242     @Test(dataProvider = "intCompareOpProvider")
4243     static void UNSIGNED_LEInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4244         int[] a = fa.apply(SPECIES.length());
4245         int[] b = fb.apply(SPECIES.length());
4246 
4247         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4248             for (int i = 0; i < a.length; i += SPECIES.length()) {
4249                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4250                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4251                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_LE, bv);
4252 
4253                 // Check results as part of computation.
4254                 for (int j = 0; j < SPECIES.length(); j++) {
4255                     Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j]));
4256                 }
4257             }
4258         }
4259     }
4260 
4261 
4262 
4263     @Test(dataProvider = "intCompareOpMaskProvider")
4264     static void UNSIGNED_LEInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
4265                                                 IntFunction<boolean[]> fm) {
4266         int[] a = fa.apply(SPECIES.length());
4267         int[] b = fb.apply(SPECIES.length());
4268         boolean[] mask = fm.apply(SPECIES.length());
4269 
4270         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4271 
4272         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4273             for (int i = 0; i < a.length; i += SPECIES.length()) {
4274                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4275                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4276                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_LE, bv, vmask);
4277 
4278                 // Check results as part of computation.
4279                 for (int j = 0; j < SPECIES.length(); j++) {
4280                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j]));
4281                 }
4282             }
4283         }
4284     }
4285 
4286 
4287 
4288 
4289     @Test(dataProvider = "intCompareOpProvider")
4290     static void UNSIGNED_GEInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4291         int[] a = fa.apply(SPECIES.length());
4292         int[] b = fb.apply(SPECIES.length());
4293 
4294         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4295             for (int i = 0; i < a.length; i += SPECIES.length()) {
4296                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4297                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4298                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_GE, bv);
4299 
4300                 // Check results as part of computation.
4301                 for (int j = 0; j < SPECIES.length(); j++) {
4302                     Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j]));
4303                 }
4304             }
4305         }
4306     }
4307 
4308 
4309 
4310     @Test(dataProvider = "intCompareOpMaskProvider")
4311     static void UNSIGNED_GEInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
4312                                                 IntFunction<boolean[]> fm) {
4313         int[] a = fa.apply(SPECIES.length());
4314         int[] b = fb.apply(SPECIES.length());
4315         boolean[] mask = fm.apply(SPECIES.length());
4316 
4317         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4318 
4319         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4320             for (int i = 0; i < a.length; i += SPECIES.length()) {
4321                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4322                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4323                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_GE, bv, vmask);
4324 
4325                 // Check results as part of computation.
4326                 for (int j = 0; j < SPECIES.length(); j++) {
4327                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j]));
4328                 }
4329             }
4330         }
4331     }
4332 
4333 
4334 
4335     @Test(dataProvider = "intCompareOpProvider")
4336     static void LTInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4337         int[] a = fa.apply(SPECIES.length());
4338         int[] b = fb.apply(SPECIES.length());
4339 
4340         for (int i = 0; i < a.length; i += SPECIES.length()) {
4341             IntVector av = IntVector.fromArray(SPECIES, a, i);
4342             VectorMask<Integer> mv = av.compare(VectorOperators.LT, b[i]);
4343 
4344             // Check results as part of computation.
4345             for (int j = 0; j < SPECIES.length(); j++) {
4346                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
4347             }
4348         }
4349     }
4350 
4351 
4352     @Test(dataProvider = "intCompareOpMaskProvider")
4353     static void LTInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa,
4354                                 IntFunction<int[]> fb, IntFunction<boolean[]> fm) {
4355         int[] a = fa.apply(SPECIES.length());
4356         int[] b = fb.apply(SPECIES.length());
4357         boolean[] mask = fm.apply(SPECIES.length());
4358 
4359         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4360 
4361         for (int i = 0; i < a.length; i += SPECIES.length()) {
4362             IntVector av = IntVector.fromArray(SPECIES, a, i);
4363             VectorMask<Integer> mv = av.compare(VectorOperators.LT, b[i], vmask);
4364 
4365             // Check results as part of computation.
4366             for (int j = 0; j < SPECIES.length(); j++) {
4367                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i]));
4368             }
4369         }
4370     }
4371 
4372     @Test(dataProvider = "intCompareOpProvider")
4373     static void LTInt64VectorTestsBroadcastLongSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4374         int[] a = fa.apply(SPECIES.length());
4375         int[] b = fb.apply(SPECIES.length());
4376 
4377         for (int i = 0; i < a.length; i += SPECIES.length()) {
4378             IntVector av = IntVector.fromArray(SPECIES, a, i);
4379             VectorMask<Integer> mv = av.compare(VectorOperators.LT, (long)b[i]);
4380 
4381             // Check results as part of computation.
4382             for (int j = 0; j < SPECIES.length(); j++) {
4383                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i]));
4384             }
4385         }
4386     }
4387 
4388 
4389     @Test(dataProvider = "intCompareOpMaskProvider")
4390     static void LTInt64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction<int[]> fa,
4391                                 IntFunction<int[]> fb, IntFunction<boolean[]> fm) {
4392         int[] a = fa.apply(SPECIES.length());
4393         int[] b = fb.apply(SPECIES.length());
4394         boolean[] mask = fm.apply(SPECIES.length());
4395 
4396         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4397 
4398         for (int i = 0; i < a.length; i += SPECIES.length()) {
4399             IntVector av = IntVector.fromArray(SPECIES, a, i);
4400             VectorMask<Integer> mv = av.compare(VectorOperators.LT, (long)b[i], vmask);
4401 
4402             // Check results as part of computation.
4403             for (int j = 0; j < SPECIES.length(); j++) {
4404                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i])));
4405             }
4406         }
4407     }
4408 
4409     @Test(dataProvider = "intCompareOpProvider")
4410     static void EQInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4411         int[] a = fa.apply(SPECIES.length());
4412         int[] b = fb.apply(SPECIES.length());
4413 
4414         for (int i = 0; i < a.length; i += SPECIES.length()) {
4415             IntVector av = IntVector.fromArray(SPECIES, a, i);
4416             VectorMask<Integer> mv = av.compare(VectorOperators.EQ, b[i]);
4417 
4418             // Check results as part of computation.
4419             for (int j = 0; j < SPECIES.length(); j++) {
4420                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
4421             }
4422         }
4423     }
4424 
4425 
4426     @Test(dataProvider = "intCompareOpMaskProvider")
4427     static void EQInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa,
4428                                 IntFunction<int[]> fb, IntFunction<boolean[]> fm) {
4429         int[] a = fa.apply(SPECIES.length());
4430         int[] b = fb.apply(SPECIES.length());
4431         boolean[] mask = fm.apply(SPECIES.length());
4432 
4433         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4434 
4435         for (int i = 0; i < a.length; i += SPECIES.length()) {
4436             IntVector av = IntVector.fromArray(SPECIES, a, i);
4437             VectorMask<Integer> mv = av.compare(VectorOperators.EQ, b[i], vmask);
4438 
4439             // Check results as part of computation.
4440             for (int j = 0; j < SPECIES.length(); j++) {
4441                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i]));
4442             }
4443         }
4444     }
4445 
4446     @Test(dataProvider = "intCompareOpProvider")
4447     static void EQInt64VectorTestsBroadcastLongSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4448         int[] a = fa.apply(SPECIES.length());
4449         int[] b = fb.apply(SPECIES.length());
4450 
4451         for (int i = 0; i < a.length; i += SPECIES.length()) {
4452             IntVector av = IntVector.fromArray(SPECIES, a, i);
4453             VectorMask<Integer> mv = av.compare(VectorOperators.EQ, (long)b[i]);
4454 
4455             // Check results as part of computation.
4456             for (int j = 0; j < SPECIES.length(); j++) {
4457                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i]));
4458             }
4459         }
4460     }
4461 
4462 
4463     @Test(dataProvider = "intCompareOpMaskProvider")
4464     static void EQInt64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction<int[]> fa,
4465                                 IntFunction<int[]> fb, IntFunction<boolean[]> fm) {
4466         int[] a = fa.apply(SPECIES.length());
4467         int[] b = fb.apply(SPECIES.length());
4468         boolean[] mask = fm.apply(SPECIES.length());
4469 
4470         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4471 
4472         for (int i = 0; i < a.length; i += SPECIES.length()) {
4473             IntVector av = IntVector.fromArray(SPECIES, a, i);
4474             VectorMask<Integer> mv = av.compare(VectorOperators.EQ, (long)b[i], vmask);
4475 
4476             // Check results as part of computation.
4477             for (int j = 0; j < SPECIES.length(); j++) {
4478                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i])));
4479             }
4480         }
4481     }
4482 

4521         assertRearrangeArraysEquals(r, a, order, SPECIES.length());
4522     }
4523 
4524     @Test(dataProvider = "intUnaryOpShuffleMaskProvider")
4525     static void RearrangeInt64VectorTestsMaskedSmokeTest(IntFunction<int[]> fa,
4526                                                           BiFunction<Integer,Integer,int[]> fs,
4527                                                           IntFunction<boolean[]> fm) {
4528         int[] a = fa.apply(SPECIES.length());
4529         int[] order = fs.apply(a.length, SPECIES.length());
4530         int[] r = fr.apply(SPECIES.length());
4531         boolean[] mask = fm.apply(SPECIES.length());
4532         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4533 
4534         for (int i = 0; i < a.length; i += SPECIES.length()) {
4535             IntVector av = IntVector.fromArray(SPECIES, a, i);
4536             av.rearrange(VectorShuffle.fromArray(SPECIES, order, i), vmask).intoArray(r, i);
4537         }
4538 
4539         assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
4540     }





































4541     @Test(dataProvider = "intUnaryOpProvider")
4542     static void getInt64VectorTests(IntFunction<int[]> fa) {
4543         int[] a = fa.apply(SPECIES.length());
4544         int[] r = fr.apply(SPECIES.length());
4545 
4546         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4547             for (int i = 0; i < a.length; i += SPECIES.length()) {
4548                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4549                 int num_lanes = SPECIES.length();
4550                 // Manually unroll because full unroll happens after intrinsification.
4551                 // Unroll is needed because get intrinsic requires for index to be a known constant.
4552                 if (num_lanes == 1) {
4553                     r[i]=av.lane(0);
4554                 } else if (num_lanes == 2) {
4555                     r[i]=av.lane(0);
4556                     r[i+1]=av.lane(1);
4557                 } else if (num_lanes == 4) {
4558                     r[i]=av.lane(0);
4559                     r[i+1]=av.lane(1);
4560                     r[i+2]=av.lane(2);

4691             }
4692         }
4693 
4694         assertArraysEquals(r, a, Int64VectorTests::get);
4695     }
4696 
4697     @Test(dataProvider = "intUnaryOpProvider")
4698     static void BroadcastInt64VectorTests(IntFunction<int[]> fa) {
4699         int[] a = fa.apply(SPECIES.length());
4700         int[] r = new int[a.length];
4701 
4702         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4703             for (int i = 0; i < a.length; i += SPECIES.length()) {
4704                 IntVector.broadcast(SPECIES, a[i]).intoArray(r, i);
4705             }
4706         }
4707 
4708         assertBroadcastArraysEquals(r, a);
4709     }
4710 
4711 
4712 
4713 
4714 
4715     @Test(dataProvider = "intUnaryOpProvider")
4716     static void ZeroInt64VectorTests(IntFunction<int[]> fa) {
4717         int[] a = fa.apply(SPECIES.length());
4718         int[] r = new int[a.length];
4719 
4720         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4721             for (int i = 0; i < a.length; i += SPECIES.length()) {
4722                 IntVector.zero(SPECIES).intoArray(a, i);
4723             }
4724         }
4725 
4726         Assert.assertEquals(a, r);
4727     }
4728 
4729 
4730 
4731 
4732     static int[] sliceUnary(int[] a, int origin, int idx) {
4733         int[] res = new int[SPECIES.length()];
4734         for (int i = 0; i < SPECIES.length(); i++){
4735             if(i+origin < SPECIES.length())
4736                 res[i] = a[idx+i+origin];
4737             else
4738                 res[i] = (int)0;
4739         }
4740         return res;
4741     }
4742 
4743     @Test(dataProvider = "intUnaryOpProvider")
4744     static void sliceUnaryInt64VectorTests(IntFunction<int[]> fa) {
4745         int[] a = fa.apply(SPECIES.length());
4746         int[] r = new int[a.length];
4747         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4748         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4749             for (int i = 0; i < a.length; i += SPECIES.length()) {
4750                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4751                 av.slice(origin).intoArray(r, i);
4752             }
4753         }
4754 
4755         assertArraysEquals(r, a, origin, Int64VectorTests::sliceUnary);
4756     }

4757     static int[] sliceBinary(int[] a, int[] b, int origin, int idx) {
4758         int[] res = new int[SPECIES.length()];
4759         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4760             if(i+origin < SPECIES.length())
4761                 res[i] = a[idx+i+origin];
4762             else {
4763                 res[i] = b[idx+j];
4764                 j++;
4765             }
4766         }
4767         return res;
4768     }
4769 
4770     @Test(dataProvider = "intBinaryOpProvider")
4771     static void sliceBinaryInt64VectorTestsBinary(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4772         int[] a = fa.apply(SPECIES.length());
4773         int[] b = fb.apply(SPECIES.length());
4774         int[] r = new int[a.length];
4775         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4776         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4777             for (int i = 0; i < a.length; i += SPECIES.length()) {
4778                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4779                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4780                 av.slice(origin, bv).intoArray(r, i);
4781             }
4782         }
4783 
4784         assertArraysEquals(r, a, b, origin, Int64VectorTests::sliceBinary);
4785     }

4786     static int[] slice(int[] a, int[] b, int origin, boolean[] mask, int idx) {
4787         int[] res = new int[SPECIES.length()];
4788         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4789             if(i+origin < SPECIES.length())
4790                 res[i] = mask[i] ? a[idx+i+origin] : (int)0;
4791             else {
4792                 res[i] = mask[i] ? b[idx+j] : (int)0;
4793                 j++;
4794             }
4795         }
4796         return res;
4797     }
4798 
4799     @Test(dataProvider = "intBinaryOpMaskProvider")
4800     static void sliceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
4801     IntFunction<boolean[]> fm) {
4802         int[] a = fa.apply(SPECIES.length());
4803         int[] b = fb.apply(SPECIES.length());
4804         boolean[] mask = fm.apply(SPECIES.length());
4805         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4806 
4807         int[] r = new int[a.length];
4808         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4809         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4810             for (int i = 0; i < a.length; i += SPECIES.length()) {
4811                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4812                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4813                 av.slice(origin, bv, vmask).intoArray(r, i);
4814             }
4815         }
4816 
4817         assertArraysEquals(r, a, b, origin, mask, Int64VectorTests::slice);
4818     }

4819     static int[] unsliceUnary(int[] a, int origin, int idx) {
4820         int[] res = new int[SPECIES.length()];
4821         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4822             if(i < origin)
4823                 res[i] = (int)0;
4824             else {
4825                 res[i] = a[idx+j];
4826                 j++;
4827             }
4828         }
4829         return res;
4830     }
4831 
4832     @Test(dataProvider = "intUnaryOpProvider")
4833     static void unsliceUnaryInt64VectorTests(IntFunction<int[]> fa) {
4834         int[] a = fa.apply(SPECIES.length());
4835         int[] r = new int[a.length];
4836         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4837         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4838             for (int i = 0; i < a.length; i += SPECIES.length()) {
4839                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4840                 av.unslice(origin).intoArray(r, i);
4841             }
4842         }
4843 
4844         assertArraysEquals(r, a, origin, Int64VectorTests::unsliceUnary);
4845     }

4846     static int[] unsliceBinary(int[] a, int[] b, int origin, int part, int idx) {
4847         int[] res = new int[SPECIES.length()];
4848         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4849             if (part == 0) {
4850                 if (i < origin)
4851                     res[i] = b[idx+i];
4852                 else {
4853                     res[i] = a[idx+j];
4854                     j++;
4855                 }
4856             } else if (part == 1) {
4857                 if (i < origin)
4858                     res[i] = a[idx+SPECIES.length()-origin+i];
4859                 else {
4860                     res[i] = b[idx+origin+j];
4861                     j++;
4862                 }
4863             }
4864         }
4865         return res;
4866     }
4867 
4868     @Test(dataProvider = "intBinaryOpProvider")
4869     static void unsliceBinaryInt64VectorTestsBinary(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4870         int[] a = fa.apply(SPECIES.length());
4871         int[] b = fb.apply(SPECIES.length());
4872         int[] r = new int[a.length];
4873         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4874         int part = (new java.util.Random()).nextInt(2);
4875         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4876             for (int i = 0; i < a.length; i += SPECIES.length()) {
4877                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4878                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4879                 av.unslice(origin, bv, part).intoArray(r, i);
4880             }
4881         }
4882 
4883         assertArraysEquals(r, a, b, origin, part, Int64VectorTests::unsliceBinary);
4884     }

4885     static int[] unslice(int[] a, int[] b, int origin, int part, boolean[] mask, int idx) {
4886         int[] res = new int[SPECIES.length()];
4887         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4888             if(i+origin < SPECIES.length())
4889                 res[i] = b[idx+i+origin];
4890             else {
4891                 res[i] = b[idx+j];
4892                 j++;
4893             }
4894         }
4895         for (int i = 0; i < SPECIES.length(); i++){
4896             res[i] = mask[i] ? a[idx+i] : res[i];
4897         }
4898         int[] res1 = new int[SPECIES.length()];
4899         if (part == 0) {
4900             for (int i = 0, j = 0; i < SPECIES.length(); i++){
4901                 if (i < origin)
4902                     res1[i] = b[idx+i];
4903                 else {
4904                    res1[i] = res[j];

4922     static void unsliceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
4923     IntFunction<boolean[]> fm) {
4924         int[] a = fa.apply(SPECIES.length());
4925         int[] b = fb.apply(SPECIES.length());
4926         boolean[] mask = fm.apply(SPECIES.length());
4927         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4928         int[] r = new int[a.length];
4929         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4930         int part = (new java.util.Random()).nextInt(2);
4931         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4932             for (int i = 0; i < a.length; i += SPECIES.length()) {
4933                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4934                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4935                 av.unslice(origin, bv, part, vmask).intoArray(r, i);
4936             }
4937         }
4938 
4939         assertArraysEquals(r, a, b, origin, part, mask, Int64VectorTests::unslice);
4940     }
4941 
4942 
4943 
4944 
4945 
4946 
4947 
4948 
4949 
4950 
4951 
4952 
4953 
4954 
4955 
4956 
4957 
4958 
4959 
4960 
4961 
4962 
4963 
4964     static int BITWISE_BLEND(int a, int b, int c) {
4965         return (int)((a&~(c))|(b&c));
4966     }

4967     static int bitwiseBlend(int a, int b, int c) {
4968         return (int)((a&~(c))|(b&c));
4969     }
4970 
4971 
4972     @Test(dataProvider = "intTernaryOpProvider")
4973     static void BITWISE_BLENDInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
4974         int[] a = fa.apply(SPECIES.length());
4975         int[] b = fb.apply(SPECIES.length());
4976         int[] c = fc.apply(SPECIES.length());
4977         int[] r = fr.apply(SPECIES.length());
4978 
4979         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4980             for (int i = 0; i < a.length; i += SPECIES.length()) {
4981                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4982                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4983                 IntVector cv = IntVector.fromArray(SPECIES, c, i);
4984                 av.lanewise(VectorOperators.BITWISE_BLEND, bv, cv).intoArray(r, i);
4985             }
4986         }
4987 
4988         assertArraysEquals(r, a, b, c, Int64VectorTests::BITWISE_BLEND);
4989     }

4990     @Test(dataProvider = "intTernaryOpProvider")
4991     static void bitwiseBlendInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
4992         int[] a = fa.apply(SPECIES.length());
4993         int[] b = fb.apply(SPECIES.length());
4994         int[] c = fc.apply(SPECIES.length());
4995         int[] r = fr.apply(SPECIES.length());
4996 
4997         for (int i = 0; i < a.length; i += SPECIES.length()) {
4998             IntVector av = IntVector.fromArray(SPECIES, a, i);
4999             IntVector bv = IntVector.fromArray(SPECIES, b, i);
5000             IntVector cv = IntVector.fromArray(SPECIES, c, i);
5001             av.bitwiseBlend(bv, cv).intoArray(r, i);
5002         }
5003 
5004         assertArraysEquals(r, a, b, c, Int64VectorTests::bitwiseBlend);
5005     }
5006 
5007 
5008     @Test(dataProvider = "intTernaryOpMaskProvider")
5009     static void BITWISE_BLENDInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
5010                                           IntFunction<int[]> fc, IntFunction<boolean[]> fm) {
5011         int[] a = fa.apply(SPECIES.length());
5012         int[] b = fb.apply(SPECIES.length());
5013         int[] c = fc.apply(SPECIES.length());
5014         int[] r = fr.apply(SPECIES.length());
5015         boolean[] mask = fm.apply(SPECIES.length());
5016         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5017 
5018         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5019             for (int i = 0; i < a.length; i += SPECIES.length()) {
5020                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5021                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
5022                 IntVector cv = IntVector.fromArray(SPECIES, c, i);
5023                 av.lanewise(VectorOperators.BITWISE_BLEND, bv, cv, vmask).intoArray(r, i);
5024             }
5025         }
5026 
5027         assertArraysEquals(r, a, b, c, mask, Int64VectorTests::BITWISE_BLEND);
5028     }
5029 
5030 
5031 
5032 
5033     @Test(dataProvider = "intTernaryOpProvider")
5034     static void BITWISE_BLENDInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5035         int[] a = fa.apply(SPECIES.length());
5036         int[] b = fb.apply(SPECIES.length());
5037         int[] c = fc.apply(SPECIES.length());
5038         int[] r = fr.apply(SPECIES.length());
5039 
5040         for (int i = 0; i < a.length; i += SPECIES.length()) {
5041             IntVector av = IntVector.fromArray(SPECIES, a, i);
5042             IntVector bv = IntVector.fromArray(SPECIES, b, i);
5043             av.lanewise(VectorOperators.BITWISE_BLEND, bv, c[i]).intoArray(r, i);
5044         }
5045         assertBroadcastArraysEquals(r, a, b, c, Int64VectorTests::BITWISE_BLEND);
5046     }
5047 
5048     @Test(dataProvider = "intTernaryOpProvider")
5049     static void BITWISE_BLENDInt64VectorTestsAltBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5050         int[] a = fa.apply(SPECIES.length());
5051         int[] b = fb.apply(SPECIES.length());
5052         int[] c = fc.apply(SPECIES.length());
5053         int[] r = fr.apply(SPECIES.length());
5054 
5055         for (int i = 0; i < a.length; i += SPECIES.length()) {
5056             IntVector av = IntVector.fromArray(SPECIES, a, i);
5057             IntVector cv = IntVector.fromArray(SPECIES, c, i);
5058             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], cv).intoArray(r, i);
5059         }
5060         assertAltBroadcastArraysEquals(r, a, b, c, Int64VectorTests::BITWISE_BLEND);
5061     }

5062     @Test(dataProvider = "intTernaryOpProvider")
5063     static void bitwiseBlendInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5064         int[] a = fa.apply(SPECIES.length());
5065         int[] b = fb.apply(SPECIES.length());
5066         int[] c = fc.apply(SPECIES.length());
5067         int[] r = fr.apply(SPECIES.length());
5068 
5069         for (int i = 0; i < a.length; i += SPECIES.length()) {
5070             IntVector av = IntVector.fromArray(SPECIES, a, i);
5071             IntVector bv = IntVector.fromArray(SPECIES, b, i);
5072             av.bitwiseBlend(bv, c[i]).intoArray(r, i);
5073         }
5074         assertBroadcastArraysEquals(r, a, b, c, Int64VectorTests::bitwiseBlend);
5075     }
5076 
5077     @Test(dataProvider = "intTernaryOpProvider")
5078     static void bitwiseBlendInt64VectorTestsAltBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5079         int[] a = fa.apply(SPECIES.length());
5080         int[] b = fb.apply(SPECIES.length());
5081         int[] c = fc.apply(SPECIES.length());
5082         int[] r = fr.apply(SPECIES.length());
5083 
5084         for (int i = 0; i < a.length; i += SPECIES.length()) {
5085             IntVector av = IntVector.fromArray(SPECIES, a, i);
5086             IntVector cv = IntVector.fromArray(SPECIES, c, i);
5087             av.bitwiseBlend(b[i], cv).intoArray(r, i);
5088         }
5089         assertAltBroadcastArraysEquals(r, a, b, c, Int64VectorTests::bitwiseBlend);
5090     }
5091 
5092 
5093     @Test(dataProvider = "intTernaryOpMaskProvider")
5094     static void BITWISE_BLENDInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
5095                                           IntFunction<int[]> fc, IntFunction<boolean[]> fm) {
5096         int[] a = fa.apply(SPECIES.length());
5097         int[] b = fb.apply(SPECIES.length());
5098         int[] c = fc.apply(SPECIES.length());
5099         int[] r = fr.apply(SPECIES.length());
5100         boolean[] mask = fm.apply(SPECIES.length());
5101         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5102 
5103         for (int i = 0; i < a.length; i += SPECIES.length()) {
5104             IntVector av = IntVector.fromArray(SPECIES, a, i);
5105             IntVector bv = IntVector.fromArray(SPECIES, b, i);
5106             av.lanewise(VectorOperators.BITWISE_BLEND, bv, c[i], vmask).intoArray(r, i);
5107         }
5108 
5109         assertBroadcastArraysEquals(r, a, b, c, mask, Int64VectorTests::BITWISE_BLEND);
5110     }
5111 
5112     @Test(dataProvider = "intTernaryOpMaskProvider")
5113     static void BITWISE_BLENDInt64VectorTestsAltBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
5114                                           IntFunction<int[]> fc, IntFunction<boolean[]> fm) {
5115         int[] a = fa.apply(SPECIES.length());
5116         int[] b = fb.apply(SPECIES.length());
5117         int[] c = fc.apply(SPECIES.length());
5118         int[] r = fr.apply(SPECIES.length());
5119         boolean[] mask = fm.apply(SPECIES.length());
5120         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5121 
5122         for (int i = 0; i < a.length; i += SPECIES.length()) {
5123             IntVector av = IntVector.fromArray(SPECIES, a, i);
5124             IntVector cv = IntVector.fromArray(SPECIES, c, i);
5125             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], cv, vmask).intoArray(r, i);
5126         }
5127 
5128         assertAltBroadcastArraysEquals(r, a, b, c, mask, Int64VectorTests::BITWISE_BLEND);
5129     }
5130 
5131 
5132 
5133 
5134     @Test(dataProvider = "intTernaryOpProvider")
5135     static void BITWISE_BLENDInt64VectorTestsDoubleBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5136         int[] a = fa.apply(SPECIES.length());
5137         int[] b = fb.apply(SPECIES.length());
5138         int[] c = fc.apply(SPECIES.length());
5139         int[] r = fr.apply(SPECIES.length());
5140 
5141         for (int i = 0; i < a.length; i += SPECIES.length()) {
5142             IntVector av = IntVector.fromArray(SPECIES, a, i);
5143             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], c[i]).intoArray(r, i);
5144         }
5145 
5146         assertDoubleBroadcastArraysEquals(r, a, b, c, Int64VectorTests::BITWISE_BLEND);
5147     }

5148     @Test(dataProvider = "intTernaryOpProvider")
5149     static void bitwiseBlendInt64VectorTestsDoubleBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5150         int[] a = fa.apply(SPECIES.length());
5151         int[] b = fb.apply(SPECIES.length());
5152         int[] c = fc.apply(SPECIES.length());
5153         int[] r = fr.apply(SPECIES.length());
5154 
5155         for (int i = 0; i < a.length; i += SPECIES.length()) {
5156             IntVector av = IntVector.fromArray(SPECIES, a, i);
5157             av.bitwiseBlend(b[i], c[i]).intoArray(r, i);
5158         }
5159 
5160         assertDoubleBroadcastArraysEquals(r, a, b, c, Int64VectorTests::bitwiseBlend);
5161     }
5162 
5163 
5164     @Test(dataProvider = "intTernaryOpMaskProvider")
5165     static void BITWISE_BLENDInt64VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
5166                                           IntFunction<int[]> fc, IntFunction<boolean[]> fm) {
5167         int[] a = fa.apply(SPECIES.length());
5168         int[] b = fb.apply(SPECIES.length());
5169         int[] c = fc.apply(SPECIES.length());
5170         int[] r = fr.apply(SPECIES.length());
5171         boolean[] mask = fm.apply(SPECIES.length());
5172         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5173 
5174         for (int i = 0; i < a.length; i += SPECIES.length()) {
5175             IntVector av = IntVector.fromArray(SPECIES, a, i);
5176             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], c[i], vmask).intoArray(r, i);
5177         }
5178 
5179         assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Int64VectorTests::BITWISE_BLEND);
5180     }
5181 
5182 
5183     static int NEG(int a) {
5184         return (int)(-((int)a));
5185     }
5186 
5187     static int neg(int a) {
5188         return (int)(-((int)a));
5189     }
5190 
5191     @Test(dataProvider = "intUnaryOpProvider")
5192     static void NEGInt64VectorTests(IntFunction<int[]> fa) {
5193         int[] a = fa.apply(SPECIES.length());
5194         int[] r = fr.apply(SPECIES.length());
5195 
5196         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5197             for (int i = 0; i < a.length; i += SPECIES.length()) {
5198                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5199                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
5200             }
5201         }
5202 

5275     }
5276 
5277     @Test(dataProvider = "intUnaryOpMaskProvider")
5278     static void ABSMaskedInt64VectorTests(IntFunction<int[]> fa,
5279                                                 IntFunction<boolean[]> fm) {
5280         int[] a = fa.apply(SPECIES.length());
5281         int[] r = fr.apply(SPECIES.length());
5282         boolean[] mask = fm.apply(SPECIES.length());
5283         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5284 
5285         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5286             for (int i = 0; i < a.length; i += SPECIES.length()) {
5287                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5288                 av.lanewise(VectorOperators.ABS, vmask).intoArray(r, i);
5289             }
5290         }
5291 
5292         assertArraysEquals(r, a, mask, Int64VectorTests::ABS);
5293     }
5294 
5295 
5296     static int NOT(int a) {
5297         return (int)(~((int)a));
5298     }
5299 
5300     static int not(int a) {
5301         return (int)(~((int)a));
5302     }
5303 
5304 
5305 
5306     @Test(dataProvider = "intUnaryOpProvider")
5307     static void NOTInt64VectorTests(IntFunction<int[]> fa) {
5308         int[] a = fa.apply(SPECIES.length());
5309         int[] r = fr.apply(SPECIES.length());
5310 
5311         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5312             for (int i = 0; i < a.length; i += SPECIES.length()) {
5313                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5314                 av.lanewise(VectorOperators.NOT).intoArray(r, i);
5315             }
5316         }
5317 
5318         assertArraysEquals(r, a, Int64VectorTests::NOT);
5319     }
5320 
5321     @Test(dataProvider = "intUnaryOpProvider")
5322     static void notInt64VectorTests(IntFunction<int[]> fa) {
5323         int[] a = fa.apply(SPECIES.length());
5324         int[] r = fr.apply(SPECIES.length());
5325 
5326         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5327             for (int i = 0; i < a.length; i += SPECIES.length()) {
5328                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5329                 av.not().intoArray(r, i);
5330             }
5331         }
5332 
5333         assertArraysEquals(r, a, Int64VectorTests::not);
5334     }
5335 
5336 
5337 
5338     @Test(dataProvider = "intUnaryOpMaskProvider")
5339     static void NOTMaskedInt64VectorTests(IntFunction<int[]> fa,
5340                                                 IntFunction<boolean[]> fm) {
5341         int[] a = fa.apply(SPECIES.length());
5342         int[] r = fr.apply(SPECIES.length());
5343         boolean[] mask = fm.apply(SPECIES.length());
5344         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5345 
5346         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5347             for (int i = 0; i < a.length; i += SPECIES.length()) {
5348                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5349                 av.lanewise(VectorOperators.NOT, vmask).intoArray(r, i);
5350             }
5351         }
5352 
5353         assertArraysEquals(r, a, mask, Int64VectorTests::NOT);
5354     }
5355 
5356 
5357 
5358     static int ZOMO(int a) {
5359         return (int)((a==0?0:-1));
5360     }
5361 
5362 
5363 
5364     @Test(dataProvider = "intUnaryOpProvider")
5365     static void ZOMOInt64VectorTests(IntFunction<int[]> fa) {
5366         int[] a = fa.apply(SPECIES.length());
5367         int[] r = fr.apply(SPECIES.length());
5368 
5369         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5370             for (int i = 0; i < a.length; i += SPECIES.length()) {
5371                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5372                 av.lanewise(VectorOperators.ZOMO).intoArray(r, i);
5373             }
5374         }
5375 
5376         assertArraysEquals(r, a, Int64VectorTests::ZOMO);
5377     }
5378 
5379 
5380 
5381     @Test(dataProvider = "intUnaryOpMaskProvider")
5382     static void ZOMOMaskedInt64VectorTests(IntFunction<int[]> fa,
5383                                                 IntFunction<boolean[]> fm) {
5384         int[] a = fa.apply(SPECIES.length());
5385         int[] r = fr.apply(SPECIES.length());
5386         boolean[] mask = fm.apply(SPECIES.length());
5387         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5388 
5389         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5390             for (int i = 0; i < a.length; i += SPECIES.length()) {
5391                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5392                 av.lanewise(VectorOperators.ZOMO, vmask).intoArray(r, i);
5393             }
5394         }
5395 
5396         assertArraysEquals(r, a, mask, Int64VectorTests::ZOMO);
5397     }
5398 



5399 




5400 









5401 





































































































































































5402 
5403     @Test(dataProvider = "intCompareOpProvider")
5404     static void ltInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
5405         int[] a = fa.apply(SPECIES.length());
5406         int[] b = fb.apply(SPECIES.length());
5407 
5408         for (int i = 0; i < a.length; i += SPECIES.length()) {
5409             IntVector av = IntVector.fromArray(SPECIES, a, i);
5410             VectorMask<Integer> mv = av.lt(b[i]);
5411 
5412             // Check results as part of computation.
5413             for (int j = 0; j < SPECIES.length(); j++) {
5414                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
5415             }
5416         }
5417     }
5418 
5419     @Test(dataProvider = "intCompareOpProvider")
5420     static void eqInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
5421         int[] a = fa.apply(SPECIES.length());

5784             }
5785         }
5786         return i - idx;
5787     }
5788 
5789     @Test(dataProvider = "maskProvider")
5790     static void maskFirstTrueInt64VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
5791         boolean[] a = fa.apply(SPECIES.length());
5792         int[] r = new int[a.length];
5793 
5794         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
5795             for (int i = 0; i < a.length; i += SPECIES.length()) {
5796                 var vmask = SPECIES.loadMask(a, i);
5797                 r[i] = vmask.firstTrue();
5798             }
5799         }
5800 
5801         assertMaskReductionArraysEquals(r, a, Int64VectorTests::maskFirstTrue);
5802     }
5803 

















5804     @DataProvider
5805     public static Object[][] longMaskProvider() {
5806         return new Object[][]{
5807                 {0xFFFFFFFFFFFFFFFFL},
5808                 {0x0000000000000000L},
5809                 {0x5555555555555555L},
5810                 {0x0123456789abcdefL},
5811         };
5812     }
5813 
5814     @Test(dataProvider = "longMaskProvider")
5815     static void maskFromToLongInt64VectorTestsSmokeTest(long inputLong) {
5816         var vmask = VectorMask.fromLong(SPECIES, inputLong);
5817         long outputLong = vmask.toLong();
5818         Assert.assertEquals(outputLong, (inputLong & (((0xFFFFFFFFFFFFFFFFL >>> (64 - SPECIES.length()))))));
5819     }
5820 
5821     @DataProvider
5822     public static Object[][] offsetProvider() {
5823         return new Object[][]{

5826                 {+1},
5827                 {+2},
5828                 {-2},
5829         };
5830     }
5831 
5832     @Test(dataProvider = "offsetProvider")
5833     static void indexInRangeInt64VectorTestsSmokeTest(int offset) {
5834         int limit = SPECIES.length() * BUFFER_REPS;
5835         for (int i = 0; i < limit; i += SPECIES.length()) {
5836             var actualMask = SPECIES.indexInRange(i + offset, limit);
5837             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
5838             assert(actualMask.equals(expectedMask));
5839             for (int j = 0; j < SPECIES.length(); j++)  {
5840                 int index = i + j + offset;
5841                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
5842             }
5843         }
5844     }
5845 














5846     @DataProvider
5847     public static Object[][] lengthProvider() {
5848         return new Object[][]{
5849                 {0},
5850                 {1},
5851                 {32},
5852                 {37},
5853                 {1024},
5854                 {1024+1},
5855                 {1024+5},
5856         };
5857     }
5858 
5859     @Test(dataProvider = "lengthProvider")
5860     static void loopBoundInt64VectorTestsSmokeTest(int length) {
5861         int actualLoopBound = SPECIES.loopBound(length);
5862         int expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
5863         Assert.assertEquals(actualLoopBound, expectedLoopBound);
5864     }
5865 








5866     @Test
5867     static void ElementSizeInt64VectorTestsSmokeTest() {
5868         IntVector av = IntVector.zero(SPECIES);
5869         int elsize = av.elementSize();
5870         Assert.assertEquals(elsize, Integer.SIZE);
5871     }
5872 
5873     @Test
5874     static void VectorShapeInt64VectorTestsSmokeTest() {
5875         IntVector av = IntVector.zero(SPECIES);
5876         VectorShape vsh = av.shape();
5877         assert(vsh.equals(VectorShape.S_64_BIT));
5878     }
5879 
5880     @Test
5881     static void ShapeWithLanesInt64VectorTestsSmokeTest() {
5882         IntVector av = IntVector.zero(SPECIES);
5883         VectorShape vsh = av.shape();
5884         VectorSpecies species = vsh.withLanes(int.class);
5885         assert(species.equals(SPECIES));

5908         IntVector av = IntVector.zero(SPECIES);
5909         VectorSpecies species = av.species().withLanes(int.class);
5910         assert(species.equals(SPECIES));
5911     }
5912 
5913     @Test
5914     static void WithShapeInt64VectorTestsSmokeTest() {
5915         IntVector av = IntVector.zero(SPECIES);
5916         VectorShape vsh = av.shape();
5917         VectorSpecies species = av.species().withShape(vsh);
5918         assert(species.equals(SPECIES));
5919     }
5920 
5921     @Test
5922     static void MaskAllTrueInt64VectorTestsSmokeTest() {
5923         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5924           Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length()));
5925         }
5926     }
5927 }
5928 

 244             } else {
 245                 Assert.assertEquals(r[i], a[i], "at index #" + i);
 246             }
 247         }
 248     }
 249 
 250     static void assertRearrangeArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
 251         int i = 0, j = 0;
 252         try {
 253             for (; i < a.length; i += vector_len) {
 254                 for (j = 0; j < vector_len; j++) {
 255                     Assert.assertEquals(r[i+j], a[i+order[i+j]]);
 256                 }
 257             }
 258         } catch (AssertionError e) {
 259             int idx = i + j;
 260             Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]);
 261         }
 262     }
 263 
 264     static void assertcompressArraysEquals(int[] r, int[] a, boolean[] m, int vector_len) {
 265         int i = 0, j = 0, k = 0;
 266         try {
 267             for (; i < a.length; i += vector_len) {
 268                 k = 0;
 269                 for (j = 0; j < vector_len; j++) {
 270                     if (m[(i + j) % SPECIES.length()]) {
 271                         Assert.assertEquals(r[i + k], a[i + j]);
 272                         k++;
 273                     }
 274                 }
 275                 for (; k < vector_len; k++) {
 276                     Assert.assertEquals(r[i + k], (int)0);
 277                 }
 278             }
 279         } catch (AssertionError e) {
 280             int idx = i + k;
 281             if (m[(i + j) % SPECIES.length()]) {
 282                 Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
 283             } else {
 284                 Assert.assertEquals(r[idx], (int)0, "at index #" + idx);
 285             }
 286         }
 287     }
 288 
 289     static void assertexpandArraysEquals(int[] r, int[] a, boolean[] m, int vector_len) {
 290         int i = 0, j = 0, k = 0;
 291         try {
 292             for (; i < a.length; i += vector_len) {
 293                 k = 0;
 294                 for (j = 0; j < vector_len; j++) {
 295                     if (m[(i + j) % SPECIES.length()]) {
 296                         Assert.assertEquals(r[i + j], a[i + k]);
 297                         k++;
 298                     } else {
 299                         Assert.assertEquals(r[i + j], (int)0);
 300                     }
 301                 }
 302             }
 303         } catch (AssertionError e) {
 304             int idx = i + j;
 305             if (m[idx % SPECIES.length()]) {
 306                 Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
 307             } else {
 308                 Assert.assertEquals(r[idx], (int)0, "at index #" + idx);
 309             }
 310         }
 311     }
 312 
 313     static void assertSelectFromArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
 314         int i = 0, j = 0;
 315         try {
 316             for (; i < a.length; i += vector_len) {
 317                 for (j = 0; j < vector_len; j++) {
 318                     Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]);
 319                 }
 320             }
 321         } catch (AssertionError e) {
 322             int idx = i + j;
 323             Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]);
 324         }
 325     }
 326 
 327     static void assertRearrangeArraysEquals(int[] r, int[] a, int[] order, boolean[] mask, int vector_len) {
 328         int i = 0, j = 0;
 329         try {
 330             for (; i < a.length; i += vector_len) {
 331                 for (j = 0; j < vector_len; j++) {
 332                     if (mask[j % SPECIES.length()])

 916         try {
 917             for (; i < r.length; i++) {
 918                 Assert.assertEquals(r[i], (long)(a[i+offs]));
 919             }
 920         } catch (AssertionError e) {
 921             Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
 922         }
 923     }
 924 
 925     static void assertArraysEquals(double[] r, int[] a, int offs) {
 926         int i = 0;
 927         try {
 928             for (; i < r.length; i++) {
 929                 Assert.assertEquals(r[i], (double)(a[i+offs]));
 930             }
 931         } catch (AssertionError e) {
 932             Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
 933         }
 934     }
 935 

 936     static int bits(int e) {
 937         return  e;
 938     }
 939 
 940     static final List<IntFunction<int[]>> INT_GENERATORS = List.of(
 941             withToString("int[-i * 5]", (int s) -> {
 942                 return fill(s * BUFFER_REPS,
 943                             i -> (int)(-i * 5));
 944             }),
 945             withToString("int[i * 5]", (int s) -> {
 946                 return fill(s * BUFFER_REPS,
 947                             i -> (int)(i * 5));
 948             }),
 949             withToString("int[i + 1]", (int s) -> {
 950                 return fill(s * BUFFER_REPS,
 951                             i -> (((int)(i + 1) == 0) ? 1 : (int)(i + 1)));
 952             }),
 953             withToString("int[cornerCaseValue(i)]", (int s) -> {
 954                 return fill(s * BUFFER_REPS,
 955                             i -> cornerCaseValue(i));

1010                 })).
1011                 toArray(Object[][]::new);
1012     }
1013 
1014     @DataProvider
1015     public Object[][] intUnaryOpProvider() {
1016         return INT_GENERATORS.stream().
1017                 map(f -> new Object[]{f}).
1018                 toArray(Object[][]::new);
1019     }
1020 
1021     @DataProvider
1022     public Object[][] intUnaryOpMaskProvider() {
1023         return BOOLEAN_MASK_GENERATORS.stream().
1024                 flatMap(fm -> INT_GENERATORS.stream().map(fa -> {
1025                     return new Object[] {fa, fm};
1026                 })).
1027                 toArray(Object[][]::new);
1028     }
1029 


1030     @DataProvider
1031     public Object[][] maskProvider() {
1032         return BOOLEAN_MASK_GENERATORS.stream().
1033                 map(f -> new Object[]{f}).
1034                 toArray(Object[][]::new);
1035     }
1036 
1037     @DataProvider
1038     public Object[][] maskCompareOpProvider() {
1039         return BOOLEAN_MASK_COMPARE_GENERATOR_PAIRS.stream().map(List::toArray).
1040                 toArray(Object[][]::new);
1041     }
1042 
1043     @DataProvider
1044     public Object[][] shuffleProvider() {
1045         return INT_SHUFFLE_GENERATORS.stream().
1046                 map(f -> new Object[]{f}).
1047                 toArray(Object[][]::new);
1048     }
1049 

1055 
1056     @DataProvider
1057     public Object[][] intUnaryOpShuffleProvider() {
1058         return INT_SHUFFLE_GENERATORS.stream().
1059                 flatMap(fs -> INT_GENERATORS.stream().map(fa -> {
1060                     return new Object[] {fa, fs};
1061                 })).
1062                 toArray(Object[][]::new);
1063     }
1064 
1065     @DataProvider
1066     public Object[][] intUnaryOpShuffleMaskProvider() {
1067         return BOOLEAN_MASK_GENERATORS.stream().
1068                 flatMap(fm -> INT_SHUFFLE_GENERATORS.stream().
1069                     flatMap(fs -> INT_GENERATORS.stream().map(fa -> {
1070                         return new Object[] {fa, fs, fm};
1071                 }))).
1072                 toArray(Object[][]::new);
1073     }
1074 

1075     static final List<IntFunction<int[]>> INT_COMPARE_GENERATORS = List.of(
1076             withToString("int[i]", (int s) -> {
1077                 return fill(s * BUFFER_REPS,
1078                             i -> (int)i);
1079             }),
1080             withToString("int[i - length / 2]", (int s) -> {
1081                 return fill(s * BUFFER_REPS,
1082                             i -> (int)(i - (s * BUFFER_REPS / 2)));
1083             }),
1084             withToString("int[i + 1]", (int s) -> {
1085                 return fill(s * BUFFER_REPS,
1086                             i -> (int)(i + 1));
1087             }),
1088             withToString("int[i - 2]", (int s) -> {
1089                 return fill(s * BUFFER_REPS,
1090                             i -> (int)(i - 2));
1091             }),
1092             withToString("int[zigZag(i)]", (int s) -> {
1093                 return fill(s * BUFFER_REPS,
1094                             i -> i%3 == 0 ? (int)i : (i%3 == 1 ? (int)(i + 1) : (int)(i - 2)));

1195             }
1196         }
1197     }
1198 
1199     static void replaceZero(int[] a, boolean[] mask, int v) {
1200         for (int i = 0; i < a.length; i++) {
1201             if (mask[i % mask.length] && a[i] == 0) {
1202                 a[i] = v;
1203             }
1204         }
1205     }
1206 
1207     static int ROL_scalar(int a, int b) {
1208         return Integer.rotateLeft(a, ((int)b));
1209     }
1210 
1211     static int ROR_scalar(int a, int b) {
1212         return Integer.rotateRight(a, ((int)b));
1213     }
1214 
1215     static int TRAILING_ZEROS_COUNT_scalar(int a) {
1216         return Integer.numberOfTrailingZeros(a);
1217     }
1218 
1219     static int LEADING_ZEROS_COUNT_scalar(int a) {
1220         return Integer.numberOfLeadingZeros(a);
1221     }
1222 
1223     static int REVERSE_scalar(int a) {
1224         return Integer.reverse(a);
1225     }
1226 
1227     static boolean eq(int a, int b) {
1228         return a == b;
1229     }
1230 
1231     static boolean neq(int a, int b) {
1232         return a != b;
1233     }
1234 
1235     static boolean lt(int a, int b) {
1236         return a < b;
1237     }
1238 
1239     static boolean le(int a, int b) {
1240         return a <= b;
1241     }
1242 
1243     static boolean gt(int a, int b) {
1244         return a > b;
1245     }
1246 

1361     @Test
1362     // Test div by 0.
1363     static void bitwiseDivByZeroSmokeTest() {
1364         try {
1365             IntVector a = (IntVector) SPECIES.broadcast(0).addIndex(1);
1366             IntVector b = (IntVector) SPECIES.broadcast(0);
1367             a.div(b);
1368             Assert.fail();
1369         } catch (ArithmeticException e) {
1370         }
1371 
1372         try {
1373             IntVector a = (IntVector) SPECIES.broadcast(0).addIndex(1);
1374             IntVector b = (IntVector) SPECIES.broadcast(0);
1375             VectorMask<Integer> m = a.lt((int) 1);
1376             a.div(b, m);
1377             Assert.fail();
1378         } catch (ArithmeticException e) {
1379         }
1380     }
1381 
1382     static int ADD(int a, int b) {
1383         return (int)(a + b);
1384     }
1385 
1386     @Test(dataProvider = "intBinaryOpProvider")
1387     static void ADDInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1388         int[] a = fa.apply(SPECIES.length());
1389         int[] b = fb.apply(SPECIES.length());
1390         int[] r = fr.apply(SPECIES.length());
1391 
1392         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1393             for (int i = 0; i < a.length; i += SPECIES.length()) {
1394                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1395                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1396                 av.lanewise(VectorOperators.ADD, bv).intoArray(r, i);
1397             }
1398         }
1399 
1400         assertArraysEquals(r, a, b, Int64VectorTests::ADD);
1401     }
1402 
1403     static int add(int a, int b) {
1404         return (int)(a + b);
1405     }
1406 
1407     @Test(dataProvider = "intBinaryOpProvider")
1408     static void addInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1409         int[] a = fa.apply(SPECIES.length());
1410         int[] b = fb.apply(SPECIES.length());
1411         int[] r = fr.apply(SPECIES.length());
1412 
1413         for (int i = 0; i < a.length; i += SPECIES.length()) {
1414             IntVector av = IntVector.fromArray(SPECIES, a, i);
1415             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1416             av.add(bv).intoArray(r, i);
1417         }
1418 
1419         assertArraysEquals(r, a, b, Int64VectorTests::add);
1420     }
1421 
1422     @Test(dataProvider = "intBinaryOpMaskProvider")

1439         assertArraysEquals(r, a, b, mask, Int64VectorTests::ADD);
1440     }
1441 
1442     @Test(dataProvider = "intBinaryOpMaskProvider")
1443     static void addInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1444                                           IntFunction<boolean[]> fm) {
1445         int[] a = fa.apply(SPECIES.length());
1446         int[] b = fb.apply(SPECIES.length());
1447         int[] r = fr.apply(SPECIES.length());
1448         boolean[] mask = fm.apply(SPECIES.length());
1449         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1450 
1451         for (int i = 0; i < a.length; i += SPECIES.length()) {
1452             IntVector av = IntVector.fromArray(SPECIES, a, i);
1453             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1454             av.add(bv, vmask).intoArray(r, i);
1455         }
1456 
1457         assertArraysEquals(r, a, b, mask, Int64VectorTests::add);
1458     }
1459 
1460     static int SUB(int a, int b) {
1461         return (int)(a - b);
1462     }
1463 
1464     @Test(dataProvider = "intBinaryOpProvider")
1465     static void SUBInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1466         int[] a = fa.apply(SPECIES.length());
1467         int[] b = fb.apply(SPECIES.length());
1468         int[] r = fr.apply(SPECIES.length());
1469 
1470         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1471             for (int i = 0; i < a.length; i += SPECIES.length()) {
1472                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1473                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1474                 av.lanewise(VectorOperators.SUB, bv).intoArray(r, i);
1475             }
1476         }
1477 
1478         assertArraysEquals(r, a, b, Int64VectorTests::SUB);
1479     }
1480 
1481     static int sub(int a, int b) {
1482         return (int)(a - b);
1483     }
1484 
1485     @Test(dataProvider = "intBinaryOpProvider")
1486     static void subInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1487         int[] a = fa.apply(SPECIES.length());
1488         int[] b = fb.apply(SPECIES.length());
1489         int[] r = fr.apply(SPECIES.length());
1490 
1491         for (int i = 0; i < a.length; i += SPECIES.length()) {
1492             IntVector av = IntVector.fromArray(SPECIES, a, i);
1493             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1494             av.sub(bv).intoArray(r, i);
1495         }
1496 
1497         assertArraysEquals(r, a, b, Int64VectorTests::sub);
1498     }
1499 
1500     @Test(dataProvider = "intBinaryOpMaskProvider")

1517         assertArraysEquals(r, a, b, mask, Int64VectorTests::SUB);
1518     }
1519 
1520     @Test(dataProvider = "intBinaryOpMaskProvider")
1521     static void subInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1522                                           IntFunction<boolean[]> fm) {
1523         int[] a = fa.apply(SPECIES.length());
1524         int[] b = fb.apply(SPECIES.length());
1525         int[] r = fr.apply(SPECIES.length());
1526         boolean[] mask = fm.apply(SPECIES.length());
1527         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1528 
1529         for (int i = 0; i < a.length; i += SPECIES.length()) {
1530             IntVector av = IntVector.fromArray(SPECIES, a, i);
1531             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1532             av.sub(bv, vmask).intoArray(r, i);
1533         }
1534 
1535         assertArraysEquals(r, a, b, mask, Int64VectorTests::sub);
1536     }
1537 
1538     static int MUL(int a, int b) {
1539         return (int)(a * b);
1540     }
1541 
1542     @Test(dataProvider = "intBinaryOpProvider")
1543     static void MULInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1544         int[] a = fa.apply(SPECIES.length());
1545         int[] b = fb.apply(SPECIES.length());
1546         int[] r = fr.apply(SPECIES.length());
1547 
1548         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1549             for (int i = 0; i < a.length; i += SPECIES.length()) {
1550                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1551                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1552                 av.lanewise(VectorOperators.MUL, bv).intoArray(r, i);
1553             }
1554         }
1555 
1556         assertArraysEquals(r, a, b, Int64VectorTests::MUL);
1557     }
1558 
1559     static int mul(int a, int b) {
1560         return (int)(a * b);
1561     }
1562 
1563     @Test(dataProvider = "intBinaryOpProvider")
1564     static void mulInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1565         int[] a = fa.apply(SPECIES.length());
1566         int[] b = fb.apply(SPECIES.length());
1567         int[] r = fr.apply(SPECIES.length());
1568 
1569         for (int i = 0; i < a.length; i += SPECIES.length()) {
1570             IntVector av = IntVector.fromArray(SPECIES, a, i);
1571             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1572             av.mul(bv).intoArray(r, i);
1573         }
1574 
1575         assertArraysEquals(r, a, b, Int64VectorTests::mul);
1576     }
1577 
1578     @Test(dataProvider = "intBinaryOpMaskProvider")

1596     }
1597 
1598     @Test(dataProvider = "intBinaryOpMaskProvider")
1599     static void mulInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1600                                           IntFunction<boolean[]> fm) {
1601         int[] a = fa.apply(SPECIES.length());
1602         int[] b = fb.apply(SPECIES.length());
1603         int[] r = fr.apply(SPECIES.length());
1604         boolean[] mask = fm.apply(SPECIES.length());
1605         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1606 
1607         for (int i = 0; i < a.length; i += SPECIES.length()) {
1608             IntVector av = IntVector.fromArray(SPECIES, a, i);
1609             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1610             av.mul(bv, vmask).intoArray(r, i);
1611         }
1612 
1613         assertArraysEquals(r, a, b, mask, Int64VectorTests::mul);
1614     }
1615 


1616     static int DIV(int a, int b) {
1617         return (int)(a / b);
1618     }
1619 
1620     @Test(dataProvider = "intBinaryOpProvider")
1621     static void DIVInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1622         int[] a = fa.apply(SPECIES.length());
1623         int[] b = fb.apply(SPECIES.length());
1624         int[] r = fr.apply(SPECIES.length());
1625 
1626         replaceZero(b, (int) 1);
1627 
1628         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1629             for (int i = 0; i < a.length; i += SPECIES.length()) {
1630                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1631                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1632                 av.lanewise(VectorOperators.DIV, bv).intoArray(r, i);
1633             }
1634         }
1635 
1636         assertArraysEquals(r, a, b, Int64VectorTests::DIV);
1637     }
1638 
1639     static int div(int a, int b) {
1640         return (int)(a / b);
1641     }
1642 
1643     @Test(dataProvider = "intBinaryOpProvider")
1644     static void divInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1645         int[] a = fa.apply(SPECIES.length());
1646         int[] b = fb.apply(SPECIES.length());
1647         int[] r = fr.apply(SPECIES.length());
1648 
1649         replaceZero(b, (int) 1);
1650 
1651         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1652             for (int i = 0; i < a.length; i += SPECIES.length()) {
1653                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1654                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1655                 av.div(bv).intoArray(r, i);
1656             }
1657         }
1658 
1659         assertArraysEquals(r, a, b, Int64VectorTests::div);
1660     }
1661 


1662     @Test(dataProvider = "intBinaryOpMaskProvider")
1663     static void DIVInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1664                                           IntFunction<boolean[]> fm) {
1665         int[] a = fa.apply(SPECIES.length());
1666         int[] b = fb.apply(SPECIES.length());
1667         int[] r = fr.apply(SPECIES.length());
1668         boolean[] mask = fm.apply(SPECIES.length());
1669         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1670 
1671         replaceZero(b, mask, (int) 1);
1672 
1673         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1674             for (int i = 0; i < a.length; i += SPECIES.length()) {
1675                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1676                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1677                 av.lanewise(VectorOperators.DIV, bv, vmask).intoArray(r, i);
1678             }
1679         }
1680 
1681         assertArraysEquals(r, a, b, mask, Int64VectorTests::DIV);

1747     static int AND(int a, int b) {
1748         return (int)(a & b);
1749     }
1750 
1751     @Test(dataProvider = "intBinaryOpProvider")
1752     static void ANDInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1753         int[] a = fa.apply(SPECIES.length());
1754         int[] b = fb.apply(SPECIES.length());
1755         int[] r = fr.apply(SPECIES.length());
1756 
1757         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1758             for (int i = 0; i < a.length; i += SPECIES.length()) {
1759                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1760                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1761                 av.lanewise(VectorOperators.AND, bv).intoArray(r, i);
1762             }
1763         }
1764 
1765         assertArraysEquals(r, a, b, Int64VectorTests::AND);
1766     }
1767 
1768     static int and(int a, int b) {
1769         return (int)(a & b);
1770     }
1771 
1772     @Test(dataProvider = "intBinaryOpProvider")
1773     static void andInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1774         int[] a = fa.apply(SPECIES.length());
1775         int[] b = fb.apply(SPECIES.length());
1776         int[] r = fr.apply(SPECIES.length());
1777 
1778         for (int i = 0; i < a.length; i += SPECIES.length()) {
1779             IntVector av = IntVector.fromArray(SPECIES, a, i);
1780             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1781             av.and(bv).intoArray(r, i);
1782         }
1783 
1784         assertArraysEquals(r, a, b, Int64VectorTests::and);
1785     }
1786 


1787     @Test(dataProvider = "intBinaryOpMaskProvider")
1788     static void ANDInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1789                                           IntFunction<boolean[]> fm) {
1790         int[] a = fa.apply(SPECIES.length());
1791         int[] b = fb.apply(SPECIES.length());
1792         int[] r = fr.apply(SPECIES.length());
1793         boolean[] mask = fm.apply(SPECIES.length());
1794         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1795 
1796         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1797             for (int i = 0; i < a.length; i += SPECIES.length()) {
1798                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1799                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1800                 av.lanewise(VectorOperators.AND, bv, vmask).intoArray(r, i);
1801             }
1802         }
1803 
1804         assertArraysEquals(r, a, b, mask, Int64VectorTests::AND);
1805     }
1806 

1807     static int AND_NOT(int a, int b) {
1808         return (int)(a & ~b);
1809     }
1810 
1811     @Test(dataProvider = "intBinaryOpProvider")
1812     static void AND_NOTInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1813         int[] a = fa.apply(SPECIES.length());
1814         int[] b = fb.apply(SPECIES.length());
1815         int[] r = fr.apply(SPECIES.length());
1816 
1817         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1818             for (int i = 0; i < a.length; i += SPECIES.length()) {
1819                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1820                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1821                 av.lanewise(VectorOperators.AND_NOT, bv).intoArray(r, i);
1822             }
1823         }
1824 
1825         assertArraysEquals(r, a, b, Int64VectorTests::AND_NOT);
1826     }
1827 


1828     @Test(dataProvider = "intBinaryOpMaskProvider")
1829     static void AND_NOTInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1830                                           IntFunction<boolean[]> fm) {
1831         int[] a = fa.apply(SPECIES.length());
1832         int[] b = fb.apply(SPECIES.length());
1833         int[] r = fr.apply(SPECIES.length());
1834         boolean[] mask = fm.apply(SPECIES.length());
1835         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1836 
1837         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1838             for (int i = 0; i < a.length; i += SPECIES.length()) {
1839                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1840                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1841                 av.lanewise(VectorOperators.AND_NOT, bv, vmask).intoArray(r, i);
1842             }
1843         }
1844 
1845         assertArraysEquals(r, a, b, mask, Int64VectorTests::AND_NOT);
1846     }
1847 

1848     static int OR(int a, int b) {
1849         return (int)(a | b);
1850     }
1851 
1852     @Test(dataProvider = "intBinaryOpProvider")
1853     static void ORInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1854         int[] a = fa.apply(SPECIES.length());
1855         int[] b = fb.apply(SPECIES.length());
1856         int[] r = fr.apply(SPECIES.length());
1857 
1858         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1859             for (int i = 0; i < a.length; i += SPECIES.length()) {
1860                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1861                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1862                 av.lanewise(VectorOperators.OR, bv).intoArray(r, i);
1863             }
1864         }
1865 
1866         assertArraysEquals(r, a, b, Int64VectorTests::OR);
1867     }
1868 
1869     static int or(int a, int b) {
1870         return (int)(a | b);
1871     }
1872 
1873     @Test(dataProvider = "intBinaryOpProvider")
1874     static void orInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1875         int[] a = fa.apply(SPECIES.length());
1876         int[] b = fb.apply(SPECIES.length());
1877         int[] r = fr.apply(SPECIES.length());
1878 
1879         for (int i = 0; i < a.length; i += SPECIES.length()) {
1880             IntVector av = IntVector.fromArray(SPECIES, a, i);
1881             IntVector bv = IntVector.fromArray(SPECIES, b, i);
1882             av.or(bv).intoArray(r, i);
1883         }
1884 
1885         assertArraysEquals(r, a, b, Int64VectorTests::or);
1886     }
1887 


1888     @Test(dataProvider = "intBinaryOpMaskProvider")
1889     static void ORInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1890                                           IntFunction<boolean[]> fm) {
1891         int[] a = fa.apply(SPECIES.length());
1892         int[] b = fb.apply(SPECIES.length());
1893         int[] r = fr.apply(SPECIES.length());
1894         boolean[] mask = fm.apply(SPECIES.length());
1895         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1896 
1897         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1898             for (int i = 0; i < a.length; i += SPECIES.length()) {
1899                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1900                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1901                 av.lanewise(VectorOperators.OR, bv, vmask).intoArray(r, i);
1902             }
1903         }
1904 
1905         assertArraysEquals(r, a, b, mask, Int64VectorTests::OR);
1906     }
1907 

1908     static int XOR(int a, int b) {
1909         return (int)(a ^ b);
1910     }
1911 
1912     @Test(dataProvider = "intBinaryOpProvider")
1913     static void XORInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1914         int[] a = fa.apply(SPECIES.length());
1915         int[] b = fb.apply(SPECIES.length());
1916         int[] r = fr.apply(SPECIES.length());
1917 
1918         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1919             for (int i = 0; i < a.length; i += SPECIES.length()) {
1920                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1921                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1922                 av.lanewise(VectorOperators.XOR, bv).intoArray(r, i);
1923             }
1924         }
1925 
1926         assertArraysEquals(r, a, b, Int64VectorTests::XOR);
1927     }
1928 


1929     @Test(dataProvider = "intBinaryOpMaskProvider")
1930     static void XORInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1931                                           IntFunction<boolean[]> fm) {
1932         int[] a = fa.apply(SPECIES.length());
1933         int[] b = fb.apply(SPECIES.length());
1934         int[] r = fr.apply(SPECIES.length());
1935         boolean[] mask = fm.apply(SPECIES.length());
1936         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1937 
1938         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1939             for (int i = 0; i < a.length; i += SPECIES.length()) {
1940                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1941                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1942                 av.lanewise(VectorOperators.XOR, bv, vmask).intoArray(r, i);
1943             }
1944         }
1945 
1946         assertArraysEquals(r, a, b, mask, Int64VectorTests::XOR);
1947     }
1948 
1949     static int COMPRESS_BITS(int a, int b) {
1950         return (int)(Integer.compress(a, b));
1951     }
1952 
1953     @Test(dataProvider = "intBinaryOpProvider")
1954     static void COMPRESS_BITSInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1955         int[] a = fa.apply(SPECIES.length());
1956         int[] b = fb.apply(SPECIES.length());
1957         int[] r = fr.apply(SPECIES.length());
1958 
1959         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1960             for (int i = 0; i < a.length; i += SPECIES.length()) {
1961                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1962                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1963                 av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
1964             }
1965         }
1966 
1967         assertArraysEquals(r, a, b, Int64VectorTests::COMPRESS_BITS);
1968     }
1969 
1970     @Test(dataProvider = "intBinaryOpMaskProvider")
1971     static void COMPRESS_BITSInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
1972                                           IntFunction<boolean[]> fm) {
1973         int[] a = fa.apply(SPECIES.length());
1974         int[] b = fb.apply(SPECIES.length());
1975         int[] r = fr.apply(SPECIES.length());
1976         boolean[] mask = fm.apply(SPECIES.length());
1977         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1978 
1979         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1980             for (int i = 0; i < a.length; i += SPECIES.length()) {
1981                 IntVector av = IntVector.fromArray(SPECIES, a, i);
1982                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
1983                 av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
1984             }
1985         }
1986 
1987         assertArraysEquals(r, a, b, mask, Int64VectorTests::COMPRESS_BITS);
1988     }
1989 
1990     static int EXPAND_BITS(int a, int b) {
1991         return (int)(Integer.expand(a, b));
1992     }
1993 
1994     @Test(dataProvider = "intBinaryOpProvider")
1995     static void EXPAND_BITSInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
1996         int[] a = fa.apply(SPECIES.length());
1997         int[] b = fb.apply(SPECIES.length());
1998         int[] r = fr.apply(SPECIES.length());
1999 
2000         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2001             for (int i = 0; i < a.length; i += SPECIES.length()) {
2002                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2003                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2004                 av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
2005             }
2006         }
2007 
2008         assertArraysEquals(r, a, b, Int64VectorTests::EXPAND_BITS);
2009     }
2010 
2011     @Test(dataProvider = "intBinaryOpMaskProvider")
2012     static void EXPAND_BITSInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2013                                           IntFunction<boolean[]> fm) {
2014         int[] a = fa.apply(SPECIES.length());
2015         int[] b = fb.apply(SPECIES.length());
2016         int[] r = fr.apply(SPECIES.length());
2017         boolean[] mask = fm.apply(SPECIES.length());
2018         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2019 
2020         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2021             for (int i = 0; i < a.length; i += SPECIES.length()) {
2022                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2023                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2024                 av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
2025             }
2026         }
2027 
2028         assertArraysEquals(r, a, b, mask, Int64VectorTests::EXPAND_BITS);
2029     }
2030 
2031     @Test(dataProvider = "intBinaryOpProvider")
2032     static void addInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2033         int[] a = fa.apply(SPECIES.length());
2034         int[] b = fb.apply(SPECIES.length());
2035         int[] r = fr.apply(SPECIES.length());
2036 
2037         for (int i = 0; i < a.length; i += SPECIES.length()) {
2038             IntVector av = IntVector.fromArray(SPECIES, a, i);
2039             av.add(b[i]).intoArray(r, i);
2040         }
2041 
2042         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::add);
2043     }
2044 
2045     @Test(dataProvider = "intBinaryOpMaskProvider")
2046     static void addInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
2047                                           IntFunction<boolean[]> fm) {
2048         int[] a = fa.apply(SPECIES.length());
2049         int[] b = fb.apply(SPECIES.length());

2104         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::mul);
2105     }
2106 
2107     @Test(dataProvider = "intBinaryOpMaskProvider")
2108     static void mulInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
2109                                           IntFunction<boolean[]> fm) {
2110         int[] a = fa.apply(SPECIES.length());
2111         int[] b = fb.apply(SPECIES.length());
2112         int[] r = fr.apply(SPECIES.length());
2113         boolean[] mask = fm.apply(SPECIES.length());
2114         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2115 
2116         for (int i = 0; i < a.length; i += SPECIES.length()) {
2117             IntVector av = IntVector.fromArray(SPECIES, a, i);
2118             av.mul(b[i], vmask).intoArray(r, i);
2119         }
2120 
2121         assertBroadcastArraysEquals(r, a, b, mask, Int64VectorTests::mul);
2122     }
2123 



2124     @Test(dataProvider = "intBinaryOpProvider")
2125     static void divInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2126         int[] a = fa.apply(SPECIES.length());
2127         int[] b = fb.apply(SPECIES.length());
2128         int[] r = fr.apply(SPECIES.length());
2129 
2130         replaceZero(b, (int) 1);
2131 
2132         for (int i = 0; i < a.length; i += SPECIES.length()) {
2133             IntVector av = IntVector.fromArray(SPECIES, a, i);
2134             av.div(b[i]).intoArray(r, i);
2135         }
2136 
2137         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::div);
2138     }
2139 


2140     @Test(dataProvider = "intBinaryOpMaskProvider")
2141     static void divInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
2142                                           IntFunction<boolean[]> fm) {
2143         int[] a = fa.apply(SPECIES.length());
2144         int[] b = fb.apply(SPECIES.length());
2145         int[] r = fr.apply(SPECIES.length());
2146         boolean[] mask = fm.apply(SPECIES.length());
2147         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2148 
2149         replaceZero(b, (int) 1);
2150 
2151         for (int i = 0; i < a.length; i += SPECIES.length()) {
2152             IntVector av = IntVector.fromArray(SPECIES, a, i);
2153             av.div(b[i], vmask).intoArray(r, i);
2154         }
2155 
2156         assertBroadcastArraysEquals(r, a, b, mask, Int64VectorTests::div);
2157     }
2158 


2159     @Test(dataProvider = "intBinaryOpProvider")
2160     static void ORInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2161         int[] a = fa.apply(SPECIES.length());
2162         int[] b = fb.apply(SPECIES.length());
2163         int[] r = fr.apply(SPECIES.length());
2164 
2165         for (int i = 0; i < a.length; i += SPECIES.length()) {
2166             IntVector av = IntVector.fromArray(SPECIES, a, i);
2167             av.lanewise(VectorOperators.OR, b[i]).intoArray(r, i);
2168         }
2169 
2170         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::OR);
2171     }
2172 
2173     @Test(dataProvider = "intBinaryOpProvider")
2174     static void orInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2175         int[] a = fa.apply(SPECIES.length());
2176         int[] b = fb.apply(SPECIES.length());
2177         int[] r = fr.apply(SPECIES.length());
2178 
2179         for (int i = 0; i < a.length; i += SPECIES.length()) {
2180             IntVector av = IntVector.fromArray(SPECIES, a, i);
2181             av.or(b[i]).intoArray(r, i);
2182         }
2183 
2184         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::or);
2185     }
2186 


2187     @Test(dataProvider = "intBinaryOpMaskProvider")
2188     static void ORInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
2189                                           IntFunction<boolean[]> fm) {
2190         int[] a = fa.apply(SPECIES.length());
2191         int[] b = fb.apply(SPECIES.length());
2192         int[] r = fr.apply(SPECIES.length());
2193         boolean[] mask = fm.apply(SPECIES.length());
2194         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2195 
2196         for (int i = 0; i < a.length; i += SPECIES.length()) {
2197             IntVector av = IntVector.fromArray(SPECIES, a, i);
2198             av.lanewise(VectorOperators.OR, b[i], vmask).intoArray(r, i);
2199         }
2200 
2201         assertBroadcastArraysEquals(r, a, b, mask, Int64VectorTests::OR);
2202     }
2203 


2204     @Test(dataProvider = "intBinaryOpProvider")
2205     static void ANDInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2206         int[] a = fa.apply(SPECIES.length());
2207         int[] b = fb.apply(SPECIES.length());
2208         int[] r = fr.apply(SPECIES.length());
2209 
2210         for (int i = 0; i < a.length; i += SPECIES.length()) {
2211             IntVector av = IntVector.fromArray(SPECIES, a, i);
2212             av.lanewise(VectorOperators.AND, b[i]).intoArray(r, i);
2213         }
2214 
2215         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::AND);
2216     }
2217 
2218     @Test(dataProvider = "intBinaryOpProvider")
2219     static void andInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2220         int[] a = fa.apply(SPECIES.length());
2221         int[] b = fb.apply(SPECIES.length());
2222         int[] r = fr.apply(SPECIES.length());
2223 
2224         for (int i = 0; i < a.length; i += SPECIES.length()) {
2225             IntVector av = IntVector.fromArray(SPECIES, a, i);
2226             av.and(b[i]).intoArray(r, i);
2227         }
2228 
2229         assertBroadcastArraysEquals(r, a, b, Int64VectorTests::and);
2230     }
2231 


2232     @Test(dataProvider = "intBinaryOpMaskProvider")
2233     static void ANDInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
2234                                           IntFunction<boolean[]> fm) {
2235         int[] a = fa.apply(SPECIES.length());
2236         int[] b = fb.apply(SPECIES.length());
2237         int[] r = fr.apply(SPECIES.length());
2238         boolean[] mask = fm.apply(SPECIES.length());
2239         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2240 
2241         for (int i = 0; i < a.length; i += SPECIES.length()) {
2242             IntVector av = IntVector.fromArray(SPECIES, a, i);
2243             av.lanewise(VectorOperators.AND, b[i], vmask).intoArray(r, i);
2244         }
2245 
2246         assertBroadcastArraysEquals(r, a, b, mask, Int64VectorTests::AND);
2247     }
2248 


2249     @Test(dataProvider = "intBinaryOpProvider")
2250     static void ORInt64VectorTestsBroadcastLongSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2251         int[] a = fa.apply(SPECIES.length());
2252         int[] b = fb.apply(SPECIES.length());
2253         int[] r = fr.apply(SPECIES.length());
2254 
2255         for (int i = 0; i < a.length; i += SPECIES.length()) {
2256             IntVector av = IntVector.fromArray(SPECIES, a, i);
2257             av.lanewise(VectorOperators.OR, (long)b[i]).intoArray(r, i);
2258         }
2259 
2260         assertBroadcastLongArraysEquals(r, a, b, Int64VectorTests::OR);
2261     }
2262 


2263     @Test(dataProvider = "intBinaryOpMaskProvider")
2264     static void ORInt64VectorTestsBroadcastMaskedLongSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
2265                                           IntFunction<boolean[]> fm) {
2266         int[] a = fa.apply(SPECIES.length());
2267         int[] b = fb.apply(SPECIES.length());
2268         int[] r = fr.apply(SPECIES.length());
2269         boolean[] mask = fm.apply(SPECIES.length());
2270         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2271 
2272         for (int i = 0; i < a.length; i += SPECIES.length()) {
2273             IntVector av = IntVector.fromArray(SPECIES, a, i);
2274             av.lanewise(VectorOperators.OR, (long)b[i], vmask).intoArray(r, i);
2275         }
2276 
2277         assertBroadcastLongArraysEquals(r, a, b, mask, Int64VectorTests::OR);
2278     }
2279 

2280     @Test(dataProvider = "intBinaryOpProvider")
2281     static void ADDInt64VectorTestsBroadcastLongSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2282         int[] a = fa.apply(SPECIES.length());
2283         int[] b = fb.apply(SPECIES.length());
2284         int[] r = fr.apply(SPECIES.length());
2285 
2286         for (int i = 0; i < a.length; i += SPECIES.length()) {
2287             IntVector av = IntVector.fromArray(SPECIES, a, i);
2288             av.lanewise(VectorOperators.ADD, (long)b[i]).intoArray(r, i);
2289         }
2290 
2291         assertBroadcastLongArraysEquals(r, a, b, Int64VectorTests::ADD);
2292     }
2293 
2294     @Test(dataProvider = "intBinaryOpMaskProvider")
2295     static void ADDInt64VectorTestsBroadcastMaskedLongSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
2296                                           IntFunction<boolean[]> fm) {
2297         int[] a = fa.apply(SPECIES.length());
2298         int[] b = fb.apply(SPECIES.length());
2299         int[] r = fr.apply(SPECIES.length());

2312         return (int)((a << b));
2313     }
2314 
2315     @Test(dataProvider = "intBinaryOpProvider")
2316     static void LSHLInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2317         int[] a = fa.apply(SPECIES.length());
2318         int[] b = fb.apply(SPECIES.length());
2319         int[] r = fr.apply(SPECIES.length());
2320 
2321         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2322             for (int i = 0; i < a.length; i += SPECIES.length()) {
2323                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2324                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2325                 av.lanewise(VectorOperators.LSHL, bv).intoArray(r, i);
2326             }
2327         }
2328 
2329         assertArraysEquals(r, a, b, Int64VectorTests::LSHL);
2330     }
2331 


2332     @Test(dataProvider = "intBinaryOpMaskProvider")
2333     static void LSHLInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2334                                           IntFunction<boolean[]> fm) {
2335         int[] a = fa.apply(SPECIES.length());
2336         int[] b = fb.apply(SPECIES.length());
2337         int[] r = fr.apply(SPECIES.length());
2338         boolean[] mask = fm.apply(SPECIES.length());
2339         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2340 
2341         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2342             for (int i = 0; i < a.length; i += SPECIES.length()) {
2343                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2344                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2345                 av.lanewise(VectorOperators.LSHL, bv, vmask).intoArray(r, i);
2346             }
2347         }
2348 
2349         assertArraysEquals(r, a, b, mask, Int64VectorTests::LSHL);
2350     }
2351 





2352     static int ASHR(int a, int b) {
2353         return (int)((a >> b));
2354     }
2355 
2356     @Test(dataProvider = "intBinaryOpProvider")
2357     static void ASHRInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2358         int[] a = fa.apply(SPECIES.length());
2359         int[] b = fb.apply(SPECIES.length());
2360         int[] r = fr.apply(SPECIES.length());
2361 
2362         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2363             for (int i = 0; i < a.length; i += SPECIES.length()) {
2364                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2365                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2366                 av.lanewise(VectorOperators.ASHR, bv).intoArray(r, i);
2367             }
2368         }
2369 
2370         assertArraysEquals(r, a, b, Int64VectorTests::ASHR);
2371     }
2372 


2373     @Test(dataProvider = "intBinaryOpMaskProvider")
2374     static void ASHRInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2375                                           IntFunction<boolean[]> fm) {
2376         int[] a = fa.apply(SPECIES.length());
2377         int[] b = fb.apply(SPECIES.length());
2378         int[] r = fr.apply(SPECIES.length());
2379         boolean[] mask = fm.apply(SPECIES.length());
2380         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2381 
2382         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2383             for (int i = 0; i < a.length; i += SPECIES.length()) {
2384                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2385                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2386                 av.lanewise(VectorOperators.ASHR, bv, vmask).intoArray(r, i);
2387             }
2388         }
2389 
2390         assertArraysEquals(r, a, b, mask, Int64VectorTests::ASHR);
2391     }
2392 





2393     static int LSHR(int a, int b) {
2394         return (int)((a >>> b));
2395     }
2396 
2397     @Test(dataProvider = "intBinaryOpProvider")
2398     static void LSHRInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2399         int[] a = fa.apply(SPECIES.length());
2400         int[] b = fb.apply(SPECIES.length());
2401         int[] r = fr.apply(SPECIES.length());
2402 
2403         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2404             for (int i = 0; i < a.length; i += SPECIES.length()) {
2405                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2406                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2407                 av.lanewise(VectorOperators.LSHR, bv).intoArray(r, i);
2408             }
2409         }
2410 
2411         assertArraysEquals(r, a, b, Int64VectorTests::LSHR);
2412     }
2413 


2414     @Test(dataProvider = "intBinaryOpMaskProvider")
2415     static void LSHRInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2416                                           IntFunction<boolean[]> fm) {
2417         int[] a = fa.apply(SPECIES.length());
2418         int[] b = fb.apply(SPECIES.length());
2419         int[] r = fr.apply(SPECIES.length());
2420         boolean[] mask = fm.apply(SPECIES.length());
2421         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2422 
2423         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2424             for (int i = 0; i < a.length; i += SPECIES.length()) {
2425                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2426                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2427                 av.lanewise(VectorOperators.LSHR, bv, vmask).intoArray(r, i);
2428             }
2429         }
2430 
2431         assertArraysEquals(r, a, b, mask, Int64VectorTests::LSHR);
2432     }
2433 





2434     static int LSHL_unary(int a, int b) {
2435         return (int)((a << b));
2436     }
2437 
2438     @Test(dataProvider = "intBinaryOpProvider")
2439     static void LSHLInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2440         int[] a = fa.apply(SPECIES.length());
2441         int[] b = fb.apply(SPECIES.length());
2442         int[] r = fr.apply(SPECIES.length());
2443 
2444         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2445             for (int i = 0; i < a.length; i += SPECIES.length()) {
2446                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2447                 av.lanewise(VectorOperators.LSHL, (int)b[i]).intoArray(r, i);
2448             }
2449         }
2450 
2451         assertShiftArraysEquals(r, a, b, Int64VectorTests::LSHL_unary);
2452     }
2453 


2454     @Test(dataProvider = "intBinaryOpMaskProvider")
2455     static void LSHLInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2456                                           IntFunction<boolean[]> fm) {
2457         int[] a = fa.apply(SPECIES.length());
2458         int[] b = fb.apply(SPECIES.length());
2459         int[] r = fr.apply(SPECIES.length());
2460         boolean[] mask = fm.apply(SPECIES.length());
2461         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2462 
2463         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2464             for (int i = 0; i < a.length; i += SPECIES.length()) {
2465                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2466                 av.lanewise(VectorOperators.LSHL, (int)b[i], vmask).intoArray(r, i);
2467             }
2468         }
2469 
2470         assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::LSHL_unary);
2471     }
2472 





2473     static int LSHR_unary(int a, int b) {
2474         return (int)((a >>> b));
2475     }
2476 
2477     @Test(dataProvider = "intBinaryOpProvider")
2478     static void LSHRInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2479         int[] a = fa.apply(SPECIES.length());
2480         int[] b = fb.apply(SPECIES.length());
2481         int[] r = fr.apply(SPECIES.length());
2482 
2483         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2484             for (int i = 0; i < a.length; i += SPECIES.length()) {
2485                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2486                 av.lanewise(VectorOperators.LSHR, (int)b[i]).intoArray(r, i);
2487             }
2488         }
2489 
2490         assertShiftArraysEquals(r, a, b, Int64VectorTests::LSHR_unary);
2491     }
2492 


2493     @Test(dataProvider = "intBinaryOpMaskProvider")
2494     static void LSHRInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2495                                           IntFunction<boolean[]> fm) {
2496         int[] a = fa.apply(SPECIES.length());
2497         int[] b = fb.apply(SPECIES.length());
2498         int[] r = fr.apply(SPECIES.length());
2499         boolean[] mask = fm.apply(SPECIES.length());
2500         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2501 
2502         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2503             for (int i = 0; i < a.length; i += SPECIES.length()) {
2504                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2505                 av.lanewise(VectorOperators.LSHR, (int)b[i], vmask).intoArray(r, i);
2506             }
2507         }
2508 
2509         assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::LSHR_unary);
2510     }
2511 





2512     static int ASHR_unary(int a, int b) {
2513         return (int)((a >> b));
2514     }
2515 
2516     @Test(dataProvider = "intBinaryOpProvider")
2517     static void ASHRInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2518         int[] a = fa.apply(SPECIES.length());
2519         int[] b = fb.apply(SPECIES.length());
2520         int[] r = fr.apply(SPECIES.length());
2521 
2522         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2523             for (int i = 0; i < a.length; i += SPECIES.length()) {
2524                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2525                 av.lanewise(VectorOperators.ASHR, (int)b[i]).intoArray(r, i);
2526             }
2527         }
2528 
2529         assertShiftArraysEquals(r, a, b, Int64VectorTests::ASHR_unary);
2530     }
2531 


2532     @Test(dataProvider = "intBinaryOpMaskProvider")
2533     static void ASHRInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2534                                           IntFunction<boolean[]> fm) {
2535         int[] a = fa.apply(SPECIES.length());
2536         int[] b = fb.apply(SPECIES.length());
2537         int[] r = fr.apply(SPECIES.length());
2538         boolean[] mask = fm.apply(SPECIES.length());
2539         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2540 
2541         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2542             for (int i = 0; i < a.length; i += SPECIES.length()) {
2543                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2544                 av.lanewise(VectorOperators.ASHR, (int)b[i], vmask).intoArray(r, i);
2545             }
2546         }
2547 
2548         assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::ASHR_unary);
2549     }
2550 





2551     static int ROR(int a, int b) {
2552         return (int)(ROR_scalar(a,b));
2553     }
2554 
2555     @Test(dataProvider = "intBinaryOpProvider")
2556     static void RORInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2557         int[] a = fa.apply(SPECIES.length());
2558         int[] b = fb.apply(SPECIES.length());
2559         int[] r = fr.apply(SPECIES.length());
2560 
2561         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2562             for (int i = 0; i < a.length; i += SPECIES.length()) {
2563                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2564                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2565                 av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
2566             }
2567         }
2568 
2569         assertArraysEquals(r, a, b, Int64VectorTests::ROR);
2570     }
2571 


2572     @Test(dataProvider = "intBinaryOpMaskProvider")
2573     static void RORInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2574                                           IntFunction<boolean[]> fm) {
2575         int[] a = fa.apply(SPECIES.length());
2576         int[] b = fb.apply(SPECIES.length());
2577         int[] r = fr.apply(SPECIES.length());
2578         boolean[] mask = fm.apply(SPECIES.length());
2579         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2580 
2581         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2582             for (int i = 0; i < a.length; i += SPECIES.length()) {
2583                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2584                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2585                 av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
2586             }
2587         }
2588 
2589         assertArraysEquals(r, a, b, mask, Int64VectorTests::ROR);
2590     }
2591 

2592     static int ROL(int a, int b) {
2593         return (int)(ROL_scalar(a,b));
2594     }
2595 
2596     @Test(dataProvider = "intBinaryOpProvider")
2597     static void ROLInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2598         int[] a = fa.apply(SPECIES.length());
2599         int[] b = fb.apply(SPECIES.length());
2600         int[] r = fr.apply(SPECIES.length());
2601 
2602         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2603             for (int i = 0; i < a.length; i += SPECIES.length()) {
2604                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2605                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2606                 av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
2607             }
2608         }
2609 
2610         assertArraysEquals(r, a, b, Int64VectorTests::ROL);
2611     }
2612 


2613     @Test(dataProvider = "intBinaryOpMaskProvider")
2614     static void ROLInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2615                                           IntFunction<boolean[]> fm) {
2616         int[] a = fa.apply(SPECIES.length());
2617         int[] b = fb.apply(SPECIES.length());
2618         int[] r = fr.apply(SPECIES.length());
2619         boolean[] mask = fm.apply(SPECIES.length());
2620         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2621 
2622         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2623             for (int i = 0; i < a.length; i += SPECIES.length()) {
2624                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2625                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2626                 av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
2627             }
2628         }
2629 
2630         assertArraysEquals(r, a, b, mask, Int64VectorTests::ROL);
2631     }
2632 

2633     static int ROR_unary(int a, int b) {
2634         return (int)(ROR_scalar(a, b));
2635     }
2636 
2637     @Test(dataProvider = "intBinaryOpProvider")
2638     static void RORInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2639         int[] a = fa.apply(SPECIES.length());
2640         int[] b = fb.apply(SPECIES.length());
2641         int[] r = fr.apply(SPECIES.length());
2642 
2643         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2644             for (int i = 0; i < a.length; i += SPECIES.length()) {
2645                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2646                 av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
2647             }
2648         }
2649 
2650         assertShiftArraysEquals(r, a, b, Int64VectorTests::ROR_unary);
2651     }
2652 


2653     @Test(dataProvider = "intBinaryOpMaskProvider")
2654     static void RORInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2655                                           IntFunction<boolean[]> fm) {
2656         int[] a = fa.apply(SPECIES.length());
2657         int[] b = fb.apply(SPECIES.length());
2658         int[] r = fr.apply(SPECIES.length());
2659         boolean[] mask = fm.apply(SPECIES.length());
2660         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2661 
2662         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2663             for (int i = 0; i < a.length; i += SPECIES.length()) {
2664                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2665                 av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
2666             }
2667         }
2668 
2669         assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::ROR_unary);
2670     }
2671 

2672     static int ROL_unary(int a, int b) {
2673         return (int)(ROL_scalar(a, b));
2674     }
2675 
2676     @Test(dataProvider = "intBinaryOpProvider")
2677     static void ROLInt64VectorTestsScalarShift(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2678         int[] a = fa.apply(SPECIES.length());
2679         int[] b = fb.apply(SPECIES.length());
2680         int[] r = fr.apply(SPECIES.length());
2681 
2682         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2683             for (int i = 0; i < a.length; i += SPECIES.length()) {
2684                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2685                 av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
2686             }
2687         }
2688 
2689         assertShiftArraysEquals(r, a, b, Int64VectorTests::ROL_unary);
2690     }
2691 


2692     @Test(dataProvider = "intBinaryOpMaskProvider")
2693     static void ROLInt64VectorTestsScalarShiftMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
2694                                           IntFunction<boolean[]> fm) {
2695         int[] a = fa.apply(SPECIES.length());
2696         int[] b = fb.apply(SPECIES.length());
2697         int[] r = fr.apply(SPECIES.length());
2698         boolean[] mask = fm.apply(SPECIES.length());
2699         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2700 
2701         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2702             for (int i = 0; i < a.length; i += SPECIES.length()) {
2703                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2704                 av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
2705             }
2706         }
2707 
2708         assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::ROL_unary);
2709     }


2710     static int LSHR_binary_const(int a) {
2711         return (int)((a >>> CONST_SHIFT));
2712     }
2713 
2714     @Test(dataProvider = "intUnaryOpProvider")
2715     static void LSHRInt64VectorTestsScalarShiftConst(IntFunction<int[]> fa) {
2716         int[] a = fa.apply(SPECIES.length());
2717         int[] r = fr.apply(SPECIES.length());
2718 
2719         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2720             for (int i = 0; i < a.length; i += SPECIES.length()) {
2721                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2722                 av.lanewise(VectorOperators.LSHR, CONST_SHIFT).intoArray(r, i);
2723             }
2724         }
2725 
2726         assertShiftConstEquals(r, a, Int64VectorTests::LSHR_binary_const);
2727     }
2728 


2729     @Test(dataProvider = "intUnaryOpMaskProvider")
2730     static void LSHRInt64VectorTestsScalarShiftMaskedConst(IntFunction<int[]> fa,
2731                                           IntFunction<boolean[]> fm) {
2732         int[] a = fa.apply(SPECIES.length());
2733         int[] r = fr.apply(SPECIES.length());
2734         boolean[] mask = fm.apply(SPECIES.length());
2735         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2736 
2737         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2738             for (int i = 0; i < a.length; i += SPECIES.length()) {
2739                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2740                 av.lanewise(VectorOperators.LSHR, CONST_SHIFT, vmask).intoArray(r, i);
2741             }
2742         }
2743 
2744         assertShiftConstEquals(r, a, mask, Int64VectorTests::LSHR_binary_const);
2745     }
2746 






2747     static int LSHL_binary_const(int a) {
2748         return (int)((a << CONST_SHIFT));
2749     }
2750 
2751     @Test(dataProvider = "intUnaryOpProvider")
2752     static void LSHLInt64VectorTestsScalarShiftConst(IntFunction<int[]> fa) {
2753         int[] a = fa.apply(SPECIES.length());
2754         int[] r = fr.apply(SPECIES.length());
2755 
2756         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2757             for (int i = 0; i < a.length; i += SPECIES.length()) {
2758                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2759                 av.lanewise(VectorOperators.LSHL, CONST_SHIFT).intoArray(r, i);
2760             }
2761         }
2762 
2763         assertShiftConstEquals(r, a, Int64VectorTests::LSHL_binary_const);
2764     }
2765 


2766     @Test(dataProvider = "intUnaryOpMaskProvider")
2767     static void LSHLInt64VectorTestsScalarShiftMaskedConst(IntFunction<int[]> fa,
2768                                           IntFunction<boolean[]> fm) {
2769         int[] a = fa.apply(SPECIES.length());
2770         int[] r = fr.apply(SPECIES.length());
2771         boolean[] mask = fm.apply(SPECIES.length());
2772         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2773 
2774         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2775             for (int i = 0; i < a.length; i += SPECIES.length()) {
2776                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2777                 av.lanewise(VectorOperators.LSHL, CONST_SHIFT, vmask).intoArray(r, i);
2778             }
2779         }
2780 
2781         assertShiftConstEquals(r, a, mask, Int64VectorTests::LSHL_binary_const);
2782     }
2783 


2784     static int ASHR_binary_const(int a) {
2785         return (int)((a >> CONST_SHIFT));
2786     }
2787 
2788     @Test(dataProvider = "intUnaryOpProvider")
2789     static void ASHRInt64VectorTestsScalarShiftConst(IntFunction<int[]> fa) {
2790         int[] a = fa.apply(SPECIES.length());
2791         int[] r = fr.apply(SPECIES.length());
2792 
2793         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2794             for (int i = 0; i < a.length; i += SPECIES.length()) {
2795                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2796                 av.lanewise(VectorOperators.ASHR, CONST_SHIFT).intoArray(r, i);
2797             }
2798         }
2799 
2800         assertShiftConstEquals(r, a, Int64VectorTests::ASHR_binary_const);
2801     }
2802 


2803     @Test(dataProvider = "intUnaryOpMaskProvider")
2804     static void ASHRInt64VectorTestsScalarShiftMaskedConst(IntFunction<int[]> fa,
2805                                           IntFunction<boolean[]> fm) {
2806         int[] a = fa.apply(SPECIES.length());
2807         int[] r = fr.apply(SPECIES.length());
2808         boolean[] mask = fm.apply(SPECIES.length());
2809         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2810 
2811         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2812             for (int i = 0; i < a.length; i += SPECIES.length()) {
2813                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2814                 av.lanewise(VectorOperators.ASHR, CONST_SHIFT, vmask).intoArray(r, i);
2815             }
2816         }
2817 
2818         assertShiftConstEquals(r, a, mask, Int64VectorTests::ASHR_binary_const);
2819     }
2820 


2821     static int ROR_binary_const(int a) {
2822         return (int)(ROR_scalar(a, CONST_SHIFT));
2823     }
2824 
2825     @Test(dataProvider = "intUnaryOpProvider")
2826     static void RORInt64VectorTestsScalarShiftConst(IntFunction<int[]> fa) {
2827         int[] a = fa.apply(SPECIES.length());
2828         int[] r = fr.apply(SPECIES.length());
2829 
2830         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2831             for (int i = 0; i < a.length; i += SPECIES.length()) {
2832                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2833                 av.lanewise(VectorOperators.ROR, CONST_SHIFT).intoArray(r, i);
2834             }
2835         }
2836 
2837         assertShiftConstEquals(r, a, Int64VectorTests::ROR_binary_const);
2838     }
2839 


2840     @Test(dataProvider = "intUnaryOpMaskProvider")
2841     static void RORInt64VectorTestsScalarShiftMaskedConst(IntFunction<int[]> fa,
2842                                           IntFunction<boolean[]> fm) {
2843         int[] a = fa.apply(SPECIES.length());
2844         int[] r = fr.apply(SPECIES.length());
2845         boolean[] mask = fm.apply(SPECIES.length());
2846         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2847 
2848         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2849             for (int i = 0; i < a.length; i += SPECIES.length()) {
2850                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2851                 av.lanewise(VectorOperators.ROR, CONST_SHIFT, vmask).intoArray(r, i);
2852             }
2853         }
2854 
2855         assertShiftConstEquals(r, a, mask, Int64VectorTests::ROR_binary_const);
2856     }
2857 


2858     static int ROL_binary_const(int a) {
2859         return (int)(ROL_scalar(a, CONST_SHIFT));
2860     }
2861 
2862     @Test(dataProvider = "intUnaryOpProvider")
2863     static void ROLInt64VectorTestsScalarShiftConst(IntFunction<int[]> fa) {
2864         int[] a = fa.apply(SPECIES.length());
2865         int[] r = fr.apply(SPECIES.length());
2866 
2867         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2868             for (int i = 0; i < a.length; i += SPECIES.length()) {
2869                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2870                 av.lanewise(VectorOperators.ROL, CONST_SHIFT).intoArray(r, i);
2871             }
2872         }
2873 
2874         assertShiftConstEquals(r, a, Int64VectorTests::ROL_binary_const);
2875     }
2876 


2877     @Test(dataProvider = "intUnaryOpMaskProvider")
2878     static void ROLInt64VectorTestsScalarShiftMaskedConst(IntFunction<int[]> fa,
2879                                           IntFunction<boolean[]> fm) {
2880         int[] a = fa.apply(SPECIES.length());
2881         int[] r = fr.apply(SPECIES.length());
2882         boolean[] mask = fm.apply(SPECIES.length());
2883         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2884 
2885         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2886             for (int i = 0; i < a.length; i += SPECIES.length()) {
2887                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2888                 av.lanewise(VectorOperators.ROL, CONST_SHIFT, vmask).intoArray(r, i);
2889             }
2890         }
2891 
2892         assertShiftConstEquals(r, a, mask, Int64VectorTests::ROL_binary_const);
2893     }
2894 
2895 
2896     static int MIN(int a, int b) {
2897         return (int)(Math.min(a, b));
2898     }
2899 
2900     @Test(dataProvider = "intBinaryOpProvider")
2901     static void MINInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2902         int[] a = fa.apply(SPECIES.length());
2903         int[] b = fb.apply(SPECIES.length());
2904         int[] r = fr.apply(SPECIES.length());
2905 
2906         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2907             for (int i = 0; i < a.length; i += SPECIES.length()) {
2908                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2909                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2910                 av.lanewise(VectorOperators.MIN, bv).intoArray(r, i);
2911             }
2912         }
2913 
2914         assertArraysEquals(r, a, b, Int64VectorTests::MIN);
2915     }
2916 
2917     static int min(int a, int b) {
2918         return (int)(Math.min(a, b));
2919     }
2920 
2921     @Test(dataProvider = "intBinaryOpProvider")
2922     static void minInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2923         int[] a = fa.apply(SPECIES.length());
2924         int[] b = fb.apply(SPECIES.length());
2925         int[] r = fr.apply(SPECIES.length());
2926 
2927         for (int i = 0; i < a.length; i += SPECIES.length()) {
2928             IntVector av = IntVector.fromArray(SPECIES, a, i);
2929             IntVector bv = IntVector.fromArray(SPECIES, b, i);
2930             av.min(bv).intoArray(r, i);
2931         }
2932 
2933         assertArraysEquals(r, a, b, Int64VectorTests::min);
2934     }
2935 
2936     static int MAX(int a, int b) {
2937         return (int)(Math.max(a, b));
2938     }
2939 
2940     @Test(dataProvider = "intBinaryOpProvider")
2941     static void MAXInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2942         int[] a = fa.apply(SPECIES.length());
2943         int[] b = fb.apply(SPECIES.length());
2944         int[] r = fr.apply(SPECIES.length());
2945 
2946         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2947             for (int i = 0; i < a.length; i += SPECIES.length()) {
2948                 IntVector av = IntVector.fromArray(SPECIES, a, i);
2949                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
2950                 av.lanewise(VectorOperators.MAX, bv).intoArray(r, i);
2951             }
2952         }
2953 
2954         assertArraysEquals(r, a, b, Int64VectorTests::MAX);
2955     }
2956 
2957     static int max(int a, int b) {
2958         return (int)(Math.max(a, b));
2959     }
2960 
2961     @Test(dataProvider = "intBinaryOpProvider")
2962     static void maxInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
2963         int[] a = fa.apply(SPECIES.length());
2964         int[] b = fb.apply(SPECIES.length());
2965         int[] r = fr.apply(SPECIES.length());
2966 
2967         for (int i = 0; i < a.length; i += SPECIES.length()) {
2968             IntVector av = IntVector.fromArray(SPECIES, a, i);
2969             IntVector bv = IntVector.fromArray(SPECIES, b, i);
2970             av.max(bv).intoArray(r, i);
2971         }
2972 
2973         assertArraysEquals(r, a, b, Int64VectorTests::max);
2974     }
2975 
2976     @Test(dataProvider = "intBinaryOpProvider")

3030     }
3031 
3032     static int ANDReduce(int[] a, int idx) {
3033         int res = -1;
3034         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3035             res &= a[i];
3036         }
3037 
3038         return res;
3039     }
3040 
3041     static int ANDReduceAll(int[] a) {
3042         int res = -1;
3043         for (int i = 0; i < a.length; i += SPECIES.length()) {
3044             res &= ANDReduce(a, i);
3045         }
3046 
3047         return res;
3048     }
3049 

3050     @Test(dataProvider = "intUnaryOpProvider")
3051     static void ANDReduceInt64VectorTests(IntFunction<int[]> fa) {
3052         int[] a = fa.apply(SPECIES.length());
3053         int[] r = fr.apply(SPECIES.length());
3054         int ra = -1;
3055 
3056         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3057             for (int i = 0; i < a.length; i += SPECIES.length()) {
3058                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3059                 r[i] = av.reduceLanes(VectorOperators.AND);
3060             }
3061         }
3062 
3063         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3064             ra = -1;
3065             for (int i = 0; i < a.length; i += SPECIES.length()) {
3066                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3067                 ra &= av.reduceLanes(VectorOperators.AND);
3068             }
3069         }
3070 
3071         assertReductionArraysEquals(r, ra, a,
3072                 Int64VectorTests::ANDReduce, Int64VectorTests::ANDReduceAll);
3073     }
3074 

3075     static int ANDReduceMasked(int[] a, int idx, boolean[] mask) {
3076         int res = -1;
3077         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3078             if (mask[i % SPECIES.length()])
3079                 res &= a[i];
3080         }
3081 
3082         return res;
3083     }
3084 
3085     static int ANDReduceAllMasked(int[] a, boolean[] mask) {
3086         int res = -1;
3087         for (int i = 0; i < a.length; i += SPECIES.length()) {
3088             res &= ANDReduceMasked(a, i, mask);
3089         }
3090 
3091         return res;
3092     }
3093 

3094     @Test(dataProvider = "intUnaryOpMaskProvider")
3095     static void ANDReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3096         int[] a = fa.apply(SPECIES.length());
3097         int[] r = fr.apply(SPECIES.length());
3098         boolean[] mask = fm.apply(SPECIES.length());
3099         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3100         int ra = -1;
3101 
3102         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3103             for (int i = 0; i < a.length; i += SPECIES.length()) {
3104                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3105                 r[i] = av.reduceLanes(VectorOperators.AND, vmask);
3106             }
3107         }
3108 
3109         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3110             ra = -1;
3111             for (int i = 0; i < a.length; i += SPECIES.length()) {
3112                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3113                 ra &= av.reduceLanes(VectorOperators.AND, vmask);
3114             }
3115         }
3116 
3117         assertReductionArraysEqualsMasked(r, ra, a, mask,
3118                 Int64VectorTests::ANDReduceMasked, Int64VectorTests::ANDReduceAllMasked);
3119     }
3120 

3121     static int ORReduce(int[] a, int idx) {
3122         int res = 0;
3123         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3124             res |= a[i];
3125         }
3126 
3127         return res;
3128     }
3129 
3130     static int ORReduceAll(int[] a) {
3131         int res = 0;
3132         for (int i = 0; i < a.length; i += SPECIES.length()) {
3133             res |= ORReduce(a, i);
3134         }
3135 
3136         return res;
3137     }
3138 

3139     @Test(dataProvider = "intUnaryOpProvider")
3140     static void ORReduceInt64VectorTests(IntFunction<int[]> fa) {
3141         int[] a = fa.apply(SPECIES.length());
3142         int[] r = fr.apply(SPECIES.length());
3143         int ra = 0;
3144 
3145         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3146             for (int i = 0; i < a.length; i += SPECIES.length()) {
3147                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3148                 r[i] = av.reduceLanes(VectorOperators.OR);
3149             }
3150         }
3151 
3152         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3153             ra = 0;
3154             for (int i = 0; i < a.length; i += SPECIES.length()) {
3155                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3156                 ra |= av.reduceLanes(VectorOperators.OR);
3157             }
3158         }
3159 
3160         assertReductionArraysEquals(r, ra, a,
3161                 Int64VectorTests::ORReduce, Int64VectorTests::ORReduceAll);
3162     }
3163 

3164     static int ORReduceMasked(int[] a, int idx, boolean[] mask) {
3165         int res = 0;
3166         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3167             if (mask[i % SPECIES.length()])
3168                 res |= a[i];
3169         }
3170 
3171         return res;
3172     }
3173 
3174     static int ORReduceAllMasked(int[] a, boolean[] mask) {
3175         int res = 0;
3176         for (int i = 0; i < a.length; i += SPECIES.length()) {
3177             res |= ORReduceMasked(a, i, mask);
3178         }
3179 
3180         return res;
3181     }
3182 

3183     @Test(dataProvider = "intUnaryOpMaskProvider")
3184     static void ORReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3185         int[] a = fa.apply(SPECIES.length());
3186         int[] r = fr.apply(SPECIES.length());
3187         boolean[] mask = fm.apply(SPECIES.length());
3188         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3189         int ra = 0;
3190 
3191         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3192             for (int i = 0; i < a.length; i += SPECIES.length()) {
3193                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3194                 r[i] = av.reduceLanes(VectorOperators.OR, vmask);
3195             }
3196         }
3197 
3198         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3199             ra = 0;
3200             for (int i = 0; i < a.length; i += SPECIES.length()) {
3201                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3202                 ra |= av.reduceLanes(VectorOperators.OR, vmask);
3203             }
3204         }
3205 
3206         assertReductionArraysEqualsMasked(r, ra, a, mask,
3207                 Int64VectorTests::ORReduceMasked, Int64VectorTests::ORReduceAllMasked);
3208     }
3209 

3210     static int XORReduce(int[] a, int idx) {
3211         int res = 0;
3212         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3213             res ^= a[i];
3214         }
3215 
3216         return res;
3217     }
3218 
3219     static int XORReduceAll(int[] a) {
3220         int res = 0;
3221         for (int i = 0; i < a.length; i += SPECIES.length()) {
3222             res ^= XORReduce(a, i);
3223         }
3224 
3225         return res;
3226     }
3227 

3228     @Test(dataProvider = "intUnaryOpProvider")
3229     static void XORReduceInt64VectorTests(IntFunction<int[]> fa) {
3230         int[] a = fa.apply(SPECIES.length());
3231         int[] r = fr.apply(SPECIES.length());
3232         int ra = 0;
3233 
3234         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3235             for (int i = 0; i < a.length; i += SPECIES.length()) {
3236                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3237                 r[i] = av.reduceLanes(VectorOperators.XOR);
3238             }
3239         }
3240 
3241         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3242             ra = 0;
3243             for (int i = 0; i < a.length; i += SPECIES.length()) {
3244                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3245                 ra ^= av.reduceLanes(VectorOperators.XOR);
3246             }
3247         }
3248 
3249         assertReductionArraysEquals(r, ra, a,
3250                 Int64VectorTests::XORReduce, Int64VectorTests::XORReduceAll);
3251     }
3252 

3253     static int XORReduceMasked(int[] a, int idx, boolean[] mask) {
3254         int res = 0;
3255         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3256             if (mask[i % SPECIES.length()])
3257                 res ^= a[i];
3258         }
3259 
3260         return res;
3261     }
3262 
3263     static int XORReduceAllMasked(int[] a, boolean[] mask) {
3264         int res = 0;
3265         for (int i = 0; i < a.length; i += SPECIES.length()) {
3266             res ^= XORReduceMasked(a, i, mask);
3267         }
3268 
3269         return res;
3270     }
3271 

3272     @Test(dataProvider = "intUnaryOpMaskProvider")
3273     static void XORReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3274         int[] a = fa.apply(SPECIES.length());
3275         int[] r = fr.apply(SPECIES.length());
3276         boolean[] mask = fm.apply(SPECIES.length());
3277         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3278         int ra = 0;
3279 
3280         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3281             for (int i = 0; i < a.length; i += SPECIES.length()) {
3282                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3283                 r[i] = av.reduceLanes(VectorOperators.XOR, vmask);
3284             }
3285         }
3286 
3287         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3288             ra = 0;
3289             for (int i = 0; i < a.length; i += SPECIES.length()) {
3290                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3291                 ra ^= av.reduceLanes(VectorOperators.XOR, vmask);

3296                 Int64VectorTests::XORReduceMasked, Int64VectorTests::XORReduceAllMasked);
3297     }
3298 
3299     static int ADDReduce(int[] a, int idx) {
3300         int res = 0;
3301         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3302             res += a[i];
3303         }
3304 
3305         return res;
3306     }
3307 
3308     static int ADDReduceAll(int[] a) {
3309         int res = 0;
3310         for (int i = 0; i < a.length; i += SPECIES.length()) {
3311             res += ADDReduce(a, i);
3312         }
3313 
3314         return res;
3315     }
3316 
3317     @Test(dataProvider = "intUnaryOpProvider")
3318     static void ADDReduceInt64VectorTests(IntFunction<int[]> fa) {
3319         int[] a = fa.apply(SPECIES.length());
3320         int[] r = fr.apply(SPECIES.length());
3321         int ra = 0;
3322 
3323         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3324             for (int i = 0; i < a.length; i += SPECIES.length()) {
3325                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3326                 r[i] = av.reduceLanes(VectorOperators.ADD);
3327             }
3328         }
3329 
3330         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3331             ra = 0;
3332             for (int i = 0; i < a.length; i += SPECIES.length()) {
3333                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3334                 ra += av.reduceLanes(VectorOperators.ADD);
3335             }
3336         }
3337 
3338         assertReductionArraysEquals(r, ra, a,
3339                 Int64VectorTests::ADDReduce, Int64VectorTests::ADDReduceAll);
3340     }
3341 
3342     static int ADDReduceMasked(int[] a, int idx, boolean[] mask) {
3343         int res = 0;
3344         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3345             if (mask[i % SPECIES.length()])
3346                 res += a[i];
3347         }
3348 
3349         return res;
3350     }
3351 
3352     static int ADDReduceAllMasked(int[] a, boolean[] mask) {
3353         int res = 0;
3354         for (int i = 0; i < a.length; i += SPECIES.length()) {
3355             res += ADDReduceMasked(a, i, mask);
3356         }
3357 
3358         return res;
3359     }
3360 
3361     @Test(dataProvider = "intUnaryOpMaskProvider")
3362     static void ADDReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3363         int[] a = fa.apply(SPECIES.length());
3364         int[] r = fr.apply(SPECIES.length());
3365         boolean[] mask = fm.apply(SPECIES.length());
3366         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3367         int ra = 0;
3368 
3369         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3370             for (int i = 0; i < a.length; i += SPECIES.length()) {
3371                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3372                 r[i] = av.reduceLanes(VectorOperators.ADD, vmask);
3373             }
3374         }
3375 
3376         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3377             ra = 0;
3378             for (int i = 0; i < a.length; i += SPECIES.length()) {
3379                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3380                 ra += av.reduceLanes(VectorOperators.ADD, vmask);
3381             }
3382         }
3383 
3384         assertReductionArraysEqualsMasked(r, ra, a, mask,
3385                 Int64VectorTests::ADDReduceMasked, Int64VectorTests::ADDReduceAllMasked);
3386     }
3387 
3388     static int MULReduce(int[] a, int idx) {
3389         int res = 1;
3390         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3391             res *= a[i];
3392         }
3393 
3394         return res;
3395     }
3396 
3397     static int MULReduceAll(int[] a) {
3398         int res = 1;
3399         for (int i = 0; i < a.length; i += SPECIES.length()) {
3400             res *= MULReduce(a, i);
3401         }
3402 
3403         return res;
3404     }
3405 
3406     @Test(dataProvider = "intUnaryOpProvider")
3407     static void MULReduceInt64VectorTests(IntFunction<int[]> fa) {
3408         int[] a = fa.apply(SPECIES.length());
3409         int[] r = fr.apply(SPECIES.length());
3410         int ra = 1;
3411 
3412         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3413             for (int i = 0; i < a.length; i += SPECIES.length()) {
3414                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3415                 r[i] = av.reduceLanes(VectorOperators.MUL);
3416             }
3417         }
3418 
3419         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3420             ra = 1;
3421             for (int i = 0; i < a.length; i += SPECIES.length()) {
3422                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3423                 ra *= av.reduceLanes(VectorOperators.MUL);
3424             }
3425         }
3426 
3427         assertReductionArraysEquals(r, ra, a,
3428                 Int64VectorTests::MULReduce, Int64VectorTests::MULReduceAll);
3429     }
3430 
3431     static int MULReduceMasked(int[] a, int idx, boolean[] mask) {
3432         int res = 1;
3433         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3434             if (mask[i % SPECIES.length()])
3435                 res *= a[i];
3436         }
3437 
3438         return res;
3439     }
3440 
3441     static int MULReduceAllMasked(int[] a, boolean[] mask) {
3442         int res = 1;
3443         for (int i = 0; i < a.length; i += SPECIES.length()) {
3444             res *= MULReduceMasked(a, i, mask);
3445         }
3446 
3447         return res;
3448     }
3449 
3450     @Test(dataProvider = "intUnaryOpMaskProvider")
3451     static void MULReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3452         int[] a = fa.apply(SPECIES.length());
3453         int[] r = fr.apply(SPECIES.length());
3454         boolean[] mask = fm.apply(SPECIES.length());
3455         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3456         int ra = 1;
3457 
3458         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3459             for (int i = 0; i < a.length; i += SPECIES.length()) {
3460                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3461                 r[i] = av.reduceLanes(VectorOperators.MUL, vmask);
3462             }
3463         }
3464 
3465         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3466             ra = 1;
3467             for (int i = 0; i < a.length; i += SPECIES.length()) {
3468                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3469                 ra *= av.reduceLanes(VectorOperators.MUL, vmask);
3470             }
3471         }
3472 
3473         assertReductionArraysEqualsMasked(r, ra, a, mask,
3474                 Int64VectorTests::MULReduceMasked, Int64VectorTests::MULReduceAllMasked);
3475     }
3476 
3477     static int MINReduce(int[] a, int idx) {
3478         int res = Integer.MAX_VALUE;
3479         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3480             res = (int) Math.min(res, a[i]);
3481         }
3482 
3483         return res;
3484     }
3485 
3486     static int MINReduceAll(int[] a) {
3487         int res = Integer.MAX_VALUE;
3488         for (int i = 0; i < a.length; i += SPECIES.length()) {
3489             res = (int) Math.min(res, MINReduce(a, i));
3490         }
3491 
3492         return res;
3493     }
3494 
3495     @Test(dataProvider = "intUnaryOpProvider")
3496     static void MINReduceInt64VectorTests(IntFunction<int[]> fa) {
3497         int[] a = fa.apply(SPECIES.length());
3498         int[] r = fr.apply(SPECIES.length());
3499         int ra = Integer.MAX_VALUE;
3500 
3501         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3502             for (int i = 0; i < a.length; i += SPECIES.length()) {
3503                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3504                 r[i] = av.reduceLanes(VectorOperators.MIN);
3505             }
3506         }
3507 
3508         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3509             ra = Integer.MAX_VALUE;
3510             for (int i = 0; i < a.length; i += SPECIES.length()) {
3511                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3512                 ra = (int) Math.min(ra, av.reduceLanes(VectorOperators.MIN));
3513             }
3514         }
3515 
3516         assertReductionArraysEquals(r, ra, a,
3517                 Int64VectorTests::MINReduce, Int64VectorTests::MINReduceAll);
3518     }
3519 
3520     static int MINReduceMasked(int[] a, int idx, boolean[] mask) {
3521         int res = Integer.MAX_VALUE;
3522         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3523             if (mask[i % SPECIES.length()])
3524                 res = (int) Math.min(res, a[i]);
3525         }
3526 
3527         return res;
3528     }
3529 
3530     static int MINReduceAllMasked(int[] a, boolean[] mask) {
3531         int res = Integer.MAX_VALUE;
3532         for (int i = 0; i < a.length; i += SPECIES.length()) {
3533             res = (int) Math.min(res, MINReduceMasked(a, i, mask));
3534         }
3535 
3536         return res;
3537     }
3538 
3539     @Test(dataProvider = "intUnaryOpMaskProvider")
3540     static void MINReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3541         int[] a = fa.apply(SPECIES.length());
3542         int[] r = fr.apply(SPECIES.length());
3543         boolean[] mask = fm.apply(SPECIES.length());
3544         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3545         int ra = Integer.MAX_VALUE;
3546 
3547         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3548             for (int i = 0; i < a.length; i += SPECIES.length()) {
3549                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3550                 r[i] = av.reduceLanes(VectorOperators.MIN, vmask);
3551             }
3552         }
3553 
3554         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3555             ra = Integer.MAX_VALUE;
3556             for (int i = 0; i < a.length; i += SPECIES.length()) {
3557                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3558                 ra = (int) Math.min(ra, av.reduceLanes(VectorOperators.MIN, vmask));
3559             }
3560         }
3561 
3562         assertReductionArraysEqualsMasked(r, ra, a, mask,
3563                 Int64VectorTests::MINReduceMasked, Int64VectorTests::MINReduceAllMasked);
3564     }
3565 
3566     static int MAXReduce(int[] a, int idx) {
3567         int res = Integer.MIN_VALUE;
3568         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3569             res = (int) Math.max(res, a[i]);
3570         }
3571 
3572         return res;
3573     }
3574 
3575     static int MAXReduceAll(int[] a) {
3576         int res = Integer.MIN_VALUE;
3577         for (int i = 0; i < a.length; i += SPECIES.length()) {
3578             res = (int) Math.max(res, MAXReduce(a, i));
3579         }
3580 
3581         return res;
3582     }
3583 
3584     @Test(dataProvider = "intUnaryOpProvider")
3585     static void MAXReduceInt64VectorTests(IntFunction<int[]> fa) {
3586         int[] a = fa.apply(SPECIES.length());
3587         int[] r = fr.apply(SPECIES.length());
3588         int ra = Integer.MIN_VALUE;
3589 
3590         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3591             for (int i = 0; i < a.length; i += SPECIES.length()) {
3592                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3593                 r[i] = av.reduceLanes(VectorOperators.MAX);
3594             }
3595         }
3596 
3597         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3598             ra = Integer.MIN_VALUE;
3599             for (int i = 0; i < a.length; i += SPECIES.length()) {
3600                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3601                 ra = (int) Math.max(ra, av.reduceLanes(VectorOperators.MAX));
3602             }
3603         }
3604 
3605         assertReductionArraysEquals(r, ra, a,
3606                 Int64VectorTests::MAXReduce, Int64VectorTests::MAXReduceAll);
3607     }
3608 
3609     static int MAXReduceMasked(int[] a, int idx, boolean[] mask) {
3610         int res = Integer.MIN_VALUE;
3611         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3612             if (mask[i % SPECIES.length()])
3613                 res = (int) Math.max(res, a[i]);
3614         }
3615 
3616         return res;
3617     }
3618 
3619     static int MAXReduceAllMasked(int[] a, boolean[] mask) {
3620         int res = Integer.MIN_VALUE;
3621         for (int i = 0; i < a.length; i += SPECIES.length()) {
3622             res = (int) Math.max(res, MAXReduceMasked(a, i, mask));
3623         }
3624 
3625         return res;
3626     }
3627 
3628     @Test(dataProvider = "intUnaryOpMaskProvider")
3629     static void MAXReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3630         int[] a = fa.apply(SPECIES.length());
3631         int[] r = fr.apply(SPECIES.length());
3632         boolean[] mask = fm.apply(SPECIES.length());
3633         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3634         int ra = Integer.MIN_VALUE;
3635 
3636         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3637             for (int i = 0; i < a.length; i += SPECIES.length()) {
3638                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3639                 r[i] = av.reduceLanes(VectorOperators.MAX, vmask);
3640             }
3641         }
3642 
3643         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3644             ra = Integer.MIN_VALUE;
3645             for (int i = 0; i < a.length; i += SPECIES.length()) {
3646                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3647                 ra = (int) Math.max(ra, av.reduceLanes(VectorOperators.MAX, vmask));
3648             }
3649         }
3650 
3651         assertReductionArraysEqualsMasked(r, ra, a, mask,
3652                 Int64VectorTests::MAXReduceMasked, Int64VectorTests::MAXReduceAllMasked);
3653     }
3654 
3655     static int FIRST_NONZEROReduce(int[] a, int idx) {
3656         int res = (int) 0;
3657         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3658             res = firstNonZero(res, a[i]);
3659         }
3660 
3661         return res;
3662     }
3663 
3664     static int FIRST_NONZEROReduceAll(int[] a) {
3665         int res = (int) 0;
3666         for (int i = 0; i < a.length; i += SPECIES.length()) {
3667             res = firstNonZero(res, FIRST_NONZEROReduce(a, i));
3668         }
3669 
3670         return res;
3671     }
3672 
3673     @Test(dataProvider = "intUnaryOpProvider")
3674     static void FIRST_NONZEROReduceInt64VectorTests(IntFunction<int[]> fa) {
3675         int[] a = fa.apply(SPECIES.length());
3676         int[] r = fr.apply(SPECIES.length());
3677         int ra = (int) 0;
3678 
3679         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3680             for (int i = 0; i < a.length; i += SPECIES.length()) {
3681                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3682                 r[i] = av.reduceLanes(VectorOperators.FIRST_NONZERO);
3683             }
3684         }
3685 
3686         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3687             ra = (int) 0;
3688             for (int i = 0; i < a.length; i += SPECIES.length()) {
3689                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3690                 ra = firstNonZero(ra, av.reduceLanes(VectorOperators.FIRST_NONZERO));
3691             }
3692         }
3693 
3694         assertReductionArraysEquals(r, ra, a,
3695                 Int64VectorTests::FIRST_NONZEROReduce, Int64VectorTests::FIRST_NONZEROReduceAll);
3696     }
3697 
3698     static int FIRST_NONZEROReduceMasked(int[] a, int idx, boolean[] mask) {
3699         int res = (int) 0;
3700         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3701             if (mask[i % SPECIES.length()])
3702                 res = firstNonZero(res, a[i]);
3703         }
3704 
3705         return res;
3706     }
3707 
3708     static int FIRST_NONZEROReduceAllMasked(int[] a, boolean[] mask) {
3709         int res = (int) 0;
3710         for (int i = 0; i < a.length; i += SPECIES.length()) {
3711             res = firstNonZero(res, FIRST_NONZEROReduceMasked(a, i, mask));
3712         }
3713 
3714         return res;
3715     }
3716 
3717     @Test(dataProvider = "intUnaryOpMaskProvider")
3718     static void FIRST_NONZEROReduceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<boolean[]> fm) {
3719         int[] a = fa.apply(SPECIES.length());
3720         int[] r = fr.apply(SPECIES.length());
3721         boolean[] mask = fm.apply(SPECIES.length());
3722         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3723         int ra = (int) 0;
3724 
3725         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3726             for (int i = 0; i < a.length; i += SPECIES.length()) {
3727                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3728                 r[i] = av.reduceLanes(VectorOperators.FIRST_NONZERO, vmask);
3729             }
3730         }
3731 
3732         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3733             ra = (int) 0;
3734             for (int i = 0; i < a.length; i += SPECIES.length()) {
3735                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3736                 ra = firstNonZero(ra, av.reduceLanes(VectorOperators.FIRST_NONZERO, vmask));
3737             }
3738         }
3739 
3740         assertReductionArraysEqualsMasked(r, ra, a, mask,
3741                 Int64VectorTests::FIRST_NONZEROReduceMasked, Int64VectorTests::FIRST_NONZEROReduceAllMasked);
3742     }
3743 
3744     static boolean anyTrue(boolean[] a, int idx) {
3745         boolean res = false;
3746         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3747             res |= a[i];
3748         }
3749 
3750         return res;
3751     }
3752 

3753     @Test(dataProvider = "boolUnaryOpProvider")
3754     static void anyTrueInt64VectorTests(IntFunction<boolean[]> fm) {
3755         boolean[] mask = fm.apply(SPECIES.length());
3756         boolean[] r = fmr.apply(SPECIES.length());
3757 
3758         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3759             for (int i = 0; i < mask.length; i += SPECIES.length()) {
3760                 VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, i);
3761                 r[i] = vmask.anyTrue();
3762             }
3763         }
3764 
3765         assertReductionBoolArraysEquals(r, mask, Int64VectorTests::anyTrue);
3766     }
3767 

3768     static boolean allTrue(boolean[] a, int idx) {
3769         boolean res = true;
3770         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3771             res &= a[i];
3772         }
3773 
3774         return res;
3775     }
3776 

3777     @Test(dataProvider = "boolUnaryOpProvider")
3778     static void allTrueInt64VectorTests(IntFunction<boolean[]> fm) {
3779         boolean[] mask = fm.apply(SPECIES.length());
3780         boolean[] r = fmr.apply(SPECIES.length());
3781 
3782         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3783             for (int i = 0; i < mask.length; i += SPECIES.length()) {
3784                 VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, i);
3785                 r[i] = vmask.allTrue();
3786             }
3787         }
3788 
3789         assertReductionBoolArraysEquals(r, mask, Int64VectorTests::allTrue);
3790     }
3791 

3792     @Test(dataProvider = "intUnaryOpProvider")
3793     static void withInt64VectorTests(IntFunction<int []> fa) {
3794         int[] a = fa.apply(SPECIES.length());
3795         int[] r = fr.apply(SPECIES.length());
3796 
3797         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3798             for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
3799                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3800                 av.withLane((j++ & (SPECIES.length()-1)), (int)(65535+i)).intoArray(r, i);
3801             }
3802         }
3803 
3804 
3805         for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
3806             assertInsertArraysEquals(r, a, (int)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
3807         }
3808     }
3809 
3810     static boolean testIS_DEFAULT(int a) {
3811         return bits(a)==0;
3812     }
3813 
3814     @Test(dataProvider = "intTestOpProvider")
3815     static void IS_DEFAULTInt64VectorTests(IntFunction<int[]> fa) {
3816         int[] a = fa.apply(SPECIES.length());
3817 
3818         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3819             for (int i = 0; i < a.length; i += SPECIES.length()) {
3820                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3821                 VectorMask<Integer> mv = av.test(VectorOperators.IS_DEFAULT);
3822 
3823                 // Check results as part of computation.
3824                 for (int j = 0; j < SPECIES.length(); j++) {
3825                     Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j]));
3826                 }
3827             }
3828         }
3829     }
3830 
3831     @Test(dataProvider = "intTestOpMaskProvider")
3832     static void IS_DEFAULTMaskedInt64VectorTests(IntFunction<int[]> fa,
3833                                           IntFunction<boolean[]> fm) {
3834         int[] a = fa.apply(SPECIES.length());
3835         boolean[] mask = fm.apply(SPECIES.length());
3836         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3837 
3838         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3839             for (int i = 0; i < a.length; i += SPECIES.length()) {
3840                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3841                 VectorMask<Integer> mv = av.test(VectorOperators.IS_DEFAULT, vmask);
3842 
3843                 // Check results as part of computation.
3844                 for (int j = 0; j < SPECIES.length(); j++) {
3845                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j]));
3846                 }
3847             }
3848         }
3849     }
3850 
3851     static boolean testIS_NEGATIVE(int a) {
3852         return bits(a)<0;
3853     }
3854 
3855     @Test(dataProvider = "intTestOpProvider")
3856     static void IS_NEGATIVEInt64VectorTests(IntFunction<int[]> fa) {
3857         int[] a = fa.apply(SPECIES.length());
3858 
3859         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3860             for (int i = 0; i < a.length; i += SPECIES.length()) {
3861                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3862                 VectorMask<Integer> mv = av.test(VectorOperators.IS_NEGATIVE);
3863 
3864                 // Check results as part of computation.
3865                 for (int j = 0; j < SPECIES.length(); j++) {
3866                     Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j]));
3867                 }
3868             }
3869         }
3870     }

3872     @Test(dataProvider = "intTestOpMaskProvider")
3873     static void IS_NEGATIVEMaskedInt64VectorTests(IntFunction<int[]> fa,
3874                                           IntFunction<boolean[]> fm) {
3875         int[] a = fa.apply(SPECIES.length());
3876         boolean[] mask = fm.apply(SPECIES.length());
3877         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3878 
3879         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3880             for (int i = 0; i < a.length; i += SPECIES.length()) {
3881                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3882                 VectorMask<Integer> mv = av.test(VectorOperators.IS_NEGATIVE, vmask);
3883 
3884                 // Check results as part of computation.
3885                 for (int j = 0; j < SPECIES.length(); j++) {
3886                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j]));
3887                 }
3888             }
3889         }
3890     }
3891 



3892     @Test(dataProvider = "intCompareOpProvider")
3893     static void LTInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
3894         int[] a = fa.apply(SPECIES.length());
3895         int[] b = fb.apply(SPECIES.length());
3896 
3897         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3898             for (int i = 0; i < a.length; i += SPECIES.length()) {
3899                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3900                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
3901                 VectorMask<Integer> mv = av.compare(VectorOperators.LT, bv);
3902 
3903                 // Check results as part of computation.
3904                 for (int j = 0; j < SPECIES.length(); j++) {
3905                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
3906                 }
3907             }
3908         }
3909     }
3910 

3911     @Test(dataProvider = "intCompareOpProvider")
3912     static void ltInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
3913         int[] a = fa.apply(SPECIES.length());
3914         int[] b = fb.apply(SPECIES.length());
3915 
3916         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3917             for (int i = 0; i < a.length; i += SPECIES.length()) {
3918                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3919                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
3920                 VectorMask<Integer> mv = av.lt(bv);
3921 
3922                 // Check results as part of computation.
3923                 for (int j = 0; j < SPECIES.length(); j++) {
3924                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
3925                 }
3926             }
3927         }
3928     }
3929 
3930     @Test(dataProvider = "intCompareOpMaskProvider")

3933         int[] a = fa.apply(SPECIES.length());
3934         int[] b = fb.apply(SPECIES.length());
3935         boolean[] mask = fm.apply(SPECIES.length());
3936 
3937         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3938 
3939         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3940             for (int i = 0; i < a.length; i += SPECIES.length()) {
3941                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3942                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
3943                 VectorMask<Integer> mv = av.compare(VectorOperators.LT, bv, vmask);
3944 
3945                 // Check results as part of computation.
3946                 for (int j = 0; j < SPECIES.length(); j++) {
3947                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j]));
3948                 }
3949             }
3950         }
3951     }
3952 

3953     @Test(dataProvider = "intCompareOpProvider")
3954     static void GTInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
3955         int[] a = fa.apply(SPECIES.length());
3956         int[] b = fb.apply(SPECIES.length());
3957 
3958         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3959             for (int i = 0; i < a.length; i += SPECIES.length()) {
3960                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3961                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
3962                 VectorMask<Integer> mv = av.compare(VectorOperators.GT, bv);
3963 
3964                 // Check results as part of computation.
3965                 for (int j = 0; j < SPECIES.length(); j++) {
3966                     Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j]));
3967                 }
3968             }
3969         }
3970     }
3971 
3972     @Test(dataProvider = "intCompareOpMaskProvider")

3975         int[] a = fa.apply(SPECIES.length());
3976         int[] b = fb.apply(SPECIES.length());
3977         boolean[] mask = fm.apply(SPECIES.length());
3978 
3979         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3980 
3981         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3982             for (int i = 0; i < a.length; i += SPECIES.length()) {
3983                 IntVector av = IntVector.fromArray(SPECIES, a, i);
3984                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
3985                 VectorMask<Integer> mv = av.compare(VectorOperators.GT, bv, vmask);
3986 
3987                 // Check results as part of computation.
3988                 for (int j = 0; j < SPECIES.length(); j++) {
3989                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j]));
3990                 }
3991             }
3992         }
3993     }
3994 

3995     @Test(dataProvider = "intCompareOpProvider")
3996     static void EQInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
3997         int[] a = fa.apply(SPECIES.length());
3998         int[] b = fb.apply(SPECIES.length());
3999 
4000         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4001             for (int i = 0; i < a.length; i += SPECIES.length()) {
4002                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4003                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4004                 VectorMask<Integer> mv = av.compare(VectorOperators.EQ, bv);
4005 
4006                 // Check results as part of computation.
4007                 for (int j = 0; j < SPECIES.length(); j++) {
4008                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
4009                 }
4010             }
4011         }
4012     }
4013 

4014     @Test(dataProvider = "intCompareOpProvider")
4015     static void eqInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4016         int[] a = fa.apply(SPECIES.length());
4017         int[] b = fb.apply(SPECIES.length());
4018 
4019         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4020             for (int i = 0; i < a.length; i += SPECIES.length()) {
4021                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4022                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4023                 VectorMask<Integer> mv = av.eq(bv);
4024 
4025                 // Check results as part of computation.
4026                 for (int j = 0; j < SPECIES.length(); j++) {
4027                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
4028                 }
4029             }
4030         }
4031     }
4032 
4033     @Test(dataProvider = "intCompareOpMaskProvider")

4036         int[] a = fa.apply(SPECIES.length());
4037         int[] b = fb.apply(SPECIES.length());
4038         boolean[] mask = fm.apply(SPECIES.length());
4039 
4040         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4041 
4042         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4043             for (int i = 0; i < a.length; i += SPECIES.length()) {
4044                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4045                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4046                 VectorMask<Integer> mv = av.compare(VectorOperators.EQ, bv, vmask);
4047 
4048                 // Check results as part of computation.
4049                 for (int j = 0; j < SPECIES.length(); j++) {
4050                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j]));
4051                 }
4052             }
4053         }
4054     }
4055 

4056     @Test(dataProvider = "intCompareOpProvider")
4057     static void NEInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4058         int[] a = fa.apply(SPECIES.length());
4059         int[] b = fb.apply(SPECIES.length());
4060 
4061         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4062             for (int i = 0; i < a.length; i += SPECIES.length()) {
4063                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4064                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4065                 VectorMask<Integer> mv = av.compare(VectorOperators.NE, bv);
4066 
4067                 // Check results as part of computation.
4068                 for (int j = 0; j < SPECIES.length(); j++) {
4069                     Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j]));
4070                 }
4071             }
4072         }
4073     }
4074 
4075     @Test(dataProvider = "intCompareOpMaskProvider")

4078         int[] a = fa.apply(SPECIES.length());
4079         int[] b = fb.apply(SPECIES.length());
4080         boolean[] mask = fm.apply(SPECIES.length());
4081 
4082         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4083 
4084         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4085             for (int i = 0; i < a.length; i += SPECIES.length()) {
4086                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4087                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4088                 VectorMask<Integer> mv = av.compare(VectorOperators.NE, bv, vmask);
4089 
4090                 // Check results as part of computation.
4091                 for (int j = 0; j < SPECIES.length(); j++) {
4092                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j]));
4093                 }
4094             }
4095         }
4096     }
4097 

4098     @Test(dataProvider = "intCompareOpProvider")
4099     static void LEInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4100         int[] a = fa.apply(SPECIES.length());
4101         int[] b = fb.apply(SPECIES.length());
4102 
4103         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4104             for (int i = 0; i < a.length; i += SPECIES.length()) {
4105                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4106                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4107                 VectorMask<Integer> mv = av.compare(VectorOperators.LE, bv);
4108 
4109                 // Check results as part of computation.
4110                 for (int j = 0; j < SPECIES.length(); j++) {
4111                     Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j]));
4112                 }
4113             }
4114         }
4115     }
4116 
4117     @Test(dataProvider = "intCompareOpMaskProvider")

4120         int[] a = fa.apply(SPECIES.length());
4121         int[] b = fb.apply(SPECIES.length());
4122         boolean[] mask = fm.apply(SPECIES.length());
4123 
4124         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4125 
4126         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4127             for (int i = 0; i < a.length; i += SPECIES.length()) {
4128                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4129                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4130                 VectorMask<Integer> mv = av.compare(VectorOperators.LE, bv, vmask);
4131 
4132                 // Check results as part of computation.
4133                 for (int j = 0; j < SPECIES.length(); j++) {
4134                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j]));
4135                 }
4136             }
4137         }
4138     }
4139 

4140     @Test(dataProvider = "intCompareOpProvider")
4141     static void GEInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4142         int[] a = fa.apply(SPECIES.length());
4143         int[] b = fb.apply(SPECIES.length());
4144 
4145         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4146             for (int i = 0; i < a.length; i += SPECIES.length()) {
4147                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4148                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4149                 VectorMask<Integer> mv = av.compare(VectorOperators.GE, bv);
4150 
4151                 // Check results as part of computation.
4152                 for (int j = 0; j < SPECIES.length(); j++) {
4153                     Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j]));
4154                 }
4155             }
4156         }
4157     }
4158 
4159     @Test(dataProvider = "intCompareOpMaskProvider")

4162         int[] a = fa.apply(SPECIES.length());
4163         int[] b = fb.apply(SPECIES.length());
4164         boolean[] mask = fm.apply(SPECIES.length());
4165 
4166         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4167 
4168         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4169             for (int i = 0; i < a.length; i += SPECIES.length()) {
4170                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4171                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4172                 VectorMask<Integer> mv = av.compare(VectorOperators.GE, bv, vmask);
4173 
4174                 // Check results as part of computation.
4175                 for (int j = 0; j < SPECIES.length(); j++) {
4176                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j]));
4177                 }
4178             }
4179         }
4180     }
4181 


4182     @Test(dataProvider = "intCompareOpProvider")
4183     static void UNSIGNED_LTInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4184         int[] a = fa.apply(SPECIES.length());
4185         int[] b = fb.apply(SPECIES.length());
4186 
4187         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4188             for (int i = 0; i < a.length; i += SPECIES.length()) {
4189                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4190                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4191                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_LT, bv);
4192 
4193                 // Check results as part of computation.
4194                 for (int j = 0; j < SPECIES.length(); j++) {
4195                     Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j]));
4196                 }
4197             }
4198         }
4199     }
4200 


4201     @Test(dataProvider = "intCompareOpMaskProvider")
4202     static void UNSIGNED_LTInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
4203                                                 IntFunction<boolean[]> fm) {
4204         int[] a = fa.apply(SPECIES.length());
4205         int[] b = fb.apply(SPECIES.length());
4206         boolean[] mask = fm.apply(SPECIES.length());
4207 
4208         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4209 
4210         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4211             for (int i = 0; i < a.length; i += SPECIES.length()) {
4212                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4213                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4214                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_LT, bv, vmask);
4215 
4216                 // Check results as part of computation.
4217                 for (int j = 0; j < SPECIES.length(); j++) {
4218                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j]));
4219                 }
4220             }
4221         }
4222     }
4223 



4224     @Test(dataProvider = "intCompareOpProvider")
4225     static void UNSIGNED_GTInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4226         int[] a = fa.apply(SPECIES.length());
4227         int[] b = fb.apply(SPECIES.length());
4228 
4229         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4230             for (int i = 0; i < a.length; i += SPECIES.length()) {
4231                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4232                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4233                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_GT, bv);
4234 
4235                 // Check results as part of computation.
4236                 for (int j = 0; j < SPECIES.length(); j++) {
4237                     Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j]));
4238                 }
4239             }
4240         }
4241     }
4242 


4243     @Test(dataProvider = "intCompareOpMaskProvider")
4244     static void UNSIGNED_GTInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
4245                                                 IntFunction<boolean[]> fm) {
4246         int[] a = fa.apply(SPECIES.length());
4247         int[] b = fb.apply(SPECIES.length());
4248         boolean[] mask = fm.apply(SPECIES.length());
4249 
4250         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4251 
4252         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4253             for (int i = 0; i < a.length; i += SPECIES.length()) {
4254                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4255                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4256                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_GT, bv, vmask);
4257 
4258                 // Check results as part of computation.
4259                 for (int j = 0; j < SPECIES.length(); j++) {
4260                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j]));
4261                 }
4262             }
4263         }
4264     }
4265 



4266     @Test(dataProvider = "intCompareOpProvider")
4267     static void UNSIGNED_LEInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4268         int[] a = fa.apply(SPECIES.length());
4269         int[] b = fb.apply(SPECIES.length());
4270 
4271         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4272             for (int i = 0; i < a.length; i += SPECIES.length()) {
4273                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4274                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4275                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_LE, bv);
4276 
4277                 // Check results as part of computation.
4278                 for (int j = 0; j < SPECIES.length(); j++) {
4279                     Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j]));
4280                 }
4281             }
4282         }
4283     }
4284 


4285     @Test(dataProvider = "intCompareOpMaskProvider")
4286     static void UNSIGNED_LEInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
4287                                                 IntFunction<boolean[]> fm) {
4288         int[] a = fa.apply(SPECIES.length());
4289         int[] b = fb.apply(SPECIES.length());
4290         boolean[] mask = fm.apply(SPECIES.length());
4291 
4292         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4293 
4294         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4295             for (int i = 0; i < a.length; i += SPECIES.length()) {
4296                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4297                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4298                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_LE, bv, vmask);
4299 
4300                 // Check results as part of computation.
4301                 for (int j = 0; j < SPECIES.length(); j++) {
4302                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j]));
4303                 }
4304             }
4305         }
4306     }
4307 



4308     @Test(dataProvider = "intCompareOpProvider")
4309     static void UNSIGNED_GEInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4310         int[] a = fa.apply(SPECIES.length());
4311         int[] b = fb.apply(SPECIES.length());
4312 
4313         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4314             for (int i = 0; i < a.length; i += SPECIES.length()) {
4315                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4316                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4317                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_GE, bv);
4318 
4319                 // Check results as part of computation.
4320                 for (int j = 0; j < SPECIES.length(); j++) {
4321                     Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j]));
4322                 }
4323             }
4324         }
4325     }
4326 


4327     @Test(dataProvider = "intCompareOpMaskProvider")
4328     static void UNSIGNED_GEInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
4329                                                 IntFunction<boolean[]> fm) {
4330         int[] a = fa.apply(SPECIES.length());
4331         int[] b = fb.apply(SPECIES.length());
4332         boolean[] mask = fm.apply(SPECIES.length());
4333 
4334         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4335 
4336         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4337             for (int i = 0; i < a.length; i += SPECIES.length()) {
4338                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4339                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4340                 VectorMask<Integer> mv = av.compare(VectorOperators.UNSIGNED_GE, bv, vmask);
4341 
4342                 // Check results as part of computation.
4343                 for (int j = 0; j < SPECIES.length(); j++) {
4344                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j]));
4345                 }
4346             }
4347         }
4348     }
4349 


4350     @Test(dataProvider = "intCompareOpProvider")
4351     static void LTInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4352         int[] a = fa.apply(SPECIES.length());
4353         int[] b = fb.apply(SPECIES.length());
4354 
4355         for (int i = 0; i < a.length; i += SPECIES.length()) {
4356             IntVector av = IntVector.fromArray(SPECIES, a, i);
4357             VectorMask<Integer> mv = av.compare(VectorOperators.LT, b[i]);
4358 
4359             // Check results as part of computation.
4360             for (int j = 0; j < SPECIES.length(); j++) {
4361                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
4362             }
4363         }
4364     }
4365 

4366     @Test(dataProvider = "intCompareOpMaskProvider")
4367     static void LTInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa,
4368                                 IntFunction<int[]> fb, IntFunction<boolean[]> fm) {
4369         int[] a = fa.apply(SPECIES.length());
4370         int[] b = fb.apply(SPECIES.length());
4371         boolean[] mask = fm.apply(SPECIES.length());
4372 
4373         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4374 
4375         for (int i = 0; i < a.length; i += SPECIES.length()) {
4376             IntVector av = IntVector.fromArray(SPECIES, a, i);
4377             VectorMask<Integer> mv = av.compare(VectorOperators.LT, b[i], vmask);
4378 
4379             // Check results as part of computation.
4380             for (int j = 0; j < SPECIES.length(); j++) {
4381                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i]));
4382             }
4383         }
4384     }
4385 
4386     @Test(dataProvider = "intCompareOpProvider")
4387     static void LTInt64VectorTestsBroadcastLongSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4388         int[] a = fa.apply(SPECIES.length());
4389         int[] b = fb.apply(SPECIES.length());
4390 
4391         for (int i = 0; i < a.length; i += SPECIES.length()) {
4392             IntVector av = IntVector.fromArray(SPECIES, a, i);
4393             VectorMask<Integer> mv = av.compare(VectorOperators.LT, (long)b[i]);
4394 
4395             // Check results as part of computation.
4396             for (int j = 0; j < SPECIES.length(); j++) {
4397                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i]));
4398             }
4399         }
4400     }
4401 

4402     @Test(dataProvider = "intCompareOpMaskProvider")
4403     static void LTInt64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction<int[]> fa,
4404                                 IntFunction<int[]> fb, IntFunction<boolean[]> fm) {
4405         int[] a = fa.apply(SPECIES.length());
4406         int[] b = fb.apply(SPECIES.length());
4407         boolean[] mask = fm.apply(SPECIES.length());
4408 
4409         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4410 
4411         for (int i = 0; i < a.length; i += SPECIES.length()) {
4412             IntVector av = IntVector.fromArray(SPECIES, a, i);
4413             VectorMask<Integer> mv = av.compare(VectorOperators.LT, (long)b[i], vmask);
4414 
4415             // Check results as part of computation.
4416             for (int j = 0; j < SPECIES.length(); j++) {
4417                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i])));
4418             }
4419         }
4420     }
4421 
4422     @Test(dataProvider = "intCompareOpProvider")
4423     static void EQInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4424         int[] a = fa.apply(SPECIES.length());
4425         int[] b = fb.apply(SPECIES.length());
4426 
4427         for (int i = 0; i < a.length; i += SPECIES.length()) {
4428             IntVector av = IntVector.fromArray(SPECIES, a, i);
4429             VectorMask<Integer> mv = av.compare(VectorOperators.EQ, b[i]);
4430 
4431             // Check results as part of computation.
4432             for (int j = 0; j < SPECIES.length(); j++) {
4433                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
4434             }
4435         }
4436     }
4437 

4438     @Test(dataProvider = "intCompareOpMaskProvider")
4439     static void EQInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa,
4440                                 IntFunction<int[]> fb, IntFunction<boolean[]> fm) {
4441         int[] a = fa.apply(SPECIES.length());
4442         int[] b = fb.apply(SPECIES.length());
4443         boolean[] mask = fm.apply(SPECIES.length());
4444 
4445         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4446 
4447         for (int i = 0; i < a.length; i += SPECIES.length()) {
4448             IntVector av = IntVector.fromArray(SPECIES, a, i);
4449             VectorMask<Integer> mv = av.compare(VectorOperators.EQ, b[i], vmask);
4450 
4451             // Check results as part of computation.
4452             for (int j = 0; j < SPECIES.length(); j++) {
4453                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i]));
4454             }
4455         }
4456     }
4457 
4458     @Test(dataProvider = "intCompareOpProvider")
4459     static void EQInt64VectorTestsBroadcastLongSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4460         int[] a = fa.apply(SPECIES.length());
4461         int[] b = fb.apply(SPECIES.length());
4462 
4463         for (int i = 0; i < a.length; i += SPECIES.length()) {
4464             IntVector av = IntVector.fromArray(SPECIES, a, i);
4465             VectorMask<Integer> mv = av.compare(VectorOperators.EQ, (long)b[i]);
4466 
4467             // Check results as part of computation.
4468             for (int j = 0; j < SPECIES.length(); j++) {
4469                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i]));
4470             }
4471         }
4472     }
4473 

4474     @Test(dataProvider = "intCompareOpMaskProvider")
4475     static void EQInt64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction<int[]> fa,
4476                                 IntFunction<int[]> fb, IntFunction<boolean[]> fm) {
4477         int[] a = fa.apply(SPECIES.length());
4478         int[] b = fb.apply(SPECIES.length());
4479         boolean[] mask = fm.apply(SPECIES.length());
4480 
4481         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4482 
4483         for (int i = 0; i < a.length; i += SPECIES.length()) {
4484             IntVector av = IntVector.fromArray(SPECIES, a, i);
4485             VectorMask<Integer> mv = av.compare(VectorOperators.EQ, (long)b[i], vmask);
4486 
4487             // Check results as part of computation.
4488             for (int j = 0; j < SPECIES.length(); j++) {
4489                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i])));
4490             }
4491         }
4492     }
4493 

4532         assertRearrangeArraysEquals(r, a, order, SPECIES.length());
4533     }
4534 
4535     @Test(dataProvider = "intUnaryOpShuffleMaskProvider")
4536     static void RearrangeInt64VectorTestsMaskedSmokeTest(IntFunction<int[]> fa,
4537                                                           BiFunction<Integer,Integer,int[]> fs,
4538                                                           IntFunction<boolean[]> fm) {
4539         int[] a = fa.apply(SPECIES.length());
4540         int[] order = fs.apply(a.length, SPECIES.length());
4541         int[] r = fr.apply(SPECIES.length());
4542         boolean[] mask = fm.apply(SPECIES.length());
4543         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4544 
4545         for (int i = 0; i < a.length; i += SPECIES.length()) {
4546             IntVector av = IntVector.fromArray(SPECIES, a, i);
4547             av.rearrange(VectorShuffle.fromArray(SPECIES, order, i), vmask).intoArray(r, i);
4548         }
4549 
4550         assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
4551     }
4552 
4553     @Test(dataProvider = "intUnaryOpMaskProvider")
4554     static void compressInt64VectorTests(IntFunction<int[]> fa,
4555                                                 IntFunction<boolean[]> fm) {
4556         int[] a = fa.apply(SPECIES.length());
4557         int[] r = fr.apply(SPECIES.length());
4558         boolean[] mask = fm.apply(SPECIES.length());
4559         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4560 
4561         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4562             for (int i = 0; i < a.length; i += SPECIES.length()) {
4563                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4564                 av.compress(vmask).intoArray(r, i);
4565             }
4566         }
4567 
4568         assertcompressArraysEquals(r, a, mask, SPECIES.length());
4569     }
4570 
4571     @Test(dataProvider = "intUnaryOpMaskProvider")
4572     static void expandInt64VectorTests(IntFunction<int[]> fa,
4573                                                 IntFunction<boolean[]> fm) {
4574         int[] a = fa.apply(SPECIES.length());
4575         int[] r = fr.apply(SPECIES.length());
4576         boolean[] mask = fm.apply(SPECIES.length());
4577         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4578 
4579         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4580             for (int i = 0; i < a.length; i += SPECIES.length()) {
4581                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4582                 av.expand(vmask).intoArray(r, i);
4583             }
4584         }
4585 
4586         assertexpandArraysEquals(r, a, mask, SPECIES.length());
4587     }
4588 
4589     @Test(dataProvider = "intUnaryOpProvider")
4590     static void getInt64VectorTests(IntFunction<int[]> fa) {
4591         int[] a = fa.apply(SPECIES.length());
4592         int[] r = fr.apply(SPECIES.length());
4593 
4594         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4595             for (int i = 0; i < a.length; i += SPECIES.length()) {
4596                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4597                 int num_lanes = SPECIES.length();
4598                 // Manually unroll because full unroll happens after intrinsification.
4599                 // Unroll is needed because get intrinsic requires for index to be a known constant.
4600                 if (num_lanes == 1) {
4601                     r[i]=av.lane(0);
4602                 } else if (num_lanes == 2) {
4603                     r[i]=av.lane(0);
4604                     r[i+1]=av.lane(1);
4605                 } else if (num_lanes == 4) {
4606                     r[i]=av.lane(0);
4607                     r[i+1]=av.lane(1);
4608                     r[i+2]=av.lane(2);

4739             }
4740         }
4741 
4742         assertArraysEquals(r, a, Int64VectorTests::get);
4743     }
4744 
4745     @Test(dataProvider = "intUnaryOpProvider")
4746     static void BroadcastInt64VectorTests(IntFunction<int[]> fa) {
4747         int[] a = fa.apply(SPECIES.length());
4748         int[] r = new int[a.length];
4749 
4750         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4751             for (int i = 0; i < a.length; i += SPECIES.length()) {
4752                 IntVector.broadcast(SPECIES, a[i]).intoArray(r, i);
4753             }
4754         }
4755 
4756         assertBroadcastArraysEquals(r, a);
4757     }
4758 




4759     @Test(dataProvider = "intUnaryOpProvider")
4760     static void ZeroInt64VectorTests(IntFunction<int[]> fa) {
4761         int[] a = fa.apply(SPECIES.length());
4762         int[] r = new int[a.length];
4763 
4764         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4765             for (int i = 0; i < a.length; i += SPECIES.length()) {
4766                 IntVector.zero(SPECIES).intoArray(a, i);
4767             }
4768         }
4769 
4770         Assert.assertEquals(a, r);
4771     }
4772 



4773     static int[] sliceUnary(int[] a, int origin, int idx) {
4774         int[] res = new int[SPECIES.length()];
4775         for (int i = 0; i < SPECIES.length(); i++){
4776             if(i+origin < SPECIES.length())
4777                 res[i] = a[idx+i+origin];
4778             else
4779                 res[i] = (int)0;
4780         }
4781         return res;
4782     }
4783 
4784     @Test(dataProvider = "intUnaryOpProvider")
4785     static void sliceUnaryInt64VectorTests(IntFunction<int[]> fa) {
4786         int[] a = fa.apply(SPECIES.length());
4787         int[] r = new int[a.length];
4788         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4789         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4790             for (int i = 0; i < a.length; i += SPECIES.length()) {
4791                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4792                 av.slice(origin).intoArray(r, i);
4793             }
4794         }
4795 
4796         assertArraysEquals(r, a, origin, Int64VectorTests::sliceUnary);
4797     }
4798 
4799     static int[] sliceBinary(int[] a, int[] b, int origin, int idx) {
4800         int[] res = new int[SPECIES.length()];
4801         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4802             if(i+origin < SPECIES.length())
4803                 res[i] = a[idx+i+origin];
4804             else {
4805                 res[i] = b[idx+j];
4806                 j++;
4807             }
4808         }
4809         return res;
4810     }
4811 
4812     @Test(dataProvider = "intBinaryOpProvider")
4813     static void sliceBinaryInt64VectorTestsBinary(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4814         int[] a = fa.apply(SPECIES.length());
4815         int[] b = fb.apply(SPECIES.length());
4816         int[] r = new int[a.length];
4817         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4818         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4819             for (int i = 0; i < a.length; i += SPECIES.length()) {
4820                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4821                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4822                 av.slice(origin, bv).intoArray(r, i);
4823             }
4824         }
4825 
4826         assertArraysEquals(r, a, b, origin, Int64VectorTests::sliceBinary);
4827     }
4828 
4829     static int[] slice(int[] a, int[] b, int origin, boolean[] mask, int idx) {
4830         int[] res = new int[SPECIES.length()];
4831         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4832             if(i+origin < SPECIES.length())
4833                 res[i] = mask[i] ? a[idx+i+origin] : (int)0;
4834             else {
4835                 res[i] = mask[i] ? b[idx+j] : (int)0;
4836                 j++;
4837             }
4838         }
4839         return res;
4840     }
4841 
4842     @Test(dataProvider = "intBinaryOpMaskProvider")
4843     static void sliceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
4844     IntFunction<boolean[]> fm) {
4845         int[] a = fa.apply(SPECIES.length());
4846         int[] b = fb.apply(SPECIES.length());
4847         boolean[] mask = fm.apply(SPECIES.length());
4848         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4849 
4850         int[] r = new int[a.length];
4851         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4852         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4853             for (int i = 0; i < a.length; i += SPECIES.length()) {
4854                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4855                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4856                 av.slice(origin, bv, vmask).intoArray(r, i);
4857             }
4858         }
4859 
4860         assertArraysEquals(r, a, b, origin, mask, Int64VectorTests::slice);
4861     }
4862 
4863     static int[] unsliceUnary(int[] a, int origin, int idx) {
4864         int[] res = new int[SPECIES.length()];
4865         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4866             if(i < origin)
4867                 res[i] = (int)0;
4868             else {
4869                 res[i] = a[idx+j];
4870                 j++;
4871             }
4872         }
4873         return res;
4874     }
4875 
4876     @Test(dataProvider = "intUnaryOpProvider")
4877     static void unsliceUnaryInt64VectorTests(IntFunction<int[]> fa) {
4878         int[] a = fa.apply(SPECIES.length());
4879         int[] r = new int[a.length];
4880         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4881         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4882             for (int i = 0; i < a.length; i += SPECIES.length()) {
4883                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4884                 av.unslice(origin).intoArray(r, i);
4885             }
4886         }
4887 
4888         assertArraysEquals(r, a, origin, Int64VectorTests::unsliceUnary);
4889     }
4890 
4891     static int[] unsliceBinary(int[] a, int[] b, int origin, int part, int idx) {
4892         int[] res = new int[SPECIES.length()];
4893         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4894             if (part == 0) {
4895                 if (i < origin)
4896                     res[i] = b[idx+i];
4897                 else {
4898                     res[i] = a[idx+j];
4899                     j++;
4900                 }
4901             } else if (part == 1) {
4902                 if (i < origin)
4903                     res[i] = a[idx+SPECIES.length()-origin+i];
4904                 else {
4905                     res[i] = b[idx+origin+j];
4906                     j++;
4907                 }
4908             }
4909         }
4910         return res;
4911     }
4912 
4913     @Test(dataProvider = "intBinaryOpProvider")
4914     static void unsliceBinaryInt64VectorTestsBinary(IntFunction<int[]> fa, IntFunction<int[]> fb) {
4915         int[] a = fa.apply(SPECIES.length());
4916         int[] b = fb.apply(SPECIES.length());
4917         int[] r = new int[a.length];
4918         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4919         int part = (new java.util.Random()).nextInt(2);
4920         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4921             for (int i = 0; i < a.length; i += SPECIES.length()) {
4922                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4923                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4924                 av.unslice(origin, bv, part).intoArray(r, i);
4925             }
4926         }
4927 
4928         assertArraysEquals(r, a, b, origin, part, Int64VectorTests::unsliceBinary);
4929     }
4930 
4931     static int[] unslice(int[] a, int[] b, int origin, int part, boolean[] mask, int idx) {
4932         int[] res = new int[SPECIES.length()];
4933         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4934             if(i+origin < SPECIES.length())
4935                 res[i] = b[idx+i+origin];
4936             else {
4937                 res[i] = b[idx+j];
4938                 j++;
4939             }
4940         }
4941         for (int i = 0; i < SPECIES.length(); i++){
4942             res[i] = mask[i] ? a[idx+i] : res[i];
4943         }
4944         int[] res1 = new int[SPECIES.length()];
4945         if (part == 0) {
4946             for (int i = 0, j = 0; i < SPECIES.length(); i++){
4947                 if (i < origin)
4948                     res1[i] = b[idx+i];
4949                 else {
4950                    res1[i] = res[j];

4968     static void unsliceInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
4969     IntFunction<boolean[]> fm) {
4970         int[] a = fa.apply(SPECIES.length());
4971         int[] b = fb.apply(SPECIES.length());
4972         boolean[] mask = fm.apply(SPECIES.length());
4973         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4974         int[] r = new int[a.length];
4975         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4976         int part = (new java.util.Random()).nextInt(2);
4977         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4978             for (int i = 0; i < a.length; i += SPECIES.length()) {
4979                 IntVector av = IntVector.fromArray(SPECIES, a, i);
4980                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
4981                 av.unslice(origin, bv, part, vmask).intoArray(r, i);
4982             }
4983         }
4984 
4985         assertArraysEquals(r, a, b, origin, part, mask, Int64VectorTests::unslice);
4986     }
4987 






















4988     static int BITWISE_BLEND(int a, int b, int c) {
4989         return (int)((a&~(c))|(b&c));
4990     }
4991 
4992     static int bitwiseBlend(int a, int b, int c) {
4993         return (int)((a&~(c))|(b&c));
4994     }
4995 

4996     @Test(dataProvider = "intTernaryOpProvider")
4997     static void BITWISE_BLENDInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
4998         int[] a = fa.apply(SPECIES.length());
4999         int[] b = fb.apply(SPECIES.length());
5000         int[] c = fc.apply(SPECIES.length());
5001         int[] r = fr.apply(SPECIES.length());
5002 
5003         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5004             for (int i = 0; i < a.length; i += SPECIES.length()) {
5005                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5006                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
5007                 IntVector cv = IntVector.fromArray(SPECIES, c, i);
5008                 av.lanewise(VectorOperators.BITWISE_BLEND, bv, cv).intoArray(r, i);
5009             }
5010         }
5011 
5012         assertArraysEquals(r, a, b, c, Int64VectorTests::BITWISE_BLEND);
5013     }
5014 
5015     @Test(dataProvider = "intTernaryOpProvider")
5016     static void bitwiseBlendInt64VectorTests(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5017         int[] a = fa.apply(SPECIES.length());
5018         int[] b = fb.apply(SPECIES.length());
5019         int[] c = fc.apply(SPECIES.length());
5020         int[] r = fr.apply(SPECIES.length());
5021 
5022         for (int i = 0; i < a.length; i += SPECIES.length()) {
5023             IntVector av = IntVector.fromArray(SPECIES, a, i);
5024             IntVector bv = IntVector.fromArray(SPECIES, b, i);
5025             IntVector cv = IntVector.fromArray(SPECIES, c, i);
5026             av.bitwiseBlend(bv, cv).intoArray(r, i);
5027         }
5028 
5029         assertArraysEquals(r, a, b, c, Int64VectorTests::bitwiseBlend);
5030     }
5031 

5032     @Test(dataProvider = "intTernaryOpMaskProvider")
5033     static void BITWISE_BLENDInt64VectorTestsMasked(IntFunction<int[]> fa, IntFunction<int[]> fb,
5034                                           IntFunction<int[]> fc, IntFunction<boolean[]> fm) {
5035         int[] a = fa.apply(SPECIES.length());
5036         int[] b = fb.apply(SPECIES.length());
5037         int[] c = fc.apply(SPECIES.length());
5038         int[] r = fr.apply(SPECIES.length());
5039         boolean[] mask = fm.apply(SPECIES.length());
5040         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5041 
5042         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5043             for (int i = 0; i < a.length; i += SPECIES.length()) {
5044                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5045                 IntVector bv = IntVector.fromArray(SPECIES, b, i);
5046                 IntVector cv = IntVector.fromArray(SPECIES, c, i);
5047                 av.lanewise(VectorOperators.BITWISE_BLEND, bv, cv, vmask).intoArray(r, i);
5048             }
5049         }
5050 
5051         assertArraysEquals(r, a, b, c, mask, Int64VectorTests::BITWISE_BLEND);
5052     }
5053 



5054     @Test(dataProvider = "intTernaryOpProvider")
5055     static void BITWISE_BLENDInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5056         int[] a = fa.apply(SPECIES.length());
5057         int[] b = fb.apply(SPECIES.length());
5058         int[] c = fc.apply(SPECIES.length());
5059         int[] r = fr.apply(SPECIES.length());
5060 
5061         for (int i = 0; i < a.length; i += SPECIES.length()) {
5062             IntVector av = IntVector.fromArray(SPECIES, a, i);
5063             IntVector bv = IntVector.fromArray(SPECIES, b, i);
5064             av.lanewise(VectorOperators.BITWISE_BLEND, bv, c[i]).intoArray(r, i);
5065         }
5066         assertBroadcastArraysEquals(r, a, b, c, Int64VectorTests::BITWISE_BLEND);
5067     }
5068 
5069     @Test(dataProvider = "intTernaryOpProvider")
5070     static void BITWISE_BLENDInt64VectorTestsAltBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5071         int[] a = fa.apply(SPECIES.length());
5072         int[] b = fb.apply(SPECIES.length());
5073         int[] c = fc.apply(SPECIES.length());
5074         int[] r = fr.apply(SPECIES.length());
5075 
5076         for (int i = 0; i < a.length; i += SPECIES.length()) {
5077             IntVector av = IntVector.fromArray(SPECIES, a, i);
5078             IntVector cv = IntVector.fromArray(SPECIES, c, i);
5079             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], cv).intoArray(r, i);
5080         }
5081         assertAltBroadcastArraysEquals(r, a, b, c, Int64VectorTests::BITWISE_BLEND);
5082     }
5083 
5084     @Test(dataProvider = "intTernaryOpProvider")
5085     static void bitwiseBlendInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5086         int[] a = fa.apply(SPECIES.length());
5087         int[] b = fb.apply(SPECIES.length());
5088         int[] c = fc.apply(SPECIES.length());
5089         int[] r = fr.apply(SPECIES.length());
5090 
5091         for (int i = 0; i < a.length; i += SPECIES.length()) {
5092             IntVector av = IntVector.fromArray(SPECIES, a, i);
5093             IntVector bv = IntVector.fromArray(SPECIES, b, i);
5094             av.bitwiseBlend(bv, c[i]).intoArray(r, i);
5095         }
5096         assertBroadcastArraysEquals(r, a, b, c, Int64VectorTests::bitwiseBlend);
5097     }
5098 
5099     @Test(dataProvider = "intTernaryOpProvider")
5100     static void bitwiseBlendInt64VectorTestsAltBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5101         int[] a = fa.apply(SPECIES.length());
5102         int[] b = fb.apply(SPECIES.length());
5103         int[] c = fc.apply(SPECIES.length());
5104         int[] r = fr.apply(SPECIES.length());
5105 
5106         for (int i = 0; i < a.length; i += SPECIES.length()) {
5107             IntVector av = IntVector.fromArray(SPECIES, a, i);
5108             IntVector cv = IntVector.fromArray(SPECIES, c, i);
5109             av.bitwiseBlend(b[i], cv).intoArray(r, i);
5110         }
5111         assertAltBroadcastArraysEquals(r, a, b, c, Int64VectorTests::bitwiseBlend);
5112     }
5113 

5114     @Test(dataProvider = "intTernaryOpMaskProvider")
5115     static void BITWISE_BLENDInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
5116                                           IntFunction<int[]> fc, IntFunction<boolean[]> fm) {
5117         int[] a = fa.apply(SPECIES.length());
5118         int[] b = fb.apply(SPECIES.length());
5119         int[] c = fc.apply(SPECIES.length());
5120         int[] r = fr.apply(SPECIES.length());
5121         boolean[] mask = fm.apply(SPECIES.length());
5122         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5123 
5124         for (int i = 0; i < a.length; i += SPECIES.length()) {
5125             IntVector av = IntVector.fromArray(SPECIES, a, i);
5126             IntVector bv = IntVector.fromArray(SPECIES, b, i);
5127             av.lanewise(VectorOperators.BITWISE_BLEND, bv, c[i], vmask).intoArray(r, i);
5128         }
5129 
5130         assertBroadcastArraysEquals(r, a, b, c, mask, Int64VectorTests::BITWISE_BLEND);
5131     }
5132 
5133     @Test(dataProvider = "intTernaryOpMaskProvider")
5134     static void BITWISE_BLENDInt64VectorTestsAltBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
5135                                           IntFunction<int[]> fc, IntFunction<boolean[]> fm) {
5136         int[] a = fa.apply(SPECIES.length());
5137         int[] b = fb.apply(SPECIES.length());
5138         int[] c = fc.apply(SPECIES.length());
5139         int[] r = fr.apply(SPECIES.length());
5140         boolean[] mask = fm.apply(SPECIES.length());
5141         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5142 
5143         for (int i = 0; i < a.length; i += SPECIES.length()) {
5144             IntVector av = IntVector.fromArray(SPECIES, a, i);
5145             IntVector cv = IntVector.fromArray(SPECIES, c, i);
5146             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], cv, vmask).intoArray(r, i);
5147         }
5148 
5149         assertAltBroadcastArraysEquals(r, a, b, c, mask, Int64VectorTests::BITWISE_BLEND);
5150     }
5151 



5152     @Test(dataProvider = "intTernaryOpProvider")
5153     static void BITWISE_BLENDInt64VectorTestsDoubleBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5154         int[] a = fa.apply(SPECIES.length());
5155         int[] b = fb.apply(SPECIES.length());
5156         int[] c = fc.apply(SPECIES.length());
5157         int[] r = fr.apply(SPECIES.length());
5158 
5159         for (int i = 0; i < a.length; i += SPECIES.length()) {
5160             IntVector av = IntVector.fromArray(SPECIES, a, i);
5161             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], c[i]).intoArray(r, i);
5162         }
5163 
5164         assertDoubleBroadcastArraysEquals(r, a, b, c, Int64VectorTests::BITWISE_BLEND);
5165     }
5166 
5167     @Test(dataProvider = "intTernaryOpProvider")
5168     static void bitwiseBlendInt64VectorTestsDoubleBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb, IntFunction<int[]> fc) {
5169         int[] a = fa.apply(SPECIES.length());
5170         int[] b = fb.apply(SPECIES.length());
5171         int[] c = fc.apply(SPECIES.length());
5172         int[] r = fr.apply(SPECIES.length());
5173 
5174         for (int i = 0; i < a.length; i += SPECIES.length()) {
5175             IntVector av = IntVector.fromArray(SPECIES, a, i);
5176             av.bitwiseBlend(b[i], c[i]).intoArray(r, i);
5177         }
5178 
5179         assertDoubleBroadcastArraysEquals(r, a, b, c, Int64VectorTests::bitwiseBlend);
5180     }
5181 

5182     @Test(dataProvider = "intTernaryOpMaskProvider")
5183     static void BITWISE_BLENDInt64VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb,
5184                                           IntFunction<int[]> fc, IntFunction<boolean[]> fm) {
5185         int[] a = fa.apply(SPECIES.length());
5186         int[] b = fb.apply(SPECIES.length());
5187         int[] c = fc.apply(SPECIES.length());
5188         int[] r = fr.apply(SPECIES.length());
5189         boolean[] mask = fm.apply(SPECIES.length());
5190         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5191 
5192         for (int i = 0; i < a.length; i += SPECIES.length()) {
5193             IntVector av = IntVector.fromArray(SPECIES, a, i);
5194             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], c[i], vmask).intoArray(r, i);
5195         }
5196 
5197         assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Int64VectorTests::BITWISE_BLEND);
5198     }
5199 

5200     static int NEG(int a) {
5201         return (int)(-((int)a));
5202     }
5203 
5204     static int neg(int a) {
5205         return (int)(-((int)a));
5206     }
5207 
5208     @Test(dataProvider = "intUnaryOpProvider")
5209     static void NEGInt64VectorTests(IntFunction<int[]> fa) {
5210         int[] a = fa.apply(SPECIES.length());
5211         int[] r = fr.apply(SPECIES.length());
5212 
5213         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5214             for (int i = 0; i < a.length; i += SPECIES.length()) {
5215                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5216                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
5217             }
5218         }
5219 

5292     }
5293 
5294     @Test(dataProvider = "intUnaryOpMaskProvider")
5295     static void ABSMaskedInt64VectorTests(IntFunction<int[]> fa,
5296                                                 IntFunction<boolean[]> fm) {
5297         int[] a = fa.apply(SPECIES.length());
5298         int[] r = fr.apply(SPECIES.length());
5299         boolean[] mask = fm.apply(SPECIES.length());
5300         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5301 
5302         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5303             for (int i = 0; i < a.length; i += SPECIES.length()) {
5304                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5305                 av.lanewise(VectorOperators.ABS, vmask).intoArray(r, i);
5306             }
5307         }
5308 
5309         assertArraysEquals(r, a, mask, Int64VectorTests::ABS);
5310     }
5311 

5312     static int NOT(int a) {
5313         return (int)(~((int)a));
5314     }
5315 
5316     static int not(int a) {
5317         return (int)(~((int)a));
5318     }
5319 


5320     @Test(dataProvider = "intUnaryOpProvider")
5321     static void NOTInt64VectorTests(IntFunction<int[]> fa) {
5322         int[] a = fa.apply(SPECIES.length());
5323         int[] r = fr.apply(SPECIES.length());
5324 
5325         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5326             for (int i = 0; i < a.length; i += SPECIES.length()) {
5327                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5328                 av.lanewise(VectorOperators.NOT).intoArray(r, i);
5329             }
5330         }
5331 
5332         assertArraysEquals(r, a, Int64VectorTests::NOT);
5333     }
5334 
5335     @Test(dataProvider = "intUnaryOpProvider")
5336     static void notInt64VectorTests(IntFunction<int[]> fa) {
5337         int[] a = fa.apply(SPECIES.length());
5338         int[] r = fr.apply(SPECIES.length());
5339 
5340         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5341             for (int i = 0; i < a.length; i += SPECIES.length()) {
5342                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5343                 av.not().intoArray(r, i);
5344             }
5345         }
5346 
5347         assertArraysEquals(r, a, Int64VectorTests::not);
5348     }
5349 


5350     @Test(dataProvider = "intUnaryOpMaskProvider")
5351     static void NOTMaskedInt64VectorTests(IntFunction<int[]> fa,
5352                                                 IntFunction<boolean[]> fm) {
5353         int[] a = fa.apply(SPECIES.length());
5354         int[] r = fr.apply(SPECIES.length());
5355         boolean[] mask = fm.apply(SPECIES.length());
5356         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5357 
5358         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5359             for (int i = 0; i < a.length; i += SPECIES.length()) {
5360                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5361                 av.lanewise(VectorOperators.NOT, vmask).intoArray(r, i);
5362             }
5363         }
5364 
5365         assertArraysEquals(r, a, mask, Int64VectorTests::NOT);
5366     }
5367 


5368     static int ZOMO(int a) {
5369         return (int)((a==0?0:-1));
5370     }
5371 


5372     @Test(dataProvider = "intUnaryOpProvider")
5373     static void ZOMOInt64VectorTests(IntFunction<int[]> fa) {
5374         int[] a = fa.apply(SPECIES.length());
5375         int[] r = fr.apply(SPECIES.length());
5376 
5377         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5378             for (int i = 0; i < a.length; i += SPECIES.length()) {
5379                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5380                 av.lanewise(VectorOperators.ZOMO).intoArray(r, i);
5381             }
5382         }
5383 
5384         assertArraysEquals(r, a, Int64VectorTests::ZOMO);
5385     }
5386 


5387     @Test(dataProvider = "intUnaryOpMaskProvider")
5388     static void ZOMOMaskedInt64VectorTests(IntFunction<int[]> fa,
5389                                                 IntFunction<boolean[]> fm) {
5390         int[] a = fa.apply(SPECIES.length());
5391         int[] r = fr.apply(SPECIES.length());
5392         boolean[] mask = fm.apply(SPECIES.length());
5393         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5394 
5395         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5396             for (int i = 0; i < a.length; i += SPECIES.length()) {
5397                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5398                 av.lanewise(VectorOperators.ZOMO, vmask).intoArray(r, i);
5399             }
5400         }
5401 
5402         assertArraysEquals(r, a, mask, Int64VectorTests::ZOMO);
5403     }
5404 
5405     static int BIT_COUNT(int a) {
5406         return (int)(Integer.bitCount(a));
5407     }
5408 
5409     @Test(dataProvider = "intUnaryOpProvider")
5410     static void BIT_COUNTInt64VectorTests(IntFunction<int[]> fa) {
5411         int[] a = fa.apply(SPECIES.length());
5412         int[] r = fr.apply(SPECIES.length());
5413 
5414         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5415             for (int i = 0; i < a.length; i += SPECIES.length()) {
5416                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5417                 av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
5418             }
5419         }
5420 
5421         assertArraysEquals(r, a, Int64VectorTests::BIT_COUNT);
5422     }
5423 
5424     @Test(dataProvider = "intUnaryOpMaskProvider")
5425     static void BIT_COUNTMaskedInt64VectorTests(IntFunction<int[]> fa,
5426                                                 IntFunction<boolean[]> fm) {
5427         int[] a = fa.apply(SPECIES.length());
5428         int[] r = fr.apply(SPECIES.length());
5429         boolean[] mask = fm.apply(SPECIES.length());
5430         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5431 
5432         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5433             for (int i = 0; i < a.length; i += SPECIES.length()) {
5434                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5435                 av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
5436             }
5437         }
5438 
5439         assertArraysEquals(r, a, mask, Int64VectorTests::BIT_COUNT);
5440     }
5441 
5442     static int TRAILING_ZEROS_COUNT(int a) {
5443         return (int)(TRAILING_ZEROS_COUNT_scalar(a));
5444     }
5445 
5446     @Test(dataProvider = "intUnaryOpProvider")
5447     static void TRAILING_ZEROS_COUNTInt64VectorTests(IntFunction<int[]> fa) {
5448         int[] a = fa.apply(SPECIES.length());
5449         int[] r = fr.apply(SPECIES.length());
5450 
5451         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5452             for (int i = 0; i < a.length; i += SPECIES.length()) {
5453                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5454                 av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
5455             }
5456         }
5457 
5458         assertArraysEquals(r, a, Int64VectorTests::TRAILING_ZEROS_COUNT);
5459     }
5460 
5461     @Test(dataProvider = "intUnaryOpMaskProvider")
5462     static void TRAILING_ZEROS_COUNTMaskedInt64VectorTests(IntFunction<int[]> fa,
5463                                                 IntFunction<boolean[]> fm) {
5464         int[] a = fa.apply(SPECIES.length());
5465         int[] r = fr.apply(SPECIES.length());
5466         boolean[] mask = fm.apply(SPECIES.length());
5467         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5468 
5469         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5470             for (int i = 0; i < a.length; i += SPECIES.length()) {
5471                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5472                 av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
5473             }
5474         }
5475 
5476         assertArraysEquals(r, a, mask, Int64VectorTests::TRAILING_ZEROS_COUNT);
5477     }
5478 
5479     static int LEADING_ZEROS_COUNT(int a) {
5480         return (int)(LEADING_ZEROS_COUNT_scalar(a));
5481     }
5482 
5483     @Test(dataProvider = "intUnaryOpProvider")
5484     static void LEADING_ZEROS_COUNTInt64VectorTests(IntFunction<int[]> fa) {
5485         int[] a = fa.apply(SPECIES.length());
5486         int[] r = fr.apply(SPECIES.length());
5487 
5488         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5489             for (int i = 0; i < a.length; i += SPECIES.length()) {
5490                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5491                 av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
5492             }
5493         }
5494 
5495         assertArraysEquals(r, a, Int64VectorTests::LEADING_ZEROS_COUNT);
5496     }
5497 
5498     @Test(dataProvider = "intUnaryOpMaskProvider")
5499     static void LEADING_ZEROS_COUNTMaskedInt64VectorTests(IntFunction<int[]> fa,
5500                                                 IntFunction<boolean[]> fm) {
5501         int[] a = fa.apply(SPECIES.length());
5502         int[] r = fr.apply(SPECIES.length());
5503         boolean[] mask = fm.apply(SPECIES.length());
5504         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5505 
5506         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5507             for (int i = 0; i < a.length; i += SPECIES.length()) {
5508                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5509                 av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
5510             }
5511         }
5512 
5513         assertArraysEquals(r, a, mask, Int64VectorTests::LEADING_ZEROS_COUNT);
5514     }
5515 
5516     static int REVERSE(int a) {
5517         return (int)(REVERSE_scalar(a));
5518     }
5519 
5520     @Test(dataProvider = "intUnaryOpProvider")
5521     static void REVERSEInt64VectorTests(IntFunction<int[]> fa) {
5522         int[] a = fa.apply(SPECIES.length());
5523         int[] r = fr.apply(SPECIES.length());
5524 
5525         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5526             for (int i = 0; i < a.length; i += SPECIES.length()) {
5527                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5528                 av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
5529             }
5530         }
5531 
5532         assertArraysEquals(r, a, Int64VectorTests::REVERSE);
5533     }
5534 
5535     @Test(dataProvider = "intUnaryOpMaskProvider")
5536     static void REVERSEMaskedInt64VectorTests(IntFunction<int[]> fa,
5537                                                 IntFunction<boolean[]> fm) {
5538         int[] a = fa.apply(SPECIES.length());
5539         int[] r = fr.apply(SPECIES.length());
5540         boolean[] mask = fm.apply(SPECIES.length());
5541         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5542 
5543         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5544             for (int i = 0; i < a.length; i += SPECIES.length()) {
5545                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5546                 av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
5547             }
5548         }
5549 
5550         assertArraysEquals(r, a, mask, Int64VectorTests::REVERSE);
5551     }
5552 
5553     static int REVERSE_BYTES(int a) {
5554         return (int)(Integer.reverseBytes(a));
5555     }
5556 
5557     @Test(dataProvider = "intUnaryOpProvider")
5558     static void REVERSE_BYTESInt64VectorTests(IntFunction<int[]> fa) {
5559         int[] a = fa.apply(SPECIES.length());
5560         int[] r = fr.apply(SPECIES.length());
5561 
5562         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5563             for (int i = 0; i < a.length; i += SPECIES.length()) {
5564                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5565                 av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
5566             }
5567         }
5568 
5569         assertArraysEquals(r, a, Int64VectorTests::REVERSE_BYTES);
5570     }
5571 
5572     @Test(dataProvider = "intUnaryOpMaskProvider")
5573     static void REVERSE_BYTESMaskedInt64VectorTests(IntFunction<int[]> fa,
5574                                                 IntFunction<boolean[]> fm) {
5575         int[] a = fa.apply(SPECIES.length());
5576         int[] r = fr.apply(SPECIES.length());
5577         boolean[] mask = fm.apply(SPECIES.length());
5578         VectorMask<Integer> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5579 
5580         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5581             for (int i = 0; i < a.length; i += SPECIES.length()) {
5582                 IntVector av = IntVector.fromArray(SPECIES, a, i);
5583                 av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
5584             }
5585         }
5586 
5587         assertArraysEquals(r, a, mask, Int64VectorTests::REVERSE_BYTES);
5588     }
5589 
5590     @Test(dataProvider = "intCompareOpProvider")
5591     static void ltInt64VectorTestsBroadcastSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
5592         int[] a = fa.apply(SPECIES.length());
5593         int[] b = fb.apply(SPECIES.length());
5594 
5595         for (int i = 0; i < a.length; i += SPECIES.length()) {
5596             IntVector av = IntVector.fromArray(SPECIES, a, i);
5597             VectorMask<Integer> mv = av.lt(b[i]);
5598 
5599             // Check results as part of computation.
5600             for (int j = 0; j < SPECIES.length(); j++) {
5601                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
5602             }
5603         }
5604     }
5605 
5606     @Test(dataProvider = "intCompareOpProvider")
5607     static void eqInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction<int[]> fa, IntFunction<int[]> fb) {
5608         int[] a = fa.apply(SPECIES.length());

5971             }
5972         }
5973         return i - idx;
5974     }
5975 
5976     @Test(dataProvider = "maskProvider")
5977     static void maskFirstTrueInt64VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
5978         boolean[] a = fa.apply(SPECIES.length());
5979         int[] r = new int[a.length];
5980 
5981         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
5982             for (int i = 0; i < a.length; i += SPECIES.length()) {
5983                 var vmask = SPECIES.loadMask(a, i);
5984                 r[i] = vmask.firstTrue();
5985             }
5986         }
5987 
5988         assertMaskReductionArraysEquals(r, a, Int64VectorTests::maskFirstTrue);
5989     }
5990 
5991     @Test(dataProvider = "maskProvider")
5992     static void maskCompressInt64VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
5993         int trueCount = 0;
5994         boolean[] a = fa.apply(SPECIES.length());
5995 
5996         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
5997             for (int i = 0; i < a.length; i += SPECIES.length()) {
5998                 var vmask = SPECIES.loadMask(a, i);
5999                 trueCount = vmask.trueCount();
6000                 var rmask = vmask.compress();
6001                 for (int j = 0; j < SPECIES.length(); j++)  {
6002                     Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
6003                 }
6004             }
6005         }
6006     }
6007 
6008     @DataProvider
6009     public static Object[][] longMaskProvider() {
6010         return new Object[][]{
6011                 {0xFFFFFFFFFFFFFFFFL},
6012                 {0x0000000000000000L},
6013                 {0x5555555555555555L},
6014                 {0x0123456789abcdefL},
6015         };
6016     }
6017 
6018     @Test(dataProvider = "longMaskProvider")
6019     static void maskFromToLongInt64VectorTestsSmokeTest(long inputLong) {
6020         var vmask = VectorMask.fromLong(SPECIES, inputLong);
6021         long outputLong = vmask.toLong();
6022         Assert.assertEquals(outputLong, (inputLong & (((0xFFFFFFFFFFFFFFFFL >>> (64 - SPECIES.length()))))));
6023     }
6024 
6025     @DataProvider
6026     public static Object[][] offsetProvider() {
6027         return new Object[][]{

6030                 {+1},
6031                 {+2},
6032                 {-2},
6033         };
6034     }
6035 
6036     @Test(dataProvider = "offsetProvider")
6037     static void indexInRangeInt64VectorTestsSmokeTest(int offset) {
6038         int limit = SPECIES.length() * BUFFER_REPS;
6039         for (int i = 0; i < limit; i += SPECIES.length()) {
6040             var actualMask = SPECIES.indexInRange(i + offset, limit);
6041             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
6042             assert(actualMask.equals(expectedMask));
6043             for (int j = 0; j < SPECIES.length(); j++)  {
6044                 int index = i + j + offset;
6045                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
6046             }
6047         }
6048     }
6049 
6050     @Test(dataProvider = "offsetProvider")
6051     static void indexInRangeLongInt64VectorTestsSmokeTest(int offset) {
6052         long limit = SPECIES.length() * BUFFER_REPS;
6053         for (long i = 0; i < limit; i += SPECIES.length()) {
6054             var actualMask = SPECIES.indexInRange(i + offset, limit);
6055             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
6056             assert(actualMask.equals(expectedMask));
6057             for (int j = 0; j < SPECIES.length(); j++)  {
6058                 long index = i + j + offset;
6059                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
6060             }
6061         }
6062     }
6063 
6064     @DataProvider
6065     public static Object[][] lengthProvider() {
6066         return new Object[][]{
6067                 {0},
6068                 {1},
6069                 {32},
6070                 {37},
6071                 {1024},
6072                 {1024+1},
6073                 {1024+5},
6074         };
6075     }
6076 
6077     @Test(dataProvider = "lengthProvider")
6078     static void loopBoundInt64VectorTestsSmokeTest(int length) {
6079         int actualLoopBound = SPECIES.loopBound(length);
6080         int expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
6081         Assert.assertEquals(actualLoopBound, expectedLoopBound);
6082     }
6083 
6084     @Test(dataProvider = "lengthProvider")
6085     static void loopBoundLongInt64VectorTestsSmokeTest(int _length) {
6086         long length = _length;
6087         long actualLoopBound = SPECIES.loopBound(length);
6088         long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
6089         Assert.assertEquals(actualLoopBound, expectedLoopBound);
6090     }
6091 
6092     @Test
6093     static void ElementSizeInt64VectorTestsSmokeTest() {
6094         IntVector av = IntVector.zero(SPECIES);
6095         int elsize = av.elementSize();
6096         Assert.assertEquals(elsize, Integer.SIZE);
6097     }
6098 
6099     @Test
6100     static void VectorShapeInt64VectorTestsSmokeTest() {
6101         IntVector av = IntVector.zero(SPECIES);
6102         VectorShape vsh = av.shape();
6103         assert(vsh.equals(VectorShape.S_64_BIT));
6104     }
6105 
6106     @Test
6107     static void ShapeWithLanesInt64VectorTestsSmokeTest() {
6108         IntVector av = IntVector.zero(SPECIES);
6109         VectorShape vsh = av.shape();
6110         VectorSpecies species = vsh.withLanes(int.class);
6111         assert(species.equals(SPECIES));

6134         IntVector av = IntVector.zero(SPECIES);
6135         VectorSpecies species = av.species().withLanes(int.class);
6136         assert(species.equals(SPECIES));
6137     }
6138 
6139     @Test
6140     static void WithShapeInt64VectorTestsSmokeTest() {
6141         IntVector av = IntVector.zero(SPECIES);
6142         VectorShape vsh = av.shape();
6143         VectorSpecies species = av.species().withShape(vsh);
6144         assert(species.equals(SPECIES));
6145     }
6146 
6147     @Test
6148     static void MaskAllTrueInt64VectorTestsSmokeTest() {
6149         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6150           Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length()));
6151         }
6152     }
6153 }

< prev index next >