846 @Override
847 @ForceInline
848 public int minAll(Mask<Integer> m) {
849 return blend((Int256Vector)IntVector.broadcast(SPECIES, Integer.MAX_VALUE), m).minAll();
850 }
851
852 @Override
853 @ForceInline
854 public int maxAll(Mask<Integer> m) {
855 return blend((Int256Vector)IntVector.broadcast(SPECIES, Integer.MIN_VALUE), m).maxAll();
856 }
857
858 @Override
859 @ForceInline
860 public Shuffle<Integer> toShuffle() {
861 int[] 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 IntVector.shuffleFromArray(SPECIES, sa, 0);
867 }
868
869 // Memory operations
870
871 private static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_INT_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(int[] a, int ix) {
877 Objects.requireNonNull(a);
878 ix = VectorIntrinsics.checkIndex(ix, a.length, LENGTH);
879 VectorIntrinsics.store(Int256Vector.class, int.class, LENGTH,
880 a, (((long) ix) << ARRAY_SHIFT) + Unsafe.ARRAY_INT_BASE_OFFSET,
881 this,
882 a, ix,
883 (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e));
884 }
885
886 @Override
1341 Int256Mask m = (Int256Mask)o;
1342 return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Int256Mask.class, int.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, Int256Mask.class, int.class, LENGTH,
1353 this, this,
1354 (m, __) -> anyTrueHelper(((Int256Mask)m).getBits()));
1355 }
1356
1357 @Override
1358 @ForceInline
1359 public boolean allTrue() {
1360 return VectorIntrinsics.test(BT_overflow, Int256Mask.class, int.class, LENGTH,
1361 this, IntVector.maskAllTrue(species()),
1362 (m, __) -> allTrueHelper(((Int256Mask)m).getBits()));
1363 }
1364 }
1365
1366 // Shuffle
1367
1368 static final class Int256Shuffle extends AbstractShuffle<Integer> {
1369 Int256Shuffle(byte[] reorder) {
1370 super(reorder);
1371 }
1372
1373 public Int256Shuffle(int[] reorder) {
1374 super(reorder);
1375 }
1376
1377 public Int256Shuffle(int[] reorder, int i) {
1378 super(reorder, i);
1379 }
1380
1381 public Int256Shuffle(IntUnaryOperator f) {
1405 Class<?> stype = species.elementType();
1406 int [] shuffleArray = toArray();
1407 if (stype == byte.class) {
1408 return (Shuffle<F>) new Byte256Vector.Byte256Shuffle(shuffleArray);
1409 } else if (stype == short.class) {
1410 return (Shuffle<F>) new Short256Vector.Short256Shuffle(shuffleArray);
1411 } else if (stype == int.class) {
1412 return (Shuffle<F>) new Int256Vector.Int256Shuffle(shuffleArray);
1413 } else if (stype == long.class) {
1414 return (Shuffle<F>) new Long256Vector.Long256Shuffle(shuffleArray);
1415 } else if (stype == float.class) {
1416 return (Shuffle<F>) new Float256Vector.Float256Shuffle(shuffleArray);
1417 } else if (stype == double.class) {
1418 return (Shuffle<F>) new Double256Vector.Double256Shuffle(shuffleArray);
1419 } else {
1420 throw new UnsupportedOperationException("Bad lane type for casting.");
1421 }
1422 }
1423
1424 @Override
1425 public Int256Shuffle rearrange(Vector.Shuffle<Integer> o) {
1426 Int256Shuffle s = (Int256Shuffle) 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 Int256Shuffle(r);
1432 }
1433 }
1434
1435 // Species
1436
1437 @Override
1438 public Species<Integer> species() {
1439 return SPECIES;
1440 }
1441 }
|
846 @Override
847 @ForceInline
848 public int minAll(Mask<Integer> m) {
849 return blend((Int256Vector)IntVector.broadcast(SPECIES, Integer.MAX_VALUE), m).minAll();
850 }
851
852 @Override
853 @ForceInline
854 public int maxAll(Mask<Integer> m) {
855 return blend((Int256Vector)IntVector.broadcast(SPECIES, Integer.MIN_VALUE), m).maxAll();
856 }
857
858 @Override
859 @ForceInline
860 public Shuffle<Integer> toShuffle() {
861 int[] 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_INT_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(int[] a, int ix) {
877 Objects.requireNonNull(a);
878 ix = VectorIntrinsics.checkIndex(ix, a.length, LENGTH);
879 VectorIntrinsics.store(Int256Vector.class, int.class, LENGTH,
880 a, (((long) ix) << ARRAY_SHIFT) + Unsafe.ARRAY_INT_BASE_OFFSET,
881 this,
882 a, ix,
883 (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e));
884 }
885
886 @Override
1341 Int256Mask m = (Int256Mask)o;
1342 return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Int256Mask.class, int.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, Int256Mask.class, int.class, LENGTH,
1353 this, this,
1354 (m, __) -> anyTrueHelper(((Int256Mask)m).getBits()));
1355 }
1356
1357 @Override
1358 @ForceInline
1359 public boolean allTrue() {
1360 return VectorIntrinsics.test(BT_overflow, Int256Mask.class, int.class, LENGTH,
1361 this, Mask.maskAllTrue(species()),
1362 (m, __) -> allTrueHelper(((Int256Mask)m).getBits()));
1363 }
1364 }
1365
1366 // Shuffle
1367
1368 static final class Int256Shuffle extends AbstractShuffle<Integer> {
1369 Int256Shuffle(byte[] reorder) {
1370 super(reorder);
1371 }
1372
1373 public Int256Shuffle(int[] reorder) {
1374 super(reorder);
1375 }
1376
1377 public Int256Shuffle(int[] reorder, int i) {
1378 super(reorder, i);
1379 }
1380
1381 public Int256Shuffle(IntUnaryOperator f) {
1405 Class<?> stype = species.elementType();
1406 int [] shuffleArray = toArray();
1407 if (stype == byte.class) {
1408 return (Shuffle<F>) new Byte256Vector.Byte256Shuffle(shuffleArray);
1409 } else if (stype == short.class) {
1410 return (Shuffle<F>) new Short256Vector.Short256Shuffle(shuffleArray);
1411 } else if (stype == int.class) {
1412 return (Shuffle<F>) new Int256Vector.Int256Shuffle(shuffleArray);
1413 } else if (stype == long.class) {
1414 return (Shuffle<F>) new Long256Vector.Long256Shuffle(shuffleArray);
1415 } else if (stype == float.class) {
1416 return (Shuffle<F>) new Float256Vector.Float256Shuffle(shuffleArray);
1417 } else if (stype == double.class) {
1418 return (Shuffle<F>) new Double256Vector.Double256Shuffle(shuffleArray);
1419 } else {
1420 throw new UnsupportedOperationException("Bad lane type for casting.");
1421 }
1422 }
1423
1424 @Override
1425 public Int256Shuffle rearrange(Shuffle<Integer> o) {
1426 Int256Shuffle s = (Int256Shuffle) 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 Int256Shuffle(r);
1432 }
1433 }
1434
1435 // Species
1436
1437 @Override
1438 public Species<Integer> species() {
1439 return SPECIES;
1440 }
1441 }
|