< prev index next >

test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java

Print this page

  48 import java.util.function.BiFunction;
  49 import java.util.function.IntFunction;
  50 import java.util.Objects;
  51 import java.util.stream.Collectors;
  52 import java.util.stream.Stream;
  53 
  54 @Test
  55 public class FloatMaxVectorTests extends AbstractVectorTest {
  56 
  57     static final VectorSpecies<Float> SPECIES =
  58                 FloatVector.SPECIES_MAX;
  59 
  60     static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
  61 
  62     static VectorShape getMaxBit() {
  63         return VectorShape.S_Max_BIT;
  64     }
  65 
  66     private static final int Max = 256;  // juts so we can do N/Max
  67 
  68     private static final float CONST_SHIFT = Float.SIZE / 2;
  69 
  70     static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max);
  71 
  72     interface FUnOp {
  73         float apply(float a);
  74     }
  75 
  76     static void assertArraysEquals(float[] r, float[] a, FUnOp f) {
  77         int i = 0;
  78         try {
  79             for (; i < a.length; i++) {
  80                 Assert.assertEquals(r[i], f.apply(a[i]));
  81             }
  82         } catch (AssertionError e) {
  83             Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]);
  84         }
  85     }
  86 
  87     interface FUnArrayOp {
  88         float[] apply(float a);

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

















































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

1012         try {
1013             for (; i < r.length; i++) {
1014                 Assert.assertEquals(r[i], (long)(a[i+offs]));
1015             }
1016         } catch (AssertionError e) {
1017             Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
1018         }
1019     }
1020 
1021     static void assertArraysEquals(double[] r, float[] a, int offs) {
1022         int i = 0;
1023         try {
1024             for (; i < r.length; i++) {
1025                 Assert.assertEquals(r[i], (double)(a[i+offs]));
1026             }
1027         } catch (AssertionError e) {
1028             Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
1029         }
1030     }
1031 
1032 
1033     static int bits(float e) {
1034         return  Float.floatToIntBits(e);
1035     }
1036 
1037     static final List<IntFunction<float[]>> FLOAT_GENERATORS = List.of(
1038             withToString("float[-i * 5]", (int s) -> {
1039                 return fill(s * BUFFER_REPS,
1040                             i -> (float)(-i * 5));
1041             }),
1042             withToString("float[i * 5]", (int s) -> {
1043                 return fill(s * BUFFER_REPS,
1044                             i -> (float)(i * 5));
1045             }),
1046             withToString("float[i + 1]", (int s) -> {
1047                 return fill(s * BUFFER_REPS,
1048                             i -> (((float)(i + 1) == 0) ? 1 : (float)(i + 1)));
1049             }),
1050             withToString("float[cornerCaseValue(i)]", (int s) -> {
1051                 return fill(s * BUFFER_REPS,
1052                             i -> cornerCaseValue(i));

1196 
1197     @DataProvider
1198     public Object[][] floatUnaryOpSelectFromProvider() {
1199         return FLOAT_SHUFFLE_GENERATORS.stream().
1200                 flatMap(fs -> FLOAT_GENERATORS.stream().map(fa -> {
1201                     return new Object[] {fa, fs};
1202                 })).
1203                 toArray(Object[][]::new);
1204     }
1205 
1206     @DataProvider
1207     public Object[][] floatUnaryOpSelectFromMaskProvider() {
1208         return BOOLEAN_MASK_GENERATORS.stream().
1209                 flatMap(fm -> FLOAT_SHUFFLE_GENERATORS.stream().
1210                     flatMap(fs -> FLOAT_GENERATORS.stream().map(fa -> {
1211                         return new Object[] {fa, fs, fm};
1212                 }))).
1213                 toArray(Object[][]::new);
1214     }
1215 
1216 
1217     static final List<IntFunction<float[]>> FLOAT_COMPARE_GENERATORS = List.of(
1218             withToString("float[i]", (int s) -> {
1219                 return fill(s * BUFFER_REPS,
1220                             i -> (float)i);
1221             }),
1222             withToString("float[i - length / 2]", (int s) -> {
1223                 return fill(s * BUFFER_REPS,
1224                             i -> (float)(i - (s * BUFFER_REPS / 2)));
1225             }),
1226             withToString("float[i + 1]", (int s) -> {
1227                 return fill(s * BUFFER_REPS,
1228                             i -> (float)(i + 1));
1229             }),
1230             withToString("float[i - 2]", (int s) -> {
1231                 return fill(s * BUFFER_REPS,
1232                             i -> (float)(i - 2));
1233             }),
1234             withToString("float[zigZag(i)]", (int s) -> {
1235                 return fill(s * BUFFER_REPS,
1236                             i -> i%3 == 0 ? (float)i : (i%3 == 1 ? (float)(i + 1) : (float)(i - 2)));

1317 
1318     static float get(float[] a, int i) {
1319         return (float) a[i];
1320     }
1321 
1322     static final IntFunction<float[]> fr = (vl) -> {
1323         int length = BUFFER_REPS * vl;
1324         return new float[length];
1325     };
1326 
1327     static final IntFunction<boolean[]> fmr = (vl) -> {
1328         int length = BUFFER_REPS * vl;
1329         return new boolean[length];
1330     };
1331 
1332     static final IntFunction<long[]> lfr = (vl) -> {
1333         int length = BUFFER_REPS * vl;
1334         return new long[length];
1335     };
1336 
1337 
1338     static boolean eq(float a, float b) {
1339         return a == b;
1340     }
1341 
1342     static boolean neq(float a, float b) {
1343         return a != b;
1344     }
1345 
1346     static boolean lt(float a, float b) {
1347         return a < b;
1348     }
1349 
1350     static boolean le(float a, float b) {
1351         return a <= b;
1352     }
1353 
1354     static boolean gt(float a, float b) {
1355         return a > b;
1356     }
1357 
1358     static boolean ge(float a, float b) {
1359         return a >= b;
1360     }
1361 
1362 
1363     static float firstNonZero(float a, float b) {
1364         return Float.compare(a, (float) 0) != 0 ? a : b;
1365     }
1366 
1367     @Test
1368     static void smokeTest1() {
1369         FloatVector three = FloatVector.broadcast(SPECIES, (byte)-3);
1370         FloatVector three2 = (FloatVector) SPECIES.broadcast(-3);
1371         assert(three.eq(three2).allTrue());
1372         FloatVector three3 = three2.broadcast(1).broadcast(-3);
1373         assert(three.eq(three3).allTrue());
1374         int scale = 2;
1375         Class<?> ETYPE = float.class;
1376         if (ETYPE == double.class || ETYPE == long.class)
1377             scale = 1000000;
1378         else if (ETYPE == byte.class && SPECIES.length() >= 64)
1379             scale = 1;
1380         FloatVector higher = three.addIndex(scale);
1381         VectorMask<Float> m = three.compare(VectorOperators.LE, higher);
1382         assert(m.allTrue());

1459     static float ADD(float a, float b) {
1460         return (float)(a + b);
1461     }
1462 
1463     @Test(dataProvider = "floatBinaryOpProvider")
1464     static void ADDFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1465         float[] a = fa.apply(SPECIES.length());
1466         float[] b = fb.apply(SPECIES.length());
1467         float[] r = fr.apply(SPECIES.length());
1468 
1469         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1470             for (int i = 0; i < a.length; i += SPECIES.length()) {
1471                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1472                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1473                 av.lanewise(VectorOperators.ADD, bv).intoArray(r, i);
1474             }
1475         }
1476 
1477         assertArraysEquals(r, a, b, FloatMaxVectorTests::ADD);
1478     }

1479     static float add(float a, float b) {
1480         return (float)(a + b);
1481     }
1482 
1483     @Test(dataProvider = "floatBinaryOpProvider")
1484     static void addFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1485         float[] a = fa.apply(SPECIES.length());
1486         float[] b = fb.apply(SPECIES.length());
1487         float[] r = fr.apply(SPECIES.length());
1488 
1489         for (int i = 0; i < a.length; i += SPECIES.length()) {
1490             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1491             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1492             av.add(bv).intoArray(r, i);
1493         }
1494 
1495         assertArraysEquals(r, a, b, FloatMaxVectorTests::add);
1496     }
1497 
1498     @Test(dataProvider = "floatBinaryOpMaskProvider")

1515         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::ADD);
1516     }
1517 
1518     @Test(dataProvider = "floatBinaryOpMaskProvider")
1519     static void addFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1520                                           IntFunction<boolean[]> fm) {
1521         float[] a = fa.apply(SPECIES.length());
1522         float[] b = fb.apply(SPECIES.length());
1523         float[] r = fr.apply(SPECIES.length());
1524         boolean[] mask = fm.apply(SPECIES.length());
1525         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1526 
1527         for (int i = 0; i < a.length; i += SPECIES.length()) {
1528             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1529             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1530             av.add(bv, vmask).intoArray(r, i);
1531         }
1532 
1533         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::add);
1534     }

1535     static float SUB(float a, float b) {
1536         return (float)(a - b);
1537     }
1538 
1539     @Test(dataProvider = "floatBinaryOpProvider")
1540     static void SUBFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1541         float[] a = fa.apply(SPECIES.length());
1542         float[] b = fb.apply(SPECIES.length());
1543         float[] r = fr.apply(SPECIES.length());
1544 
1545         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1546             for (int i = 0; i < a.length; i += SPECIES.length()) {
1547                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1548                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1549                 av.lanewise(VectorOperators.SUB, bv).intoArray(r, i);
1550             }
1551         }
1552 
1553         assertArraysEquals(r, a, b, FloatMaxVectorTests::SUB);
1554     }

1555     static float sub(float a, float b) {
1556         return (float)(a - b);
1557     }
1558 
1559     @Test(dataProvider = "floatBinaryOpProvider")
1560     static void subFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1561         float[] a = fa.apply(SPECIES.length());
1562         float[] b = fb.apply(SPECIES.length());
1563         float[] r = fr.apply(SPECIES.length());
1564 
1565         for (int i = 0; i < a.length; i += SPECIES.length()) {
1566             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1567             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1568             av.sub(bv).intoArray(r, i);
1569         }
1570 
1571         assertArraysEquals(r, a, b, FloatMaxVectorTests::sub);
1572     }
1573 
1574     @Test(dataProvider = "floatBinaryOpMaskProvider")

1591         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::SUB);
1592     }
1593 
1594     @Test(dataProvider = "floatBinaryOpMaskProvider")
1595     static void subFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1596                                           IntFunction<boolean[]> fm) {
1597         float[] a = fa.apply(SPECIES.length());
1598         float[] b = fb.apply(SPECIES.length());
1599         float[] r = fr.apply(SPECIES.length());
1600         boolean[] mask = fm.apply(SPECIES.length());
1601         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1602 
1603         for (int i = 0; i < a.length; i += SPECIES.length()) {
1604             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1605             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1606             av.sub(bv, vmask).intoArray(r, i);
1607         }
1608 
1609         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::sub);
1610     }

1611     static float MUL(float a, float b) {
1612         return (float)(a * b);
1613     }
1614 
1615     @Test(dataProvider = "floatBinaryOpProvider")
1616     static void MULFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1617         float[] a = fa.apply(SPECIES.length());
1618         float[] b = fb.apply(SPECIES.length());
1619         float[] r = fr.apply(SPECIES.length());
1620 
1621         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1622             for (int i = 0; i < a.length; i += SPECIES.length()) {
1623                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1624                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1625                 av.lanewise(VectorOperators.MUL, bv).intoArray(r, i);
1626             }
1627         }
1628 
1629         assertArraysEquals(r, a, b, FloatMaxVectorTests::MUL);
1630     }

1631     static float mul(float a, float b) {
1632         return (float)(a * b);
1633     }
1634 
1635     @Test(dataProvider = "floatBinaryOpProvider")
1636     static void mulFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1637         float[] a = fa.apply(SPECIES.length());
1638         float[] b = fb.apply(SPECIES.length());
1639         float[] r = fr.apply(SPECIES.length());
1640 
1641         for (int i = 0; i < a.length; i += SPECIES.length()) {
1642             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1643             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1644             av.mul(bv).intoArray(r, i);
1645         }
1646 
1647         assertArraysEquals(r, a, b, FloatMaxVectorTests::mul);
1648     }
1649 
1650     @Test(dataProvider = "floatBinaryOpMaskProvider")

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

1708     static float div(float a, float b) {
1709         return (float)(a / b);
1710     }
1711 
1712     @Test(dataProvider = "floatBinaryOpProvider")
1713     static void divFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1714         float[] a = fa.apply(SPECIES.length());
1715         float[] b = fb.apply(SPECIES.length());
1716         float[] r = fr.apply(SPECIES.length());
1717 
1718         for (int i = 0; i < a.length; i += SPECIES.length()) {
1719             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1720             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1721             av.div(bv).intoArray(r, i);
1722         }
1723 
1724         assertArraysEquals(r, a, b, FloatMaxVectorTests::div);
1725     }
1726 
1727 
1728 
1729     @Test(dataProvider = "floatBinaryOpMaskProvider")
1730     static void DIVFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1731                                           IntFunction<boolean[]> fm) {
1732         float[] a = fa.apply(SPECIES.length());
1733         float[] b = fb.apply(SPECIES.length());
1734         float[] r = fr.apply(SPECIES.length());
1735         boolean[] mask = fm.apply(SPECIES.length());
1736         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1737 
1738         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1739             for (int i = 0; i < a.length; i += SPECIES.length()) {
1740                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1741                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1742                 av.lanewise(VectorOperators.DIV, bv, vmask).intoArray(r, i);
1743             }
1744         }
1745 
1746         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::DIV);
1747     }
1748 
1749     @Test(dataProvider = "floatBinaryOpMaskProvider")
1750     static void divFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1751                                           IntFunction<boolean[]> fm) {
1752         float[] a = fa.apply(SPECIES.length());
1753         float[] b = fb.apply(SPECIES.length());
1754         float[] r = fr.apply(SPECIES.length());
1755         boolean[] mask = fm.apply(SPECIES.length());
1756         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1757 
1758         for (int i = 0; i < a.length; i += SPECIES.length()) {
1759             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1760             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1761             av.div(bv, vmask).intoArray(r, i);
1762         }
1763 
1764         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::div);
1765     }
1766 
1767 
1768 
1769     static float FIRST_NONZERO(float a, float b) {
1770         return (float)(Double.doubleToLongBits(a)!=0?a:b);
1771     }
1772 
1773     @Test(dataProvider = "floatBinaryOpProvider")
1774     static void FIRST_NONZEROFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1775         float[] a = fa.apply(SPECIES.length());
1776         float[] b = fb.apply(SPECIES.length());
1777         float[] r = fr.apply(SPECIES.length());
1778 
1779         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1780             for (int i = 0; i < a.length; i += SPECIES.length()) {
1781                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1782                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1783                 av.lanewise(VectorOperators.FIRST_NONZERO, bv).intoArray(r, i);
1784             }
1785         }
1786 
1787         assertArraysEquals(r, a, b, FloatMaxVectorTests::FIRST_NONZERO);
1788     }

1790     @Test(dataProvider = "floatBinaryOpMaskProvider")
1791     static void FIRST_NONZEROFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1792                                           IntFunction<boolean[]> fm) {
1793         float[] a = fa.apply(SPECIES.length());
1794         float[] b = fb.apply(SPECIES.length());
1795         float[] r = fr.apply(SPECIES.length());
1796         boolean[] mask = fm.apply(SPECIES.length());
1797         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1798 
1799         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1800             for (int i = 0; i < a.length; i += SPECIES.length()) {
1801                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1802                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1803                 av.lanewise(VectorOperators.FIRST_NONZERO, bv, vmask).intoArray(r, i);
1804             }
1805         }
1806 
1807         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::FIRST_NONZERO);
1808     }
1809 
1810 
1811 
1812 
1813 
1814 
1815 
1816 
1817 
1818     @Test(dataProvider = "floatBinaryOpProvider")
1819     static void addFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1820         float[] a = fa.apply(SPECIES.length());
1821         float[] b = fb.apply(SPECIES.length());
1822         float[] r = fr.apply(SPECIES.length());
1823 
1824         for (int i = 0; i < a.length; i += SPECIES.length()) {
1825             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1826             av.add(b[i]).intoArray(r, i);
1827         }
1828 
1829         assertBroadcastArraysEquals(r, a, b, FloatMaxVectorTests::add);
1830     }
1831 
1832     @Test(dataProvider = "floatBinaryOpMaskProvider")
1833     static void addFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1834                                           IntFunction<boolean[]> fm) {
1835         float[] a = fa.apply(SPECIES.length());
1836         float[] b = fb.apply(SPECIES.length());
1837         float[] r = fr.apply(SPECIES.length());

1891         assertBroadcastArraysEquals(r, a, b, FloatMaxVectorTests::mul);
1892     }
1893 
1894     @Test(dataProvider = "floatBinaryOpMaskProvider")
1895     static void mulFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1896                                           IntFunction<boolean[]> fm) {
1897         float[] a = fa.apply(SPECIES.length());
1898         float[] b = fb.apply(SPECIES.length());
1899         float[] r = fr.apply(SPECIES.length());
1900         boolean[] mask = fm.apply(SPECIES.length());
1901         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1902 
1903         for (int i = 0; i < a.length; i += SPECIES.length()) {
1904             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1905             av.mul(b[i], vmask).intoArray(r, i);
1906         }
1907 
1908         assertBroadcastArraysEquals(r, a, b, mask, FloatMaxVectorTests::mul);
1909     }
1910 
1911 
1912     @Test(dataProvider = "floatBinaryOpProvider")
1913     static void divFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1914         float[] a = fa.apply(SPECIES.length());
1915         float[] b = fb.apply(SPECIES.length());
1916         float[] r = fr.apply(SPECIES.length());
1917 
1918         for (int i = 0; i < a.length; i += SPECIES.length()) {
1919             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1920             av.div(b[i]).intoArray(r, i);
1921         }
1922 
1923         assertBroadcastArraysEquals(r, a, b, FloatMaxVectorTests::div);
1924     }
1925 
1926 
1927 
1928     @Test(dataProvider = "floatBinaryOpMaskProvider")
1929     static void divFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1930                                           IntFunction<boolean[]> fm) {
1931         float[] a = fa.apply(SPECIES.length());
1932         float[] b = fb.apply(SPECIES.length());
1933         float[] r = fr.apply(SPECIES.length());
1934         boolean[] mask = fm.apply(SPECIES.length());
1935         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1936 
1937         for (int i = 0; i < a.length; i += SPECIES.length()) {
1938             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1939             av.div(b[i], vmask).intoArray(r, i);
1940         }
1941 
1942         assertBroadcastArraysEquals(r, a, b, mask, FloatMaxVectorTests::div);
1943     }
1944 
1945 
1946 
1947 
1948 
1949 
1950 
1951 
1952 
1953 
1954     @Test(dataProvider = "floatBinaryOpProvider")
1955     static void ADDFloatMaxVectorTestsBroadcastLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1956         float[] a = fa.apply(SPECIES.length());
1957         float[] b = fb.apply(SPECIES.length());
1958         float[] r = fr.apply(SPECIES.length());
1959 
1960         for (int i = 0; i < a.length; i += SPECIES.length()) {
1961             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1962             av.lanewise(VectorOperators.ADD, (long)b[i]).intoArray(r, i);
1963         }
1964 
1965         assertBroadcastLongArraysEquals(r, a, b, FloatMaxVectorTests::ADD);
1966     }
1967 
1968     @Test(dataProvider = "floatBinaryOpMaskProvider")
1969     static void ADDFloatMaxVectorTestsBroadcastMaskedLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1970                                           IntFunction<boolean[]> fm) {
1971         float[] a = fa.apply(SPECIES.length());
1972         float[] b = fb.apply(SPECIES.length());
1973         float[] r = fr.apply(SPECIES.length());
1974         boolean[] mask = fm.apply(SPECIES.length());
1975         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1976 
1977         for (int i = 0; i < a.length; i += SPECIES.length()) {
1978             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1979             av.lanewise(VectorOperators.ADD, (long)b[i], vmask).intoArray(r, i);
1980         }
1981 
1982         assertBroadcastLongArraysEquals(r, a, b, mask, FloatMaxVectorTests::ADD);
1983     }
1984 
1985 
1986 
1987 
1988 
1989 
1990 
1991 
1992 
1993 
1994 
1995 
1996 
1997 
1998 
1999 
2000 
2001 
2002 
2003 
2004 
2005 
2006 
2007 
2008 
2009 
2010 
2011 
2012 
2013 
2014 
2015 
2016 
2017 
2018 
2019 
2020 
2021 
2022 
2023 
2024 
2025 
2026 
2027 
2028 
2029 
2030 
2031 
2032 
2033 
2034 
2035 
2036 
2037 
2038 
2039 
2040 
2041 
2042     static float MIN(float a, float b) {
2043         return (float)(Math.min(a, b));
2044     }
2045 
2046     @Test(dataProvider = "floatBinaryOpProvider")
2047     static void MINFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2048         float[] a = fa.apply(SPECIES.length());
2049         float[] b = fb.apply(SPECIES.length());
2050         float[] r = fr.apply(SPECIES.length());
2051 
2052         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2053             for (int i = 0; i < a.length; i += SPECIES.length()) {
2054                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2055                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2056                 av.lanewise(VectorOperators.MIN, bv).intoArray(r, i);
2057             }
2058         }
2059 
2060         assertArraysEquals(r, a, b, FloatMaxVectorTests::MIN);
2061     }

2062     static float min(float a, float b) {
2063         return (float)(Math.min(a, b));
2064     }
2065 
2066     @Test(dataProvider = "floatBinaryOpProvider")
2067     static void minFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2068         float[] a = fa.apply(SPECIES.length());
2069         float[] b = fb.apply(SPECIES.length());
2070         float[] r = fr.apply(SPECIES.length());
2071 
2072         for (int i = 0; i < a.length; i += SPECIES.length()) {
2073             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2074             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2075             av.min(bv).intoArray(r, i);
2076         }
2077 
2078         assertArraysEquals(r, a, b, FloatMaxVectorTests::min);
2079     }

2080     static float MAX(float a, float b) {
2081         return (float)(Math.max(a, b));
2082     }
2083 
2084     @Test(dataProvider = "floatBinaryOpProvider")
2085     static void MAXFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2086         float[] a = fa.apply(SPECIES.length());
2087         float[] b = fb.apply(SPECIES.length());
2088         float[] r = fr.apply(SPECIES.length());
2089 
2090         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2091             for (int i = 0; i < a.length; i += SPECIES.length()) {
2092                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2093                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2094                 av.lanewise(VectorOperators.MAX, bv).intoArray(r, i);
2095             }
2096         }
2097 
2098         assertArraysEquals(r, a, b, FloatMaxVectorTests::MAX);
2099     }

2100     static float max(float a, float b) {
2101         return (float)(Math.max(a, b));
2102     }
2103 
2104     @Test(dataProvider = "floatBinaryOpProvider")
2105     static void maxFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2106         float[] a = fa.apply(SPECIES.length());
2107         float[] b = fb.apply(SPECIES.length());
2108         float[] r = fr.apply(SPECIES.length());
2109 
2110         for (int i = 0; i < a.length; i += SPECIES.length()) {
2111             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2112             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2113             av.max(bv).intoArray(r, i);
2114         }
2115 
2116         assertArraysEquals(r, a, b, FloatMaxVectorTests::max);
2117     }
2118 
2119     @Test(dataProvider = "floatBinaryOpProvider")

2155             av.lanewise(VectorOperators.MAX, b[i]).intoArray(r, i);
2156         }
2157 
2158         assertBroadcastArraysEquals(r, a, b, FloatMaxVectorTests::MAX);
2159     }
2160 
2161     @Test(dataProvider = "floatBinaryOpProvider")
2162     static void maxFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2163         float[] a = fa.apply(SPECIES.length());
2164         float[] b = fb.apply(SPECIES.length());
2165         float[] r = fr.apply(SPECIES.length());
2166 
2167         for (int i = 0; i < a.length; i += SPECIES.length()) {
2168             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2169             av.max(b[i]).intoArray(r, i);
2170         }
2171 
2172         assertBroadcastArraysEquals(r, a, b, FloatMaxVectorTests::max);
2173     }
2174 
2175 
2176 
2177 
2178 
2179 
2180 
2181 
2182 
2183 
2184 
2185 
2186     static float ADDReduce(float[] a, int idx) {
2187         float res = 0;
2188         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2189             res += a[i];
2190         }
2191 
2192         return res;
2193     }
2194 
2195     static float ADDReduceAll(float[] a) {
2196         float res = 0;
2197         for (int i = 0; i < a.length; i += SPECIES.length()) {
2198             res += ADDReduce(a, i);
2199         }
2200 
2201         return res;
2202     }

2203     @Test(dataProvider = "floatUnaryOpProvider")
2204     static void ADDReduceFloatMaxVectorTests(IntFunction<float[]> fa) {
2205         float[] a = fa.apply(SPECIES.length());
2206         float[] r = fr.apply(SPECIES.length());
2207         float ra = 0;
2208 
2209         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2210             for (int i = 0; i < a.length; i += SPECIES.length()) {
2211                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2212                 r[i] = av.reduceLanes(VectorOperators.ADD);
2213             }
2214         }
2215 
2216         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2217             ra = 0;
2218             for (int i = 0; i < a.length; i += SPECIES.length()) {
2219                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2220                 ra += av.reduceLanes(VectorOperators.ADD);
2221             }
2222         }
2223 
2224         assertReductionArraysEquals(r, ra, a,
2225                 FloatMaxVectorTests::ADDReduce, FloatMaxVectorTests::ADDReduceAll);
2226     }

