< prev index next >

test/jdk/jdk/incubator/vector/LongMaxVectorTests.java

Print this page

 206             } else {
 207                 Assert.assertEquals(r[i], a[i], "at index #" + i);
 208             }
 209         }
 210     }
 211 
 212     static void assertRearrangeArraysEquals(long[] r, long[] a, int[] order, int vector_len) {
 213         int i = 0, j = 0;
 214         try {
 215             for (; i < a.length; i += vector_len) {
 216                 for (j = 0; j < vector_len; j++) {
 217                     Assert.assertEquals(r[i+j], a[i+order[i+j]]);
 218                 }
 219             }
 220         } catch (AssertionError e) {
 221             int idx = i + j;
 222             Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]);
 223         }
 224     }
 225 

















































 226     static void assertSelectFromArraysEquals(long[] r, long[] a, long[] order, int vector_len) {
 227         int i = 0, j = 0;
 228         try {
 229             for (; i < a.length; i += vector_len) {
 230                 for (j = 0; j < vector_len; j++) {
 231                     Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]);
 232                 }
 233             }
 234         } catch (AssertionError e) {
 235             int idx = i + j;
 236             Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]);
 237         }
 238     }
 239 
 240     static void assertRearrangeArraysEquals(long[] r, long[] a, int[] order, boolean[] mask, int vector_len) {
 241         int i = 0, j = 0;
 242         try {
 243             for (; i < a.length; i += vector_len) {
 244                 for (j = 0; j < vector_len; j++) {
 245                     if (mask[j % SPECIES.length()])

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

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

1040 
1041     @DataProvider
1042     public Object[][] longUnaryOpSelectFromProvider() {
1043         return LONG_SHUFFLE_GENERATORS.stream().
1044                 flatMap(fs -> LONG_GENERATORS.stream().map(fa -> {
1045                     return new Object[] {fa, fs};
1046                 })).
1047                 toArray(Object[][]::new);
1048     }
1049 
1050     @DataProvider
1051     public Object[][] longUnaryOpSelectFromMaskProvider() {
1052         return BOOLEAN_MASK_GENERATORS.stream().
1053                 flatMap(fm -> LONG_SHUFFLE_GENERATORS.stream().
1054                     flatMap(fs -> LONG_GENERATORS.stream().map(fa -> {
1055                         return new Object[] {fa, fs, fm};
1056                 }))).
1057                 toArray(Object[][]::new);
1058     }
1059 
1060 
1061     static final List<IntFunction<long[]>> LONG_COMPARE_GENERATORS = List.of(
1062             withToString("long[i]", (int s) -> {
1063                 return fill(s * BUFFER_REPS,
1064                             i -> (long)i);
1065             }),
1066             withToString("long[i - length / 2]", (int s) -> {
1067                 return fill(s * BUFFER_REPS,
1068                             i -> (long)(i - (s * BUFFER_REPS / 2)));
1069             }),
1070             withToString("long[i + 1]", (int s) -> {
1071                 return fill(s * BUFFER_REPS,
1072                             i -> (long)(i + 1));
1073             }),
1074             withToString("long[i - 2]", (int s) -> {
1075                 return fill(s * BUFFER_REPS,
1076                             i -> (long)(i - 2));
1077             }),
1078             withToString("long[zigZag(i)]", (int s) -> {
1079                 return fill(s * BUFFER_REPS,
1080                             i -> i%3 == 0 ? (long)i : (i%3 == 1 ? (long)(i + 1) : (long)(i - 2)));

1152                 return Long.MAX_VALUE;
1153             default:
1154                 return (long)0;
1155         }
1156     }
1157 
1158     static long get(long[] a, int i) {
1159         return (long) a[i];
1160     }
1161 
1162     static final IntFunction<long[]> fr = (vl) -> {
1163         int length = BUFFER_REPS * vl;
1164         return new long[length];
1165     };
1166 
1167     static final IntFunction<boolean[]> fmr = (vl) -> {
1168         int length = BUFFER_REPS * vl;
1169         return new boolean[length];
1170     };
1171 
1172 
1173     static void replaceZero(long[] a, long v) {
1174         for (int i = 0; i < a.length; i++) {
1175             if (a[i] == 0) {
1176                 a[i] = v;
1177             }
1178         }
1179     }
1180 
1181     static void replaceZero(long[] a, boolean[] mask, long v) {
1182         for (int i = 0; i < a.length; i++) {
1183             if (mask[i % mask.length] && a[i] == 0) {
1184                 a[i] = v;
1185             }
1186         }
1187     }
1188 
1189     static long ROL_scalar(long a, long b) {
1190         return Long.rotateLeft(a, ((int)b));
1191     }
1192 
1193     static long ROR_scalar(long a, long b) {
1194         return Long.rotateRight(a, ((int)b));
1195     }
1196 












1197     static boolean eq(long a, long b) {
1198         return a == b;
1199     }
1200 
1201     static boolean neq(long a, long b) {
1202         return a != b;
1203     }
1204 
1205     static boolean lt(long a, long b) {
1206         return a < b;
1207     }
1208 
1209     static boolean le(long a, long b) {
1210         return a <= b;
1211     }
1212 
1213     static boolean gt(long a, long b) {
1214         return a > b;
1215     }
1216 

1331     @Test
1332     // Test div by 0.
1333     static void bitwiseDivByZeroSmokeTest() {
1334         try {
1335             LongVector a = (LongVector) SPECIES.broadcast(0).addIndex(1);
1336             LongVector b = (LongVector) SPECIES.broadcast(0);
1337             a.div(b);
1338             Assert.fail();
1339         } catch (ArithmeticException e) {
1340         }
1341 
1342         try {
1343             LongVector a = (LongVector) SPECIES.broadcast(0).addIndex(1);
1344             LongVector b = (LongVector) SPECIES.broadcast(0);
1345             VectorMask<Long> m = a.lt((long) 1);
1346             a.div(b, m);
1347             Assert.fail();
1348         } catch (ArithmeticException e) {
1349         }
1350     }

1351     static long ADD(long a, long b) {
1352         return (long)(a + b);
1353     }
1354 
1355     @Test(dataProvider = "longBinaryOpProvider")
1356     static void ADDLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1357         long[] a = fa.apply(SPECIES.length());
1358         long[] b = fb.apply(SPECIES.length());
1359         long[] r = fr.apply(SPECIES.length());
1360 
1361         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1362             for (int i = 0; i < a.length; i += SPECIES.length()) {
1363                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1364                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1365                 av.lanewise(VectorOperators.ADD, bv).intoArray(r, i);
1366             }
1367         }
1368 
1369         assertArraysEquals(r, a, b, LongMaxVectorTests::ADD);
1370     }

1371     static long add(long a, long b) {
1372         return (long)(a + b);
1373     }
1374 
1375     @Test(dataProvider = "longBinaryOpProvider")
1376     static void addLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1377         long[] a = fa.apply(SPECIES.length());
1378         long[] b = fb.apply(SPECIES.length());
1379         long[] r = fr.apply(SPECIES.length());
1380 
1381         for (int i = 0; i < a.length; i += SPECIES.length()) {
1382             LongVector av = LongVector.fromArray(SPECIES, a, i);
1383             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1384             av.add(bv).intoArray(r, i);
1385         }
1386 
1387         assertArraysEquals(r, a, b, LongMaxVectorTests::add);
1388     }
1389 
1390     @Test(dataProvider = "longBinaryOpMaskProvider")

1407         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::ADD);
1408     }
1409 
1410     @Test(dataProvider = "longBinaryOpMaskProvider")
1411     static void addLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1412                                           IntFunction<boolean[]> fm) {
1413         long[] a = fa.apply(SPECIES.length());
1414         long[] b = fb.apply(SPECIES.length());
1415         long[] r = fr.apply(SPECIES.length());
1416         boolean[] mask = fm.apply(SPECIES.length());
1417         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1418 
1419         for (int i = 0; i < a.length; i += SPECIES.length()) {
1420             LongVector av = LongVector.fromArray(SPECIES, a, i);
1421             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1422             av.add(bv, vmask).intoArray(r, i);
1423         }
1424 
1425         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::add);
1426     }

1427     static long SUB(long a, long b) {
1428         return (long)(a - b);
1429     }
1430 
1431     @Test(dataProvider = "longBinaryOpProvider")
1432     static void SUBLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1433         long[] a = fa.apply(SPECIES.length());
1434         long[] b = fb.apply(SPECIES.length());
1435         long[] r = fr.apply(SPECIES.length());
1436 
1437         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1438             for (int i = 0; i < a.length; i += SPECIES.length()) {
1439                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1440                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1441                 av.lanewise(VectorOperators.SUB, bv).intoArray(r, i);
1442             }
1443         }
1444 
1445         assertArraysEquals(r, a, b, LongMaxVectorTests::SUB);
1446     }

1447     static long sub(long a, long b) {
1448         return (long)(a - b);
1449     }
1450 
1451     @Test(dataProvider = "longBinaryOpProvider")
1452     static void subLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1453         long[] a = fa.apply(SPECIES.length());
1454         long[] b = fb.apply(SPECIES.length());
1455         long[] r = fr.apply(SPECIES.length());
1456 
1457         for (int i = 0; i < a.length; i += SPECIES.length()) {
1458             LongVector av = LongVector.fromArray(SPECIES, a, i);
1459             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1460             av.sub(bv).intoArray(r, i);
1461         }
1462 
1463         assertArraysEquals(r, a, b, LongMaxVectorTests::sub);
1464     }
1465 
1466     @Test(dataProvider = "longBinaryOpMaskProvider")

1483         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::SUB);
1484     }
1485 
1486     @Test(dataProvider = "longBinaryOpMaskProvider")
1487     static void subLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1488                                           IntFunction<boolean[]> fm) {
1489         long[] a = fa.apply(SPECIES.length());
1490         long[] b = fb.apply(SPECIES.length());
1491         long[] r = fr.apply(SPECIES.length());
1492         boolean[] mask = fm.apply(SPECIES.length());
1493         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1494 
1495         for (int i = 0; i < a.length; i += SPECIES.length()) {
1496             LongVector av = LongVector.fromArray(SPECIES, a, i);
1497             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1498             av.sub(bv, vmask).intoArray(r, i);
1499         }
1500 
1501         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::sub);
1502     }

1503     static long MUL(long a, long b) {
1504         return (long)(a * b);
1505     }
1506 
1507     @Test(dataProvider = "longBinaryOpProvider")
1508     static void MULLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1509         long[] a = fa.apply(SPECIES.length());
1510         long[] b = fb.apply(SPECIES.length());
1511         long[] r = fr.apply(SPECIES.length());
1512 
1513         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1514             for (int i = 0; i < a.length; i += SPECIES.length()) {
1515                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1516                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1517                 av.lanewise(VectorOperators.MUL, bv).intoArray(r, i);
1518             }
1519         }
1520 
1521         assertArraysEquals(r, a, b, LongMaxVectorTests::MUL);
1522     }

1523     static long mul(long a, long b) {
1524         return (long)(a * b);
1525     }
1526 
1527     @Test(dataProvider = "longBinaryOpProvider")
1528     static void mulLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1529         long[] a = fa.apply(SPECIES.length());
1530         long[] b = fb.apply(SPECIES.length());
1531         long[] r = fr.apply(SPECIES.length());
1532 
1533         for (int i = 0; i < a.length; i += SPECIES.length()) {
1534             LongVector av = LongVector.fromArray(SPECIES, a, i);
1535             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1536             av.mul(bv).intoArray(r, i);
1537         }
1538 
1539         assertArraysEquals(r, a, b, LongMaxVectorTests::mul);
1540     }
1541 
1542     @Test(dataProvider = "longBinaryOpMaskProvider")

1560     }
1561 
1562     @Test(dataProvider = "longBinaryOpMaskProvider")
1563     static void mulLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1564                                           IntFunction<boolean[]> fm) {
1565         long[] a = fa.apply(SPECIES.length());
1566         long[] b = fb.apply(SPECIES.length());
1567         long[] r = fr.apply(SPECIES.length());
1568         boolean[] mask = fm.apply(SPECIES.length());
1569         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1570 
1571         for (int i = 0; i < a.length; i += SPECIES.length()) {
1572             LongVector av = LongVector.fromArray(SPECIES, a, i);
1573             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1574             av.mul(bv, vmask).intoArray(r, i);
1575         }
1576 
1577         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::mul);
1578     }
1579 
1580 
1581 
1582     static long DIV(long a, long b) {
1583         return (long)(a / b);
1584     }
1585 
1586     @Test(dataProvider = "longBinaryOpProvider")
1587     static void DIVLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1588         long[] a = fa.apply(SPECIES.length());
1589         long[] b = fb.apply(SPECIES.length());
1590         long[] r = fr.apply(SPECIES.length());
1591 
1592         replaceZero(b, (long) 1);
1593 
1594         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1595             for (int i = 0; i < a.length; i += SPECIES.length()) {
1596                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1597                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1598                 av.lanewise(VectorOperators.DIV, bv).intoArray(r, i);
1599             }
1600         }
1601 
1602         assertArraysEquals(r, a, b, LongMaxVectorTests::DIV);
1603     }

1604     static long div(long a, long b) {
1605         return (long)(a / b);
1606     }
1607 
1608     @Test(dataProvider = "longBinaryOpProvider")
1609     static void divLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1610         long[] a = fa.apply(SPECIES.length());
1611         long[] b = fb.apply(SPECIES.length());
1612         long[] r = fr.apply(SPECIES.length());
1613 
1614         replaceZero(b, (long) 1);
1615 
1616         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1617             for (int i = 0; i < a.length; i += SPECIES.length()) {
1618                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1619                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1620                 av.div(bv).intoArray(r, i);
1621             }
1622         }
1623 
1624         assertArraysEquals(r, a, b, LongMaxVectorTests::div);
1625     }
1626 
1627 
1628 
1629     @Test(dataProvider = "longBinaryOpMaskProvider")
1630     static void DIVLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1631                                           IntFunction<boolean[]> fm) {
1632         long[] a = fa.apply(SPECIES.length());
1633         long[] b = fb.apply(SPECIES.length());
1634         long[] r = fr.apply(SPECIES.length());
1635         boolean[] mask = fm.apply(SPECIES.length());
1636         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1637 
1638         replaceZero(b, mask, (long) 1);
1639 
1640         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1641             for (int i = 0; i < a.length; i += SPECIES.length()) {
1642                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1643                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1644                 av.lanewise(VectorOperators.DIV, bv, vmask).intoArray(r, i);
1645             }
1646         }
1647 
1648         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::DIV);

1714     static long AND(long a, long b) {
1715         return (long)(a & b);
1716     }
1717 
1718     @Test(dataProvider = "longBinaryOpProvider")
1719     static void ANDLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1720         long[] a = fa.apply(SPECIES.length());
1721         long[] b = fb.apply(SPECIES.length());
1722         long[] r = fr.apply(SPECIES.length());
1723 
1724         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1725             for (int i = 0; i < a.length; i += SPECIES.length()) {
1726                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1727                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1728                 av.lanewise(VectorOperators.AND, bv).intoArray(r, i);
1729             }
1730         }
1731 
1732         assertArraysEquals(r, a, b, LongMaxVectorTests::AND);
1733     }

1734     static long and(long a, long b) {
1735         return (long)(a & b);
1736     }
1737 
1738     @Test(dataProvider = "longBinaryOpProvider")
1739     static void andLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1740         long[] a = fa.apply(SPECIES.length());
1741         long[] b = fb.apply(SPECIES.length());
1742         long[] r = fr.apply(SPECIES.length());
1743 
1744         for (int i = 0; i < a.length; i += SPECIES.length()) {
1745             LongVector av = LongVector.fromArray(SPECIES, a, i);
1746             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1747             av.and(bv).intoArray(r, i);
1748         }
1749 
1750         assertArraysEquals(r, a, b, LongMaxVectorTests::and);
1751     }
1752 
1753 
1754 
1755     @Test(dataProvider = "longBinaryOpMaskProvider")
1756     static void ANDLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1757                                           IntFunction<boolean[]> fm) {
1758         long[] a = fa.apply(SPECIES.length());
1759         long[] b = fb.apply(SPECIES.length());
1760         long[] r = fr.apply(SPECIES.length());
1761         boolean[] mask = fm.apply(SPECIES.length());
1762         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1763 
1764         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1765             for (int i = 0; i < a.length; i += SPECIES.length()) {
1766                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1767                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1768                 av.lanewise(VectorOperators.AND, bv, vmask).intoArray(r, i);
1769             }
1770         }
1771 
1772         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::AND);
1773     }
1774 
1775 
1776     static long AND_NOT(long a, long b) {
1777         return (long)(a & ~b);
1778     }
1779 
1780     @Test(dataProvider = "longBinaryOpProvider")
1781     static void AND_NOTLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1782         long[] a = fa.apply(SPECIES.length());
1783         long[] b = fb.apply(SPECIES.length());
1784         long[] r = fr.apply(SPECIES.length());
1785 
1786         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1787             for (int i = 0; i < a.length; i += SPECIES.length()) {
1788                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1789                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1790                 av.lanewise(VectorOperators.AND_NOT, bv).intoArray(r, i);
1791             }
1792         }
1793 
1794         assertArraysEquals(r, a, b, LongMaxVectorTests::AND_NOT);
1795     }
1796 
1797 
1798 
1799     @Test(dataProvider = "longBinaryOpMaskProvider")
1800     static void AND_NOTLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1801                                           IntFunction<boolean[]> fm) {
1802         long[] a = fa.apply(SPECIES.length());
1803         long[] b = fb.apply(SPECIES.length());
1804         long[] r = fr.apply(SPECIES.length());
1805         boolean[] mask = fm.apply(SPECIES.length());
1806         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1807 
1808         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1809             for (int i = 0; i < a.length; i += SPECIES.length()) {
1810                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1811                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1812                 av.lanewise(VectorOperators.AND_NOT, bv, vmask).intoArray(r, i);
1813             }
1814         }
1815 
1816         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::AND_NOT);
1817     }
1818 
1819 
1820     static long OR(long a, long b) {
1821         return (long)(a | b);
1822     }
1823 
1824     @Test(dataProvider = "longBinaryOpProvider")
1825     static void ORLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1826         long[] a = fa.apply(SPECIES.length());
1827         long[] b = fb.apply(SPECIES.length());
1828         long[] r = fr.apply(SPECIES.length());
1829 
1830         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1831             for (int i = 0; i < a.length; i += SPECIES.length()) {
1832                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1833                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1834                 av.lanewise(VectorOperators.OR, bv).intoArray(r, i);
1835             }
1836         }
1837 
1838         assertArraysEquals(r, a, b, LongMaxVectorTests::OR);
1839     }

1840     static long or(long a, long b) {
1841         return (long)(a | b);
1842     }
1843 
1844     @Test(dataProvider = "longBinaryOpProvider")
1845     static void orLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1846         long[] a = fa.apply(SPECIES.length());
1847         long[] b = fb.apply(SPECIES.length());
1848         long[] r = fr.apply(SPECIES.length());
1849 
1850         for (int i = 0; i < a.length; i += SPECIES.length()) {
1851             LongVector av = LongVector.fromArray(SPECIES, a, i);
1852             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1853             av.or(bv).intoArray(r, i);
1854         }
1855 
1856         assertArraysEquals(r, a, b, LongMaxVectorTests::or);
1857     }
1858 
1859 
1860 
1861     @Test(dataProvider = "longBinaryOpMaskProvider")
1862     static void ORLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1863                                           IntFunction<boolean[]> fm) {
1864         long[] a = fa.apply(SPECIES.length());
1865         long[] b = fb.apply(SPECIES.length());
1866         long[] r = fr.apply(SPECIES.length());
1867         boolean[] mask = fm.apply(SPECIES.length());
1868         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1869 
1870         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1871             for (int i = 0; i < a.length; i += SPECIES.length()) {
1872                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1873                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1874                 av.lanewise(VectorOperators.OR, bv, vmask).intoArray(r, i);
1875             }
1876         }
1877 
1878         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::OR);
1879     }
1880 
1881 
1882     static long XOR(long a, long b) {
1883         return (long)(a ^ b);
1884     }
1885 
1886     @Test(dataProvider = "longBinaryOpProvider")
1887     static void XORLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1888         long[] a = fa.apply(SPECIES.length());
1889         long[] b = fb.apply(SPECIES.length());
1890         long[] r = fr.apply(SPECIES.length());
1891 
1892         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1893             for (int i = 0; i < a.length; i += SPECIES.length()) {
1894                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1895                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1896                 av.lanewise(VectorOperators.XOR, bv).intoArray(r, i);
1897             }
1898         }
1899 
1900         assertArraysEquals(r, a, b, LongMaxVectorTests::XOR);
1901     }
1902 
1903 
1904 
1905     @Test(dataProvider = "longBinaryOpMaskProvider")
1906     static void XORLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1907                                           IntFunction<boolean[]> fm) {
1908         long[] a = fa.apply(SPECIES.length());
1909         long[] b = fb.apply(SPECIES.length());
1910         long[] r = fr.apply(SPECIES.length());
1911         boolean[] mask = fm.apply(SPECIES.length());
1912         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1913 
1914         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1915             for (int i = 0; i < a.length; i += SPECIES.length()) {
1916                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1917                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1918                 av.lanewise(VectorOperators.XOR, bv, vmask).intoArray(r, i);
1919             }
1920         }
1921 
1922         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::XOR);
1923     }
1924 

















































































1925 
1926     @Test(dataProvider = "longBinaryOpProvider")
1927     static void addLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1928         long[] a = fa.apply(SPECIES.length());
1929         long[] b = fb.apply(SPECIES.length());
1930         long[] r = fr.apply(SPECIES.length());
1931 
1932         for (int i = 0; i < a.length; i += SPECIES.length()) {
1933             LongVector av = LongVector.fromArray(SPECIES, a, i);
1934             av.add(b[i]).intoArray(r, i);
1935         }
1936 
1937         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::add);
1938     }
1939 
1940     @Test(dataProvider = "longBinaryOpMaskProvider")
1941     static void addLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
1942                                           IntFunction<boolean[]> fm) {
1943         long[] a = fa.apply(SPECIES.length());
1944         long[] b = fb.apply(SPECIES.length());

1999         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::mul);
2000     }
2001 
2002     @Test(dataProvider = "longBinaryOpMaskProvider")
2003     static void mulLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2004                                           IntFunction<boolean[]> fm) {
2005         long[] a = fa.apply(SPECIES.length());
2006         long[] b = fb.apply(SPECIES.length());
2007         long[] r = fr.apply(SPECIES.length());
2008         boolean[] mask = fm.apply(SPECIES.length());
2009         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2010 
2011         for (int i = 0; i < a.length; i += SPECIES.length()) {
2012             LongVector av = LongVector.fromArray(SPECIES, a, i);
2013             av.mul(b[i], vmask).intoArray(r, i);
2014         }
2015 
2016         assertBroadcastArraysEquals(r, a, b, mask, LongMaxVectorTests::mul);
2017     }
2018 
2019 
2020 
2021 
2022     @Test(dataProvider = "longBinaryOpProvider")
2023     static void divLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2024         long[] a = fa.apply(SPECIES.length());
2025         long[] b = fb.apply(SPECIES.length());
2026         long[] r = fr.apply(SPECIES.length());
2027 
2028         replaceZero(b, (long) 1);
2029 
2030         for (int i = 0; i < a.length; i += SPECIES.length()) {
2031             LongVector av = LongVector.fromArray(SPECIES, a, i);
2032             av.div(b[i]).intoArray(r, i);
2033         }
2034 
2035         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::div);
2036     }
2037 
2038 
2039 
2040     @Test(dataProvider = "longBinaryOpMaskProvider")
2041     static void divLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2042                                           IntFunction<boolean[]> fm) {
2043         long[] a = fa.apply(SPECIES.length());
2044         long[] b = fb.apply(SPECIES.length());
2045         long[] r = fr.apply(SPECIES.length());
2046         boolean[] mask = fm.apply(SPECIES.length());
2047         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2048 
2049         replaceZero(b, (long) 1);
2050 
2051         for (int i = 0; i < a.length; i += SPECIES.length()) {
2052             LongVector av = LongVector.fromArray(SPECIES, a, i);
2053             av.div(b[i], vmask).intoArray(r, i);
2054         }
2055 
2056         assertBroadcastArraysEquals(r, a, b, mask, LongMaxVectorTests::div);
2057     }
2058 
2059 
2060 
2061     @Test(dataProvider = "longBinaryOpProvider")
2062     static void ORLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2063         long[] a = fa.apply(SPECIES.length());
2064         long[] b = fb.apply(SPECIES.length());
2065         long[] r = fr.apply(SPECIES.length());
2066 
2067         for (int i = 0; i < a.length; i += SPECIES.length()) {
2068             LongVector av = LongVector.fromArray(SPECIES, a, i);
2069             av.lanewise(VectorOperators.OR, b[i]).intoArray(r, i);
2070         }
2071 
2072         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::OR);
2073     }
2074 
2075     @Test(dataProvider = "longBinaryOpProvider")
2076     static void orLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2077         long[] a = fa.apply(SPECIES.length());
2078         long[] b = fb.apply(SPECIES.length());
2079         long[] r = fr.apply(SPECIES.length());
2080 
2081         for (int i = 0; i < a.length; i += SPECIES.length()) {
2082             LongVector av = LongVector.fromArray(SPECIES, a, i);
2083             av.or(b[i]).intoArray(r, i);
2084         }
2085 
2086         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::or);
2087     }
2088 
2089 
2090 
2091     @Test(dataProvider = "longBinaryOpMaskProvider")
2092     static void ORLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2093                                           IntFunction<boolean[]> fm) {
2094         long[] a = fa.apply(SPECIES.length());
2095         long[] b = fb.apply(SPECIES.length());
2096         long[] r = fr.apply(SPECIES.length());
2097         boolean[] mask = fm.apply(SPECIES.length());
2098         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2099 
2100         for (int i = 0; i < a.length; i += SPECIES.length()) {
2101             LongVector av = LongVector.fromArray(SPECIES, a, i);
2102             av.lanewise(VectorOperators.OR, b[i], vmask).intoArray(r, i);
2103         }
2104 
2105         assertBroadcastArraysEquals(r, a, b, mask, LongMaxVectorTests::OR);
2106     }
2107 
2108 
2109 
2110     @Test(dataProvider = "longBinaryOpProvider")
2111     static void ANDLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2112         long[] a = fa.apply(SPECIES.length());
2113         long[] b = fb.apply(SPECIES.length());
2114         long[] r = fr.apply(SPECIES.length());
2115 
2116         for (int i = 0; i < a.length; i += SPECIES.length()) {
2117             LongVector av = LongVector.fromArray(SPECIES, a, i);
2118             av.lanewise(VectorOperators.AND, b[i]).intoArray(r, i);
2119         }
2120 
2121         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::AND);
2122     }
2123 
2124     @Test(dataProvider = "longBinaryOpProvider")
2125     static void andLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2126         long[] a = fa.apply(SPECIES.length());
2127         long[] b = fb.apply(SPECIES.length());
2128         long[] r = fr.apply(SPECIES.length());
2129 
2130         for (int i = 0; i < a.length; i += SPECIES.length()) {
2131             LongVector av = LongVector.fromArray(SPECIES, a, i);
2132             av.and(b[i]).intoArray(r, i);
2133         }
2134 
2135         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::and);
2136     }
2137 
2138 
2139 
2140     @Test(dataProvider = "longBinaryOpMaskProvider")
2141     static void ANDLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2142                                           IntFunction<boolean[]> fm) {
2143         long[] a = fa.apply(SPECIES.length());
2144         long[] b = fb.apply(SPECIES.length());
2145         long[] r = fr.apply(SPECIES.length());
2146         boolean[] mask = fm.apply(SPECIES.length());
2147         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2148 
2149         for (int i = 0; i < a.length; i += SPECIES.length()) {
2150             LongVector av = LongVector.fromArray(SPECIES, a, i);
2151             av.lanewise(VectorOperators.AND, b[i], vmask).intoArray(r, i);
2152         }
2153 
2154         assertBroadcastArraysEquals(r, a, b, mask, LongMaxVectorTests::AND);
2155     }
2156 
2157 
2158 
2159     @Test(dataProvider = "longBinaryOpProvider")
2160     static void ORLongMaxVectorTestsBroadcastLongSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2161         long[] a = fa.apply(SPECIES.length());
2162         long[] b = fb.apply(SPECIES.length());
2163         long[] r = fr.apply(SPECIES.length());
2164 
2165         for (int i = 0; i < a.length; i += SPECIES.length()) {
2166             LongVector av = LongVector.fromArray(SPECIES, a, i);
2167             av.lanewise(VectorOperators.OR, (long)b[i]).intoArray(r, i);
2168         }
2169 
2170         assertBroadcastLongArraysEquals(r, a, b, LongMaxVectorTests::OR);
2171     }
2172 
2173 
2174 
2175     @Test(dataProvider = "longBinaryOpMaskProvider")
2176     static void ORLongMaxVectorTestsBroadcastMaskedLongSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2177                                           IntFunction<boolean[]> fm) {
2178         long[] a = fa.apply(SPECIES.length());
2179         long[] b = fb.apply(SPECIES.length());
2180         long[] r = fr.apply(SPECIES.length());
2181         boolean[] mask = fm.apply(SPECIES.length());
2182         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2183 
2184         for (int i = 0; i < a.length; i += SPECIES.length()) {
2185             LongVector av = LongVector.fromArray(SPECIES, a, i);
2186             av.lanewise(VectorOperators.OR, (long)b[i], vmask).intoArray(r, i);
2187         }
2188 
2189         assertBroadcastLongArraysEquals(r, a, b, mask, LongMaxVectorTests::OR);
2190     }
2191 
2192 
2193     @Test(dataProvider = "longBinaryOpProvider")
2194     static void ADDLongMaxVectorTestsBroadcastLongSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2195         long[] a = fa.apply(SPECIES.length());
2196         long[] b = fb.apply(SPECIES.length());
2197         long[] r = fr.apply(SPECIES.length());
2198 
2199         for (int i = 0; i < a.length; i += SPECIES.length()) {
2200             LongVector av = LongVector.fromArray(SPECIES, a, i);
2201             av.lanewise(VectorOperators.ADD, (long)b[i]).intoArray(r, i);
2202         }
2203 
2204         assertBroadcastLongArraysEquals(r, a, b, LongMaxVectorTests::ADD);
2205     }
2206 
2207     @Test(dataProvider = "longBinaryOpMaskProvider")
2208     static void ADDLongMaxVectorTestsBroadcastMaskedLongSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2209                                           IntFunction<boolean[]> fm) {
2210         long[] a = fa.apply(SPECIES.length());
2211         long[] b = fb.apply(SPECIES.length());
2212         long[] r = fr.apply(SPECIES.length());

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

2906     static long min(long a, long b) {
2907         return (long)(Math.min(a, b));
2908     }
2909 
2910     @Test(dataProvider = "longBinaryOpProvider")
2911     static void minLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2912         long[] a = fa.apply(SPECIES.length());
2913         long[] b = fb.apply(SPECIES.length());
2914         long[] r = fr.apply(SPECIES.length());
2915 
2916         for (int i = 0; i < a.length; i += SPECIES.length()) {
2917             LongVector av = LongVector.fromArray(SPECIES, a, i);
2918             LongVector bv = LongVector.fromArray(SPECIES, b, i);
2919             av.min(bv).intoArray(r, i);
2920         }
2921 
2922         assertArraysEquals(r, a, b, LongMaxVectorTests::min);
2923     }

