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


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


< prev index next >