< prev index next >

test/jdk/jdk/incubator/vector/Double128VectorTests.java

Print this page




 224 
 225     interface FBinMaskOp {
 226         double apply(double a, double 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(double[] a, double[] b, double[] 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(double[] a, double[] b, double[] r, boolean[] mask, FBinOp f) {
 245         assertArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 246     }
 247 
 248     static void assertArraysEquals(double[] a, double[] b, double[] 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(double[] a, double[] b, double[] 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(double[] a, double[] b, double[] r, boolean[] mask, FBinOp f) {
 274         assertShiftArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 275     }
 276 
 277     static void assertShiftArraysEquals(double[] a, double[] b, double[] 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                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1252                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1253                 av.lanewise(VectorOperators.FIRST_NONZERO, bv, vmask).intoArray(r, i);
1254             }
1255         }
1256 
1257         assertArraysEquals(a, b, r, mask, Double128VectorTests::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 (double)(Math.max(a, b));
1365     }
1366 
1367     @Test(dataProvider = "doubleBinaryOpProvider")
1368     static void maxDouble128VectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb) {
1369         double[] a = fa.apply(SPECIES.length());
1370         double[] b = fb.apply(SPECIES.length());
1371         double[] 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                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1376                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1377                 av.max(bv).intoArray(r, i);
1378             }
1379         }
1380 
1381         assertArraysEquals(a, b, r, Double128VectorTests::max);
1382     }
1383 
























































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


2978         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2979             for (int i = 0; i < a.length; i += SPECIES.length()) {
2980                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
2981                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
2982                 DoubleVector cv = DoubleVector.fromArray(SPECIES, c, i);
2983                 av.lanewise(VectorOperators.FMA, bv, cv, vmask).intoArray(r, i);
2984             }
2985         }
2986 
2987         assertArraysEquals(a, b, c, r, mask, Double128VectorTests::FMA);
2988     }
2989 
2990 
2991 
2992 
2993 
2994     static double NEG(double a) {
2995         return (double)(-((double)a));
2996     }
2997 




2998     @Test(dataProvider = "doubleUnaryOpProvider")
2999     static void NEGDouble128VectorTests(IntFunction<double[]> fa) {
3000         double[] a = fa.apply(SPECIES.length());
3001         double[] r = fr.apply(SPECIES.length());
3002 
3003         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3004             for (int i = 0; i < a.length; i += SPECIES.length()) {
3005                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
3006                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
3007             }
3008         }
3009 
3010         assertArraysEquals(a, r, Double128VectorTests::NEG);