2227     static float ADDReduceMasked(float[] a, int idx, boolean[] mask) {
2228         float res = 0;
2229         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2230             if (mask[i % SPECIES.length()])
2231                 res += a[i];
2232         }
2233 
2234         return res;
2235     }
2236 
2237     static float ADDReduceAllMasked(float[] a, boolean[] mask) {
2238         float res = 0;
2239         for (int i = 0; i < a.length; i += SPECIES.length()) {
2240             res += ADDReduceMasked(a, i, mask);
2241         }
2242 
2243         return res;
2244     }

2245     @Test(dataProvider = "floatUnaryOpMaskProvider")
2246     static void ADDReduceFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2247         float[] a = fa.apply(SPECIES.length());
2248         float[] r = fr.apply(SPECIES.length());
2249         boolean[] mask = fm.apply(SPECIES.length());
2250         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2251         float ra = 0;
2252 
2253         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2254             for (int i = 0; i < a.length; i += SPECIES.length()) {
2255                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2256                 r[i] = av.reduceLanes(VectorOperators.ADD, vmask);
2257             }
2258         }
2259 
2260         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2261             ra = 0;
2262             for (int i = 0; i < a.length; i += SPECIES.length()) {
2263                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2264                 ra += av.reduceLanes(VectorOperators.ADD, vmask);
2265             }
2266         }
2267 
2268         assertReductionArraysEqualsMasked(r, ra, a, mask,
2269                 FloatMaxVectorTests::ADDReduceMasked, FloatMaxVectorTests::ADDReduceAllMasked);
2270     }

2271     static float MULReduce(float[] a, int idx) {
2272         float res = 1;
2273         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2274             res *= a[i];
2275         }
2276 
2277         return res;
2278     }
2279 
2280     static float MULReduceAll(float[] a) {
2281         float res = 1;
2282         for (int i = 0; i < a.length; i += SPECIES.length()) {
2283             res *= MULReduce(a, i);
2284         }
2285 
2286         return res;
2287     }

2288     @Test(dataProvider = "floatUnaryOpProvider")
2289     static void MULReduceFloatMaxVectorTests(IntFunction<float[]> fa) {
2290         float[] a = fa.apply(SPECIES.length());
2291         float[] r = fr.apply(SPECIES.length());
2292         float ra = 1;
2293 
2294         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2295             for (int i = 0; i < a.length; i += SPECIES.length()) {
2296                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2297                 r[i] = av.reduceLanes(VectorOperators.MUL);
2298             }
2299         }
2300 
2301         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2302             ra = 1;
2303             for (int i = 0; i < a.length; i += SPECIES.length()) {
2304                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2305                 ra *= av.reduceLanes(VectorOperators.MUL);
2306             }
2307         }
2308 
2309         assertReductionArraysEquals(r, ra, a,
2310                 FloatMaxVectorTests::MULReduce, FloatMaxVectorTests::MULReduceAll);
2311     }

2312     static float MULReduceMasked(float[] a, int idx, boolean[] mask) {
2313         float res = 1;
2314         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2315             if (mask[i % SPECIES.length()])
2316                 res *= a[i];
2317         }
2318 
2319         return res;
2320     }
2321 
2322     static float MULReduceAllMasked(float[] a, boolean[] mask) {
2323         float res = 1;
2324         for (int i = 0; i < a.length; i += SPECIES.length()) {
2325             res *= MULReduceMasked(a, i, mask);
2326         }
2327 
2328         return res;
2329     }

2330     @Test(dataProvider = "floatUnaryOpMaskProvider")
2331     static void MULReduceFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2332         float[] a = fa.apply(SPECIES.length());
2333         float[] r = fr.apply(SPECIES.length());
2334         boolean[] mask = fm.apply(SPECIES.length());
2335         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2336         float ra = 1;
2337 
2338         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2339             for (int i = 0; i < a.length; i += SPECIES.length()) {
2340                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2341                 r[i] = av.reduceLanes(VectorOperators.MUL, vmask);
2342             }
2343         }
2344 
2345         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2346             ra = 1;
2347             for (int i = 0; i < a.length; i += SPECIES.length()) {
2348                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2349                 ra *= av.reduceLanes(VectorOperators.MUL, vmask);
2350             }
2351         }
2352 
2353         assertReductionArraysEqualsMasked(r, ra, a, mask,
2354                 FloatMaxVectorTests::MULReduceMasked, FloatMaxVectorTests::MULReduceAllMasked);
2355     }

2356     static float MINReduce(float[] a, int idx) {
2357         float res = Float.POSITIVE_INFINITY;
2358         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2359             res = (float) Math.min(res, a[i]);
2360         }
2361 
2362         return res;
2363     }
2364 
2365     static float MINReduceAll(float[] a) {
2366         float res = Float.POSITIVE_INFINITY;
2367         for (int i = 0; i < a.length; i += SPECIES.length()) {
2368             res = (float) Math.min(res, MINReduce(a, i));
2369         }
2370 
2371         return res;
2372     }

2373     @Test(dataProvider = "floatUnaryOpProvider")
2374     static void MINReduceFloatMaxVectorTests(IntFunction<float[]> fa) {
2375         float[] a = fa.apply(SPECIES.length());
2376         float[] r = fr.apply(SPECIES.length());
2377         float ra = Float.POSITIVE_INFINITY;
2378 
2379         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2380             for (int i = 0; i < a.length; i += SPECIES.length()) {
2381                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2382                 r[i] = av.reduceLanes(VectorOperators.MIN);
2383             }
2384         }
2385 
2386         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2387             ra = Float.POSITIVE_INFINITY;
2388             for (int i = 0; i < a.length; i += SPECIES.length()) {
2389                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2390                 ra = (float) Math.min(ra, av.reduceLanes(VectorOperators.MIN));
2391             }
2392         }
2393 
2394         assertReductionArraysEquals(r, ra, a,
2395                 FloatMaxVectorTests::MINReduce, FloatMaxVectorTests::MINReduceAll);
2396     }

2397     static float MINReduceMasked(float[] a, int idx, boolean[] mask) {
2398         float res = Float.POSITIVE_INFINITY;
2399         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2400             if (mask[i % SPECIES.length()])
2401                 res = (float) Math.min(res, a[i]);
2402         }
2403 
2404         return res;
2405     }
2406 
2407     static float MINReduceAllMasked(float[] a, boolean[] mask) {
2408         float res = Float.POSITIVE_INFINITY;
2409         for (int i = 0; i < a.length; i += SPECIES.length()) {
2410             res = (float) Math.min(res, MINReduceMasked(a, i, mask));
2411         }
2412 
2413         return res;
2414     }

2415     @Test(dataProvider = "floatUnaryOpMaskProvider")
2416     static void MINReduceFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2417         float[] a = fa.apply(SPECIES.length());
2418         float[] r = fr.apply(SPECIES.length());
2419         boolean[] mask = fm.apply(SPECIES.length());
2420         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2421         float ra = Float.POSITIVE_INFINITY;
2422 
2423         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2424             for (int i = 0; i < a.length; i += SPECIES.length()) {
2425                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2426                 r[i] = av.reduceLanes(VectorOperators.MIN, vmask);
2427             }
2428         }
2429 
2430         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2431             ra = Float.POSITIVE_INFINITY;
2432             for (int i = 0; i < a.length; i += SPECIES.length()) {
2433                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2434                 ra = (float) Math.min(ra, av.reduceLanes(VectorOperators.MIN, vmask));
2435             }
2436         }
2437 
2438         assertReductionArraysEqualsMasked(r, ra, a, mask,
2439                 FloatMaxVectorTests::MINReduceMasked, FloatMaxVectorTests::MINReduceAllMasked);
2440     }

2441     static float MAXReduce(float[] a, int idx) {
2442         float res = Float.NEGATIVE_INFINITY;
2443         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2444             res = (float) Math.max(res, a[i]);
2445         }
2446 
2447         return res;
2448     }
2449 
2450     static float MAXReduceAll(float[] a) {
2451         float res = Float.NEGATIVE_INFINITY;
2452         for (int i = 0; i < a.length; i += SPECIES.length()) {
2453             res = (float) Math.max(res, MAXReduce(a, i));
2454         }
2455 
2456         return res;
2457     }

2458     @Test(dataProvider = "floatUnaryOpProvider")
2459     static void MAXReduceFloatMaxVectorTests(IntFunction<float[]> fa) {
2460         float[] a = fa.apply(SPECIES.length());
2461         float[] r = fr.apply(SPECIES.length());
2462         float ra = Float.NEGATIVE_INFINITY;
2463 
2464         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2465             for (int i = 0; i < a.length; i += SPECIES.length()) {
2466                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2467                 r[i] = av.reduceLanes(VectorOperators.MAX);
2468             }
2469         }
2470 
2471         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2472             ra = Float.NEGATIVE_INFINITY;
2473             for (int i = 0; i < a.length; i += SPECIES.length()) {
2474                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2475                 ra = (float) Math.max(ra, av.reduceLanes(VectorOperators.MAX));
2476             }
2477         }
2478 
2479         assertReductionArraysEquals(r, ra, a,
2480                 FloatMaxVectorTests::MAXReduce, FloatMaxVectorTests::MAXReduceAll);
2481     }

2482     static float MAXReduceMasked(float[] a, int idx, boolean[] mask) {
2483         float res = Float.NEGATIVE_INFINITY;
2484         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2485             if (mask[i % SPECIES.length()])
2486                 res = (float) Math.max(res, a[i]);
2487         }
2488 
2489         return res;
2490     }
2491 
2492     static float MAXReduceAllMasked(float[] a, boolean[] mask) {
2493         float res = Float.NEGATIVE_INFINITY;
2494         for (int i = 0; i < a.length; i += SPECIES.length()) {
2495             res = (float) Math.max(res, MAXReduceMasked(a, i, mask));
2496         }
2497 
2498         return res;
2499     }

2500     @Test(dataProvider = "floatUnaryOpMaskProvider")
2501     static void MAXReduceFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2502         float[] a = fa.apply(SPECIES.length());
2503         float[] r = fr.apply(SPECIES.length());
2504         boolean[] mask = fm.apply(SPECIES.length());
2505         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2506         float ra = Float.NEGATIVE_INFINITY;
2507 
2508         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2509             for (int i = 0; i < a.length; i += SPECIES.length()) {
2510                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2511                 r[i] = av.reduceLanes(VectorOperators.MAX, vmask);
2512             }
2513         }
2514 
2515         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2516             ra = Float.NEGATIVE_INFINITY;
2517             for (int i = 0; i < a.length; i += SPECIES.length()) {
2518                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2519                 ra = (float) Math.max(ra, av.reduceLanes(VectorOperators.MAX, vmask));
2520             }
2521         }
2522 
2523         assertReductionArraysEqualsMasked(r, ra, a, mask,
2524                 FloatMaxVectorTests::MAXReduceMasked, FloatMaxVectorTests::MAXReduceAllMasked);
2525     }

2526     static float FIRST_NONZEROReduce(float[] a, int idx) {
2527         float res = (float) 0;
2528         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2529             res = firstNonZero(res, a[i]);
2530         }
2531 
2532         return res;
2533     }
2534 
2535     static float FIRST_NONZEROReduceAll(float[] a) {
2536         float res = (float) 0;
2537         for (int i = 0; i < a.length; i += SPECIES.length()) {
2538             res = firstNonZero(res, FIRST_NONZEROReduce(a, i));
2539         }
2540 
2541         return res;
2542     }

2543     @Test(dataProvider = "floatUnaryOpProvider")
2544     static void FIRST_NONZEROReduceFloatMaxVectorTests(IntFunction<float[]> fa) {
2545         float[] a = fa.apply(SPECIES.length());
2546         float[] r = fr.apply(SPECIES.length());
2547         float ra = (float) 0;
2548 
2549         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2550             for (int i = 0; i < a.length; i += SPECIES.length()) {
2551                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2552                 r[i] = av.reduceLanes(VectorOperators.FIRST_NONZERO);
2553             }
2554         }
2555 
2556         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2557             ra = (float) 0;
2558             for (int i = 0; i < a.length; i += SPECIES.length()) {
2559                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2560                 ra = firstNonZero(ra, av.reduceLanes(VectorOperators.FIRST_NONZERO));
2561             }
2562         }
2563 
2564         assertReductionArraysEquals(r, ra, a,
2565                 FloatMaxVectorTests::FIRST_NONZEROReduce, FloatMaxVectorTests::FIRST_NONZEROReduceAll);
2566     }

2567     static float FIRST_NONZEROReduceMasked(float[] a, int idx, boolean[] mask) {
2568         float res = (float) 0;
2569         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2570             if (mask[i % SPECIES.length()])
2571                 res = firstNonZero(res, a[i]);
2572         }
2573 
2574         return res;
2575     }
2576 
2577     static float FIRST_NONZEROReduceAllMasked(float[] a, boolean[] mask) {
2578         float res = (float) 0;
2579         for (int i = 0; i < a.length; i += SPECIES.length()) {
2580             res = firstNonZero(res, FIRST_NONZEROReduceMasked(a, i, mask));
2581         }
2582 
2583         return res;
2584     }

2585     @Test(dataProvider = "floatUnaryOpMaskProvider")
2586     static void FIRST_NONZEROReduceFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2587         float[] a = fa.apply(SPECIES.length());
2588         float[] r = fr.apply(SPECIES.length());
2589         boolean[] mask = fm.apply(SPECIES.length());
2590         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2591         float ra = (float) 0;
2592 
2593         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2594             for (int i = 0; i < a.length; i += SPECIES.length()) {
2595                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2596                 r[i] = av.reduceLanes(VectorOperators.FIRST_NONZERO, vmask);
2597             }
2598         }
2599 
2600         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2601             ra = (float) 0;
2602             for (int i = 0; i < a.length; i += SPECIES.length()) {
2603                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2604                 ra = firstNonZero(ra, av.reduceLanes(VectorOperators.FIRST_NONZERO, vmask));
2605             }
2606         }
2607 
2608         assertReductionArraysEqualsMasked(r, ra, a, mask,
2609                 FloatMaxVectorTests::FIRST_NONZEROReduceMasked, FloatMaxVectorTests::FIRST_NONZEROReduceAllMasked);
2610     }
2611 
2612 
2613 
2614 
2615 
2616     @Test(dataProvider = "floatUnaryOpProvider")
2617     static void withFloatMaxVectorTests(IntFunction<float []> fa) {
2618         float[] a = fa.apply(SPECIES.length());
2619         float[] r = fr.apply(SPECIES.length());
2620 
2621         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2622             for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
2623                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2624                 av.withLane((j++ & (SPECIES.length()-1)), (float)(65535+i)).intoArray(r, i);
2625             }
2626         }
2627 
2628 
2629         for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
2630             assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
2631         }
2632     }

2633     static boolean testIS_DEFAULT(float a) {
2634         return bits(a)==0;
2635     }
2636 
2637     @Test(dataProvider = "floatTestOpProvider")
2638     static void IS_DEFAULTFloatMaxVectorTests(IntFunction<float[]> fa) {
2639         float[] a = fa.apply(SPECIES.length());
2640 
2641         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2642             for (int i = 0; i < a.length; i += SPECIES.length()) {
2643                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2644                 VectorMask<Float> mv = av.test(VectorOperators.IS_DEFAULT);
2645 
2646                 // Check results as part of computation.
2647                 for (int j = 0; j < SPECIES.length(); j++) {
2648                     Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j]));
2649                 }
2650             }
2651         }
2652     }
2653 
2654     @Test(dataProvider = "floatTestOpMaskProvider")
2655     static void IS_DEFAULTMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
2656                                           IntFunction<boolean[]> fm) {
2657         float[] a = fa.apply(SPECIES.length());
2658         boolean[] mask = fm.apply(SPECIES.length());
2659         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2660 
2661         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2662             for (int i = 0; i < a.length; i += SPECIES.length()) {
2663                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2664                 VectorMask<Float> mv = av.test(VectorOperators.IS_DEFAULT, vmask);
2665 
2666                 // Check results as part of computation.
2667                 for (int j = 0; j < SPECIES.length(); j++) {
2668                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j]));
2669                 }
2670             }
2671         }
2672     }

2673     static boolean testIS_NEGATIVE(float a) {
2674         return bits(a)<0;
2675     }
2676 
2677     @Test(dataProvider = "floatTestOpProvider")
2678     static void IS_NEGATIVEFloatMaxVectorTests(IntFunction<float[]> fa) {
2679         float[] a = fa.apply(SPECIES.length());
2680 
2681         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2682             for (int i = 0; i < a.length; i += SPECIES.length()) {
2683                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2684                 VectorMask<Float> mv = av.test(VectorOperators.IS_NEGATIVE);
2685 
2686                 // Check results as part of computation.
2687                 for (int j = 0; j < SPECIES.length(); j++) {
2688                     Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j]));
2689                 }
2690             }
2691         }
2692     }

2735     @Test(dataProvider = "floatTestOpMaskProvider")
2736     static void IS_FINITEMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
2737                                           IntFunction<boolean[]> fm) {
2738         float[] a = fa.apply(SPECIES.length());
2739         boolean[] mask = fm.apply(SPECIES.length());
2740         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2741 
2742         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2743             for (int i = 0; i < a.length; i += SPECIES.length()) {
2744                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2745                 VectorMask<Float> mv = av.test(VectorOperators.IS_FINITE, vmask);
2746 
2747                 // Check results as part of computation.
2748                 for (int j = 0; j < SPECIES.length(); j++) {
2749                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_FINITE(a[i + j]));
2750                 }
2751             }
2752         }
2753     }
2754 
2755 
2756     static boolean testIS_NAN(float a) {
2757         return Float.isNaN(a);
2758     }
2759 
2760     @Test(dataProvider = "floatTestOpProvider")
2761     static void IS_NANFloatMaxVectorTests(IntFunction<float[]> fa) {
2762         float[] a = fa.apply(SPECIES.length());
2763 
2764         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2765             for (int i = 0; i < a.length; i += SPECIES.length()) {
2766                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2767                 VectorMask<Float> mv = av.test(VectorOperators.IS_NAN);
2768 
2769                 // Check results as part of computation.
2770                 for (int j = 0; j < SPECIES.length(); j++) {
2771                     Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j]));
2772                 }
2773             }
2774         }
2775     }

2777     @Test(dataProvider = "floatTestOpMaskProvider")
2778     static void IS_NANMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
2779                                           IntFunction<boolean[]> fm) {
2780         float[] a = fa.apply(SPECIES.length());
2781         boolean[] mask = fm.apply(SPECIES.length());
2782         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2783 
2784         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2785             for (int i = 0; i < a.length; i += SPECIES.length()) {
2786                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2787                 VectorMask<Float> mv = av.test(VectorOperators.IS_NAN, vmask);
2788 
2789                 // Check results as part of computation.
2790                 for (int j = 0; j < SPECIES.length(); j++) {
2791                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_NAN(a[i + j]));
2792                 }
2793             }
2794         }
2795     }
2796 
2797 
2798     static boolean testIS_INFINITE(float a) {
2799         return Float.isInfinite(a);
2800     }
2801 
2802     @Test(dataProvider = "floatTestOpProvider")
2803     static void IS_INFINITEFloatMaxVectorTests(IntFunction<float[]> fa) {
2804         float[] a = fa.apply(SPECIES.length());
2805 
2806         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2807             for (int i = 0; i < a.length; i += SPECIES.length()) {
2808                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2809                 VectorMask<Float> mv = av.test(VectorOperators.IS_INFINITE);
2810 
2811                 // Check results as part of computation.
2812                 for (int j = 0; j < SPECIES.length(); j++) {
2813                     Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j]));
2814                 }
2815             }
2816         }
2817     }

2819     @Test(dataProvider = "floatTestOpMaskProvider")
2820     static void IS_INFINITEMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
2821                                           IntFunction<boolean[]> fm) {
2822         float[] a = fa.apply(SPECIES.length());
2823         boolean[] mask = fm.apply(SPECIES.length());
2824         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2825 
2826         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2827             for (int i = 0; i < a.length; i += SPECIES.length()) {
2828                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2829                 VectorMask<Float> mv = av.test(VectorOperators.IS_INFINITE, vmask);
2830 
2831                 // Check results as part of computation.
2832                 for (int j = 0; j < SPECIES.length(); j++) {
2833                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_INFINITE(a[i + j]));
2834                 }
2835             }
2836         }
2837     }
2838 
2839 
2840     @Test(dataProvider = "floatCompareOpProvider")
2841     static void LTFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2842         float[] a = fa.apply(SPECIES.length());
2843         float[] b = fb.apply(SPECIES.length());
2844 
2845         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2846             for (int i = 0; i < a.length; i += SPECIES.length()) {
2847                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2848                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2849                 VectorMask<Float> mv = av.compare(VectorOperators.LT, bv);
2850 
2851                 // Check results as part of computation.
2852                 for (int j = 0; j < SPECIES.length(); j++) {
2853                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
2854                 }
2855             }
2856         }
2857     }
2858 
2859 
2860     @Test(dataProvider = "floatCompareOpProvider")
2861     static void ltFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2862         float[] a = fa.apply(SPECIES.length());
2863         float[] b = fb.apply(SPECIES.length());
2864 
2865         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2866             for (int i = 0; i < a.length; i += SPECIES.length()) {
2867                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2868                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2869                 VectorMask<Float> mv = av.lt(bv);
2870 
2871                 // Check results as part of computation.
2872                 for (int j = 0; j < SPECIES.length(); j++) {
2873                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
2874                 }
2875             }
2876         }
2877     }
2878 
2879     @Test(dataProvider = "floatCompareOpMaskProvider")

2882         float[] a = fa.apply(SPECIES.length());
2883         float[] b = fb.apply(SPECIES.length());
2884         boolean[] mask = fm.apply(SPECIES.length());
2885 
2886         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2887 
2888         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2889             for (int i = 0; i < a.length; i += SPECIES.length()) {
2890                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2891                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2892                 VectorMask<Float> mv = av.compare(VectorOperators.LT, bv, vmask);
2893 
2894                 // Check results as part of computation.
2895                 for (int j = 0; j < SPECIES.length(); j++) {
2896                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j]));
2897                 }
2898             }
2899         }
2900     }
2901 
2902 
2903     @Test(dataProvider = "floatCompareOpProvider")
2904     static void GTFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2905         float[] a = fa.apply(SPECIES.length());
2906         float[] b = fb.apply(SPECIES.length());
2907 
2908         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2909             for (int i = 0; i < a.length; i += SPECIES.length()) {
2910                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2911                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2912                 VectorMask<Float> mv = av.compare(VectorOperators.GT, bv);
2913 
2914                 // Check results as part of computation.
2915                 for (int j = 0; j < SPECIES.length(); j++) {
2916                     Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j]));
2917                 }
2918             }
2919         }
2920     }
2921 
2922     @Test(dataProvider = "floatCompareOpMaskProvider")

2925         float[] a = fa.apply(SPECIES.length());
2926         float[] b = fb.apply(SPECIES.length());
2927         boolean[] mask = fm.apply(SPECIES.length());
2928 
2929         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2930 
2931         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2932             for (int i = 0; i < a.length; i += SPECIES.length()) {
2933                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2934                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2935                 VectorMask<Float> mv = av.compare(VectorOperators.GT, bv, vmask);
2936 
2937                 // Check results as part of computation.
2938                 for (int j = 0; j < SPECIES.length(); j++) {
2939                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j]));
2940                 }
2941             }
2942         }
2943     }
2944 
2945 
2946     @Test(dataProvider = "floatCompareOpProvider")
2947     static void EQFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2948         float[] a = fa.apply(SPECIES.length());
2949         float[] b = fb.apply(SPECIES.length());
2950 
2951         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2952             for (int i = 0; i < a.length; i += SPECIES.length()) {
2953                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2954                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2955                 VectorMask<Float> mv = av.compare(VectorOperators.EQ, bv);
2956 
2957                 // Check results as part of computation.
2958                 for (int j = 0; j < SPECIES.length(); j++) {
2959                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
2960                 }
2961             }
2962         }
2963     }
2964 
2965 
2966     @Test(dataProvider = "floatCompareOpProvider")
2967     static void eqFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2968         float[] a = fa.apply(SPECIES.length());
2969         float[] b = fb.apply(SPECIES.length());
2970 
2971         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2972             for (int i = 0; i < a.length; i += SPECIES.length()) {
2973                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2974                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2975                 VectorMask<Float> mv = av.eq(bv);
2976 
2977                 // Check results as part of computation.
2978                 for (int j = 0; j < SPECIES.length(); j++) {
2979                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
2980                 }
2981             }
2982         }
2983     }
2984 
2985     @Test(dataProvider = "floatCompareOpMaskProvider")

2988         float[] a = fa.apply(SPECIES.length());
2989         float[] b = fb.apply(SPECIES.length());
2990         boolean[] mask = fm.apply(SPECIES.length());
2991 
2992         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2993 
2994         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2995             for (int i = 0; i < a.length; i += SPECIES.length()) {
2996                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2997                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2998                 VectorMask<Float> mv = av.compare(VectorOperators.EQ, bv, vmask);
2999 
3000                 // Check results as part of computation.
3001                 for (int j = 0; j < SPECIES.length(); j++) {
3002                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j]));
3003                 }
3004             }
3005         }
3006     }
3007 
3008 
3009     @Test(dataProvider = "floatCompareOpProvider")
3010     static void NEFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3011         float[] a = fa.apply(SPECIES.length());
3012         float[] b = fb.apply(SPECIES.length());
3013 
3014         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3015             for (int i = 0; i < a.length; i += SPECIES.length()) {
3016                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3017                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3018                 VectorMask<Float> mv = av.compare(VectorOperators.NE, bv);
3019 
3020                 // Check results as part of computation.
3021                 for (int j = 0; j < SPECIES.length(); j++) {
3022                     Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j]));
3023                 }
3024             }
3025         }
3026     }
3027 
3028     @Test(dataProvider = "floatCompareOpMaskProvider")

