< prev index next >

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

Print this page




 905     @Override
 906     @ForceInline
 907     public double minAll(Mask<Double> m) {
 908         return blend((Double64Vector)DoubleVector.broadcast(SPECIES, Double.MAX_VALUE), m).minAll();
 909     }
 910 
 911     @Override
 912     @ForceInline
 913     public double maxAll(Mask<Double> m) {
 914         return blend((Double64Vector)DoubleVector.broadcast(SPECIES, Double.MIN_VALUE), m).maxAll();
 915     }
 916 
 917     @Override
 918     @ForceInline
 919     public Shuffle<Double> toShuffle() {
 920         double[] a = toArray();
 921         int[] sa = new int[a.length];
 922         for (int i = 0; i < a.length; i++) {
 923             sa[i] = (int) a[i];
 924         }
 925         return DoubleVector.shuffleFromArray(SPECIES, sa, 0);
 926     }
 927 
 928     // Memory operations
 929 
 930     private static final int ARRAY_SHIFT         = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_DOUBLE_INDEX_SCALE);
 931     private static final int BOOLEAN_ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
 932 
 933     @Override
 934     @ForceInline
 935     public void intoArray(double[] a, int ix) {
 936         Objects.requireNonNull(a);
 937         ix = VectorIntrinsics.checkIndex(ix, a.length, LENGTH);
 938         VectorIntrinsics.store(Double64Vector.class, double.class, LENGTH,
 939                                a, (((long) ix) << ARRAY_SHIFT) + Unsafe.ARRAY_DOUBLE_BASE_OFFSET,
 940                                this,
 941                                a, ix,
 942                                (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e));
 943     }
 944 
 945     @Override


1389             Double64Mask m = (Double64Mask)o;
1390             return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Double64Mask.class, long.class, LENGTH,
1391                                              this, m,
1392                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
1393         }
1394 
1395         // Reductions
1396 
1397         @Override
1398         @ForceInline
1399         public boolean anyTrue() {
1400             return VectorIntrinsics.test(BT_ne, Double64Mask.class, long.class, LENGTH,
1401                                          this, this,
1402                                          (m, __) -> anyTrueHelper(((Double64Mask)m).getBits()));
1403         }
1404 
1405         @Override
1406         @ForceInline
1407         public boolean allTrue() {
1408             return VectorIntrinsics.test(BT_overflow, Double64Mask.class, long.class, LENGTH,
1409                                          this, DoubleVector.maskAllTrue(species()),
1410                                          (m, __) -> allTrueHelper(((Double64Mask)m).getBits()));
1411         }
1412     }
1413 
1414     // Shuffle
1415 
1416     static final class Double64Shuffle extends AbstractShuffle<Double> {
1417         Double64Shuffle(byte[] reorder) {
1418             super(reorder);
1419         }
1420 
1421         public Double64Shuffle(int[] reorder) {
1422             super(reorder);
1423         }
1424 
1425         public Double64Shuffle(int[] reorder, int i) {
1426             super(reorder, i);
1427         }
1428 
1429         public Double64Shuffle(IntUnaryOperator f) {


1453             Class<?> stype = species.elementType();
1454             int [] shuffleArray = toArray();
1455             if (stype == byte.class) {
1456                 return (Shuffle<F>) new Byte64Vector.Byte64Shuffle(shuffleArray);
1457             } else if (stype == short.class) {
1458                 return (Shuffle<F>) new Short64Vector.Short64Shuffle(shuffleArray);
1459             } else if (stype == int.class) {
1460                 return (Shuffle<F>) new Int64Vector.Int64Shuffle(shuffleArray);
1461             } else if (stype == long.class) {
1462                 return (Shuffle<F>) new Long64Vector.Long64Shuffle(shuffleArray);
1463             } else if (stype == float.class) {
1464                 return (Shuffle<F>) new Float64Vector.Float64Shuffle(shuffleArray);
1465             } else if (stype == double.class) {
1466                 return (Shuffle<F>) new Double64Vector.Double64Shuffle(shuffleArray);
1467             } else {
1468                 throw new UnsupportedOperationException("Bad lane type for casting.");
1469             }
1470         }
1471 
1472         @Override
1473         public Double64Shuffle rearrange(Vector.Shuffle<Double> o) {
1474             Double64Shuffle s = (Double64Shuffle) o;
1475             byte[] r = new byte[reorder.length];
1476             for (int i = 0; i < reorder.length; i++) {
1477                 r[i] = reorder[s.reorder[i]];
1478             }
1479             return new Double64Shuffle(r);
1480         }
1481     }
1482 
1483     // Species
1484 
1485     @Override
1486     public Species<Double> species() {
1487         return SPECIES;
1488     }
1489 }


 905     @Override
 906     @ForceInline
 907     public double minAll(Mask<Double> m) {
 908         return blend((Double64Vector)DoubleVector.broadcast(SPECIES, Double.MAX_VALUE), m).minAll();
 909     }
 910 
 911     @Override
 912     @ForceInline
 913     public double maxAll(Mask<Double> m) {
 914         return blend((Double64Vector)DoubleVector.broadcast(SPECIES, Double.MIN_VALUE), m).maxAll();
 915     }
 916 
 917     @Override
 918     @ForceInline
 919     public Shuffle<Double> toShuffle() {
 920         double[] a = toArray();
 921         int[] sa = new int[a.length];
 922         for (int i = 0; i < a.length; i++) {
 923             sa[i] = (int) a[i];
 924         }
 925         return Shuffle.fromArray(SPECIES, sa, 0);
 926     }
 927 
 928     // Memory operations
 929 
 930     private static final int ARRAY_SHIFT         = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_DOUBLE_INDEX_SCALE);
 931     private static final int BOOLEAN_ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
 932 
 933     @Override
 934     @ForceInline
 935     public void intoArray(double[] a, int ix) {
 936         Objects.requireNonNull(a);
 937         ix = VectorIntrinsics.checkIndex(ix, a.length, LENGTH);
 938         VectorIntrinsics.store(Double64Vector.class, double.class, LENGTH,
 939                                a, (((long) ix) << ARRAY_SHIFT) + Unsafe.ARRAY_DOUBLE_BASE_OFFSET,
 940                                this,
 941                                a, ix,
 942                                (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e));
 943     }
 944 
 945     @Override


