< prev index next >

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

Print this page




 229 
 230     interface FBinMaskOp {
 231         float apply(float a, float b, boolean m);
 232 
 233         static FBinMaskOp lift(FBinOp f) {
 234             return (a, b, m) -> m ? f.apply(a, b) : a;
 235         }
 236     }
 237 
 238     static void assertArraysEquals(float[] a, float[] b, float[] r, FBinOp f) {
 239         int i = 0;
 240         try {
 241             for (; i < a.length; i++) {
 242                 Assert.assertEquals(r[i], f.apply(a[i], b[i]));
 243             }
 244         } catch (AssertionError e) {
 245             Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i);
 246         }
 247     }
 248 












 249     static void assertArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinOp f) {
 250         assertArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 251     }
 252 
 253     static void assertArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinMaskOp f) {
 254         int i = 0;
 255         try {
 256             for (; i < a.length; i++) {
 257                 Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]));
 258             }
 259         } catch (AssertionError err) {
 260             Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]);
 261         }
 262     }
 263 


















 264     static void assertShiftArraysEquals(float[] a, float[] b, float[] r, FBinOp f) {
 265         int i = 0;
 266         int j = 0;
 267         try {
 268             for (; j < a.length; j += SPECIES.length()) {
 269                 for (i = 0; i < SPECIES.length(); i++) {
 270                     Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]));
 271                 }
 272             }
 273         } catch (AssertionError e) {
 274             Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j);
 275         }
 276     }
 277 
 278     static void assertShiftArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinOp f) {
 279         assertShiftArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 280     }
 281 
 282     static void assertShiftArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinMaskOp f) {
 283         int i = 0;


1253 
1254         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1255             for (int i = 0; i < a.length; i += SPECIES.length()) {
1256                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1257                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1258                 av.lanewise(VectorOperators.FIRST_NONZERO, bv, vmask).intoArray(r, i);
1259             }
1260         }
1261 
1262         assertArraysEquals(a, b, r, mask, FloatMaxVectorTests::FIRST_NONZERO);
1263     }
1264 
1265 
1266 
1267 
1268 
1269 
1270 
1271 
1272 




































































































































1273 
1274 
1275 
1276 
1277 
1278 
1279 
1280 
1281 
1282 
1283 
1284 
1285 
1286 
1287 
1288 
1289 
1290 
1291 
1292 


1369         return (float)(Math.max(a, b));
1370     }
1371 
1372     @Test(dataProvider = "floatBinaryOpProvider")
1373     static void maxFloatMaxVectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1374         float[] a = fa.apply(SPECIES.length());
1375         float[] b = fb.apply(SPECIES.length());
1376         float[] r = fr.apply(SPECIES.length());
1377 
1378         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1379             for (int i = 0; i < a.length; i += SPECIES.length()) {
1380                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1381                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1382                 av.max(bv).intoArray(r, i);
1383             }
1384         }
1385 
1386         assertArraysEquals(a, b, r, FloatMaxVectorTests::max);
1387     }
1388 
























































1389 
1390 
1391 
1392 
1393 
1394 
1395 
1396 
1397 
1398 
1399 
1400     static float ADD(float[] a, int idx) {
1401         float res = 0;
1402         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1403             res += a[i];
1404         }
1405 
1406         return res;
1407     }
1408 


2969         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2970             for (int i = 0; i < a.length; i += SPECIES.length()) {
2971                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2972                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2973                 FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
2974                 av.lanewise(VectorOperators.FMA, bv, cv, vmask).intoArray(r, i);
2975             }
2976         }
2977 
2978         assertArraysEquals(a, b, c, r, mask, FloatMaxVectorTests::FMA);
2979     }
2980 
2981 
2982 
2983 
2984 
2985     static float NEG(float a) {
2986         return (float)(-((float)a));
2987     }
2988 




2989     @Test(dataProvider = "floatUnaryOpProvider")
2990     static void NEGFloatMaxVectorTests(IntFunction<float[]> fa) {
2991         float[] a = fa.apply(SPECIES.length());
2992         float[] r = fr.apply(SPECIES.length());
2993 
2994         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2995             for (int i = 0; i < a.length; i += SPECIES.length()) {
2996                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2997                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
2998             }
2999         }
3000 
3001         assertArraysEquals(a, r, FloatMaxVectorTests::NEG);















