< prev index next >

test/jdk/jdk/incubator/vector/Float128VectorTests.java

Print this page

  43 import org.testng.annotations.Test;
  44 
  45 import java.lang.Integer;
  46 import java.util.List;
  47 import java.util.Arrays;
  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 Float128VectorTests extends AbstractVectorTest {
  56 
  57     static final VectorSpecies<Float> SPECIES =
  58                 FloatVector.SPECIES_128;
  59 
  60     static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
  61 
  62 
  63     private static final float CONST_SHIFT = Float.SIZE / 2;
  64 
  65     static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
  66 
  67     interface FUnOp {
  68         float apply(float a);
  69     }
  70 
  71     static void assertArraysEquals(float[] r, float[] a, FUnOp f) {
  72         int i = 0;
  73         try {
  74             for (; i < a.length; i++) {
  75                 Assert.assertEquals(r[i], f.apply(a[i]));
  76             }
  77         } catch (AssertionError e) {
  78             Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]);
  79         }
  80     }
  81 
  82     interface FUnArrayOp {
  83         float[] apply(float a);

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

















































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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

1886         assertBroadcastArraysEquals(r, a, b, Float128VectorTests::mul);
1887     }
1888 
1889     @Test(dataProvider = "floatBinaryOpMaskProvider")
1890     static void mulFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1891                                           IntFunction<boolean[]> fm) {
1892         float[] a = fa.apply(SPECIES.length());
1893         float[] b = fb.apply(SPECIES.length());
1894         float[] r = fr.apply(SPECIES.length());
1895         boolean[] mask = fm.apply(SPECIES.length());
1896         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1897 
1898         for (int i = 0; i < a.length; i += SPECIES.length()) {
1899             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1900             av.mul(b[i], vmask).intoArray(r, i);
1901         }
1902 
1903         assertBroadcastArraysEquals(r, a, b, mask, Float128VectorTests::mul);
1904     }
1905 
1906 
1907     @Test(dataProvider = "floatBinaryOpProvider")
1908     static void divFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1909         float[] a = fa.apply(SPECIES.length());
1910         float[] b = fb.apply(SPECIES.length());
1911         float[] r = fr.apply(SPECIES.length());
1912 
1913         for (int i = 0; i < a.length; i += SPECIES.length()) {
1914             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1915             av.div(b[i]).intoArray(r, i);
1916         }
1917 
1918         assertBroadcastArraysEquals(r, a, b, Float128VectorTests::div);
1919     }
1920 
1921 
1922 
1923     @Test(dataProvider = "floatBinaryOpMaskProvider")
1924     static void divFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1925                                           IntFunction<boolean[]> fm) {
1926         float[] a = fa.apply(SPECIES.length());
1927         float[] b = fb.apply(SPECIES.length());
1928         float[] r = fr.apply(SPECIES.length());
1929         boolean[] mask = fm.apply(SPECIES.length());
1930         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1931 
1932         for (int i = 0; i < a.length; i += SPECIES.length()) {
1933             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1934             av.div(b[i], vmask).intoArray(r, i);
1935         }
1936 
1937         assertBroadcastArraysEquals(r, a, b, mask, Float128VectorTests::div);
1938     }
1939 
1940 
1941 
1942 
1943 
1944 
1945 
1946 
1947 
1948 
1949     @Test(dataProvider = "floatBinaryOpProvider")
1950     static void ADDFloat128VectorTestsBroadcastLongSmokeTest(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.lanewise(VectorOperators.ADD, (long)b[i]).intoArray(r, i);
1958         }
1959 
1960         assertBroadcastLongArraysEquals(r, a, b, Float128VectorTests::ADD);
1961     }
1962 
1963     @Test(dataProvider = "floatBinaryOpMaskProvider")
1964     static void ADDFloat128VectorTestsBroadcastMaskedLongSmokeTest(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.lanewise(VectorOperators.ADD, (long)b[i], vmask).intoArray(r, i);
1975         }
1976 
1977         assertBroadcastLongArraysEquals(r, a, b, mask, Float128VectorTests::ADD);
1978     }
1979 
1980 
1981 
1982 
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     static float MIN(float a, float b) {
2038         return (float)(Math.min(a, b));
2039     }
2040 
2041     @Test(dataProvider = "floatBinaryOpProvider")
2042     static void MINFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2043         float[] a = fa.apply(SPECIES.length());
2044         float[] b = fb.apply(SPECIES.length());
2045         float[] r = fr.apply(SPECIES.length());
2046 
2047         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2048             for (int i = 0; i < a.length; i += SPECIES.length()) {
2049                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2050                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2051                 av.lanewise(VectorOperators.MIN, bv).intoArray(r, i);
2052             }
2053         }
2054 
2055         assertArraysEquals(r, a, b, Float128VectorTests::MIN);
2056     }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2521     static float FIRST_NONZEROReduce(float[] a, int idx) {
2522         float res = (float) 0;
2523         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2524             res = firstNonZero(res, a[i]);
2525         }
2526 
2527         return res;
2528     }
2529 
2530     static float FIRST_NONZEROReduceAll(float[] a) {
2531         float res = (float) 0;
2532         for (int i = 0; i < a.length; i += SPECIES.length()) {
2533             res = firstNonZero(res, FIRST_NONZEROReduce(a, i));
2534         }
2535 
2536         return res;
2537     }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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





































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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

