2924     static long MAX(long a, long b) {
2925         return (long)(Math.max(a, b));
2926     }
2927 
2928     @Test(dataProvider = "longBinaryOpProvider")
2929     static void MAXLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2930         long[] a = fa.apply(SPECIES.length());
2931         long[] b = fb.apply(SPECIES.length());
2932         long[] r = fr.apply(SPECIES.length());
2933 
2934         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2935             for (int i = 0; i < a.length; i += SPECIES.length()) {
2936                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2937                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2938                 av.lanewise(VectorOperators.MAX, bv).intoArray(r, i);
2939             }
2940         }
2941 
2942         assertArraysEquals(r, a, b, LongMaxVectorTests::MAX);
2943     }

2944     static long max(long a, long b) {
2945         return (long)(Math.max(a, b));
2946     }
2947 
2948     @Test(dataProvider = "longBinaryOpProvider")
2949     static void maxLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2950         long[] a = fa.apply(SPECIES.length());
2951         long[] b = fb.apply(SPECIES.length());
2952         long[] r = fr.apply(SPECIES.length());
2953 
2954         for (int i = 0; i < a.length; i += SPECIES.length()) {
2955             LongVector av = LongVector.fromArray(SPECIES, a, i);
2956             LongVector bv = LongVector.fromArray(SPECIES, b, i);
2957             av.max(bv).intoArray(r, i);
2958         }
2959 
2960         assertArraysEquals(r, a, b, LongMaxVectorTests::max);
2961     }
2962 
2963     @Test(dataProvider = "longBinaryOpProvider")

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

3294                 LongMaxVectorTests::XORReduceMasked, LongMaxVectorTests::XORReduceAllMasked);
3295     }
3296 
3297     static long ADDReduce(long[] a, int idx) {
3298         long res = 0;
3299         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3300             res += a[i];
3301         }
3302 
3303         return res;
3304     }
3305 
3306     static long ADDReduceAll(long[] a) {
3307         long res = 0;
3308         for (int i = 0; i < a.length; i += SPECIES.length()) {
3309             res += ADDReduce(a, i);
3310         }
3311 
3312         return res;
3313     }

3314     @Test(dataProvider = "longUnaryOpProvider")
3315     static void ADDReduceLongMaxVectorTests(IntFunction<long[]> fa) {
3316         long[] a = fa.apply(SPECIES.length());
3317         long[] r = fr.apply(SPECIES.length());
3318         long ra = 0;
3319 
3320         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3321             for (int i = 0; i < a.length; i += SPECIES.length()) {
3322                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3323                 r[i] = av.reduceLanes(VectorOperators.ADD);
3324             }
3325         }
3326 
3327         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3328             ra = 0;
3329             for (int i = 0; i < a.length; i += SPECIES.length()) {
3330                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3331                 ra += av.reduceLanes(VectorOperators.ADD);
3332             }
3333         }
3334 
3335         assertReductionArraysEquals(r, ra, a,
3336                 LongMaxVectorTests::ADDReduce, LongMaxVectorTests::ADDReduceAll);
3337     }

3338     static long ADDReduceMasked(long[] a, int idx, boolean[] mask) {
3339         long res = 0;
3340         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3341             if (mask[i % SPECIES.length()])
3342                 res += a[i];
3343         }
3344 
3345         return res;
3346     }
3347 
3348     static long ADDReduceAllMasked(long[] a, boolean[] mask) {
3349         long res = 0;
3350         for (int i = 0; i < a.length; i += SPECIES.length()) {
3351             res += ADDReduceMasked(a, i, mask);
3352         }
3353 
3354         return res;
3355     }

3356     @Test(dataProvider = "longUnaryOpMaskProvider")
3357     static void ADDReduceLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
3358         long[] a = fa.apply(SPECIES.length());
3359         long[] r = fr.apply(SPECIES.length());
3360         boolean[] mask = fm.apply(SPECIES.length());
3361         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3362         long ra = 0;
3363 
3364         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3365             for (int i = 0; i < a.length; i += SPECIES.length()) {
3366                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3367                 r[i] = av.reduceLanes(VectorOperators.ADD, vmask);
3368             }
3369         }
3370 
3371         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3372             ra = 0;
3373             for (int i = 0; i < a.length; i += SPECIES.length()) {
3374                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3375                 ra += av.reduceLanes(VectorOperators.ADD, vmask);
3376             }
3377         }
3378 
3379         assertReductionArraysEqualsMasked(r, ra, a, mask,
3380                 LongMaxVectorTests::ADDReduceMasked, LongMaxVectorTests::ADDReduceAllMasked);
3381     }

3382     static long MULReduce(long[] a, int idx) {
3383         long res = 1;
3384         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3385             res *= a[i];
3386         }
3387 
3388         return res;
3389     }
3390 
3391     static long MULReduceAll(long[] a) {
3392         long res = 1;
3393         for (int i = 0; i < a.length; i += SPECIES.length()) {
3394             res *= MULReduce(a, i);
3395         }
3396 
3397         return res;
3398     }

3399     @Test(dataProvider = "longUnaryOpProvider")
3400     static void MULReduceLongMaxVectorTests(IntFunction<long[]> fa) {
3401         long[] a = fa.apply(SPECIES.length());
3402         long[] r = fr.apply(SPECIES.length());
3403         long ra = 1;
3404 
3405         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3406             for (int i = 0; i < a.length; i += SPECIES.length()) {
3407                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3408                 r[i] = av.reduceLanes(VectorOperators.MUL);
3409             }
3410         }
3411 
3412         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3413             ra = 1;
3414             for (int i = 0; i < a.length; i += SPECIES.length()) {
3415                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3416                 ra *= av.reduceLanes(VectorOperators.MUL);
3417             }
3418         }
3419 
3420         assertReductionArraysEquals(r, ra, a,
3421                 LongMaxVectorTests::MULReduce, LongMaxVectorTests::MULReduceAll);
3422     }

3423     static long MULReduceMasked(long[] a, int idx, boolean[] mask) {
3424         long res = 1;
3425         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3426             if (mask[i % SPECIES.length()])
3427                 res *= a[i];
3428         }
3429 
3430         return res;
3431     }
3432 
3433     static long MULReduceAllMasked(long[] a, boolean[] mask) {
3434         long res = 1;
3435         for (int i = 0; i < a.length; i += SPECIES.length()) {
3436             res *= MULReduceMasked(a, i, mask);
3437         }
3438 
3439         return res;
3440     }

3441     @Test(dataProvider = "longUnaryOpMaskProvider")
3442     static void MULReduceLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
3443         long[] a = fa.apply(SPECIES.length());
3444         long[] r = fr.apply(SPECIES.length());
3445         boolean[] mask = fm.apply(SPECIES.length());
3446         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3447         long ra = 1;
3448 
3449         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3450             for (int i = 0; i < a.length; i += SPECIES.length()) {
3451                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3452                 r[i] = av.reduceLanes(VectorOperators.MUL, vmask);
3453             }
3454         }
3455 
3456         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3457             ra = 1;
3458             for (int i = 0; i < a.length; i += SPECIES.length()) {
3459                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3460                 ra *= av.reduceLanes(VectorOperators.MUL, vmask);
3461             }
3462         }
3463 
3464         assertReductionArraysEqualsMasked(r, ra, a, mask,
3465                 LongMaxVectorTests::MULReduceMasked, LongMaxVectorTests::MULReduceAllMasked);
3466     }

3467     static long MINReduce(long[] a, int idx) {
3468         long res = Long.MAX_VALUE;
3469         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3470             res = (long) Math.min(res, a[i]);
3471         }
3472 
3473         return res;
3474     }
3475 
3476     static long MINReduceAll(long[] a) {
3477         long res = Long.MAX_VALUE;
3478         for (int i = 0; i < a.length; i += SPECIES.length()) {
3479             res = (long) Math.min(res, MINReduce(a, i));
3480         }
3481 
3482         return res;
3483     }

3484     @Test(dataProvider = "longUnaryOpProvider")
3485     static void MINReduceLongMaxVectorTests(IntFunction<long[]> fa) {
3486         long[] a = fa.apply(SPECIES.length());
3487         long[] r = fr.apply(SPECIES.length());
3488         long ra = Long.MAX_VALUE;
3489 
3490         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3491             for (int i = 0; i < a.length; i += SPECIES.length()) {
3492                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3493                 r[i] = av.reduceLanes(VectorOperators.MIN);
3494             }
3495         }
3496 
3497         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3498             ra = Long.MAX_VALUE;
3499             for (int i = 0; i < a.length; i += SPECIES.length()) {
3500                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3501                 ra = (long) Math.min(ra, av.reduceLanes(VectorOperators.MIN));
3502             }
3503         }
3504 
3505         assertReductionArraysEquals(r, ra, a,
3506                 LongMaxVectorTests::MINReduce, LongMaxVectorTests::MINReduceAll);
3507     }

3508     static long MINReduceMasked(long[] a, int idx, boolean[] mask) {
3509         long res = Long.MAX_VALUE;
3510         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3511             if (mask[i % SPECIES.length()])
3512                 res = (long) Math.min(res, a[i]);
3513         }
3514 
3515         return res;
3516     }
3517 
3518     static long MINReduceAllMasked(long[] a, boolean[] mask) {
3519         long res = Long.MAX_VALUE;
3520         for (int i = 0; i < a.length; i += SPECIES.length()) {
3521             res = (long) Math.min(res, MINReduceMasked(a, i, mask));
3522         }
3523 
3524         return res;
3525     }

3526     @Test(dataProvider = "longUnaryOpMaskProvider")
3527     static void MINReduceLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
3528         long[] a = fa.apply(SPECIES.length());
3529         long[] r = fr.apply(SPECIES.length());
3530         boolean[] mask = fm.apply(SPECIES.length());
3531         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3532         long ra = Long.MAX_VALUE;
3533 
3534         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3535             for (int i = 0; i < a.length; i += SPECIES.length()) {
3536                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3537                 r[i] = av.reduceLanes(VectorOperators.MIN, vmask);
3538             }
3539         }
3540 
3541         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3542             ra = Long.MAX_VALUE;
3543             for (int i = 0; i < a.length; i += SPECIES.length()) {
3544                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3545                 ra = (long) Math.min(ra, av.reduceLanes(VectorOperators.MIN, vmask));
3546             }
3547         }
3548 
3549         assertReductionArraysEqualsMasked(r, ra, a, mask,
3550                 LongMaxVectorTests::MINReduceMasked, LongMaxVectorTests::MINReduceAllMasked);
3551     }

3552     static long MAXReduce(long[] a, int idx) {
3553         long res = Long.MIN_VALUE;
3554         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3555             res = (long) Math.max(res, a[i]);
3556         }
3557 
3558         return res;
3559     }
3560 
3561     static long MAXReduceAll(long[] a) {
3562         long res = Long.MIN_VALUE;
3563         for (int i = 0; i < a.length; i += SPECIES.length()) {
3564             res = (long) Math.max(res, MAXReduce(a, i));
3565         }
3566 
3567         return res;
3568     }

3569     @Test(dataProvider = "longUnaryOpProvider")
3570     static void MAXReduceLongMaxVectorTests(IntFunction<long[]> fa) {
3571         long[] a = fa.apply(SPECIES.length());
3572         long[] r = fr.apply(SPECIES.length());
3573         long ra = Long.MIN_VALUE;
3574 
3575         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3576             for (int i = 0; i < a.length; i += SPECIES.length()) {
3577                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3578                 r[i] = av.reduceLanes(VectorOperators.MAX);
3579             }
3580         }
3581 
3582         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3583             ra = Long.MIN_VALUE;
3584             for (int i = 0; i < a.length; i += SPECIES.length()) {
3585                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3586                 ra = (long) Math.max(ra, av.reduceLanes(VectorOperators.MAX));
3587             }
3588         }
3589 
3590         assertReductionArraysEquals(r, ra, a,
3591                 LongMaxVectorTests::MAXReduce, LongMaxVectorTests::MAXReduceAll);
3592     }

3593     static long MAXReduceMasked(long[] a, int idx, boolean[] mask) {
3594         long res = Long.MIN_VALUE;
3595         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3596             if (mask[i % SPECIES.length()])
3597                 res = (long) Math.max(res, a[i]);
3598         }
3599 
3600         return res;
3601     }
3602 
3603     static long MAXReduceAllMasked(long[] a, boolean[] mask) {
3604         long res = Long.MIN_VALUE;
3605         for (int i = 0; i < a.length; i += SPECIES.length()) {
3606             res = (long) Math.max(res, MAXReduceMasked(a, i, mask));
3607         }
3608 
3609         return res;
3610     }

3611     @Test(dataProvider = "longUnaryOpMaskProvider")
3612     static void MAXReduceLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
3613         long[] a = fa.apply(SPECIES.length());
3614         long[] r = fr.apply(SPECIES.length());
3615         boolean[] mask = fm.apply(SPECIES.length());
3616         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3617         long ra = Long.MIN_VALUE;
3618 
3619         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3620             for (int i = 0; i < a.length; i += SPECIES.length()) {
3621                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3622                 r[i] = av.reduceLanes(VectorOperators.MAX, vmask);
3623             }
3624         }
3625 
3626         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3627             ra = Long.MIN_VALUE;
3628             for (int i = 0; i < a.length; i += SPECIES.length()) {
3629                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3630                 ra = (long) Math.max(ra, av.reduceLanes(VectorOperators.MAX, vmask));
3631             }
3632         }
3633 
3634         assertReductionArraysEqualsMasked(r, ra, a, mask,
3635                 LongMaxVectorTests::MAXReduceMasked, LongMaxVectorTests::MAXReduceAllMasked);
3636     }

3637     static long FIRST_NONZEROReduce(long[] a, int idx) {
3638         long res = (long) 0;
3639         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3640             res = firstNonZero(res, a[i]);
3641         }
3642 
3643         return res;
3644     }
3645 
3646     static long FIRST_NONZEROReduceAll(long[] a) {
3647         long res = (long) 0;
3648         for (int i = 0; i < a.length; i += SPECIES.length()) {
3649             res = firstNonZero(res, FIRST_NONZEROReduce(a, i));
3650         }
3651 
3652         return res;
3653     }

3654     @Test(dataProvider = "longUnaryOpProvider")
3655     static void FIRST_NONZEROReduceLongMaxVectorTests(IntFunction<long[]> fa) {
3656         long[] a = fa.apply(SPECIES.length());
3657         long[] r = fr.apply(SPECIES.length());
3658         long ra = (long) 0;
3659 
3660         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3661             for (int i = 0; i < a.length; i += SPECIES.length()) {
3662                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3663                 r[i] = av.reduceLanes(VectorOperators.FIRST_NONZERO);
3664             }
3665         }
3666 
3667         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3668             ra = (long) 0;
3669             for (int i = 0; i < a.length; i += SPECIES.length()) {
3670                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3671                 ra = firstNonZero(ra, av.reduceLanes(VectorOperators.FIRST_NONZERO));
3672             }
3673         }
3674 
3675         assertReductionArraysEquals(r, ra, a,
3676                 LongMaxVectorTests::FIRST_NONZEROReduce, LongMaxVectorTests::FIRST_NONZEROReduceAll);
3677     }

3678     static long FIRST_NONZEROReduceMasked(long[] a, int idx, boolean[] mask) {
3679         long res = (long) 0;
3680         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3681             if (mask[i % SPECIES.length()])
3682                 res = firstNonZero(res, a[i]);
3683         }
3684 
3685         return res;
3686     }
3687 
3688     static long FIRST_NONZEROReduceAllMasked(long[] a, boolean[] mask) {
3689         long res = (long) 0;
3690         for (int i = 0; i < a.length; i += SPECIES.length()) {
3691             res = firstNonZero(res, FIRST_NONZEROReduceMasked(a, i, mask));
3692         }
3693 
3694         return res;
3695     }

3696     @Test(dataProvider = "longUnaryOpMaskProvider")
3697     static void FIRST_NONZEROReduceLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
3698         long[] a = fa.apply(SPECIES.length());
3699         long[] r = fr.apply(SPECIES.length());
3700         boolean[] mask = fm.apply(SPECIES.length());
3701         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3702         long ra = (long) 0;
3703 
3704         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3705             for (int i = 0; i < a.length; i += SPECIES.length()) {
3706                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3707                 r[i] = av.reduceLanes(VectorOperators.FIRST_NONZERO, vmask);
3708             }
3709         }
3710 
3711         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3712             ra = (long) 0;
3713             for (int i = 0; i < a.length; i += SPECIES.length()) {
3714                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3715                 ra = firstNonZero(ra, av.reduceLanes(VectorOperators.FIRST_NONZERO, vmask));
3716             }
3717         }
3718 
3719         assertReductionArraysEqualsMasked(r, ra, a, mask,
3720                 LongMaxVectorTests::FIRST_NONZEROReduceMasked, LongMaxVectorTests::FIRST_NONZEROReduceAllMasked);
3721     }
3722 
3723     static boolean anyTrue(boolean[] a, int idx) {
3724         boolean res = false;
3725         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3726             res |= a[i];
3727         }
3728 
3729         return res;
3730     }
3731 
3732 
3733     @Test(dataProvider = "boolUnaryOpProvider")
3734     static void anyTrueLongMaxVectorTests(IntFunction<boolean[]> fm) {
3735         boolean[] mask = fm.apply(SPECIES.length());
3736         boolean[] r = fmr.apply(SPECIES.length());
3737 
3738         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3739             for (int i = 0; i < mask.length; i += SPECIES.length()) {
3740                 VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, i);
3741                 r[i] = vmask.anyTrue();
3742             }
3743         }
3744 
3745         assertReductionBoolArraysEquals(r, mask, LongMaxVectorTests::anyTrue);
3746     }
3747 
3748 
3749     static boolean allTrue(boolean[] a, int idx) {
3750         boolean res = true;
3751         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3752             res &= a[i];
3753         }
3754 
3755         return res;
3756     }
3757 
3758 
3759     @Test(dataProvider = "boolUnaryOpProvider")
3760     static void allTrueLongMaxVectorTests(IntFunction<boolean[]> fm) {
3761         boolean[] mask = fm.apply(SPECIES.length());
3762         boolean[] r = fmr.apply(SPECIES.length());
3763 
3764         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3765             for (int i = 0; i < mask.length; i += SPECIES.length()) {
3766                 VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, i);
3767                 r[i] = vmask.allTrue();
3768             }
3769         }
3770 
3771         assertReductionBoolArraysEquals(r, mask, LongMaxVectorTests::allTrue);
3772     }
3773 
3774 
3775     @Test(dataProvider = "longUnaryOpProvider")
3776     static void withLongMaxVectorTests(IntFunction<long []> fa) {
3777         long[] a = fa.apply(SPECIES.length());
3778         long[] r = fr.apply(SPECIES.length());
3779 
3780         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3781             for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
3782                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3783                 av.withLane((j++ & (SPECIES.length()-1)), (long)(65535+i)).intoArray(r, i);
3784             }
3785         }
3786 
3787 
3788         for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
3789             assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
3790         }
3791     }

3792     static boolean testIS_DEFAULT(long a) {
3793         return bits(a)==0;
3794     }
3795 
3796     @Test(dataProvider = "longTestOpProvider")
3797     static void IS_DEFAULTLongMaxVectorTests(IntFunction<long[]> fa) {
3798         long[] a = fa.apply(SPECIES.length());
3799 
3800         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3801             for (int i = 0; i < a.length; i += SPECIES.length()) {
3802                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3803                 VectorMask<Long> mv = av.test(VectorOperators.IS_DEFAULT);
3804 
3805                 // Check results as part of computation.
3806                 for (int j = 0; j < SPECIES.length(); j++) {
3807                     Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j]));
3808                 }
3809             }
3810         }
3811     }
3812 
3813     @Test(dataProvider = "longTestOpMaskProvider")
3814     static void IS_DEFAULTMaskedLongMaxVectorTests(IntFunction<long[]> fa,
3815                                           IntFunction<boolean[]> fm) {
3816         long[] a = fa.apply(SPECIES.length());
3817         boolean[] mask = fm.apply(SPECIES.length());
3818         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3819 
3820         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3821             for (int i = 0; i < a.length; i += SPECIES.length()) {
3822                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3823                 VectorMask<Long> mv = av.test(VectorOperators.IS_DEFAULT, vmask);
3824 
3825                 // Check results as part of computation.
3826                 for (int j = 0; j < SPECIES.length(); j++) {
3827                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j]));
3828                 }
3829             }
3830         }
3831     }

3832     static boolean testIS_NEGATIVE(long a) {
3833         return bits(a)<0;
3834     }
3835 
3836     @Test(dataProvider = "longTestOpProvider")
3837     static void IS_NEGATIVELongMaxVectorTests(IntFunction<long[]> fa) {
3838         long[] a = fa.apply(SPECIES.length());
3839 
3840         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3841             for (int i = 0; i < a.length; i += SPECIES.length()) {
3842                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3843                 VectorMask<Long> mv = av.test(VectorOperators.IS_NEGATIVE);
3844 
3845                 // Check results as part of computation.
3846                 for (int j = 0; j < SPECIES.length(); j++) {
3847                     Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j]));
3848                 }
3849             }
3850         }
3851     }

3853     @Test(dataProvider = "longTestOpMaskProvider")
3854     static void IS_NEGATIVEMaskedLongMaxVectorTests(IntFunction<long[]> fa,
3855                                           IntFunction<boolean[]> fm) {
3856         long[] a = fa.apply(SPECIES.length());
3857         boolean[] mask = fm.apply(SPECIES.length());
3858         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3859 
3860         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3861             for (int i = 0; i < a.length; i += SPECIES.length()) {
3862                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3863                 VectorMask<Long> mv = av.test(VectorOperators.IS_NEGATIVE, vmask);
3864 
3865                 // Check results as part of computation.
3866                 for (int j = 0; j < SPECIES.length(); j++) {
3867                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j]));
3868                 }
3869             }
3870         }
3871     }
3872 
3873 
3874 
3875 
3876     @Test(dataProvider = "longCompareOpProvider")
3877     static void LTLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
3878         long[] a = fa.apply(SPECIES.length());
3879         long[] b = fb.apply(SPECIES.length());
3880 
3881         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3882             for (int i = 0; i < a.length; i += SPECIES.length()) {
3883                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3884                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
3885                 VectorMask<Long> mv = av.compare(VectorOperators.LT, bv);
3886 
3887                 // Check results as part of computation.
3888                 for (int j = 0; j < SPECIES.length(); j++) {
3889                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
3890                 }
3891             }
3892         }
3893     }
3894 
3895 
3896     @Test(dataProvider = "longCompareOpProvider")
3897     static void ltLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
3898         long[] a = fa.apply(SPECIES.length());
3899         long[] b = fb.apply(SPECIES.length());
3900 
3901         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3902             for (int i = 0; i < a.length; i += SPECIES.length()) {
3903                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3904                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
3905                 VectorMask<Long> mv = av.lt(bv);
3906 
3907                 // Check results as part of computation.
3908                 for (int j = 0; j < SPECIES.length(); j++) {
3909                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
3910                 }
3911             }
3912         }
3913     }
3914 
3915     @Test(dataProvider = "longCompareOpMaskProvider")

3918         long[] a = fa.apply(SPECIES.length());
3919         long[] b = fb.apply(SPECIES.length());
3920         boolean[] mask = fm.apply(SPECIES.length());
3921 
3922         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3923 
3924         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3925             for (int i = 0; i < a.length; i += SPECIES.length()) {
3926                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3927                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
3928                 VectorMask<Long> mv = av.compare(VectorOperators.LT, bv, vmask);
3929 
3930                 // Check results as part of computation.
3931                 for (int j = 0; j < SPECIES.length(); j++) {
3932                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j]));
3933                 }
3934             }
3935         }
3936     }
3937 
3938 
3939     @Test(dataProvider = "longCompareOpProvider")
3940     static void GTLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
3941         long[] a = fa.apply(SPECIES.length());
3942         long[] b = fb.apply(SPECIES.length());
3943 
3944         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3945             for (int i = 0; i < a.length; i += SPECIES.length()) {
3946                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3947                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
3948                 VectorMask<Long> mv = av.compare(VectorOperators.GT, bv);
3949 
3950                 // Check results as part of computation.
3951                 for (int j = 0; j < SPECIES.length(); j++) {
3952                     Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j]));
3953                 }
3954             }
3955         }
3956     }
3957 
3958     @Test(dataProvider = "longCompareOpMaskProvider")

3961         long[] a = fa.apply(SPECIES.length());
3962         long[] b = fb.apply(SPECIES.length());
3963         boolean[] mask = fm.apply(SPECIES.length());
3964 
3965         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3966 
3967         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3968             for (int i = 0; i < a.length; i += SPECIES.length()) {
3969                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3970                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
3971                 VectorMask<Long> mv = av.compare(VectorOperators.GT, bv, vmask);
3972 
3973                 // Check results as part of computation.
3974                 for (int j = 0; j < SPECIES.length(); j++) {
3975                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j]));
3976                 }
3977             }
3978         }
3979     }
3980 
3981 
3982     @Test(dataProvider = "longCompareOpProvider")
3983     static void EQLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
3984         long[] a = fa.apply(SPECIES.length());
3985         long[] b = fb.apply(SPECIES.length());
3986 
3987         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3988             for (int i = 0; i < a.length; i += SPECIES.length()) {
3989                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3990                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
3991                 VectorMask<Long> mv = av.compare(VectorOperators.EQ, bv);
3992 
3993                 // Check results as part of computation.
3994                 for (int j = 0; j < SPECIES.length(); j++) {
3995                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
3996                 }
3997             }
3998         }
3999     }
4000 
4001 
4002     @Test(dataProvider = "longCompareOpProvider")
4003     static void eqLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4004         long[] a = fa.apply(SPECIES.length());
4005         long[] b = fb.apply(SPECIES.length());
4006 
4007         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4008             for (int i = 0; i < a.length; i += SPECIES.length()) {
4009                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4010                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4011                 VectorMask<Long> mv = av.eq(bv);
4012 
4013                 // Check results as part of computation.
4014                 for (int j = 0; j < SPECIES.length(); j++) {
4015                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
4016                 }
4017             }
4018         }
4019     }
4020 
4021     @Test(dataProvider = "longCompareOpMaskProvider")

