< prev index next >

test/jdk/jdk/incubator/vector/Float64VectorTests.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, Float64VectorTests::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 maxFloat64VectorTests(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, Float64VectorTests::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, Float64VectorTests::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 NEGFloat64VectorTests(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, Float64VectorTests::NEG);















2997     }
2998 
2999     @Test(dataProvider = "floatUnaryOpMaskProvider")
3000     static void NEGMaskedFloat64VectorTests(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, Float64VectorTests::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()]),
 252                                 "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i);
 253         }
 254     }
 255 
 256     static void assertArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinOp f) {
 257         assertArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 258     }
 259 
 260     static void assertArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinMaskOp f) {
 261         int i = 0;
 262         try {
 263             for (; i < a.length; i++) {
 264                 Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]));
 265             }
 266         } catch (AssertionError err) {
 267             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()]);
 268         }
 269     }
 270 
 271     static void assertBroadcastArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinOp f) {
 272         assertBroadcastArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 273     }
 274 
 275     static void assertBroadcastArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinMaskOp f) {
 276         int i = 0;
 277         try {
 278             for (; i < a.length; i++) {
 279                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]));
 280             }
 281         } catch (AssertionError err) {
 282             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], 
 283                                 mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + 
 284                                 ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " +
 285                                 mask[i % SPECIES.length()]);
 286         }
 287     }
 288 
 289     static void assertShiftArraysEquals(float[] a, float[] b, float[] r, FBinOp f) {
 290         int i = 0;
 291         int j = 0;
 292         try {
 293             for (; j < a.length; j += SPECIES.length()) {
 294                 for (i = 0; i < SPECIES.length(); i++) {
 295                     Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]));
 296                 }
 297             }
 298         } catch (AssertionError e) {
 299             Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j);
 300         }
 301     }
 302 
 303     static void assertShiftArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinOp f) {
 304         assertShiftArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 305     }
 306 
 307     static void assertShiftArraysEquals(float[] a, float[] b, float[] r, boolean[] mask, FBinMaskOp f) {
 308         int i = 0;


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


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


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


< prev index next >