5018     @DataProvider
5019     public static Object[][] longMaskProvider() {
5020         return new Object[][]{
5021                 {0xFFFFFFFFFFFFFFFFL},
5022                 {0x0000000000000000L},
5023                 {0x5555555555555555L},
5024                 {0x0123456789abcdefL},
5025         };
5026     }
5027 
5028     @Test(dataProvider = "longMaskProvider")
5029     static void maskFromToLongFloat128VectorTestsSmokeTest(long inputLong) {
5030         var vmask = VectorMask.fromLong(SPECIES, inputLong);
5031         long outputLong = vmask.toLong();
5032         Assert.assertEquals(outputLong, (inputLong & (((0xFFFFFFFFFFFFFFFFL >>> (64 - SPECIES.length()))))));
5033     }
5034 
5035     @DataProvider
5036     public static Object[][] offsetProvider() {
5037         return new Object[][]{

5040                 {+1},
5041                 {+2},
5042                 {-2},
5043         };
5044     }
5045 
5046     @Test(dataProvider = "offsetProvider")
5047     static void indexInRangeFloat128VectorTestsSmokeTest(int offset) {
5048         int limit = SPECIES.length() * BUFFER_REPS;
5049         for (int i = 0; i < limit; i += SPECIES.length()) {
5050             var actualMask = SPECIES.indexInRange(i + offset, limit);
5051             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
5052             assert(actualMask.equals(expectedMask));
5053             for (int j = 0; j < SPECIES.length(); j++)  {
5054                 int index = i + j + offset;
5055                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
5056             }
5057         }
5058     }
5059 














5060     @DataProvider
5061     public static Object[][] lengthProvider() {
5062         return new Object[][]{
5063                 {0},
5064                 {1},
5065                 {32},
5066                 {37},
5067                 {1024},
5068                 {1024+1},
5069                 {1024+5},
5070         };
5071     }
5072 
5073     @Test(dataProvider = "lengthProvider")
5074     static void loopBoundFloat128VectorTestsSmokeTest(int length) {
5075         int actualLoopBound = SPECIES.loopBound(length);
5076         int expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
5077         Assert.assertEquals(actualLoopBound, expectedLoopBound);
5078     }
5079 








