< prev index next >

test/jdk/jdk/incubator/vector/Float512VectorTests.java

Print this page




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











 244     static void assertArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinOp f) {
 245         assertArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 246     }
 247 
 248     static void assertArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinMaskOp f) {
 249         int i = 0;
 250         try {
 251             for (; i < a.length; i++) {
 252                 Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]));
 253             }
 254         } catch (AssertionError err) {
 255             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()]);
 256         }
 257     }
 258 















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


1248 
1249         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1250             for (int i = 0; i < a.length; i += SPECIES.length()) {
1251                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1252                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1253                 av.lanewise(VectorOperators.FIRST_NONZERO, bv, vmask).intoArray(r, i);
1254             }
1255         }
1256 
1257         assertArraysEquals(a, b, r, mask, Float512VectorTests::FIRST_NONZERO);
1258     }
1259 
1260 
1261 
1262 
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 


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
























































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


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




2984     @Test(dataProvider = "floatUnaryOpProvider")
2985     static void NEGFloat512VectorTests(IntFunction<float[]> fa) {
2986         float[] a = fa.apply(SPECIES.length());
2987         float[] r = fr.apply(SPECIES.length());
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                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
2993             }
2994         }
2995 
2996         assertArraysEquals(a, r, Float512VectorTests::NEG);















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




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


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


1522         return (float)(Math.max(a, b));
1523     }
1524 
1525     @Test(dataProvider = "floatBinaryOpProvider")
1526     static void maxFloat512VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1527         float[] a = fa.apply(SPECIES.length());
1528         float[] b = fb.apply(SPECIES.length());
1529         float[] r = fr.apply(SPECIES.length());
1530 
1531         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1532             for (int i = 0; i < a.length; i += SPECIES.length()) {
1533                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1534                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1535                 av.max(bv).intoArray(r, i);
1536             }
1537         }
1538 
1539         assertArraysEquals(a, b, r, Float512VectorTests::max);
1540     }
1541 
1542     @Test(dataProvider = "floatBinaryOpProvider")
1543     static void MINFloat512VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1544         float[] a = fa.apply(SPECIES.length());
1545         float[] b = fb.apply(SPECIES.length());
1546         float[] r = fr.apply(SPECIES.length());
1547 
1548         for (int i = 0; i < a.length; i += SPECIES.length()) {
1549             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1550             av.lanewise(VectorOperators.MIN, b[i]).intoArray(r, i);
1551         }
1552 
1553         assertBroadcastArraysEquals(a, b, r, Float512VectorTests::MIN);
1554     }
1555 
1556     @Test(dataProvider = "floatBinaryOpProvider")
1557     static void minFloat512VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1558         float[] a = fa.apply(SPECIES.length());
1559         float[] b = fb.apply(SPECIES.length());
1560         float[] r = fr.apply(SPECIES.length());
1561 
1562         for (int i = 0; i < a.length; i += SPECIES.length()) {
1563             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1564             av.min(b[i]).intoArray(r, i);
1565         }
1566 
1567         assertBroadcastArraysEquals(a, b, r, Float512VectorTests::min);
1568     }
1569 
1570     @Test(dataProvider = "floatBinaryOpProvider")
1571     static void MAXFloat512VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1572         float[] a = fa.apply(SPECIES.length());
1573         float[] b = fb.apply(SPECIES.length());
1574         float[] r = fr.apply(SPECIES.length());
1575 
1576         for (int i = 0; i < a.length; i += SPECIES.length()) {
1577             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1578             av.lanewise(VectorOperators.MAX, b[i]).intoArray(r, i);
1579         }
1580 
1581         assertBroadcastArraysEquals(a, b, r, Float512VectorTests::MAX);
1582     }
1583 
1584     @Test(dataProvider = "floatBinaryOpProvider")
1585     static void maxFloat512VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1586         float[] a = fa.apply(SPECIES.length());
1587         float[] b = fb.apply(SPECIES.length());
1588         float[] r = fr.apply(SPECIES.length());
1589 
1590         for (int i = 0; i < a.length; i += SPECIES.length()) {
1591             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1592             av.max(b[i]).intoArray(r, i);
1593         }
1594 
1595         assertBroadcastArraysEquals(a, b, r, Float512VectorTests::max);
1596     }
1597 
1598 
1599 
1600 
1601 
1602 
1603 
1604 
1605 
1606 
1607 
1608 
1609     static float ADD(float[] a, int idx) {
1610         float res = 0;
1611         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1612             res += a[i];
1613         }
1614 
1615         return res;
1616     }
1617 


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


< prev index next >