< prev index next >

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

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

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

@@ -312,11 +339,11 @@
  
      @Override
      @ForceInline
      public final int reduceLanes(VectorOperators.Associative op,
                                      VectorMask<Integer> m) {
-         return super.reduceLanesTemplate(op, m);  // specialized
+         return super.reduceLanesTemplate(op, Int128Mask.class, (Int128Mask) 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<Integer> m) {
-         return (long) super.reduceLanesTemplate(op, m);  // specialized
+         return (long) super.reduceLanesTemplate(op, Int128Mask.class, (Int128Mask) m);  // specialized
      }
  
      @ForceInline
      public VectorShuffle<Integer> toShuffle() {
          return super.toShuffleTemplate(Int128Shuffle.class); // specialize

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

@@ -417,10 +451,11 @@
      @ForceInline
      public Int128Vector rearrange(VectorShuffle<Integer> shuffle,
                                    VectorMask<Integer> m) {
          return (Int128Vector)
              super.rearrangeTemplate(Int128Shuffle.class,
+                                     Int128Mask.class,
                                      (Int128Shuffle) shuffle,
                                      (Int128Mask) m);  // specialize
      }
  
      @Override

@@ -586,20 +621,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,
-                     Int128Mask::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 Int128Mask eq(VectorMask<Integer> mask) {

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

@@ -777,40 +818,98 @@
      final
      IntVector fromArray0(int[] a, int offset) {
          return super.fromArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     IntVector fromArray0(int[] a, int offset, VectorMask<Integer> m) {
+         return super.fromArray0Template(Int128Mask.class, a, offset, (Int128Mask) m);  // specialize
+     }
+ 
+     @ForceInline
+     @Override
+     final
+     IntVector fromArray0(int[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Integer> m) {
+         return super.fromArray0Template(Int128Mask.class, a, offset, indexMap, mapOffset, (Int128Mask) m);
+     }
+ 
  
  
      @ForceInline
      @Override
      final
      IntVector fromByteArray0(byte[] a, int offset) {
          return super.fromByteArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     IntVector fromByteArray0(byte[] a, int offset, VectorMask<Integer> m) {
+         return super.fromByteArray0Template(Int128Mask.class, a, offset, (Int128Mask) m);  // specialize
+     }
+ 
      @ForceInline
      @Override
      final
      IntVector fromByteBuffer0(ByteBuffer bb, int offset) {
          return super.fromByteBuffer0Template(bb, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     IntVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask<Integer> m) {
+         return super.fromByteBuffer0Template(Int128Mask.class, bb, offset, (Int128Mask) m);  // specialize
+     }
+ 
      @ForceInline
      @Override
      final
      void intoArray0(int[] a, int offset) {
          super.intoArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     void intoArray0(int[] a, int offset, VectorMask<Integer> m) {
+         super.intoArray0Template(Int128Mask.class, a, offset, (Int128Mask) m);
+     }
+ 
+     @ForceInline
+     @Override
+     final
+     void intoArray0(int[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Integer> m) {
+         super.intoArray0Template(Int128Mask.class, a, offset, indexMap, mapOffset, (Int128Mask) 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<Integer> m) {
+         super.intoByteArray0Template(Int128Mask.class, a, offset, (Int128Mask) m);  // specialize
+     }
+ 
+     @ForceInline
+     @Override
+     final
+     void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask<Integer> m) {
+         super.intoByteBuffer0Template(Int128Mask.class, bb, offset, (Int128Mask) m);
+     }
+ 
+ 
      // End of specialized low-level memory operations.
  
      // ================================================
  
  }
< prev index next >