< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template

Print this page
*** 236,12 ***
                                ($masktype$)m, f);  // specialize
      }
  
      @ForceInline
      final @Override
!     $type$ rOp($type$ v, FBinOp f) {
!         return super.rOpTemplate(v, f);  // specialize
      }
  
      @Override
      @ForceInline
      public final <F>
--- 236,12 ---
                                ($masktype$)m, f);  // specialize
      }
  
      @ForceInline
      final @Override
!     $type$ rOp($type$ v, VectorMask<$Boxtype$> m, FBinOp f) {
!         return super.rOpTemplate(v, m, f);  // specialize
      }
  
      @Override
      @ForceInline
      public final <F>

*** 273,34 ***
      @ForceInline
      public $vectortype$ lanewise(Unary op) {
          return ($vectortype$) super.lanewiseTemplate(op);  // specialize
      }
  
      @Override
      @ForceInline
      public $vectortype$ lanewise(Binary op, Vector<$Boxtype$> v) {
          return ($vectortype$) super.lanewiseTemplate(op, v);  // specialize
      }
  
  #if[!FP]
      /*package-private*/
      @Override
      @ForceInline $vectortype$
      lanewiseShift(VectorOperators.Binary op, int e) {
          return ($vectortype$) super.lanewiseShiftTemplate(op, e);  // specialize
      }
  #end[!FP]
  
      /*package-private*/
      @Override
      @ForceInline
      public final
      $vectortype$