3002     }
3003 
3004     @Test(dataProvider = "floatUnaryOpMaskProvider")
3005     static void NEGMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
3006                                                 IntFunction<boolean[]> fm) {
3007         float[] a = fa.apply(SPECIES.length());
3008         float[] r = fr.apply(SPECIES.length());
3009         boolean[] mask = fm.apply(SPECIES.length());
3010         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3011 
3012         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3013             for (int i = 0; i < a.length; i += SPECIES.length()) {
3014                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3015                 av.lanewise(VectorOperators.NEG, vmask).intoArray(r, i);
3016             }
3017         }
3018 
3019         assertArraysEquals(a, r, mask, FloatMaxVectorTests::NEG);
3020     }
3021 




 229 
 230     interface FBinMaskOp {
 231         float apply(float a, float b, boolean m);
 232 
 233         static FBinMaskOp lift(FBinOp f) {
 234             return (a, b, m) -> m ? f.apply(a, b) : a;
 235         }
 236     }
 237 
 238     static void assertArraysEquals(float[] a, float[] b, float[] r, FBinOp f) {
 239         int i = 0;
 240         try {
 241             for (; i < a.length; i++) {
 242                 Assert.assertEquals(r[i], f.apply(a[i], b[i]));
 243             }
 244         } catch (AssertionError e) {
 245             Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i);
 246         }
 247     }
 248 
 249     static void assertBroadcastArraysEquals(float[] a, float[] b, float[] r, FBinOp f) {
 250         int i = 0;
 251         try {
 252             for (; i < a.length; i++) {
 253                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]));
 254             }
 255         } catch (AssertionError e) {
 256             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]),
 257                                 "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i);
 258         }
 259     }
 260 
 261     static void assertArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinOp f) {
 262         assertArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 263     }
 264 
 265     static void assertArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinMaskOp f) {
 266         int i = 0;
 267         try {
 268             for (; i < a.length; i++) {
 269                 Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]));
 270             }
 271         } catch (AssertionError err) {
 272             Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]);
 273         }
 274     }
 275 
 276     static void assertBroadcastArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinOp f) {
 277         assertBroadcastArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 278     }
 279 
 280     static void assertBroadcastArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinMaskOp f) {
 281         int i = 0;
 282         try {
 283             for (; i < a.length; i++) {
 284                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]));
 285             }
 286         } catch (AssertionError err) {
 287             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], 
 288                                 mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + 
 289                                 ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " +
 290                                 mask[i % SPECIES.length()]);
 291         }
 292     }
 293 
 294     static void assertShiftArraysEquals(float[] a, float[] b, float[] r, FBinOp f) {
 295         int i = 0;
 296         int j = 0;
 297         try {
 298             for (; j < a.length; j += SPECIES.length()) {
 299                 for (i = 0; i < SPECIES.length(); i++) {
 300                     Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]));
 301                 }
 302             }
 303         } catch (AssertionError e) {
 304             Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j);
 305         }
 306     }
 307 
 308     static void assertShiftArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinOp f) {
 309         assertShiftArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 310     }
 311 
 312     static void assertShiftArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinMaskOp f) {
 313         int i = 0;


1283 
1284         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1285             for (int i = 0; i < a.length; i += SPECIES.length()) {
1286                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1287                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1288                 av.lanewise(VectorOperators.FIRST_NONZERO, bv, vmask).intoArray(r, i);
1289             }
1290         }
1291 
1292         assertArraysEquals(a, b, r, mask, FloatMaxVectorTests::FIRST_NONZERO);
1293     }
1294 
1295 
1296 
1297 
1298 
1299 
1300 
1301 
1302 
1303     @Test(dataProvider = "floatBinaryOpProvider")
1304     static void addFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1305         float[] a = fa.apply(SPECIES.length());
1306         float[] b = fb.apply(SPECIES.length());
1307         float[] r = fr.apply(SPECIES.length());
1308 
1309         for (int i = 0; i < a.length; i += SPECIES.length()) {
1310             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1311             av.add(b[i]).intoArray(r, i);
1312         }
1313 
1314         assertBroadcastArraysEquals(a, b, r, FloatMaxVectorTests::add);
1315     }
1316 
1317     @Test(dataProvider = "floatBinaryOpMaskProvider")
1318     static void addFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1319                                           IntFunction<boolean[]> fm) {
1320         float[] a = fa.apply(SPECIES.length());
1321         float[] b = fb.apply(SPECIES.length());
1322         float[] r = fr.apply(SPECIES.length());
1323         boolean[] mask = fm.apply(SPECIES.length());
1324         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1325 
1326         for (int i = 0; i < a.length; i += SPECIES.length()) {
1327             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1328             av.add(b[i], vmask).intoArray(r, i);
1329         }
1330 
1331         assertBroadcastArraysEquals(a, b, r, mask, FloatMaxVectorTests::add);
1332     }
1333 
1334     @Test(dataProvider = "floatBinaryOpProvider")
1335     static void subFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1336         float[] a = fa.apply(SPECIES.length());
1337         float[] b = fb.apply(SPECIES.length());
1338         float[] r = fr.apply(SPECIES.length());
1339 
1340         for (int i = 0; i < a.length; i += SPECIES.length()) {
1341             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1342             av.sub(b[i]).intoArray(r, i);
1343         }
1344 
1345         assertBroadcastArraysEquals(a, b, r, FloatMaxVectorTests::sub);
1346     }
1347 
1348     @Test(dataProvider = "floatBinaryOpMaskProvider")
1349     static void subFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1350                                           IntFunction<boolean[]> fm) {
1351         float[] a = fa.apply(SPECIES.length());
1352         float[] b = fb.apply(SPECIES.length());
1353         float[] r = fr.apply(SPECIES.length());
1354         boolean[] mask = fm.apply(SPECIES.length());
1355         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1356 
1357         for (int i = 0; i < a.length; i += SPECIES.length()) {
1358             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1359             av.sub(b[i], vmask).intoArray(r, i);
1360         }
1361 
1362         assertBroadcastArraysEquals(a, b, r, mask, FloatMaxVectorTests::sub);
1363     }
1364 
1365     @Test(dataProvider = "floatBinaryOpProvider")
1366     static void mulFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1367         float[] a = fa.apply(SPECIES.length());
1368         float[] b = fb.apply(SPECIES.length());
1369         float[] r = fr.apply(SPECIES.length());
1370 
1371         for (int i = 0; i < a.length; i += SPECIES.length()) {
1372             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1373             av.mul(b[i]).intoArray(r, i);
1374         }
1375 
1376         assertBroadcastArraysEquals(a, b, r, FloatMaxVectorTests::mul);
1377     }
1378 
1379     @Test(dataProvider = "floatBinaryOpMaskProvider")
1380     static void mulFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1381                                           IntFunction<boolean[]> fm) {
1382         float[] a = fa.apply(SPECIES.length());
1383         float[] b = fb.apply(SPECIES.length());
1384         float[] r = fr.apply(SPECIES.length());
1385         boolean[] mask = fm.apply(SPECIES.length());
1386         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1387 
1388         for (int i = 0; i < a.length; i += SPECIES.length()) {
1389             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1390             av.mul(b[i], vmask).intoArray(r, i);
1391         }
1392 
1393         assertBroadcastArraysEquals(a, b, r, mask, FloatMaxVectorTests::mul);
1394     }
1395 
1396 
1397     @Test(dataProvider = "floatBinaryOpProvider")
1398     static void divFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1399         float[] a = fa.apply(SPECIES.length());
1400         float[] b = fb.apply(SPECIES.length());
1401         float[] r = fr.apply(SPECIES.length());
1402 
1403         for (int i = 0; i < a.length; i += SPECIES.length()) {
1404             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1405             av.div(b[i]).intoArray(r, i);
1406         }
1407 
1408         assertBroadcastArraysEquals(a, b, r, FloatMaxVectorTests::div);
1409     }
1410 
1411 
1412 
1413     @Test(dataProvider = "floatBinaryOpMaskProvider")
1414     static void divFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1415                                           IntFunction<boolean[]> fm) {
1416         float[] a = fa.apply(SPECIES.length());
1417         float[] b = fb.apply(SPECIES.length());
1418         float[] r = fr.apply(SPECIES.length());
1419         boolean[] mask = fm.apply(SPECIES.length());
1420         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1421 
1422         for (int i = 0; i < a.length; i += SPECIES.length()) {
1423             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1424             av.div(b[i], vmask).intoArray(r, i);
1425         }
1426 
1427         assertBroadcastArraysEquals(a, b, r, mask, FloatMaxVectorTests::div);
1428     }
1429 
1430 
1431 
1432 
1433 
1434 
1435 
1436 
1437 
1438 
1439 
1440 
1441 
1442 
1443 
1444 
1445 
1446 
1447 
1448 
1449 
1450 
1451 
1452 
1453 
1454 