5080     @Test
5081     static void ElementSizeFloat128VectorTestsSmokeTest() {
5082         FloatVector av = FloatVector.zero(SPECIES);
5083         int elsize = av.elementSize();
5084         Assert.assertEquals(elsize, Float.SIZE);
5085     }
5086 
5087     @Test
5088     static void VectorShapeFloat128VectorTestsSmokeTest() {
5089         FloatVector av = FloatVector.zero(SPECIES);
5090         VectorShape vsh = av.shape();
5091         assert(vsh.equals(VectorShape.S_128_BIT));
5092     }
5093 
5094     @Test
5095     static void ShapeWithLanesFloat128VectorTestsSmokeTest() {
5096         FloatVector av = FloatVector.zero(SPECIES);
5097         VectorShape vsh = av.shape();
5098         VectorSpecies species = vsh.withLanes(float.class);
5099         assert(species.equals(SPECIES));

5122         FloatVector av = FloatVector.zero(SPECIES);
5123         VectorSpecies species = av.species().withLanes(float.class);
5124         assert(species.equals(SPECIES));
5125     }
5126 
5127     @Test
5128     static void WithShapeFloat128VectorTestsSmokeTest() {
5129         FloatVector av = FloatVector.zero(SPECIES);
5130         VectorShape vsh = av.shape();
5131         VectorSpecies species = av.species().withShape(vsh);
5132         assert(species.equals(SPECIES));
5133     }
5134 
5135     @Test
5136     static void MaskAllTrueFloat128VectorTestsSmokeTest() {
5137         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5138           Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length()));
5139         }
5140     }
5141 }
5142 

  43 import org.testng.annotations.Test;
  44 
  45 import java.lang.Integer;
  46 import java.util.List;
  47 import java.util.Arrays;
  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 Float128VectorTests extends AbstractVectorTest {
  56 
  57     static final VectorSpecies<Float> SPECIES =
  58                 FloatVector.SPECIES_128;
  59 
  60     static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
  61 
  62 

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

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

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

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

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

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

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

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

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

1498     static float ADD(float a, float b) {
1499         return (float)(a + b);
1500     }
1501 
1502     @Test(dataProvider = "floatBinaryOpProvider")
1503     static void ADDFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1504         float[] a = fa.apply(SPECIES.length());
1505         float[] b = fb.apply(SPECIES.length());
1506         float[] r = fr.apply(SPECIES.length());
1507 
1508         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1509             for (int i = 0; i < a.length; i += SPECIES.length()) {
1510                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1511                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1512                 av.lanewise(VectorOperators.ADD, bv).intoArray(r, i);
1513             }
1514         }
1515 
1516         assertArraysEquals(r, a, b, Float128VectorTests::ADD);
1517     }
1518 
1519     static float add(float a, float b) {
1520         return (float)(a + b);
1521     }
1522 
1523     @Test(dataProvider = "floatBinaryOpProvider")
1524     static void addFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1525         float[] a = fa.apply(SPECIES.length());
1526         float[] b = fb.apply(SPECIES.length());
1527         float[] r = fr.apply(SPECIES.length());
1528 
1529         for (int i = 0; i < a.length; i += SPECIES.length()) {
1530             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1531             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1532             av.add(bv).intoArray(r, i);
1533         }
1534 
1535         assertArraysEquals(r, a, b, Float128VectorTests::add);
1536     }
1537 
1538     @Test(dataProvider = "floatBinaryOpMaskProvider")

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

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

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


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


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

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








1851     @Test(dataProvider = "floatBinaryOpProvider")
1852     static void addFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1853         float[] a = fa.apply(SPECIES.length());
1854         float[] b = fb.apply(SPECIES.length());
1855         float[] r = fr.apply(SPECIES.length());
1856 
1857         for (int i = 0; i < a.length; i += SPECIES.length()) {
1858             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1859             av.add(b[i]).intoArray(r, i);
1860         }
1861 
1862         assertBroadcastArraysEquals(r, a, b, Float128VectorTests::add);
1863     }
1864 
1865     @Test(dataProvider = "floatBinaryOpMaskProvider")
1866     static void addFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1867                                           IntFunction<boolean[]> fm) {
1868         float[] a = fa.apply(SPECIES.length());
1869         float[] b = fb.apply(SPECIES.length());
1870         float[] r = fr.apply(SPECIES.length());

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

1944     @Test(dataProvider = "floatBinaryOpProvider")
1945     static void divFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1946         float[] a = fa.apply(SPECIES.length());
1947         float[] b = fb.apply(SPECIES.length());
1948         float[] r = fr.apply(SPECIES.length());
1949 
1950         for (int i = 0; i < a.length; i += SPECIES.length()) {
1951             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1952             av.div(b[i]).intoArray(r, i);
1953         }
1954 
1955         assertBroadcastArraysEquals(r, a, b, Float128VectorTests::div);
1956     }
1957 


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









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

























































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

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











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




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

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

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

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

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

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

2810     @Test(dataProvider = "floatCompareOpProvider")
2811     static void LTFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2812         float[] a = fa.apply(SPECIES.length());
2813         float[] b = fb.apply(SPECIES.length());
2814 
2815         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2816             for (int i = 0; i < a.length; i += SPECIES.length()) {
2817                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2818                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2819                 VectorMask<Float> mv = av.compare(VectorOperators.LT, bv);
2820 
2821                 // Check results as part of computation.
2822                 for (int j = 0; j < SPECIES.length(); j++) {
2823                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
2824                 }
2825             }
2826         }
2827     }
2828 

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

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

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

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

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

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

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

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

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

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

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

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

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









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