4024         long[] a = fa.apply(SPECIES.length());
4025         long[] b = fb.apply(SPECIES.length());
4026         boolean[] mask = fm.apply(SPECIES.length());
4027 
4028         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4029 
4030         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4031             for (int i = 0; i < a.length; i += SPECIES.length()) {
4032                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4033                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4034                 VectorMask<Long> mv = av.compare(VectorOperators.EQ, bv, vmask);
4035 
4036                 // Check results as part of computation.
4037                 for (int j = 0; j < SPECIES.length(); j++) {
4038                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j]));
4039                 }
4040             }
4041         }
4042     }
4043 
4044 
4045     @Test(dataProvider = "longCompareOpProvider")
4046     static void NELongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4047         long[] a = fa.apply(SPECIES.length());
4048         long[] b = fb.apply(SPECIES.length());
4049 
4050         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4051             for (int i = 0; i < a.length; i += SPECIES.length()) {
4052                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4053                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4054                 VectorMask<Long> mv = av.compare(VectorOperators.NE, bv);
4055 
4056                 // Check results as part of computation.
4057                 for (int j = 0; j < SPECIES.length(); j++) {
4058                     Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j]));
4059                 }
4060             }
4061         }
4062     }
4063 
4064     @Test(dataProvider = "longCompareOpMaskProvider")

4067         long[] a = fa.apply(SPECIES.length());
4068         long[] b = fb.apply(SPECIES.length());
4069         boolean[] mask = fm.apply(SPECIES.length());
4070 
4071         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4072 
4073         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4074             for (int i = 0; i < a.length; i += SPECIES.length()) {
4075                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4076                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4077                 VectorMask<Long> mv = av.compare(VectorOperators.NE, bv, vmask);
4078 
4079                 // Check results as part of computation.
4080                 for (int j = 0; j < SPECIES.length(); j++) {
4081                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j]));
4082                 }
4083             }
4084         }
4085     }
4086 
4087 
4088     @Test(dataProvider = "longCompareOpProvider")
4089     static void LELongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4090         long[] a = fa.apply(SPECIES.length());
4091         long[] b = fb.apply(SPECIES.length());
4092 
4093         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4094             for (int i = 0; i < a.length; i += SPECIES.length()) {
4095                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4096                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4097                 VectorMask<Long> mv = av.compare(VectorOperators.LE, bv);
4098 
4099                 // Check results as part of computation.
4100                 for (int j = 0; j < SPECIES.length(); j++) {
4101                     Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j]));
4102                 }
4103             }
4104         }
4105     }
4106 
4107     @Test(dataProvider = "longCompareOpMaskProvider")

4110         long[] a = fa.apply(SPECIES.length());
4111         long[] b = fb.apply(SPECIES.length());
4112         boolean[] mask = fm.apply(SPECIES.length());
4113 
4114         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4115 
4116         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4117             for (int i = 0; i < a.length; i += SPECIES.length()) {
4118                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4119                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4120                 VectorMask<Long> mv = av.compare(VectorOperators.LE, bv, vmask);
4121 
4122                 // Check results as part of computation.
4123                 for (int j = 0; j < SPECIES.length(); j++) {
4124                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j]));
4125                 }
4126             }
4127         }
4128     }
4129 
4130 
4131     @Test(dataProvider = "longCompareOpProvider")
4132     static void GELongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4133         long[] a = fa.apply(SPECIES.length());
4134         long[] b = fb.apply(SPECIES.length());
4135 
4136         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4137             for (int i = 0; i < a.length; i += SPECIES.length()) {
4138                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4139                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4140                 VectorMask<Long> mv = av.compare(VectorOperators.GE, bv);
4141 
4142                 // Check results as part of computation.
4143                 for (int j = 0; j < SPECIES.length(); j++) {
4144                     Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j]));
4145                 }
4146             }
4147         }
4148     }
4149 
4150     @Test(dataProvider = "longCompareOpMaskProvider")

4153         long[] a = fa.apply(SPECIES.length());
4154         long[] b = fb.apply(SPECIES.length());
4155         boolean[] mask = fm.apply(SPECIES.length());
4156 
4157         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4158 
4159         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4160             for (int i = 0; i < a.length; i += SPECIES.length()) {
4161                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4162                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4163                 VectorMask<Long> mv = av.compare(VectorOperators.GE, bv, vmask);
4164 
4165                 // Check results as part of computation.
4166                 for (int j = 0; j < SPECIES.length(); j++) {
4167                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j]));
4168                 }
4169             }
4170         }
4171     }
4172 
4173 
4174 
4175     @Test(dataProvider = "longCompareOpProvider")
4176     static void UNSIGNED_LTLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4177         long[] a = fa.apply(SPECIES.length());
4178         long[] b = fb.apply(SPECIES.length());
4179 
4180         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4181             for (int i = 0; i < a.length; i += SPECIES.length()) {
4182                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4183                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4184                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_LT, bv);
4185 
4186                 // Check results as part of computation.
4187                 for (int j = 0; j < SPECIES.length(); j++) {
4188                     Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j]));
4189                 }
4190             }
4191         }
4192     }
4193 
4194 
4195 
4196     @Test(dataProvider = "longCompareOpMaskProvider")
4197     static void UNSIGNED_LTLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4198                                                 IntFunction<boolean[]> fm) {
4199         long[] a = fa.apply(SPECIES.length());
4200         long[] b = fb.apply(SPECIES.length());
4201         boolean[] mask = fm.apply(SPECIES.length());
4202 
4203         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4204 
4205         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4206             for (int i = 0; i < a.length; i += SPECIES.length()) {
4207                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4208                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4209                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_LT, bv, vmask);
4210 
4211                 // Check results as part of computation.
4212                 for (int j = 0; j < SPECIES.length(); j++) {
4213                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j]));
4214                 }
4215             }
4216         }
4217     }
4218 
4219 
4220 
4221 
4222     @Test(dataProvider = "longCompareOpProvider")
4223     static void UNSIGNED_GTLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4224         long[] a = fa.apply(SPECIES.length());
4225         long[] b = fb.apply(SPECIES.length());
4226 
4227         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4228             for (int i = 0; i < a.length; i += SPECIES.length()) {
4229                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4230                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4231                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_GT, bv);
4232 
4233                 // Check results as part of computation.
4234                 for (int j = 0; j < SPECIES.length(); j++) {
4235                     Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j]));
4236                 }
4237             }
4238         }
4239     }
4240 
4241 
4242 
4243     @Test(dataProvider = "longCompareOpMaskProvider")
4244     static void UNSIGNED_GTLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4245                                                 IntFunction<boolean[]> fm) {
4246         long[] a = fa.apply(SPECIES.length());
4247         long[] b = fb.apply(SPECIES.length());
4248         boolean[] mask = fm.apply(SPECIES.length());
4249 
4250         VectorMask<Long> 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                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4255                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4256                 VectorMask<Long> 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 
4267 
4268 
4269     @Test(dataProvider = "longCompareOpProvider")
4270     static void UNSIGNED_LELongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4271         long[] a = fa.apply(SPECIES.length());
4272         long[] b = fb.apply(SPECIES.length());
4273 
4274         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4275             for (int i = 0; i < a.length; i += SPECIES.length()) {
4276                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4277                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4278                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_LE, bv);
4279 
4280                 // Check results as part of computation.
4281                 for (int j = 0; j < SPECIES.length(); j++) {
4282                     Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j]));
4283                 }
4284             }
4285         }
4286     }
4287 
4288 
4289 
4290     @Test(dataProvider = "longCompareOpMaskProvider")
4291     static void UNSIGNED_LELongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4292                                                 IntFunction<boolean[]> fm) {
4293         long[] a = fa.apply(SPECIES.length());
4294         long[] b = fb.apply(SPECIES.length());
4295         boolean[] mask = fm.apply(SPECIES.length());
4296 
4297         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4298 
4299         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4300             for (int i = 0; i < a.length; i += SPECIES.length()) {
4301                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4302                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4303                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_LE, bv, vmask);
4304 
4305                 // Check results as part of computation.
4306                 for (int j = 0; j < SPECIES.length(); j++) {
4307                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j]));
4308                 }
4309             }
4310         }
4311     }
4312 
4313 
4314 
4315 
4316     @Test(dataProvider = "longCompareOpProvider")
4317     static void UNSIGNED_GELongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4318         long[] a = fa.apply(SPECIES.length());
4319         long[] b = fb.apply(SPECIES.length());
4320 
4321         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4322             for (int i = 0; i < a.length; i += SPECIES.length()) {
4323                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4324                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4325                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_GE, bv);
4326 
4327                 // Check results as part of computation.
4328                 for (int j = 0; j < SPECIES.length(); j++) {
4329                     Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j]));
4330                 }
4331             }
4332         }
4333     }
4334 
4335 
4336 
4337     @Test(dataProvider = "longCompareOpMaskProvider")
4338     static void UNSIGNED_GELongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4339                                                 IntFunction<boolean[]> fm) {
4340         long[] a = fa.apply(SPECIES.length());
4341         long[] b = fb.apply(SPECIES.length());
4342         boolean[] mask = fm.apply(SPECIES.length());
4343 
4344         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4345 
4346         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4347             for (int i = 0; i < a.length; i += SPECIES.length()) {
4348                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4349                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4350                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_GE, bv, vmask);
4351 
4352                 // Check results as part of computation.
4353                 for (int j = 0; j < SPECIES.length(); j++) {
4354                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j]));
4355                 }
4356             }
4357         }
4358     }
4359 
4360 
4361 
4362     @Test(dataProvider = "longCompareOpProvider")
4363     static void LTLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4364         long[] a = fa.apply(SPECIES.length());
4365         long[] b = fb.apply(SPECIES.length());
4366 
4367         for (int i = 0; i < a.length; i += SPECIES.length()) {
4368             LongVector av = LongVector.fromArray(SPECIES, a, i);
4369             VectorMask<Long> mv = av.compare(VectorOperators.LT, b[i]);
4370 
4371             // Check results as part of computation.
4372             for (int j = 0; j < SPECIES.length(); j++) {
4373                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
4374             }
4375         }
4376     }
4377 
4378 
4379     @Test(dataProvider = "longCompareOpMaskProvider")
4380     static void LTLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa,
4381                                 IntFunction<long[]> fb, IntFunction<boolean[]> fm) {
4382         long[] a = fa.apply(SPECIES.length());
4383         long[] b = fb.apply(SPECIES.length());
4384         boolean[] mask = fm.apply(SPECIES.length());
4385 
4386         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4387 
4388         for (int i = 0; i < a.length; i += SPECIES.length()) {
4389             LongVector av = LongVector.fromArray(SPECIES, a, i);
4390             VectorMask<Long> mv = av.compare(VectorOperators.LT, b[i], vmask);
4391 
4392             // Check results as part of computation.
4393             for (int j = 0; j < SPECIES.length(); j++) {
4394                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i]));
4395             }
4396         }
4397     }
4398 
4399 
4400     @Test(dataProvider = "longCompareOpProvider")
4401     static void EQLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4402         long[] a = fa.apply(SPECIES.length());
4403         long[] b = fb.apply(SPECIES.length());
4404 
4405         for (int i = 0; i < a.length; i += SPECIES.length()) {
4406             LongVector av = LongVector.fromArray(SPECIES, a, i);
4407             VectorMask<Long> mv = av.compare(VectorOperators.EQ, b[i]);
4408 
4409             // Check results as part of computation.
4410             for (int j = 0; j < SPECIES.length(); j++) {
4411                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
4412             }
4413         }
4414     }
4415 
4416 
4417     @Test(dataProvider = "longCompareOpMaskProvider")
4418     static void EQLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa,
4419                                 IntFunction<long[]> fb, IntFunction<boolean[]> fm) {
4420         long[] a = fa.apply(SPECIES.length());
4421         long[] b = fb.apply(SPECIES.length());
4422         boolean[] mask = fm.apply(SPECIES.length());
4423 
4424         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4425 
4426         for (int i = 0; i < a.length; i += SPECIES.length()) {
4427             LongVector av = LongVector.fromArray(SPECIES, a, i);
4428             VectorMask<Long> mv = av.compare(VectorOperators.EQ, b[i], vmask);
4429 
4430             // Check results as part of computation.
4431             for (int j = 0; j < SPECIES.length(); j++) {
4432                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i]));
4433             }
4434         }
4435     }
4436 

4476         assertRearrangeArraysEquals(r, a, order, SPECIES.length());
4477     }
4478 
4479     @Test(dataProvider = "longUnaryOpShuffleMaskProvider")
4480     static void RearrangeLongMaxVectorTestsMaskedSmokeTest(IntFunction<long[]> fa,
4481                                                           BiFunction<Integer,Integer,int[]> fs,
4482                                                           IntFunction<boolean[]> fm) {
4483         long[] a = fa.apply(SPECIES.length());
4484         int[] order = fs.apply(a.length, SPECIES.length());
4485         long[] r = fr.apply(SPECIES.length());
4486         boolean[] mask = fm.apply(SPECIES.length());
4487         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4488 
4489         for (int i = 0; i < a.length; i += SPECIES.length()) {
4490             LongVector av = LongVector.fromArray(SPECIES, a, i);
4491             av.rearrange(VectorShuffle.fromArray(SPECIES, order, i), vmask).intoArray(r, i);
4492         }
4493 
4494         assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
4495     }





































4496     @Test(dataProvider = "longUnaryOpProvider")
4497     static void getLongMaxVectorTests(IntFunction<long[]> fa) {
4498         long[] a = fa.apply(SPECIES.length());
4499         long[] r = fr.apply(SPECIES.length());
4500 
4501         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4502             for (int i = 0; i < a.length; i += SPECIES.length()) {
4503                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4504                 int num_lanes = SPECIES.length();
4505                 // Manually unroll because full unroll happens after intrinsification.
4506                 // Unroll is needed because get intrinsic requires for index to be a known constant.
4507                 if (num_lanes == 1) {
4508                     r[i]=av.lane(0);
4509                 } else if (num_lanes == 2) {
4510                     r[i]=av.lane(0);
4511                     r[i+1]=av.lane(1);
4512                 } else if (num_lanes == 4) {
4513                     r[i]=av.lane(0);
4514                     r[i+1]=av.lane(1);
4515                     r[i+2]=av.lane(2);

4646             }
4647         }
4648 
4649         assertArraysEquals(r, a, LongMaxVectorTests::get);
4650     }
4651 
4652     @Test(dataProvider = "longUnaryOpProvider")
4653     static void BroadcastLongMaxVectorTests(IntFunction<long[]> fa) {
4654         long[] a = fa.apply(SPECIES.length());
4655         long[] r = new long[a.length];
4656 
4657         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4658             for (int i = 0; i < a.length; i += SPECIES.length()) {
4659                 LongVector.broadcast(SPECIES, a[i]).intoArray(r, i);
4660             }
4661         }
4662 
4663         assertBroadcastArraysEquals(r, a);
4664     }
4665 
4666 
4667 
4668 
4669 
4670     @Test(dataProvider = "longUnaryOpProvider")
4671     static void ZeroLongMaxVectorTests(IntFunction<long[]> fa) {
4672         long[] a = fa.apply(SPECIES.length());
4673         long[] r = new long[a.length];
4674 
4675         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4676             for (int i = 0; i < a.length; i += SPECIES.length()) {
4677                 LongVector.zero(SPECIES).intoArray(a, i);
4678             }
4679         }
4680 
4681         Assert.assertEquals(a, r);
4682     }
4683 
4684 
4685 
4686 
4687     static long[] sliceUnary(long[] a, int origin, int idx) {
4688         long[] res = new long[SPECIES.length()];
4689         for (int i = 0; i < SPECIES.length(); i++){
4690             if(i+origin < SPECIES.length())
4691                 res[i] = a[idx+i+origin];
4692             else
4693                 res[i] = (long)0;
4694         }
4695         return res;
4696     }
4697 
4698     @Test(dataProvider = "longUnaryOpProvider")
4699     static void sliceUnaryLongMaxVectorTests(IntFunction<long[]> fa) {
4700         long[] a = fa.apply(SPECIES.length());
4701         long[] r = new long[a.length];
4702         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4703         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4704             for (int i = 0; i < a.length; i += SPECIES.length()) {
4705                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4706                 av.slice(origin).intoArray(r, i);
4707             }
4708         }
4709 
4710         assertArraysEquals(r, a, origin, LongMaxVectorTests::sliceUnary);
4711     }

4712     static long[] sliceBinary(long[] a, long[] b, int origin, int idx) {
4713         long[] res = new long[SPECIES.length()];
4714         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4715             if(i+origin < SPECIES.length())
4716                 res[i] = a[idx+i+origin];
4717             else {
4718                 res[i] = b[idx+j];
4719                 j++;
4720             }
4721         }
4722         return res;
4723     }
4724 
4725     @Test(dataProvider = "longBinaryOpProvider")
4726     static void sliceBinaryLongMaxVectorTestsBinary(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4727         long[] a = fa.apply(SPECIES.length());
4728         long[] b = fb.apply(SPECIES.length());
4729         long[] r = new long[a.length];
4730         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4731         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4732             for (int i = 0; i < a.length; i += SPECIES.length()) {
4733                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4734                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4735                 av.slice(origin, bv).intoArray(r, i);
4736             }
4737         }
4738 
4739         assertArraysEquals(r, a, b, origin, LongMaxVectorTests::sliceBinary);
4740     }

4741     static long[] slice(long[] a, long[] b, int origin, boolean[] mask, int idx) {
4742         long[] res = new long[SPECIES.length()];
4743         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4744             if(i+origin < SPECIES.length())
4745                 res[i] = mask[i] ? a[idx+i+origin] : (long)0;
4746             else {
4747                 res[i] = mask[i] ? b[idx+j] : (long)0;
4748                 j++;
4749             }
4750         }
4751         return res;
4752     }
4753 
4754     @Test(dataProvider = "longBinaryOpMaskProvider")
4755     static void sliceLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4756     IntFunction<boolean[]> fm) {
4757         long[] a = fa.apply(SPECIES.length());
4758         long[] b = fb.apply(SPECIES.length());
4759         boolean[] mask = fm.apply(SPECIES.length());
4760         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4761 
4762         long[] r = new long[a.length];
4763         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4764         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4765             for (int i = 0; i < a.length; i += SPECIES.length()) {
4766                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4767                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4768                 av.slice(origin, bv, vmask).intoArray(r, i);
4769             }
4770         }
4771 
4772         assertArraysEquals(r, a, b, origin, mask, LongMaxVectorTests::slice);
4773     }

4774     static long[] unsliceUnary(long[] a, int origin, int idx) {
4775         long[] res = new long[SPECIES.length()];
4776         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4777             if(i < origin)
4778                 res[i] = (long)0;
4779             else {
4780                 res[i] = a[idx+j];
4781                 j++;
4782             }
4783         }
4784         return res;
4785     }
4786 
4787     @Test(dataProvider = "longUnaryOpProvider")
4788     static void unsliceUnaryLongMaxVectorTests(IntFunction<long[]> fa) {
4789         long[] a = fa.apply(SPECIES.length());
4790         long[] r = new long[a.length];
4791         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4792         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4793             for (int i = 0; i < a.length; i += SPECIES.length()) {
4794                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4795                 av.unslice(origin).intoArray(r, i);
4796             }
4797         }
4798 
4799         assertArraysEquals(r, a, origin, LongMaxVectorTests::unsliceUnary);
4800     }

4801     static long[] unsliceBinary(long[] a, long[] b, int origin, int part, int idx) {
4802         long[] res = new long[SPECIES.length()];
4803         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4804             if (part == 0) {
4805                 if (i < origin)
4806                     res[i] = b[idx+i];
4807                 else {
4808                     res[i] = a[idx+j];
4809                     j++;
4810                 }
4811             } else if (part == 1) {
4812                 if (i < origin)
4813                     res[i] = a[idx+SPECIES.length()-origin+i];
4814                 else {
4815                     res[i] = b[idx+origin+j];
4816                     j++;
4817                 }
4818             }
4819         }
4820         return res;
4821     }
4822 
4823     @Test(dataProvider = "longBinaryOpProvider")
4824     static void unsliceBinaryLongMaxVectorTestsBinary(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4825         long[] a = fa.apply(SPECIES.length());
4826         long[] b = fb.apply(SPECIES.length());
4827         long[] r = new long[a.length];
4828         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4829         int part = (new java.util.Random()).nextInt(2);
4830         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4831             for (int i = 0; i < a.length; i += SPECIES.length()) {
4832                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4833                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4834                 av.unslice(origin, bv, part).intoArray(r, i);
4835             }
4836         }
4837 
4838         assertArraysEquals(r, a, b, origin, part, LongMaxVectorTests::unsliceBinary);
4839     }

4840     static long[] unslice(long[] a, long[] b, int origin, int part, boolean[] mask, int idx) {
4841         long[] res = new long[SPECIES.length()];
4842         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4843             if(i+origin < SPECIES.length())
4844                 res[i] = b[idx+i+origin];
4845             else {
4846                 res[i] = b[idx+j];
4847                 j++;
4848             }
4849         }
4850         for (int i = 0; i < SPECIES.length(); i++){
4851             res[i] = mask[i] ? a[idx+i] : res[i];
4852         }
4853         long[] res1 = new long[SPECIES.length()];
4854         if (part == 0) {
4855             for (int i = 0, j = 0; i < SPECIES.length(); i++){
4856                 if (i < origin)
4857                     res1[i] = b[idx+i];
4858                 else {
4859                    res1[i] = res[j];

4877     static void unsliceLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4878     IntFunction<boolean[]> fm) {
4879         long[] a = fa.apply(SPECIES.length());
4880         long[] b = fb.apply(SPECIES.length());
4881         boolean[] mask = fm.apply(SPECIES.length());
4882         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4883         long[] r = new long[a.length];
4884         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4885         int part = (new java.util.Random()).nextInt(2);
4886         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4887             for (int i = 0; i < a.length; i += SPECIES.length()) {
4888                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4889                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4890                 av.unslice(origin, bv, part, vmask).intoArray(r, i);
4891             }
4892         }
4893 
4894         assertArraysEquals(r, a, b, origin, part, mask, LongMaxVectorTests::unslice);
4895     }
4896 
4897 
4898 
4899 
4900 
4901 
4902 
4903 
4904 
4905 
4906 
4907 
4908 
4909 
4910 
4911 
4912 
4913 
4914 
4915 
4916 
4917 
4918 
4919     static long BITWISE_BLEND(long a, long b, long c) {
4920         return (long)((a&~(c))|(b&c));
4921     }

4922     static long bitwiseBlend(long a, long b, long c) {
4923         return (long)((a&~(c))|(b&c));
4924     }
4925 
4926 
4927     @Test(dataProvider = "longTernaryOpProvider")
4928     static void BITWISE_BLENDLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
4929         long[] a = fa.apply(SPECIES.length());
4930         long[] b = fb.apply(SPECIES.length());
4931         long[] c = fc.apply(SPECIES.length());
4932         long[] r = fr.apply(SPECIES.length());
4933 
4934         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4935             for (int i = 0; i < a.length; i += SPECIES.length()) {
4936                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4937                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4938                 LongVector cv = LongVector.fromArray(SPECIES, c, i);
4939                 av.lanewise(VectorOperators.BITWISE_BLEND, bv, cv).intoArray(r, i);
4940             }
4941         }
4942 
4943         assertArraysEquals(r, a, b, c, LongMaxVectorTests::BITWISE_BLEND);
4944     }

4945     @Test(dataProvider = "longTernaryOpProvider")
4946     static void bitwiseBlendLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
4947         long[] a = fa.apply(SPECIES.length());
4948         long[] b = fb.apply(SPECIES.length());
4949         long[] c = fc.apply(SPECIES.length());
4950         long[] r = fr.apply(SPECIES.length());
4951 
4952         for (int i = 0; i < a.length; i += SPECIES.length()) {
4953             LongVector av = LongVector.fromArray(SPECIES, a, i);
4954             LongVector bv = LongVector.fromArray(SPECIES, b, i);
4955             LongVector cv = LongVector.fromArray(SPECIES, c, i);
4956             av.bitwiseBlend(bv, cv).intoArray(r, i);
4957         }
4958 
4959         assertArraysEquals(r, a, b, c, LongMaxVectorTests::bitwiseBlend);
4960     }
4961 
4962 
4963     @Test(dataProvider = "longTernaryOpMaskProvider")
4964     static void BITWISE_BLENDLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4965                                           IntFunction<long[]> fc, IntFunction<boolean[]> fm) {
4966         long[] a = fa.apply(SPECIES.length());
4967         long[] b = fb.apply(SPECIES.length());
4968         long[] c = fc.apply(SPECIES.length());
4969         long[] r = fr.apply(SPECIES.length());
4970         boolean[] mask = fm.apply(SPECIES.length());
4971         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4972 
4973         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4974             for (int i = 0; i < a.length; i += SPECIES.length()) {
4975                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4976                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4977                 LongVector cv = LongVector.fromArray(SPECIES, c, i);
4978                 av.lanewise(VectorOperators.BITWISE_BLEND, bv, cv, vmask).intoArray(r, i);
4979             }
4980         }
4981 
4982         assertArraysEquals(r, a, b, c, mask, LongMaxVectorTests::BITWISE_BLEND);
4983     }
4984 
4985 
4986 
4987 
4988     @Test(dataProvider = "longTernaryOpProvider")
4989     static void BITWISE_BLENDLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
4990         long[] a = fa.apply(SPECIES.length());
4991         long[] b = fb.apply(SPECIES.length());
4992         long[] c = fc.apply(SPECIES.length());
4993         long[] r = fr.apply(SPECIES.length());
4994 
4995         for (int i = 0; i < a.length; i += SPECIES.length()) {
4996             LongVector av = LongVector.fromArray(SPECIES, a, i);
4997             LongVector bv = LongVector.fromArray(SPECIES, b, i);
4998             av.lanewise(VectorOperators.BITWISE_BLEND, bv, c[i]).intoArray(r, i);
4999         }
5000         assertBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::BITWISE_BLEND);
5001     }
5002 
5003     @Test(dataProvider = "longTernaryOpProvider")
5004     static void BITWISE_BLENDLongMaxVectorTestsAltBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
5005         long[] a = fa.apply(SPECIES.length());
5006         long[] b = fb.apply(SPECIES.length());
5007         long[] c = fc.apply(SPECIES.length());
5008         long[] r = fr.apply(SPECIES.length());
5009 
5010         for (int i = 0; i < a.length; i += SPECIES.length()) {
5011             LongVector av = LongVector.fromArray(SPECIES, a, i);
5012             LongVector cv = LongVector.fromArray(SPECIES, c, i);
5013             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], cv).intoArray(r, i);
5014         }
5015         assertAltBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::BITWISE_BLEND);
5016     }