3031         float[] a = fa.apply(SPECIES.length());
3032         float[] b = fb.apply(SPECIES.length());
3033         boolean[] mask = fm.apply(SPECIES.length());
3034 
3035         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3036 
3037         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3038             for (int i = 0; i < a.length; i += SPECIES.length()) {
3039                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3040                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3041                 VectorMask<Float> mv = av.compare(VectorOperators.NE, bv, vmask);
3042 
3043                 // Check results as part of computation.
3044                 for (int j = 0; j < SPECIES.length(); j++) {
3045                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j]));
3046                 }
3047             }
3048         }
3049     }
3050 
3051 
3052     @Test(dataProvider = "floatCompareOpProvider")
3053     static void LEFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3054         float[] a = fa.apply(SPECIES.length());
3055         float[] b = fb.apply(SPECIES.length());
3056 
3057         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3058             for (int i = 0; i < a.length; i += SPECIES.length()) {
3059                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3060                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3061                 VectorMask<Float> mv = av.compare(VectorOperators.LE, bv);
3062 
3063                 // Check results as part of computation.
3064                 for (int j = 0; j < SPECIES.length(); j++) {
3065                     Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j]));
3066                 }
3067             }
3068         }
3069     }
3070 
3071     @Test(dataProvider = "floatCompareOpMaskProvider")

3074         float[] a = fa.apply(SPECIES.length());
3075         float[] b = fb.apply(SPECIES.length());
3076         boolean[] mask = fm.apply(SPECIES.length());
3077 
3078         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3079 
3080         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3081             for (int i = 0; i < a.length; i += SPECIES.length()) {
3082                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3083                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3084                 VectorMask<Float> mv = av.compare(VectorOperators.LE, bv, vmask);
3085 
3086                 // Check results as part of computation.
3087                 for (int j = 0; j < SPECIES.length(); j++) {
3088                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j]));
3089                 }
3090             }
3091         }
3092     }
3093 
3094 
3095     @Test(dataProvider = "floatCompareOpProvider")
3096     static void GEFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3097         float[] a = fa.apply(SPECIES.length());
3098         float[] b = fb.apply(SPECIES.length());
3099 
3100         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3101             for (int i = 0; i < a.length; i += SPECIES.length()) {
3102                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3103                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3104                 VectorMask<Float> mv = av.compare(VectorOperators.GE, bv);
3105 
3106                 // Check results as part of computation.
3107                 for (int j = 0; j < SPECIES.length(); j++) {
3108                     Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j]));
3109                 }
3110             }
3111         }
3112     }
3113 
3114     @Test(dataProvider = "floatCompareOpMaskProvider")

3117         float[] a = fa.apply(SPECIES.length());
3118         float[] b = fb.apply(SPECIES.length());
3119         boolean[] mask = fm.apply(SPECIES.length());
3120 
3121         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3122 
3123         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3124             for (int i = 0; i < a.length; i += SPECIES.length()) {
3125                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3126                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3127                 VectorMask<Float> mv = av.compare(VectorOperators.GE, bv, vmask);
3128 
3129                 // Check results as part of computation.
3130                 for (int j = 0; j < SPECIES.length(); j++) {
3131                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j]));
3132                 }
3133             }
3134         }
3135     }
3136 
3137 
3138 
3139 
3140 
3141 
3142 
3143 
3144 
3145 
3146     @Test(dataProvider = "floatCompareOpProvider")
3147     static void LTFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3148         float[] a = fa.apply(SPECIES.length());
3149         float[] b = fb.apply(SPECIES.length());
3150 
3151         for (int i = 0; i < a.length; i += SPECIES.length()) {
3152             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3153             VectorMask<Float> mv = av.compare(VectorOperators.LT, b[i]);
3154 
3155             // Check results as part of computation.
3156             for (int j = 0; j < SPECIES.length(); j++) {
3157                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
3158             }
3159         }
3160     }
3161 
3162 
3163     @Test(dataProvider = "floatCompareOpMaskProvider")
3164     static void LTFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa,
3165                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3166         float[] a = fa.apply(SPECIES.length());
3167         float[] b = fb.apply(SPECIES.length());
3168         boolean[] mask = fm.apply(SPECIES.length());
3169 
3170         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3171 
3172         for (int i = 0; i < a.length; i += SPECIES.length()) {
3173             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3174             VectorMask<Float> mv = av.compare(VectorOperators.LT, b[i], vmask);
3175 
3176             // Check results as part of computation.
3177             for (int j = 0; j < SPECIES.length(); j++) {
3178                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i]));
3179             }
3180         }
3181     }
3182 
3183     @Test(dataProvider = "floatCompareOpProvider")
3184     static void LTFloatMaxVectorTestsBroadcastLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3185         float[] a = fa.apply(SPECIES.length());
3186         float[] b = fb.apply(SPECIES.length());
3187 
3188         for (int i = 0; i < a.length; i += SPECIES.length()) {
3189             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3190             VectorMask<Float> mv = av.compare(VectorOperators.LT, (long)b[i]);
3191 
3192             // Check results as part of computation.
3193             for (int j = 0; j < SPECIES.length(); j++) {
3194                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i]));
3195             }
3196         }
3197     }
3198 
3199 
3200     @Test(dataProvider = "floatCompareOpMaskProvider")
3201     static void LTFloatMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction<float[]> fa,
3202                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3203         float[] a = fa.apply(SPECIES.length());
3204         float[] b = fb.apply(SPECIES.length());
3205         boolean[] mask = fm.apply(SPECIES.length());
3206 
3207         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3208 
3209         for (int i = 0; i < a.length; i += SPECIES.length()) {
3210             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3211             VectorMask<Float> mv = av.compare(VectorOperators.LT, (long)b[i], vmask);
3212 
3213             // Check results as part of computation.
3214             for (int j = 0; j < SPECIES.length(); j++) {
3215                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i])));
3216             }
3217         }
3218     }
3219 
3220     @Test(dataProvider = "floatCompareOpProvider")
3221     static void EQFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3222         float[] a = fa.apply(SPECIES.length());
3223         float[] b = fb.apply(SPECIES.length());
3224 
3225         for (int i = 0; i < a.length; i += SPECIES.length()) {
3226             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3227             VectorMask<Float> mv = av.compare(VectorOperators.EQ, b[i]);
3228 
3229             // Check results as part of computation.
3230             for (int j = 0; j < SPECIES.length(); j++) {
3231                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
3232             }
3233         }
3234     }
3235 
3236 
3237     @Test(dataProvider = "floatCompareOpMaskProvider")
3238     static void EQFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa,
3239                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3240         float[] a = fa.apply(SPECIES.length());
3241         float[] b = fb.apply(SPECIES.length());
3242         boolean[] mask = fm.apply(SPECIES.length());
3243 
3244         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3245 
3246         for (int i = 0; i < a.length; i += SPECIES.length()) {
3247             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3248             VectorMask<Float> mv = av.compare(VectorOperators.EQ, b[i], vmask);
3249 
3250             // Check results as part of computation.
3251             for (int j = 0; j < SPECIES.length(); j++) {
3252                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i]));
3253             }
3254         }
3255     }
3256 
3257     @Test(dataProvider = "floatCompareOpProvider")
3258     static void EQFloatMaxVectorTestsBroadcastLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3259         float[] a = fa.apply(SPECIES.length());
3260         float[] b = fb.apply(SPECIES.length());
3261 
3262         for (int i = 0; i < a.length; i += SPECIES.length()) {
3263             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3264             VectorMask<Float> mv = av.compare(VectorOperators.EQ, (long)b[i]);
3265 
3266             // Check results as part of computation.
3267             for (int j = 0; j < SPECIES.length(); j++) {
3268                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i]));
3269             }
3270         }
3271     }
3272 
3273 
3274     @Test(dataProvider = "floatCompareOpMaskProvider")
3275     static void EQFloatMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction<float[]> fa,
3276                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3277         float[] a = fa.apply(SPECIES.length());
3278         float[] b = fb.apply(SPECIES.length());
3279         boolean[] mask = fm.apply(SPECIES.length());
3280 
3281         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3282 
3283         for (int i = 0; i < a.length; i += SPECIES.length()) {
3284             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3285             VectorMask<Float> mv = av.compare(VectorOperators.EQ, (long)b[i], vmask);
3286 
3287             // Check results as part of computation.
3288             for (int j = 0; j < SPECIES.length(); j++) {
3289                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i])));
3290             }
3291         }
3292     }
3293 

3332         assertRearrangeArraysEquals(r, a, order, SPECIES.length());
3333     }
3334 
3335     @Test(dataProvider = "floatUnaryOpShuffleMaskProvider")
3336     static void RearrangeFloatMaxVectorTestsMaskedSmokeTest(IntFunction<float[]> fa,
3337                                                           BiFunction<Integer,Integer,int[]> fs,
3338                                                           IntFunction<boolean[]> fm) {
3339         float[] a = fa.apply(SPECIES.length());
3340         int[] order = fs.apply(a.length, SPECIES.length());
3341         float[] r = fr.apply(SPECIES.length());
3342         boolean[] mask = fm.apply(SPECIES.length());
3343         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3344 
3345         for (int i = 0; i < a.length; i += SPECIES.length()) {
3346             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3347             av.rearrange(VectorShuffle.fromArray(SPECIES, order, i), vmask).intoArray(r, i);
3348         }
3349 
3350         assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
3351     }





































3352     @Test(dataProvider = "floatUnaryOpProvider")
3353     static void getFloatMaxVectorTests(IntFunction<float[]> fa) {
3354         float[] a = fa.apply(SPECIES.length());
3355         float[] r = fr.apply(SPECIES.length());
3356 
3357         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3358             for (int i = 0; i < a.length; i += SPECIES.length()) {
3359                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3360                 int num_lanes = SPECIES.length();
3361                 // Manually unroll because full unroll happens after intrinsification.
3362                 // Unroll is needed because get intrinsic requires for index to be a known constant.
3363                 if (num_lanes == 1) {
3364                     r[i]=av.lane(0);
3365                 } else if (num_lanes == 2) {
3366                     r[i]=av.lane(0);
3367                     r[i+1]=av.lane(1);
3368                 } else if (num_lanes == 4) {
3369                     r[i]=av.lane(0);
3370                     r[i+1]=av.lane(1);
3371                     r[i+2]=av.lane(2);

3502             }
3503         }
3504 
3505         assertArraysEquals(r, a, FloatMaxVectorTests::get);
3506     }
3507 
3508     @Test(dataProvider = "floatUnaryOpProvider")
3509     static void BroadcastFloatMaxVectorTests(IntFunction<float[]> fa) {
3510         float[] a = fa.apply(SPECIES.length());
3511         float[] r = new float[a.length];
3512 
3513         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3514             for (int i = 0; i < a.length; i += SPECIES.length()) {
3515                 FloatVector.broadcast(SPECIES, a[i]).intoArray(r, i);
3516             }
3517         }
3518 
3519         assertBroadcastArraysEquals(r, a);
3520     }
3521 
3522 
3523 
3524 
3525 
3526     @Test(dataProvider = "floatUnaryOpProvider")
3527     static void ZeroFloatMaxVectorTests(IntFunction<float[]> fa) {
3528         float[] a = fa.apply(SPECIES.length());
3529         float[] r = new float[a.length];
3530 
3531         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3532             for (int i = 0; i < a.length; i += SPECIES.length()) {
3533                 FloatVector.zero(SPECIES).intoArray(a, i);
3534             }
3535         }
3536 
3537         Assert.assertEquals(a, r);
3538     }
3539 
3540 
3541 
3542 
3543     static float[] sliceUnary(float[] a, int origin, int idx) {
3544         float[] res = new float[SPECIES.length()];
3545         for (int i = 0; i < SPECIES.length(); i++){
3546             if(i+origin < SPECIES.length())
3547                 res[i] = a[idx+i+origin];
3548             else
3549                 res[i] = (float)0;
3550         }
3551         return res;
3552     }
3553 
3554     @Test(dataProvider = "floatUnaryOpProvider")
3555     static void sliceUnaryFloatMaxVectorTests(IntFunction<float[]> fa) {
3556         float[] a = fa.apply(SPECIES.length());
3557         float[] r = new float[a.length];
3558         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3559         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3560             for (int i = 0; i < a.length; i += SPECIES.length()) {
3561                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3562                 av.slice(origin).intoArray(r, i);
3563             }
3564         }
3565 
3566         assertArraysEquals(r, a, origin, FloatMaxVectorTests::sliceUnary);
3567     }

3568     static float[] sliceBinary(float[] a, float[] b, int origin, int idx) {
3569         float[] res = new float[SPECIES.length()];
3570         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3571             if(i+origin < SPECIES.length())
3572                 res[i] = a[idx+i+origin];
3573             else {
3574                 res[i] = b[idx+j];
3575                 j++;
3576             }
3577         }
3578         return res;
3579     }
3580 
3581     @Test(dataProvider = "floatBinaryOpProvider")
3582     static void sliceBinaryFloatMaxVectorTestsBinary(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3583         float[] a = fa.apply(SPECIES.length());
3584         float[] b = fb.apply(SPECIES.length());
3585         float[] r = new float[a.length];
3586         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3587         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3588             for (int i = 0; i < a.length; i += SPECIES.length()) {
3589                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3590                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3591                 av.slice(origin, bv).intoArray(r, i);
3592             }
3593         }
3594 
3595         assertArraysEquals(r, a, b, origin, FloatMaxVectorTests::sliceBinary);
3596     }

3597     static float[] slice(float[] a, float[] b, int origin, boolean[] mask, int idx) {
3598         float[] res = new float[SPECIES.length()];
3599         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3600             if(i+origin < SPECIES.length())
3601                 res[i] = mask[i] ? a[idx+i+origin] : (float)0;
3602             else {
3603                 res[i] = mask[i] ? b[idx+j] : (float)0;
3604                 j++;
3605             }
3606         }
3607         return res;
3608     }
3609 
3610     @Test(dataProvider = "floatBinaryOpMaskProvider")
3611     static void sliceFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
3612     IntFunction<boolean[]> fm) {
3613         float[] a = fa.apply(SPECIES.length());
3614         float[] b = fb.apply(SPECIES.length());
3615         boolean[] mask = fm.apply(SPECIES.length());
3616         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3617 
3618         float[] r = new float[a.length];
3619         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3620         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3621             for (int i = 0; i < a.length; i += SPECIES.length()) {
3622                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3623                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3624                 av.slice(origin, bv, vmask).intoArray(r, i);
3625             }
3626         }
3627 
3628         assertArraysEquals(r, a, b, origin, mask, FloatMaxVectorTests::slice);
3629     }

3630     static float[] unsliceUnary(float[] a, int origin, int idx) {
3631         float[] res = new float[SPECIES.length()];
3632         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3633             if(i < origin)
3634                 res[i] = (float)0;
3635             else {
3636                 res[i] = a[idx+j];
3637                 j++;
3638             }
3639         }
3640         return res;
3641     }
3642 
3643     @Test(dataProvider = "floatUnaryOpProvider")
3644     static void unsliceUnaryFloatMaxVectorTests(IntFunction<float[]> fa) {
3645         float[] a = fa.apply(SPECIES.length());
3646         float[] r = new float[a.length];
3647         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3648         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3649             for (int i = 0; i < a.length; i += SPECIES.length()) {
3650                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3651                 av.unslice(origin).intoArray(r, i);
3652             }
3653         }
3654 
3655         assertArraysEquals(r, a, origin, FloatMaxVectorTests::unsliceUnary);
3656     }

3657     static float[] unsliceBinary(float[] a, float[] b, int origin, int part, int idx) {
3658         float[] res = new float[SPECIES.length()];
3659         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3660             if (part == 0) {
3661                 if (i < origin)
3662                     res[i] = b[idx+i];
3663                 else {
3664                     res[i] = a[idx+j];
3665                     j++;
3666                 }
3667             } else if (part == 1) {
3668                 if (i < origin)
3669                     res[i] = a[idx+SPECIES.length()-origin+i];
3670                 else {
3671                     res[i] = b[idx+origin+j];
3672                     j++;
3673                 }
3674             }
3675         }
3676         return res;
3677     }
3678 
3679     @Test(dataProvider = "floatBinaryOpProvider")
3680     static void unsliceBinaryFloatMaxVectorTestsBinary(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3681         float[] a = fa.apply(SPECIES.length());
3682         float[] b = fb.apply(SPECIES.length());
3683         float[] r = new float[a.length];
3684         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3685         int part = (new java.util.Random()).nextInt(2);
3686         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3687             for (int i = 0; i < a.length; i += SPECIES.length()) {
3688                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3689                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3690                 av.unslice(origin, bv, part).intoArray(r, i);
3691             }
3692         }
3693 
3694         assertArraysEquals(r, a, b, origin, part, FloatMaxVectorTests::unsliceBinary);
3695     }

3696     static float[] unslice(float[] a, float[] b, int origin, int part, boolean[] mask, int idx) {
3697         float[] res = new float[SPECIES.length()];
3698         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3699             if(i+origin < SPECIES.length())
3700                 res[i] = b[idx+i+origin];
3701             else {
3702                 res[i] = b[idx+j];
3703                 j++;
3704             }
3705         }
3706         for (int i = 0; i < SPECIES.length(); i++){
3707             res[i] = mask[i] ? a[idx+i] : res[i];
3708         }
3709         float[] res1 = new float[SPECIES.length()];
3710         if (part == 0) {
3711             for (int i = 0, j = 0; i < SPECIES.length(); i++){
3712                 if (i < origin)
3713                     res1[i] = b[idx+i];
3714                 else {
3715                    res1[i] = res[j];

3756 
3757     static float strictSIN(float a) {
3758         return (float)(StrictMath.sin((double)a));
3759     }
3760 
3761     @Test(dataProvider = "floatUnaryOpProvider")
3762     static void SINFloatMaxVectorTests(IntFunction<float[]> fa) {
3763         float[] a = fa.apply(SPECIES.length());
3764         float[] r = fr.apply(SPECIES.length());
3765 
3766         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3767             for (int i = 0; i < a.length; i += SPECIES.length()) {
3768                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3769                 av.lanewise(VectorOperators.SIN).intoArray(r, i);
3770             }
3771         }
3772 
3773         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::SIN, FloatMaxVectorTests::strictSIN);
3774     }
3775 
3776 
3777     static float EXP(float a) {
3778         return (float)(Math.exp((double)a));
3779     }
3780 
3781     static float strictEXP(float a) {
3782         return (float)(StrictMath.exp((double)a));
3783     }
3784 
3785     @Test(dataProvider = "floatUnaryOpProvider")
3786     static void EXPFloatMaxVectorTests(IntFunction<float[]> fa) {
3787         float[] a = fa.apply(SPECIES.length());
3788         float[] r = fr.apply(SPECIES.length());
3789 
3790         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3791             for (int i = 0; i < a.length; i += SPECIES.length()) {
3792                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3793                 av.lanewise(VectorOperators.EXP).intoArray(r, i);
3794             }
3795         }
3796 
3797         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::EXP, FloatMaxVectorTests::strictEXP);
3798     }
3799 
3800 
3801     static float LOG1P(float a) {
3802         return (float)(Math.log1p((double)a));
3803     }
3804 
3805     static float strictLOG1P(float a) {
3806         return (float)(StrictMath.log1p((double)a));
3807     }
3808 
3809     @Test(dataProvider = "floatUnaryOpProvider")
3810     static void LOG1PFloatMaxVectorTests(IntFunction<float[]> fa) {
3811         float[] a = fa.apply(SPECIES.length());
3812         float[] r = fr.apply(SPECIES.length());
3813 
3814         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3815             for (int i = 0; i < a.length; i += SPECIES.length()) {
3816                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3817                 av.lanewise(VectorOperators.LOG1P).intoArray(r, i);
3818             }
3819         }
3820 
3821         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::LOG1P, FloatMaxVectorTests::strictLOG1P);
3822     }
3823 
3824 
3825     static float LOG(float a) {
3826         return (float)(Math.log((double)a));
3827     }
3828 
3829     static float strictLOG(float a) {
3830         return (float)(StrictMath.log((double)a));
3831     }
3832 
3833     @Test(dataProvider = "floatUnaryOpProvider")
3834     static void LOGFloatMaxVectorTests(IntFunction<float[]> fa) {
3835         float[] a = fa.apply(SPECIES.length());
3836         float[] r = fr.apply(SPECIES.length());
3837 
3838         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3839             for (int i = 0; i < a.length; i += SPECIES.length()) {
3840                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3841                 av.lanewise(VectorOperators.LOG).intoArray(r, i);
3842             }
3843         }
3844 
3845         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::LOG, FloatMaxVectorTests::strictLOG);
3846     }
3847 
3848 
3849     static float LOG10(float a) {
3850         return (float)(Math.log10((double)a));
3851     }
3852 
3853     static float strictLOG10(float a) {
3854         return (float)(StrictMath.log10((double)a));
3855     }
3856 
3857     @Test(dataProvider = "floatUnaryOpProvider")
3858     static void LOG10FloatMaxVectorTests(IntFunction<float[]> fa) {
3859         float[] a = fa.apply(SPECIES.length());
3860         float[] r = fr.apply(SPECIES.length());
3861 
3862         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3863             for (int i = 0; i < a.length; i += SPECIES.length()) {
3864                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3865                 av.lanewise(VectorOperators.LOG10).intoArray(r, i);
3866             }
3867         }
3868 
3869         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::LOG10, FloatMaxVectorTests::strictLOG10);
3870     }
3871 
3872 
3873     static float EXPM1(float a) {
3874         return (float)(Math.expm1((double)a));
3875     }
3876 
3877     static float strictEXPM1(float a) {
3878         return (float)(StrictMath.expm1((double)a));
3879     }
3880 
3881     @Test(dataProvider = "floatUnaryOpProvider")
3882     static void EXPM1FloatMaxVectorTests(IntFunction<float[]> fa) {
3883         float[] a = fa.apply(SPECIES.length());
3884         float[] r = fr.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                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3889                 av.lanewise(VectorOperators.EXPM1).intoArray(r, i);
3890             }
3891         }
3892 
3893         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::EXPM1, FloatMaxVectorTests::strictEXPM1);
3894     }
3895 
3896 
3897     static float COS(float a) {
3898         return (float)(Math.cos((double)a));
3899     }
3900 
3901     static float strictCOS(float a) {
3902         return (float)(StrictMath.cos((double)a));
3903     }
3904 
3905     @Test(dataProvider = "floatUnaryOpProvider")
3906     static void COSFloatMaxVectorTests(IntFunction<float[]> fa) {
3907         float[] a = fa.apply(SPECIES.length());
3908         float[] r = fr.apply(SPECIES.length());
3909 
3910         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3911             for (int i = 0; i < a.length; i += SPECIES.length()) {
3912                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3913                 av.lanewise(VectorOperators.COS).intoArray(r, i);
3914             }
3915         }
3916 
3917         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::COS, FloatMaxVectorTests::strictCOS);
3918     }
3919 
3920 
3921     static float TAN(float a) {
3922         return (float)(Math.tan((double)a));
3923     }
3924 
3925     static float strictTAN(float a) {
3926         return (float)(StrictMath.tan((double)a));
3927     }
3928 
3929     @Test(dataProvider = "floatUnaryOpProvider")
3930     static void TANFloatMaxVectorTests(IntFunction<float[]> fa) {
3931         float[] a = fa.apply(SPECIES.length());
3932         float[] r = fr.apply(SPECIES.length());
3933 
3934         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3935             for (int i = 0; i < a.length; i += SPECIES.length()) {
3936                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3937                 av.lanewise(VectorOperators.TAN).intoArray(r, i);
3938             }
3939         }
3940 
3941         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::TAN, FloatMaxVectorTests::strictTAN);
3942     }
3943 
3944 
3945     static float SINH(float a) {
3946         return (float)(Math.sinh((double)a));
3947     }
3948 
3949     static float strictSINH(float a) {
3950         return (float)(StrictMath.sinh((double)a));
3951     }
3952 
3953     @Test(dataProvider = "floatUnaryOpProvider")
3954     static void SINHFloatMaxVectorTests(IntFunction<float[]> fa) {
3955         float[] a = fa.apply(SPECIES.length());
3956         float[] r = fr.apply(SPECIES.length());
3957 
3958         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3959             for (int i = 0; i < a.length; i += SPECIES.length()) {
3960                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3961                 av.lanewise(VectorOperators.SINH).intoArray(r, i);
3962             }
3963         }
3964 
3965         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::SINH, FloatMaxVectorTests::strictSINH);
3966     }
3967 
3968 
3969     static float COSH(float a) {
3970         return (float)(Math.cosh((double)a));
3971     }
3972 
3973     static float strictCOSH(float a) {
3974         return (float)(StrictMath.cosh((double)a));
3975     }
3976 
3977     @Test(dataProvider = "floatUnaryOpProvider")
3978     static void COSHFloatMaxVectorTests(IntFunction<float[]> fa) {
3979         float[] a = fa.apply(SPECIES.length());
3980         float[] r = fr.apply(SPECIES.length());
3981 
3982         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3983             for (int i = 0; i < a.length; i += SPECIES.length()) {
3984                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3985                 av.lanewise(VectorOperators.COSH).intoArray(r, i);
3986             }
3987         }
3988 
3989         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::COSH, FloatMaxVectorTests::strictCOSH);
3990     }
3991 
3992 
3993     static float TANH(float a) {
3994         return (float)(Math.tanh((double)a));
3995     }
3996 
3997     static float strictTANH(float a) {
3998         return (float)(StrictMath.tanh((double)a));
3999     }
4000 
4001     @Test(dataProvider = "floatUnaryOpProvider")
4002     static void TANHFloatMaxVectorTests(IntFunction<float[]> fa) {
4003         float[] a = fa.apply(SPECIES.length());
4004         float[] r = fr.apply(SPECIES.length());
4005 
4006         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4007             for (int i = 0; i < a.length; i += SPECIES.length()) {
4008                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4009                 av.lanewise(VectorOperators.TANH).intoArray(r, i);
4010             }
4011         }
4012 
4013         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::TANH, FloatMaxVectorTests::strictTANH);
4014     }
4015 
4016 
4017     static float ASIN(float a) {
4018         return (float)(Math.asin((double)a));
4019     }
4020 
4021     static float strictASIN(float a) {
4022         return (float)(StrictMath.asin((double)a));
4023     }
4024 
4025     @Test(dataProvider = "floatUnaryOpProvider")
4026     static void ASINFloatMaxVectorTests(IntFunction<float[]> fa) {
4027         float[] a = fa.apply(SPECIES.length());
4028         float[] r = fr.apply(SPECIES.length());
4029 
4030         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4031             for (int i = 0; i < a.length; i += SPECIES.length()) {
4032                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4033                 av.lanewise(VectorOperators.ASIN).intoArray(r, i);
4034             }
4035         }
4036 
4037         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::ASIN, FloatMaxVectorTests::strictASIN);
4038     }
4039 
4040 
4041     static float ACOS(float a) {
4042         return (float)(Math.acos((double)a));
4043     }
4044 
4045     static float strictACOS(float a) {
4046         return (float)(StrictMath.acos((double)a));
4047     }
4048 
4049     @Test(dataProvider = "floatUnaryOpProvider")
4050     static void ACOSFloatMaxVectorTests(IntFunction<float[]> fa) {
4051         float[] a = fa.apply(SPECIES.length());
4052         float[] r = fr.apply(SPECIES.length());
4053 
4054         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4055             for (int i = 0; i < a.length; i += SPECIES.length()) {
4056                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4057                 av.lanewise(VectorOperators.ACOS).intoArray(r, i);
4058             }
4059         }
4060 
4061         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::ACOS, FloatMaxVectorTests::strictACOS);
4062     }
4063 
4064 
4065     static float ATAN(float a) {
4066         return (float)(Math.atan((double)a));
4067     }
4068 
4069     static float strictATAN(float a) {
4070         return (float)(StrictMath.atan((double)a));
4071     }
4072 
4073     @Test(dataProvider = "floatUnaryOpProvider")
4074     static void ATANFloatMaxVectorTests(IntFunction<float[]> fa) {
4075         float[] a = fa.apply(SPECIES.length());
4076         float[] r = fr.apply(SPECIES.length());
4077 
4078         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4079             for (int i = 0; i < a.length; i += SPECIES.length()) {
4080                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4081                 av.lanewise(VectorOperators.ATAN).intoArray(r, i);
4082             }
4083         }
4084 
4085         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::ATAN, FloatMaxVectorTests::strictATAN);
4086     }
4087 
4088 
4089     static float CBRT(float a) {
4090         return (float)(Math.cbrt((double)a));
4091     }
4092 
4093     static float strictCBRT(float a) {
4094         return (float)(StrictMath.cbrt((double)a));
4095     }
4096 
4097     @Test(dataProvider = "floatUnaryOpProvider")
4098     static void CBRTFloatMaxVectorTests(IntFunction<float[]> fa) {
4099         float[] a = fa.apply(SPECIES.length());
4100         float[] r = fr.apply(SPECIES.length());
4101 
4102         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4103             for (int i = 0; i < a.length; i += SPECIES.length()) {
4104                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4105                 av.lanewise(VectorOperators.CBRT).intoArray(r, i);
4106             }
4107         }
4108 
4109         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::CBRT, FloatMaxVectorTests::strictCBRT);
4110     }
4111 
4112 
4113     static float HYPOT(float a, float b) {
4114         return (float)(Math.hypot((double)a, (double)b));
4115     }
4116 
4117     static float strictHYPOT(float a, float b) {
4118         return (float)(StrictMath.hypot((double)a, (double)b));
4119     }
4120 
4121     @Test(dataProvider = "floatBinaryOpProvider")
4122     static void HYPOTFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4123         float[] a = fa.apply(SPECIES.length());
4124         float[] b = fb.apply(SPECIES.length());
4125         float[] r = fr.apply(SPECIES.length());
4126 
4127         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4128             for (int i = 0; i < a.length; i += SPECIES.length()) {
4129                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4130                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4131                 av.lanewise(VectorOperators.HYPOT, bv).intoArray(r, i);
4132             }
4133         }
4134 
4135         assertArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::HYPOT, FloatMaxVectorTests::strictHYPOT);
4136     }
4137 
4138 
4139 
4140     static float POW(float a, float b) {
4141         return (float)(Math.pow((double)a, (double)b));
4142     }
4143 
4144     static float strictPOW(float a, float b) {
4145         return (float)(StrictMath.pow((double)a, (double)b));
4146     }
4147 
4148     @Test(dataProvider = "floatBinaryOpProvider")
4149     static void POWFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4150         float[] a = fa.apply(SPECIES.length());
4151         float[] b = fb.apply(SPECIES.length());
4152         float[] r = fr.apply(SPECIES.length());
4153 
4154         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4155             for (int i = 0; i < a.length; i += SPECIES.length()) {
4156                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4157                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4158                 av.lanewise(VectorOperators.POW, bv).intoArray(r, i);
4159             }
4160         }
4161 
4162         assertArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::POW, FloatMaxVectorTests::strictPOW);
4163     }
4164 