3011     }
3012 
3013     @Test(dataProvider = "doubleUnaryOpMaskProvider")
3014     static void NEGMaskedDouble128VectorTests(IntFunction<double[]> fa,
3015                                                 IntFunction<boolean[]> fm) {
3016         double[] a = fa.apply(SPECIES.length());
3017         double[] r = fr.apply(SPECIES.length());
3018         boolean[] mask = fm.apply(SPECIES.length());
3019         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3020 
3021         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3022             for (int i = 0; i < a.length; i += SPECIES.length()) {
3023                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
3024                 av.lanewise(VectorOperators.NEG, vmask).intoArray(r, i);
3025             }
3026         }
3027 
3028         assertArraysEquals(a, r, mask, Double128VectorTests::NEG);
3029     }
3030 




 224 
 225     interface FBinMaskOp {
 226         double apply(double a, double 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(double[] a, double[] b, double[] 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(double[] a, double[] b, double[] 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(double[] a, double[] b, double[] r, boolean[] mask, FBinOp f) {
 257         assertArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 258     }
 259 
 260     static void assertArraysEquals(double[] a, double[] b, double[] 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(double[] a, double[] b, double[] r, boolean[] mask, FBinOp f) {
 272         assertBroadcastArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 273     }
 274 
 275     static void assertBroadcastArraysEquals(double[] a, double[] b, double[] 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(double[] a, double[] b, double[] 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(double[] a, double[] b, double[] r, boolean[] mask, FBinOp f) {
 304         assertShiftArraysEquals(a, b, r, mask, FBinMaskOp.lift(f));
 305     }
 306 
 307     static void assertShiftArraysEquals(double[] a, double[] b, double[] 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                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1282                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1283                 av.lanewise(VectorOperators.FIRST_NONZERO, bv, vmask).intoArray(r, i);
1284             }
1285         }
1286 
1287         assertArraysEquals(a, b, r, mask, Double128VectorTests::FIRST_NONZERO);
1288     }
1289 
1290 
1291 
1292 
1293 
1294 
1295 
1296 
1297 
1298     @Test(dataProvider = "doubleBinaryOpProvider")
1299     static void addDouble128VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
1300         double[] a = fa.apply(SPECIES.length());
1301         double[] b = fb.apply(SPECIES.length());
1302         double[] r = fr.apply(SPECIES.length());
1303 
1304         for (int i = 0; i < a.length; i += SPECIES.length()) {
1305             DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1306             av.add(b[i]).intoArray(r, i);
1307         }
1308 
1309         assertBroadcastArraysEquals(a, b, r, Double128VectorTests::add);
1310     }
1311 
1312     @Test(dataProvider = "doubleBinaryOpMaskProvider")
1313     static void addDouble128VectorTestsBroadcastMaskedSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb,
1314                                           IntFunction<boolean[]> fm) {
1315         double[] a = fa.apply(SPECIES.length());
1316         double[] b = fb.apply(SPECIES.length());
1317         double[] r = fr.apply(SPECIES.length());
1318         boolean[] mask = fm.apply(SPECIES.length());
1319         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1320 
1321         for (int i = 0; i < a.length; i += SPECIES.length()) {
1322             DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1323             av.add(b[i], vmask).intoArray(r, i);
1324         }
1325 
1326         assertBroadcastArraysEquals(a, b, r, mask, Double128VectorTests::add);
1327     }
1328 
1329     @Test(dataProvider = "doubleBinaryOpProvider")
1330     static void subDouble128VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
1331         double[] a = fa.apply(SPECIES.length());
1332         double[] b = fb.apply(SPECIES.length());
1333         double[] r = fr.apply(SPECIES.length());
1334 
1335         for (int i = 0; i < a.length; i += SPECIES.length()) {
1336             DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1337             av.sub(b[i]).intoArray(r, i);
1338         }
1339 
1340         assertBroadcastArraysEquals(a, b, r, Double128VectorTests::sub);
1341     }
1342 
1343     @Test(dataProvider = "doubleBinaryOpMaskProvider")
1344     static void subDouble128VectorTestsBroadcastMaskedSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb,
1345                                           IntFunction<boolean[]> fm) {
1346         double[] a = fa.apply(SPECIES.length());
1347         double[] b = fb.apply(SPECIES.length());
1348         double[] r = fr.apply(SPECIES.length());
1349         boolean[] mask = fm.apply(SPECIES.length());
1350         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1351 
1352         for (int i = 0; i < a.length; i += SPECIES.length()) {
1353             DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1354             av.sub(b[i], vmask).intoArray(r, i);
1355         }
1356 
1357         assertBroadcastArraysEquals(a, b, r, mask, Double128VectorTests::sub);
1358     }
1359 
1360     @Test(dataProvider = "doubleBinaryOpProvider")
1361     static void mulDouble128VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
1362         double[] a = fa.apply(SPECIES.length());
1363         double[] b = fb.apply(SPECIES.length());
1364         double[] r = fr.apply(SPECIES.length());
1365 
1366         for (int i = 0; i < a.length; i += SPECIES.length()) {
1367             DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1368             av.mul(b[i]).intoArray(r, i);
1369         }
1370 
1371         assertBroadcastArraysEquals(a, b, r, Double128VectorTests::mul);
1372     }
1373 
1374     @Test(dataProvider = "doubleBinaryOpMaskProvider")
1375     static void mulDouble128VectorTestsBroadcastMaskedSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb,
1376                                           IntFunction<boolean[]> fm) {
1377         double[] a = fa.apply(SPECIES.length());
1378         double[] b = fb.apply(SPECIES.length());
1379         double[] r = fr.apply(SPECIES.length());
1380         boolean[] mask = fm.apply(SPECIES.length());
1381         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1382 
1383         for (int i = 0; i < a.length; i += SPECIES.length()) {
1384             DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1385             av.mul(b[i], vmask).intoArray(r, i);
1386         }
1387 
1388         assertBroadcastArraysEquals(a, b, r, mask, Double128VectorTests::mul);
1389     }
1390 
1391 
1392     @Test(dataProvider = "doubleBinaryOpProvider")
1393     static void divDouble128VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
1394         double[] a = fa.apply(SPECIES.length());
1395         double[] b = fb.apply(SPECIES.length());
1396         double[] r = fr.apply(SPECIES.length());
1397 
1398         for (int i = 0; i < a.length; i += SPECIES.length()) {
1399             DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1400             av.div(b[i]).intoArray(r, i);
1401         }
1402 
1403         assertBroadcastArraysEquals(a, b, r, Double128VectorTests::div);
1404     }
1405 
1406 
1407 
1408     @Test(dataProvider = "doubleBinaryOpMaskProvider")
1409     static void divDouble128VectorTestsBroadcastMaskedSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb,
1410                                           IntFunction<boolean[]> fm) {
1411         double[] a = fa.apply(SPECIES.length());
1412         double[] b = fb.apply(SPECIES.length());
1413         double[] r = fr.apply(SPECIES.length());
1414         boolean[] mask = fm.apply(SPECIES.length());
1415         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1416 
1417         for (int i = 0; i < a.length; i += SPECIES.length()) {
1418             DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1419             av.div(b[i], vmask).intoArray(r, i);
1420         }
1421 
1422         assertBroadcastArraysEquals(a, b, r, mask, Double128VectorTests::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 (double)(Math.max(a, b));
1527     }
1528 
1529     @Test(dataProvider = "doubleBinaryOpProvider")
1530     static void maxDouble128VectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb) {
1531         double[] a = fa.apply(SPECIES.length());
1532         double[] b = fb.apply(SPECIES.length());
1533         double[] 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                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1538                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1539                 av.max(bv).intoArray(r, i);
1540             }
1541         }
1542 
1543         assertArraysEquals(a, b, r, Double128VectorTests::max);
1544     }
1545 
1546     @Test(dataProvider = "doubleBinaryOpProvider")
1547     static void MINDouble128VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
1548         double[] a = fa.apply(SPECIES.length());
1549         double[] b = fb.apply(SPECIES.length());
1550         double[] r = fr.apply(SPECIES.length());
1551 
1552         for (int i = 0; i < a.length; i += SPECIES.length()) {
1553             DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1554             av.lanewise(VectorOperators.MIN, b[i]).intoArray(r, i);
1555         }
1556 
1557         assertBroadcastArraysEquals(a, b, r, Double128VectorTests::MIN);
1558     }
1559 
1560     @Test(dataProvider = "doubleBinaryOpProvider")
1561     static void minDouble128VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
1562         double[] a = fa.apply(SPECIES.length());
1563         double[] b = fb.apply(SPECIES.length());
1564         double[] r = fr.apply(SPECIES.length());
1565 
1566         for (int i = 0; i < a.length; i += SPECIES.length()) {
1567             DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1568             av.min(b[i]).intoArray(r, i);
1569         }
1570 
1571         assertBroadcastArraysEquals(a, b, r, Double128VectorTests::min);
1572     }
1573 
1574     @Test(dataProvider = "doubleBinaryOpProvider")
1575     static void MAXDouble128VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
1576         double[] a = fa.apply(SPECIES.length());
1577         double[] b = fb.apply(SPECIES.length());
1578         double[] r = fr.apply(SPECIES.length());
1579 
1580         for (int i = 0; i < a.length; i += SPECIES.length()) {
1581             DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1582             av.lanewise(VectorOperators.MAX, b[i]).intoArray(r, i);
1583         }
1584 
1585         assertBroadcastArraysEquals(a, b, r, Double128VectorTests::MAX);
1586     }
1587 
1588     @Test(dataProvider = "doubleBinaryOpProvider")
1589     static void maxDouble128VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
1590         double[] a = fa.apply(SPECIES.length());
1591         double[] b = fb.apply(SPECIES.length());
1592         double[] r = fr.apply(SPECIES.length());
1593 
1594         for (int i = 0; i < a.length; i += SPECIES.length()) {
1595             DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1596             av.max(b[i]).intoArray(r, i);
1597         }
1598 
1599         assertBroadcastArraysEquals(a, b, r, Double128VectorTests::max);
1600     }
1601 
1602 
1603 
1604 
1605 
1606 
1607 
1608 
1609 
1610 
1611 
1612 
1613     static double ADD(double[] a, int idx) {
1614         double res = 0;
1615         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1616             res += a[i];
1617         }
1618 
1619         return res;
1620     }
1621 