5017     @Test(dataProvider = "longTernaryOpProvider")
5018     static void bitwiseBlendLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
5019         long[] a = fa.apply(SPECIES.length());
5020         long[] b = fb.apply(SPECIES.length());
5021         long[] c = fc.apply(SPECIES.length());
5022         long[] r = fr.apply(SPECIES.length());
5023 
5024         for (int i = 0; i < a.length; i += SPECIES.length()) {
5025             LongVector av = LongVector.fromArray(SPECIES, a, i);
5026             LongVector bv = LongVector.fromArray(SPECIES, b, i);
5027             av.bitwiseBlend(bv, c[i]).intoArray(r, i);
5028         }
5029         assertBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::bitwiseBlend);
5030     }
5031 
5032     @Test(dataProvider = "longTernaryOpProvider")
5033     static void bitwiseBlendLongMaxVectorTestsAltBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
5034         long[] a = fa.apply(SPECIES.length());
5035         long[] b = fb.apply(SPECIES.length());
5036         long[] c = fc.apply(SPECIES.length());
5037         long[] r = fr.apply(SPECIES.length());
5038 
5039         for (int i = 0; i < a.length; i += SPECIES.length()) {
5040             LongVector av = LongVector.fromArray(SPECIES, a, i);
5041             LongVector cv = LongVector.fromArray(SPECIES, c, i);
5042             av.bitwiseBlend(b[i], cv).intoArray(r, i);
5043         }
5044         assertAltBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::bitwiseBlend);
5045     }
5046 
5047 
5048     @Test(dataProvider = "longTernaryOpMaskProvider")
5049     static void BITWISE_BLENDLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
5050                                           IntFunction<long[]> fc, IntFunction<boolean[]> fm) {
5051         long[] a = fa.apply(SPECIES.length());
5052         long[] b = fb.apply(SPECIES.length());
5053         long[] c = fc.apply(SPECIES.length());
5054         long[] r = fr.apply(SPECIES.length());
5055         boolean[] mask = fm.apply(SPECIES.length());
5056         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5057 
5058         for (int i = 0; i < a.length; i += SPECIES.length()) {
5059             LongVector av = LongVector.fromArray(SPECIES, a, i);
5060             LongVector bv = LongVector.fromArray(SPECIES, b, i);
5061             av.lanewise(VectorOperators.BITWISE_BLEND, bv, c[i], vmask).intoArray(r, i);
5062         }
5063 
5064         assertBroadcastArraysEquals(r, a, b, c, mask, LongMaxVectorTests::BITWISE_BLEND);
5065     }
5066 
5067     @Test(dataProvider = "longTernaryOpMaskProvider")
5068     static void BITWISE_BLENDLongMaxVectorTestsAltBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
5069                                           IntFunction<long[]> fc, IntFunction<boolean[]> fm) {
5070         long[] a = fa.apply(SPECIES.length());
5071         long[] b = fb.apply(SPECIES.length());
5072         long[] c = fc.apply(SPECIES.length());
5073         long[] r = fr.apply(SPECIES.length());
5074         boolean[] mask = fm.apply(SPECIES.length());
5075         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5076 
5077         for (int i = 0; i < a.length; i += SPECIES.length()) {
5078             LongVector av = LongVector.fromArray(SPECIES, a, i);
5079             LongVector cv = LongVector.fromArray(SPECIES, c, i);
5080             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], cv, vmask).intoArray(r, i);
5081         }
5082 
5083         assertAltBroadcastArraysEquals(r, a, b, c, mask, LongMaxVectorTests::BITWISE_BLEND);
5084     }
5085 
5086 
5087 
5088 
5089     @Test(dataProvider = "longTernaryOpProvider")
5090     static void BITWISE_BLENDLongMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
5091         long[] a = fa.apply(SPECIES.length());
5092         long[] b = fb.apply(SPECIES.length());
5093         long[] c = fc.apply(SPECIES.length());
5094         long[] r = fr.apply(SPECIES.length());
5095 
5096         for (int i = 0; i < a.length; i += SPECIES.length()) {
5097             LongVector av = LongVector.fromArray(SPECIES, a, i);
5098             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], c[i]).intoArray(r, i);
5099         }
5100 
5101         assertDoubleBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::BITWISE_BLEND);
5102     }

5103     @Test(dataProvider = "longTernaryOpProvider")
5104     static void bitwiseBlendLongMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
5105         long[] a = fa.apply(SPECIES.length());
5106         long[] b = fb.apply(SPECIES.length());
5107         long[] c = fc.apply(SPECIES.length());
5108         long[] r = fr.apply(SPECIES.length());
5109 
5110         for (int i = 0; i < a.length; i += SPECIES.length()) {
5111             LongVector av = LongVector.fromArray(SPECIES, a, i);
5112             av.bitwiseBlend(b[i], c[i]).intoArray(r, i);
5113         }
5114 
5115         assertDoubleBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::bitwiseBlend);
5116     }
5117 
5118 
5119     @Test(dataProvider = "longTernaryOpMaskProvider")
5120     static void BITWISE_BLENDLongMaxVectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
5121                                           IntFunction<long[]> fc, IntFunction<boolean[]> fm) {
5122         long[] a = fa.apply(SPECIES.length());
5123         long[] b = fb.apply(SPECIES.length());
5124         long[] c = fc.apply(SPECIES.length());
5125         long[] r = fr.apply(SPECIES.length());
5126         boolean[] mask = fm.apply(SPECIES.length());
5127         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5128 
5129         for (int i = 0; i < a.length; i += SPECIES.length()) {
5130             LongVector av = LongVector.fromArray(SPECIES, a, i);
5131             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], c[i], vmask).intoArray(r, i);
5132         }
5133 
5134         assertDoubleBroadcastArraysEquals(r, a, b, c, mask, LongMaxVectorTests::BITWISE_BLEND);
5135     }
5136 
5137 
5138     static long NEG(long a) {
5139         return (long)(-((long)a));
5140     }
5141 
5142     static long neg(long a) {
5143         return (long)(-((long)a));
5144     }
5145 
5146     @Test(dataProvider = "longUnaryOpProvider")
5147     static void NEGLongMaxVectorTests(IntFunction<long[]> fa) {
5148         long[] a = fa.apply(SPECIES.length());
5149         long[] r = fr.apply(SPECIES.length());
5150 
5151         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5152             for (int i = 0; i < a.length; i += SPECIES.length()) {
5153                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5154                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
5155             }
5156         }
5157 

5230     }
5231 
5232     @Test(dataProvider = "longUnaryOpMaskProvider")
5233     static void ABSMaskedLongMaxVectorTests(IntFunction<long[]> fa,
5234                                                 IntFunction<boolean[]> fm) {
5235         long[] a = fa.apply(SPECIES.length());
5236         long[] r = fr.apply(SPECIES.length());
5237         boolean[] mask = fm.apply(SPECIES.length());
5238         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5239 
5240         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5241             for (int i = 0; i < a.length; i += SPECIES.length()) {
5242                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5243                 av.lanewise(VectorOperators.ABS, vmask).intoArray(r, i);
5244             }
5245         }
5246 
5247         assertArraysEquals(r, a, mask, LongMaxVectorTests::ABS);
5248     }
5249 
5250 
5251     static long NOT(long a) {
5252         return (long)(~((long)a));
5253     }
5254 
5255     static long not(long a) {
5256         return (long)(~((long)a));
5257     }
5258 
5259 
5260 
5261     @Test(dataProvider = "longUnaryOpProvider")
5262     static void NOTLongMaxVectorTests(IntFunction<long[]> fa) {
5263         long[] a = fa.apply(SPECIES.length());
5264         long[] r = fr.apply(SPECIES.length());
5265 
5266         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5267             for (int i = 0; i < a.length; i += SPECIES.length()) {
5268                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5269                 av.lanewise(VectorOperators.NOT).intoArray(r, i);
5270             }
5271         }
5272 
5273         assertArraysEquals(r, a, LongMaxVectorTests::NOT);
5274     }
5275 
5276     @Test(dataProvider = "longUnaryOpProvider")
5277     static void notLongMaxVectorTests(IntFunction<long[]> fa) {
5278         long[] a = fa.apply(SPECIES.length());
5279         long[] r = fr.apply(SPECIES.length());
5280 
5281         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5282             for (int i = 0; i < a.length; i += SPECIES.length()) {
5283                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5284                 av.not().intoArray(r, i);
5285             }
5286         }
5287 
5288         assertArraysEquals(r, a, LongMaxVectorTests::not);
5289     }
5290 
5291 
5292 
5293     @Test(dataProvider = "longUnaryOpMaskProvider")
5294     static void NOTMaskedLongMaxVectorTests(IntFunction<long[]> fa,
5295                                                 IntFunction<boolean[]> fm) {
5296         long[] a = fa.apply(SPECIES.length());
5297         long[] r = fr.apply(SPECIES.length());
5298         boolean[] mask = fm.apply(SPECIES.length());
5299         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5300 
5301         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5302             for (int i = 0; i < a.length; i += SPECIES.length()) {
5303                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5304                 av.lanewise(VectorOperators.NOT, vmask).intoArray(r, i);
5305             }
5306         }
5307 
5308         assertArraysEquals(r, a, mask, LongMaxVectorTests::NOT);
5309     }
5310 
5311 
5312 
5313     static long ZOMO(long a) {
5314         return (long)((a==0?0:-1));
5315     }
5316 
5317 
5318 
5319     @Test(dataProvider = "longUnaryOpProvider")
5320     static void ZOMOLongMaxVectorTests(IntFunction<long[]> fa) {
5321         long[] a = fa.apply(SPECIES.length());
5322         long[] r = fr.apply(SPECIES.length());
5323 
5324         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5325             for (int i = 0; i < a.length; i += SPECIES.length()) {
5326                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5327                 av.lanewise(VectorOperators.ZOMO).intoArray(r, i);
5328             }
5329         }
5330 
5331         assertArraysEquals(r, a, LongMaxVectorTests::ZOMO);
5332     }
5333 
5334 
5335 
5336     @Test(dataProvider = "longUnaryOpMaskProvider")
5337     static void ZOMOMaskedLongMaxVectorTests(IntFunction<long[]> fa,
5338                                                 IntFunction<boolean[]> fm) {
5339         long[] a = fa.apply(SPECIES.length());
5340         long[] r = fr.apply(SPECIES.length());
5341         boolean[] mask = fm.apply(SPECIES.length());
5342         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5343 
5344         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5345             for (int i = 0; i < a.length; i += SPECIES.length()) {
5346                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5347                 av.lanewise(VectorOperators.ZOMO, vmask).intoArray(r, i);
5348             }
5349         }
5350 
5351         assertArraysEquals(r, a, mask, LongMaxVectorTests::ZOMO);
5352     }
5353 



5354 




5355 









5356 





































































































































































5357 
5358     @Test(dataProvider = "longCompareOpProvider")
5359     static void ltLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
5360         long[] a = fa.apply(SPECIES.length());
5361         long[] b = fb.apply(SPECIES.length());
5362 
5363         for (int i = 0; i < a.length; i += SPECIES.length()) {
5364             LongVector av = LongVector.fromArray(SPECIES, a, i);
5365             VectorMask<Long> mv = av.lt(b[i]);
5366 
5367             // Check results as part of computation.
5368             for (int j = 0; j < SPECIES.length(); j++) {
5369                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
5370             }
5371         }
5372     }
5373 
5374     @Test(dataProvider = "longCompareOpProvider")
5375     static void eqLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
5376         long[] a = fa.apply(SPECIES.length());

5673             }
5674         }
5675         return i - idx;
5676     }
5677 
5678     @Test(dataProvider = "maskProvider")
5679     static void maskFirstTrueLongMaxVectorTestsSmokeTest(IntFunction<boolean[]> fa) {
5680         boolean[] a = fa.apply(SPECIES.length());
5681         int[] r = new int[a.length];
5682 
5683         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
5684             for (int i = 0; i < a.length; i += SPECIES.length()) {
5685                 var vmask = SPECIES.loadMask(a, i);
5686                 r[i] = vmask.firstTrue();
5687             }
5688         }
5689 
5690         assertMaskReductionArraysEquals(r, a, LongMaxVectorTests::maskFirstTrue);
5691     }
5692 

















5693 
5694     @DataProvider
5695     public static Object[][] offsetProvider() {
5696         return new Object[][]{
5697                 {0},
5698                 {-1},
5699                 {+1},
5700                 {+2},
5701                 {-2},
5702         };
5703     }
5704 
5705     @Test(dataProvider = "offsetProvider")
5706     static void indexInRangeLongMaxVectorTestsSmokeTest(int offset) {
5707         int limit = SPECIES.length() * BUFFER_REPS;
5708         for (int i = 0; i < limit; i += SPECIES.length()) {
5709             var actualMask = SPECIES.indexInRange(i + offset, limit);
5710             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
5711             assert(actualMask.equals(expectedMask));
5712             for (int j = 0; j < SPECIES.length(); j++)  {
5713                 int index = i + j + offset;
5714                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
5715             }
5716         }
5717     }
5718 














5719     @DataProvider
5720     public static Object[][] lengthProvider() {
5721         return new Object[][]{
5722                 {0},
5723                 {1},
5724                 {32},
5725                 {37},
5726                 {1024},
5727                 {1024+1},
5728                 {1024+5},
5729         };
5730     }
5731 
5732     @Test(dataProvider = "lengthProvider")
5733     static void loopBoundLongMaxVectorTestsSmokeTest(int length) {
5734         int actualLoopBound = SPECIES.loopBound(length);
5735         int expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
5736         Assert.assertEquals(actualLoopBound, expectedLoopBound);
5737     }
5738 








5739     @Test
5740     static void ElementSizeLongMaxVectorTestsSmokeTest() {
5741         LongVector av = LongVector.zero(SPECIES);
5742         int elsize = av.elementSize();
5743         Assert.assertEquals(elsize, Long.SIZE);
5744     }
5745 
5746     @Test
5747     static void VectorShapeLongMaxVectorTestsSmokeTest() {
5748         LongVector av = LongVector.zero(SPECIES);
5749         VectorShape vsh = av.shape();
5750         assert(vsh.equals(VectorShape.S_Max_BIT));
5751     }
5752 
5753     @Test
5754     static void ShapeWithLanesLongMaxVectorTestsSmokeTest() {
5755         LongVector av = LongVector.zero(SPECIES);
5756         VectorShape vsh = av.shape();
5757         VectorSpecies species = vsh.withLanes(long.class);
5758         assert(species.equals(SPECIES));

5781         LongVector av = LongVector.zero(SPECIES);
5782         VectorSpecies species = av.species().withLanes(long.class);
5783         assert(species.equals(SPECIES));
5784     }
5785 
5786     @Test
5787     static void WithShapeLongMaxVectorTestsSmokeTest() {
5788         LongVector av = LongVector.zero(SPECIES);
5789         VectorShape vsh = av.shape();
5790         VectorSpecies species = av.species().withShape(vsh);
5791         assert(species.equals(SPECIES));
5792     }
5793 
5794     @Test
5795     static void MaskAllTrueLongMaxVectorTestsSmokeTest() {
5796         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5797           Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length()));
5798         }
5799     }
5800 }
5801 

 206             } else {
 207                 Assert.assertEquals(r[i], a[i], "at index #" + i);
 208             }
 209         }
 210     }
 211 
 212     static void assertRearrangeArraysEquals(long[] r, long[] a, int[] order, int vector_len) {
 213         int i = 0, j = 0;
 214         try {
 215             for (; i < a.length; i += vector_len) {
 216                 for (j = 0; j < vector_len; j++) {
 217                     Assert.assertEquals(r[i+j], a[i+order[i+j]]);
 218                 }
 219             }
 220         } catch (AssertionError e) {
 221             int idx = i + j;
 222             Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]);
 223         }
 224     }
 225 
 226     static void assertcompressArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
 227         int i = 0, j = 0, k = 0;
 228         try {
 229             for (; i < a.length; i += vector_len) {
 230                 k = 0;
 231                 for (j = 0; j < vector_len; j++) {
 232                     if (m[(i + j) % SPECIES.length()]) {
 233                         Assert.assertEquals(r[i + k], a[i + j]);
 234                         k++;
 235                     }
 236                 }
 237                 for (; k < vector_len; k++) {
 238                     Assert.assertEquals(r[i + k], (long)0);
 239                 }
 240             }
 241         } catch (AssertionError e) {
 242             int idx = i + k;
 243             if (m[(i + j) % SPECIES.length()]) {
 244                 Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
 245             } else {
 246                 Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
 247             }
 248         }
 249     }
 250 
 251     static void assertexpandArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
 252         int i = 0, j = 0, k = 0;
 253         try {
 254             for (; i < a.length; i += vector_len) {
 255                 k = 0;
 256                 for (j = 0; j < vector_len; j++) {
 257                     if (m[(i + j) % SPECIES.length()]) {
 258                         Assert.assertEquals(r[i + j], a[i + k]);
 259                         k++;
 260                     } else {
 261                         Assert.assertEquals(r[i + j], (long)0);
 262                     }
 263                 }
 264             }
 265         } catch (AssertionError e) {
 266             int idx = i + j;
 267             if (m[idx % SPECIES.length()]) {
 268                 Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
 269             } else {
 270                 Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
 271             }
 272         }
 273     }
 274 
 275     static void assertSelectFromArraysEquals(long[] r, long[] a, long[] order, int vector_len) {
 276         int i = 0, j = 0;
 277         try {
 278             for (; i < a.length; i += vector_len) {
 279                 for (j = 0; j < vector_len; j++) {
 280                     Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]);
 281                 }
 282             }
 283         } catch (AssertionError e) {
 284             int idx = i + j;
 285             Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]);
 286         }
 287     }
 288 
 289     static void assertRearrangeArraysEquals(long[] r, long[] a, int[] order, boolean[] mask, int vector_len) {
 290         int i = 0, j = 0;
 291         try {
 292             for (; i < a.length; i += vector_len) {
 293                 for (j = 0; j < vector_len; j++) {
 294                     if (mask[j % SPECIES.length()])

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

 931     static long bits(long e) {
 932         return  e;
 933     }
 934 
 935     static final List<IntFunction<long[]>> LONG_GENERATORS = List.of(
 936             withToString("long[-i * 5]", (int s) -> {
 937                 return fill(s * BUFFER_REPS,
 938                             i -> (long)(-i * 5));
 939             }),
 940             withToString("long[i * 5]", (int s) -> {
 941                 return fill(s * BUFFER_REPS,
 942                             i -> (long)(i * 5));
 943             }),
 944             withToString("long[i + 1]", (int s) -> {
 945                 return fill(s * BUFFER_REPS,
 946                             i -> (((long)(i + 1) == 0) ? 1 : (long)(i + 1)));
 947             }),
 948             withToString("long[cornerCaseValue(i)]", (int s) -> {
 949                 return fill(s * BUFFER_REPS,
 950                             i -> cornerCaseValue(i));

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

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

1087 
1088     @DataProvider
1089     public Object[][] longUnaryOpSelectFromProvider() {
1090         return LONG_SHUFFLE_GENERATORS.stream().
1091                 flatMap(fs -> LONG_GENERATORS.stream().map(fa -> {
1092                     return new Object[] {fa, fs};
1093                 })).
1094                 toArray(Object[][]::new);
1095     }
1096 
1097     @DataProvider
1098     public Object[][] longUnaryOpSelectFromMaskProvider() {
1099         return BOOLEAN_MASK_GENERATORS.stream().
1100                 flatMap(fm -> LONG_SHUFFLE_GENERATORS.stream().
1101                     flatMap(fs -> LONG_GENERATORS.stream().map(fa -> {
1102                         return new Object[] {fa, fs, fm};
1103                 }))).
1104                 toArray(Object[][]::new);
1105     }
1106 

1107     static final List<IntFunction<long[]>> LONG_COMPARE_GENERATORS = List.of(
1108             withToString("long[i]", (int s) -> {
1109                 return fill(s * BUFFER_REPS,
1110                             i -> (long)i);
1111             }),
1112             withToString("long[i - length / 2]", (int s) -> {
1113                 return fill(s * BUFFER_REPS,
1114                             i -> (long)(i - (s * BUFFER_REPS / 2)));
1115             }),
1116             withToString("long[i + 1]", (int s) -> {
1117                 return fill(s * BUFFER_REPS,
1118                             i -> (long)(i + 1));
1119             }),
1120             withToString("long[i - 2]", (int s) -> {
1121                 return fill(s * BUFFER_REPS,
1122                             i -> (long)(i - 2));
1123             }),
1124             withToString("long[zigZag(i)]", (int s) -> {
1125                 return fill(s * BUFFER_REPS,
1126                             i -> i%3 == 0 ? (long)i : (i%3 == 1 ? (long)(i + 1) : (long)(i - 2)));

1198                 return Long.MAX_VALUE;
1199             default:
1200                 return (long)0;
1201         }
1202     }
1203 
1204     static long get(long[] a, int i) {
1205         return (long) a[i];
1206     }
1207 
1208     static final IntFunction<long[]> fr = (vl) -> {
1209         int length = BUFFER_REPS * vl;
1210         return new long[length];
1211     };
1212 
1213     static final IntFunction<boolean[]> fmr = (vl) -> {
1214         int length = BUFFER_REPS * vl;
1215         return new boolean[length];
1216     };
1217 

1218     static void replaceZero(long[] a, long v) {
1219         for (int i = 0; i < a.length; i++) {
1220             if (a[i] == 0) {
1221                 a[i] = v;
1222             }
1223         }
1224     }
1225 
1226     static void replaceZero(long[] a, boolean[] mask, long v) {
1227         for (int i = 0; i < a.length; i++) {
1228             if (mask[i % mask.length] && a[i] == 0) {
1229                 a[i] = v;
1230             }
1231         }
1232     }
1233 
1234     static long ROL_scalar(long a, long b) {
1235         return Long.rotateLeft(a, ((int)b));
1236     }
1237 
1238     static long ROR_scalar(long a, long b) {
1239         return Long.rotateRight(a, ((int)b));
1240     }
1241 
1242     static long TRAILING_ZEROS_COUNT_scalar(long a) {
1243         return Long.numberOfTrailingZeros(a);
1244     }
1245 
1246     static long LEADING_ZEROS_COUNT_scalar(long a) {
1247         return Long.numberOfLeadingZeros(a);
1248     }
1249 
1250     static long REVERSE_scalar(long a) {
1251         return Long.reverse(a);
1252     }
1253 
1254     static boolean eq(long a, long b) {
1255         return a == b;
1256     }
1257 
1258     static boolean neq(long a, long b) {
1259         return a != b;
1260     }
1261 
1262     static boolean lt(long a, long b) {
1263         return a < b;
1264     }
1265 
1266     static boolean le(long a, long b) {
1267         return a <= b;
1268     }
1269 
1270     static boolean gt(long a, long b) {
1271         return a > b;
1272     }
1273 

1388     @Test
1389     // Test div by 0.
1390     static void bitwiseDivByZeroSmokeTest() {
1391         try {
1392             LongVector a = (LongVector) SPECIES.broadcast(0).addIndex(1);
1393             LongVector b = (LongVector) SPECIES.broadcast(0);
1394             a.div(b);
1395             Assert.fail();
1396         } catch (ArithmeticException e) {
1397         }
1398 
1399         try {
1400             LongVector a = (LongVector) SPECIES.broadcast(0).addIndex(1);
1401             LongVector b = (LongVector) SPECIES.broadcast(0);
1402             VectorMask<Long> m = a.lt((long) 1);
1403             a.div(b, m);
1404             Assert.fail();
1405         } catch (ArithmeticException e) {
1406         }
1407     }
1408 
1409     static long ADD(long a, long b) {
1410         return (long)(a + b);
1411     }
1412 
1413     @Test(dataProvider = "longBinaryOpProvider")
1414     static void ADDLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1415         long[] a = fa.apply(SPECIES.length());
1416         long[] b = fb.apply(SPECIES.length());
1417         long[] r = fr.apply(SPECIES.length());
1418 
1419         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1420             for (int i = 0; i < a.length; i += SPECIES.length()) {
1421                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1422                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1423                 av.lanewise(VectorOperators.ADD, bv).intoArray(r, i);
1424             }
1425         }
1426 
1427         assertArraysEquals(r, a, b, LongMaxVectorTests::ADD);
1428     }
1429 
1430     static long add(long a, long b) {
1431         return (long)(a + b);
1432     }
1433 
1434     @Test(dataProvider = "longBinaryOpProvider")
1435     static void addLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1436         long[] a = fa.apply(SPECIES.length());
1437         long[] b = fb.apply(SPECIES.length());
1438         long[] r = fr.apply(SPECIES.length());
1439 
1440         for (int i = 0; i < a.length; i += SPECIES.length()) {
1441             LongVector av = LongVector.fromArray(SPECIES, a, i);
1442             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1443             av.add(bv).intoArray(r, i);
1444         }
1445 
1446         assertArraysEquals(r, a, b, LongMaxVectorTests::add);
1447     }
1448 
1449     @Test(dataProvider = "longBinaryOpMaskProvider")

1466         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::ADD);
1467     }
1468 
1469     @Test(dataProvider = "longBinaryOpMaskProvider")
1470     static void addLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1471                                           IntFunction<boolean[]> fm) {
1472         long[] a = fa.apply(SPECIES.length());
1473         long[] b = fb.apply(SPECIES.length());
1474         long[] r = fr.apply(SPECIES.length());
1475         boolean[] mask = fm.apply(SPECIES.length());
1476         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1477 
1478         for (int i = 0; i < a.length; i += SPECIES.length()) {
1479             LongVector av = LongVector.fromArray(SPECIES, a, i);
1480             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1481             av.add(bv, vmask).intoArray(r, i);
1482         }
1483 
1484         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::add);
1485     }
1486 
1487     static long SUB(long a, long b) {
1488         return (long)(a - b);
1489     }
1490 
1491     @Test(dataProvider = "longBinaryOpProvider")
1492     static void SUBLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1493         long[] a = fa.apply(SPECIES.length());
1494         long[] b = fb.apply(SPECIES.length());
1495         long[] r = fr.apply(SPECIES.length());
1496 
1497         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1498             for (int i = 0; i < a.length; i += SPECIES.length()) {
1499                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1500                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1501                 av.lanewise(VectorOperators.SUB, bv).intoArray(r, i);
1502             }
1503         }
1504 
1505         assertArraysEquals(r, a, b, LongMaxVectorTests::SUB);
1506     }
1507 
1508     static long sub(long a, long b) {
1509         return (long)(a - b);
1510     }
1511 
1512     @Test(dataProvider = "longBinaryOpProvider")
1513     static void subLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1514         long[] a = fa.apply(SPECIES.length());
1515         long[] b = fb.apply(SPECIES.length());
1516         long[] r = fr.apply(SPECIES.length());
1517 
1518         for (int i = 0; i < a.length; i += SPECIES.length()) {
1519             LongVector av = LongVector.fromArray(SPECIES, a, i);
1520             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1521             av.sub(bv).intoArray(r, i);
1522         }
1523 
1524         assertArraysEquals(r, a, b, LongMaxVectorTests::sub);
1525     }
1526 
1527     @Test(dataProvider = "longBinaryOpMaskProvider")

1544         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::SUB);
1545     }
1546 
1547     @Test(dataProvider = "longBinaryOpMaskProvider")
1548     static void subLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1549                                           IntFunction<boolean[]> fm) {
1550         long[] a = fa.apply(SPECIES.length());
1551         long[] b = fb.apply(SPECIES.length());
1552         long[] r = fr.apply(SPECIES.length());
1553         boolean[] mask = fm.apply(SPECIES.length());
1554         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1555 
1556         for (int i = 0; i < a.length; i += SPECIES.length()) {
1557             LongVector av = LongVector.fromArray(SPECIES, a, i);
1558             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1559             av.sub(bv, vmask).intoArray(r, i);
1560         }
1561 
1562         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::sub);
1563     }
1564 
1565     static long MUL(long a, long b) {
1566         return (long)(a * b);
1567     }
1568 
1569     @Test(dataProvider = "longBinaryOpProvider")
1570     static void MULLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1571         long[] a = fa.apply(SPECIES.length());
1572         long[] b = fb.apply(SPECIES.length());
1573         long[] r = fr.apply(SPECIES.length());
1574 
1575         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1576             for (int i = 0; i < a.length; i += SPECIES.length()) {
1577                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1578                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1579                 av.lanewise(VectorOperators.MUL, bv).intoArray(r, i);
1580             }
1581         }
1582 
1583         assertArraysEquals(r, a, b, LongMaxVectorTests::MUL);
1584     }
1585 
1586     static long mul(long a, long b) {
1587         return (long)(a * b);
1588     }
1589 
1590     @Test(dataProvider = "longBinaryOpProvider")
1591     static void mulLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1592         long[] a = fa.apply(SPECIES.length());
1593         long[] b = fb.apply(SPECIES.length());
1594         long[] r = fr.apply(SPECIES.length());
1595 
1596         for (int i = 0; i < a.length; i += SPECIES.length()) {
1597             LongVector av = LongVector.fromArray(SPECIES, a, i);
1598             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1599             av.mul(bv).intoArray(r, i);
1600         }
1601 
1602         assertArraysEquals(r, a, b, LongMaxVectorTests::mul);
1603     }
1604 
1605     @Test(dataProvider = "longBinaryOpMaskProvider")

1623     }
1624 
1625     @Test(dataProvider = "longBinaryOpMaskProvider")
1626     static void mulLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1627                                           IntFunction<boolean[]> fm) {
1628         long[] a = fa.apply(SPECIES.length());
1629         long[] b = fb.apply(SPECIES.length());
1630         long[] r = fr.apply(SPECIES.length());
1631         boolean[] mask = fm.apply(SPECIES.length());
1632         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1633 
1634         for (int i = 0; i < a.length; i += SPECIES.length()) {
1635             LongVector av = LongVector.fromArray(SPECIES, a, i);
1636             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1637             av.mul(bv, vmask).intoArray(r, i);
1638         }
1639 
1640         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::mul);
1641     }
1642 