4165     static float pow(float a, float b) {
4166         return (float)(Math.pow((double)a, (double)b));
4167     }
4168 
4169     static float strictpow(float a, float b) {
4170         return (float)(StrictMath.pow((double)a, (double)b));
4171     }
4172 
4173     @Test(dataProvider = "floatBinaryOpProvider")
4174     static void powFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4175         float[] a = fa.apply(SPECIES.length());
4176         float[] b = fb.apply(SPECIES.length());
4177         float[] r = fr.apply(SPECIES.length());
4178 
4179         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4180             for (int i = 0; i < a.length; i += SPECIES.length()) {
4181                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4182                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4183                 av.pow(bv).intoArray(r, i);
4184             }
4185         }
4186 
4187         assertArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::pow, FloatMaxVectorTests::strictpow);
4188     }
4189 
4190 
4191 
4192     static float ATAN2(float a, float b) {
4193         return (float)(Math.atan2((double)a, (double)b));
4194     }
4195 
4196     static float strictATAN2(float a, float b) {
4197         return (float)(StrictMath.atan2((double)a, (double)b));
4198     }
4199 
4200     @Test(dataProvider = "floatBinaryOpProvider")
4201     static void ATAN2FloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4202         float[] a = fa.apply(SPECIES.length());
4203         float[] b = fb.apply(SPECIES.length());
4204         float[] r = fr.apply(SPECIES.length());
4205 
4206         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4207             for (int i = 0; i < a.length; i += SPECIES.length()) {
4208                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4209                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4210                 av.lanewise(VectorOperators.ATAN2, bv).intoArray(r, i);
4211             }
4212         }
4213 
4214         assertArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::ATAN2, FloatMaxVectorTests::strictATAN2);
4215     }
4216 
4217 
4218 
4219     @Test(dataProvider = "floatBinaryOpProvider")
4220     static void POWFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4221         float[] a = fa.apply(SPECIES.length());
4222         float[] b = fb.apply(SPECIES.length());
4223         float[] r = fr.apply(SPECIES.length());
4224 
4225         for (int i = 0; i < a.length; i += SPECIES.length()) {
4226             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4227             av.lanewise(VectorOperators.POW, b[i]).intoArray(r, i);
4228         }
4229 
4230         assertBroadcastArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::POW, FloatMaxVectorTests::strictPOW);
4231     }
4232 

4233     @Test(dataProvider = "floatBinaryOpProvider")
4234     static void powFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4235         float[] a = fa.apply(SPECIES.length());
4236         float[] b = fb.apply(SPECIES.length());
4237         float[] r = fr.apply(SPECIES.length());
4238 
4239         for (int i = 0; i < a.length; i += SPECIES.length()) {
4240             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4241             av.pow(b[i]).intoArray(r, i);
4242         }
4243 
4244         assertBroadcastArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::pow, FloatMaxVectorTests::strictpow);
4245     }
4246 
4247 
4248 
4249     static float FMA(float a, float b, float c) {
4250         return (float)(Math.fma(a, b, c));
4251     }

4252     static float fma(float a, float b, float c) {
4253         return (float)(Math.fma(a, b, c));
4254     }
4255 
4256 
4257     @Test(dataProvider = "floatTernaryOpProvider")
4258     static void FMAFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4259         float[] a = fa.apply(SPECIES.length());
4260         float[] b = fb.apply(SPECIES.length());
4261         float[] c = fc.apply(SPECIES.length());
4262         float[] r = fr.apply(SPECIES.length());
4263 
4264         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4265             for (int i = 0; i < a.length; i += SPECIES.length()) {
4266                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4267                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4268                 FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4269                 av.lanewise(VectorOperators.FMA, bv, cv).intoArray(r, i);
4270             }
4271         }
4272 
4273         assertArraysEquals(r, a, b, c, FloatMaxVectorTests::FMA);
4274     }

4275     @Test(dataProvider = "floatTernaryOpProvider")
4276     static void fmaFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4277         float[] a = fa.apply(SPECIES.length());
4278         float[] b = fb.apply(SPECIES.length());
4279         float[] c = fc.apply(SPECIES.length());
4280         float[] r = fr.apply(SPECIES.length());
4281 
4282         for (int i = 0; i < a.length; i += SPECIES.length()) {
4283             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4284             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4285             FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4286             av.fma(bv, cv).intoArray(r, i);
4287         }
4288 
4289         assertArraysEquals(r, a, b, c, FloatMaxVectorTests::fma);
4290     }
4291 
4292 
4293     @Test(dataProvider = "floatTernaryOpMaskProvider")
4294     static void FMAFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
4295                                           IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
4296         float[] a = fa.apply(SPECIES.length());
4297         float[] b = fb.apply(SPECIES.length());
4298         float[] c = fc.apply(SPECIES.length());
4299         float[] r = fr.apply(SPECIES.length());
4300         boolean[] mask = fm.apply(SPECIES.length());
4301         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4302 
4303         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4304             for (int i = 0; i < a.length; i += SPECIES.length()) {
4305                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4306                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4307                 FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4308                 av.lanewise(VectorOperators.FMA, bv, cv, vmask).intoArray(r, i);
4309             }
4310         }
4311 
4312         assertArraysEquals(r, a, b, c, mask, FloatMaxVectorTests::FMA);
4313     }
4314 
4315 
4316 
4317 
4318 
4319     @Test(dataProvider = "floatTernaryOpProvider")
4320     static void FMAFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4321         float[] a = fa.apply(SPECIES.length());
4322         float[] b = fb.apply(SPECIES.length());
4323         float[] c = fc.apply(SPECIES.length());
4324         float[] r = fr.apply(SPECIES.length());
4325 
4326         for (int i = 0; i < a.length; i += SPECIES.length()) {
4327             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4328             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4329             av.lanewise(VectorOperators.FMA, bv, c[i]).intoArray(r, i);
4330         }
4331         assertBroadcastArraysEquals(r, a, b, c, FloatMaxVectorTests::FMA);
4332     }
4333 
4334     @Test(dataProvider = "floatTernaryOpProvider")
4335     static void FMAFloatMaxVectorTestsAltBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4336         float[] a = fa.apply(SPECIES.length());
4337         float[] b = fb.apply(SPECIES.length());
4338         float[] c = fc.apply(SPECIES.length());
4339         float[] r = fr.apply(SPECIES.length());
4340 
4341         for (int i = 0; i < a.length; i += SPECIES.length()) {
4342             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4343             FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4344             av.lanewise(VectorOperators.FMA, b[i], cv).intoArray(r, i);
4345         }
4346         assertAltBroadcastArraysEquals(r, a, b, c, FloatMaxVectorTests::FMA);
4347     }
4348 
4349 
4350     @Test(dataProvider = "floatTernaryOpMaskProvider")
4351     static void FMAFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
4352                                           IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
4353         float[] a = fa.apply(SPECIES.length());
4354         float[] b = fb.apply(SPECIES.length());
4355         float[] c = fc.apply(SPECIES.length());
4356         float[] r = fr.apply(SPECIES.length());
4357         boolean[] mask = fm.apply(SPECIES.length());
4358         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4359 
4360         for (int i = 0; i < a.length; i += SPECIES.length()) {
4361             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4362             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4363             av.lanewise(VectorOperators.FMA, bv, c[i], vmask).intoArray(r, i);
4364         }
4365 
4366         assertBroadcastArraysEquals(r, a, b, c, mask, FloatMaxVectorTests::FMA);
4367     }
4368 
4369     @Test(dataProvider = "floatTernaryOpMaskProvider")
4370     static void FMAFloatMaxVectorTestsAltBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
4371                                           IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
4372         float[] a = fa.apply(SPECIES.length());
4373         float[] b = fb.apply(SPECIES.length());
4374         float[] c = fc.apply(SPECIES.length());
4375         float[] r = fr.apply(SPECIES.length());
4376         boolean[] mask = fm.apply(SPECIES.length());
4377         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4378 
4379         for (int i = 0; i < a.length; i += SPECIES.length()) {
4380             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4381             FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4382             av.lanewise(VectorOperators.FMA, b[i], cv, vmask).intoArray(r, i);
4383         }
4384 
4385         assertAltBroadcastArraysEquals(r, a, b, c, mask, FloatMaxVectorTests::FMA);
4386     }
4387 
4388 
4389 
4390 
4391     @Test(dataProvider = "floatTernaryOpProvider")
4392     static void FMAFloatMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4393         float[] a = fa.apply(SPECIES.length());
4394         float[] b = fb.apply(SPECIES.length());
4395         float[] c = fc.apply(SPECIES.length());
4396         float[] r = fr.apply(SPECIES.length());
4397 
4398         for (int i = 0; i < a.length; i += SPECIES.length()) {
4399             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4400             av.lanewise(VectorOperators.FMA, b[i], c[i]).intoArray(r, i);
4401         }
4402 
4403         assertDoubleBroadcastArraysEquals(r, a, b, c, FloatMaxVectorTests::FMA);
4404     }

4405     @Test(dataProvider = "floatTernaryOpProvider")
4406     static void fmaFloatMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4407         float[] a = fa.apply(SPECIES.length());
4408         float[] b = fb.apply(SPECIES.length());
4409         float[] c = fc.apply(SPECIES.length());
4410         float[] r = fr.apply(SPECIES.length());
4411 
4412         for (int i = 0; i < a.length; i += SPECIES.length()) {
4413             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4414             av.fma(b[i], c[i]).intoArray(r, i);
4415         }
4416 
4417         assertDoubleBroadcastArraysEquals(r, a, b, c, FloatMaxVectorTests::fma);
4418     }
4419 
4420 
4421     @Test(dataProvider = "floatTernaryOpMaskProvider")
4422     static void FMAFloatMaxVectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
4423                                           IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
4424         float[] a = fa.apply(SPECIES.length());
4425         float[] b = fb.apply(SPECIES.length());
4426         float[] c = fc.apply(SPECIES.length());
4427         float[] r = fr.apply(SPECIES.length());
4428         boolean[] mask = fm.apply(SPECIES.length());
4429         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4430 
4431         for (int i = 0; i < a.length; i += SPECIES.length()) {
4432             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4433             av.lanewise(VectorOperators.FMA, b[i], c[i], vmask).intoArray(r, i);
4434         }
4435 
4436         assertDoubleBroadcastArraysEquals(r, a, b, c, mask, FloatMaxVectorTests::FMA);
4437     }
4438 
4439 
4440 
4441 
4442     static float NEG(float a) {
4443         return (float)(-((float)a));
4444     }
4445 
4446     static float neg(float a) {
4447         return (float)(-((float)a));
4448     }
4449 
4450     @Test(dataProvider = "floatUnaryOpProvider")
4451     static void NEGFloatMaxVectorTests(IntFunction<float[]> fa) {
4452         float[] a = fa.apply(SPECIES.length());
4453         float[] r = fr.apply(SPECIES.length());
4454 
4455         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4456             for (int i = 0; i < a.length; i += SPECIES.length()) {
4457                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4458                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
4459             }
4460         }
4461 

4534     }
4535 
4536     @Test(dataProvider = "floatUnaryOpMaskProvider")
4537     static void ABSMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
4538                                                 IntFunction<boolean[]> fm) {
4539         float[] a = fa.apply(SPECIES.length());
4540         float[] r = fr.apply(SPECIES.length());
4541         boolean[] mask = fm.apply(SPECIES.length());
4542         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4543 
4544         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4545             for (int i = 0; i < a.length; i += SPECIES.length()) {
4546                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4547                 av.lanewise(VectorOperators.ABS, vmask).intoArray(r, i);
4548             }
4549         }
4550 
4551         assertArraysEquals(r, a, mask, FloatMaxVectorTests::ABS);
4552     }
4553 
4554 
4555 
4556 
4557 
4558 
4559 
4560 
4561     static float SQRT(float a) {
4562         return (float)(Math.sqrt((double)a));
4563     }
4564 
4565     static float sqrt(float a) {
4566         return (float)(Math.sqrt((double)a));
4567     }
4568 
4569 
4570 
4571     @Test(dataProvider = "floatUnaryOpProvider")
4572     static void SQRTFloatMaxVectorTests(IntFunction<float[]> fa) {
4573         float[] a = fa.apply(SPECIES.length());
4574         float[] r = fr.apply(SPECIES.length());
4575 
4576         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4577             for (int i = 0; i < a.length; i += SPECIES.length()) {
4578                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4579                 av.lanewise(VectorOperators.SQRT).intoArray(r, i);
4580             }
4581         }
4582 
4583         assertArraysEquals(r, a, FloatMaxVectorTests::SQRT);
4584     }
4585 
4586     @Test(dataProvider = "floatUnaryOpProvider")
4587     static void sqrtFloatMaxVectorTests(IntFunction<float[]> fa) {
4588         float[] a = fa.apply(SPECIES.length());
4589         float[] r = fr.apply(SPECIES.length());
4590 
4591         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4592             for (int i = 0; i < a.length; i += SPECIES.length()) {
4593                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4594                 av.sqrt().intoArray(r, i);
4595             }
4596         }
4597 
4598         assertArraysEquals(r, a, FloatMaxVectorTests::sqrt);
4599     }
4600 
4601 
4602 
4603     @Test(dataProvider = "floatUnaryOpMaskProvider")
4604     static void SQRTMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
4605                                                 IntFunction<boolean[]> fm) {
4606         float[] a = fa.apply(SPECIES.length());
4607         float[] r = fr.apply(SPECIES.length());
4608         boolean[] mask = fm.apply(SPECIES.length());
4609         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4610 
4611         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4612             for (int i = 0; i < a.length; i += SPECIES.length()) {
4613                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4614                 av.lanewise(VectorOperators.SQRT, vmask).intoArray(r, i);
4615             }
4616         }
4617 
4618         assertArraysEquals(r, a, mask, FloatMaxVectorTests::SQRT);
4619     }
4620 
4621 
4622     @Test(dataProvider = "floatCompareOpProvider")
4623     static void ltFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4624         float[] a = fa.apply(SPECIES.length());
4625         float[] b = fb.apply(SPECIES.length());
4626 
4627         for (int i = 0; i < a.length; i += SPECIES.length()) {
4628             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4629             VectorMask<Float> mv = av.lt(b[i]);
4630 
4631             // Check results as part of computation.
4632             for (int j = 0; j < SPECIES.length(); j++) {
4633                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
4634             }
4635         }
4636     }
4637 
4638     @Test(dataProvider = "floatCompareOpProvider")
4639     static void eqFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4640         float[] a = fa.apply(SPECIES.length());
4641         float[] b = fb.apply(SPECIES.length());

5003             }
5004         }
5005         return i - idx;
5006     }
5007 
5008     @Test(dataProvider = "maskProvider")
5009     static void maskFirstTrueFloatMaxVectorTestsSmokeTest(IntFunction<boolean[]> fa) {
5010         boolean[] a = fa.apply(SPECIES.length());
5011         int[] r = new int[a.length];
5012 
5013         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
5014             for (int i = 0; i < a.length; i += SPECIES.length()) {
5015                 var vmask = SPECIES.loadMask(a, i);
5016                 r[i] = vmask.firstTrue();
5017             }
5018         }
5019 
5020         assertMaskReductionArraysEquals(r, a, FloatMaxVectorTests::maskFirstTrue);
5021     }
5022 

















5023 
5024     @DataProvider
5025     public static Object[][] offsetProvider() {
5026         return new Object[][]{
5027                 {0},
5028                 {-1},
5029                 {+1},
5030                 {+2},
5031                 {-2},
5032         };
5033     }
5034 
5035     @Test(dataProvider = "offsetProvider")
5036     static void indexInRangeFloatMaxVectorTestsSmokeTest(int offset) {
5037         int limit = SPECIES.length() * BUFFER_REPS;
5038         for (int i = 0; i < limit; i += SPECIES.length()) {
5039             var actualMask = SPECIES.indexInRange(i + offset, limit);
5040             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
5041             assert(actualMask.equals(expectedMask));
5042             for (int j = 0; j < SPECIES.length(); j++)  {
5043                 int index = i + j + offset;
5044                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
5045             }
5046         }
5047     }
5048 














5049     @DataProvider
5050     public static Object[][] lengthProvider() {
5051         return new Object[][]{
5052                 {0},
5053                 {1},
5054                 {32},
5055                 {37},
5056                 {1024},
5057                 {1024+1},
5058                 {1024+5},
5059         };
5060     }
5061 
5062     @Test(dataProvider = "lengthProvider")
5063     static void loopBoundFloatMaxVectorTestsSmokeTest(int length) {
5064         int actualLoopBound = SPECIES.loopBound(length);
5065         int expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
5066         Assert.assertEquals(actualLoopBound, expectedLoopBound);
5067     }
5068 








5069     @Test
5070     static void ElementSizeFloatMaxVectorTestsSmokeTest() {
5071         FloatVector av = FloatVector.zero(SPECIES);
5072         int elsize = av.elementSize();
5073         Assert.assertEquals(elsize, Float.SIZE);
5074     }
5075 
5076     @Test
5077     static void VectorShapeFloatMaxVectorTestsSmokeTest() {
5078         FloatVector av = FloatVector.zero(SPECIES);
5079         VectorShape vsh = av.shape();
5080         assert(vsh.equals(VectorShape.S_Max_BIT));
5081     }
5082 
5083     @Test
5084     static void ShapeWithLanesFloatMaxVectorTestsSmokeTest() {
5085         FloatVector av = FloatVector.zero(SPECIES);
5086         VectorShape vsh = av.shape();
5087         VectorSpecies species = vsh.withLanes(float.class);
5088         assert(species.equals(SPECIES));

5111         FloatVector av = FloatVector.zero(SPECIES);
5112         VectorSpecies species = av.species().withLanes(float.class);
5113         assert(species.equals(SPECIES));
5114     }
5115 
5116     @Test
5117     static void WithShapeFloatMaxVectorTestsSmokeTest() {
5118         FloatVector av = FloatVector.zero(SPECIES);
5119         VectorShape vsh = av.shape();
5120         VectorSpecies species = av.species().withShape(vsh);
5121         assert(species.equals(SPECIES));
5122     }
5123 
5124     @Test
5125     static void MaskAllTrueFloatMaxVectorTestsSmokeTest() {
5126         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5127           Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length()));
5128         }
5129     }
5130 }
5131 

  48 import java.util.function.BiFunction;
  49 import java.util.function.IntFunction;
  50 import java.util.Objects;
  51 import java.util.stream.Collectors;
  52 import java.util.stream.Stream;
  53 
  54 @Test
  55 public class FloatMaxVectorTests extends AbstractVectorTest {
  56 
  57     static final VectorSpecies<Float> SPECIES =
  58                 FloatVector.SPECIES_MAX;
  59 
  60     static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
  61 
  62     static VectorShape getMaxBit() {
  63         return VectorShape.S_Max_BIT;
  64     }
  65 
  66     private static final int Max = 256;  // juts so we can do N/Max
  67 

  68 
  69     static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max);
  70 
  71     interface FUnOp {
  72         float apply(float a);
  73     }
  74 
  75     static void assertArraysEquals(float[] r, float[] a, FUnOp f) {
  76         int i = 0;
  77         try {
  78             for (; i < a.length; i++) {
  79                 Assert.assertEquals(r[i], f.apply(a[i]));
  80             }
  81         } catch (AssertionError e) {
  82             Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]);
  83         }
  84     }
  85 
  86     interface FUnArrayOp {
  87         float[] apply(float a);

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

1060         try {
1061             for (; i < r.length; i++) {
1062                 Assert.assertEquals(r[i], (long)(a[i+offs]));
1063             }
1064         } catch (AssertionError e) {
1065             Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
1066         }
1067     }
1068 
1069     static void assertArraysEquals(double[] r, float[] a, int offs) {
1070         int i = 0;
1071         try {
1072             for (; i < r.length; i++) {
1073                 Assert.assertEquals(r[i], (double)(a[i+offs]));
1074             }
1075         } catch (AssertionError e) {
1076             Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
1077         }
1078     }
1079 