3116     @Test(dataProvider = "floatCompareOpMaskProvider")
3117     static void LTFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa,
3118                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3119         float[] a = fa.apply(SPECIES.length());
3120         float[] b = fb.apply(SPECIES.length());
3121         boolean[] mask = fm.apply(SPECIES.length());
3122 
3123         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3124 
3125         for (int i = 0; i < a.length; i += SPECIES.length()) {
3126             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3127             VectorMask<Float> mv = av.compare(VectorOperators.LT, b[i], 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] && (a[i + j] < b[i]));
3132             }
3133         }
3134     }
3135 
3136     @Test(dataProvider = "floatCompareOpProvider")
3137     static void LTFloat128VectorTestsBroadcastLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3138         float[] a = fa.apply(SPECIES.length());
3139         float[] b = fb.apply(SPECIES.length());
3140 
3141         for (int i = 0; i < a.length; i += SPECIES.length()) {
3142             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3143             VectorMask<Float> mv = av.compare(VectorOperators.LT, (long)b[i]);
3144 
3145             // Check results as part of computation.
3146             for (int j = 0; j < SPECIES.length(); j++) {
3147                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i]));
3148             }
3149         }
3150     }
3151 

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

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

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

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

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




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



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

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

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

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

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

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

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

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

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

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

3945     static float COSH(float a) {
3946         return (float)(Math.cosh((double)a));
3947     }
3948 
3949     static float strictCOSH(float a) {
3950         return (float)(StrictMath.cosh((double)a));
3951     }
3952 
3953     @Test(dataProvider = "floatUnaryOpProvider")
3954     static void COSHFloat128VectorTests(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.COSH).intoArray(r, i);
3962             }
3963         }
3964 
3965         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::COSH, Float128VectorTests::strictCOSH);
3966     }
3967 

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

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

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

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

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

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

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

4161     static float ATAN2(float a, float b) {
4162         return (float)(Math.atan2((double)a, (double)b));
4163     }
4164 
4165     static float strictATAN2(float a, float b) {
4166         return (float)(StrictMath.atan2((double)a, (double)b));
4167     }
4168 
4169     @Test(dataProvider = "floatBinaryOpProvider")
4170     static void ATAN2Float128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4171         float[] a = fa.apply(SPECIES.length());
4172         float[] b = fb.apply(SPECIES.length());
4173         float[] r = fr.apply(SPECIES.length());
4174 
4175         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4176             for (int i = 0; i < a.length; i += SPECIES.length()) {
4177                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4178                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4179                 av.lanewise(VectorOperators.ATAN2, bv).intoArray(r, i);
4180             }
4181         }
4182 
4183         assertArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::ATAN2, Float128VectorTests::strictATAN2);
4184     }
4185 
4186 

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

4217     static float FMA(float a, float b, float c) {
4218         return (float)(Math.fma(a, b, c));
4219     }
4220 
4221     static float fma(float a, float b, float c) {
4222         return (float)(Math.fma(a, b, c));
4223     }
4224 

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

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




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

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



4351     @Test(dataProvider = "floatTernaryOpProvider")
4352     static void FMAFloat128VectorTestsDoubleBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
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 
4358         for (int i = 0; i < a.length; i += SPECIES.length()) {
4359             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4360             av.lanewise(VectorOperators.FMA, b[i], c[i]).intoArray(r, i);
4361         }
4362 
4363         assertDoubleBroadcastArraysEquals(r, a, b, c, Float128VectorTests::FMA);
4364     }
4365 
4366     @Test(dataProvider = "floatTernaryOpProvider")
4367     static void fmaFloat128VectorTestsDoubleBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4368         float[] a = fa.apply(SPECIES.length());
4369         float[] b = fb.apply(SPECIES.length());
4370         float[] c = fc.apply(SPECIES.length());
4371         float[] r = fr.apply(SPECIES.length());
4372 
4373         for (int i = 0; i < a.length; i += SPECIES.length()) {
4374             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4375             av.fma(b[i], c[i]).intoArray(r, i);
4376         }
4377 
4378         assertDoubleBroadcastArraysEquals(r, a, b, c, Float128VectorTests::fma);
4379     }
4380 

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



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

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







4511     static float SQRT(float a) {
4512         return (float)(Math.sqrt((double)a));
4513     }
4514 
4515     static float sqrt(float a) {
4516         return (float)(Math.sqrt((double)a));
4517     }
4518 


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


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

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