1643     static long DIV(long a, long b) {
1644         return (long)(a / b);
1645     }
1646 
1647     @Test(dataProvider = "longBinaryOpProvider")
1648     static void DIVLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1649         long[] a = fa.apply(SPECIES.length());
1650         long[] b = fb.apply(SPECIES.length());
1651         long[] r = fr.apply(SPECIES.length());
1652 
1653         replaceZero(b, (long) 1);
1654 
1655         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1656             for (int i = 0; i < a.length; i += SPECIES.length()) {
1657                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1658                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1659                 av.lanewise(VectorOperators.DIV, bv).intoArray(r, i);
1660             }
1661         }
1662 
1663         assertArraysEquals(r, a, b, LongMaxVectorTests::DIV);
1664     }
1665 
1666     static long div(long a, long b) {
1667         return (long)(a / b);
1668     }
1669 
1670     @Test(dataProvider = "longBinaryOpProvider")
1671     static void divLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1672         long[] a = fa.apply(SPECIES.length());
1673         long[] b = fb.apply(SPECIES.length());
1674         long[] r = fr.apply(SPECIES.length());
1675 
1676         replaceZero(b, (long) 1);
1677 
1678         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1679             for (int i = 0; i < a.length; i += SPECIES.length()) {
1680                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1681                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1682                 av.div(bv).intoArray(r, i);
1683             }
1684         }
1685 
1686         assertArraysEquals(r, a, b, LongMaxVectorTests::div);
1687     }
1688 


1689     @Test(dataProvider = "longBinaryOpMaskProvider")
1690     static void DIVLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1691                                           IntFunction<boolean[]> fm) {
1692         long[] a = fa.apply(SPECIES.length());
1693         long[] b = fb.apply(SPECIES.length());
1694         long[] r = fr.apply(SPECIES.length());
1695         boolean[] mask = fm.apply(SPECIES.length());
1696         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1697 
1698         replaceZero(b, mask, (long) 1);
1699 
1700         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1701             for (int i = 0; i < a.length; i += SPECIES.length()) {
1702                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1703                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1704                 av.lanewise(VectorOperators.DIV, bv, vmask).intoArray(r, i);
1705             }
1706         }
1707 
1708         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::DIV);

1774     static long AND(long a, long b) {
1775         return (long)(a & b);
1776     }
1777 
1778     @Test(dataProvider = "longBinaryOpProvider")
1779     static void ANDLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1780         long[] a = fa.apply(SPECIES.length());
1781         long[] b = fb.apply(SPECIES.length());
1782         long[] r = fr.apply(SPECIES.length());
1783 
1784         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1785             for (int i = 0; i < a.length; i += SPECIES.length()) {
1786                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1787                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1788                 av.lanewise(VectorOperators.AND, bv).intoArray(r, i);
1789             }
1790         }
1791 
1792         assertArraysEquals(r, a, b, LongMaxVectorTests::AND);
1793     }
1794 
1795     static long and(long a, long b) {
1796         return (long)(a & b);
1797     }
1798 
1799     @Test(dataProvider = "longBinaryOpProvider")
1800     static void andLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1801         long[] a = fa.apply(SPECIES.length());
1802         long[] b = fb.apply(SPECIES.length());
1803         long[] r = fr.apply(SPECIES.length());
1804 
1805         for (int i = 0; i < a.length; i += SPECIES.length()) {
1806             LongVector av = LongVector.fromArray(SPECIES, a, i);
1807             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1808             av.and(bv).intoArray(r, i);
1809         }
1810 
1811         assertArraysEquals(r, a, b, LongMaxVectorTests::and);
1812     }
1813 


1814     @Test(dataProvider = "longBinaryOpMaskProvider")
1815     static void ANDLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1816                                           IntFunction<boolean[]> fm) {
1817         long[] a = fa.apply(SPECIES.length());
1818         long[] b = fb.apply(SPECIES.length());
1819         long[] r = fr.apply(SPECIES.length());
1820         boolean[] mask = fm.apply(SPECIES.length());
1821         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1822 
1823         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1824             for (int i = 0; i < a.length; i += SPECIES.length()) {
1825                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1826                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1827                 av.lanewise(VectorOperators.AND, bv, vmask).intoArray(r, i);
1828             }
1829         }
1830 
1831         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::AND);
1832     }
1833 

1834     static long AND_NOT(long a, long b) {
1835         return (long)(a & ~b);
1836     }
1837 
1838     @Test(dataProvider = "longBinaryOpProvider")
1839     static void AND_NOTLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1840         long[] a = fa.apply(SPECIES.length());
1841         long[] b = fb.apply(SPECIES.length());
1842         long[] r = fr.apply(SPECIES.length());
1843 
1844         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1845             for (int i = 0; i < a.length; i += SPECIES.length()) {
1846                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1847                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1848                 av.lanewise(VectorOperators.AND_NOT, bv).intoArray(r, i);
1849             }
1850         }
1851 
1852         assertArraysEquals(r, a, b, LongMaxVectorTests::AND_NOT);
1853     }
1854 


1855     @Test(dataProvider = "longBinaryOpMaskProvider")
1856     static void AND_NOTLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1857                                           IntFunction<boolean[]> fm) {
1858         long[] a = fa.apply(SPECIES.length());
1859         long[] b = fb.apply(SPECIES.length());
1860         long[] r = fr.apply(SPECIES.length());
1861         boolean[] mask = fm.apply(SPECIES.length());
1862         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1863 
1864         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1865             for (int i = 0; i < a.length; i += SPECIES.length()) {
1866                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1867                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1868                 av.lanewise(VectorOperators.AND_NOT, bv, vmask).intoArray(r, i);
1869             }
1870         }
1871 
1872         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::AND_NOT);
1873     }
1874 

1875     static long OR(long a, long b) {
1876         return (long)(a | b);
1877     }
1878 
1879     @Test(dataProvider = "longBinaryOpProvider")
1880     static void ORLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1881         long[] a = fa.apply(SPECIES.length());
1882         long[] b = fb.apply(SPECIES.length());
1883         long[] r = fr.apply(SPECIES.length());
1884 
1885         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1886             for (int i = 0; i < a.length; i += SPECIES.length()) {
1887                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1888                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1889                 av.lanewise(VectorOperators.OR, bv).intoArray(r, i);
1890             }
1891         }
1892 
1893         assertArraysEquals(r, a, b, LongMaxVectorTests::OR);
1894     }
1895 
1896     static long or(long a, long b) {
1897         return (long)(a | b);
1898     }
1899 
1900     @Test(dataProvider = "longBinaryOpProvider")
1901     static void orLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1902         long[] a = fa.apply(SPECIES.length());
1903         long[] b = fb.apply(SPECIES.length());
1904         long[] r = fr.apply(SPECIES.length());
1905 
1906         for (int i = 0; i < a.length; i += SPECIES.length()) {
1907             LongVector av = LongVector.fromArray(SPECIES, a, i);
1908             LongVector bv = LongVector.fromArray(SPECIES, b, i);
1909             av.or(bv).intoArray(r, i);
1910         }
1911 
1912         assertArraysEquals(r, a, b, LongMaxVectorTests::or);
1913     }
1914 


1915     @Test(dataProvider = "longBinaryOpMaskProvider")
1916     static void ORLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1917                                           IntFunction<boolean[]> fm) {
1918         long[] a = fa.apply(SPECIES.length());
1919         long[] b = fb.apply(SPECIES.length());
1920         long[] r = fr.apply(SPECIES.length());
1921         boolean[] mask = fm.apply(SPECIES.length());
1922         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1923 
1924         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1925             for (int i = 0; i < a.length; i += SPECIES.length()) {
1926                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1927                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1928                 av.lanewise(VectorOperators.OR, bv, vmask).intoArray(r, i);
1929             }
1930         }
1931 
1932         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::OR);
1933     }
1934 

1935     static long XOR(long a, long b) {
1936         return (long)(a ^ b);
1937     }
1938 
1939     @Test(dataProvider = "longBinaryOpProvider")
1940     static void XORLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1941         long[] a = fa.apply(SPECIES.length());
1942         long[] b = fb.apply(SPECIES.length());
1943         long[] r = fr.apply(SPECIES.length());
1944 
1945         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1946             for (int i = 0; i < a.length; i += SPECIES.length()) {
1947                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1948                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1949                 av.lanewise(VectorOperators.XOR, bv).intoArray(r, i);
1950             }
1951         }
1952 
1953         assertArraysEquals(r, a, b, LongMaxVectorTests::XOR);
1954     }
1955 


1956     @Test(dataProvider = "longBinaryOpMaskProvider")
1957     static void XORLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1958                                           IntFunction<boolean[]> fm) {
1959         long[] a = fa.apply(SPECIES.length());
1960         long[] b = fb.apply(SPECIES.length());
1961         long[] r = fr.apply(SPECIES.length());
1962         boolean[] mask = fm.apply(SPECIES.length());
1963         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1964 
1965         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1966             for (int i = 0; i < a.length; i += SPECIES.length()) {
1967                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1968                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1969                 av.lanewise(VectorOperators.XOR, bv, vmask).intoArray(r, i);
1970             }
1971         }
1972 
1973         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::XOR);
1974     }
1975 
1976     static long COMPRESS_BITS(long a, long b) {
1977         return (long)(Long.compress(a, b));
1978     }
1979 
1980     @Test(dataProvider = "longBinaryOpProvider")
1981     static void COMPRESS_BITSLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
1982         long[] a = fa.apply(SPECIES.length());
1983         long[] b = fb.apply(SPECIES.length());
1984         long[] r = fr.apply(SPECIES.length());
1985 
1986         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1987             for (int i = 0; i < a.length; i += SPECIES.length()) {
1988                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1989                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1990                 av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
1991             }
1992         }
1993 
1994         assertArraysEquals(r, a, b, LongMaxVectorTests::COMPRESS_BITS);
1995     }
1996 
1997     @Test(dataProvider = "longBinaryOpMaskProvider")
1998     static void COMPRESS_BITSLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
1999                                           IntFunction<boolean[]> fm) {
2000         long[] a = fa.apply(SPECIES.length());
2001         long[] b = fb.apply(SPECIES.length());
2002         long[] r = fr.apply(SPECIES.length());
2003         boolean[] mask = fm.apply(SPECIES.length());
2004         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2005 
2006         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2007             for (int i = 0; i < a.length; i += SPECIES.length()) {
2008                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2009                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2010                 av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
2011             }
2012         }
2013 
2014         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::COMPRESS_BITS);
2015     }
2016 
2017     static long EXPAND_BITS(long a, long b) {
2018         return (long)(Long.expand(a, b));
2019     }
2020 
2021     @Test(dataProvider = "longBinaryOpProvider")
2022     static void EXPAND_BITSLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2023         long[] a = fa.apply(SPECIES.length());
2024         long[] b = fb.apply(SPECIES.length());
2025         long[] r = fr.apply(SPECIES.length());
2026 
2027         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2028             for (int i = 0; i < a.length; i += SPECIES.length()) {
2029                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2030                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2031                 av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
2032             }
2033         }
2034 
2035         assertArraysEquals(r, a, b, LongMaxVectorTests::EXPAND_BITS);
2036     }
2037 
2038     @Test(dataProvider = "longBinaryOpMaskProvider")
2039     static void EXPAND_BITSLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
2040                                           IntFunction<boolean[]> fm) {
2041         long[] a = fa.apply(SPECIES.length());
2042         long[] b = fb.apply(SPECIES.length());
2043         long[] r = fr.apply(SPECIES.length());
2044         boolean[] mask = fm.apply(SPECIES.length());
2045         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2046 
2047         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2048             for (int i = 0; i < a.length; i += SPECIES.length()) {
2049                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2050                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2051                 av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
2052             }
2053         }
2054 
2055         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::EXPAND_BITS);
2056     }
2057 
2058     @Test(dataProvider = "longBinaryOpProvider")
2059     static void addLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2060         long[] a = fa.apply(SPECIES.length());
2061         long[] b = fb.apply(SPECIES.length());
2062         long[] r = fr.apply(SPECIES.length());
2063 
2064         for (int i = 0; i < a.length; i += SPECIES.length()) {
2065             LongVector av = LongVector.fromArray(SPECIES, a, i);
2066             av.add(b[i]).intoArray(r, i);
2067         }
2068 
2069         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::add);
2070     }
2071 
2072     @Test(dataProvider = "longBinaryOpMaskProvider")
2073     static void addLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2074                                           IntFunction<boolean[]> fm) {
2075         long[] a = fa.apply(SPECIES.length());
2076         long[] b = fb.apply(SPECIES.length());

2131         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::mul);
2132     }
2133 
2134     @Test(dataProvider = "longBinaryOpMaskProvider")
2135     static void mulLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2136                                           IntFunction<boolean[]> fm) {
2137         long[] a = fa.apply(SPECIES.length());
2138         long[] b = fb.apply(SPECIES.length());
2139         long[] r = fr.apply(SPECIES.length());
2140         boolean[] mask = fm.apply(SPECIES.length());
2141         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2142 
2143         for (int i = 0; i < a.length; i += SPECIES.length()) {
2144             LongVector av = LongVector.fromArray(SPECIES, a, i);
2145             av.mul(b[i], vmask).intoArray(r, i);
2146         }
2147 
2148         assertBroadcastArraysEquals(r, a, b, mask, LongMaxVectorTests::mul);
2149     }
2150 



2151     @Test(dataProvider = "longBinaryOpProvider")
2152     static void divLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2153         long[] a = fa.apply(SPECIES.length());
2154         long[] b = fb.apply(SPECIES.length());
2155         long[] r = fr.apply(SPECIES.length());
2156 
2157         replaceZero(b, (long) 1);
2158 
2159         for (int i = 0; i < a.length; i += SPECIES.length()) {
2160             LongVector av = LongVector.fromArray(SPECIES, a, i);
2161             av.div(b[i]).intoArray(r, i);
2162         }
2163 
2164         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::div);
2165     }
2166 


2167     @Test(dataProvider = "longBinaryOpMaskProvider")
2168     static void divLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2169                                           IntFunction<boolean[]> fm) {
2170         long[] a = fa.apply(SPECIES.length());
2171         long[] b = fb.apply(SPECIES.length());
2172         long[] r = fr.apply(SPECIES.length());
2173         boolean[] mask = fm.apply(SPECIES.length());
2174         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2175 
2176         replaceZero(b, (long) 1);
2177 
2178         for (int i = 0; i < a.length; i += SPECIES.length()) {
2179             LongVector av = LongVector.fromArray(SPECIES, a, i);
2180             av.div(b[i], vmask).intoArray(r, i);
2181         }
2182 
2183         assertBroadcastArraysEquals(r, a, b, mask, LongMaxVectorTests::div);
2184     }
2185 


2186     @Test(dataProvider = "longBinaryOpProvider")
2187     static void ORLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2188         long[] a = fa.apply(SPECIES.length());
2189         long[] b = fb.apply(SPECIES.length());
2190         long[] r = fr.apply(SPECIES.length());
2191 
2192         for (int i = 0; i < a.length; i += SPECIES.length()) {
2193             LongVector av = LongVector.fromArray(SPECIES, a, i);
2194             av.lanewise(VectorOperators.OR, b[i]).intoArray(r, i);
2195         }
2196 
2197         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::OR);
2198     }
2199 
2200     @Test(dataProvider = "longBinaryOpProvider")
2201     static void orLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2202         long[] a = fa.apply(SPECIES.length());
2203         long[] b = fb.apply(SPECIES.length());
2204         long[] r = fr.apply(SPECIES.length());
2205 
2206         for (int i = 0; i < a.length; i += SPECIES.length()) {
2207             LongVector av = LongVector.fromArray(SPECIES, a, i);
2208             av.or(b[i]).intoArray(r, i);
2209         }
2210 
2211         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::or);
2212     }
2213 


2214     @Test(dataProvider = "longBinaryOpMaskProvider")
2215     static void ORLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2216                                           IntFunction<boolean[]> fm) {
2217         long[] a = fa.apply(SPECIES.length());
2218         long[] b = fb.apply(SPECIES.length());
2219         long[] r = fr.apply(SPECIES.length());
2220         boolean[] mask = fm.apply(SPECIES.length());
2221         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2222 
2223         for (int i = 0; i < a.length; i += SPECIES.length()) {
2224             LongVector av = LongVector.fromArray(SPECIES, a, i);
2225             av.lanewise(VectorOperators.OR, b[i], vmask).intoArray(r, i);
2226         }
2227 
2228         assertBroadcastArraysEquals(r, a, b, mask, LongMaxVectorTests::OR);
2229     }
2230 


2231     @Test(dataProvider = "longBinaryOpProvider")
2232     static void ANDLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2233         long[] a = fa.apply(SPECIES.length());
2234         long[] b = fb.apply(SPECIES.length());
2235         long[] r = fr.apply(SPECIES.length());
2236 
2237         for (int i = 0; i < a.length; i += SPECIES.length()) {
2238             LongVector av = LongVector.fromArray(SPECIES, a, i);
2239             av.lanewise(VectorOperators.AND, b[i]).intoArray(r, i);
2240         }
2241 
2242         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::AND);
2243     }
2244 
2245     @Test(dataProvider = "longBinaryOpProvider")
2246     static void andLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2247         long[] a = fa.apply(SPECIES.length());
2248         long[] b = fb.apply(SPECIES.length());
2249         long[] r = fr.apply(SPECIES.length());
2250 
2251         for (int i = 0; i < a.length; i += SPECIES.length()) {
2252             LongVector av = LongVector.fromArray(SPECIES, a, i);
2253             av.and(b[i]).intoArray(r, i);
2254         }
2255 
2256         assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::and);
2257     }
2258 


2259     @Test(dataProvider = "longBinaryOpMaskProvider")
2260     static void ANDLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2261                                           IntFunction<boolean[]> fm) {
2262         long[] a = fa.apply(SPECIES.length());
2263         long[] b = fb.apply(SPECIES.length());
2264         long[] r = fr.apply(SPECIES.length());
2265         boolean[] mask = fm.apply(SPECIES.length());
2266         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2267 
2268         for (int i = 0; i < a.length; i += SPECIES.length()) {
2269             LongVector av = LongVector.fromArray(SPECIES, a, i);
2270             av.lanewise(VectorOperators.AND, b[i], vmask).intoArray(r, i);
2271         }
2272 
2273         assertBroadcastArraysEquals(r, a, b, mask, LongMaxVectorTests::AND);
2274     }
2275 


2276     @Test(dataProvider = "longBinaryOpProvider")
2277     static void ORLongMaxVectorTestsBroadcastLongSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2278         long[] a = fa.apply(SPECIES.length());
2279         long[] b = fb.apply(SPECIES.length());
2280         long[] r = fr.apply(SPECIES.length());
2281 
2282         for (int i = 0; i < a.length; i += SPECIES.length()) {
2283             LongVector av = LongVector.fromArray(SPECIES, a, i);
2284             av.lanewise(VectorOperators.OR, (long)b[i]).intoArray(r, i);
2285         }
2286 
2287         assertBroadcastLongArraysEquals(r, a, b, LongMaxVectorTests::OR);
2288     }
2289 


2290     @Test(dataProvider = "longBinaryOpMaskProvider")
2291     static void ORLongMaxVectorTestsBroadcastMaskedLongSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2292                                           IntFunction<boolean[]> fm) {
2293         long[] a = fa.apply(SPECIES.length());
2294         long[] b = fb.apply(SPECIES.length());
2295         long[] r = fr.apply(SPECIES.length());
2296         boolean[] mask = fm.apply(SPECIES.length());
2297         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2298 
2299         for (int i = 0; i < a.length; i += SPECIES.length()) {
2300             LongVector av = LongVector.fromArray(SPECIES, a, i);
2301             av.lanewise(VectorOperators.OR, (long)b[i], vmask).intoArray(r, i);
2302         }
2303 
2304         assertBroadcastLongArraysEquals(r, a, b, mask, LongMaxVectorTests::OR);
2305     }
2306 

2307     @Test(dataProvider = "longBinaryOpProvider")
2308     static void ADDLongMaxVectorTestsBroadcastLongSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2309         long[] a = fa.apply(SPECIES.length());
2310         long[] b = fb.apply(SPECIES.length());
2311         long[] r = fr.apply(SPECIES.length());
2312 
2313         for (int i = 0; i < a.length; i += SPECIES.length()) {
2314             LongVector av = LongVector.fromArray(SPECIES, a, i);
2315             av.lanewise(VectorOperators.ADD, (long)b[i]).intoArray(r, i);
2316         }
2317 
2318         assertBroadcastLongArraysEquals(r, a, b, LongMaxVectorTests::ADD);
2319     }
2320 
2321     @Test(dataProvider = "longBinaryOpMaskProvider")
2322     static void ADDLongMaxVectorTestsBroadcastMaskedLongSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
2323                                           IntFunction<boolean[]> fm) {
2324         long[] a = fa.apply(SPECIES.length());
2325         long[] b = fb.apply(SPECIES.length());
2326         long[] r = fr.apply(SPECIES.length());

2339         return (long)((a << b));
2340     }
2341 
2342     @Test(dataProvider = "longBinaryOpProvider")
2343     static void LSHLLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2344         long[] a = fa.apply(SPECIES.length());
2345         long[] b = fb.apply(SPECIES.length());
2346         long[] r = fr.apply(SPECIES.length());
2347 
2348         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2349             for (int i = 0; i < a.length; i += SPECIES.length()) {
2350                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2351                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2352                 av.lanewise(VectorOperators.LSHL, bv).intoArray(r, i);
2353             }
2354         }
2355 
2356         assertArraysEquals(r, a, b, LongMaxVectorTests::LSHL);
2357     }
2358 


2359     @Test(dataProvider = "longBinaryOpMaskProvider")
2360     static void LSHLLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
2361                                           IntFunction<boolean[]> fm) {
2362         long[] a = fa.apply(SPECIES.length());
2363         long[] b = fb.apply(SPECIES.length());
2364         long[] r = fr.apply(SPECIES.length());
2365         boolean[] mask = fm.apply(SPECIES.length());
2366         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2367 
2368         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2369             for (int i = 0; i < a.length; i += SPECIES.length()) {
2370                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2371                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2372                 av.lanewise(VectorOperators.LSHL, bv, vmask).intoArray(r, i);
2373             }
2374         }
2375 
2376         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::LSHL);
2377     }
2378 





2379     static long ASHR(long a, long b) {
2380         return (long)((a >> b));
2381     }
2382 
2383     @Test(dataProvider = "longBinaryOpProvider")
2384     static void ASHRLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2385         long[] a = fa.apply(SPECIES.length());
2386         long[] b = fb.apply(SPECIES.length());
2387         long[] r = fr.apply(SPECIES.length());
2388 
2389         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2390             for (int i = 0; i < a.length; i += SPECIES.length()) {
2391                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2392                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2393                 av.lanewise(VectorOperators.ASHR, bv).intoArray(r, i);
2394             }
2395         }
2396 
2397         assertArraysEquals(r, a, b, LongMaxVectorTests::ASHR);
2398     }
2399 


2400     @Test(dataProvider = "longBinaryOpMaskProvider")
2401     static void ASHRLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
2402                                           IntFunction<boolean[]> fm) {
2403         long[] a = fa.apply(SPECIES.length());
2404         long[] b = fb.apply(SPECIES.length());
2405         long[] r = fr.apply(SPECIES.length());
2406         boolean[] mask = fm.apply(SPECIES.length());
2407         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2408 
2409         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2410             for (int i = 0; i < a.length; i += SPECIES.length()) {
2411                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2412                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2413                 av.lanewise(VectorOperators.ASHR, bv, vmask).intoArray(r, i);
2414             }
2415         }
2416 
2417         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::ASHR);
2418     }
2419 





2420     static long LSHR(long a, long b) {
2421         return (long)((a >>> b));
2422     }
2423 
2424     @Test(dataProvider = "longBinaryOpProvider")
2425     static void LSHRLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2426         long[] a = fa.apply(SPECIES.length());
2427         long[] b = fb.apply(SPECIES.length());
2428         long[] r = fr.apply(SPECIES.length());
2429 
2430         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2431             for (int i = 0; i < a.length; i += SPECIES.length()) {
2432                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2433                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2434                 av.lanewise(VectorOperators.LSHR, bv).intoArray(r, i);
2435             }
2436         }
2437 
2438         assertArraysEquals(r, a, b, LongMaxVectorTests::LSHR);
2439     }
2440 


2441     @Test(dataProvider = "longBinaryOpMaskProvider")
2442     static void LSHRLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
2443                                           IntFunction<boolean[]> fm) {
2444         long[] a = fa.apply(SPECIES.length());
2445         long[] b = fb.apply(SPECIES.length());
2446         long[] r = fr.apply(SPECIES.length());
2447         boolean[] mask = fm.apply(SPECIES.length());
2448         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2449 
2450         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2451             for (int i = 0; i < a.length; i += SPECIES.length()) {
2452                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2453                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2454                 av.lanewise(VectorOperators.LSHR, bv, vmask).intoArray(r, i);
2455             }
2456         }
2457 
2458         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::LSHR);
2459     }
2460 





2461     static long LSHL_unary(long a, long b) {
2462         return (long)((a << b));
2463     }
2464 
2465     @Test(dataProvider = "longBinaryOpProvider")
2466     static void LSHLLongMaxVectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2467         long[] a = fa.apply(SPECIES.length());
2468         long[] b = fb.apply(SPECIES.length());
2469         long[] r = fr.apply(SPECIES.length());
2470 
2471         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2472             for (int i = 0; i < a.length; i += SPECIES.length()) {
2473                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2474                 av.lanewise(VectorOperators.LSHL, (int)b[i]).intoArray(r, i);
2475             }
2476         }
2477 
2478         assertShiftArraysEquals(r, a, b, LongMaxVectorTests::LSHL_unary);
2479     }
2480 


2481     @Test(dataProvider = "longBinaryOpMaskProvider")
2482     static void LSHLLongMaxVectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
2483                                           IntFunction<boolean[]> fm) {
2484         long[] a = fa.apply(SPECIES.length());
2485         long[] b = fb.apply(SPECIES.length());
2486         long[] r = fr.apply(SPECIES.length());
2487         boolean[] mask = fm.apply(SPECIES.length());
2488         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2489 
2490         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2491             for (int i = 0; i < a.length; i += SPECIES.length()) {
2492                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2493                 av.lanewise(VectorOperators.LSHL, (int)b[i], vmask).intoArray(r, i);
2494             }
2495         }
2496 
2497         assertShiftArraysEquals(r, a, b, mask, LongMaxVectorTests::LSHL_unary);
2498     }
2499 





2500     static long LSHR_unary(long a, long b) {
2501         return (long)((a >>> b));
2502     }
2503 
2504     @Test(dataProvider = "longBinaryOpProvider")
2505     static void LSHRLongMaxVectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2506         long[] a = fa.apply(SPECIES.length());
2507         long[] b = fb.apply(SPECIES.length());
2508         long[] r = fr.apply(SPECIES.length());
2509 
2510         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2511             for (int i = 0; i < a.length; i += SPECIES.length()) {
2512                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2513                 av.lanewise(VectorOperators.LSHR, (int)b[i]).intoArray(r, i);
2514             }
2515         }
2516 
2517         assertShiftArraysEquals(r, a, b, LongMaxVectorTests::LSHR_unary);
2518     }
2519 


2520     @Test(dataProvider = "longBinaryOpMaskProvider")
2521     static void LSHRLongMaxVectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
2522                                           IntFunction<boolean[]> fm) {
2523         long[] a = fa.apply(SPECIES.length());
2524         long[] b = fb.apply(SPECIES.length());
2525         long[] r = fr.apply(SPECIES.length());
2526         boolean[] mask = fm.apply(SPECIES.length());
2527         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2528 
2529         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2530             for (int i = 0; i < a.length; i += SPECIES.length()) {
2531                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2532                 av.lanewise(VectorOperators.LSHR, (int)b[i], vmask).intoArray(r, i);
2533             }
2534         }
2535 
2536         assertShiftArraysEquals(r, a, b, mask, LongMaxVectorTests::LSHR_unary);
2537     }
2538 





2539     static long ASHR_unary(long a, long b) {
2540         return (long)((a >> b));
2541     }
2542 
2543     @Test(dataProvider = "longBinaryOpProvider")
2544     static void ASHRLongMaxVectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2545         long[] a = fa.apply(SPECIES.length());
2546         long[] b = fb.apply(SPECIES.length());
2547         long[] r = fr.apply(SPECIES.length());
2548 
2549         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2550             for (int i = 0; i < a.length; i += SPECIES.length()) {
2551                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2552                 av.lanewise(VectorOperators.ASHR, (int)b[i]).intoArray(r, i);
2553             }
2554         }
2555 
2556         assertShiftArraysEquals(r, a, b, LongMaxVectorTests::ASHR_unary);
2557     }
2558 


