< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java

Print this page




 846     @Override
 847     @ForceInline
 848     public long minAll(Mask<Long> m) {
 849         return blend((Long256Vector)LongVector.broadcast(SPECIES, Long.MAX_VALUE), m).minAll();
 850     }
 851 
 852     @Override
 853     @ForceInline
 854     public long maxAll(Mask<Long> m) {
 855         return blend((Long256Vector)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(Long256Vector.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             Long256Mask m = (Long256Mask)o;
1342             return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Long256Mask.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, Long256Mask.class, long.class, LENGTH,
1353                                          this, this,
1354                                          (m, __) -> anyTrueHelper(((Long256Mask)m).getBits()));
1355         }
1356 
1357         @Override
1358         @ForceInline
1359         public boolean allTrue() {
1360             return VectorIntrinsics.test(BT_overflow, Long256Mask.class, long.class, LENGTH,
1361                                          this, LongVector.maskAllTrue(species()),
1362                                          (m, __) -> allTrueHelper(((Long256Mask)m).getBits()));
1363         }
1364     }
1365 
1366     // Shuffle
1367 
1368     static final class Long256Shuffle extends AbstractShuffle<Long> {
1369         Long256Shuffle(byte[] reorder) {
1370             super(reorder);
1371         }
1372 
1373         public Long256Shuffle(int[] reorder) {
1374             super(reorder);
1375         }
1376 
1377         public Long256Shuffle(int[] reorder, int i) {
1378             super(reorder, i);
1379         }
1380 
1381         public Long256Shuffle(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 Long256Shuffle rearrange(Vector.Shuffle<Long> o) {
1426             Long256Shuffle s = (Long256Shuffle) 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 Long256Shuffle(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((Long256Vector)LongVector.broadcast(SPECIES, Long.MAX_VALUE), m).minAll();
 850     }
 851 
 852     @Override
 853     @ForceInline
 854     public long maxAll(Mask<Long> m) {
 855         return blend((Long256Vector)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(Long256Vector.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             Long256Mask m = (Long256Mask)o;
1342             return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Long256Mask.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, Long256Mask.class, long.class, LENGTH,
1353                                          this, this,
1354                                          (m, __) -> anyTrueHelper(((Long256Mask)m).getBits()));
1355         }
1356 
1357         @Override
1358         @ForceInline
1359         public boolean allTrue() {
1360             return VectorIntrinsics.test(BT_overflow, Long256Mask.class, long.class, LENGTH,
1361                                          this, Mask.maskAllTrue(species()),
1362                                          (m, __) -> allTrueHelper(((Long256Mask)m).getBits()));
1363         }
1364     }
1365 
1366     // Shuffle
1367 
1368     static final class Long256Shuffle extends AbstractShuffle<Long> {
1369         Long256Shuffle(byte[] reorder) {
1370             super(reorder);
1371         }
1372 
1373         public Long256Shuffle(int[] reorder) {
1374             super(reorder);
1375         }
1376 
1377         public Long256Shuffle(int[] reorder, int i) {
1378             super(reorder, i);
1379         }
1380 
1381         public Long256Shuffle(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 Long256Shuffle rearrange(Shuffle<Long> o) {
1426             Long256Shuffle s = (Long256Shuffle) 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 Long256Shuffle(r);
1432         }
1433     }
1434 
1435     // Species
1436 
1437     @Override
1438     public Species<Long> species() {
1439         return SPECIES;
1440     }
1441 }
< prev index next >