1531         return (float)(Math.max(a, b));
1532     }
1533 
1534     @Test(dataProvider = "floatBinaryOpProvider")
1535     static void maxFloatMaxVectorTests(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.max(bv).intoArray(r, i);
1545             }
1546         }
1547 
1548         assertArraysEquals(a, b, r, FloatMaxVectorTests::max);
1549     }
1550 
1551     @Test(dataProvider = "floatBinaryOpProvider")
1552     static void MINFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1553         float[] a = fa.apply(SPECIES.length());
1554         float[] b = fb.apply(SPECIES.length());
1555         float[] r = fr.apply(SPECIES.length());
1556 
1557         for (int i = 0; i < a.length; i += SPECIES.length()) {
1558             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1559             av.lanewise(VectorOperators.MIN, b[i]).intoArray(r, i);
1560         }
1561 
1562         assertBroadcastArraysEquals(a, b, r, FloatMaxVectorTests::MIN);
1563     }
1564 
1565     @Test(dataProvider = "floatBinaryOpProvider")
1566     static void minFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1567         float[] a = fa.apply(SPECIES.length());
1568         float[] b = fb.apply(SPECIES.length());
1569         float[] r = fr.apply(SPECIES.length());
1570 
1571         for (int i = 0; i < a.length; i += SPECIES.length()) {
1572             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1573             av.min(b[i]).intoArray(r, i);
1574         }
1575 
1576         assertBroadcastArraysEquals(a, b, r, FloatMaxVectorTests::min);
1577     }
1578 
1579     @Test(dataProvider = "floatBinaryOpProvider")
1580     static void MAXFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1581         float[] a = fa.apply(SPECIES.length());
1582         float[] b = fb.apply(SPECIES.length());
1583         float[] r = fr.apply(SPECIES.length());
1584 
1585         for (int i = 0; i < a.length; i += SPECIES.length()) {
1586             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1587             av.lanewise(VectorOperators.MAX, b[i]).intoArray(r, i);
1588         }
1589 
1590         assertBroadcastArraysEquals(a, b, r, FloatMaxVectorTests::MAX);
1591     }
1592 
1593     @Test(dataProvider = "floatBinaryOpProvider")
1594     static void maxFloatMaxVectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1595         float[] a = fa.apply(SPECIES.length());
1596         float[] b = fb.apply(SPECIES.length());
1597         float[] r = fr.apply(SPECIES.length());
1598 
1599         for (int i = 0; i < a.length; i += SPECIES.length()) {
1600             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1601             av.max(b[i]).intoArray(r, i);
1602         }
1603 
1604         assertBroadcastArraysEquals(a, b, r, FloatMaxVectorTests::max);
1605     }
1606 
1607 
1608 
1609 
1610 
1611 
1612 
1613 
1614 
1615 
1616 
1617 
1618     static float ADD(float[] a, int idx) {
1619         float res = 0;
1620         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1621             res += a[i];
1622         }
1623 
1624         return res;
1625     }
1626 


