229 230 interface FBinMaskOp { 231 double apply(double a, double b, boolean m); 232 233 static FBinMaskOp lift(FBinOp f) { 234 return (a, b, m) -> m ? f.apply(a, b) : a; 235 } 236 } 237 238 static void assertArraysEquals(double[] a, double[] b, double[] r, FBinOp f) { 239 int i = 0; 240 try { 241 for (; i < a.length; i++) { 242 Assert.assertEquals(r[i], f.apply(a[i], b[i])); 243 } 244 } catch (AssertionError e) { 245 Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); 246 } 247 } 248 249 static void assertArraysEquals(double[] a, double[] b, double[] r, boolean[] mask, FBinOp f) { 250 assertArraysEquals(a, b, r, mask, FBinMaskOp.lift(f)); 251 } 252 253 static void assertArraysEquals(double[] a, double[] b, double[] r, boolean[] mask, FBinMaskOp f) { 254 int i = 0; 255 try { 256 for (; i < a.length; i++) { 257 Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); 258 } 259 } catch (AssertionError err) { 260 Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); 261 } 262 } 263 264 static void assertShiftArraysEquals(double[] a, double[] b, double[] r, FBinOp f) { 265 int i = 0; 266 int j = 0; 267 try { 268 for (; j < a.length; j += SPECIES.length()) { 269 for (i = 0; i < SPECIES.length(); i++) { 270 Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); 271 } 272 } 273 } catch (AssertionError e) { 274 Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); 275 } 276 } 277 278 static void assertShiftArraysEquals(double[] a, double[] b, double[] r, boolean[] mask, FBinOp f) { 279 assertShiftArraysEquals(a, b, r, mask, FBinMaskOp.lift(f)); 280 } 281 282 static void assertShiftArraysEquals(double[] a, double[] b, double[] r, boolean[] mask, FBinMaskOp f) { 283 int i = 0; 1253 1254 for (int ic = 0; ic < INVOC_COUNT; ic++) { 1255 for (int i = 0; i < a.length; i += SPECIES.length()) { 1256 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1257 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); 1258 av.lanewise(VectorOperators.FIRST_NONZERO, bv, vmask).intoArray(r, i); 1259 } 1260 } 1261 1262 assertArraysEquals(a, b, r, mask, DoubleMaxVectorTests::FIRST_NONZERO); 1263 } 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1369 return (double)(Math.max(a, b)); 1370 } 1371 1372 @Test(dataProvider = "doubleBinaryOpProvider") 1373 static void maxDoubleMaxVectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb) { 1374 double[] a = fa.apply(SPECIES.length()); 1375 double[] b = fb.apply(SPECIES.length()); 1376 double[] r = fr.apply(SPECIES.length()); 1377 1378 for (int ic = 0; ic < INVOC_COUNT; ic++) { 1379 for (int i = 0; i < a.length; i += SPECIES.length()) { 1380 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1381 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); 1382 av.max(bv).intoArray(r, i); 1383 } 1384 } 1385 1386 assertArraysEquals(a, b, r, DoubleMaxVectorTests::max); 1387 } 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 static double ADD(double[] a, int idx) { 1401 double res = 0; 1402 for (int i = idx; i < (idx + SPECIES.length()); i++) { 1403 res += a[i]; 1404 } 1405 1406 return res; 1407 } 1408 2983 for (int ic = 0; ic < INVOC_COUNT; ic++) { 2984 for (int i = 0; i < a.length; i += SPECIES.length()) { 2985 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 2986 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); 2987 DoubleVector cv = DoubleVector.fromArray(SPECIES, c, i); 2988 av.lanewise(VectorOperators.FMA, bv, cv, vmask).intoArray(r, i); 2989 } 2990 } 2991 2992 assertArraysEquals(a, b, c, r, mask, DoubleMaxVectorTests::FMA); 2993 } 2994 2995 2996 2997 2998 2999 static double NEG(double a) { 3000 return (double)(-((double)a)); 3001 } 3002 3003 @Test(dataProvider = "doubleUnaryOpProvider") 3004 static void NEGDoubleMaxVectorTests(IntFunction<double[]> fa) { 3005 double[] a = fa.apply(SPECIES.length()); 3006 double[] r = fr.apply(SPECIES.length()); 3007 3008 for (int ic = 0; ic < INVOC_COUNT; ic++) { 3009 for (int i = 0; i < a.length; i += SPECIES.length()) { 3010 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 3011 av.lanewise(VectorOperators.NEG).intoArray(r, i); 3012 } 3013 } 3014 3015 assertArraysEquals(a, r, DoubleMaxVectorTests::NEG); 3016 } 3017 3018 @Test(dataProvider = "doubleUnaryOpMaskProvider") 3019 static void NEGMaskedDoubleMaxVectorTests(IntFunction<double[]> fa, 3020 IntFunction<boolean[]> fm) { 3021 double[] a = fa.apply(SPECIES.length()); 3022 double[] r = fr.apply(SPECIES.length()); 3023 boolean[] mask = fm.apply(SPECIES.length()); 3024 VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0); 3025 3026 for (int ic = 0; ic < INVOC_COUNT; ic++) { 3027 for (int i = 0; i < a.length; i += SPECIES.length()) { 3028 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 3029 av.lanewise(VectorOperators.NEG, vmask).intoArray(r, i); 3030 } 3031 } 3032 3033 assertArraysEquals(a, r, mask, DoubleMaxVectorTests::NEG); 3034 } 3035 | 229 230 interface FBinMaskOp { 231 double apply(double a, double b, boolean m); 232 233 static FBinMaskOp lift(FBinOp f) { 234 return (a, b, m) -> m ? f.apply(a, b) : a; 235 } 236 } 237 238 static void assertArraysEquals(double[] a, double[] b, double[] r, FBinOp f) { 239 int i = 0; 240 try { 241 for (; i < a.length; i++) { 242 Assert.assertEquals(r[i], f.apply(a[i], b[i])); 243 } 244 } catch (AssertionError e) { 245 Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); 246 } 247 } 248 249 static void assertBroadcastArraysEquals(double[] a, double[] b, double[] r, FBinOp f) { 250 int i = 0; 251 try { 252 for (; i < a.length; i++) { 253 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); 254 } 255 } catch (AssertionError e) { 256 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); 257 } 258 } 259 260 static void assertArraysEquals(double[] a, double[] b, double[] r, boolean[] mask, FBinOp f) { 261 assertArraysEquals(a, b, r, mask, FBinMaskOp.lift(f)); 262 } 263 264 static void assertArraysEquals(double[] a, double[] b, double[] r, boolean[] mask, FBinMaskOp f) { 265 int i = 0; 266 try { 267 for (; i < a.length; i++) { 268 Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); 269 } 270 } catch (AssertionError err) { 271 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()]); 272 } 273 } 274 275 static void assertBroadcastArraysEquals(double[] a, double[] b, double[] r, boolean[] mask, FBinOp f) { 276 assertBroadcastArraysEquals(a, b, r, mask, FBinMaskOp.lift(f)); 277 } 278 279 static void assertBroadcastArraysEquals(double[] a, double[] b, double[] r, boolean[] mask, FBinMaskOp f) { 280 int i = 0; 281 try { 282 for (; i < a.length; i++) { 283 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); 284 } 285 } catch (AssertionError err) { 286 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()]); 287 } 288 } 289 290 static void assertShiftArraysEquals(double[] a, double[] b, double[] r, FBinOp f) { 291 int i = 0; 292 int j = 0; 293 try { 294 for (; j < a.length; j += SPECIES.length()) { 295 for (i = 0; i < SPECIES.length(); i++) { 296 Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); 297 } 298 } 299 } catch (AssertionError e) { 300 Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); 301 } 302 } 303 304 static void assertShiftArraysEquals(double[] a, double[] b, double[] r, boolean[] mask, FBinOp f) { 305 assertShiftArraysEquals(a, b, r, mask, FBinMaskOp.lift(f)); 306 } 307 308 static void assertShiftArraysEquals(double[] a, double[] b, double[] r, boolean[] mask, FBinMaskOp f) { 309 int i = 0; 1279 1280 for (int ic = 0; ic < INVOC_COUNT; ic++) { 1281 for (int i = 0; i < a.length; i += SPECIES.length()) { 1282 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1283 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); 1284 av.lanewise(VectorOperators.FIRST_NONZERO, bv, vmask).intoArray(r, i); 1285 } 1286 } 1287 1288 assertArraysEquals(a, b, r, mask, DoubleMaxVectorTests::FIRST_NONZERO); 1289 } 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 @Test(dataProvider = "doubleBinaryOpProvider") 1300 static void addDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) { 1301 double[] a = fa.apply(SPECIES.length()); 1302 double[] b = fb.apply(SPECIES.length()); 1303 double[] r = fr.apply(SPECIES.length()); 1304 1305 for (int i = 0; i < a.length; i += SPECIES.length()) { 1306 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1307 av.add(b[i]).intoArray(r, i); 1308 } 1309 1310 assertBroadcastArraysEquals(a, b, r, DoubleMaxVectorTests::add); 1311 } 1312 1313 @Test(dataProvider = "doubleBinaryOpMaskProvider") 1314 static void addDoubleMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb, 1315 IntFunction<boolean[]> fm) { 1316 double[] a = fa.apply(SPECIES.length()); 1317 double[] b = fb.apply(SPECIES.length()); 1318 double[] r = fr.apply(SPECIES.length()); 1319 boolean[] mask = fm.apply(SPECIES.length()); 1320 VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0); 1321 1322 for (int i = 0; i < a.length; i += SPECIES.length()) { 1323 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1324 av.add(b[i], vmask).intoArray(r, i); 1325 } 1326 1327 assertBroadcastArraysEquals(a, b, r, mask, DoubleMaxVectorTests::add); 1328 } 1329 1330 @Test(dataProvider = "doubleBinaryOpProvider") 1331 static void subDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) { 1332 double[] a = fa.apply(SPECIES.length()); 1333 double[] b = fb.apply(SPECIES.length()); 1334 double[] r = fr.apply(SPECIES.length()); 1335 1336 for (int i = 0; i < a.length; i += SPECIES.length()) { 1337 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1338 av.sub(b[i]).intoArray(r, i); 1339 } 1340 1341 assertBroadcastArraysEquals(a, b, r, DoubleMaxVectorTests::sub); 1342 } 1343 1344 @Test(dataProvider = "doubleBinaryOpMaskProvider") 1345 static void subDoubleMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb, 1346 IntFunction<boolean[]> fm) { 1347 double[] a = fa.apply(SPECIES.length()); 1348 double[] b = fb.apply(SPECIES.length()); 1349 double[] r = fr.apply(SPECIES.length()); 1350 boolean[] mask = fm.apply(SPECIES.length()); 1351 VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0); 1352 1353 for (int i = 0; i < a.length; i += SPECIES.length()) { 1354 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1355 av.sub(b[i], vmask).intoArray(r, i); 1356 } 1357 1358 assertBroadcastArraysEquals(a, b, r, mask, DoubleMaxVectorTests::sub); 1359 } 1360 1361 @Test(dataProvider = "doubleBinaryOpProvider") 1362 static void mulDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) { 1363 double[] a = fa.apply(SPECIES.length()); 1364 double[] b = fb.apply(SPECIES.length()); 1365 double[] r = fr.apply(SPECIES.length()); 1366 1367 for (int i = 0; i < a.length; i += SPECIES.length()) { 1368 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1369 av.mul(b[i]).intoArray(r, i); 1370 } 1371 1372 assertBroadcastArraysEquals(a, b, r, DoubleMaxVectorTests::mul); 1373 } 1374 1375 @Test(dataProvider = "doubleBinaryOpMaskProvider") 1376 static void mulDoubleMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb, 1377 IntFunction<boolean[]> fm) { 1378 double[] a = fa.apply(SPECIES.length()); 1379 double[] b = fb.apply(SPECIES.length()); 1380 double[] r = fr.apply(SPECIES.length()); 1381 boolean[] mask = fm.apply(SPECIES.length()); 1382 VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0); 1383 1384 for (int i = 0; i < a.length; i += SPECIES.length()) { 1385 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1386 av.mul(b[i], vmask).intoArray(r, i); 1387 } 1388 1389 assertBroadcastArraysEquals(a, b, r, mask, DoubleMaxVectorTests::mul); 1390 } 1391 1392 1393 @Test(dataProvider = "doubleBinaryOpProvider") 1394 static void divDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) { 1395 double[] a = fa.apply(SPECIES.length()); 1396 double[] b = fb.apply(SPECIES.length()); 1397 double[] r = fr.apply(SPECIES.length()); 1398 1399 for (int i = 0; i < a.length; i += SPECIES.length()) { 1400 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1401 av.div(b[i]).intoArray(r, i); 1402 } 1403 1404 assertBroadcastArraysEquals(a, b, r, DoubleMaxVectorTests::div); 1405 } 1406 1407 1408 1409 @Test(dataProvider = "doubleBinaryOpMaskProvider") 1410 static void divDoubleMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb, 1411 IntFunction<boolean[]> fm) { 1412 double[] a = fa.apply(SPECIES.length()); 1413 double[] b = fb.apply(SPECIES.length()); 1414 double[] r = fr.apply(SPECIES.length()); 1415 boolean[] mask = fm.apply(SPECIES.length()); 1416 VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0); 1417 1418 for (int i = 0; i < a.length; i += SPECIES.length()) { 1419 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1420 av.div(b[i], vmask).intoArray(r, i); 1421 } 1422 1423 assertBroadcastArraysEquals(a, b, r, mask, DoubleMaxVectorTests::div); 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 1450 1527 return (double)(Math.max(a, b)); 1528 } 1529 1530 @Test(dataProvider = "doubleBinaryOpProvider") 1531 static void maxDoubleMaxVectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb) { 1532 double[] a = fa.apply(SPECIES.length()); 1533 double[] b = fb.apply(SPECIES.length()); 1534 double[] r = fr.apply(SPECIES.length()); 1535 1536 for (int ic = 0; ic < INVOC_COUNT; ic++) { 1537 for (int i = 0; i < a.length; i += SPECIES.length()) { 1538 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1539 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); 1540 av.max(bv).intoArray(r, i); 1541 } 1542 } 1543 1544 assertArraysEquals(a, b, r, DoubleMaxVectorTests::max); 1545 } 1546 1547 @Test(dataProvider = "doubleBinaryOpProvider") 1548 static void MINDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) { 1549 double[] a = fa.apply(SPECIES.length()); 1550 double[] b = fb.apply(SPECIES.length()); 1551 double[] r = fr.apply(SPECIES.length()); 1552 1553 for (int i = 0; i < a.length; i += SPECIES.length()) { 1554 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1555 av.lanewise(VectorOperators.MIN, b[i]).intoArray(r, i); 1556 } 1557 1558 assertBroadcastArraysEquals(a, b, r, DoubleMaxVectorTests::MIN); 1559 } 1560 1561 @Test(dataProvider = "doubleBinaryOpProvider") 1562 static void minDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) { 1563 double[] a = fa.apply(SPECIES.length()); 1564 double[] b = fb.apply(SPECIES.length()); 1565 double[] r = fr.apply(SPECIES.length()); 1566 1567 for (int i = 0; i < a.length; i += SPECIES.length()) { 1568 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1569 av.min(b[i]).intoArray(r, i); 1570 } 1571 1572 assertBroadcastArraysEquals(a, b, r, DoubleMaxVectorTests::min); 1573 } 1574 1575 @Test(dataProvider = "doubleBinaryOpProvider") 1576 static void MAXDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) { 1577 double[] a = fa.apply(SPECIES.length()); 1578 double[] b = fb.apply(SPECIES.length()); 1579 double[] r = fr.apply(SPECIES.length()); 1580 1581 for (int i = 0; i < a.length; i += SPECIES.length()) { 1582 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1583 av.lanewise(VectorOperators.MAX, b[i]).intoArray(r, i); 1584 } 1585 1586 assertBroadcastArraysEquals(a, b, r, DoubleMaxVectorTests::MAX); 1587 } 1588 1589 @Test(dataProvider = "doubleBinaryOpProvider") 1590 static void maxDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) { 1591 double[] a = fa.apply(SPECIES.length()); 1592 double[] b = fb.apply(SPECIES.length()); 1593 double[] r = fr.apply(SPECIES.length()); 1594 1595 for (int i = 0; i < a.length; i += SPECIES.length()) { 1596 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 1597 av.max(b[i]).intoArray(r, i); 1598 } 1599 1600 assertBroadcastArraysEquals(a, b, r, DoubleMaxVectorTests::max); 1601 } 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 static double ADD(double[] a, int idx) { 1615 double res = 0; 1616 for (int i = idx; i < (idx + SPECIES.length()); i++) { 1617 res += a[i]; 1618 } 1619 1620 return res; 1621 } 1622 3197 for (int ic = 0; ic < INVOC_COUNT; ic++) { 3198 for (int i = 0; i < a.length; i += SPECIES.length()) { 3199 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 3200 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); 3201 DoubleVector cv = DoubleVector.fromArray(SPECIES, c, i); 3202 av.lanewise(VectorOperators.FMA, bv, cv, vmask).intoArray(r, i); 3203 } 3204 } 3205 3206 assertArraysEquals(a, b, c, r, mask, DoubleMaxVectorTests::FMA); 3207 } 3208 3209 3210 3211 3212 3213 static double NEG(double a) { 3214 return (double)(-((double)a)); 3215 } 3216 3217 static double neg(double a) { 3218 return (double)(-((double)a)); 3219 } 3220 3221 @Test(dataProvider = "doubleUnaryOpProvider") 3222 static void NEGDoubleMaxVectorTests(IntFunction<double[]> fa) { 3223 double[] a = fa.apply(SPECIES.length()); 3224 double[] 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 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 3229 av.lanewise(VectorOperators.NEG).intoArray(r, i); 3230 } 3231 } 3232 3233 assertArraysEquals(a, r, DoubleMaxVectorTests::NEG); 3234 } 3235 3236 @Test(dataProvider = "doubleUnaryOpProvider") 3237 static void negDoubleMaxVectorTests(IntFunction<double[]> fa) { 3238 double[] a = fa.apply(SPECIES.length()); 3239 double[] r = fr.apply(SPECIES.length()); 3240 3241 for (int ic = 0; ic < INVOC_COUNT; ic++) { 3242 for (int i = 0; i < a.length; i += SPECIES.length()) { 3243 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 3244 av.neg().intoArray(r, i); 3245 } 3246 } 3247 3248 assertArraysEquals(a, r, DoubleMaxVectorTests::neg); 3249 } 3250 3251 @Test(dataProvider = "doubleUnaryOpMaskProvider") 3252 static void NEGMaskedDoubleMaxVectorTests(IntFunction<double[]> fa, 3253 IntFunction<boolean[]> fm) { 3254 double[] a = fa.apply(SPECIES.length()); 3255 double[] r = fr.apply(SPECIES.length()); 3256 boolean[] mask = fm.apply(SPECIES.length()); 3257 VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0); 3258 3259 for (int ic = 0; ic < INVOC_COUNT; ic++) { 3260 for (int i = 0; i < a.length; i += SPECIES.length()) { 3261 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); 3262 av.lanewise(VectorOperators.NEG, vmask).intoArray(r, i); 3263 } 3264 } 3265 3266 assertArraysEquals(a, r, mask, DoubleMaxVectorTests::NEG); 3267 } 3268 |