1389             Double64Mask m = (Double64Mask)o;
1390             return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Double64Mask.class, long.class, LENGTH,
1391                                              this, m,
1392                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
1393         }
1394 
1395         // Reductions
1396 
1397         @Override
1398         @ForceInline
1399         public boolean anyTrue() {
1400             return VectorIntrinsics.test(BT_ne, Double64Mask.class, long.class, LENGTH,
1401                                          this, this,
1402                                          (m, __) -> anyTrueHelper(((Double64Mask)m).getBits()));
1403         }
1404 
1405         @Override
1406         @ForceInline
1407         public boolean allTrue() {
1408             return VectorIntrinsics.test(BT_overflow, Double64Mask.class, long.class, LENGTH,
1409                                          this, Mask.maskAllTrue(species()),
1410                                          (m, __) -> allTrueHelper(((Double64Mask)m).getBits()));
1411         }
1412     }
1413 
1414     // Shuffle
1415 
1416     static final class Double64Shuffle extends AbstractShuffle<Double> {
1417         Double64Shuffle(byte[] reorder) {
1418             super(reorder);
1419         }
1420 
1421         public Double64Shuffle(int[] reorder) {
1422             super(reorder);
1423         }
1424 
1425         public Double64Shuffle(int[] reorder, int i) {
1426             super(reorder, i);
1427         }
1428 
1429         public Double64Shuffle(IntUnaryOperator f) {


1453             Class<?> stype = species.elementType();
1454             int [] shuffleArray = toArray();
1455             if (stype == byte.class) {
1456                 return (Shuffle<F>) new Byte64Vector.Byte64Shuffle(shuffleArray);
1457             } else if (stype == short.class) {
1458                 return (Shuffle<F>) new Short64Vector.Short64Shuffle(shuffleArray);
1459             } else if (stype == int.class) {
1460                 return (Shuffle<F>) new Int64Vector.Int64Shuffle(shuffleArray);
1461             } else if (stype == long.class) {
1462                 return (Shuffle<F>) new Long64Vector.Long64Shuffle(shuffleArray);
1463             } else if (stype == float.class) {
1464                 return (Shuffle<F>) new Float64Vector.Float64Shuffle(shuffleArray);
1465             } else if (stype == double.class) {
1466                 return (Shuffle<F>) new Double64Vector.Double64Shuffle(shuffleArray);
1467             } else {
1468                 throw new UnsupportedOperationException("Bad lane type for casting.");
1469             }
1470         }
1471 
1472         @Override
1473         public Double64Shuffle rearrange(Shuffle<Double> o) {
1474             Double64Shuffle s = (Double64Shuffle) o;
1475             byte[] r = new byte[reorder.length];
1476             for (int i = 0; i < reorder.length; i++) {
1477                 r[i] = reorder[s.reorder[i]];
1478             }
1479             return new Double64Shuffle(r);
1480         }
1481     }
1482 
1483     // Species
1484 
1485     @Override
1486     public Species<Double> species() {
1487         return SPECIES;
1488     }
1489 }
< prev index next >