< prev index next >

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

Print this page
@@ -229,12 +229,12 @@
                                (Long64Mask)m, f);  // specialize
      }
  
      @ForceInline
      final @Override
-     long rOp(long v, FBinOp f) {
-         return super.rOpTemplate(v, f);  // specialize
+     long rOp(long v, VectorMask<Long> m, FBinOp f) {
+         return super.rOpTemplate(v, m, f);  // specialize
      }
  
      @Override
      @ForceInline
      public final <F>

@@ -266,32 +266,59 @@
      @ForceInline
      public Long64Vector lanewise(Unary op) {
          return (Long64Vector) super.lanewiseTemplate(op);  // specialize
      }
  
+     @Override
+     @ForceInline
+     public Long64Vector lanewise(Unary op, VectorMask<Long> m) {
+         return (Long64Vector) super.lanewiseTemplate(op, Long64Mask.class, (Long64Mask) m);  // specialize
+     }
+ 
      @Override
      @ForceInline
      public Long64Vector lanewise(Binary op, Vector<Long> v) {
          return (Long64Vector) super.lanewiseTemplate(op, v);  // specialize
      }
  
+     @Override
+     @ForceInline
+     public Long64Vector lanewise(Binary op, Vector<Long> v, VectorMask<Long> m) {
+         return (Long64Vector) super.lanewiseTemplate(op, Long64Mask.class, v, (Long64Mask) m);  // specialize
+     }
+ 
      /*package-private*/
      @Override
      @ForceInline Long64Vector
      lanewiseShift(VectorOperators.Binary op, int e) {
          return (Long64Vector) super.lanewiseShiftTemplate(op, e);  // specialize
      }
  
+     /*package-private*/
+     @Override
+     @ForceInline Long64Vector
+     lanewiseShift(VectorOperators.Binary op, int e, VectorMask<Long> m) {
+         return (Long64Vector) super.lanewiseShiftTemplate(op, Long64Mask.class, e, (Long64Mask) m);  // specialize
+     }
+ 
      /*package-private*/
      @Override
      @ForceInline
      public final
      Long64Vector
-     lanewise(VectorOperators.Ternary op, Vector<Long> v1, Vector<Long> v2) {
+     lanewise(Ternary op, Vector<Long> v1, Vector<Long> v2) {
          return (Long64Vector) super.lanewiseTemplate(op, v1, v2);  // specialize
      }
  
+     @Override
+     @ForceInline
+     public final
+     Long64Vector
+     lanewise(Ternary op, Vector<Long> v1, Vector<Long> v2, VectorMask<Long> m) {
+         return (Long64Vector) super.lanewiseTemplate(op, Long64Mask.class, v1, v2, (Long64Mask) m);  // specialize
+     }
+ 
      @Override
      @ForceInline
      public final
      Long64Vector addIndex(int scale) {
          return (Long64Vector) super.addIndexTemplate(scale);  // specialize

@@ -307,11 +334,11 @@
  
      @Override
      @ForceInline
      public final long reduceLanes(VectorOperators.Associative op,
                                      VectorMask<Long> m) {
-         return super.reduceLanesTemplate(op, m);  // specialized
+         return super.reduceLanesTemplate(op, Long64Mask.class, (Long64Mask) m);  // specialized
      }
  
      @Override
      @ForceInline
      public final long reduceLanesToLong(VectorOperators.Associative op) {

@@ -320,11 +347,11 @@
  
      @Override
      @ForceInline
      public final long reduceLanesToLong(VectorOperators.Associative op,
                                          VectorMask<Long> m) {
-         return (long) super.reduceLanesTemplate(op, m);  // specialized
+         return (long) super.reduceLanesTemplate(op, Long64Mask.class, (Long64Mask) m);  // specialized
      }
  
      @ForceInline
      public VectorShuffle<Long> toShuffle() {
          return super.toShuffleTemplate(Long64Shuffle.class); // specialize

@@ -351,10 +378,17 @@
      public final Long64Mask compare(Comparison op, long s) {
          return super.compareTemplate(Long64Mask.class, op, s);  // specialize
      }
  
  
+     @Override
+     @ForceInline
+     public final Long64Mask compare(Comparison op, Vector<Long> v, VectorMask<Long> m) {
+         return super.compareTemplate(Long64Mask.class, op, v, (Long64Mask) m);
+     }
+ 
+ 
      @Override
      @ForceInline
      public Long64Vector blend(Vector<Long> v, VectorMask<Long> m) {
          return (Long64Vector)
              super.blendTemplate(Long64Mask.class,

@@ -407,10 +441,11 @@
      @ForceInline
      public Long64Vector rearrange(VectorShuffle<Long> shuffle,
                                    VectorMask<Long> m) {
          return (Long64Vector)
              super.rearrangeTemplate(Long64Shuffle.class,
+                                     Long64Mask.class,
                                      (Long64Shuffle) shuffle,
                                      (Long64Mask) m);  // specialize
      }
  
      @Override

@@ -570,20 +605,16 @@
          @ForceInline
          public <E> VectorMask<E> cast(VectorSpecies<E> dsp) {
              AbstractSpecies<E> species = (AbstractSpecies<E>) dsp;
              if (length() != species.laneCount())
                  throw new IllegalArgumentException("VectorMask length and species length differ");
-             if (VSIZE == species.vectorBitSize()) {
-                 Class<?> dtype = species.elementType();
-                 Class<?> dmtype = species.maskType();
-                 return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET,
-                     this.getClass(), ETYPE, VLENGTH,
-                     dmtype, dtype, VLENGTH,
-                     this, species,
-                     Long64Mask::defaultMaskCast);
-             }
-             return this.defaultMaskCast(species);
+ 
+             return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST,
+                 this.getClass(), ETYPE, VLENGTH,
+                 species.maskType(), species.elementType(), VLENGTH,
+                 this, species,
+                 (m, s) -> s.maskFactory(m.toArray()).check(s));
          }
  
          @Override
          @ForceInline
          public Long64Mask eq(VectorMask<Long> mask) {

@@ -605,56 +636,66 @@
          @Override
          @ForceInline
          public Long64Mask and(VectorMask<Long> mask) {
              Objects.requireNonNull(mask);
              Long64Mask m = (Long64Mask)mask;
-             return VectorSupport.binaryOp(VECTOR_OP_AND, Long64Mask.class, long.class, VLENGTH,
-                                              this, m,
-                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b));
+             return VectorSupport.binaryOp(VECTOR_OP_AND, Long64Mask.class, null, long.class, VLENGTH,
+                                           this, m, null,
+                                           (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b));
          }
  
          @Override
          @ForceInline
          public Long64Mask or(VectorMask<Long> mask) {
              Objects.requireNonNull(mask);
              Long64Mask m = (Long64Mask)mask;
-             return VectorSupport.binaryOp(VECTOR_OP_OR, Long64Mask.class, long.class, VLENGTH,
-                                              this, m,
-                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
+             return VectorSupport.binaryOp(VECTOR_OP_OR, Long64Mask.class, null, long.class, VLENGTH,
+                                           this, m, null,
+                                           (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b));
          }
  
          @ForceInline
          /* package-private */
          Long64Mask xor(VectorMask<Long> mask) {
              Objects.requireNonNull(mask);
              Long64Mask m = (Long64Mask)mask;
-             return VectorSupport.binaryOp(VECTOR_OP_XOR, Long64Mask.class, long.class, VLENGTH,
-                                           this, m,
-                                           (m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
+             return VectorSupport.binaryOp(VECTOR_OP_XOR, Long64Mask.class, null, long.class, VLENGTH,
+                                           this, m, null,
+                                           (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b));
          }
  
          // Mask Query operations
  
          @Override
          @ForceInline
          public int trueCount() {
-             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long64Mask.class, long.class, VLENGTH, this,
-                                                       (m) -> trueCountHelper(((Long64Mask)m).getBits()));
+             return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long64Mask.class, long.class, VLENGTH, this,
+                                                       (m) -> trueCountHelper(m.getBits()));
          }
  
          @Override
          @ForceInline
          public int firstTrue() {
-             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long64Mask.class, long.class, VLENGTH, this,
-                                                       (m) -> firstTrueHelper(((Long64Mask)m).getBits()));
+             return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long64Mask.class, long.class, VLENGTH, this,
+                                                       (m) -> firstTrueHelper(m.getBits()));
          }
  
          @Override
          @ForceInline
          public int lastTrue() {
-             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long64Mask.class, long.class, VLENGTH, this,
-                                                       (m) -> lastTrueHelper(((Long64Mask)m).getBits()));
+             return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long64Mask.class, long.class, VLENGTH, this,
+                                                       (m) -> lastTrueHelper(m.getBits()));
+         }
+ 
+         @Override
+         @ForceInline
+         public long toLong() {
+             if (length() > Long.SIZE) {
+                 throw new UnsupportedOperationException("too many lanes for one long");
+             }
+             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Long64Mask.class, long.class, VLENGTH, this,
+                                                       (m) -> toLongHelper(m.getBits()));
          }
  
          // Reductions
  
          @Override

@@ -761,40 +802,98 @@
      final
      LongVector fromArray0(long[] a, int offset) {
          return super.fromArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     LongVector fromArray0(long[] a, int offset, VectorMask<Long> m) {
+         return super.fromArray0Template(Long64Mask.class, a, offset, (Long64Mask) m);  // specialize
+     }
+ 
+     @ForceInline
+     @Override
+     final
+     LongVector fromArray0(long[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Long> m) {
+         return super.fromArray0Template(Long64Mask.class, a, offset, indexMap, mapOffset, (Long64Mask) m);
+     }
+ 
  
  
      @ForceInline
      @Override
      final
      LongVector fromByteArray0(byte[] a, int offset) {
          return super.fromByteArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     LongVector fromByteArray0(byte[] a, int offset, VectorMask<Long> m) {
+         return super.fromByteArray0Template(Long64Mask.class, a, offset, (Long64Mask) m);  // specialize
+     }
+ 
      @ForceInline
      @Override
      final
      LongVector fromByteBuffer0(ByteBuffer bb, int offset) {
          return super.fromByteBuffer0Template(bb, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     LongVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask<Long> m) {
+         return super.fromByteBuffer0Template(Long64Mask.class, bb, offset, (Long64Mask) m);  // specialize
+     }
+ 
      @ForceInline
      @Override
      final
      void intoArray0(long[] a, int offset) {
          super.intoArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     void intoArray0(long[] a, int offset, VectorMask<Long> m) {
+         super.intoArray0Template(Long64Mask.class, a, offset, (Long64Mask) m);
+     }
+ 
+     @ForceInline
+     @Override
+     final
+     void intoArray0(long[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Long> m) {
+         super.intoArray0Template(Long64Mask.class, a, offset, indexMap, mapOffset, (Long64Mask) m);
+     }
+ 
+ 
      @ForceInline
      @Override
      final
      void intoByteArray0(byte[] a, int offset) {
          super.intoByteArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     void intoByteArray0(byte[] a, int offset, VectorMask<Long> m) {
+         super.intoByteArray0Template(Long64Mask.class, a, offset, (Long64Mask) m);  // specialize
+     }
+ 
+     @ForceInline
+     @Override
+     final
+     void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask<Long> m) {
+         super.intoByteBuffer0Template(Long64Mask.class, bb, offset, (Long64Mask) m);
+     }
+ 
+ 
      // End of specialized low-level memory operations.
  
      // ================================================
  
  }
< prev index next >