< prev index next >

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

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

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

@@ -312,11 +339,11 @@
  
      @Override
      @ForceInline
      public final short reduceLanes(VectorOperators.Associative op,
                                      VectorMask<Short> m) {
-         return super.reduceLanesTemplate(op, m);  // specialized
+         return super.reduceLanesTemplate(op, ShortMaxMask.class, (ShortMaxMask) m);  // specialized
      }
  
      @Override
      @ForceInline
      public final long reduceLanesToLong(VectorOperators.Associative op) {

@@ -325,11 +352,11 @@
  
      @Override
      @ForceInline
      public final long reduceLanesToLong(VectorOperators.Associative op,
                                          VectorMask<Short> m) {
-         return (long) super.reduceLanesTemplate(op, m);  // specialized
+         return (long) super.reduceLanesTemplate(op, ShortMaxMask.class, (ShortMaxMask) m);  // specialized
      }
  
      @ForceInline
      public VectorShuffle<Short> toShuffle() {
          return super.toShuffleTemplate(ShortMaxShuffle.class); // specialize

@@ -361,10 +388,17 @@
      @ForceInline
      public final ShortMaxMask compare(Comparison op, long s) {
          return super.compareTemplate(ShortMaxMask.class, op, s);  // specialize
      }
  
+     @Override
+     @ForceInline
+     public final ShortMaxMask compare(Comparison op, Vector<Short> v, VectorMask<Short> m) {
+         return super.compareTemplate(ShortMaxMask.class, op, v, (ShortMaxMask) m);
+     }
+ 
+ 
      @Override
      @ForceInline
      public ShortMaxVector blend(Vector<Short> v, VectorMask<Short> m) {
          return (ShortMaxVector)
              super.blendTemplate(ShortMaxMask.class,

@@ -417,10 +451,11 @@
      @ForceInline
      public ShortMaxVector rearrange(VectorShuffle<Short> shuffle,
                                    VectorMask<Short> m) {
          return (ShortMaxVector)
              super.rearrangeTemplate(ShortMaxShuffle.class,
+                                     ShortMaxMask.class,
                                      (ShortMaxShuffle) shuffle,
                                      (ShortMaxMask) m);  // specialize
      }
  
      @Override

@@ -580,20 +615,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,
-                     ShortMaxMask::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 ShortMaxMask eq(VectorMask<Short> mask) {

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

@@ -771,46 +812,105 @@
      final
      ShortVector fromArray0(short[] a, int offset) {
          return super.fromArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     ShortVector fromArray0(short[] a, int offset, VectorMask<Short> m) {
+         return super.fromArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);  // specialize
+     }
+ 
+ 
      @ForceInline
      @Override
      final
      ShortVector fromCharArray0(char[] a, int offset) {
          return super.fromCharArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     ShortVector fromCharArray0(char[] a, int offset, VectorMask<Short> m) {
+         return super.fromCharArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);  // specialize
+     }
+ 
  
      @ForceInline
      @Override
      final
      ShortVector fromByteArray0(byte[] a, int offset) {
          return super.fromByteArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     ShortVector fromByteArray0(byte[] a, int offset, VectorMask<Short> m) {
+         return super.fromByteArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);  // specialize
+     }
+ 
      @ForceInline
      @Override
      final
      ShortVector fromByteBuffer0(ByteBuffer bb, int offset) {
          return super.fromByteBuffer0Template(bb, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     ShortVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask<Short> m) {
+         return super.fromByteBuffer0Template(ShortMaxMask.class, bb, offset, (ShortMaxMask) m);  // specialize
+     }
+ 
      @ForceInline
      @Override
      final
      void intoArray0(short[] a, int offset) {
          super.intoArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     void intoArray0(short[] a, int offset, VectorMask<Short> m) {
+         super.intoArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) 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<Short> m) {
+         super.intoByteArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);  // specialize
+     }
+ 
+     @ForceInline
+     @Override
+     final
+     void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask<Short> m) {
+         super.intoByteBuffer0Template(ShortMaxMask.class, bb, offset, (ShortMaxMask) m);
+     }
+ 
+     @ForceInline
+     @Override
+     final
+     void intoCharArray0(char[] a, int offset, VectorMask<Short> m) {
+         super.intoCharArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);
+     }
+ 
      // End of specialized low-level memory operations.
  
      // ================================================
  
  }
< prev index next >