4948             }
4949         }
4950         return i - idx;
4951     }
4952 
4953     @Test(dataProvider = "maskProvider")
4954     static void maskFirstTrueFloat128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
4955         boolean[] a = fa.apply(SPECIES.length());
4956         int[] r = new int[a.length];
4957 
4958         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
4959             for (int i = 0; i < a.length; i += SPECIES.length()) {
4960                 var vmask = SPECIES.loadMask(a, i);
4961                 r[i] = vmask.firstTrue();
4962             }
4963         }
4964 
4965         assertMaskReductionArraysEquals(r, a, Float128VectorTests::maskFirstTrue);
4966     }
4967 
4968     @Test(dataProvider = "maskProvider")
4969     static void maskCompressFloat128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
4970         int trueCount = 0;
4971         boolean[] a = fa.apply(SPECIES.length());
4972 
4973         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
4974             for (int i = 0; i < a.length; i += SPECIES.length()) {
4975                 var vmask = SPECIES.loadMask(a, i);
4976                 trueCount = vmask.trueCount();
4977                 var rmask = vmask.compress();
4978                 for (int j = 0; j < SPECIES.length(); j++)  {
4979                     Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
4980                 }
4981             }
4982         }
4983     }
4984 
4985     @DataProvider
4986     public static Object[][] longMaskProvider() {
4987         return new Object[][]{
4988                 {0xFFFFFFFFFFFFFFFFL},
4989                 {0x0000000000000000L},
4990                 {0x5555555555555555L},
4991                 {0x0123456789abcdefL},
4992         };
4993     }
4994 
4995     @Test(dataProvider = "longMaskProvider")
4996     static void maskFromToLongFloat128VectorTestsSmokeTest(long inputLong) {
4997         var vmask = VectorMask.fromLong(SPECIES, inputLong);
4998         long outputLong = vmask.toLong();
4999         Assert.assertEquals(outputLong, (inputLong & (((0xFFFFFFFFFFFFFFFFL >>> (64 - SPECIES.length()))))));
5000     }
5001 
5002     @DataProvider
5003     public static Object[][] offsetProvider() {
5004         return new Object[][]{

5007                 {+1},
5008                 {+2},
5009                 {-2},
5010         };
5011     }
5012 
5013     @Test(dataProvider = "offsetProvider")
5014     static void indexInRangeFloat128VectorTestsSmokeTest(int offset) {
5015         int limit = SPECIES.length() * BUFFER_REPS;
5016         for (int i = 0; i < limit; i += SPECIES.length()) {
5017             var actualMask = SPECIES.indexInRange(i + offset, limit);
5018             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
5019             assert(actualMask.equals(expectedMask));
5020             for (int j = 0; j < SPECIES.length(); j++)  {
5021                 int index = i + j + offset;
5022                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
5023             }
5024         }
5025     }
5026 
5027     @Test(dataProvider = "offsetProvider")
5028     static void indexInRangeLongFloat128VectorTestsSmokeTest(int offset) {
5029         long limit = SPECIES.length() * BUFFER_REPS;
5030         for (long i = 0; i < limit; i += SPECIES.length()) {
5031             var actualMask = SPECIES.indexInRange(i + offset, limit);
5032             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
5033             assert(actualMask.equals(expectedMask));
5034             for (int j = 0; j < SPECIES.length(); j++)  {
5035                 long index = i + j + offset;
5036                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
5037             }
5038         }
5039     }
5040 
5041     @DataProvider
5042     public static Object[][] lengthProvider() {
5043         return new Object[][]{
5044                 {0},
5045                 {1},
5046                 {32},
5047                 {37},
5048                 {1024},
5049                 {1024+1},
5050                 {1024+5},
5051         };
5052     }
5053 
5054     @Test(dataProvider = "lengthProvider")
5055     static void loopBoundFloat128VectorTestsSmokeTest(int length) {
5056         int actualLoopBound = SPECIES.loopBound(length);
5057         int expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
5058         Assert.assertEquals(actualLoopBound, expectedLoopBound);
5059     }
5060 
5061     @Test(dataProvider = "lengthProvider")
5062     static void loopBoundLongFloat128VectorTestsSmokeTest(int _length) {
5063         long length = _length;
5064         long actualLoopBound = SPECIES.loopBound(length);
5065         long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
5066         Assert.assertEquals(actualLoopBound, expectedLoopBound);
5067     }
5068 
5069     @Test
5070     static void ElementSizeFloat128VectorTestsSmokeTest() {
5071         FloatVector av = FloatVector.zero(SPECIES);
5072         int elsize = av.elementSize();
5073         Assert.assertEquals(elsize, Float.SIZE);
5074     }
5075 
5076     @Test
5077     static void VectorShapeFloat128VectorTestsSmokeTest() {
5078         FloatVector av = FloatVector.zero(SPECIES);
5079         VectorShape vsh = av.shape();
5080         assert(vsh.equals(VectorShape.S_128_BIT));
5081     }
5082 
5083     @Test
5084     static void ShapeWithLanesFloat128VectorTestsSmokeTest() {
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 WithShapeFloat128VectorTestsSmokeTest() {
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 MaskAllTrueFloat128VectorTestsSmokeTest() {
5126         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5127           Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length()));
5128         }
5129     }
5130 }

< prev index next >