!     lanewise(VectorOperators.Ternary op, Vector<$Boxtype$> v1, Vector<$Boxtype$> v2) {
          return ($vectortype$) super.lanewiseTemplate(op, v1, v2);  // specialize
      }
  
      @Override
      @ForceInline
      public final
      $vectortype$ addIndex(int scale) {
          return ($vectortype$) super.addIndexTemplate(scale);  // specialize
--- 273,61 ---
      @ForceInline
      public $vectortype$ lanewise(Unary op) {
          return ($vectortype$) super.lanewiseTemplate(op);  // specialize
      }
  
+     @Override
+     @ForceInline
+     public $vectortype$ lanewise(Unary op, VectorMask<$Boxtype$> m) {
+         return ($vectortype$) super.lanewiseTemplate(op, $masktype$.class, ($masktype$) m);  // specialize
+     }
+ 
      @Override
      @ForceInline
      public $vectortype$ lanewise(Binary op, Vector<$Boxtype$> v) {
          return ($vectortype$) super.lanewiseTemplate(op, v);  // specialize
      }
  
+     @Override
+     @ForceInline
+     public $vectortype$ lanewise(Binary op, Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
+         return ($vectortype$) super.lanewiseTemplate(op, $masktype$.class, v, ($masktype$) m);  // specialize
+     }
+ 
  #if[!FP]
      /*package-private*/
      @Override
      @ForceInline $vectortype$
      lanewiseShift(VectorOperators.Binary op, int e) {
          return ($vectortype$) super.lanewiseShiftTemplate(op, e);  // specialize
      }
+ 
+     /*package-private*/
+     @Override
+     @ForceInline $vectortype$
+     lanewiseShift(VectorOperators.Binary op, int e, VectorMask<$Boxtype$> m) {
+         return ($vectortype$) super.lanewiseShiftTemplate(op, $masktype$.class, e, ($masktype$) m);  // specialize
+     }
  #end[!FP]
  
      /*package-private*/
      @Override
      @ForceInline
      public final
      $vectortype$
!     lanewise(Ternary op, Vector<$Boxtype$> v1, Vector<$Boxtype$> v2) {
          return ($vectortype$) super.lanewiseTemplate(op, v1, v2);  // specialize
      }
  
+     @Override
+     @ForceInline
+     public final
+     $vectortype$
+     lanewise(Ternary op, Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, VectorMask<$Boxtype$> m) {
+         return ($vectortype$) super.lanewiseTemplate(op, $masktype$.class, v1, v2, ($masktype$) m);  // specialize
+     }
+ 
      @Override
      @ForceInline
      public final
      $vectortype$ addIndex(int scale) {
          return ($vectortype$) super.addIndexTemplate(scale);  // specialize

*** 316,11 ***
  
      @Override
      @ForceInline
      public final $type$ reduceLanes(VectorOperators.Associative op,
                                      VectorMask<$Boxtype$> m) {
!         return super.reduceLanesTemplate(op, m);  // specialized
      }
  
      @Override
      @ForceInline
      public final long reduceLanesToLong(VectorOperators.Associative op) {
--- 343,11 ---
  
      @Override
      @ForceInline
      public final $type$ reduceLanes(VectorOperators.Associative op,
                                      VectorMask<$Boxtype$> m) {
!         return super.reduceLanesTemplate(op, $masktype$.class, ($masktype$) m);  // specialized
      }
  
      @Override
      @ForceInline
      public final long reduceLanesToLong(VectorOperators.Associative op) {

*** 329,11 ***
  
      @Override
      @ForceInline
      public final long reduceLanesToLong(VectorOperators.Associative op,
                                          VectorMask<$Boxtype$> m) {
!         return (long) super.reduceLanesTemplate(op, m);  // specialized
      }
  
      @ForceInline
      public VectorShuffle<$Boxtype$> toShuffle() {
          return super.toShuffleTemplate($shuffletype$.class); // specialize
--- 356,11 ---
  
      @Override
      @ForceInline
      public final long reduceLanesToLong(VectorOperators.Associative op,
                                          VectorMask<$Boxtype$> m) {
!         return (long) super.reduceLanesTemplate(op, $masktype$.class, ($masktype$) m);  // specialized
      }
  
      @ForceInline
      public VectorShuffle<$Boxtype$> toShuffle() {
          return super.toShuffleTemplate($shuffletype$.class); // specialize

*** 367,10 ***
--- 394,17 ---
      public final $masktype$ compare(Comparison op, long s) {
          return super.compareTemplate($masktype$.class, op, s);  // specialize
      }
  #end[!long]
  
+     @Override
+     @ForceInline
+     public final $masktype$ compare(Comparison op, Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
+         return super.compareTemplate($masktype$.class, op, v, ($masktype$) m);
+     }
+ 
+ 
      @Override
      @ForceInline
      public $vectortype$ blend(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
          return ($vectortype$)
              super.blendTemplate($masktype$.class,

*** 423,10 ***
--- 457,11 ---
      @ForceInline
      public $vectortype$ rearrange(VectorShuffle<$Boxtype$> shuffle,
                                    VectorMask<$Boxtype$> m) {
          return ($vectortype$)
              super.rearrangeTemplate($shuffletype$.class,
+                                     $masktype$.class,
                                      ($shuffletype$) shuffle,
                                      ($masktype$) m);  // specialize
      }
  
      @Override

*** 853,20 ***
          @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,
-                     $Type$$bits$Mask::defaultMaskCast);
-             }
-             return this.defaultMaskCast(species);
          }
  
          @Override
          @ForceInline
          public $masktype$ eq(VectorMask<$Boxtype$> mask) {
--- 888,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");
! 
!             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 $masktype$ eq(VectorMask<$Boxtype$> mask) {

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

*** 1059,56 ***
--- 1100,148 ---
      final
      $abstractvectortype$ fromArray0($type$[] a, int offset) {
          return super.fromArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     $abstractvectortype$ fromArray0($type$[] a, int offset, VectorMask<$Boxtype$> m) {
+         return super.fromArray0Template($masktype$.class, a, offset, ($masktype$) m);  // specialize
+     }
+ 
+ #if[!byteOrShort]
+     @ForceInline
+     @Override
+     final
+     $abstractvectortype$ fromArray0($type$[] a, int offset, int[] indexMap, int mapOffset, VectorMask<$Boxtype$> m) {
+         return super.fromArray0Template($masktype$.class, a, offset, indexMap, mapOffset, ($masktype$) m);
+     }
+ #end[!byteOrShort]
+ 
  #if[short]
      @ForceInline
      @Override
      final
      $abstractvectortype$ fromCharArray0(char[] a, int offset) {
          return super.fromCharArray0Template(a, offset);  // specialize
      }
+ 
+     @ForceInline
+     @Override
+     final
+     $abstractvectortype$ fromCharArray0(char[] a, int offset, VectorMask<$Boxtype$> m) {
+         return super.fromCharArray0Template($masktype$.class, a, offset, ($masktype$) m);  // specialize
+     }
  #end[short]
  
  #if[byte]
      @ForceInline
      @Override
      final
      $abstractvectortype$ fromBooleanArray0(boolean[] a, int offset) {
          return super.fromBooleanArray0Template(a, offset);  // specialize
      }
+ 
+     @ForceInline
+     @Override
+     final
+     $abstractvectortype$ fromBooleanArray0(boolean[] a, int offset, VectorMask<$Boxtype$> m) {
+         return super.fromBooleanArray0Template($masktype$.class, a, offset, ($masktype$) m);  // specialize
+     }
  #end[byte]
  
      @ForceInline
      @Override
      final
      $abstractvectortype$ fromByteArray0(byte[] a, int offset) {
          return super.fromByteArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     $abstractvectortype$ fromByteArray0(byte[] a, int offset, VectorMask<$Boxtype$> m) {
+         return super.fromByteArray0Template($masktype$.class, a, offset, ($masktype$) m);  // specialize
+     }
+ 
      @ForceInline
      @Override
      final
      $abstractvectortype$ fromByteBuffer0(ByteBuffer bb, int offset) {
          return super.fromByteBuffer0Template(bb, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     $abstractvectortype$ fromByteBuffer0(ByteBuffer bb, int offset, VectorMask<$Boxtype$> m) {
+         return super.fromByteBuffer0Template($masktype$.class, bb, offset, ($masktype$) m);  // specialize
+     }
+ 
      @ForceInline
      @Override
      final
      void intoArray0($type$[] a, int offset) {
          super.intoArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     void intoArray0($type$[] a, int offset, VectorMask<$Boxtype$> m) {
+         super.intoArray0Template($masktype$.class, a, offset, ($masktype$) m);
+     }
+ 
+ #if[!byteOrShort]
+     @ForceInline
+     @Override
+     final
+     void intoArray0($type$[] a, int offset, int[] indexMap, int mapOffset, VectorMask<$Boxtype$> m) {
+         super.intoArray0Template($masktype$.class, a, offset, indexMap, mapOffset, ($masktype$) m);
+     }
+ #end[!byteOrShort]
+ 
+ #if[byte]
+     @ForceInline
+     @Override
+     final
+     void intoBooleanArray0(boolean[] a, int offset, VectorMask<$Boxtype$> m) {
+         super.intoBooleanArray0Template($masktype$.class, a, offset, ($masktype$) m);
+     }
+ #end[byte]
+ 
      @ForceInline
      @Override
      final
      void intoByteArray0(byte[] a, int offset) {
          super.intoByteArray0Template(a, offset);  // specialize
      }
  
+     @ForceInline
+     @Override
+     final
+     void intoByteArray0(byte[] a, int offset, VectorMask<$Boxtype$> m) {
+         super.intoByteArray0Template($masktype$.class, a, offset, ($masktype$) m);  // specialize
+     }
+ 
+     @ForceInline
+     @Override
+     final
+     void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask<$Boxtype$> m) {
+         super.intoByteBuffer0Template($masktype$.class, bb, offset, ($masktype$) m);
+     }
+ 
+ #if[short]
+     @ForceInline
+     @Override
+     final
+     void intoCharArray0(char[] a, int offset, VectorMask<$Boxtype$> m) {
+         super.intoCharArray0Template($masktype$.class, a, offset, ($masktype$) m);
+     }
+ #end[short]
+ 
      // End of specialized low-level memory operations.
  
      // ================================================
  
  }
< prev index next >