3196         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3197             for (int i = 0; i < a.length; i += SPECIES.length()) {
3198                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
3199                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
3200                 DoubleVector cv = DoubleVector.fromArray(SPECIES, c, i);
3201                 av.lanewise(VectorOperators.FMA, bv, cv, vmask).intoArray(r, i);
3202             }
3203         }
3204 
3205         assertArraysEquals(a, b, c, r, mask, Double128VectorTests::FMA);
3206     }
3207 
3208 
3209 
3210 
3211 
3212     static double NEG(double a) {
3213         return (double)(-((double)a));
3214     }
3215 
3216     static double neg(double a) {
3217         return (double)(-((double)a));
3218     }
3219 
3220     @Test(dataProvider = "doubleUnaryOpProvider")
3221     static void NEGDouble128VectorTests(IntFunction<double[]> fa) {
3222         double[] a = fa.apply(SPECIES.length());
3223         double[] r = fr.apply(SPECIES.length());
3224 
3225         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3226             for (int i = 0; i < a.length; i += SPECIES.length()) {
3227                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
3228                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
3229             }
3230         }
3231 
3232         assertArraysEquals(a, r, Double128VectorTests::NEG);
3233     }
3234 
3235     @Test(dataProvider = "doubleUnaryOpProvider")
3236     static void negDouble128VectorTests(IntFunction<double[]> fa) {
3237         double[] a = fa.apply(SPECIES.length());
3238         double[] r = fr.apply(SPECIES.length());
3239 
3240         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3241             for (int i = 0; i < a.length; i += SPECIES.length()) {
3242                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
3243                 av.neg().intoArray(r, i);
3244             }
3245         }
3246 
3247         assertArraysEquals(a, r, Double128VectorTests::neg);
3248     }
3249 
3250     @Test(dataProvider = "doubleUnaryOpMaskProvider")
3251     static void NEGMaskedDouble128VectorTests(IntFunction<double[]> fa,
3252                                                 IntFunction<boolean[]> fm) {
3253         double[] a = fa.apply(SPECIES.length());
3254         double[] r = fr.apply(SPECIES.length());
3255         boolean[] mask = fm.apply(SPECIES.length());
3256         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3257 
3258         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3259             for (int i = 0; i < a.length; i += SPECIES.length()) {
3260                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
3261                 av.lanewise(VectorOperators.NEG, vmask).intoArray(r, i);
3262             }
3263         }
3264 
3265         assertArraysEquals(a, r, mask, Double128VectorTests::NEG);
3266     }
3267 


< prev index next >