1080     static int bits(float e) {
1081         return  Float.floatToIntBits(e);
1082     }
1083 
1084     static final List<IntFunction<float[]>> FLOAT_GENERATORS = List.of(
1085             withToString("float[-i * 5]", (int s) -> {
1086                 return fill(s * BUFFER_REPS,
1087                             i -> (float)(-i * 5));
1088             }),
1089             withToString("float[i * 5]", (int s) -> {
1090                 return fill(s * BUFFER_REPS,
1091                             i -> (float)(i * 5));
1092             }),
1093             withToString("float[i + 1]", (int s) -> {
1094                 return fill(s * BUFFER_REPS,
1095                             i -> (((float)(i + 1) == 0) ? 1 : (float)(i + 1)));
1096             }),
1097             withToString("float[cornerCaseValue(i)]", (int s) -> {
1098                 return fill(s * BUFFER_REPS,
1099                             i -> cornerCaseValue(i));

1243 
1244     @DataProvider
1245     public Object[][] floatUnaryOpSelectFromProvider() {
1246         return FLOAT_SHUFFLE_GENERATORS.stream().
1247                 flatMap(fs -> FLOAT_GENERATORS.stream().map(fa -> {
1248                     return new Object[] {fa, fs};
1249                 })).
1250                 toArray(Object[][]::new);
1251     }
1252 
1253     @DataProvider
1254     public Object[][] floatUnaryOpSelectFromMaskProvider() {
1255         return BOOLEAN_MASK_GENERATORS.stream().
1256                 flatMap(fm -> FLOAT_SHUFFLE_GENERATORS.stream().
1257                     flatMap(fs -> FLOAT_GENERATORS.stream().map(fa -> {
1258                         return new Object[] {fa, fs, fm};
1259                 }))).
1260                 toArray(Object[][]::new);
1261     }
1262 

1263     static final List<IntFunction<float[]>> FLOAT_COMPARE_GENERATORS = List.of(
1264             withToString("float[i]", (int s) -> {
1265                 return fill(s * BUFFER_REPS,
1266                             i -> (float)i);
1267             }),
1268             withToString("float[i - length / 2]", (int s) -> {
1269                 return fill(s * BUFFER_REPS,
1270                             i -> (float)(i - (s * BUFFER_REPS / 2)));
1271             }),
1272             withToString("float[i + 1]", (int s) -> {
1273                 return fill(s * BUFFER_REPS,
1274                             i -> (float)(i + 1));
1275             }),
1276             withToString("float[i - 2]", (int s) -> {
1277                 return fill(s * BUFFER_REPS,
1278                             i -> (float)(i - 2));
1279             }),
1280             withToString("float[zigZag(i)]", (int s) -> {
1281                 return fill(s * BUFFER_REPS,
1282                             i -> i%3 == 0 ? (float)i : (i%3 == 1 ? (float)(i + 1) : (float)(i - 2)));

1363 
1364     static float get(float[] a, int i) {
1365         return (float) a[i];
1366     }
1367 
1368     static final IntFunction<float[]> fr = (vl) -> {
1369         int length = BUFFER_REPS * vl;
1370         return new float[length];
1371     };
1372 
1373     static final IntFunction<boolean[]> fmr = (vl) -> {
1374         int length = BUFFER_REPS * vl;
1375         return new boolean[length];
1376     };
1377 
1378     static final IntFunction<long[]> lfr = (vl) -> {
1379         int length = BUFFER_REPS * vl;
1380         return new long[length];
1381     };
1382 

1383     static boolean eq(float a, float b) {
1384         return a == b;
1385     }
1386 
1387     static boolean neq(float a, float b) {
1388         return a != b;
1389     }
1390 
1391     static boolean lt(float a, float b) {
1392         return a < b;
1393     }
1394 
1395     static boolean le(float a, float b) {
1396         return a <= b;
1397     }
1398 
1399     static boolean gt(float a, float b) {
1400         return a > b;
1401     }
1402 
1403     static boolean ge(float a, float b) {
1404         return a >= b;
1405     }
1406 

1407     static float firstNonZero(float a, float b) {
1408         return Float.compare(a, (float) 0) != 0 ? a : b;
1409     }
1410 
1411     @Test
1412     static void smokeTest1() {
1413         FloatVector three = FloatVector.broadcast(SPECIES, (byte)-3);
1414         FloatVector three2 = (FloatVector) SPECIES.broadcast(-3);
1415         assert(three.eq(three2).allTrue());
1416         FloatVector three3 = three2.broadcast(1).broadcast(-3);
1417         assert(three.eq(three3).allTrue());
1418         int scale = 2;
1419         Class<?> ETYPE = float.class;
1420         if (ETYPE == double.class || ETYPE == long.class)
1421             scale = 1000000;
1422         else if (ETYPE == byte.class && SPECIES.length() >= 64)
1423             scale = 1;
1424         FloatVector higher = three.addIndex(scale);
1425         VectorMask<Float> m = three.compare(VectorOperators.LE, higher);
1426         assert(m.allTrue());

1503     static float ADD(float a, float b) {
1504         return (float)(a + b);
1505     }
1506 
1507     @Test(dataProvider = "floatBinaryOpProvider")
1508     static void ADDFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1509         float[] a = fa.apply(SPECIES.length());
1510         float[] b = fb.apply(SPECIES.length());
1511         float[] 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                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1516                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1517                 av.lanewise(VectorOperators.ADD, bv).intoArray(r, i);
1518             }
1519         }
1520 
1521         assertArraysEquals(r, a, b, FloatMaxVectorTests::ADD);
1522     }
1523 
1524     static float add(float a, float b) {
1525         return (float)(a + b);
1526     }
1527 
1528     @Test(dataProvider = "floatBinaryOpProvider")
1529     static void addFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1530         float[] a = fa.apply(SPECIES.length());
1531         float[] b = fb.apply(SPECIES.length());
1532         float[] r = fr.apply(SPECIES.length());
1533 
1534         for (int i = 0; i < a.length; i += SPECIES.length()) {
1535             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1536             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1537             av.add(bv).intoArray(r, i);
1538         }
1539 
1540         assertArraysEquals(r, a, b, FloatMaxVectorTests::add);
1541     }
1542 
1543     @Test(dataProvider = "floatBinaryOpMaskProvider")

1560         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::ADD);
1561     }
1562 
1563     @Test(dataProvider = "floatBinaryOpMaskProvider")
1564     static void addFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1565                                           IntFunction<boolean[]> fm) {
1566         float[] a = fa.apply(SPECIES.length());
1567         float[] b = fb.apply(SPECIES.length());
1568         float[] r = fr.apply(SPECIES.length());
1569         boolean[] mask = fm.apply(SPECIES.length());
1570         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1571 
1572         for (int i = 0; i < a.length; i += SPECIES.length()) {
1573             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1574             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1575             av.add(bv, vmask).intoArray(r, i);
1576         }
1577 
1578         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::add);
1579     }
1580 
1581     static float SUB(float a, float b) {
1582         return (float)(a - b);
1583     }
1584 
1585     @Test(dataProvider = "floatBinaryOpProvider")
1586     static void SUBFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1587         float[] a = fa.apply(SPECIES.length());
1588         float[] b = fb.apply(SPECIES.length());
1589         float[] r = fr.apply(SPECIES.length());
1590 
1591         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1592             for (int i = 0; i < a.length; i += SPECIES.length()) {
1593                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1594                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1595                 av.lanewise(VectorOperators.SUB, bv).intoArray(r, i);
1596             }
1597         }
1598 
1599         assertArraysEquals(r, a, b, FloatMaxVectorTests::SUB);
1600     }
1601 
1602     static float sub(float a, float b) {
1603         return (float)(a - b);
1604     }
1605 
1606     @Test(dataProvider = "floatBinaryOpProvider")
1607     static void subFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1608         float[] a = fa.apply(SPECIES.length());
1609         float[] b = fb.apply(SPECIES.length());
1610         float[] r = fr.apply(SPECIES.length());
1611 
1612         for (int i = 0; i < a.length; i += SPECIES.length()) {
1613             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1614             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1615             av.sub(bv).intoArray(r, i);
1616         }
1617 
1618         assertArraysEquals(r, a, b, FloatMaxVectorTests::sub);
1619     }
1620 
1621     @Test(dataProvider = "floatBinaryOpMaskProvider")

1638         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::SUB);
1639     }
1640 
1641     @Test(dataProvider = "floatBinaryOpMaskProvider")
1642     static void subFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1643                                           IntFunction<boolean[]> fm) {
1644         float[] a = fa.apply(SPECIES.length());
1645         float[] b = fb.apply(SPECIES.length());
1646         float[] r = fr.apply(SPECIES.length());
1647         boolean[] mask = fm.apply(SPECIES.length());
1648         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1649 
1650         for (int i = 0; i < a.length; i += SPECIES.length()) {
1651             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1652             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1653             av.sub(bv, vmask).intoArray(r, i);
1654         }
1655 
1656         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::sub);
1657     }
1658 
1659     static float MUL(float a, float b) {
1660         return (float)(a * b);
1661     }
1662 
1663     @Test(dataProvider = "floatBinaryOpProvider")
1664     static void MULFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1665         float[] a = fa.apply(SPECIES.length());
1666         float[] b = fb.apply(SPECIES.length());
1667         float[] r = fr.apply(SPECIES.length());
1668 
1669         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1670             for (int i = 0; i < a.length; i += SPECIES.length()) {
1671                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1672                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1673                 av.lanewise(VectorOperators.MUL, bv).intoArray(r, i);
1674             }
1675         }
1676 
1677         assertArraysEquals(r, a, b, FloatMaxVectorTests::MUL);
1678     }
1679 
1680     static float mul(float a, float b) {
1681         return (float)(a * b);
1682     }
1683 
1684     @Test(dataProvider = "floatBinaryOpProvider")
1685     static void mulFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1686         float[] a = fa.apply(SPECIES.length());
1687         float[] b = fb.apply(SPECIES.length());
1688         float[] r = fr.apply(SPECIES.length());
1689 
1690         for (int i = 0; i < a.length; i += SPECIES.length()) {
1691             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1692             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1693             av.mul(bv).intoArray(r, i);
1694         }
1695 
1696         assertArraysEquals(r, a, b, FloatMaxVectorTests::mul);
1697     }
1698 
1699     @Test(dataProvider = "floatBinaryOpMaskProvider")

1737     static float DIV(float a, float b) {
1738         return (float)(a / b);
1739     }
1740 
1741     @Test(dataProvider = "floatBinaryOpProvider")
1742     static void DIVFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1743         float[] a = fa.apply(SPECIES.length());
1744         float[] b = fb.apply(SPECIES.length());
1745         float[] r = fr.apply(SPECIES.length());
1746 
1747         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1748             for (int i = 0; i < a.length; i += SPECIES.length()) {
1749                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1750                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1751                 av.lanewise(VectorOperators.DIV, bv).intoArray(r, i);
1752             }
1753         }
1754 
1755         assertArraysEquals(r, a, b, FloatMaxVectorTests::DIV);
1756     }
1757 
1758     static float div(float a, float b) {
1759         return (float)(a / b);
1760     }
1761 
1762     @Test(dataProvider = "floatBinaryOpProvider")
1763     static void divFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1764         float[] a = fa.apply(SPECIES.length());
1765         float[] b = fb.apply(SPECIES.length());
1766         float[] r = fr.apply(SPECIES.length());
1767 
1768         for (int i = 0; i < a.length; i += SPECIES.length()) {
1769             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1770             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1771             av.div(bv).intoArray(r, i);
1772         }
1773 
1774         assertArraysEquals(r, a, b, FloatMaxVectorTests::div);
1775     }
1776 


1777     @Test(dataProvider = "floatBinaryOpMaskProvider")
1778     static void DIVFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1779                                           IntFunction<boolean[]> fm) {
1780         float[] a = fa.apply(SPECIES.length());
1781         float[] b = fb.apply(SPECIES.length());
1782         float[] r = fr.apply(SPECIES.length());
1783         boolean[] mask = fm.apply(SPECIES.length());
1784         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1785 
1786         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1787             for (int i = 0; i < a.length; i += SPECIES.length()) {
1788                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1789                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1790                 av.lanewise(VectorOperators.DIV, bv, vmask).intoArray(r, i);
1791             }
1792         }
1793 
1794         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::DIV);
1795     }
1796 
1797     @Test(dataProvider = "floatBinaryOpMaskProvider")
1798     static void divFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1799                                           IntFunction<boolean[]> fm) {
1800         float[] a = fa.apply(SPECIES.length());
1801         float[] b = fb.apply(SPECIES.length());
1802         float[] r = fr.apply(SPECIES.length());
1803         boolean[] mask = fm.apply(SPECIES.length());
1804         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1805 
1806         for (int i = 0; i < a.length; i += SPECIES.length()) {
1807             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1808             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1809             av.div(bv, vmask).intoArray(r, i);
1810         }
1811 
1812         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::div);
1813     }
1814 


1815     static float FIRST_NONZERO(float a, float b) {
1816         return (float)(Double.doubleToLongBits(a)!=0?a:b);
1817     }
1818 
1819     @Test(dataProvider = "floatBinaryOpProvider")
1820     static void FIRST_NONZEROFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1821         float[] a = fa.apply(SPECIES.length());
1822         float[] b = fb.apply(SPECIES.length());
1823         float[] r = fr.apply(SPECIES.length());
1824 
1825         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1826             for (int i = 0; i < a.length; i += SPECIES.length()) {
1827                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1828                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1829                 av.lanewise(VectorOperators.FIRST_NONZERO, bv).intoArray(r, i);
1830             }
1831         }
1832 
1833         assertArraysEquals(r, a, b, FloatMaxVectorTests::FIRST_NONZERO);
1834     }

1836     @Test(dataProvider = "floatBinaryOpMaskProvider")
1837     static void FIRST_NONZEROFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1838                                           IntFunction<boolean[]> fm) {
1839         float[] a = fa.apply(SPECIES.length());
1840         float[] b = fb.apply(SPECIES.length());
1841         float[] r = fr.apply(SPECIES.length());
1842         boolean[] mask = fm.apply(SPECIES.length());
1843         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1844 
1845         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1846             for (int i = 0; i < a.length; i += SPECIES.length()) {
1847                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1848                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1849                 av.lanewise(VectorOperators.FIRST_NONZERO, bv, vmask).intoArray(r, i);
1850             }
1851         }
1852 
1853         assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::FIRST_NONZERO);
1854     }
1855 








1856     @Test(dataProvider = "floatBinaryOpProvider")
1857     static void addFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1858         float[] a = fa.apply(SPECIES.length());
1859         float[] b = fb.apply(SPECIES.length());
1860         float[] r = fr.apply(SPECIES.length());
1861 
1862         for (int i = 0; i < a.length; i += SPECIES.length()) {
1863             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1864             av.add(b[i]).intoArray(r, i);
1865         }
1866 
1867         assertBroadcastArraysEquals(r, a, b, FloatMaxVectorTests::add);
1868     }
1869 
1870     @Test(dataProvider = "floatBinaryOpMaskProvider")
1871     static void addFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1872                                           IntFunction<boolean[]> fm) {
1873         float[] a = fa.apply(SPECIES.length());
1874         float[] b = fb.apply(SPECIES.length());
1875         float[] r = fr.apply(SPECIES.length());

1929         assertBroadcastArraysEquals(r, a, b, FloatMaxVectorTests::mul);
1930     }
1931 
1932     @Test(dataProvider = "floatBinaryOpMaskProvider")
1933     static void mulFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1934                                           IntFunction<boolean[]> fm) {
1935         float[] a = fa.apply(SPECIES.length());
1936         float[] b = fb.apply(SPECIES.length());
1937         float[] r = fr.apply(SPECIES.length());
1938         boolean[] mask = fm.apply(SPECIES.length());
1939         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1940 
1941         for (int i = 0; i < a.length; i += SPECIES.length()) {
1942             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1943             av.mul(b[i], vmask).intoArray(r, i);
1944         }
1945 
1946         assertBroadcastArraysEquals(r, a, b, mask, FloatMaxVectorTests::mul);
1947     }
1948 

1949     @Test(dataProvider = "floatBinaryOpProvider")
1950     static void divFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1951         float[] a = fa.apply(SPECIES.length());
1952         float[] b = fb.apply(SPECIES.length());
1953         float[] r = fr.apply(SPECIES.length());
1954 
1955         for (int i = 0; i < a.length; i += SPECIES.length()) {
1956             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1957             av.div(b[i]).intoArray(r, i);
1958         }
1959 
1960         assertBroadcastArraysEquals(r, a, b, FloatMaxVectorTests::div);
1961     }
1962 


1963     @Test(dataProvider = "floatBinaryOpMaskProvider")
1964     static void divFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1965                                           IntFunction<boolean[]> fm) {
1966         float[] a = fa.apply(SPECIES.length());
1967         float[] b = fb.apply(SPECIES.length());
1968         float[] r = fr.apply(SPECIES.length());
1969         boolean[] mask = fm.apply(SPECIES.length());
1970         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1971 
1972         for (int i = 0; i < a.length; i += SPECIES.length()) {
1973             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1974             av.div(b[i], vmask).intoArray(r, i);
1975         }
1976 
1977         assertBroadcastArraysEquals(r, a, b, mask, FloatMaxVectorTests::div);
1978     }
1979 









1980     @Test(dataProvider = "floatBinaryOpProvider")
1981     static void ADDFloatMaxVectorTestsBroadcastLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1982         float[] a = fa.apply(SPECIES.length());
1983         float[] b = fb.apply(SPECIES.length());
1984         float[] r = fr.apply(SPECIES.length());
1985 
1986         for (int i = 0; i < a.length; i += SPECIES.length()) {
1987             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1988             av.lanewise(VectorOperators.ADD, (long)b[i]).intoArray(r, i);
1989         }
1990 
1991         assertBroadcastLongArraysEquals(r, a, b, FloatMaxVectorTests::ADD);
1992     }
1993 
1994     @Test(dataProvider = "floatBinaryOpMaskProvider")
1995     static void ADDFloatMaxVectorTestsBroadcastMaskedLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1996                                           IntFunction<boolean[]> fm) {
1997         float[] a = fa.apply(SPECIES.length());
1998         float[] b = fb.apply(SPECIES.length());
1999         float[] r = fr.apply(SPECIES.length());
2000         boolean[] mask = fm.apply(SPECIES.length());
2001         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2002 
2003         for (int i = 0; i < a.length; i += SPECIES.length()) {
2004             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2005             av.lanewise(VectorOperators.ADD, (long)b[i], vmask).intoArray(r, i);
2006         }
2007 
2008         assertBroadcastLongArraysEquals(r, a, b, mask, FloatMaxVectorTests::ADD);
2009     }
2010 

























































2011     static float MIN(float a, float b) {
2012         return (float)(Math.min(a, b));
2013     }
2014 
2015     @Test(dataProvider = "floatBinaryOpProvider")
2016     static void MINFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2017         float[] a = fa.apply(SPECIES.length());
2018         float[] b = fb.apply(SPECIES.length());
2019         float[] r = fr.apply(SPECIES.length());
2020 
2021         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2022             for (int i = 0; i < a.length; i += SPECIES.length()) {
2023                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2024                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2025                 av.lanewise(VectorOperators.MIN, bv).intoArray(r, i);
2026             }
2027         }
2028 
2029         assertArraysEquals(r, a, b, FloatMaxVectorTests::MIN);
2030     }
2031 
2032     static float min(float a, float b) {
2033         return (float)(Math.min(a, b));
2034     }
2035 
2036     @Test(dataProvider = "floatBinaryOpProvider")
2037     static void minFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2038         float[] a = fa.apply(SPECIES.length());
2039         float[] b = fb.apply(SPECIES.length());
2040         float[] r = fr.apply(SPECIES.length());
2041 
2042         for (int i = 0; i < a.length; i += SPECIES.length()) {
2043             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2044             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2045             av.min(bv).intoArray(r, i);
2046         }
2047 
2048         assertArraysEquals(r, a, b, FloatMaxVectorTests::min);
2049     }
2050 
2051     static float MAX(float a, float b) {
2052         return (float)(Math.max(a, b));
2053     }
2054 
2055     @Test(dataProvider = "floatBinaryOpProvider")
2056     static void MAXFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2057         float[] a = fa.apply(SPECIES.length());
2058         float[] b = fb.apply(SPECIES.length());
2059         float[] r = fr.apply(SPECIES.length());
2060 
2061         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2062             for (int i = 0; i < a.length; i += SPECIES.length()) {
2063                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2064                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2065                 av.lanewise(VectorOperators.MAX, bv).intoArray(r, i);
2066             }
2067         }
2068 
2069         assertArraysEquals(r, a, b, FloatMaxVectorTests::MAX);
2070     }
2071 
2072     static float max(float a, float b) {
2073         return (float)(Math.max(a, b));
2074     }
2075 
2076     @Test(dataProvider = "floatBinaryOpProvider")
2077     static void maxFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2078         float[] a = fa.apply(SPECIES.length());
2079         float[] b = fb.apply(SPECIES.length());
2080         float[] r = fr.apply(SPECIES.length());
2081 
2082         for (int i = 0; i < a.length; i += SPECIES.length()) {
2083             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2084             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2085             av.max(bv).intoArray(r, i);
2086         }
2087 
2088         assertArraysEquals(r, a, b, FloatMaxVectorTests::max);
2089     }
2090 
2091     @Test(dataProvider = "floatBinaryOpProvider")

2127             av.lanewise(VectorOperators.MAX, b[i]).intoArray(r, i);
2128         }
2129 
2130         assertBroadcastArraysEquals(r, a, b, FloatMaxVectorTests::MAX);
2131     }
2132 
2133     @Test(dataProvider = "floatBinaryOpProvider")
2134     static void maxFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2135         float[] a = fa.apply(SPECIES.length());
2136         float[] b = fb.apply(SPECIES.length());
2137         float[] r = fr.apply(SPECIES.length());
2138 
2139         for (int i = 0; i < a.length; i += SPECIES.length()) {
2140             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2141             av.max(b[i]).intoArray(r, i);
2142         }
2143 
2144         assertBroadcastArraysEquals(r, a, b, FloatMaxVectorTests::max);
2145     }
2146 











