< prev index next >

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

Print this page
@@ -229,12 +229,12 @@
                                (Long128Mask)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 Long128Vector lanewise(Unary op) {
          return (Long128Vector) super.lanewiseTemplate(op);  // specialize
      }
  
+     @Override
+     @ForceInline
+     public Long128Vector lanewise(Unary op, VectorMask<Long> m) {
+         return (Long128Vector) super.lanewiseTemplate(op, Long128Mask.class, (Long128Mask) m);  // specialize
+     }
+ 
      @Override
      @ForceInline
      public Long128Vector lanewise(Binary op, Vector<Long> v) {
          return (Long128Vector) super.lanewiseTemplate(op, v);  // specialize
      }
  
+     @Override
+     @ForceInline
+     public Long128Vector lanewise(Binary op, Vector<Long> v, VectorMask<Long> m) {
+         return (Long128Vector) super.lanewiseTemplate(op, Long128Mask.class, v, (Long128Mask) m);  // specialize
+     }
+ 
      /*package-private*/
      @Override
      @ForceInline Long128Vector
      lanewiseShift(VectorOperators.Binary op, int e) {
          return (Long128Vector) super.lanewiseShiftTemplate(op, e);  // specialize
      }
  
+     /*package-private*/
+     @Override
+     @ForceInline Long128Vector
+     lanewiseShift(VectorOperators.Binary op, int e, VectorMask<Long> m) {
+         return (Long128Vector) super.lanewiseShiftTemplate(op, Long128Mask.class, e, (Long128Mask) m);  // specialize
+     }
+ 
      /*package-private*/
      @Override
      @ForceInline
      public final
      Long128Vector
-     lanewise(VectorOperators.Ternary op, Vector<Long> v1, Vector<Long> v2) {
+     lanewise(Ternary op, Vector<Long> v1, Vector<Long> v2) {
          return (Long128Vector) super.lanewiseTemplate(op, v1, v2);  // specialize
      }
  
+     @Override
+     @ForceInline
+     public final
+     Long128Vector
+     lanewise(Ternary op, Vector<Long> v1, Vector<Long> v2, VectorMask<Long> m) {
+         return (Long128Vector) super.lanewiseTemplate(op, Long128Mask.class, v1, v2, (Long128Mask) m);  // specialize
+     }
+ 
      @Override
      @ForceInline
      public final
      Long128Vector addIndex(int scale) {
          return (Long128Vector) 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, Long128Mask.class, (Long128Mask) 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, Long128Mask.class, (Long128Mask) m);  // specialized
      }
  
      @ForceInline
      public VectorShuffle<Long> toShuffle() {
          return super.toShuffleTemplate(Long128Shuffle.class); // specialize

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

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

@@ -572,20 +607,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,
-                     Long128Mask::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 Long128Mask eq(VectorMask<Long> mask) {

@@ -607,56 +638,66 @@
          @Override
          @ForceInline
          public Long128Mask and(VectorMask<Long> mask) {
              Objects.requireNonNull(mask);
              Long128Mask m = (Long128Mask)mask;
-             return VectorSupport.binaryOp(VECTOR_OP_AND, Long128Mask.class, long.class, VLENGTH,
-                                              this, m,
-                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b));
+             return VectorSupport.binaryOp(VECTOR_OP_AND, Long128Mask.class, null, long.class, VLENGTH,
+                                           this, m, null,
+                                           (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b));
          }
  
          @Override
          @ForceInline
          public Long128Mask or(VectorMask<Long> mask) {
              Objects.requireNonNull(mask);
              Long128Mask m = (Long128Mask)mask;
-             return VectorSupport.binaryOp(VECTOR_OP_OR, Long128Mask.class, long.class, VLENGTH,
-                                              this, m,
-                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
+             return VectorSupport.binaryOp(VECTOR_OP_OR, Long128Mask.class, null, long.class, VLENGTH,
+                                           this, m, null,
+                                           (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b));
          }
  
          @ForceInline
          /* package-private */
          Long128Mask xor(VectorMask<Long> mask) {
              Objects.requireNonNull(mask);
              Long128Mask m = (Long128Mask)mask;
-             return VectorSupport.binaryOp(VECTOR_OP_XOR, Long128Mask.class, long.class, VLENGTH,
-                                           this, m,
-                                           (m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
+             return VectorSupport.binaryOp(VECTOR_OP_XOR, Long128Mask.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, Long128Mask.class, long.class, VLENGTH, this,
-                                                       (m) -> trueCountHelper(((Long128Mask)m).getBits()));
+             return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long128Mask.class, long.class, VLENGTH, this,
+                                                       (m) -> trueCountHelper(m.getBits()));
          }
  
          @Override
          @ForceInline
          public int firstTrue() {
-             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long128Mask.class, long.class, VLENGTH, this,
-                                                       (m) -> firstTrueHelper(((Long128Mask)m).getBits()));
+             return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long128Mask.class, long.class, VLENGTH, this,
+                                                       (m) -> firstTrueHelper(m.getBits()));
          }
  
          @Override
          @ForceInline
          public int lastTrue() {
-             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long128Mask.class, long.class, VLENGTH, this,
-                                                       (m) -> lastTrueHelper(((Long128Mask)m).getBits()));
+             return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long128Mask.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, Long128Mask.class, long.class, VLENGTH, this,
+                                                       (m) -> toLongHelper(m.getBits()));
          }
  
          // Reductions
  
          @Override

@@ -763,40 +804,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(Long128Mask.class, a, offset, (Long128Mask) m);  // specialize
+     }
+ 
+     @ForceInline
+     @Override
+     final
+     LongVector fromArray0(long[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Long> m) {
+         return super.fromArray0Template(Long128Mask.class, a, offset, indexMap, mapOffset, (Long128Mask) 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(Long128Mask.class, a, offset, (Long128Mask) 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(Long128Mask.class, bb, offset, (Long128Mask) 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(Long128Mask.class, a, offset, (Long128Mask) m);
+     }
+ 
+     @ForceInline
+     @Override
+     final
+     void intoArray0(long[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Long> m) {
+         super.intoArray0Template(Long128Mask.class, a, offset, indexMap, mapOffset, (Long128Mask) 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(Long128Mask.class, a, offset, (Long128Mask) m);  // specialize
+     }
+ 
+     @ForceInline
+     @Override
+     final
+     void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask<Long> m) {
+         super.intoByteBuffer0Template(Long128Mask.class, bb, offset, (Long128Mask) m);
+     }
+ 
+ 
      // End of specialized low-level memory operations.
  
      // ================================================
  
  }
< prev index next >