3187         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3188             for (int i = 0; i < a.length; i += SPECIES.length()) {
3189                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3190                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3191                 FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
3192                 av.lanewise(VectorOperators.FMA, bv, cv, vmask).intoArray(r, i);
3193             }
3194         }
3195 
3196         assertArraysEquals(a, b, c, r, mask, FloatMaxVectorTests::FMA);
3197     }
3198 
3199 
3200 
3201 
3202 
3203     static float NEG(float a) {
3204         return (float)(-((float)a));
3205     }
3206 
3207     static float neg(float a) {
3208         return (float)(-((float)a));
3209     }
3210 
3211     @Test(dataProvider = "floatUnaryOpProvider")
3212     static void NEGFloatMaxVectorTests(IntFunction<float[]> fa) {
3213         float[] a = fa.apply(SPECIES.length());
3214         float[] r = fr.apply(SPECIES.length());
3215 
3216         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3217             for (int i = 0; i < a.length; i += SPECIES.length()) {
3218                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3219                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
3220             }
3221         }
3222 
3223         assertArraysEquals(a, r, FloatMaxVectorTests::NEG);
3224     }
3225 
3226     @Test(dataProvider = "floatUnaryOpProvider")
3227     static void negFloatMaxVectorTests(IntFunction<float[]> fa) {
3228         float[] a = fa.apply(SPECIES.length());
3229         float[] r = fr.apply(SPECIES.length());
3230 
3231         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3232             for (int i = 0; i < a.length; i += SPECIES.length()) {
3233                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3234                 av.neg().intoArray(r, i);
3235             }
3236         }
3237 
3238         assertArraysEquals(a, r, FloatMaxVectorTests::neg);
3239     }
3240 
3241     @Test(dataProvider = "floatUnaryOpMaskProvider")
3242     static void NEGMaskedFloatMaxVectorTests(IntFunction<float[]> fa,
3243                                                 IntFunction<boolean[]> fm) {
3244         float[] a = fa.apply(SPECIES.length());
3245         float[] r = fr.apply(SPECIES.length());
3246         boolean[] mask = fm.apply(SPECIES.length());
3247         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3248 
3249         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3250             for (int i = 0; i < a.length; i += SPECIES.length()) {
3251                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3252                 av.lanewise(VectorOperators.NEG, vmask).intoArray(r, i);
3253             }
3254         }
3255 
3256         assertArraysEquals(a, r, mask, FloatMaxVectorTests::NEG);
3257     }
3258 


< prev index next >