2147     static float ADDReduce(float[] a, int idx) {
2148         float res = 0;
2149         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2150             res += a[i];
2151         }
2152 
2153         return res;
2154     }
2155 
2156     static float ADDReduceAll(float[] a) {
2157         float res = 0;
2158         for (int i = 0; i < a.length; i += SPECIES.length()) {
2159             res += ADDReduce(a, i);
2160         }
2161 
2162         return res;
2163     }
2164 
2165     @Test(dataProvider = "floatUnaryOpProvider")
2166     static void ADDReduceFloatMaxVectorTests(IntFunction<float[]> fa) {
2167         float[] a = fa.apply(SPECIES.length());
2168         float[] r = fr.apply(SPECIES.length());
2169         float ra = 0;
2170 
2171         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2172             for (int i = 0; i < a.length; i += SPECIES.length()) {
2173                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2174                 r[i] = av.reduceLanes(VectorOperators.ADD);
2175             }
2176         }
2177 
2178         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2179             ra = 0;
2180             for (int i = 0; i < a.length; i += SPECIES.length()) {
2181                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2182                 ra += av.reduceLanes(VectorOperators.ADD);
2183             }
2184         }
2185 
2186         assertReductionArraysEquals(r, ra, a,
2187                 FloatMaxVectorTests::ADDReduce, FloatMaxVectorTests::ADDReduceAll);
2188     }
2189 
2190     static float ADDReduceMasked(float[] a, int idx, boolean[] mask) {
2191         float res = 0;
2192         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2193             if (mask[i % SPECIES.length()])
2194                 res += a[i];
2195         }
2196 
2197         return res;
2198     }
2199 
2200     static float ADDReduceAllMasked(float[] a, boolean[] mask) {
2201         float res = 0;
2202         for (int i = 0; i < a.length; i += SPECIES.length()) {
2203             res += ADDReduceMasked(a, i, mask);
2204         }
2205 
2206         return res;
2207     }
2208 
2209     @Test(dataProvider = "floatUnaryOpMaskProvider")
2210     static void ADDReduceFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2211         float[] a = fa.apply(SPECIES.length());
2212         float[] r = fr.apply(SPECIES.length());
2213         boolean[] mask = fm.apply(SPECIES.length());
2214         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2215         float ra = 0;
2216 
2217         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2218             for (int i = 0; i < a.length; i += SPECIES.length()) {
2219                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2220                 r[i] = av.reduceLanes(VectorOperators.ADD, vmask);
2221             }
2222         }
2223 
2224         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2225             ra = 0;
2226             for (int i = 0; i < a.length; i += SPECIES.length()) {
2227                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2228                 ra += av.reduceLanes(VectorOperators.ADD, vmask);
2229             }
2230         }
2231 
2232         assertReductionArraysEqualsMasked(r, ra, a, mask,
2233                 FloatMaxVectorTests::ADDReduceMasked, FloatMaxVectorTests::ADDReduceAllMasked);
2234     }
2235 
2236     static float MULReduce(float[] a, int idx) {
2237         float res = 1;
2238         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2239             res *= a[i];
2240         }
2241 
2242         return res;
2243     }
2244 
2245     static float MULReduceAll(float[] a) {
2246         float res = 1;
2247         for (int i = 0; i < a.length; i += SPECIES.length()) {
2248             res *= MULReduce(a, i);
2249         }
2250 
2251         return res;
2252     }
2253 
2254     @Test(dataProvider = "floatUnaryOpProvider")
2255     static void MULReduceFloatMaxVectorTests(IntFunction<float[]> fa) {
2256         float[] a = fa.apply(SPECIES.length());
2257         float[] r = fr.apply(SPECIES.length());
2258         float ra = 1;
2259 
2260         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2261             for (int i = 0; i < a.length; i += SPECIES.length()) {
2262                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2263                 r[i] = av.reduceLanes(VectorOperators.MUL);
2264             }
2265         }
2266 
2267         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2268             ra = 1;
2269             for (int i = 0; i < a.length; i += SPECIES.length()) {
2270                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2271                 ra *= av.reduceLanes(VectorOperators.MUL);
2272             }
2273         }
2274 
2275         assertReductionArraysEquals(r, ra, a,
2276                 FloatMaxVectorTests::MULReduce, FloatMaxVectorTests::MULReduceAll);
2277     }
2278 
2279     static float MULReduceMasked(float[] a, int idx, boolean[] mask) {
2280         float res = 1;
2281         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2282             if (mask[i % SPECIES.length()])
2283                 res *= a[i];
2284         }
2285 
2286         return res;
2287     }
2288 
2289     static float MULReduceAllMasked(float[] a, boolean[] mask) {
2290         float res = 1;
2291         for (int i = 0; i < a.length; i += SPECIES.length()) {
2292             res *= MULReduceMasked(a, i, mask);
2293         }
2294 
2295         return res;
2296     }
2297 
2298     @Test(dataProvider = "floatUnaryOpMaskProvider")
2299     static void MULReduceFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2300         float[] a = fa.apply(SPECIES.length());
2301         float[] r = fr.apply(SPECIES.length());
2302         boolean[] mask = fm.apply(SPECIES.length());
2303         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2304         float ra = 1;
2305 
2306         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2307             for (int i = 0; i < a.length; i += SPECIES.length()) {
2308                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2309                 r[i] = av.reduceLanes(VectorOperators.MUL, vmask);
2310             }
2311         }
2312 
2313         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2314             ra = 1;
2315             for (int i = 0; i < a.length; i += SPECIES.length()) {
2316                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2317                 ra *= av.reduceLanes(VectorOperators.MUL, vmask);
2318             }
2319         }
2320 
2321         assertReductionArraysEqualsMasked(r, ra, a, mask,
2322                 FloatMaxVectorTests::MULReduceMasked, FloatMaxVectorTests::MULReduceAllMasked);
2323     }
2324 
2325     static float MINReduce(float[] a, int idx) {
2326         float res = Float.POSITIVE_INFINITY;
2327         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2328             res = (float) Math.min(res, a[i]);
2329         }
2330 
2331         return res;
2332     }
2333 
2334     static float MINReduceAll(float[] a) {
2335         float res = Float.POSITIVE_INFINITY;
2336         for (int i = 0; i < a.length; i += SPECIES.length()) {
2337             res = (float) Math.min(res, MINReduce(a, i));
2338         }
2339 
2340         return res;
2341     }
2342 
2343     @Test(dataProvider = "floatUnaryOpProvider")
2344     static void MINReduceFloatMaxVectorTests(IntFunction<float[]> fa) {
2345         float[] a = fa.apply(SPECIES.length());
2346         float[] r = fr.apply(SPECIES.length());
2347         float ra = Float.POSITIVE_INFINITY;
2348 
2349         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2350             for (int i = 0; i < a.length; i += SPECIES.length()) {
2351                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2352                 r[i] = av.reduceLanes(VectorOperators.MIN);
2353             }
2354         }
2355 
2356         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2357             ra = Float.POSITIVE_INFINITY;
2358             for (int i = 0; i < a.length; i += SPECIES.length()) {
2359                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2360                 ra = (float) Math.min(ra, av.reduceLanes(VectorOperators.MIN));
2361             }
2362         }
2363 
2364         assertReductionArraysEquals(r, ra, a,
2365                 FloatMaxVectorTests::MINReduce, FloatMaxVectorTests::MINReduceAll);
2366     }
2367 
2368     static float MINReduceMasked(float[] a, int idx, boolean[] mask) {
2369         float res = Float.POSITIVE_INFINITY;
2370         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2371             if (mask[i % SPECIES.length()])
2372                 res = (float) Math.min(res, a[i]);
2373         }
2374 
2375         return res;
2376     }
2377 
2378     static float MINReduceAllMasked(float[] a, boolean[] mask) {
2379         float res = Float.POSITIVE_INFINITY;
2380         for (int i = 0; i < a.length; i += SPECIES.length()) {
2381             res = (float) Math.min(res, MINReduceMasked(a, i, mask));
2382         }
2383 
2384         return res;
2385     }
2386 
2387     @Test(dataProvider = "floatUnaryOpMaskProvider")
2388     static void MINReduceFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2389         float[] a = fa.apply(SPECIES.length());
2390         float[] r = fr.apply(SPECIES.length());
2391         boolean[] mask = fm.apply(SPECIES.length());
2392         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2393         float ra = Float.POSITIVE_INFINITY;
2394 
2395         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2396             for (int i = 0; i < a.length; i += SPECIES.length()) {
2397                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2398                 r[i] = av.reduceLanes(VectorOperators.MIN, vmask);
2399             }
2400         }
2401 
2402         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2403             ra = Float.POSITIVE_INFINITY;
2404             for (int i = 0; i < a.length; i += SPECIES.length()) {
2405                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2406                 ra = (float) Math.min(ra, av.reduceLanes(VectorOperators.MIN, vmask));
2407             }
2408         }
2409 
2410         assertReductionArraysEqualsMasked(r, ra, a, mask,
2411                 FloatMaxVectorTests::MINReduceMasked, FloatMaxVectorTests::MINReduceAllMasked);
2412     }
2413 
2414     static float MAXReduce(float[] a, int idx) {
2415         float res = Float.NEGATIVE_INFINITY;
2416         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2417             res = (float) Math.max(res, a[i]);
2418         }
2419 
2420         return res;
2421     }
2422 
2423     static float MAXReduceAll(float[] a) {
2424         float res = Float.NEGATIVE_INFINITY;
2425         for (int i = 0; i < a.length; i += SPECIES.length()) {
2426             res = (float) Math.max(res, MAXReduce(a, i));
2427         }
2428 
2429         return res;
2430     }
2431 
2432     @Test(dataProvider = "floatUnaryOpProvider")
2433     static void MAXReduceFloatMaxVectorTests(IntFunction<float[]> fa) {
2434         float[] a = fa.apply(SPECIES.length());
2435         float[] r = fr.apply(SPECIES.length());
2436         float ra = Float.NEGATIVE_INFINITY;
2437 
2438         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2439             for (int i = 0; i < a.length; i += SPECIES.length()) {
2440                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2441                 r[i] = av.reduceLanes(VectorOperators.MAX);
2442             }
2443         }
2444 
2445         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2446             ra = Float.NEGATIVE_INFINITY;
2447             for (int i = 0; i < a.length; i += SPECIES.length()) {
2448                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2449                 ra = (float) Math.max(ra, av.reduceLanes(VectorOperators.MAX));
2450             }
2451         }
2452 
2453         assertReductionArraysEquals(r, ra, a,
2454                 FloatMaxVectorTests::MAXReduce, FloatMaxVectorTests::MAXReduceAll);
2455     }
2456 
2457     static float MAXReduceMasked(float[] a, int idx, boolean[] mask) {
2458         float res = Float.NEGATIVE_INFINITY;
2459         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2460             if (mask[i % SPECIES.length()])
2461                 res = (float) Math.max(res, a[i]);
2462         }
2463 
2464         return res;
2465     }
2466 
2467     static float MAXReduceAllMasked(float[] a, boolean[] mask) {
2468         float res = Float.NEGATIVE_INFINITY;
2469         for (int i = 0; i < a.length; i += SPECIES.length()) {
2470             res = (float) Math.max(res, MAXReduceMasked(a, i, mask));
2471         }
2472 
2473         return res;
2474     }
2475 
2476     @Test(dataProvider = "floatUnaryOpMaskProvider")
2477     static void MAXReduceFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2478         float[] a = fa.apply(SPECIES.length());
2479         float[] r = fr.apply(SPECIES.length());
2480         boolean[] mask = fm.apply(SPECIES.length());
2481         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2482         float ra = Float.NEGATIVE_INFINITY;
2483 
2484         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2485             for (int i = 0; i < a.length; i += SPECIES.length()) {
2486                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2487                 r[i] = av.reduceLanes(VectorOperators.MAX, vmask);
2488             }
2489         }
2490 
2491         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2492             ra = Float.NEGATIVE_INFINITY;
2493             for (int i = 0; i < a.length; i += SPECIES.length()) {
2494                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2495                 ra = (float) Math.max(ra, av.reduceLanes(VectorOperators.MAX, vmask));
2496             }
2497         }
2498 
2499         assertReductionArraysEqualsMasked(r, ra, a, mask,
2500                 FloatMaxVectorTests::MAXReduceMasked, FloatMaxVectorTests::MAXReduceAllMasked);
2501     }
2502 
2503     static float FIRST_NONZEROReduce(float[] a, int idx) {
2504         float res = (float) 0;
2505         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2506             res = firstNonZero(res, a[i]);
2507         }
2508 
2509         return res;
2510     }
2511 
2512     static float FIRST_NONZEROReduceAll(float[] a) {
2513         float res = (float) 0;
2514         for (int i = 0; i < a.length; i += SPECIES.length()) {
2515             res = firstNonZero(res, FIRST_NONZEROReduce(a, i));
2516         }
2517 
2518         return res;
2519     }
2520 
2521     @Test(dataProvider = "floatUnaryOpProvider")
2522     static void FIRST_NONZEROReduceFloatMaxVectorTests(IntFunction<float[]> fa) {
2523         float[] a = fa.apply(SPECIES.length());
2524         float[] r = fr.apply(SPECIES.length());
2525         float ra = (float) 0;
2526 
2527         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2528             for (int i = 0; i < a.length; i += SPECIES.length()) {
2529                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2530                 r[i] = av.reduceLanes(VectorOperators.FIRST_NONZERO);
2531             }
2532         }
2533 
2534         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2535             ra = (float) 0;
2536             for (int i = 0; i < a.length; i += SPECIES.length()) {
2537                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2538                 ra = firstNonZero(ra, av.reduceLanes(VectorOperators.FIRST_NONZERO));
2539             }
2540         }
2541 
2542         assertReductionArraysEquals(r, ra, a,
2543                 FloatMaxVectorTests::FIRST_NONZEROReduce, FloatMaxVectorTests::FIRST_NONZEROReduceAll);
2544     }
2545 
2546     static float FIRST_NONZEROReduceMasked(float[] a, int idx, boolean[] mask) {
2547         float res = (float) 0;
2548         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2549             if (mask[i % SPECIES.length()])
2550                 res = firstNonZero(res, a[i]);
2551         }
2552 
2553         return res;
2554     }
2555 
2556     static float FIRST_NONZEROReduceAllMasked(float[] a, boolean[] mask) {
2557         float res = (float) 0;
2558         for (int i = 0; i < a.length; i += SPECIES.length()) {
2559             res = firstNonZero(res, FIRST_NONZEROReduceMasked(a, i, mask));
2560         }
2561 
2562         return res;
2563     }
2564 
2565     @Test(dataProvider = "floatUnaryOpMaskProvider")
2566     static void FIRST_NONZEROReduceFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2567         float[] a = fa.apply(SPECIES.length());
2568         float[] r = fr.apply(SPECIES.length());
2569         boolean[] mask = fm.apply(SPECIES.length());
2570         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2571         float ra = (float) 0;
2572 
2573         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2574             for (int i = 0; i < a.length; i += SPECIES.length()) {
2575                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2576                 r[i] = av.reduceLanes(VectorOperators.FIRST_NONZERO, vmask);
2577             }
2578         }
2579 
2580         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2581             ra = (float) 0;
2582             for (int i = 0; i < a.length; i += SPECIES.length()) {
2583                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2584                 ra = firstNonZero(ra, av.reduceLanes(VectorOperators.FIRST_NONZERO, vmask));
2585             }
2586         }
2587 
2588         assertReductionArraysEqualsMasked(r, ra, a, mask,
2589                 FloatMaxVectorTests::FIRST_NONZEROReduceMasked, FloatMaxVectorTests::FIRST_NONZEROReduceAllMasked);
2590     }
2591 




2592     @Test(dataProvider = "floatUnaryOpProvider")
2593     static void withFloatMaxVectorTests(IntFunction<float []> fa) {
2594         float[] a = fa.apply(SPECIES.length());
2595         float[] r = fr.apply(SPECIES.length());
2596 
2597         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2598             for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
2599                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2600                 av.withLane((j++ & (SPECIES.length()-1)), (float)(65535+i)).intoArray(r, i);
2601             }
2602         }
2603 
2604 
2605         for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
2606             assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
2607         }
2608     }
2609 
2610     static boolean testIS_DEFAULT(float a) {
2611         return bits(a)==0;
2612     }
2613 
2614     @Test(dataProvider = "floatTestOpProvider")
2615     static void IS_DEFAULTFloatMaxVectorTests(IntFunction<float[]> fa) {
2616         float[] a = fa.apply(SPECIES.length());
2617 
2618         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2619             for (int i = 0; i < a.length; i += SPECIES.length()) {
2620                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2621                 VectorMask<Float> mv = av.test(VectorOperators.IS_DEFAULT);
2622 
2623                 // Check results as part of computation.
2624                 for (int j = 0; j < SPECIES.length(); j++) {
2625                     Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j]));
2626                 }
2627             }
2628         }
2629     }
2630 
2631     @Test(dataProvider = "floatTestOpMaskProvider")
2632     static void IS_DEFAULTMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
2633                                           IntFunction<boolean[]> fm) {
2634         float[] a = fa.apply(SPECIES.length());
2635         boolean[] mask = fm.apply(SPECIES.length());
2636         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2637 
2638         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2639             for (int i = 0; i < a.length; i += SPECIES.length()) {
2640                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2641                 VectorMask<Float> mv = av.test(VectorOperators.IS_DEFAULT, vmask);
2642 
2643                 // Check results as part of computation.
2644                 for (int j = 0; j < SPECIES.length(); j++) {
2645                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j]));
2646                 }
2647             }
2648         }
2649     }
2650 
2651     static boolean testIS_NEGATIVE(float a) {
2652         return bits(a)<0;
2653     }
2654 
2655     @Test(dataProvider = "floatTestOpProvider")
2656     static void IS_NEGATIVEFloatMaxVectorTests(IntFunction<float[]> fa) {
2657         float[] a = fa.apply(SPECIES.length());
2658 
2659         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2660             for (int i = 0; i < a.length; i += SPECIES.length()) {
2661                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2662                 VectorMask<Float> mv = av.test(VectorOperators.IS_NEGATIVE);
2663 
2664                 // Check results as part of computation.
2665                 for (int j = 0; j < SPECIES.length(); j++) {
2666                     Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j]));
2667                 }
2668             }
2669         }
2670     }

2713     @Test(dataProvider = "floatTestOpMaskProvider")
2714     static void IS_FINITEMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
2715                                           IntFunction<boolean[]> fm) {
2716         float[] a = fa.apply(SPECIES.length());
2717         boolean[] mask = fm.apply(SPECIES.length());
2718         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2719 
2720         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2721             for (int i = 0; i < a.length; i += SPECIES.length()) {
2722                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2723                 VectorMask<Float> mv = av.test(VectorOperators.IS_FINITE, vmask);
2724 
2725                 // Check results as part of computation.
2726                 for (int j = 0; j < SPECIES.length(); j++) {
2727                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_FINITE(a[i + j]));
2728                 }
2729             }
2730         }
2731     }
2732 

2733     static boolean testIS_NAN(float a) {
2734         return Float.isNaN(a);
2735     }
2736 
2737     @Test(dataProvider = "floatTestOpProvider")
2738     static void IS_NANFloatMaxVectorTests(IntFunction<float[]> fa) {
2739         float[] a = fa.apply(SPECIES.length());
2740 
2741         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2742             for (int i = 0; i < a.length; i += SPECIES.length()) {
2743                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2744                 VectorMask<Float> mv = av.test(VectorOperators.IS_NAN);
2745 
2746                 // Check results as part of computation.
2747                 for (int j = 0; j < SPECIES.length(); j++) {
2748                     Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j]));
2749                 }
2750             }
2751         }
2752     }

2754     @Test(dataProvider = "floatTestOpMaskProvider")
2755     static void IS_NANMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
2756                                           IntFunction<boolean[]> fm) {
2757         float[] a = fa.apply(SPECIES.length());
2758         boolean[] mask = fm.apply(SPECIES.length());
2759         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2760 
2761         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2762             for (int i = 0; i < a.length; i += SPECIES.length()) {
2763                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2764                 VectorMask<Float> mv = av.test(VectorOperators.IS_NAN, vmask);
2765 
2766                 // Check results as part of computation.
2767                 for (int j = 0; j < SPECIES.length(); j++) {
2768                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_NAN(a[i + j]));
2769                 }
2770             }
2771         }
2772     }
2773 

2774     static boolean testIS_INFINITE(float a) {
2775         return Float.isInfinite(a);
2776     }
2777 
2778     @Test(dataProvider = "floatTestOpProvider")
2779     static void IS_INFINITEFloatMaxVectorTests(IntFunction<float[]> fa) {
2780         float[] a = fa.apply(SPECIES.length());
2781 
2782         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2783             for (int i = 0; i < a.length; i += SPECIES.length()) {
2784                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2785                 VectorMask<Float> mv = av.test(VectorOperators.IS_INFINITE);
2786 
2787                 // Check results as part of computation.
2788                 for (int j = 0; j < SPECIES.length(); j++) {
2789                     Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j]));
2790                 }
2791             }
2792         }
2793     }

2795     @Test(dataProvider = "floatTestOpMaskProvider")
2796     static void IS_INFINITEMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
2797                                           IntFunction<boolean[]> fm) {
2798         float[] a = fa.apply(SPECIES.length());
2799         boolean[] mask = fm.apply(SPECIES.length());
2800         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2801 
2802         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2803             for (int i = 0; i < a.length; i += SPECIES.length()) {
2804                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2805                 VectorMask<Float> mv = av.test(VectorOperators.IS_INFINITE, vmask);
2806 
2807                 // Check results as part of computation.
2808                 for (int j = 0; j < SPECIES.length(); j++) {
2809                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_INFINITE(a[i + j]));
2810                 }
2811             }
2812         }
2813     }
2814 

2815     @Test(dataProvider = "floatCompareOpProvider")
2816     static void LTFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2817         float[] a = fa.apply(SPECIES.length());
2818         float[] b = fb.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                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2823                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2824                 VectorMask<Float> mv = av.compare(VectorOperators.LT, bv);
2825 
2826                 // Check results as part of computation.
2827                 for (int j = 0; j < SPECIES.length(); j++) {
2828                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
2829                 }
2830             }
2831         }
2832     }
2833 

2834     @Test(dataProvider = "floatCompareOpProvider")
2835     static void ltFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2836         float[] a = fa.apply(SPECIES.length());
2837         float[] b = fb.apply(SPECIES.length());
2838 
2839         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2840             for (int i = 0; i < a.length; i += SPECIES.length()) {
2841                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2842                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2843                 VectorMask<Float> mv = av.lt(bv);
2844 
2845                 // Check results as part of computation.
2846                 for (int j = 0; j < SPECIES.length(); j++) {
2847                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
2848                 }
2849             }
2850         }
2851     }
2852 
2853     @Test(dataProvider = "floatCompareOpMaskProvider")

2856         float[] a = fa.apply(SPECIES.length());
2857         float[] b = fb.apply(SPECIES.length());
2858         boolean[] mask = fm.apply(SPECIES.length());
2859 
2860         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2861 
2862         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2863             for (int i = 0; i < a.length; i += SPECIES.length()) {
2864                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2865                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2866                 VectorMask<Float> mv = av.compare(VectorOperators.LT, bv, vmask);
2867 
2868                 // Check results as part of computation.
2869                 for (int j = 0; j < SPECIES.length(); j++) {
2870                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j]));
2871                 }
2872             }
2873         }
2874     }
2875 

2876     @Test(dataProvider = "floatCompareOpProvider")
2877     static void GTFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2878         float[] a = fa.apply(SPECIES.length());
2879         float[] b = fb.apply(SPECIES.length());
2880 
2881         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2882             for (int i = 0; i < a.length; i += SPECIES.length()) {
2883                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2884                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2885                 VectorMask<Float> mv = av.compare(VectorOperators.GT, bv);
2886 
2887                 // Check results as part of computation.
2888                 for (int j = 0; j < SPECIES.length(); j++) {
2889                     Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j]));
2890                 }
2891             }
2892         }
2893     }
2894 
2895     @Test(dataProvider = "floatCompareOpMaskProvider")

2898         float[] a = fa.apply(SPECIES.length());
2899         float[] b = fb.apply(SPECIES.length());
2900         boolean[] mask = fm.apply(SPECIES.length());
2901 
2902         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2903 
2904         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2905             for (int i = 0; i < a.length; i += SPECIES.length()) {
2906                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2907                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2908                 VectorMask<Float> mv = av.compare(VectorOperators.GT, bv, vmask);
2909 
2910                 // Check results as part of computation.
2911                 for (int j = 0; j < SPECIES.length(); j++) {
2912                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j]));
2913                 }
2914             }
2915         }
2916     }
2917 

2918     @Test(dataProvider = "floatCompareOpProvider")
2919     static void EQFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2920         float[] a = fa.apply(SPECIES.length());
2921         float[] b = fb.apply(SPECIES.length());
2922 
2923         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2924             for (int i = 0; i < a.length; i += SPECIES.length()) {
2925                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2926                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2927                 VectorMask<Float> mv = av.compare(VectorOperators.EQ, bv);
2928 
2929                 // Check results as part of computation.
2930                 for (int j = 0; j < SPECIES.length(); j++) {
2931                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
2932                 }
2933             }
2934         }
2935     }
2936 

2937     @Test(dataProvider = "floatCompareOpProvider")
2938     static void eqFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2939         float[] a = fa.apply(SPECIES.length());
2940         float[] b = fb.apply(SPECIES.length());
2941 
2942         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2943             for (int i = 0; i < a.length; i += SPECIES.length()) {
2944                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2945                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2946                 VectorMask<Float> mv = av.eq(bv);
2947 
2948                 // Check results as part of computation.
2949                 for (int j = 0; j < SPECIES.length(); j++) {
2950                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
2951                 }
2952             }
2953         }
2954     }
2955 
2956     @Test(dataProvider = "floatCompareOpMaskProvider")

2959         float[] a = fa.apply(SPECIES.length());
2960         float[] b = fb.apply(SPECIES.length());
2961         boolean[] mask = fm.apply(SPECIES.length());
2962 
2963         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2964 
2965         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2966             for (int i = 0; i < a.length; i += SPECIES.length()) {
2967                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2968                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2969                 VectorMask<Float> mv = av.compare(VectorOperators.EQ, bv, vmask);
2970 
2971                 // Check results as part of computation.
2972                 for (int j = 0; j < SPECIES.length(); j++) {
2973                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j]));
2974                 }
2975             }
2976         }
2977     }
2978 

2979     @Test(dataProvider = "floatCompareOpProvider")
2980     static void NEFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2981         float[] a = fa.apply(SPECIES.length());
2982         float[] b = fb.apply(SPECIES.length());
2983 
2984         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2985             for (int i = 0; i < a.length; i += SPECIES.length()) {
2986                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2987                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2988                 VectorMask<Float> mv = av.compare(VectorOperators.NE, bv);
2989 
2990                 // Check results as part of computation.
2991                 for (int j = 0; j < SPECIES.length(); j++) {
2992                     Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j]));
2993                 }
2994             }
2995         }
2996     }
2997 
2998     @Test(dataProvider = "floatCompareOpMaskProvider")

3001         float[] a = fa.apply(SPECIES.length());
3002         float[] b = fb.apply(SPECIES.length());
3003         boolean[] mask = fm.apply(SPECIES.length());
3004 
3005         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3006 
3007         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3008             for (int i = 0; i < a.length; i += SPECIES.length()) {
3009                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3010                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3011                 VectorMask<Float> mv = av.compare(VectorOperators.NE, bv, vmask);
3012 
3013                 // Check results as part of computation.
3014                 for (int j = 0; j < SPECIES.length(); j++) {
3015                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j]));
3016                 }
3017             }
3018         }
3019     }
3020 