2559     @Test(dataProvider = "longBinaryOpMaskProvider")
2560     static void ASHRLongMaxVectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
2561                                           IntFunction<boolean[]> fm) {
2562         long[] a = fa.apply(SPECIES.length());
2563         long[] b = fb.apply(SPECIES.length());
2564         long[] r = fr.apply(SPECIES.length());
2565         boolean[] mask = fm.apply(SPECIES.length());
2566         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2567 
2568         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2569             for (int i = 0; i < a.length; i += SPECIES.length()) {
2570                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2571                 av.lanewise(VectorOperators.ASHR, (int)b[i], vmask).intoArray(r, i);
2572             }
2573         }
2574 
2575         assertShiftArraysEquals(r, a, b, mask, LongMaxVectorTests::ASHR_unary);
2576     }
2577 





2578     static long ROR(long a, long b) {
2579         return (long)(ROR_scalar(a,b));
2580     }
2581 
2582     @Test(dataProvider = "longBinaryOpProvider")
2583     static void RORLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2584         long[] a = fa.apply(SPECIES.length());
2585         long[] b = fb.apply(SPECIES.length());
2586         long[] r = fr.apply(SPECIES.length());
2587 
2588         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2589             for (int i = 0; i < a.length; i += SPECIES.length()) {
2590                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2591                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2592                 av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
2593             }
2594         }
2595 
2596         assertArraysEquals(r, a, b, LongMaxVectorTests::ROR);
2597     }
2598 


2599     @Test(dataProvider = "longBinaryOpMaskProvider")
2600     static void RORLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
2601                                           IntFunction<boolean[]> fm) {
2602         long[] a = fa.apply(SPECIES.length());
2603         long[] b = fb.apply(SPECIES.length());
2604         long[] r = fr.apply(SPECIES.length());
2605         boolean[] mask = fm.apply(SPECIES.length());
2606         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2607 
2608         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2609             for (int i = 0; i < a.length; i += SPECIES.length()) {
2610                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2611                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2612                 av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
2613             }
2614         }
2615 
2616         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::ROR);
2617     }
2618 

2619     static long ROL(long a, long b) {
2620         return (long)(ROL_scalar(a,b));
2621     }
2622 
2623     @Test(dataProvider = "longBinaryOpProvider")
2624     static void ROLLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2625         long[] a = fa.apply(SPECIES.length());
2626         long[] b = fb.apply(SPECIES.length());
2627         long[] r = fr.apply(SPECIES.length());
2628 
2629         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2630             for (int i = 0; i < a.length; i += SPECIES.length()) {
2631                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2632                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2633                 av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
2634             }
2635         }
2636 
2637         assertArraysEquals(r, a, b, LongMaxVectorTests::ROL);
2638     }
2639 


2640     @Test(dataProvider = "longBinaryOpMaskProvider")
2641     static void ROLLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
2642                                           IntFunction<boolean[]> fm) {
2643         long[] a = fa.apply(SPECIES.length());
2644         long[] b = fb.apply(SPECIES.length());
2645         long[] r = fr.apply(SPECIES.length());
2646         boolean[] mask = fm.apply(SPECIES.length());
2647         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2648 
2649         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2650             for (int i = 0; i < a.length; i += SPECIES.length()) {
2651                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2652                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2653                 av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
2654             }
2655         }
2656 
2657         assertArraysEquals(r, a, b, mask, LongMaxVectorTests::ROL);
2658     }
2659 

2660     static long ROR_unary(long a, long b) {
2661         return (long)(ROR_scalar(a, b));
2662     }
2663 
2664     @Test(dataProvider = "longBinaryOpProvider")
2665     static void RORLongMaxVectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2666         long[] a = fa.apply(SPECIES.length());
2667         long[] b = fb.apply(SPECIES.length());
2668         long[] r = fr.apply(SPECIES.length());
2669 
2670         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2671             for (int i = 0; i < a.length; i += SPECIES.length()) {
2672                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2673                 av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
2674             }
2675         }
2676 
2677         assertShiftArraysEquals(r, a, b, LongMaxVectorTests::ROR_unary);
2678     }
2679 


2680     @Test(dataProvider = "longBinaryOpMaskProvider")
2681     static void RORLongMaxVectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
2682                                           IntFunction<boolean[]> fm) {
2683         long[] a = fa.apply(SPECIES.length());
2684         long[] b = fb.apply(SPECIES.length());
2685         long[] r = fr.apply(SPECIES.length());
2686         boolean[] mask = fm.apply(SPECIES.length());
2687         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2688 
2689         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2690             for (int i = 0; i < a.length; i += SPECIES.length()) {
2691                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2692                 av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
2693             }
2694         }
2695 
2696         assertShiftArraysEquals(r, a, b, mask, LongMaxVectorTests::ROR_unary);
2697     }
2698 

2699     static long ROL_unary(long a, long b) {
2700         return (long)(ROL_scalar(a, b));
2701     }
2702 
2703     @Test(dataProvider = "longBinaryOpProvider")
2704     static void ROLLongMaxVectorTestsScalarShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2705         long[] a = fa.apply(SPECIES.length());
2706         long[] b = fb.apply(SPECIES.length());
2707         long[] r = fr.apply(SPECIES.length());
2708 
2709         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2710             for (int i = 0; i < a.length; i += SPECIES.length()) {
2711                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2712                 av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
2713             }
2714         }
2715 
2716         assertShiftArraysEquals(r, a, b, LongMaxVectorTests::ROL_unary);
2717     }
2718 


2719     @Test(dataProvider = "longBinaryOpMaskProvider")
2720     static void ROLLongMaxVectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
2721                                           IntFunction<boolean[]> fm) {
2722         long[] a = fa.apply(SPECIES.length());
2723         long[] b = fb.apply(SPECIES.length());
2724         long[] r = fr.apply(SPECIES.length());
2725         boolean[] mask = fm.apply(SPECIES.length());
2726         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2727 
2728         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2729             for (int i = 0; i < a.length; i += SPECIES.length()) {
2730                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2731                 av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
2732             }
2733         }
2734 
2735         assertShiftArraysEquals(r, a, b, mask, LongMaxVectorTests::ROL_unary);
2736     }


2737     static long LSHR_binary_const(long a) {
2738         return (long)((a >>> CONST_SHIFT));
2739     }
2740 
2741     @Test(dataProvider = "longUnaryOpProvider")
2742     static void LSHRLongMaxVectorTestsScalarShiftConst(IntFunction<long[]> fa) {
2743         long[] a = fa.apply(SPECIES.length());
2744         long[] 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                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2749                 av.lanewise(VectorOperators.LSHR, CONST_SHIFT).intoArray(r, i);
2750             }
2751         }
2752 
2753         assertShiftConstEquals(r, a, LongMaxVectorTests::LSHR_binary_const);
2754     }
2755 


2756     @Test(dataProvider = "longUnaryOpMaskProvider")
2757     static void LSHRLongMaxVectorTestsScalarShiftMaskedConst(IntFunction<long[]> fa,
2758                                           IntFunction<boolean[]> fm) {
2759         long[] a = fa.apply(SPECIES.length());
2760         long[] r = fr.apply(SPECIES.length());
2761         boolean[] mask = fm.apply(SPECIES.length());
2762         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2763 
2764         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2765             for (int i = 0; i < a.length; i += SPECIES.length()) {
2766                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2767                 av.lanewise(VectorOperators.LSHR, CONST_SHIFT, vmask).intoArray(r, i);
2768             }
2769         }
2770 
2771         assertShiftConstEquals(r, a, mask, LongMaxVectorTests::LSHR_binary_const);
2772     }
2773 






2774     static long LSHL_binary_const(long a) {
2775         return (long)((a << CONST_SHIFT));
2776     }
2777 
2778     @Test(dataProvider = "longUnaryOpProvider")
2779     static void LSHLLongMaxVectorTestsScalarShiftConst(IntFunction<long[]> fa) {
2780         long[] a = fa.apply(SPECIES.length());
2781         long[] r = fr.apply(SPECIES.length());
2782 
2783         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2784             for (int i = 0; i < a.length; i += SPECIES.length()) {
2785                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2786                 av.lanewise(VectorOperators.LSHL, CONST_SHIFT).intoArray(r, i);
2787             }
2788         }
2789 
2790         assertShiftConstEquals(r, a, LongMaxVectorTests::LSHL_binary_const);
2791     }
2792 


2793     @Test(dataProvider = "longUnaryOpMaskProvider")
2794     static void LSHLLongMaxVectorTestsScalarShiftMaskedConst(IntFunction<long[]> fa,
2795                                           IntFunction<boolean[]> fm) {
2796         long[] a = fa.apply(SPECIES.length());
2797         long[] r = fr.apply(SPECIES.length());
2798         boolean[] mask = fm.apply(SPECIES.length());
2799         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2800 
2801         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2802             for (int i = 0; i < a.length; i += SPECIES.length()) {
2803                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2804                 av.lanewise(VectorOperators.LSHL, CONST_SHIFT, vmask).intoArray(r, i);
2805             }
2806         }
2807 
2808         assertShiftConstEquals(r, a, mask, LongMaxVectorTests::LSHL_binary_const);
2809     }
2810 


2811     static long ASHR_binary_const(long a) {
2812         return (long)((a >> CONST_SHIFT));
2813     }
2814 
2815     @Test(dataProvider = "longUnaryOpProvider")
2816     static void ASHRLongMaxVectorTestsScalarShiftConst(IntFunction<long[]> fa) {
2817         long[] a = fa.apply(SPECIES.length());
2818         long[] r = fr.apply(SPECIES.length());
2819 
2820         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2821             for (int i = 0; i < a.length; i += SPECIES.length()) {
2822                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2823                 av.lanewise(VectorOperators.ASHR, CONST_SHIFT).intoArray(r, i);
2824             }
2825         }
2826 
2827         assertShiftConstEquals(r, a, LongMaxVectorTests::ASHR_binary_const);
2828     }
2829 


2830     @Test(dataProvider = "longUnaryOpMaskProvider")
2831     static void ASHRLongMaxVectorTestsScalarShiftMaskedConst(IntFunction<long[]> fa,
2832                                           IntFunction<boolean[]> fm) {
2833         long[] a = fa.apply(SPECIES.length());
2834         long[] r = fr.apply(SPECIES.length());
2835         boolean[] mask = fm.apply(SPECIES.length());
2836         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2837 
2838         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2839             for (int i = 0; i < a.length; i += SPECIES.length()) {
2840                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2841                 av.lanewise(VectorOperators.ASHR, CONST_SHIFT, vmask).intoArray(r, i);
2842             }
2843         }
2844 
2845         assertShiftConstEquals(r, a, mask, LongMaxVectorTests::ASHR_binary_const);
2846     }
2847 


2848     static long ROR_binary_const(long a) {
2849         return (long)(ROR_scalar(a, CONST_SHIFT));
2850     }
2851 
2852     @Test(dataProvider = "longUnaryOpProvider")
2853     static void RORLongMaxVectorTestsScalarShiftConst(IntFunction<long[]> fa) {
2854         long[] a = fa.apply(SPECIES.length());
2855         long[] r = fr.apply(SPECIES.length());
2856 
2857         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2858             for (int i = 0; i < a.length; i += SPECIES.length()) {
2859                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2860                 av.lanewise(VectorOperators.ROR, CONST_SHIFT).intoArray(r, i);
2861             }
2862         }
2863 
2864         assertShiftConstEquals(r, a, LongMaxVectorTests::ROR_binary_const);
2865     }
2866 


2867     @Test(dataProvider = "longUnaryOpMaskProvider")
2868     static void RORLongMaxVectorTestsScalarShiftMaskedConst(IntFunction<long[]> fa,
2869                                           IntFunction<boolean[]> fm) {
2870         long[] a = fa.apply(SPECIES.length());
2871         long[] r = fr.apply(SPECIES.length());
2872         boolean[] mask = fm.apply(SPECIES.length());
2873         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2874 
2875         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2876             for (int i = 0; i < a.length; i += SPECIES.length()) {
2877                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2878                 av.lanewise(VectorOperators.ROR, CONST_SHIFT, vmask).intoArray(r, i);
2879             }
2880         }
2881 
2882         assertShiftConstEquals(r, a, mask, LongMaxVectorTests::ROR_binary_const);
2883     }
2884 


2885     static long ROL_binary_const(long a) {
2886         return (long)(ROL_scalar(a, CONST_SHIFT));
2887     }
2888 
2889     @Test(dataProvider = "longUnaryOpProvider")
2890     static void ROLLongMaxVectorTestsScalarShiftConst(IntFunction<long[]> fa) {
2891         long[] a = fa.apply(SPECIES.length());
2892         long[] r = fr.apply(SPECIES.length());
2893 
2894         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2895             for (int i = 0; i < a.length; i += SPECIES.length()) {
2896                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2897                 av.lanewise(VectorOperators.ROL, CONST_SHIFT).intoArray(r, i);
2898             }
2899         }
2900 
2901         assertShiftConstEquals(r, a, LongMaxVectorTests::ROL_binary_const);
2902     }
2903 


2904     @Test(dataProvider = "longUnaryOpMaskProvider")
2905     static void ROLLongMaxVectorTestsScalarShiftMaskedConst(IntFunction<long[]> fa,
2906                                           IntFunction<boolean[]> fm) {
2907         long[] a = fa.apply(SPECIES.length());
2908         long[] r = fr.apply(SPECIES.length());
2909         boolean[] mask = fm.apply(SPECIES.length());
2910         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2911 
2912         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2913             for (int i = 0; i < a.length; i += SPECIES.length()) {
2914                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2915                 av.lanewise(VectorOperators.ROL, CONST_SHIFT, vmask).intoArray(r, i);
2916             }
2917         }
2918 
2919         assertShiftConstEquals(r, a, mask, LongMaxVectorTests::ROL_binary_const);
2920     }
2921 
2922 
2923     static long MIN(long a, long b) {
2924         return (long)(Math.min(a, b));
2925     }
2926 
2927     @Test(dataProvider = "longBinaryOpProvider")
2928     static void MINLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2929         long[] a = fa.apply(SPECIES.length());
2930         long[] b = fb.apply(SPECIES.length());
2931         long[] r = fr.apply(SPECIES.length());
2932 
2933         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2934             for (int i = 0; i < a.length; i += SPECIES.length()) {
2935                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2936                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2937                 av.lanewise(VectorOperators.MIN, bv).intoArray(r, i);
2938             }
2939         }
2940 
2941         assertArraysEquals(r, a, b, LongMaxVectorTests::MIN);
2942     }
2943 
2944     static long min(long a, long b) {
2945         return (long)(Math.min(a, b));
2946     }
2947 
2948     @Test(dataProvider = "longBinaryOpProvider")
2949     static void minLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2950         long[] a = fa.apply(SPECIES.length());
2951         long[] b = fb.apply(SPECIES.length());
2952         long[] r = fr.apply(SPECIES.length());
2953 
2954         for (int i = 0; i < a.length; i += SPECIES.length()) {
2955             LongVector av = LongVector.fromArray(SPECIES, a, i);
2956             LongVector bv = LongVector.fromArray(SPECIES, b, i);
2957             av.min(bv).intoArray(r, i);
2958         }
2959 
2960         assertArraysEquals(r, a, b, LongMaxVectorTests::min);
2961     }
2962 
2963     static long MAX(long a, long b) {
2964         return (long)(Math.max(a, b));
2965     }
2966 
2967     @Test(dataProvider = "longBinaryOpProvider")
2968     static void MAXLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2969         long[] a = fa.apply(SPECIES.length());
2970         long[] b = fb.apply(SPECIES.length());
2971         long[] r = fr.apply(SPECIES.length());
2972 
2973         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2974             for (int i = 0; i < a.length; i += SPECIES.length()) {
2975                 LongVector av = LongVector.fromArray(SPECIES, a, i);
2976                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
2977                 av.lanewise(VectorOperators.MAX, bv).intoArray(r, i);
2978             }
2979         }
2980 
2981         assertArraysEquals(r, a, b, LongMaxVectorTests::MAX);
2982     }
2983 
2984     static long max(long a, long b) {
2985         return (long)(Math.max(a, b));
2986     }
2987 
2988     @Test(dataProvider = "longBinaryOpProvider")
2989     static void maxLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
2990         long[] a = fa.apply(SPECIES.length());
2991         long[] b = fb.apply(SPECIES.length());
2992         long[] r = fr.apply(SPECIES.length());
2993 
2994         for (int i = 0; i < a.length; i += SPECIES.length()) {
2995             LongVector av = LongVector.fromArray(SPECIES, a, i);
2996             LongVector bv = LongVector.fromArray(SPECIES, b, i);
2997             av.max(bv).intoArray(r, i);
2998         }
2999 
3000         assertArraysEquals(r, a, b, LongMaxVectorTests::max);
3001     }
3002 
3003     @Test(dataProvider = "longBinaryOpProvider")

3057     }
3058 
3059     static long ANDReduce(long[] a, int idx) {
3060         long res = -1;
3061         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3062             res &= a[i];
3063         }
3064 
3065         return res;
3066     }
3067 
3068     static long ANDReduceAll(long[] a) {
3069         long res = -1;
3070         for (int i = 0; i < a.length; i += SPECIES.length()) {
3071             res &= ANDReduce(a, i);
3072         }
3073 
3074         return res;
3075     }
3076 

3077     @Test(dataProvider = "longUnaryOpProvider")
3078     static void ANDReduceLongMaxVectorTests(IntFunction<long[]> fa) {
3079         long[] a = fa.apply(SPECIES.length());
3080         long[] r = fr.apply(SPECIES.length());
3081         long ra = -1;
3082 
3083         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3084             for (int i = 0; i < a.length; i += SPECIES.length()) {
3085                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3086                 r[i] = av.reduceLanes(VectorOperators.AND);
3087             }
3088         }
3089 
3090         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3091             ra = -1;
3092             for (int i = 0; i < a.length; i += SPECIES.length()) {
3093                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3094                 ra &= av.reduceLanes(VectorOperators.AND);
3095             }
3096         }
3097 
3098         assertReductionArraysEquals(r, ra, a,
3099                 LongMaxVectorTests::ANDReduce, LongMaxVectorTests::ANDReduceAll);
3100     }
3101 

3102     static long ANDReduceMasked(long[] a, int idx, boolean[] mask) {
3103         long res = -1;
3104         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3105             if (mask[i % SPECIES.length()])
3106                 res &= a[i];
3107         }
3108 
3109         return res;
3110     }
3111 
3112     static long ANDReduceAllMasked(long[] a, boolean[] mask) {
3113         long res = -1;
3114         for (int i = 0; i < a.length; i += SPECIES.length()) {
3115             res &= ANDReduceMasked(a, i, mask);
3116         }
3117 
3118         return res;
3119     }
3120 

3121     @Test(dataProvider = "longUnaryOpMaskProvider")
3122     static void ANDReduceLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
3123         long[] a = fa.apply(SPECIES.length());
3124         long[] r = fr.apply(SPECIES.length());
3125         boolean[] mask = fm.apply(SPECIES.length());
3126         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3127         long ra = -1;
3128 
3129         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3130             for (int i = 0; i < a.length; i += SPECIES.length()) {
3131                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3132                 r[i] = av.reduceLanes(VectorOperators.AND, vmask);
3133             }
3134         }
3135 
3136         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3137             ra = -1;
3138             for (int i = 0; i < a.length; i += SPECIES.length()) {
3139                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3140                 ra &= av.reduceLanes(VectorOperators.AND, vmask);
3141             }
3142         }
3143 
3144         assertReductionArraysEqualsMasked(r, ra, a, mask,
3145                 LongMaxVectorTests::ANDReduceMasked, LongMaxVectorTests::ANDReduceAllMasked);
3146     }
3147 

3148     static long ORReduce(long[] a, int idx) {
3149         long res = 0;
3150         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3151             res |= a[i];
3152         }
3153 
3154         return res;
3155     }
3156 
3157     static long ORReduceAll(long[] a) {
3158         long res = 0;
3159         for (int i = 0; i < a.length; i += SPECIES.length()) {
3160             res |= ORReduce(a, i);
3161         }
3162 
3163         return res;
3164     }
3165 

3166     @Test(dataProvider = "longUnaryOpProvider")
3167     static void ORReduceLongMaxVectorTests(IntFunction<long[]> fa) {
3168         long[] a = fa.apply(SPECIES.length());
3169         long[] r = fr.apply(SPECIES.length());
3170         long ra = 0;
3171 
3172         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3173             for (int i = 0; i < a.length; i += SPECIES.length()) {
3174                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3175                 r[i] = av.reduceLanes(VectorOperators.OR);
3176             }
3177         }
3178 
3179         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3180             ra = 0;
3181             for (int i = 0; i < a.length; i += SPECIES.length()) {
3182                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3183                 ra |= av.reduceLanes(VectorOperators.OR);
3184             }
3185         }
3186 
3187         assertReductionArraysEquals(r, ra, a,
3188                 LongMaxVectorTests::ORReduce, LongMaxVectorTests::ORReduceAll);
3189     }
3190 

3191     static long ORReduceMasked(long[] a, int idx, boolean[] mask) {
3192         long res = 0;
3193         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3194             if (mask[i % SPECIES.length()])
3195                 res |= a[i];
3196         }
3197 
3198         return res;
3199     }
3200 
3201     static long ORReduceAllMasked(long[] a, boolean[] mask) {
3202         long res = 0;
3203         for (int i = 0; i < a.length; i += SPECIES.length()) {
3204             res |= ORReduceMasked(a, i, mask);
3205         }
3206 
3207         return res;
3208     }
3209 

3210     @Test(dataProvider = "longUnaryOpMaskProvider")
3211     static void ORReduceLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
3212         long[] a = fa.apply(SPECIES.length());
3213         long[] r = fr.apply(SPECIES.length());
3214         boolean[] mask = fm.apply(SPECIES.length());
3215         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3216         long ra = 0;
3217 
3218         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3219             for (int i = 0; i < a.length; i += SPECIES.length()) {
3220                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3221                 r[i] = av.reduceLanes(VectorOperators.OR, vmask);
3222             }
3223         }
3224 
3225         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3226             ra = 0;
3227             for (int i = 0; i < a.length; i += SPECIES.length()) {
3228                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3229                 ra |= av.reduceLanes(VectorOperators.OR, vmask);
3230             }
3231         }
3232 
3233         assertReductionArraysEqualsMasked(r, ra, a, mask,
3234                 LongMaxVectorTests::ORReduceMasked, LongMaxVectorTests::ORReduceAllMasked);
3235     }
3236 

3237     static long XORReduce(long[] a, int idx) {
3238         long res = 0;
3239         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3240             res ^= a[i];
3241         }
3242 
3243         return res;
3244     }
3245 
3246     static long XORReduceAll(long[] a) {
3247         long res = 0;
3248         for (int i = 0; i < a.length; i += SPECIES.length()) {
3249             res ^= XORReduce(a, i);
3250         }
3251 
3252         return res;
3253     }
3254 

3255     @Test(dataProvider = "longUnaryOpProvider")
3256     static void XORReduceLongMaxVectorTests(IntFunction<long[]> fa) {
3257         long[] a = fa.apply(SPECIES.length());
3258         long[] r = fr.apply(SPECIES.length());
3259         long ra = 0;
3260 
3261         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3262             for (int i = 0; i < a.length; i += SPECIES.length()) {
3263                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3264                 r[i] = av.reduceLanes(VectorOperators.XOR);
3265             }
3266         }
3267 
3268         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3269             ra = 0;
3270             for (int i = 0; i < a.length; i += SPECIES.length()) {
3271                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3272                 ra ^= av.reduceLanes(VectorOperators.XOR);
3273             }
3274         }
3275 
3276         assertReductionArraysEquals(r, ra, a,
3277                 LongMaxVectorTests::XORReduce, LongMaxVectorTests::XORReduceAll);
3278     }
3279 

3280     static long XORReduceMasked(long[] a, int idx, boolean[] mask) {
3281         long res = 0;
3282         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3283             if (mask[i % SPECIES.length()])
3284                 res ^= a[i];
3285         }
3286 
3287         return res;
3288     }
3289 
3290     static long XORReduceAllMasked(long[] a, boolean[] mask) {
3291         long res = 0;
3292         for (int i = 0; i < a.length; i += SPECIES.length()) {
3293             res ^= XORReduceMasked(a, i, mask);
3294         }
3295 
3296         return res;
3297     }
3298 

3299     @Test(dataProvider = "longUnaryOpMaskProvider")
3300     static void XORReduceLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
3301         long[] a = fa.apply(SPECIES.length());
3302         long[] r = fr.apply(SPECIES.length());
3303         boolean[] mask = fm.apply(SPECIES.length());
3304         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3305         long ra = 0;
3306 
3307         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3308             for (int i = 0; i < a.length; i += SPECIES.length()) {
3309                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3310                 r[i] = av.reduceLanes(VectorOperators.XOR, vmask);
3311             }
3312         }
3313 
3314         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3315             ra = 0;
3316             for (int i = 0; i < a.length; i += SPECIES.length()) {
3317                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3318                 ra ^= av.reduceLanes(VectorOperators.XOR, vmask);

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

3780     @Test(dataProvider = "boolUnaryOpProvider")
3781     static void anyTrueLongMaxVectorTests(IntFunction<boolean[]> fm) {
3782         boolean[] mask = fm.apply(SPECIES.length());
3783         boolean[] r = fmr.apply(SPECIES.length());
3784 
3785         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3786             for (int i = 0; i < mask.length; i += SPECIES.length()) {
3787                 VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, i);
3788                 r[i] = vmask.anyTrue();
3789             }
3790         }
3791 
3792         assertReductionBoolArraysEquals(r, mask, LongMaxVectorTests::anyTrue);
3793     }
3794 

3795     static boolean allTrue(boolean[] a, int idx) {
3796         boolean res = true;
3797         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3798             res &= a[i];
3799         }
3800 
3801         return res;
3802     }
3803 

3804     @Test(dataProvider = "boolUnaryOpProvider")
3805     static void allTrueLongMaxVectorTests(IntFunction<boolean[]> fm) {
3806         boolean[] mask = fm.apply(SPECIES.length());
3807         boolean[] r = fmr.apply(SPECIES.length());
3808 
3809         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3810             for (int i = 0; i < mask.length; i += SPECIES.length()) {
3811                 VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, i);
3812                 r[i] = vmask.allTrue();
3813             }
3814         }
3815 
3816         assertReductionBoolArraysEquals(r, mask, LongMaxVectorTests::allTrue);
3817     }
3818 

3819     @Test(dataProvider = "longUnaryOpProvider")
3820     static void withLongMaxVectorTests(IntFunction<long []> fa) {
3821         long[] a = fa.apply(SPECIES.length());
3822         long[] r = fr.apply(SPECIES.length());
3823 
3824         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3825             for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
3826                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3827                 av.withLane((j++ & (SPECIES.length()-1)), (long)(65535+i)).intoArray(r, i);
3828             }
3829         }
3830 
3831 
3832         for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
3833             assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
3834         }
3835     }
3836 
3837     static boolean testIS_DEFAULT(long a) {
3838         return bits(a)==0;
3839     }
3840 
3841     @Test(dataProvider = "longTestOpProvider")
3842     static void IS_DEFAULTLongMaxVectorTests(IntFunction<long[]> fa) {
3843         long[] a = fa.apply(SPECIES.length());
3844 
3845         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3846             for (int i = 0; i < a.length; i += SPECIES.length()) {
3847                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3848                 VectorMask<Long> mv = av.test(VectorOperators.IS_DEFAULT);
3849 
3850                 // Check results as part of computation.
3851                 for (int j = 0; j < SPECIES.length(); j++) {
3852                     Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j]));
3853                 }
3854             }
3855         }
3856     }
3857 
3858     @Test(dataProvider = "longTestOpMaskProvider")
3859     static void IS_DEFAULTMaskedLongMaxVectorTests(IntFunction<long[]> fa,
3860                                           IntFunction<boolean[]> fm) {
3861         long[] a = fa.apply(SPECIES.length());
3862         boolean[] mask = fm.apply(SPECIES.length());
3863         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3864 
3865         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3866             for (int i = 0; i < a.length; i += SPECIES.length()) {
3867                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3868                 VectorMask<Long> mv = av.test(VectorOperators.IS_DEFAULT, vmask);
3869 
3870                 // Check results as part of computation.
3871                 for (int j = 0; j < SPECIES.length(); j++) {
3872                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j]));
3873                 }
3874             }
3875         }
3876     }
3877 
3878     static boolean testIS_NEGATIVE(long a) {
3879         return bits(a)<0;
3880     }
3881 
3882     @Test(dataProvider = "longTestOpProvider")
3883     static void IS_NEGATIVELongMaxVectorTests(IntFunction<long[]> fa) {
3884         long[] a = fa.apply(SPECIES.length());
3885 
3886         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3887             for (int i = 0; i < a.length; i += SPECIES.length()) {
3888                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3889                 VectorMask<Long> mv = av.test(VectorOperators.IS_NEGATIVE);
3890 
3891                 // Check results as part of computation.
3892                 for (int j = 0; j < SPECIES.length(); j++) {
3893                     Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j]));
3894                 }
3895             }
3896         }
3897     }

