846 @Override
847 @ForceInline
848 public long minAll(Mask<Long> m) {
849 return blend((Long512Vector)LongVector.broadcast(SPECIES, Long.MAX_VALUE), m).minAll();
850 }
851
852 @Override
853 @ForceInline
854 public long maxAll(Mask<Long> m) {
855 return blend((Long512Vector)LongVector.broadcast(SPECIES, Long.MIN_VALUE), m).maxAll();
856 }
857
858 @Override
859 @ForceInline
860 public Shuffle<Long> toShuffle() {
861 long[] a = toArray();
862 int[] sa = new int[a.length];
863 for (int i = 0; i < a.length; i++) {
864 sa[i] = (int) a[i];
865 }
866 return LongVector.shuffleFromArray(SPECIES, sa, 0);
867 }
868
869 // Memory operations
870
871 private static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_LONG_INDEX_SCALE);
872 private static final int BOOLEAN_ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
873
874 @Override
875 @ForceInline
876 public void intoArray(long[] a, int ix) {
877 Objects.requireNonNull(a);
878 ix = VectorIntrinsics.checkIndex(ix, a.length, LENGTH);
879 VectorIntrinsics.store(Long512Vector.class, long.class, LENGTH,
880 a, (((long) ix) << ARRAY_SHIFT) + Unsafe.ARRAY_LONG_BASE_OFFSET,
881 this,
882 a, ix,
883 (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e));
884 }
885
886 @Override
1341 Long512Mask m = (Long512Mask)o;
1342 return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Long512Mask.class, long.class, LENGTH,
1343 this, m,
1344 (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
1345 }
1346
1347 // Reductions
1348
1349 @Override
1350 @ForceInline
1351 public boolean anyTrue() {
1352 return VectorIntrinsics.test(BT_ne, Long512Mask.class, long.class, LENGTH,
1353 this, this,
1354 (m, __) -> anyTrueHelper(((Long512Mask)m).getBits()));
1355 }
1356
1357 @Override
1358 @ForceInline
1359 public boolean allTrue() {
1360 return VectorIntrinsics.test(BT_overflow, Long512Mask.class, long.class, LENGTH,
1361 this, LongVector.maskAllTrue(species()),
1362 (m, __) -> allTrueHelper(((Long512Mask)m).getBits()));
1363 }
1364 }
1365
1366 // Shuffle
1367
1368 static final class Long512Shuffle extends AbstractShuffle<Long> {
1369 Long512Shuffle(byte[] reorder) {
1370 super(reorder);
1371 }
1372
1373 public Long512Shuffle(int[] reorder) {
1374 super(reorder);
1375 }
1376
1377 public Long512Shuffle(int[] reorder, int i) {
1378 super(reorder, i);
1379 }
1380
1381 public Long512Shuffle(IntUnaryOperator f) {
1405 Class<?> stype = species.elementType();
1406 int [] shuffleArray = toArray();
1407 if (stype == byte.class) {
1408 return (Shuffle<F>) new Byte512Vector.Byte512Shuffle(shuffleArray);
1409 } else if (stype == short.class) {
1410 return (Shuffle<F>) new Short512Vector.Short512Shuffle(shuffleArray);
1411 } else if (stype == int.class) {
1412 return (Shuffle<F>) new Int512Vector.Int512Shuffle(shuffleArray);
1413 } else if (stype == long.class) {
1414 return (Shuffle<F>) new Long512Vector.Long512Shuffle(shuffleArray);
1415 } else if (stype == float.class) {
1416 return (Shuffle<F>) new Float512Vector.Float512Shuffle(shuffleArray);
1417 } else if (stype == double.class) {
1418 return (Shuffle<F>) new Double512Vector.Double512Shuffle(shuffleArray);
1419 } else {
1420 throw new UnsupportedOperationException("Bad lane type for casting.");
1421 }
1422 }
1423
1424 @Override
1425 public Long512Shuffle rearrange(Vector.Shuffle<Long> o) {
1426 Long512Shuffle s = (Long512Shuffle) o;
1427 byte[] r = new byte[reorder.length];
1428 for (int i = 0; i < reorder.length; i++) {
1429 r[i] = reorder[s.reorder[i]];
1430 }
1431 return new Long512Shuffle(r);
1432 }
1433 }
1434
1435 // Species
1436
1437 @Override
1438 public Species<Long> species() {
1439 return SPECIES;
1440 }
1441 }
|
846 @Override
847 @ForceInline
848 public long minAll(Mask<Long> m) {
849 return blend((Long512Vector)LongVector.broadcast(SPECIES, Long.MAX_VALUE), m).minAll();
850 }
851
852 @Override
853 @ForceInline
854 public long maxAll(Mask<Long> m) {
855 return blend((Long512Vector)LongVector.broadcast(SPECIES, Long.MIN_VALUE), m).maxAll();
856 }
857
858 @Override
859 @ForceInline
860 public Shuffle<Long> toShuffle() {
861 long[] a = toArray();
862 int[] sa = new int[a.length];
863 for (int i = 0; i < a.length; i++) {
864 sa[i] = (int) a[i];
865 }
866 return Shuffle.fromArray(SPECIES, sa, 0);
867 }
868
869 // Memory operations
870
871 private static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_LONG_INDEX_SCALE);
872 private static final int BOOLEAN_ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
873
874 @Override
875 @ForceInline
876 public void intoArray(long[] a, int ix) {
877 Objects.requireNonNull(a);
878 ix = VectorIntrinsics.checkIndex(ix, a.length, LENGTH);
879 VectorIntrinsics.store(Long512Vector.class, long.class, LENGTH,
880 a, (((long) ix) << ARRAY_SHIFT) + Unsafe.ARRAY_LONG_BASE_OFFSET,
881 this,
882 a, ix,
883 (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e));
884 }
885
886 @Override
1341 Long512Mask m = (Long512Mask)o;
1342 return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Long512Mask.class, long.class, LENGTH,
1343 this, m,
1344 (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
1345 }
1346
1347 // Reductions
1348
1349 @Override
1350 @ForceInline
1351 public boolean anyTrue() {
1352 return VectorIntrinsics.test(BT_ne, Long512Mask.class, long.class, LENGTH,
1353 this, this,
1354 (m, __) -> anyTrueHelper(((Long512Mask)m).getBits()));
1355 }
1356
1357 @Override
1358 @ForceInline
1359 public boolean allTrue() {
1360 return VectorIntrinsics.test(BT_overflow, Long512Mask.class, long.class, LENGTH,
1361 this, Mask.maskAllTrue(species()),
1362 (m, __) -> allTrueHelper(((Long512Mask)m).getBits()));
1363 }
1364 }
1365
1366 // Shuffle
1367
1368 static final class Long512Shuffle extends AbstractShuffle<Long> {
1369 Long512Shuffle(byte[] reorder) {
1370 super(reorder);
1371 }
1372
1373 public Long512Shuffle(int[] reorder) {
1374 super(reorder);
1375 }
1376
1377 public Long512Shuffle(int[] reorder, int i) {
1378 super(reorder, i);
1379 }
1380
1381 public Long512Shuffle(IntUnaryOperator f) {
1405 Class<?> stype = species.elementType();
1406 int [] shuffleArray = toArray();
1407 if (stype == byte.class) {
1408 return (Shuffle<F>) new Byte512Vector.Byte512Shuffle(shuffleArray);
1409 } else if (stype == short.class) {
1410 return (Shuffle<F>) new Short512Vector.Short512Shuffle(shuffleArray);
1411 } else if (stype == int.class) {
1412 return (Shuffle<F>) new Int512Vector.Int512Shuffle(shuffleArray);
1413 } else if (stype == long.class) {
1414 return (Shuffle<F>) new Long512Vector.Long512Shuffle(shuffleArray);
1415 } else if (stype == float.class) {
1416 return (Shuffle<F>) new Float512Vector.Float512Shuffle(shuffleArray);
1417 } else if (stype == double.class) {
1418 return (Shuffle<F>) new Double512Vector.Double512Shuffle(shuffleArray);
1419 } else {
1420 throw new UnsupportedOperationException("Bad lane type for casting.");
1421 }
1422 }
1423
1424 @Override
1425 public Long512Shuffle rearrange(Shuffle<Long> o) {
1426 Long512Shuffle s = (Long512Shuffle) o;
1427 byte[] r = new byte[reorder.length];
1428 for (int i = 0; i < reorder.length; i++) {
1429 r[i] = reorder[s.reorder[i]];
1430 }
1431 return new Long512Shuffle(r);
1432 }
1433 }
1434
1435 // Species
1436
1437 @Override
1438 public Species<Long> species() {
1439 return SPECIES;
1440 }
1441 }
|