3021     @Test(dataProvider = "floatCompareOpProvider")
3022     static void LEFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3023         float[] a = fa.apply(SPECIES.length());
3024         float[] b = fb.apply(SPECIES.length());
3025 
3026         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3027             for (int i = 0; i < a.length; i += SPECIES.length()) {
3028                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3029                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3030                 VectorMask<Float> mv = av.compare(VectorOperators.LE, bv);
3031 
3032                 // Check results as part of computation.
3033                 for (int j = 0; j < SPECIES.length(); j++) {
3034                     Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j]));
3035                 }
3036             }
3037         }
3038     }
3039 
3040     @Test(dataProvider = "floatCompareOpMaskProvider")

3043         float[] a = fa.apply(SPECIES.length());
3044         float[] b = fb.apply(SPECIES.length());
3045         boolean[] mask = fm.apply(SPECIES.length());
3046 
3047         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3048 
3049         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3050             for (int i = 0; i < a.length; i += SPECIES.length()) {
3051                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3052                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3053                 VectorMask<Float> mv = av.compare(VectorOperators.LE, bv, vmask);
3054 
3055                 // Check results as part of computation.
3056                 for (int j = 0; j < SPECIES.length(); j++) {
3057                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j]));
3058                 }
3059             }
3060         }
3061     }
3062 

3063     @Test(dataProvider = "floatCompareOpProvider")
3064     static void GEFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3065         float[] a = fa.apply(SPECIES.length());
3066         float[] b = fb.apply(SPECIES.length());
3067 
3068         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3069             for (int i = 0; i < a.length; i += SPECIES.length()) {
3070                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3071                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3072                 VectorMask<Float> mv = av.compare(VectorOperators.GE, bv);
3073 
3074                 // Check results as part of computation.
3075                 for (int j = 0; j < SPECIES.length(); j++) {
3076                     Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j]));
3077                 }
3078             }
3079         }
3080     }
3081 
3082     @Test(dataProvider = "floatCompareOpMaskProvider")

3085         float[] a = fa.apply(SPECIES.length());
3086         float[] b = fb.apply(SPECIES.length());
3087         boolean[] mask = fm.apply(SPECIES.length());
3088 
3089         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3090 
3091         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3092             for (int i = 0; i < a.length; i += SPECIES.length()) {
3093                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3094                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3095                 VectorMask<Float> mv = av.compare(VectorOperators.GE, bv, vmask);
3096 
3097                 // Check results as part of computation.
3098                 for (int j = 0; j < SPECIES.length(); j++) {
3099                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j]));
3100                 }
3101             }
3102         }
3103     }
3104 









3105     @Test(dataProvider = "floatCompareOpProvider")
3106     static void LTFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3107         float[] a = fa.apply(SPECIES.length());
3108         float[] b = fb.apply(SPECIES.length());
3109 
3110         for (int i = 0; i < a.length; i += SPECIES.length()) {
3111             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3112             VectorMask<Float> mv = av.compare(VectorOperators.LT, b[i]);
3113 
3114             // Check results as part of computation.
3115             for (int j = 0; j < SPECIES.length(); j++) {
3116                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
3117             }
3118         }
3119     }
3120 

3121     @Test(dataProvider = "floatCompareOpMaskProvider")
3122     static void LTFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa,
3123                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3124         float[] a = fa.apply(SPECIES.length());
3125         float[] b = fb.apply(SPECIES.length());
3126         boolean[] mask = fm.apply(SPECIES.length());
3127 
3128         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3129 
3130         for (int i = 0; i < a.length; i += SPECIES.length()) {
3131             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3132             VectorMask<Float> mv = av.compare(VectorOperators.LT, b[i], vmask);
3133 
3134             // Check results as part of computation.
3135             for (int j = 0; j < SPECIES.length(); j++) {
3136                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i]));
3137             }
3138         }
3139     }
3140 
3141     @Test(dataProvider = "floatCompareOpProvider")
3142     static void LTFloatMaxVectorTestsBroadcastLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3143         float[] a = fa.apply(SPECIES.length());
3144         float[] b = fb.apply(SPECIES.length());
3145 
3146         for (int i = 0; i < a.length; i += SPECIES.length()) {
3147             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3148             VectorMask<Float> mv = av.compare(VectorOperators.LT, (long)b[i]);
3149 
3150             // Check results as part of computation.
3151             for (int j = 0; j < SPECIES.length(); j++) {
3152                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i]));
3153             }
3154         }
3155     }
3156 

3157     @Test(dataProvider = "floatCompareOpMaskProvider")
3158     static void LTFloatMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction<float[]> fa,
3159                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3160         float[] a = fa.apply(SPECIES.length());
3161         float[] b = fb.apply(SPECIES.length());
3162         boolean[] mask = fm.apply(SPECIES.length());
3163 
3164         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3165 
3166         for (int i = 0; i < a.length; i += SPECIES.length()) {
3167             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3168             VectorMask<Float> mv = av.compare(VectorOperators.LT, (long)b[i], vmask);
3169 
3170             // Check results as part of computation.
3171             for (int j = 0; j < SPECIES.length(); j++) {
3172                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i])));
3173             }
3174         }
3175     }
3176 
3177     @Test(dataProvider = "floatCompareOpProvider")
3178     static void EQFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3179         float[] a = fa.apply(SPECIES.length());
3180         float[] b = fb.apply(SPECIES.length());
3181 
3182         for (int i = 0; i < a.length; i += SPECIES.length()) {
3183             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3184             VectorMask<Float> mv = av.compare(VectorOperators.EQ, b[i]);
3185 
3186             // Check results as part of computation.
3187             for (int j = 0; j < SPECIES.length(); j++) {
3188                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
3189             }
3190         }
3191     }
3192 

3193     @Test(dataProvider = "floatCompareOpMaskProvider")
3194     static void EQFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa,
3195                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3196         float[] a = fa.apply(SPECIES.length());
3197         float[] b = fb.apply(SPECIES.length());
3198         boolean[] mask = fm.apply(SPECIES.length());
3199 
3200         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3201 
3202         for (int i = 0; i < a.length; i += SPECIES.length()) {
3203             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3204             VectorMask<Float> mv = av.compare(VectorOperators.EQ, b[i], vmask);
3205 
3206             // Check results as part of computation.
3207             for (int j = 0; j < SPECIES.length(); j++) {
3208                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i]));
3209             }
3210         }
3211     }
3212 
3213     @Test(dataProvider = "floatCompareOpProvider")
3214     static void EQFloatMaxVectorTestsBroadcastLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3215         float[] a = fa.apply(SPECIES.length());
3216         float[] b = fb.apply(SPECIES.length());
3217 
3218         for (int i = 0; i < a.length; i += SPECIES.length()) {
3219             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3220             VectorMask<Float> mv = av.compare(VectorOperators.EQ, (long)b[i]);
3221 
3222             // Check results as part of computation.
3223             for (int j = 0; j < SPECIES.length(); j++) {
3224                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i]));
3225             }
3226         }
3227     }
3228 

3229     @Test(dataProvider = "floatCompareOpMaskProvider")
3230     static void EQFloatMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction<float[]> fa,
3231                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3232         float[] a = fa.apply(SPECIES.length());
3233         float[] b = fb.apply(SPECIES.length());
3234         boolean[] mask = fm.apply(SPECIES.length());
3235 
3236         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3237 
3238         for (int i = 0; i < a.length; i += SPECIES.length()) {
3239             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3240             VectorMask<Float> mv = av.compare(VectorOperators.EQ, (long)b[i], vmask);
3241 
3242             // Check results as part of computation.
3243             for (int j = 0; j < SPECIES.length(); j++) {
3244                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i])));
3245             }
3246         }
3247     }
3248 

3287         assertRearrangeArraysEquals(r, a, order, SPECIES.length());
3288     }
3289 
3290     @Test(dataProvider = "floatUnaryOpShuffleMaskProvider")
3291     static void RearrangeFloatMaxVectorTestsMaskedSmokeTest(IntFunction<float[]> fa,
3292                                                           BiFunction<Integer,Integer,int[]> fs,
3293                                                           IntFunction<boolean[]> fm) {
3294         float[] a = fa.apply(SPECIES.length());
3295         int[] order = fs.apply(a.length, SPECIES.length());
3296         float[] r = fr.apply(SPECIES.length());
3297         boolean[] mask = fm.apply(SPECIES.length());
3298         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3299 
3300         for (int i = 0; i < a.length; i += SPECIES.length()) {
3301             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3302             av.rearrange(VectorShuffle.fromArray(SPECIES, order, i), vmask).intoArray(r, i);
3303         }
3304 
3305         assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
3306     }
3307 
3308     @Test(dataProvider = "floatUnaryOpMaskProvider")
3309     static void compressFloatMaxVectorTests(IntFunction<float[]> fa,
3310                                                 IntFunction<boolean[]> fm) {
3311         float[] a = fa.apply(SPECIES.length());
3312         float[] r = fr.apply(SPECIES.length());
3313         boolean[] mask = fm.apply(SPECIES.length());
3314         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3315 
3316         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3317             for (int i = 0; i < a.length; i += SPECIES.length()) {
3318                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3319                 av.compress(vmask).intoArray(r, i);
3320             }
3321         }
3322 
3323         assertcompressArraysEquals(r, a, mask, SPECIES.length());
3324     }
3325 
3326     @Test(dataProvider = "floatUnaryOpMaskProvider")
3327     static void expandFloatMaxVectorTests(IntFunction<float[]> fa,
3328                                                 IntFunction<boolean[]> fm) {
3329         float[] a = fa.apply(SPECIES.length());
3330         float[] r = fr.apply(SPECIES.length());
3331         boolean[] mask = fm.apply(SPECIES.length());
3332         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3333 
3334         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3335             for (int i = 0; i < a.length; i += SPECIES.length()) {
3336                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3337                 av.expand(vmask).intoArray(r, i);
3338             }
3339         }
3340 
3341         assertexpandArraysEquals(r, a, mask, SPECIES.length());
3342     }
3343 
3344     @Test(dataProvider = "floatUnaryOpProvider")
3345     static void getFloatMaxVectorTests(IntFunction<float[]> fa) {
3346         float[] a = fa.apply(SPECIES.length());
3347         float[] r = fr.apply(SPECIES.length());
3348 
3349         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3350             for (int i = 0; i < a.length; i += SPECIES.length()) {
3351                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3352                 int num_lanes = SPECIES.length();
3353                 // Manually unroll because full unroll happens after intrinsification.
3354                 // Unroll is needed because get intrinsic requires for index to be a known constant.
3355                 if (num_lanes == 1) {
3356                     r[i]=av.lane(0);
3357                 } else if (num_lanes == 2) {
3358                     r[i]=av.lane(0);
3359                     r[i+1]=av.lane(1);
3360                 } else if (num_lanes == 4) {
3361                     r[i]=av.lane(0);
3362                     r[i+1]=av.lane(1);
3363                     r[i+2]=av.lane(2);

3494             }
3495         }
3496 
3497         assertArraysEquals(r, a, FloatMaxVectorTests::get);
3498     }
3499 
3500     @Test(dataProvider = "floatUnaryOpProvider")
3501     static void BroadcastFloatMaxVectorTests(IntFunction<float[]> fa) {
3502         float[] a = fa.apply(SPECIES.length());
3503         float[] r = new float[a.length];
3504 
3505         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3506             for (int i = 0; i < a.length; i += SPECIES.length()) {
3507                 FloatVector.broadcast(SPECIES, a[i]).intoArray(r, i);
3508             }
3509         }
3510 
3511         assertBroadcastArraysEquals(r, a);
3512     }
3513 




3514     @Test(dataProvider = "floatUnaryOpProvider")
3515     static void ZeroFloatMaxVectorTests(IntFunction<float[]> fa) {
3516         float[] a = fa.apply(SPECIES.length());
3517         float[] r = new float[a.length];
3518 
3519         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3520             for (int i = 0; i < a.length; i += SPECIES.length()) {
3521                 FloatVector.zero(SPECIES).intoArray(a, i);
3522             }
3523         }
3524 
3525         Assert.assertEquals(a, r);
3526     }
3527 



3528     static float[] sliceUnary(float[] a, int origin, int idx) {
3529         float[] res = new float[SPECIES.length()];
3530         for (int i = 0; i < SPECIES.length(); i++){
3531             if(i+origin < SPECIES.length())
3532                 res[i] = a[idx+i+origin];
3533             else
3534                 res[i] = (float)0;
3535         }
3536         return res;
3537     }
3538 
3539     @Test(dataProvider = "floatUnaryOpProvider")
3540     static void sliceUnaryFloatMaxVectorTests(IntFunction<float[]> fa) {
3541         float[] a = fa.apply(SPECIES.length());
3542         float[] r = new float[a.length];
3543         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3544         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3545             for (int i = 0; i < a.length; i += SPECIES.length()) {
3546                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3547                 av.slice(origin).intoArray(r, i);
3548             }
3549         }
3550 
3551         assertArraysEquals(r, a, origin, FloatMaxVectorTests::sliceUnary);
3552     }
3553 
3554     static float[] sliceBinary(float[] a, float[] b, int origin, int idx) {
3555         float[] res = new float[SPECIES.length()];
3556         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3557             if(i+origin < SPECIES.length())
3558                 res[i] = a[idx+i+origin];
3559             else {
3560                 res[i] = b[idx+j];
3561                 j++;
3562             }
3563         }
3564         return res;
3565     }
3566 
3567     @Test(dataProvider = "floatBinaryOpProvider")
3568     static void sliceBinaryFloatMaxVectorTestsBinary(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3569         float[] a = fa.apply(SPECIES.length());
3570         float[] b = fb.apply(SPECIES.length());
3571         float[] r = new float[a.length];
3572         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3573         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3574             for (int i = 0; i < a.length; i += SPECIES.length()) {
3575                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3576                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3577                 av.slice(origin, bv).intoArray(r, i);
3578             }
3579         }
3580 
3581         assertArraysEquals(r, a, b, origin, FloatMaxVectorTests::sliceBinary);
3582     }
3583 
3584     static float[] slice(float[] a, float[] b, int origin, boolean[] mask, int idx) {
3585         float[] res = new float[SPECIES.length()];
3586         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3587             if(i+origin < SPECIES.length())
3588                 res[i] = mask[i] ? a[idx+i+origin] : (float)0;
3589             else {
3590                 res[i] = mask[i] ? b[idx+j] : (float)0;
3591                 j++;
3592             }
3593         }
3594         return res;
3595     }
3596 
3597     @Test(dataProvider = "floatBinaryOpMaskProvider")
3598     static void sliceFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
3599     IntFunction<boolean[]> fm) {
3600         float[] a = fa.apply(SPECIES.length());
3601         float[] b = fb.apply(SPECIES.length());
3602         boolean[] mask = fm.apply(SPECIES.length());
3603         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3604 
3605         float[] r = new float[a.length];
3606         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3607         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3608             for (int i = 0; i < a.length; i += SPECIES.length()) {
3609                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3610                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3611                 av.slice(origin, bv, vmask).intoArray(r, i);
3612             }
3613         }
3614 
3615         assertArraysEquals(r, a, b, origin, mask, FloatMaxVectorTests::slice);
3616     }
3617 
3618     static float[] unsliceUnary(float[] a, int origin, int idx) {
3619         float[] res = new float[SPECIES.length()];
3620         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3621             if(i < origin)
3622                 res[i] = (float)0;
3623             else {
3624                 res[i] = a[idx+j];
3625                 j++;
3626             }
3627         }
3628         return res;
3629     }
3630 
3631     @Test(dataProvider = "floatUnaryOpProvider")
3632     static void unsliceUnaryFloatMaxVectorTests(IntFunction<float[]> fa) {
3633         float[] a = fa.apply(SPECIES.length());
3634         float[] r = new float[a.length];
3635         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3636         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3637             for (int i = 0; i < a.length; i += SPECIES.length()) {
3638                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3639                 av.unslice(origin).intoArray(r, i);
3640             }
3641         }
3642 
3643         assertArraysEquals(r, a, origin, FloatMaxVectorTests::unsliceUnary);
3644     }
3645 
3646     static float[] unsliceBinary(float[] a, float[] b, int origin, int part, int idx) {
3647         float[] res = new float[SPECIES.length()];
3648         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3649             if (part == 0) {
3650                 if (i < origin)
3651                     res[i] = b[idx+i];
3652                 else {
3653                     res[i] = a[idx+j];
3654                     j++;
3655                 }
3656             } else if (part == 1) {
3657                 if (i < origin)
3658                     res[i] = a[idx+SPECIES.length()-origin+i];
3659                 else {
3660                     res[i] = b[idx+origin+j];
3661                     j++;
3662                 }
3663             }
3664         }
3665         return res;
3666     }
3667 
3668     @Test(dataProvider = "floatBinaryOpProvider")
3669     static void unsliceBinaryFloatMaxVectorTestsBinary(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3670         float[] a = fa.apply(SPECIES.length());
3671         float[] b = fb.apply(SPECIES.length());
3672         float[] r = new float[a.length];
3673         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3674         int part = (new java.util.Random()).nextInt(2);
3675         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3676             for (int i = 0; i < a.length; i += SPECIES.length()) {
3677                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3678                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3679                 av.unslice(origin, bv, part).intoArray(r, i);
3680             }
3681         }
3682 
3683         assertArraysEquals(r, a, b, origin, part, FloatMaxVectorTests::unsliceBinary);
3684     }
3685 
3686     static float[] unslice(float[] a, float[] b, int origin, int part, boolean[] mask, int idx) {
3687         float[] res = new float[SPECIES.length()];
3688         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3689             if(i+origin < SPECIES.length())
3690                 res[i] = b[idx+i+origin];
3691             else {
3692                 res[i] = b[idx+j];
3693                 j++;
3694             }
3695         }
3696         for (int i = 0; i < SPECIES.length(); i++){
3697             res[i] = mask[i] ? a[idx+i] : res[i];
3698         }
3699         float[] res1 = new float[SPECIES.length()];
3700         if (part == 0) {
3701             for (int i = 0, j = 0; i < SPECIES.length(); i++){
3702                 if (i < origin)
3703                     res1[i] = b[idx+i];
3704                 else {
3705                    res1[i] = res[j];

3746 
3747     static float strictSIN(float a) {
3748         return (float)(StrictMath.sin((double)a));
3749     }
3750 
3751     @Test(dataProvider = "floatUnaryOpProvider")
3752     static void SINFloatMaxVectorTests(IntFunction<float[]> fa) {
3753         float[] a = fa.apply(SPECIES.length());
3754         float[] r = fr.apply(SPECIES.length());
3755 
3756         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3757             for (int i = 0; i < a.length; i += SPECIES.length()) {
3758                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3759                 av.lanewise(VectorOperators.SIN).intoArray(r, i);
3760             }
3761         }
3762 
3763         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::SIN, FloatMaxVectorTests::strictSIN);
3764     }
3765 

3766     static float EXP(float a) {
3767         return (float)(Math.exp((double)a));
3768     }
3769 
3770     static float strictEXP(float a) {
3771         return (float)(StrictMath.exp((double)a));
3772     }
3773 
3774     @Test(dataProvider = "floatUnaryOpProvider")
3775     static void EXPFloatMaxVectorTests(IntFunction<float[]> fa) {
3776         float[] a = fa.apply(SPECIES.length());
3777         float[] r = fr.apply(SPECIES.length());
3778 
3779         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3780             for (int i = 0; i < a.length; i += SPECIES.length()) {
3781                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3782                 av.lanewise(VectorOperators.EXP).intoArray(r, i);
3783             }
3784         }
3785 
3786         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::EXP, FloatMaxVectorTests::strictEXP);
3787     }
3788 

3789     static float LOG1P(float a) {
3790         return (float)(Math.log1p((double)a));
3791     }
3792 
3793     static float strictLOG1P(float a) {
3794         return (float)(StrictMath.log1p((double)a));
3795     }
3796 
3797     @Test(dataProvider = "floatUnaryOpProvider")
3798     static void LOG1PFloatMaxVectorTests(IntFunction<float[]> fa) {
3799         float[] a = fa.apply(SPECIES.length());
3800         float[] r = fr.apply(SPECIES.length());
3801 
3802         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3803             for (int i = 0; i < a.length; i += SPECIES.length()) {
3804                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3805                 av.lanewise(VectorOperators.LOG1P).intoArray(r, i);
3806             }
3807         }
3808 
3809         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::LOG1P, FloatMaxVectorTests::strictLOG1P);
3810     }
3811 

3812     static float LOG(float a) {
3813         return (float)(Math.log((double)a));
3814     }
3815 
3816     static float strictLOG(float a) {
3817         return (float)(StrictMath.log((double)a));
3818     }
3819 
3820     @Test(dataProvider = "floatUnaryOpProvider")
3821     static void LOGFloatMaxVectorTests(IntFunction<float[]> fa) {
3822         float[] a = fa.apply(SPECIES.length());
3823         float[] r = fr.apply(SPECIES.length());
3824 
3825         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3826             for (int i = 0; i < a.length; i += SPECIES.length()) {
3827                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3828                 av.lanewise(VectorOperators.LOG).intoArray(r, i);
3829             }
3830         }
3831 
3832         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::LOG, FloatMaxVectorTests::strictLOG);
3833     }
3834 

3835     static float LOG10(float a) {
3836         return (float)(Math.log10((double)a));
3837     }
3838 
3839     static float strictLOG10(float a) {
3840         return (float)(StrictMath.log10((double)a));
3841     }
3842 
3843     @Test(dataProvider = "floatUnaryOpProvider")
3844     static void LOG10FloatMaxVectorTests(IntFunction<float[]> fa) {
3845         float[] a = fa.apply(SPECIES.length());
3846         float[] r = fr.apply(SPECIES.length());
3847 
3848         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3849             for (int i = 0; i < a.length; i += SPECIES.length()) {
3850                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3851                 av.lanewise(VectorOperators.LOG10).intoArray(r, i);
3852             }
3853         }
3854 
3855         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::LOG10, FloatMaxVectorTests::strictLOG10);
3856     }
3857 

3858     static float EXPM1(float a) {
3859         return (float)(Math.expm1((double)a));
3860     }
3861 
3862     static float strictEXPM1(float a) {
3863         return (float)(StrictMath.expm1((double)a));
3864     }
3865 
3866     @Test(dataProvider = "floatUnaryOpProvider")
3867     static void EXPM1FloatMaxVectorTests(IntFunction<float[]> fa) {
3868         float[] a = fa.apply(SPECIES.length());
3869         float[] r = fr.apply(SPECIES.length());
3870 
3871         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3872             for (int i = 0; i < a.length; i += SPECIES.length()) {
3873                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3874                 av.lanewise(VectorOperators.EXPM1).intoArray(r, i);
3875             }
3876         }
3877 
3878         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::EXPM1, FloatMaxVectorTests::strictEXPM1);
3879     }
3880 

3881     static float COS(float a) {
3882         return (float)(Math.cos((double)a));
3883     }
3884 
3885     static float strictCOS(float a) {
3886         return (float)(StrictMath.cos((double)a));
3887     }
3888 
3889     @Test(dataProvider = "floatUnaryOpProvider")
3890     static void COSFloatMaxVectorTests(IntFunction<float[]> fa) {
3891         float[] a = fa.apply(SPECIES.length());
3892         float[] r = fr.apply(SPECIES.length());
3893 
3894         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3895             for (int i = 0; i < a.length; i += SPECIES.length()) {
3896                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3897                 av.lanewise(VectorOperators.COS).intoArray(r, i);
3898             }
3899         }
3900 
3901         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::COS, FloatMaxVectorTests::strictCOS);
3902     }
3903 

3904     static float TAN(float a) {
3905         return (float)(Math.tan((double)a));
3906     }
3907 
3908     static float strictTAN(float a) {
3909         return (float)(StrictMath.tan((double)a));
3910     }
3911 
3912     @Test(dataProvider = "floatUnaryOpProvider")
3913     static void TANFloatMaxVectorTests(IntFunction<float[]> fa) {
3914         float[] a = fa.apply(SPECIES.length());
3915         float[] r = fr.apply(SPECIES.length());
3916 
3917         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3918             for (int i = 0; i < a.length; i += SPECIES.length()) {
3919                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3920                 av.lanewise(VectorOperators.TAN).intoArray(r, i);
3921             }
3922         }
3923 
3924         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::TAN, FloatMaxVectorTests::strictTAN);
3925     }
3926 

3927     static float SINH(float a) {
3928         return (float)(Math.sinh((double)a));
3929     }
3930 
3931     static float strictSINH(float a) {
3932         return (float)(StrictMath.sinh((double)a));
3933     }
3934 
3935     @Test(dataProvider = "floatUnaryOpProvider")
3936     static void SINHFloatMaxVectorTests(IntFunction<float[]> fa) {
3937         float[] a = fa.apply(SPECIES.length());
3938         float[] r = fr.apply(SPECIES.length());
3939 
3940         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3941             for (int i = 0; i < a.length; i += SPECIES.length()) {
3942                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3943                 av.lanewise(VectorOperators.SINH).intoArray(r, i);
3944             }
3945         }
3946 
3947         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::SINH, FloatMaxVectorTests::strictSINH);
3948     }
3949 

3950     static float COSH(float a) {
3951         return (float)(Math.cosh((double)a));
3952     }
3953 
3954     static float strictCOSH(float a) {
3955         return (float)(StrictMath.cosh((double)a));
3956     }
3957 
3958     @Test(dataProvider = "floatUnaryOpProvider")
3959     static void COSHFloatMaxVectorTests(IntFunction<float[]> fa) {
3960         float[] a = fa.apply(SPECIES.length());
3961         float[] r = fr.apply(SPECIES.length());
3962 
3963         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3964             for (int i = 0; i < a.length; i += SPECIES.length()) {
3965                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3966                 av.lanewise(VectorOperators.COSH).intoArray(r, i);
3967             }
3968         }
3969 
3970         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::COSH, FloatMaxVectorTests::strictCOSH);
3971     }
3972 