3899     @Test(dataProvider = "longTestOpMaskProvider")
3900     static void IS_NEGATIVEMaskedLongMaxVectorTests(IntFunction<long[]> fa,
3901                                           IntFunction<boolean[]> fm) {
3902         long[] a = fa.apply(SPECIES.length());
3903         boolean[] mask = fm.apply(SPECIES.length());
3904         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3905 
3906         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3907             for (int i = 0; i < a.length; i += SPECIES.length()) {
3908                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3909                 VectorMask<Long> mv = av.test(VectorOperators.IS_NEGATIVE, vmask);
3910 
3911                 // Check results as part of computation.
3912                 for (int j = 0; j < SPECIES.length(); j++) {
3913                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j]));
3914                 }
3915             }
3916         }
3917     }
3918 



3919     @Test(dataProvider = "longCompareOpProvider")
3920     static void LTLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
3921         long[] a = fa.apply(SPECIES.length());
3922         long[] b = fb.apply(SPECIES.length());
3923 
3924         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3925             for (int i = 0; i < a.length; i += SPECIES.length()) {
3926                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3927                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
3928                 VectorMask<Long> mv = av.compare(VectorOperators.LT, bv);
3929 
3930                 // Check results as part of computation.
3931                 for (int j = 0; j < SPECIES.length(); j++) {
3932                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
3933                 }
3934             }
3935         }
3936     }
3937 

3938     @Test(dataProvider = "longCompareOpProvider")
3939     static void ltLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
3940         long[] a = fa.apply(SPECIES.length());
3941         long[] b = fb.apply(SPECIES.length());
3942 
3943         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3944             for (int i = 0; i < a.length; i += SPECIES.length()) {
3945                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3946                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
3947                 VectorMask<Long> mv = av.lt(bv);
3948 
3949                 // Check results as part of computation.
3950                 for (int j = 0; j < SPECIES.length(); j++) {
3951                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
3952                 }
3953             }
3954         }
3955     }
3956 
3957     @Test(dataProvider = "longCompareOpMaskProvider")

3960         long[] a = fa.apply(SPECIES.length());
3961         long[] b = fb.apply(SPECIES.length());
3962         boolean[] mask = fm.apply(SPECIES.length());
3963 
3964         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3965 
3966         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3967             for (int i = 0; i < a.length; i += SPECIES.length()) {
3968                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3969                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
3970                 VectorMask<Long> mv = av.compare(VectorOperators.LT, bv, vmask);
3971 
3972                 // Check results as part of computation.
3973                 for (int j = 0; j < SPECIES.length(); j++) {
3974                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j]));
3975                 }
3976             }
3977         }
3978     }
3979 

3980     @Test(dataProvider = "longCompareOpProvider")
3981     static void GTLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
3982         long[] a = fa.apply(SPECIES.length());
3983         long[] b = fb.apply(SPECIES.length());
3984 
3985         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3986             for (int i = 0; i < a.length; i += SPECIES.length()) {
3987                 LongVector av = LongVector.fromArray(SPECIES, a, i);
3988                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
3989                 VectorMask<Long> mv = av.compare(VectorOperators.GT, bv);
3990 
3991                 // Check results as part of computation.
3992                 for (int j = 0; j < SPECIES.length(); j++) {
3993                     Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j]));
3994                 }
3995             }
3996         }
3997     }
3998 
3999     @Test(dataProvider = "longCompareOpMaskProvider")

4002         long[] a = fa.apply(SPECIES.length());
4003         long[] b = fb.apply(SPECIES.length());
4004         boolean[] mask = fm.apply(SPECIES.length());
4005 
4006         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4007 
4008         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4009             for (int i = 0; i < a.length; i += SPECIES.length()) {
4010                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4011                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4012                 VectorMask<Long> mv = av.compare(VectorOperators.GT, bv, vmask);
4013 
4014                 // Check results as part of computation.
4015                 for (int j = 0; j < SPECIES.length(); j++) {
4016                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j]));
4017                 }
4018             }
4019         }
4020     }
4021 

4022     @Test(dataProvider = "longCompareOpProvider")
4023     static void EQLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4024         long[] a = fa.apply(SPECIES.length());
4025         long[] b = fb.apply(SPECIES.length());
4026 
4027         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4028             for (int i = 0; i < a.length; i += SPECIES.length()) {
4029                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4030                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4031                 VectorMask<Long> mv = av.compare(VectorOperators.EQ, bv);
4032 
4033                 // Check results as part of computation.
4034                 for (int j = 0; j < SPECIES.length(); j++) {
4035                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
4036                 }
4037             }
4038         }
4039     }
4040 

4041     @Test(dataProvider = "longCompareOpProvider")
4042     static void eqLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4043         long[] a = fa.apply(SPECIES.length());
4044         long[] b = fb.apply(SPECIES.length());
4045 
4046         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4047             for (int i = 0; i < a.length; i += SPECIES.length()) {
4048                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4049                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4050                 VectorMask<Long> mv = av.eq(bv);
4051 
4052                 // Check results as part of computation.
4053                 for (int j = 0; j < SPECIES.length(); j++) {
4054                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
4055                 }
4056             }
4057         }
4058     }
4059 
4060     @Test(dataProvider = "longCompareOpMaskProvider")

4063         long[] a = fa.apply(SPECIES.length());
4064         long[] b = fb.apply(SPECIES.length());
4065         boolean[] mask = fm.apply(SPECIES.length());
4066 
4067         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4068 
4069         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4070             for (int i = 0; i < a.length; i += SPECIES.length()) {
4071                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4072                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4073                 VectorMask<Long> mv = av.compare(VectorOperators.EQ, bv, vmask);
4074 
4075                 // Check results as part of computation.
4076                 for (int j = 0; j < SPECIES.length(); j++) {
4077                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j]));
4078                 }
4079             }
4080         }
4081     }
4082 

4083     @Test(dataProvider = "longCompareOpProvider")
4084     static void NELongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4085         long[] a = fa.apply(SPECIES.length());
4086         long[] b = fb.apply(SPECIES.length());
4087 
4088         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4089             for (int i = 0; i < a.length; i += SPECIES.length()) {
4090                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4091                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4092                 VectorMask<Long> mv = av.compare(VectorOperators.NE, bv);
4093 
4094                 // Check results as part of computation.
4095                 for (int j = 0; j < SPECIES.length(); j++) {
4096                     Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j]));
4097                 }
4098             }
4099         }
4100     }
4101 
4102     @Test(dataProvider = "longCompareOpMaskProvider")

4105         long[] a = fa.apply(SPECIES.length());
4106         long[] b = fb.apply(SPECIES.length());
4107         boolean[] mask = fm.apply(SPECIES.length());
4108 
4109         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4110 
4111         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4112             for (int i = 0; i < a.length; i += SPECIES.length()) {
4113                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4114                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4115                 VectorMask<Long> mv = av.compare(VectorOperators.NE, bv, vmask);
4116 
4117                 // Check results as part of computation.
4118                 for (int j = 0; j < SPECIES.length(); j++) {
4119                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j]));
4120                 }
4121             }
4122         }
4123     }
4124 

4125     @Test(dataProvider = "longCompareOpProvider")
4126     static void LELongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4127         long[] a = fa.apply(SPECIES.length());
4128         long[] b = fb.apply(SPECIES.length());
4129 
4130         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4131             for (int i = 0; i < a.length; i += SPECIES.length()) {
4132                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4133                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4134                 VectorMask<Long> mv = av.compare(VectorOperators.LE, bv);
4135 
4136                 // Check results as part of computation.
4137                 for (int j = 0; j < SPECIES.length(); j++) {
4138                     Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j]));
4139                 }
4140             }
4141         }
4142     }
4143 
4144     @Test(dataProvider = "longCompareOpMaskProvider")

4147         long[] a = fa.apply(SPECIES.length());
4148         long[] b = fb.apply(SPECIES.length());
4149         boolean[] mask = fm.apply(SPECIES.length());
4150 
4151         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4152 
4153         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4154             for (int i = 0; i < a.length; i += SPECIES.length()) {
4155                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4156                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4157                 VectorMask<Long> mv = av.compare(VectorOperators.LE, bv, vmask);
4158 
4159                 // Check results as part of computation.
4160                 for (int j = 0; j < SPECIES.length(); j++) {
4161                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j]));
4162                 }
4163             }
4164         }
4165     }
4166 

4167     @Test(dataProvider = "longCompareOpProvider")
4168     static void GELongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4169         long[] a = fa.apply(SPECIES.length());
4170         long[] b = fb.apply(SPECIES.length());
4171 
4172         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4173             for (int i = 0; i < a.length; i += SPECIES.length()) {
4174                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4175                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4176                 VectorMask<Long> mv = av.compare(VectorOperators.GE, bv);
4177 
4178                 // Check results as part of computation.
4179                 for (int j = 0; j < SPECIES.length(); j++) {
4180                     Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j]));
4181                 }
4182             }
4183         }
4184     }
4185 
4186     @Test(dataProvider = "longCompareOpMaskProvider")

4189         long[] a = fa.apply(SPECIES.length());
4190         long[] b = fb.apply(SPECIES.length());
4191         boolean[] mask = fm.apply(SPECIES.length());
4192 
4193         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4194 
4195         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4196             for (int i = 0; i < a.length; i += SPECIES.length()) {
4197                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4198                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4199                 VectorMask<Long> mv = av.compare(VectorOperators.GE, bv, vmask);
4200 
4201                 // Check results as part of computation.
4202                 for (int j = 0; j < SPECIES.length(); j++) {
4203                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j]));
4204                 }
4205             }
4206         }
4207     }
4208 


4209     @Test(dataProvider = "longCompareOpProvider")
4210     static void UNSIGNED_LTLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4211         long[] a = fa.apply(SPECIES.length());
4212         long[] b = fb.apply(SPECIES.length());
4213 
4214         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4215             for (int i = 0; i < a.length; i += SPECIES.length()) {
4216                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4217                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4218                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_LT, bv);
4219 
4220                 // Check results as part of computation.
4221                 for (int j = 0; j < SPECIES.length(); j++) {
4222                     Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j]));
4223                 }
4224             }
4225         }
4226     }
4227 


4228     @Test(dataProvider = "longCompareOpMaskProvider")
4229     static void UNSIGNED_LTLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4230                                                 IntFunction<boolean[]> fm) {
4231         long[] a = fa.apply(SPECIES.length());
4232         long[] b = fb.apply(SPECIES.length());
4233         boolean[] mask = fm.apply(SPECIES.length());
4234 
4235         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4236 
4237         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4238             for (int i = 0; i < a.length; i += SPECIES.length()) {
4239                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4240                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4241                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_LT, bv, vmask);
4242 
4243                 // Check results as part of computation.
4244                 for (int j = 0; j < SPECIES.length(); j++) {
4245                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j]));
4246                 }
4247             }
4248         }
4249     }
4250 



4251     @Test(dataProvider = "longCompareOpProvider")
4252     static void UNSIGNED_GTLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4253         long[] a = fa.apply(SPECIES.length());
4254         long[] b = fb.apply(SPECIES.length());
4255 
4256         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4257             for (int i = 0; i < a.length; i += SPECIES.length()) {
4258                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4259                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4260                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_GT, bv);
4261 
4262                 // Check results as part of computation.
4263                 for (int j = 0; j < SPECIES.length(); j++) {
4264                     Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j]));
4265                 }
4266             }
4267         }
4268     }
4269 


4270     @Test(dataProvider = "longCompareOpMaskProvider")
4271     static void UNSIGNED_GTLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4272                                                 IntFunction<boolean[]> fm) {
4273         long[] a = fa.apply(SPECIES.length());
4274         long[] b = fb.apply(SPECIES.length());
4275         boolean[] mask = fm.apply(SPECIES.length());
4276 
4277         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4278 
4279         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4280             for (int i = 0; i < a.length; i += SPECIES.length()) {
4281                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4282                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4283                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_GT, bv, vmask);
4284 
4285                 // Check results as part of computation.
4286                 for (int j = 0; j < SPECIES.length(); j++) {
4287                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j]));
4288                 }
4289             }
4290         }
4291     }
4292 



4293     @Test(dataProvider = "longCompareOpProvider")
4294     static void UNSIGNED_LELongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4295         long[] a = fa.apply(SPECIES.length());
4296         long[] b = fb.apply(SPECIES.length());
4297 
4298         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4299             for (int i = 0; i < a.length; i += SPECIES.length()) {
4300                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4301                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4302                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_LE, bv);
4303 
4304                 // Check results as part of computation.
4305                 for (int j = 0; j < SPECIES.length(); j++) {
4306                     Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j]));
4307                 }
4308             }
4309         }
4310     }
4311 


4312     @Test(dataProvider = "longCompareOpMaskProvider")
4313     static void UNSIGNED_LELongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4314                                                 IntFunction<boolean[]> fm) {
4315         long[] a = fa.apply(SPECIES.length());
4316         long[] b = fb.apply(SPECIES.length());
4317         boolean[] mask = fm.apply(SPECIES.length());
4318 
4319         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4320 
4321         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4322             for (int i = 0; i < a.length; i += SPECIES.length()) {
4323                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4324                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4325                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_LE, bv, vmask);
4326 
4327                 // Check results as part of computation.
4328                 for (int j = 0; j < SPECIES.length(); j++) {
4329                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j]));
4330                 }
4331             }
4332         }
4333     }
4334 



4335     @Test(dataProvider = "longCompareOpProvider")
4336     static void UNSIGNED_GELongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4337         long[] a = fa.apply(SPECIES.length());
4338         long[] b = fb.apply(SPECIES.length());
4339 
4340         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4341             for (int i = 0; i < a.length; i += SPECIES.length()) {
4342                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4343                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4344                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_GE, bv);
4345 
4346                 // Check results as part of computation.
4347                 for (int j = 0; j < SPECIES.length(); j++) {
4348                     Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j]));
4349                 }
4350             }
4351         }
4352     }
4353 


4354     @Test(dataProvider = "longCompareOpMaskProvider")
4355     static void UNSIGNED_GELongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4356                                                 IntFunction<boolean[]> fm) {
4357         long[] a = fa.apply(SPECIES.length());
4358         long[] b = fb.apply(SPECIES.length());
4359         boolean[] mask = fm.apply(SPECIES.length());
4360 
4361         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4362 
4363         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4364             for (int i = 0; i < a.length; i += SPECIES.length()) {
4365                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4366                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4367                 VectorMask<Long> mv = av.compare(VectorOperators.UNSIGNED_GE, bv, vmask);
4368 
4369                 // Check results as part of computation.
4370                 for (int j = 0; j < SPECIES.length(); j++) {
4371                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j]));
4372                 }
4373             }
4374         }
4375     }
4376 


4377     @Test(dataProvider = "longCompareOpProvider")
4378     static void LTLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4379         long[] a = fa.apply(SPECIES.length());
4380         long[] b = fb.apply(SPECIES.length());
4381 
4382         for (int i = 0; i < a.length; i += SPECIES.length()) {
4383             LongVector av = LongVector.fromArray(SPECIES, a, i);
4384             VectorMask<Long> mv = av.compare(VectorOperators.LT, b[i]);
4385 
4386             // Check results as part of computation.
4387             for (int j = 0; j < SPECIES.length(); j++) {
4388                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
4389             }
4390         }
4391     }
4392 

4393     @Test(dataProvider = "longCompareOpMaskProvider")
4394     static void LTLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa,
4395                                 IntFunction<long[]> fb, IntFunction<boolean[]> fm) {
4396         long[] a = fa.apply(SPECIES.length());
4397         long[] b = fb.apply(SPECIES.length());
4398         boolean[] mask = fm.apply(SPECIES.length());
4399 
4400         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4401 
4402         for (int i = 0; i < a.length; i += SPECIES.length()) {
4403             LongVector av = LongVector.fromArray(SPECIES, a, i);
4404             VectorMask<Long> mv = av.compare(VectorOperators.LT, b[i], vmask);
4405 
4406             // Check results as part of computation.
4407             for (int j = 0; j < SPECIES.length(); j++) {
4408                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i]));
4409             }
4410         }
4411     }
4412 
4413 
4414     @Test(dataProvider = "longCompareOpProvider")
4415     static void EQLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4416         long[] a = fa.apply(SPECIES.length());
4417         long[] b = fb.apply(SPECIES.length());
4418 
4419         for (int i = 0; i < a.length; i += SPECIES.length()) {
4420             LongVector av = LongVector.fromArray(SPECIES, a, i);
4421             VectorMask<Long> mv = av.compare(VectorOperators.EQ, b[i]);
4422 
4423             // Check results as part of computation.
4424             for (int j = 0; j < SPECIES.length(); j++) {
4425                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
4426             }
4427         }
4428     }
4429 

4430     @Test(dataProvider = "longCompareOpMaskProvider")
4431     static void EQLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa,
4432                                 IntFunction<long[]> fb, IntFunction<boolean[]> fm) {
4433         long[] a = fa.apply(SPECIES.length());
4434         long[] b = fb.apply(SPECIES.length());
4435         boolean[] mask = fm.apply(SPECIES.length());
4436 
4437         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4438 
4439         for (int i = 0; i < a.length; i += SPECIES.length()) {
4440             LongVector av = LongVector.fromArray(SPECIES, a, i);
4441             VectorMask<Long> mv = av.compare(VectorOperators.EQ, b[i], vmask);
4442 
4443             // Check results as part of computation.
4444             for (int j = 0; j < SPECIES.length(); j++) {
4445                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i]));
4446             }
4447         }
4448     }
4449 

4489         assertRearrangeArraysEquals(r, a, order, SPECIES.length());
4490     }
4491 
4492     @Test(dataProvider = "longUnaryOpShuffleMaskProvider")
4493     static void RearrangeLongMaxVectorTestsMaskedSmokeTest(IntFunction<long[]> fa,
4494                                                           BiFunction<Integer,Integer,int[]> fs,
4495                                                           IntFunction<boolean[]> fm) {
4496         long[] a = fa.apply(SPECIES.length());
4497         int[] order = fs.apply(a.length, SPECIES.length());
4498         long[] r = fr.apply(SPECIES.length());
4499         boolean[] mask = fm.apply(SPECIES.length());
4500         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4501 
4502         for (int i = 0; i < a.length; i += SPECIES.length()) {
4503             LongVector av = LongVector.fromArray(SPECIES, a, i);
4504             av.rearrange(VectorShuffle.fromArray(SPECIES, order, i), vmask).intoArray(r, i);
4505         }
4506 
4507         assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
4508     }
4509 
4510     @Test(dataProvider = "longUnaryOpMaskProvider")
4511     static void compressLongMaxVectorTests(IntFunction<long[]> fa,
4512                                                 IntFunction<boolean[]> fm) {
4513         long[] a = fa.apply(SPECIES.length());
4514         long[] r = fr.apply(SPECIES.length());
4515         boolean[] mask = fm.apply(SPECIES.length());
4516         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4517 
4518         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4519             for (int i = 0; i < a.length; i += SPECIES.length()) {
4520                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4521                 av.compress(vmask).intoArray(r, i);
4522             }
4523         }
4524 
4525         assertcompressArraysEquals(r, a, mask, SPECIES.length());
4526     }
4527 
4528     @Test(dataProvider = "longUnaryOpMaskProvider")
4529     static void expandLongMaxVectorTests(IntFunction<long[]> fa,
4530                                                 IntFunction<boolean[]> fm) {
4531         long[] a = fa.apply(SPECIES.length());
4532         long[] r = fr.apply(SPECIES.length());
4533         boolean[] mask = fm.apply(SPECIES.length());
4534         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4535 
4536         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4537             for (int i = 0; i < a.length; i += SPECIES.length()) {
4538                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4539                 av.expand(vmask).intoArray(r, i);
4540             }
4541         }
4542 
4543         assertexpandArraysEquals(r, a, mask, SPECIES.length());
4544     }
4545 
4546     @Test(dataProvider = "longUnaryOpProvider")
4547     static void getLongMaxVectorTests(IntFunction<long[]> fa) {
4548         long[] a = fa.apply(SPECIES.length());
4549         long[] r = fr.apply(SPECIES.length());
4550 
4551         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4552             for (int i = 0; i < a.length; i += SPECIES.length()) {
4553                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4554                 int num_lanes = SPECIES.length();
4555                 // Manually unroll because full unroll happens after intrinsification.
4556                 // Unroll is needed because get intrinsic requires for index to be a known constant.
4557                 if (num_lanes == 1) {
4558                     r[i]=av.lane(0);
4559                 } else if (num_lanes == 2) {
4560                     r[i]=av.lane(0);
4561                     r[i+1]=av.lane(1);
4562                 } else if (num_lanes == 4) {
4563                     r[i]=av.lane(0);
4564                     r[i+1]=av.lane(1);
4565                     r[i+2]=av.lane(2);

4696             }
4697         }
4698 
4699         assertArraysEquals(r, a, LongMaxVectorTests::get);
4700     }
4701 
4702     @Test(dataProvider = "longUnaryOpProvider")
4703     static void BroadcastLongMaxVectorTests(IntFunction<long[]> fa) {
4704         long[] a = fa.apply(SPECIES.length());
4705         long[] r = new long[a.length];
4706 
4707         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4708             for (int i = 0; i < a.length; i += SPECIES.length()) {
4709                 LongVector.broadcast(SPECIES, a[i]).intoArray(r, i);
4710             }
4711         }
4712 
4713         assertBroadcastArraysEquals(r, a);
4714     }
4715 




4716     @Test(dataProvider = "longUnaryOpProvider")
4717     static void ZeroLongMaxVectorTests(IntFunction<long[]> fa) {
4718         long[] a = fa.apply(SPECIES.length());
4719         long[] r = new long[a.length];
4720 
4721         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4722             for (int i = 0; i < a.length; i += SPECIES.length()) {
4723                 LongVector.zero(SPECIES).intoArray(a, i);
4724             }
4725         }
4726 
4727         Assert.assertEquals(a, r);
4728     }
4729 



4730     static long[] sliceUnary(long[] a, int origin, int idx) {
4731         long[] res = new long[SPECIES.length()];
4732         for (int i = 0; i < SPECIES.length(); i++){
4733             if(i+origin < SPECIES.length())
4734                 res[i] = a[idx+i+origin];
4735             else
4736                 res[i] = (long)0;
4737         }
4738         return res;
4739     }
4740 
4741     @Test(dataProvider = "longUnaryOpProvider")
4742     static void sliceUnaryLongMaxVectorTests(IntFunction<long[]> fa) {
4743         long[] a = fa.apply(SPECIES.length());
4744         long[] r = new long[a.length];
4745         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4746         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4747             for (int i = 0; i < a.length; i += SPECIES.length()) {
4748                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4749                 av.slice(origin).intoArray(r, i);
4750             }
4751         }
4752 
4753         assertArraysEquals(r, a, origin, LongMaxVectorTests::sliceUnary);
4754     }
4755 
4756     static long[] sliceBinary(long[] a, long[] b, int origin, int idx) {
4757         long[] res = new long[SPECIES.length()];
4758         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4759             if(i+origin < SPECIES.length())
4760                 res[i] = a[idx+i+origin];
4761             else {
4762                 res[i] = b[idx+j];
4763                 j++;
4764             }
4765         }
4766         return res;
4767     }
4768 
4769     @Test(dataProvider = "longBinaryOpProvider")
4770     static void sliceBinaryLongMaxVectorTestsBinary(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4771         long[] a = fa.apply(SPECIES.length());
4772         long[] b = fb.apply(SPECIES.length());
4773         long[] r = new long[a.length];
4774         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4775         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4776             for (int i = 0; i < a.length; i += SPECIES.length()) {
4777                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4778                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4779                 av.slice(origin, bv).intoArray(r, i);
4780             }
4781         }
4782 
4783         assertArraysEquals(r, a, b, origin, LongMaxVectorTests::sliceBinary);
4784     }
4785 
4786     static long[] slice(long[] a, long[] b, int origin, boolean[] mask, int idx) {
4787         long[] res = new long[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] : (long)0;
4791             else {
4792                 res[i] = mask[i] ? b[idx+j] : (long)0;
4793                 j++;
4794             }
4795         }
4796         return res;
4797     }
4798 
4799     @Test(dataProvider = "longBinaryOpMaskProvider")
4800     static void sliceLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4801     IntFunction<boolean[]> fm) {
4802         long[] a = fa.apply(SPECIES.length());
4803         long[] b = fb.apply(SPECIES.length());
4804         boolean[] mask = fm.apply(SPECIES.length());
4805         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4806 
4807         long[] r = new long[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                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4812                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4813                 av.slice(origin, bv, vmask).intoArray(r, i);
4814             }
4815         }
4816 
4817         assertArraysEquals(r, a, b, origin, mask, LongMaxVectorTests::slice);
4818     }
4819 
4820     static long[] unsliceUnary(long[] a, int origin, int idx) {
4821         long[] res = new long[SPECIES.length()];
4822         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4823             if(i < origin)
4824                 res[i] = (long)0;
4825             else {
4826                 res[i] = a[idx+j];
4827                 j++;
4828             }
4829         }
4830         return res;
4831     }
4832 
4833     @Test(dataProvider = "longUnaryOpProvider")
4834     static void unsliceUnaryLongMaxVectorTests(IntFunction<long[]> fa) {
4835         long[] a = fa.apply(SPECIES.length());
4836         long[] r = new long[a.length];
4837         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4838         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4839             for (int i = 0; i < a.length; i += SPECIES.length()) {
4840                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4841                 av.unslice(origin).intoArray(r, i);
4842             }
4843         }
4844 
4845         assertArraysEquals(r, a, origin, LongMaxVectorTests::unsliceUnary);
4846     }
4847 
4848     static long[] unsliceBinary(long[] a, long[] b, int origin, int part, int idx) {
4849         long[] res = new long[SPECIES.length()];
4850         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4851             if (part == 0) {
4852                 if (i < origin)
4853                     res[i] = b[idx+i];
4854                 else {
4855                     res[i] = a[idx+j];
4856                     j++;
4857                 }
4858             } else if (part == 1) {
4859                 if (i < origin)
4860                     res[i] = a[idx+SPECIES.length()-origin+i];
4861                 else {
4862                     res[i] = b[idx+origin+j];
4863                     j++;
4864                 }
4865             }
4866         }
4867         return res;
4868     }
4869 
4870     @Test(dataProvider = "longBinaryOpProvider")
4871     static void unsliceBinaryLongMaxVectorTestsBinary(IntFunction<long[]> fa, IntFunction<long[]> fb) {
4872         long[] a = fa.apply(SPECIES.length());
4873         long[] b = fb.apply(SPECIES.length());
4874         long[] r = new long[a.length];
4875         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4876         int part = (new java.util.Random()).nextInt(2);
4877         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4878             for (int i = 0; i < a.length; i += SPECIES.length()) {
4879                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4880                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4881                 av.unslice(origin, bv, part).intoArray(r, i);
4882             }
4883         }
4884 
4885         assertArraysEquals(r, a, b, origin, part, LongMaxVectorTests::unsliceBinary);
4886     }
4887 
4888     static long[] unslice(long[] a, long[] b, int origin, int part, boolean[] mask, int idx) {
4889         long[] res = new long[SPECIES.length()];
4890         for (int i = 0, j = 0; i < SPECIES.length(); i++){
4891             if(i+origin < SPECIES.length())
4892                 res[i] = b[idx+i+origin];
4893             else {
4894                 res[i] = b[idx+j];
4895                 j++;
4896             }
4897         }
4898         for (int i = 0; i < SPECIES.length(); i++){
4899             res[i] = mask[i] ? a[idx+i] : res[i];
4900         }
4901         long[] res1 = new long[SPECIES.length()];
4902         if (part == 0) {
4903             for (int i = 0, j = 0; i < SPECIES.length(); i++){
4904                 if (i < origin)
4905                     res1[i] = b[idx+i];
4906                 else {
4907                    res1[i] = res[j];

4925     static void unsliceLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4926     IntFunction<boolean[]> fm) {
4927         long[] a = fa.apply(SPECIES.length());
4928         long[] b = fb.apply(SPECIES.length());
4929         boolean[] mask = fm.apply(SPECIES.length());
4930         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4931         long[] r = new long[a.length];
4932         int origin = (new java.util.Random()).nextInt(SPECIES.length());
4933         int part = (new java.util.Random()).nextInt(2);
4934         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4935             for (int i = 0; i < a.length; i += SPECIES.length()) {
4936                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4937                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4938                 av.unslice(origin, bv, part, vmask).intoArray(r, i);
4939             }
4940         }
4941 
4942         assertArraysEquals(r, a, b, origin, part, mask, LongMaxVectorTests::unslice);
4943     }
4944 






















4945     static long BITWISE_BLEND(long a, long b, long c) {
4946         return (long)((a&~(c))|(b&c));
4947     }
4948 
4949     static long bitwiseBlend(long a, long b, long c) {
4950         return (long)((a&~(c))|(b&c));
4951     }
4952 

4953     @Test(dataProvider = "longTernaryOpProvider")
4954     static void BITWISE_BLENDLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
4955         long[] a = fa.apply(SPECIES.length());
4956         long[] b = fb.apply(SPECIES.length());
4957         long[] c = fc.apply(SPECIES.length());
4958         long[] r = fr.apply(SPECIES.length());
4959 
4960         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4961             for (int i = 0; i < a.length; i += SPECIES.length()) {
4962                 LongVector av = LongVector.fromArray(SPECIES, a, i);
4963                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
4964                 LongVector cv = LongVector.fromArray(SPECIES, c, i);
4965                 av.lanewise(VectorOperators.BITWISE_BLEND, bv, cv).intoArray(r, i);
4966             }
4967         }
4968 
4969         assertArraysEquals(r, a, b, c, LongMaxVectorTests::BITWISE_BLEND);
4970     }
4971 
4972     @Test(dataProvider = "longTernaryOpProvider")
4973     static void bitwiseBlendLongMaxVectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
4974         long[] a = fa.apply(SPECIES.length());
4975         long[] b = fb.apply(SPECIES.length());
4976         long[] c = fc.apply(SPECIES.length());
4977         long[] r = fr.apply(SPECIES.length());
4978 
4979         for (int i = 0; i < a.length; i += SPECIES.length()) {
4980             LongVector av = LongVector.fromArray(SPECIES, a, i);
4981             LongVector bv = LongVector.fromArray(SPECIES, b, i);
4982             LongVector cv = LongVector.fromArray(SPECIES, c, i);
4983             av.bitwiseBlend(bv, cv).intoArray(r, i);
4984         }
4985 
4986         assertArraysEquals(r, a, b, c, LongMaxVectorTests::bitwiseBlend);
4987     }
4988 