3973     static float TANH(float a) {
3974         return (float)(Math.tanh((double)a));
3975     }
3976 
3977     static float strictTANH(float a) {
3978         return (float)(StrictMath.tanh((double)a));
3979     }
3980 
3981     @Test(dataProvider = "floatUnaryOpProvider")
3982     static void TANHFloatMaxVectorTests(IntFunction<float[]> fa) {
3983         float[] a = fa.apply(SPECIES.length());
3984         float[] r = fr.apply(SPECIES.length());
3985 
3986         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3987             for (int i = 0; i < a.length; i += SPECIES.length()) {
3988                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3989                 av.lanewise(VectorOperators.TANH).intoArray(r, i);
3990             }
3991         }
3992 
3993         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::TANH, FloatMaxVectorTests::strictTANH);
3994     }
3995 

3996     static float ASIN(float a) {
3997         return (float)(Math.asin((double)a));
3998     }
3999 
4000     static float strictASIN(float a) {
4001         return (float)(StrictMath.asin((double)a));
4002     }
4003 
4004     @Test(dataProvider = "floatUnaryOpProvider")
4005     static void ASINFloatMaxVectorTests(IntFunction<float[]> fa) {
4006         float[] a = fa.apply(SPECIES.length());
4007         float[] r = fr.apply(SPECIES.length());
4008 
4009         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4010             for (int i = 0; i < a.length; i += SPECIES.length()) {
4011                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4012                 av.lanewise(VectorOperators.ASIN).intoArray(r, i);
4013             }
4014         }
4015 
4016         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::ASIN, FloatMaxVectorTests::strictASIN);
4017     }
4018 

4019     static float ACOS(float a) {
4020         return (float)(Math.acos((double)a));
4021     }
4022 
4023     static float strictACOS(float a) {
4024         return (float)(StrictMath.acos((double)a));
4025     }
4026 
4027     @Test(dataProvider = "floatUnaryOpProvider")
4028     static void ACOSFloatMaxVectorTests(IntFunction<float[]> fa) {
4029         float[] a = fa.apply(SPECIES.length());
4030         float[] r = fr.apply(SPECIES.length());
4031 
4032         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4033             for (int i = 0; i < a.length; i += SPECIES.length()) {
4034                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4035                 av.lanewise(VectorOperators.ACOS).intoArray(r, i);
4036             }
4037         }
4038 
4039         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::ACOS, FloatMaxVectorTests::strictACOS);
4040     }
4041 

4042     static float ATAN(float a) {
4043         return (float)(Math.atan((double)a));
4044     }
4045 
4046     static float strictATAN(float a) {
4047         return (float)(StrictMath.atan((double)a));
4048     }
4049 
4050     @Test(dataProvider = "floatUnaryOpProvider")
4051     static void ATANFloatMaxVectorTests(IntFunction<float[]> fa) {
4052         float[] a = fa.apply(SPECIES.length());
4053         float[] r = fr.apply(SPECIES.length());
4054 
4055         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4056             for (int i = 0; i < a.length; i += SPECIES.length()) {
4057                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4058                 av.lanewise(VectorOperators.ATAN).intoArray(r, i);
4059             }
4060         }
4061 
4062         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::ATAN, FloatMaxVectorTests::strictATAN);
4063     }
4064 

4065     static float CBRT(float a) {
4066         return (float)(Math.cbrt((double)a));
4067     }
4068 
4069     static float strictCBRT(float a) {
4070         return (float)(StrictMath.cbrt((double)a));
4071     }
4072 
4073     @Test(dataProvider = "floatUnaryOpProvider")
4074     static void CBRTFloatMaxVectorTests(IntFunction<float[]> fa) {
4075         float[] a = fa.apply(SPECIES.length());
4076         float[] r = fr.apply(SPECIES.length());
4077 
4078         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4079             for (int i = 0; i < a.length; i += SPECIES.length()) {
4080                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4081                 av.lanewise(VectorOperators.CBRT).intoArray(r, i);
4082             }
4083         }
4084 
4085         assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::CBRT, FloatMaxVectorTests::strictCBRT);
4086     }
4087 

4088     static float HYPOT(float a, float b) {
4089         return (float)(Math.hypot((double)a, (double)b));
4090     }
4091 
4092     static float strictHYPOT(float a, float b) {
4093         return (float)(StrictMath.hypot((double)a, (double)b));
4094     }
4095 
4096     @Test(dataProvider = "floatBinaryOpProvider")
4097     static void HYPOTFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4098         float[] a = fa.apply(SPECIES.length());
4099         float[] b = fb.apply(SPECIES.length());
4100         float[] r = fr.apply(SPECIES.length());
4101 
4102         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4103             for (int i = 0; i < a.length; i += SPECIES.length()) {
4104                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4105                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4106                 av.lanewise(VectorOperators.HYPOT, bv).intoArray(r, i);
4107             }
4108         }
4109 
4110         assertArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::HYPOT, FloatMaxVectorTests::strictHYPOT);
4111     }
4112 
4113 

4114     static float POW(float a, float b) {
4115         return (float)(Math.pow((double)a, (double)b));
4116     }
4117 
4118     static float strictPOW(float a, float b) {
4119         return (float)(StrictMath.pow((double)a, (double)b));
4120     }
4121 
4122     @Test(dataProvider = "floatBinaryOpProvider")
4123     static void POWFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4124         float[] a = fa.apply(SPECIES.length());
4125         float[] b = fb.apply(SPECIES.length());
4126         float[] r = fr.apply(SPECIES.length());
4127 
4128         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4129             for (int i = 0; i < a.length; i += SPECIES.length()) {
4130                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4131                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4132                 av.lanewise(VectorOperators.POW, bv).intoArray(r, i);
4133             }
4134         }
4135 
4136         assertArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::POW, FloatMaxVectorTests::strictPOW);
4137     }
4138 
4139 
4140     static float pow(float a, float b) {
4141         return (float)(Math.pow((double)a, (double)b));
4142     }
4143 
4144     static float strictpow(float a, float b) {
4145         return (float)(StrictMath.pow((double)a, (double)b));
4146     }
4147 
4148     @Test(dataProvider = "floatBinaryOpProvider")
4149     static void powFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4150         float[] a = fa.apply(SPECIES.length());
4151         float[] b = fb.apply(SPECIES.length());
4152         float[] r = fr.apply(SPECIES.length());
4153 
4154         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4155             for (int i = 0; i < a.length; i += SPECIES.length()) {
4156                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4157                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4158                 av.pow(bv).intoArray(r, i);
4159             }
4160         }
4161 
4162         assertArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::pow, FloatMaxVectorTests::strictpow);
4163     }
4164 
4165 

4166     static float ATAN2(float a, float b) {
4167         return (float)(Math.atan2((double)a, (double)b));
4168     }
4169 
4170     static float strictATAN2(float a, float b) {
4171         return (float)(StrictMath.atan2((double)a, (double)b));
4172     }
4173 
4174     @Test(dataProvider = "floatBinaryOpProvider")
4175     static void ATAN2FloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4176         float[] a = fa.apply(SPECIES.length());
4177         float[] b = fb.apply(SPECIES.length());
4178         float[] r = fr.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                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4183                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4184                 av.lanewise(VectorOperators.ATAN2, bv).intoArray(r, i);
4185             }
4186         }
4187 
4188         assertArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::ATAN2, FloatMaxVectorTests::strictATAN2);
4189     }
4190 
4191 

4192     @Test(dataProvider = "floatBinaryOpProvider")
4193     static void POWFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4194         float[] a = fa.apply(SPECIES.length());
4195         float[] b = fb.apply(SPECIES.length());
4196         float[] r = fr.apply(SPECIES.length());
4197 
4198         for (int i = 0; i < a.length; i += SPECIES.length()) {
4199             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4200             av.lanewise(VectorOperators.POW, b[i]).intoArray(r, i);
4201         }
4202 
4203         assertBroadcastArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::POW, FloatMaxVectorTests::strictPOW);
4204     }
4205 
4206 
4207     @Test(dataProvider = "floatBinaryOpProvider")
4208     static void powFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4209         float[] a = fa.apply(SPECIES.length());
4210         float[] b = fb.apply(SPECIES.length());
4211         float[] r = fr.apply(SPECIES.length());
4212 
4213         for (int i = 0; i < a.length; i += SPECIES.length()) {
4214             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4215             av.pow(b[i]).intoArray(r, i);
4216         }
4217 
4218         assertBroadcastArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::pow, FloatMaxVectorTests::strictpow);
4219     }
4220 
4221 

4222     static float FMA(float a, float b, float c) {
4223         return (float)(Math.fma(a, b, c));
4224     }
4225 
4226     static float fma(float a, float b, float c) {
4227         return (float)(Math.fma(a, b, c));
4228     }
4229 

4230     @Test(dataProvider = "floatTernaryOpProvider")
4231     static void FMAFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4232         float[] a = fa.apply(SPECIES.length());
4233         float[] b = fb.apply(SPECIES.length());
4234         float[] c = fc.apply(SPECIES.length());
4235         float[] r = fr.apply(SPECIES.length());
4236 
4237         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4238             for (int i = 0; i < a.length; i += SPECIES.length()) {
4239                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4240                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4241                 FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4242                 av.lanewise(VectorOperators.FMA, bv, cv).intoArray(r, i);
4243             }
4244         }
4245 
4246         assertArraysEquals(r, a, b, c, FloatMaxVectorTests::FMA);
4247     }
4248 
4249     @Test(dataProvider = "floatTernaryOpProvider")
4250     static void fmaFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4251         float[] a = fa.apply(SPECIES.length());
4252         float[] b = fb.apply(SPECIES.length());
4253         float[] c = fc.apply(SPECIES.length());
4254         float[] r = fr.apply(SPECIES.length());
4255 
4256         for (int i = 0; i < a.length; i += SPECIES.length()) {
4257             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4258             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4259             FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4260             av.fma(bv, cv).intoArray(r, i);
4261         }
4262 
4263         assertArraysEquals(r, a, b, c, FloatMaxVectorTests::fma);
4264     }
4265 

4266     @Test(dataProvider = "floatTernaryOpMaskProvider")
4267     static void FMAFloatMaxVectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
4268                                           IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
4269         float[] a = fa.apply(SPECIES.length());
4270         float[] b = fb.apply(SPECIES.length());
4271         float[] c = fc.apply(SPECIES.length());
4272         float[] r = fr.apply(SPECIES.length());
4273         boolean[] mask = fm.apply(SPECIES.length());
4274         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4275 
4276         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4277             for (int i = 0; i < a.length; i += SPECIES.length()) {
4278                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4279                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4280                 FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4281                 av.lanewise(VectorOperators.FMA, bv, cv, vmask).intoArray(r, i);
4282             }
4283         }
4284 
4285         assertArraysEquals(r, a, b, c, mask, FloatMaxVectorTests::FMA);
4286     }
4287 




4288     @Test(dataProvider = "floatTernaryOpProvider")
4289     static void FMAFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4290         float[] a = fa.apply(SPECIES.length());
4291         float[] b = fb.apply(SPECIES.length());
4292         float[] c = fc.apply(SPECIES.length());
4293         float[] r = fr.apply(SPECIES.length());
4294 
4295         for (int i = 0; i < a.length; i += SPECIES.length()) {
4296             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4297             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4298             av.lanewise(VectorOperators.FMA, bv, c[i]).intoArray(r, i);
4299         }
4300         assertBroadcastArraysEquals(r, a, b, c, FloatMaxVectorTests::FMA);
4301     }
4302 
4303     @Test(dataProvider = "floatTernaryOpProvider")
4304     static void FMAFloatMaxVectorTestsAltBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4305         float[] a = fa.apply(SPECIES.length());
4306         float[] b = fb.apply(SPECIES.length());
4307         float[] c = fc.apply(SPECIES.length());
4308         float[] r = fr.apply(SPECIES.length());
4309 
4310         for (int i = 0; i < a.length; i += SPECIES.length()) {
4311             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4312             FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4313             av.lanewise(VectorOperators.FMA, b[i], cv).intoArray(r, i);
4314         }
4315         assertAltBroadcastArraysEquals(r, a, b, c, FloatMaxVectorTests::FMA);
4316     }
4317 

4318     @Test(dataProvider = "floatTernaryOpMaskProvider")
4319     static void FMAFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
4320                                           IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
4321         float[] a = fa.apply(SPECIES.length());
4322         float[] b = fb.apply(SPECIES.length());
4323         float[] c = fc.apply(SPECIES.length());
4324         float[] r = fr.apply(SPECIES.length());
4325         boolean[] mask = fm.apply(SPECIES.length());
4326         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4327 
4328         for (int i = 0; i < a.length; i += SPECIES.length()) {
4329             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4330             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4331             av.lanewise(VectorOperators.FMA, bv, c[i], vmask).intoArray(r, i);
4332         }
4333 
4334         assertBroadcastArraysEquals(r, a, b, c, mask, FloatMaxVectorTests::FMA);
4335     }
4336 
4337     @Test(dataProvider = "floatTernaryOpMaskProvider")
4338     static void FMAFloatMaxVectorTestsAltBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
4339                                           IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
4340         float[] a = fa.apply(SPECIES.length());
4341         float[] b = fb.apply(SPECIES.length());
4342         float[] c = fc.apply(SPECIES.length());
4343         float[] r = fr.apply(SPECIES.length());
4344         boolean[] mask = fm.apply(SPECIES.length());
4345         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4346 
4347         for (int i = 0; i < a.length; i += SPECIES.length()) {
4348             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4349             FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4350             av.lanewise(VectorOperators.FMA, b[i], cv, vmask).intoArray(r, i);
4351         }
4352 
4353         assertAltBroadcastArraysEquals(r, a, b, c, mask, FloatMaxVectorTests::FMA);
4354     }
4355 



4356     @Test(dataProvider = "floatTernaryOpProvider")
4357     static void FMAFloatMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4358         float[] a = fa.apply(SPECIES.length());
4359         float[] b = fb.apply(SPECIES.length());
4360         float[] c = fc.apply(SPECIES.length());
4361         float[] r = fr.apply(SPECIES.length());
4362 
4363         for (int i = 0; i < a.length; i += SPECIES.length()) {
4364             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4365             av.lanewise(VectorOperators.FMA, b[i], c[i]).intoArray(r, i);
4366         }
4367 
4368         assertDoubleBroadcastArraysEquals(r, a, b, c, FloatMaxVectorTests::FMA);
4369     }
4370 
4371     @Test(dataProvider = "floatTernaryOpProvider")
4372     static void fmaFloatMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4373         float[] a = fa.apply(SPECIES.length());
4374         float[] b = fb.apply(SPECIES.length());
4375         float[] c = fc.apply(SPECIES.length());
4376         float[] r = fr.apply(SPECIES.length());
4377 
4378         for (int i = 0; i < a.length; i += SPECIES.length()) {
4379             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4380             av.fma(b[i], c[i]).intoArray(r, i);
4381         }
4382 
4383         assertDoubleBroadcastArraysEquals(r, a, b, c, FloatMaxVectorTests::fma);
4384     }
4385 

4386     @Test(dataProvider = "floatTernaryOpMaskProvider")
4387     static void FMAFloatMaxVectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
4388                                           IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
4389         float[] a = fa.apply(SPECIES.length());
4390         float[] b = fb.apply(SPECIES.length());
4391         float[] c = fc.apply(SPECIES.length());
4392         float[] r = fr.apply(SPECIES.length());
4393         boolean[] mask = fm.apply(SPECIES.length());
4394         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4395 
4396         for (int i = 0; i < a.length; i += SPECIES.length()) {
4397             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4398             av.lanewise(VectorOperators.FMA, b[i], c[i], vmask).intoArray(r, i);
4399         }
4400 
4401         assertDoubleBroadcastArraysEquals(r, a, b, c, mask, FloatMaxVectorTests::FMA);
4402     }
4403 



4404     static float NEG(float a) {
4405         return (float)(-((float)a));
4406     }
4407 
4408     static float neg(float a) {
4409         return (float)(-((float)a));
4410     }
4411 
4412     @Test(dataProvider = "floatUnaryOpProvider")
4413     static void NEGFloatMaxVectorTests(IntFunction<float[]> fa) {
4414         float[] a = fa.apply(SPECIES.length());
4415         float[] r = fr.apply(SPECIES.length());
4416 
4417         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4418             for (int i = 0; i < a.length; i += SPECIES.length()) {
4419                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4420                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
4421             }
4422         }
4423 

4496     }
4497 
4498     @Test(dataProvider = "floatUnaryOpMaskProvider")
4499     static void ABSMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
4500                                                 IntFunction<boolean[]> fm) {
4501         float[] a = fa.apply(SPECIES.length());
4502         float[] r = fr.apply(SPECIES.length());
4503         boolean[] mask = fm.apply(SPECIES.length());
4504         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4505 
4506         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4507             for (int i = 0; i < a.length; i += SPECIES.length()) {
4508                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4509                 av.lanewise(VectorOperators.ABS, vmask).intoArray(r, i);
4510             }
4511         }
4512 
4513         assertArraysEquals(r, a, mask, FloatMaxVectorTests::ABS);
4514     }
4515 







4516     static float SQRT(float a) {
4517         return (float)(Math.sqrt((double)a));
4518     }
4519 
4520     static float sqrt(float a) {
4521         return (float)(Math.sqrt((double)a));
4522     }
4523 


4524     @Test(dataProvider = "floatUnaryOpProvider")
4525     static void SQRTFloatMaxVectorTests(IntFunction<float[]> fa) {
4526         float[] a = fa.apply(SPECIES.length());
4527         float[] r = fr.apply(SPECIES.length());
4528 
4529         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4530             for (int i = 0; i < a.length; i += SPECIES.length()) {
4531                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4532                 av.lanewise(VectorOperators.SQRT).intoArray(r, i);
4533             }
4534         }
4535 
4536         assertArraysEquals(r, a, FloatMaxVectorTests::SQRT);
4537     }
4538 
4539     @Test(dataProvider = "floatUnaryOpProvider")
4540     static void sqrtFloatMaxVectorTests(IntFunction<float[]> fa) {
4541         float[] a = fa.apply(SPECIES.length());
4542         float[] r = fr.apply(SPECIES.length());
4543 
4544         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4545             for (int i = 0; i < a.length; i += SPECIES.length()) {
4546                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4547                 av.sqrt().intoArray(r, i);
4548             }
4549         }
4550 
4551         assertArraysEquals(r, a, FloatMaxVectorTests::sqrt);
4552     }
4553 


4554     @Test(dataProvider = "floatUnaryOpMaskProvider")
4555     static void SQRTMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
4556                                                 IntFunction<boolean[]> fm) {
4557         float[] a = fa.apply(SPECIES.length());
4558         float[] r = fr.apply(SPECIES.length());
4559         boolean[] mask = fm.apply(SPECIES.length());
4560         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4561 
4562         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4563             for (int i = 0; i < a.length; i += SPECIES.length()) {
4564                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4565                 av.lanewise(VectorOperators.SQRT, vmask).intoArray(r, i);
4566             }
4567         }
4568 
4569         assertArraysEquals(r, a, mask, FloatMaxVectorTests::SQRT);
4570     }
4571 

4572     @Test(dataProvider = "floatCompareOpProvider")
4573     static void ltFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4574         float[] a = fa.apply(SPECIES.length());
4575         float[] b = fb.apply(SPECIES.length());
4576 
4577         for (int i = 0; i < a.length; i += SPECIES.length()) {
4578             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4579             VectorMask<Float> mv = av.lt(b[i]);
4580 
4581             // Check results as part of computation.
4582             for (int j = 0; j < SPECIES.length(); j++) {
4583                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
4584             }
4585         }
4586     }
4587 
4588     @Test(dataProvider = "floatCompareOpProvider")
4589     static void eqFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4590         float[] a = fa.apply(SPECIES.length());
4591         float[] b = fb.apply(SPECIES.length());

4953             }
4954         }
4955         return i - idx;
4956     }
4957 
4958     @Test(dataProvider = "maskProvider")
4959     static void maskFirstTrueFloatMaxVectorTestsSmokeTest(IntFunction<boolean[]> fa) {
4960         boolean[] a = fa.apply(SPECIES.length());
4961         int[] r = new int[a.length];
4962 
4963         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
4964             for (int i = 0; i < a.length; i += SPECIES.length()) {
4965                 var vmask = SPECIES.loadMask(a, i);
4966                 r[i] = vmask.firstTrue();
4967             }
4968         }
4969 
4970         assertMaskReductionArraysEquals(r, a, FloatMaxVectorTests::maskFirstTrue);
4971     }
4972 
4973     @Test(dataProvider = "maskProvider")
4974     static void maskCompressFloatMaxVectorTestsSmokeTest(IntFunction<boolean[]> fa) {
4975         int trueCount = 0;
4976         boolean[] a = fa.apply(SPECIES.length());
4977 
4978         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
4979             for (int i = 0; i < a.length; i += SPECIES.length()) {
4980                 var vmask = SPECIES.loadMask(a, i);
4981                 trueCount = vmask.trueCount();
4982                 var rmask = vmask.compress();
4983                 for (int j = 0; j < SPECIES.length(); j++)  {
4984                     Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
4985                 }
4986             }
4987         }
4988     }
4989 
4990 
4991     @DataProvider
4992     public static Object[][] offsetProvider() {
4993         return new Object[][]{
4994                 {0},
4995                 {-1},
4996                 {+1},
4997                 {+2},
4998                 {-2},
4999         };
5000     }
5001 
5002     @Test(dataProvider = "offsetProvider")
5003     static void indexInRangeFloatMaxVectorTestsSmokeTest(int offset) {
5004         int limit = SPECIES.length() * BUFFER_REPS;
5005         for (int i = 0; i < limit; i += SPECIES.length()) {
5006             var actualMask = SPECIES.indexInRange(i + offset, limit);
5007             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
5008             assert(actualMask.equals(expectedMask));
5009             for (int j = 0; j < SPECIES.length(); j++)  {
5010                 int index = i + j + offset;
5011                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
5012             }
5013         }
5014     }
5015 
5016     @Test(dataProvider = "offsetProvider")
5017     static void indexInRangeLongFloatMaxVectorTestsSmokeTest(int offset) {
5018         long limit = SPECIES.length() * BUFFER_REPS;
5019         for (long i = 0; i < limit; i += SPECIES.length()) {
5020             var actualMask = SPECIES.indexInRange(i + offset, limit);
5021             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
5022             assert(actualMask.equals(expectedMask));
5023             for (int j = 0; j < SPECIES.length(); j++)  {
5024                 long index = i + j + offset;
5025                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
5026             }
5027         }
5028     }
5029 
5030     @DataProvider
5031     public static Object[][] lengthProvider() {
5032         return new Object[][]{
5033                 {0},
5034                 {1},
5035                 {32},
5036                 {37},
5037                 {1024},
5038                 {1024+1},
5039                 {1024+5},
5040         };
5041     }
5042 
5043     @Test(dataProvider = "lengthProvider")
5044     static void loopBoundFloatMaxVectorTestsSmokeTest(int length) {
5045         int actualLoopBound = SPECIES.loopBound(length);
5046         int expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
5047         Assert.assertEquals(actualLoopBound, expectedLoopBound);
5048     }
5049 
5050     @Test(dataProvider = "lengthProvider")
5051     static void loopBoundLongFloatMaxVectorTestsSmokeTest(int _length) {
5052         long length = _length;
5053         long actualLoopBound = SPECIES.loopBound(length);
5054         long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
5055         Assert.assertEquals(actualLoopBound, expectedLoopBound);
5056     }
5057 
5058     @Test
5059     static void ElementSizeFloatMaxVectorTestsSmokeTest() {
5060         FloatVector av = FloatVector.zero(SPECIES);
5061         int elsize = av.elementSize();
5062         Assert.assertEquals(elsize, Float.SIZE);
5063     }
5064 
5065     @Test
5066     static void VectorShapeFloatMaxVectorTestsSmokeTest() {
5067         FloatVector av = FloatVector.zero(SPECIES);
5068         VectorShape vsh = av.shape();
5069         assert(vsh.equals(VectorShape.S_Max_BIT));
5070     }
5071 
5072     @Test
5073     static void ShapeWithLanesFloatMaxVectorTestsSmokeTest() {
5074         FloatVector av = FloatVector.zero(SPECIES);
5075         VectorShape vsh = av.shape();
5076         VectorSpecies species = vsh.withLanes(float.class);
5077         assert(species.equals(SPECIES));

5100         FloatVector av = FloatVector.zero(SPECIES);
5101         VectorSpecies species = av.species().withLanes(float.class);
5102         assert(species.equals(SPECIES));
5103     }
5104 
5105     @Test
5106     static void WithShapeFloatMaxVectorTestsSmokeTest() {
5107         FloatVector av = FloatVector.zero(SPECIES);
5108         VectorShape vsh = av.shape();
5109         VectorSpecies species = av.species().withShape(vsh);
5110         assert(species.equals(SPECIES));
5111     }
5112 
5113     @Test
5114     static void MaskAllTrueFloatMaxVectorTestsSmokeTest() {
5115         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5116           Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length()));
5117         }
5118     }
5119 }

< prev index next >