4989     @Test(dataProvider = "longTernaryOpMaskProvider")
4990     static void BITWISE_BLENDLongMaxVectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
4991                                           IntFunction<long[]> fc, IntFunction<boolean[]> fm) {
4992         long[] a = fa.apply(SPECIES.length());
4993         long[] b = fb.apply(SPECIES.length());
4994         long[] c = fc.apply(SPECIES.length());
4995         long[] r = fr.apply(SPECIES.length());
4996         boolean[] mask = fm.apply(SPECIES.length());
4997         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4998 
4999         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5000             for (int i = 0; i < a.length; i += SPECIES.length()) {
5001                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5002                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
5003                 LongVector cv = LongVector.fromArray(SPECIES, c, i);
5004                 av.lanewise(VectorOperators.BITWISE_BLEND, bv, cv, vmask).intoArray(r, i);
5005             }
5006         }
5007 
5008         assertArraysEquals(r, a, b, c, mask, LongMaxVectorTests::BITWISE_BLEND);
5009     }
5010 



5011     @Test(dataProvider = "longTernaryOpProvider")
5012     static void BITWISE_BLENDLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
5013         long[] a = fa.apply(SPECIES.length());
5014         long[] b = fb.apply(SPECIES.length());
5015         long[] c = fc.apply(SPECIES.length());
5016         long[] r = fr.apply(SPECIES.length());
5017 
5018         for (int i = 0; i < a.length; i += SPECIES.length()) {
5019             LongVector av = LongVector.fromArray(SPECIES, a, i);
5020             LongVector bv = LongVector.fromArray(SPECIES, b, i);
5021             av.lanewise(VectorOperators.BITWISE_BLEND, bv, c[i]).intoArray(r, i);
5022         }
5023         assertBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::BITWISE_BLEND);
5024     }
5025 
5026     @Test(dataProvider = "longTernaryOpProvider")
5027     static void BITWISE_BLENDLongMaxVectorTestsAltBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
5028         long[] a = fa.apply(SPECIES.length());
5029         long[] b = fb.apply(SPECIES.length());
5030         long[] c = fc.apply(SPECIES.length());
5031         long[] r = fr.apply(SPECIES.length());
5032 
5033         for (int i = 0; i < a.length; i += SPECIES.length()) {
5034             LongVector av = LongVector.fromArray(SPECIES, a, i);
5035             LongVector cv = LongVector.fromArray(SPECIES, c, i);
5036             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], cv).intoArray(r, i);
5037         }
5038         assertAltBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::BITWISE_BLEND);
5039     }
5040 
5041     @Test(dataProvider = "longTernaryOpProvider")
5042     static void bitwiseBlendLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
5043         long[] a = fa.apply(SPECIES.length());
5044         long[] b = fb.apply(SPECIES.length());
5045         long[] c = fc.apply(SPECIES.length());
5046         long[] r = fr.apply(SPECIES.length());
5047 
5048         for (int i = 0; i < a.length; i += SPECIES.length()) {
5049             LongVector av = LongVector.fromArray(SPECIES, a, i);
5050             LongVector bv = LongVector.fromArray(SPECIES, b, i);
5051             av.bitwiseBlend(bv, c[i]).intoArray(r, i);
5052         }
5053         assertBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::bitwiseBlend);
5054     }
5055 
5056     @Test(dataProvider = "longTernaryOpProvider")
5057     static void bitwiseBlendLongMaxVectorTestsAltBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
5058         long[] a = fa.apply(SPECIES.length());
5059         long[] b = fb.apply(SPECIES.length());
5060         long[] c = fc.apply(SPECIES.length());
5061         long[] r = fr.apply(SPECIES.length());
5062 
5063         for (int i = 0; i < a.length; i += SPECIES.length()) {
5064             LongVector av = LongVector.fromArray(SPECIES, a, i);
5065             LongVector cv = LongVector.fromArray(SPECIES, c, i);
5066             av.bitwiseBlend(b[i], cv).intoArray(r, i);
5067         }
5068         assertAltBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::bitwiseBlend);
5069     }
5070 

5071     @Test(dataProvider = "longTernaryOpMaskProvider")
5072     static void BITWISE_BLENDLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
5073                                           IntFunction<long[]> fc, IntFunction<boolean[]> fm) {
5074         long[] a = fa.apply(SPECIES.length());
5075         long[] b = fb.apply(SPECIES.length());
5076         long[] c = fc.apply(SPECIES.length());
5077         long[] r = fr.apply(SPECIES.length());
5078         boolean[] mask = fm.apply(SPECIES.length());
5079         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5080 
5081         for (int i = 0; i < a.length; i += SPECIES.length()) {
5082             LongVector av = LongVector.fromArray(SPECIES, a, i);
5083             LongVector bv = LongVector.fromArray(SPECIES, b, i);
5084             av.lanewise(VectorOperators.BITWISE_BLEND, bv, c[i], vmask).intoArray(r, i);
5085         }
5086 
5087         assertBroadcastArraysEquals(r, a, b, c, mask, LongMaxVectorTests::BITWISE_BLEND);
5088     }
5089 
5090     @Test(dataProvider = "longTernaryOpMaskProvider")
5091     static void BITWISE_BLENDLongMaxVectorTestsAltBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
5092                                           IntFunction<long[]> fc, IntFunction<boolean[]> fm) {
5093         long[] a = fa.apply(SPECIES.length());
5094         long[] b = fb.apply(SPECIES.length());
5095         long[] c = fc.apply(SPECIES.length());
5096         long[] r = fr.apply(SPECIES.length());
5097         boolean[] mask = fm.apply(SPECIES.length());
5098         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5099 
5100         for (int i = 0; i < a.length; i += SPECIES.length()) {
5101             LongVector av = LongVector.fromArray(SPECIES, a, i);
5102             LongVector cv = LongVector.fromArray(SPECIES, c, i);
5103             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], cv, vmask).intoArray(r, i);
5104         }
5105 
5106         assertAltBroadcastArraysEquals(r, a, b, c, mask, LongMaxVectorTests::BITWISE_BLEND);
5107     }
5108 



5109     @Test(dataProvider = "longTernaryOpProvider")
5110     static void BITWISE_BLENDLongMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
5111         long[] a = fa.apply(SPECIES.length());
5112         long[] b = fb.apply(SPECIES.length());
5113         long[] c = fc.apply(SPECIES.length());
5114         long[] r = fr.apply(SPECIES.length());
5115 
5116         for (int i = 0; i < a.length; i += SPECIES.length()) {
5117             LongVector av = LongVector.fromArray(SPECIES, a, i);
5118             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], c[i]).intoArray(r, i);
5119         }
5120 
5121         assertDoubleBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::BITWISE_BLEND);
5122     }
5123 
5124     @Test(dataProvider = "longTernaryOpProvider")
5125     static void bitwiseBlendLongMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
5126         long[] a = fa.apply(SPECIES.length());
5127         long[] b = fb.apply(SPECIES.length());
5128         long[] c = fc.apply(SPECIES.length());
5129         long[] r = fr.apply(SPECIES.length());
5130 
5131         for (int i = 0; i < a.length; i += SPECIES.length()) {
5132             LongVector av = LongVector.fromArray(SPECIES, a, i);
5133             av.bitwiseBlend(b[i], c[i]).intoArray(r, i);
5134         }
5135 
5136         assertDoubleBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::bitwiseBlend);
5137     }
5138 

5139     @Test(dataProvider = "longTernaryOpMaskProvider")
5140     static void BITWISE_BLENDLongMaxVectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
5141                                           IntFunction<long[]> fc, IntFunction<boolean[]> fm) {
5142         long[] a = fa.apply(SPECIES.length());
5143         long[] b = fb.apply(SPECIES.length());
5144         long[] c = fc.apply(SPECIES.length());
5145         long[] r = fr.apply(SPECIES.length());
5146         boolean[] mask = fm.apply(SPECIES.length());
5147         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5148 
5149         for (int i = 0; i < a.length; i += SPECIES.length()) {
5150             LongVector av = LongVector.fromArray(SPECIES, a, i);
5151             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], c[i], vmask).intoArray(r, i);
5152         }
5153 
5154         assertDoubleBroadcastArraysEquals(r, a, b, c, mask, LongMaxVectorTests::BITWISE_BLEND);
5155     }
5156 

5157     static long NEG(long a) {
5158         return (long)(-((long)a));
5159     }
5160 
5161     static long neg(long a) {
5162         return (long)(-((long)a));
5163     }
5164 
5165     @Test(dataProvider = "longUnaryOpProvider")
5166     static void NEGLongMaxVectorTests(IntFunction<long[]> fa) {
5167         long[] a = fa.apply(SPECIES.length());
5168         long[] r = fr.apply(SPECIES.length());
5169 
5170         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5171             for (int i = 0; i < a.length; i += SPECIES.length()) {
5172                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5173                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
5174             }
5175         }
5176 

5249     }
5250 
5251     @Test(dataProvider = "longUnaryOpMaskProvider")
5252     static void ABSMaskedLongMaxVectorTests(IntFunction<long[]> fa,
5253                                                 IntFunction<boolean[]> fm) {
5254         long[] a = fa.apply(SPECIES.length());
5255         long[] r = fr.apply(SPECIES.length());
5256         boolean[] mask = fm.apply(SPECIES.length());
5257         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5258 
5259         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5260             for (int i = 0; i < a.length; i += SPECIES.length()) {
5261                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5262                 av.lanewise(VectorOperators.ABS, vmask).intoArray(r, i);
5263             }
5264         }
5265 
5266         assertArraysEquals(r, a, mask, LongMaxVectorTests::ABS);
5267     }
5268 

5269     static long NOT(long a) {
5270         return (long)(~((long)a));
5271     }
5272 
5273     static long not(long a) {
5274         return (long)(~((long)a));
5275     }
5276 


5277     @Test(dataProvider = "longUnaryOpProvider")
5278     static void NOTLongMaxVectorTests(IntFunction<long[]> fa) {
5279         long[] a = fa.apply(SPECIES.length());
5280         long[] r = fr.apply(SPECIES.length());
5281 
5282         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5283             for (int i = 0; i < a.length; i += SPECIES.length()) {
5284                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5285                 av.lanewise(VectorOperators.NOT).intoArray(r, i);
5286             }
5287         }
5288 
5289         assertArraysEquals(r, a, LongMaxVectorTests::NOT);
5290     }
5291 
5292     @Test(dataProvider = "longUnaryOpProvider")
5293     static void notLongMaxVectorTests(IntFunction<long[]> fa) {
5294         long[] a = fa.apply(SPECIES.length());
5295         long[] r = fr.apply(SPECIES.length());
5296 
5297         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5298             for (int i = 0; i < a.length; i += SPECIES.length()) {
5299                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5300                 av.not().intoArray(r, i);
5301             }
5302         }
5303 
5304         assertArraysEquals(r, a, LongMaxVectorTests::not);
5305     }
5306 


5307     @Test(dataProvider = "longUnaryOpMaskProvider")
5308     static void NOTMaskedLongMaxVectorTests(IntFunction<long[]> fa,
5309                                                 IntFunction<boolean[]> fm) {
5310         long[] a = fa.apply(SPECIES.length());
5311         long[] r = fr.apply(SPECIES.length());
5312         boolean[] mask = fm.apply(SPECIES.length());
5313         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5314 
5315         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5316             for (int i = 0; i < a.length; i += SPECIES.length()) {
5317                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5318                 av.lanewise(VectorOperators.NOT, vmask).intoArray(r, i);
5319             }
5320         }
5321 
5322         assertArraysEquals(r, a, mask, LongMaxVectorTests::NOT);
5323     }
5324 


5325     static long ZOMO(long a) {
5326         return (long)((a==0?0:-1));
5327     }
5328 


5329     @Test(dataProvider = "longUnaryOpProvider")
5330     static void ZOMOLongMaxVectorTests(IntFunction<long[]> fa) {
5331         long[] a = fa.apply(SPECIES.length());
5332         long[] r = fr.apply(SPECIES.length());
5333 
5334         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5335             for (int i = 0; i < a.length; i += SPECIES.length()) {
5336                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5337                 av.lanewise(VectorOperators.ZOMO).intoArray(r, i);
5338             }
5339         }
5340 
5341         assertArraysEquals(r, a, LongMaxVectorTests::ZOMO);
5342     }
5343 


5344     @Test(dataProvider = "longUnaryOpMaskProvider")
5345     static void ZOMOMaskedLongMaxVectorTests(IntFunction<long[]> fa,
5346                                                 IntFunction<boolean[]> fm) {
5347         long[] a = fa.apply(SPECIES.length());
5348         long[] r = fr.apply(SPECIES.length());
5349         boolean[] mask = fm.apply(SPECIES.length());
5350         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5351 
5352         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5353             for (int i = 0; i < a.length; i += SPECIES.length()) {
5354                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5355                 av.lanewise(VectorOperators.ZOMO, vmask).intoArray(r, i);
5356             }
5357         }
5358 
5359         assertArraysEquals(r, a, mask, LongMaxVectorTests::ZOMO);
5360     }
5361 
5362     static long BIT_COUNT(long a) {
5363         return (long)(Long.bitCount(a));
5364     }
5365 
5366     @Test(dataProvider = "longUnaryOpProvider")
5367     static void BIT_COUNTLongMaxVectorTests(IntFunction<long[]> fa) {
5368         long[] a = fa.apply(SPECIES.length());
5369         long[] r = fr.apply(SPECIES.length());
5370 
5371         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5372             for (int i = 0; i < a.length; i += SPECIES.length()) {
5373                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5374                 av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
5375             }
5376         }
5377 
5378         assertArraysEquals(r, a, LongMaxVectorTests::BIT_COUNT);
5379     }
5380 
5381     @Test(dataProvider = "longUnaryOpMaskProvider")
5382     static void BIT_COUNTMaskedLongMaxVectorTests(IntFunction<long[]> fa,
5383                                                 IntFunction<boolean[]> fm) {
5384         long[] a = fa.apply(SPECIES.length());
5385         long[] r = fr.apply(SPECIES.length());
5386         boolean[] mask = fm.apply(SPECIES.length());
5387         VectorMask<Long> 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                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5392                 av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
5393             }
5394         }
5395 
5396         assertArraysEquals(r, a, mask, LongMaxVectorTests::BIT_COUNT);
5397     }
5398 
5399     static long TRAILING_ZEROS_COUNT(long a) {
5400         return (long)(TRAILING_ZEROS_COUNT_scalar(a));
5401     }
5402 
5403     @Test(dataProvider = "longUnaryOpProvider")
5404     static void TRAILING_ZEROS_COUNTLongMaxVectorTests(IntFunction<long[]> fa) {
5405         long[] a = fa.apply(SPECIES.length());
5406         long[] r = fr.apply(SPECIES.length());
5407 
5408         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5409             for (int i = 0; i < a.length; i += SPECIES.length()) {
5410                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5411                 av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
5412             }
5413         }
5414 
5415         assertArraysEquals(r, a, LongMaxVectorTests::TRAILING_ZEROS_COUNT);
5416     }
5417 
5418     @Test(dataProvider = "longUnaryOpMaskProvider")
5419     static void TRAILING_ZEROS_COUNTMaskedLongMaxVectorTests(IntFunction<long[]> fa,
5420                                                 IntFunction<boolean[]> fm) {
5421         long[] a = fa.apply(SPECIES.length());
5422         long[] r = fr.apply(SPECIES.length());
5423         boolean[] mask = fm.apply(SPECIES.length());
5424         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5425 
5426         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5427             for (int i = 0; i < a.length; i += SPECIES.length()) {
5428                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5429                 av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
5430             }
5431         }
5432 
5433         assertArraysEquals(r, a, mask, LongMaxVectorTests::TRAILING_ZEROS_COUNT);
5434     }
5435 
5436     static long LEADING_ZEROS_COUNT(long a) {
5437         return (long)(LEADING_ZEROS_COUNT_scalar(a));
5438     }
5439 
5440     @Test(dataProvider = "longUnaryOpProvider")
5441     static void LEADING_ZEROS_COUNTLongMaxVectorTests(IntFunction<long[]> fa) {
5442         long[] a = fa.apply(SPECIES.length());
5443         long[] r = fr.apply(SPECIES.length());
5444 
5445         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5446             for (int i = 0; i < a.length; i += SPECIES.length()) {
5447                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5448                 av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
5449             }
5450         }
5451 
5452         assertArraysEquals(r, a, LongMaxVectorTests::LEADING_ZEROS_COUNT);
5453     }
5454 
5455     @Test(dataProvider = "longUnaryOpMaskProvider")
5456     static void LEADING_ZEROS_COUNTMaskedLongMaxVectorTests(IntFunction<long[]> fa,
5457                                                 IntFunction<boolean[]> fm) {
5458         long[] a = fa.apply(SPECIES.length());
5459         long[] r = fr.apply(SPECIES.length());
5460         boolean[] mask = fm.apply(SPECIES.length());
5461         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5462 
5463         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5464             for (int i = 0; i < a.length; i += SPECIES.length()) {
5465                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5466                 av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
5467             }
5468         }
5469 
5470         assertArraysEquals(r, a, mask, LongMaxVectorTests::LEADING_ZEROS_COUNT);
5471     }
5472 
5473     static long REVERSE(long a) {
5474         return (long)(REVERSE_scalar(a));
5475     }
5476 
5477     @Test(dataProvider = "longUnaryOpProvider")
5478     static void REVERSELongMaxVectorTests(IntFunction<long[]> fa) {
5479         long[] a = fa.apply(SPECIES.length());
5480         long[] r = fr.apply(SPECIES.length());
5481 
5482         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5483             for (int i = 0; i < a.length; i += SPECIES.length()) {
5484                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5485                 av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
5486             }
5487         }
5488 
5489         assertArraysEquals(r, a, LongMaxVectorTests::REVERSE);
5490     }
5491 
5492     @Test(dataProvider = "longUnaryOpMaskProvider")
5493     static void REVERSEMaskedLongMaxVectorTests(IntFunction<long[]> fa,
5494                                                 IntFunction<boolean[]> fm) {
5495         long[] a = fa.apply(SPECIES.length());
5496         long[] r = fr.apply(SPECIES.length());
5497         boolean[] mask = fm.apply(SPECIES.length());
5498         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5499 
5500         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5501             for (int i = 0; i < a.length; i += SPECIES.length()) {
5502                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5503                 av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
5504             }
5505         }
5506 
5507         assertArraysEquals(r, a, mask, LongMaxVectorTests::REVERSE);
5508     }
5509 
5510     static long REVERSE_BYTES(long a) {
5511         return (long)(Long.reverseBytes(a));
5512     }
5513 
5514     @Test(dataProvider = "longUnaryOpProvider")
5515     static void REVERSE_BYTESLongMaxVectorTests(IntFunction<long[]> fa) {
5516         long[] a = fa.apply(SPECIES.length());
5517         long[] r = fr.apply(SPECIES.length());
5518 
5519         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5520             for (int i = 0; i < a.length; i += SPECIES.length()) {
5521                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5522                 av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
5523             }
5524         }
5525 
5526         assertArraysEquals(r, a, LongMaxVectorTests::REVERSE_BYTES);
5527     }
5528 
5529     @Test(dataProvider = "longUnaryOpMaskProvider")
5530     static void REVERSE_BYTESMaskedLongMaxVectorTests(IntFunction<long[]> fa,
5531                                                 IntFunction<boolean[]> fm) {
5532         long[] a = fa.apply(SPECIES.length());
5533         long[] r = fr.apply(SPECIES.length());
5534         boolean[] mask = fm.apply(SPECIES.length());
5535         VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5536 
5537         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5538             for (int i = 0; i < a.length; i += SPECIES.length()) {
5539                 LongVector av = LongVector.fromArray(SPECIES, a, i);
5540                 av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
5541             }
5542         }
5543 
5544         assertArraysEquals(r, a, mask, LongMaxVectorTests::REVERSE_BYTES);
5545     }
5546 
5547     @Test(dataProvider = "longCompareOpProvider")
5548     static void ltLongMaxVectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
5549         long[] a = fa.apply(SPECIES.length());
5550         long[] b = fb.apply(SPECIES.length());
5551 
5552         for (int i = 0; i < a.length; i += SPECIES.length()) {
5553             LongVector av = LongVector.fromArray(SPECIES, a, i);
5554             VectorMask<Long> mv = av.lt(b[i]);
5555 
5556             // Check results as part of computation.
5557             for (int j = 0; j < SPECIES.length(); j++) {
5558                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
5559             }
5560         }
5561     }
5562 
5563     @Test(dataProvider = "longCompareOpProvider")
5564     static void eqLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
5565         long[] a = fa.apply(SPECIES.length());

5862             }
5863         }
5864         return i - idx;
5865     }
5866 
5867     @Test(dataProvider = "maskProvider")
5868     static void maskFirstTrueLongMaxVectorTestsSmokeTest(IntFunction<boolean[]> fa) {
5869         boolean[] a = fa.apply(SPECIES.length());
5870         int[] r = new int[a.length];
5871 
5872         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
5873             for (int i = 0; i < a.length; i += SPECIES.length()) {
5874                 var vmask = SPECIES.loadMask(a, i);
5875                 r[i] = vmask.firstTrue();
5876             }
5877         }
5878 
5879         assertMaskReductionArraysEquals(r, a, LongMaxVectorTests::maskFirstTrue);
5880     }
5881 
5882     @Test(dataProvider = "maskProvider")
5883     static void maskCompressLongMaxVectorTestsSmokeTest(IntFunction<boolean[]> fa) {
5884         int trueCount = 0;
5885         boolean[] a = fa.apply(SPECIES.length());
5886 
5887         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
5888             for (int i = 0; i < a.length; i += SPECIES.length()) {
5889                 var vmask = SPECIES.loadMask(a, i);
5890                 trueCount = vmask.trueCount();
5891                 var rmask = vmask.compress();
5892                 for (int j = 0; j < SPECIES.length(); j++)  {
5893                     Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
5894                 }
5895             }
5896         }
5897     }
5898 
5899 
5900     @DataProvider
5901     public static Object[][] offsetProvider() {
5902         return new Object[][]{
5903                 {0},
5904                 {-1},
5905                 {+1},
5906                 {+2},
5907                 {-2},
5908         };
5909     }
5910 
5911     @Test(dataProvider = "offsetProvider")
5912     static void indexInRangeLongMaxVectorTestsSmokeTest(int offset) {
5913         int limit = SPECIES.length() * BUFFER_REPS;
5914         for (int i = 0; i < limit; i += SPECIES.length()) {
5915             var actualMask = SPECIES.indexInRange(i + offset, limit);
5916             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
5917             assert(actualMask.equals(expectedMask));
5918             for (int j = 0; j < SPECIES.length(); j++)  {
5919                 int index = i + j + offset;
5920                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
5921             }
5922         }
5923     }
5924 
5925     @Test(dataProvider = "offsetProvider")
5926     static void indexInRangeLongLongMaxVectorTestsSmokeTest(int offset) {
5927         long limit = SPECIES.length() * BUFFER_REPS;
5928         for (long i = 0; i < limit; i += SPECIES.length()) {
5929             var actualMask = SPECIES.indexInRange(i + offset, limit);
5930             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
5931             assert(actualMask.equals(expectedMask));
5932             for (int j = 0; j < SPECIES.length(); j++)  {
5933                 long index = i + j + offset;
5934                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
5935             }
5936         }
5937     }
5938 
5939     @DataProvider
5940     public static Object[][] lengthProvider() {
5941         return new Object[][]{
5942                 {0},
5943                 {1},
5944                 {32},
5945                 {37},
5946                 {1024},
5947                 {1024+1},
5948                 {1024+5},
5949         };
5950     }
5951 
5952     @Test(dataProvider = "lengthProvider")
5953     static void loopBoundLongMaxVectorTestsSmokeTest(int length) {
5954         int actualLoopBound = SPECIES.loopBound(length);
5955         int expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
5956         Assert.assertEquals(actualLoopBound, expectedLoopBound);
5957     }
5958 
5959     @Test(dataProvider = "lengthProvider")
5960     static void loopBoundLongLongMaxVectorTestsSmokeTest(int _length) {
5961         long length = _length;
5962         long actualLoopBound = SPECIES.loopBound(length);
5963         long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
5964         Assert.assertEquals(actualLoopBound, expectedLoopBound);
5965     }
5966 
5967     @Test
5968     static void ElementSizeLongMaxVectorTestsSmokeTest() {
5969         LongVector av = LongVector.zero(SPECIES);
5970         int elsize = av.elementSize();
5971         Assert.assertEquals(elsize, Long.SIZE);
5972     }
5973 
5974     @Test
5975     static void VectorShapeLongMaxVectorTestsSmokeTest() {
5976         LongVector av = LongVector.zero(SPECIES);
5977         VectorShape vsh = av.shape();
5978         assert(vsh.equals(VectorShape.S_Max_BIT));
5979     }
5980 
5981     @Test
5982     static void ShapeWithLanesLongMaxVectorTestsSmokeTest() {
5983         LongVector av = LongVector.zero(SPECIES);
5984         VectorShape vsh = av.shape();
5985         VectorSpecies species = vsh.withLanes(long.class);
5986         assert(species.equals(SPECIES));

6009         LongVector av = LongVector.zero(SPECIES);
6010         VectorSpecies species = av.species().withLanes(long.class);
6011         assert(species.equals(SPECIES));
6012     }
6013 
6014     @Test
6015     static void WithShapeLongMaxVectorTestsSmokeTest() {
6016         LongVector av = LongVector.zero(SPECIES);
6017         VectorShape vsh = av.shape();
6018         VectorSpecies species = av.species().withShape(vsh);
6019         assert(species.equals(SPECIES));
6020     }
6021 
6022     @Test
6023     static void MaskAllTrueLongMaxVectorTestsSmokeTest() {
6024         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6025           Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length()));
6026         }
6027     }
6028 }

< prev index next >