< prev index next >

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

Print this page

 221 
 222     @ForceInline
 223     final @Override
 224     $vectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, FTriOp f) {
 225         return ($vectortype$)
 226             super.tOpTemplate(($vectortype$)v1, ($vectortype$)v2,
 227                               f);  // specialize
 228     }
 229 
 230     @ForceInline
 231     final @Override
 232     $vectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2,
 233                      VectorMask<$Boxtype$> m, FTriOp f) {
 234         return ($vectortype$)
 235             super.tOpTemplate(($vectortype$)v1, ($vectortype$)v2,
 236                               ($masktype$)m, f);  // specialize
 237     }
 238 
 239     @ForceInline
 240     final @Override
 241     $type$ rOp($type$ v, FBinOp f) {
 242         return super.rOpTemplate(v, f);  // specialize
 243     }
 244 
 245     @Override
 246     @ForceInline
 247     public final <F>
 248     Vector<F> convertShape(VectorOperators.Conversion<$Boxtype$,F> conv,
 249                            VectorSpecies<F> rsp, int part) {
 250         return super.convertShapeTemplate(conv, rsp, part);  // specialize
 251     }
 252 
 253     @Override
 254     @ForceInline
 255     public final <F>
 256     Vector<F> reinterpretShape(VectorSpecies<F> toSpecies, int part) {
 257         return super.reinterpretShapeTemplate(toSpecies, part);  // specialize
 258     }
 259 
 260     // Specialized algebraic operations:
 261 
 262     // The following definition forces a specialized version of this
 263     // crucial method into the v-table of this class.  A call to add()
 264     // will inline to a call to lanewise(ADD,), at which point the JIT
 265     // intrinsic will have the opcode of ADD, plus all the metadata
 266     // for this particular class, enabling it to generate precise
 267     // code.
 268     //
 269     // There is probably no benefit to the JIT to specialize the
 270     // masked or broadcast versions of the lanewise method.
 271 
 272     @Override
 273     @ForceInline
 274     public $vectortype$ lanewise(Unary op) {
 275         return ($vectortype$) super.lanewiseTemplate(op);  // specialize
 276     }
 277 






 278     @Override
 279     @ForceInline
 280     public $vectortype$ lanewise(Binary op, Vector<$Boxtype$> v) {
 281         return ($vectortype$) super.lanewiseTemplate(op, v);  // specialize
 282     }
 283 






 284 #if[!FP]
 285     /*package-private*/
 286     @Override
 287     @ForceInline $vectortype$
 288     lanewiseShift(VectorOperators.Binary op, int e) {
 289         return ($vectortype$) super.lanewiseShiftTemplate(op, e);  // specialize
 290     }







 291 #end[!FP]
 292 
 293     /*package-private*/
 294     @Override
 295     @ForceInline
 296     public final
 297     $vectortype$
 298     lanewise(VectorOperators.Ternary op, Vector<$Boxtype$> v1, Vector<$Boxtype$> v2) {
 299         return ($vectortype$) super.lanewiseTemplate(op, v1, v2);  // specialize
 300     }
 301 








 302     @Override
 303     @ForceInline
 304     public final
 305     $vectortype$ addIndex(int scale) {
 306         return ($vectortype$) super.addIndexTemplate(scale);  // specialize
 307     }
 308 
 309     // Type specific horizontal reductions
 310 
 311     @Override
 312     @ForceInline
 313     public final $type$ reduceLanes(VectorOperators.Associative op) {
 314         return super.reduceLanesTemplate(op);  // specialized
 315     }
 316 
 317     @Override
 318     @ForceInline
 319     public final $type$ reduceLanes(VectorOperators.Associative op,
 320                                     VectorMask<$Boxtype$> m) {
 321         return super.reduceLanesTemplate(op, m);  // specialized
 322     }
 323 
 324     @Override
 325     @ForceInline
 326     public final long reduceLanesToLong(VectorOperators.Associative op) {
 327         return (long) super.reduceLanesTemplate(op);  // specialized
 328     }
 329 
 330     @Override
 331     @ForceInline
 332     public final long reduceLanesToLong(VectorOperators.Associative op,
 333                                         VectorMask<$Boxtype$> m) {
 334         return (long) super.reduceLanesTemplate(op, m);  // specialized
 335     }
 336 
 337     @ForceInline
 338     public VectorShuffle<$Boxtype$> toShuffle() {
 339         return super.toShuffleTemplate($shuffletype$.class); // specialize
 340     }
 341 
 342     // Specialized unary testing
 343 
 344     @Override
 345     @ForceInline
 346     public final $masktype$ test(Test op) {
 347         return super.testTemplate($masktype$.class, op);  // specialize
 348     }
 349 
 350     // Specialized comparisons
 351 
 352     @Override
 353     @ForceInline
 354     public final $masktype$ compare(Comparison op, Vector<$Boxtype$> v) {
 355         return super.compareTemplate($masktype$.class, op, v);  // specialize
 356     }
 357 
 358     @Override
 359     @ForceInline
 360     public final $masktype$ compare(Comparison op, $type$ s) {
 361         return super.compareTemplate($masktype$.class, op, s);  // specialize
 362     }
 363 
 364 #if[!long]
 365     @Override
 366     @ForceInline
 367     public final $masktype$ compare(Comparison op, long s) {
 368         return super.compareTemplate($masktype$.class, op, s);  // specialize
 369     }
 370 #end[!long]
 371 







 372     @Override
 373     @ForceInline
 374     public $vectortype$ blend(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
 375         return ($vectortype$)
 376             super.blendTemplate($masktype$.class,
 377                                 ($vectortype$) v,
 378                                 ($masktype$) m);  // specialize
 379     }
 380 
 381     @Override
 382     @ForceInline
 383     public $vectortype$ slice(int origin, Vector<$Boxtype$> v) {
 384         return ($vectortype$) super.sliceTemplate(origin, v);  // specialize
 385     }
 386 
 387     @Override
 388     @ForceInline
 389     public $vectortype$ slice(int origin) {
 390         return ($vectortype$) super.sliceTemplate(origin);  // specialize
 391     }

 408     @Override
 409     @ForceInline
 410     public $vectortype$ unslice(int origin) {
 411         return ($vectortype$) super.unsliceTemplate(origin);  // specialize
 412     }
 413 
 414     @Override
 415     @ForceInline
 416     public $vectortype$ rearrange(VectorShuffle<$Boxtype$> s) {
 417         return ($vectortype$)
 418             super.rearrangeTemplate($shuffletype$.class,
 419                                     ($shuffletype$) s);  // specialize
 420     }
 421 
 422     @Override
 423     @ForceInline
 424     public $vectortype$ rearrange(VectorShuffle<$Boxtype$> shuffle,
 425                                   VectorMask<$Boxtype$> m) {
 426         return ($vectortype$)
 427             super.rearrangeTemplate($shuffletype$.class,

 428                                     ($shuffletype$) shuffle,
 429                                     ($masktype$) m);  // specialize
 430     }
 431 
 432     @Override
 433     @ForceInline
 434     public $vectortype$ rearrange(VectorShuffle<$Boxtype$> s,
 435                                   Vector<$Boxtype$> v) {
 436         return ($vectortype$)
 437             super.rearrangeTemplate($shuffletype$.class,
 438                                     ($shuffletype$) s,
 439                                     ($vectortype$) v);  // specialize
 440     }
 441 
 442     @Override
 443     @ForceInline
 444     public $vectortype$ selectFrom(Vector<$Boxtype$> v) {
 445         return ($vectortype$)
 446             super.selectFromTemplate(($vectortype$) v);  // specialize
 447     }

 838 
 839         /**
 840          * Helper function for lane-wise mask conversions.
 841          * This function kicks in after intrinsic failure.
 842          */
 843         @ForceInline
 844         private final <E>
 845         VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
 846             if (length() != dsp.laneCount())
 847                 throw new IllegalArgumentException("VectorMask length and species length differ");
 848             boolean[] maskArray = toArray();
 849             return  dsp.maskFactory(maskArray).check(dsp);
 850         }
 851 
 852         @Override
 853         @ForceInline
 854         public <E> VectorMask<E> cast(VectorSpecies<E> dsp) {
 855             AbstractSpecies<E> species = (AbstractSpecies<E>) dsp;
 856             if (length() != species.laneCount())
 857                 throw new IllegalArgumentException("VectorMask length and species length differ");
 858             if (VSIZE == species.vectorBitSize()) {
 859                 Class<?> dtype = species.elementType();
 860                 Class<?> dmtype = species.maskType();
 861                 return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET,
 862                     this.getClass(), ETYPE, VLENGTH,
 863                     dmtype, dtype, VLENGTH,
 864                     this, species,
 865                     $Type$$bits$Mask::defaultMaskCast);
 866             }
 867             return this.defaultMaskCast(species);
 868         }
 869 
 870         @Override
 871         @ForceInline
 872         public $masktype$ eq(VectorMask<$Boxtype$> mask) {
 873             Objects.requireNonNull(mask);
 874             $masktype$ m = ($masktype$)mask;
 875             return xor(m.not());
 876         }
 877 
 878         // Unary operations
 879 
 880         @Override
 881         @ForceInline
 882         public $masktype$ not() {
 883             return xor(maskAll(true));
 884         }
 885 
 886         // Binary operations
 887 
 888         @Override
 889         @ForceInline
 890         public $masktype$ and(VectorMask<$Boxtype$> mask) {
 891             Objects.requireNonNull(mask);
 892             $masktype$ m = ($masktype$)mask;
 893             return VectorSupport.binaryOp(VECTOR_OP_AND, $masktype$.class, $bitstype$.class, VLENGTH,
 894                                              this, m,
 895                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b));
 896         }
 897 
 898         @Override
 899         @ForceInline
 900         public $masktype$ or(VectorMask<$Boxtype$> mask) {
 901             Objects.requireNonNull(mask);
 902             $masktype$ m = ($masktype$)mask;
 903             return VectorSupport.binaryOp(VECTOR_OP_OR, $masktype$.class, $bitstype$.class, VLENGTH,
 904                                              this, m,
 905                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
 906         }
 907 
 908         @ForceInline
 909         /* package-private */
 910         $masktype$ xor(VectorMask<$Boxtype$> mask) {
 911             Objects.requireNonNull(mask);
 912             $masktype$ m = ($masktype$)mask;
 913             return VectorSupport.binaryOp(VECTOR_OP_XOR, $masktype$.class, $bitstype$.class, VLENGTH,
 914                                           this, m,
 915                                           (m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
 916         }
 917 
 918         // Mask Query operations
 919 
 920         @Override
 921         @ForceInline
 922         public int trueCount() {
 923             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, $masktype$.class, $bitstype$.class, VLENGTH, this,
 924                                                       (m) -> trueCountHelper((($masktype$)m).getBits()));
 925         }
 926 
 927         @Override
 928         @ForceInline
 929         public int firstTrue() {
 930             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, $masktype$.class, $bitstype$.class, VLENGTH, this,
 931                                                       (m) -> firstTrueHelper((($masktype$)m).getBits()));
 932         }
 933 
 934         @Override
 935         @ForceInline
 936         public int lastTrue() {
 937             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, $masktype$.class, $bitstype$.class, VLENGTH, this,
 938                                                       (m) -> lastTrueHelper((($masktype$)m).getBits()));










 939         }
 940 
 941         // Reductions
 942 
 943         @Override
 944         @ForceInline
 945         public boolean anyTrue() {
 946             return VectorSupport.test(BT_ne, $masktype$.class, $bitstype$.class, VLENGTH,
 947                                          this, vspecies().maskAll(true),
 948                                          (m, __) -> anyTrueHelper((($masktype$)m).getBits()));
 949         }
 950 
 951         @Override
 952         @ForceInline
 953         public boolean allTrue() {
 954             return VectorSupport.test(BT_overflow, $masktype$.class, $bitstype$.class, VLENGTH,
 955                                          this, vspecies().maskAll(true),
 956                                          (m, __) -> allTrueHelper((($masktype$)m).getBits()));
 957         }
 958 

1044             byte[] r = new byte[reorder1.length];
1045             for (int i = 0; i < reorder1.length; i++) {
1046                 int ssi = reorder2[i];
1047                 r[i] = reorder1[ssi];  // throws on exceptional index
1048             }
1049             return new $shuffletype$(r);
1050         }
1051     }
1052 
1053     // ================================================
1054 
1055     // Specialized low-level memory operations.
1056 
1057     @ForceInline
1058     @Override
1059     final
1060     $abstractvectortype$ fromArray0($type$[] a, int offset) {
1061         return super.fromArray0Template(a, offset);  // specialize
1062     }
1063 
















1064 #if[short]
1065     @ForceInline
1066     @Override
1067     final
1068     $abstractvectortype$ fromCharArray0(char[] a, int offset) {
1069         return super.fromCharArray0Template(a, offset);  // specialize
1070     }







1071 #end[short]
1072 
1073 #if[byte]
1074     @ForceInline
1075     @Override
1076     final
1077     $abstractvectortype$ fromBooleanArray0(boolean[] a, int offset) {
1078         return super.fromBooleanArray0Template(a, offset);  // specialize
1079     }







1080 #end[byte]
1081 
1082     @ForceInline
1083     @Override
1084     final
1085     $abstractvectortype$ fromByteArray0(byte[] a, int offset) {
1086         return super.fromByteArray0Template(a, offset);  // specialize
1087     }
1088 







1089     @ForceInline
1090     @Override
1091     final
1092     $abstractvectortype$ fromByteBuffer0(ByteBuffer bb, int offset) {
1093         return super.fromByteBuffer0Template(bb, offset);  // specialize
1094     }
1095 







1096     @ForceInline
1097     @Override
1098     final
1099     void intoArray0($type$[] a, int offset) {
1100         super.intoArray0Template(a, offset);  // specialize
1101     }
1102 

























1103     @ForceInline
1104     @Override
1105     final
1106     void intoByteArray0(byte[] a, int offset) {
1107         super.intoByteArray0Template(a, offset);  // specialize
1108     }
1109 























1110     // End of specialized low-level memory operations.
1111 
1112     // ================================================
1113 
1114 }

 221 
 222     @ForceInline
 223     final @Override
 224     $vectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, FTriOp f) {
 225         return ($vectortype$)
 226             super.tOpTemplate(($vectortype$)v1, ($vectortype$)v2,
 227                               f);  // specialize
 228     }
 229 
 230     @ForceInline
 231     final @Override
 232     $vectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2,
 233                      VectorMask<$Boxtype$> m, FTriOp f) {
 234         return ($vectortype$)
 235             super.tOpTemplate(($vectortype$)v1, ($vectortype$)v2,
 236                               ($masktype$)m, f);  // specialize
 237     }
 238 
 239     @ForceInline
 240     final @Override
 241     $type$ rOp($type$ v, VectorMask<$Boxtype$> m, FBinOp f) {
 242         return super.rOpTemplate(v, m, f);  // specialize
 243     }
 244 
 245     @Override
 246     @ForceInline
 247     public final <F>
 248     Vector<F> convertShape(VectorOperators.Conversion<$Boxtype$,F> conv,
 249                            VectorSpecies<F> rsp, int part) {
 250         return super.convertShapeTemplate(conv, rsp, part);  // specialize
 251     }
 252 
 253     @Override
 254     @ForceInline
 255     public final <F>
 256     Vector<F> reinterpretShape(VectorSpecies<F> toSpecies, int part) {
 257         return super.reinterpretShapeTemplate(toSpecies, part);  // specialize
 258     }
 259 
 260     // Specialized algebraic operations:
 261 
 262     // The following definition forces a specialized version of this
 263     // crucial method into the v-table of this class.  A call to add()
 264     // will inline to a call to lanewise(ADD,), at which point the JIT
 265     // intrinsic will have the opcode of ADD, plus all the metadata
 266     // for this particular class, enabling it to generate precise
 267     // code.
 268     //
 269     // There is probably no benefit to the JIT to specialize the
 270     // masked or broadcast versions of the lanewise method.
 271 
 272     @Override
 273     @ForceInline
 274     public $vectortype$ lanewise(Unary op) {
 275         return ($vectortype$) super.lanewiseTemplate(op);  // specialize
 276     }
 277 
 278     @Override
 279     @ForceInline
 280     public $vectortype$ lanewise(Unary op, VectorMask<$Boxtype$> m) {
 281         return ($vectortype$) super.lanewiseTemplate(op, $masktype$.class, ($masktype$) m);  // specialize
 282     }
 283 
 284     @Override
 285     @ForceInline
 286     public $vectortype$ lanewise(Binary op, Vector<$Boxtype$> v) {
 287         return ($vectortype$) super.lanewiseTemplate(op, v);  // specialize
 288     }
 289 
 290     @Override
 291     @ForceInline
 292     public $vectortype$ lanewise(Binary op, Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
 293         return ($vectortype$) super.lanewiseTemplate(op, $masktype$.class, v, ($masktype$) m);  // specialize
 294     }
 295 
 296 #if[!FP]
 297     /*package-private*/
 298     @Override
 299     @ForceInline $vectortype$
 300     lanewiseShift(VectorOperators.Binary op, int e) {
 301         return ($vectortype$) super.lanewiseShiftTemplate(op, e);  // specialize
 302     }
 303 
 304     /*package-private*/
 305     @Override
 306     @ForceInline $vectortype$
 307     lanewiseShift(VectorOperators.Binary op, int e, VectorMask<$Boxtype$> m) {
 308         return ($vectortype$) super.lanewiseShiftTemplate(op, $masktype$.class, e, ($masktype$) m);  // specialize
 309     }
 310 #end[!FP]
 311 
 312     /*package-private*/
 313     @Override
 314     @ForceInline
 315     public final
 316     $vectortype$
 317     lanewise(Ternary op, Vector<$Boxtype$> v1, Vector<$Boxtype$> v2) {
 318         return ($vectortype$) super.lanewiseTemplate(op, v1, v2);  // specialize
 319     }
 320 
 321     @Override
 322     @ForceInline
 323     public final
 324     $vectortype$
 325     lanewise(Ternary op, Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, VectorMask<$Boxtype$> m) {
 326         return ($vectortype$) super.lanewiseTemplate(op, $masktype$.class, v1, v2, ($masktype$) m);  // specialize
 327     }
 328 
 329     @Override
 330     @ForceInline
 331     public final
 332     $vectortype$ addIndex(int scale) {
 333         return ($vectortype$) super.addIndexTemplate(scale);  // specialize
 334     }
 335 
 336     // Type specific horizontal reductions
 337 
 338     @Override
 339     @ForceInline
 340     public final $type$ reduceLanes(VectorOperators.Associative op) {
 341         return super.reduceLanesTemplate(op);  // specialized
 342     }
 343 
 344     @Override
 345     @ForceInline
 346     public final $type$ reduceLanes(VectorOperators.Associative op,
 347                                     VectorMask<$Boxtype$> m) {
 348         return super.reduceLanesTemplate(op, $masktype$.class, ($masktype$) m);  // specialized
 349     }
 350 
 351     @Override
 352     @ForceInline
 353     public final long reduceLanesToLong(VectorOperators.Associative op) {
 354         return (long) super.reduceLanesTemplate(op);  // specialized
 355     }
 356 
 357     @Override
 358     @ForceInline
 359     public final long reduceLanesToLong(VectorOperators.Associative op,
 360                                         VectorMask<$Boxtype$> m) {
 361         return (long) super.reduceLanesTemplate(op, $masktype$.class, ($masktype$) m);  // specialized
 362     }
 363 
 364     @ForceInline
 365     public VectorShuffle<$Boxtype$> toShuffle() {
 366         return super.toShuffleTemplate($shuffletype$.class); // specialize
 367     }
 368 
 369     // Specialized unary testing
 370 
 371     @Override
 372     @ForceInline
 373     public final $masktype$ test(Test op) {
 374         return super.testTemplate($masktype$.class, op);  // specialize
 375     }
 376 
 377     // Specialized comparisons
 378 
 379     @Override
 380     @ForceInline
 381     public final $masktype$ compare(Comparison op, Vector<$Boxtype$> v) {
 382         return super.compareTemplate($masktype$.class, op, v);  // specialize
 383     }
 384 
 385     @Override
 386     @ForceInline
 387     public final $masktype$ compare(Comparison op, $type$ s) {
 388         return super.compareTemplate($masktype$.class, op, s);  // specialize
 389     }
 390 
 391 #if[!long]
 392     @Override
 393     @ForceInline
 394     public final $masktype$ compare(Comparison op, long s) {
 395         return super.compareTemplate($masktype$.class, op, s);  // specialize
 396     }
 397 #end[!long]
 398 
 399     @Override
 400     @ForceInline
 401     public final $masktype$ compare(Comparison op, Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
 402         return super.compareTemplate($masktype$.class, op, v, ($masktype$) m);
 403     }
 404 
 405 
 406     @Override
 407     @ForceInline
 408     public $vectortype$ blend(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
 409         return ($vectortype$)
 410             super.blendTemplate($masktype$.class,
 411                                 ($vectortype$) v,
 412                                 ($masktype$) m);  // specialize
 413     }
 414 
 415     @Override
 416     @ForceInline
 417     public $vectortype$ slice(int origin, Vector<$Boxtype$> v) {
 418         return ($vectortype$) super.sliceTemplate(origin, v);  // specialize
 419     }
 420 
 421     @Override
 422     @ForceInline
 423     public $vectortype$ slice(int origin) {
 424         return ($vectortype$) super.sliceTemplate(origin);  // specialize
 425     }

 442     @Override
 443     @ForceInline
 444     public $vectortype$ unslice(int origin) {
 445         return ($vectortype$) super.unsliceTemplate(origin);  // specialize
 446     }
 447 
 448     @Override
 449     @ForceInline
 450     public $vectortype$ rearrange(VectorShuffle<$Boxtype$> s) {
 451         return ($vectortype$)
 452             super.rearrangeTemplate($shuffletype$.class,
 453                                     ($shuffletype$) s);  // specialize
 454     }
 455 
 456     @Override
 457     @ForceInline
 458     public $vectortype$ rearrange(VectorShuffle<$Boxtype$> shuffle,
 459                                   VectorMask<$Boxtype$> m) {
 460         return ($vectortype$)
 461             super.rearrangeTemplate($shuffletype$.class,
 462                                     $masktype$.class,
 463                                     ($shuffletype$) shuffle,
 464                                     ($masktype$) m);  // specialize
 465     }
 466 
 467     @Override
 468     @ForceInline
 469     public $vectortype$ rearrange(VectorShuffle<$Boxtype$> s,
 470                                   Vector<$Boxtype$> v) {
 471         return ($vectortype$)
 472             super.rearrangeTemplate($shuffletype$.class,
 473                                     ($shuffletype$) s,
 474                                     ($vectortype$) v);  // specialize
 475     }
 476 
 477     @Override
 478     @ForceInline
 479     public $vectortype$ selectFrom(Vector<$Boxtype$> v) {
 480         return ($vectortype$)
 481             super.selectFromTemplate(($vectortype$) v);  // specialize
 482     }

 873 
 874         /**
 875          * Helper function for lane-wise mask conversions.
 876          * This function kicks in after intrinsic failure.
 877          */
 878         @ForceInline
 879         private final <E>
 880         VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
 881             if (length() != dsp.laneCount())
 882                 throw new IllegalArgumentException("VectorMask length and species length differ");
 883             boolean[] maskArray = toArray();
 884             return  dsp.maskFactory(maskArray).check(dsp);
 885         }
 886 
 887         @Override
 888         @ForceInline
 889         public <E> VectorMask<E> cast(VectorSpecies<E> dsp) {
 890             AbstractSpecies<E> species = (AbstractSpecies<E>) dsp;
 891             if (length() != species.laneCount())
 892                 throw new IllegalArgumentException("VectorMask length and species length differ");
 893 
 894             return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST,
 895                 this.getClass(), ETYPE, VLENGTH,
 896                 species.maskType(), species.elementType(), VLENGTH,
 897                 this, species,
 898                 (m, s) -> s.maskFactory(m.toArray()).check(s));




 899         }
 900 
 901         @Override
 902         @ForceInline
 903         public $masktype$ eq(VectorMask<$Boxtype$> mask) {
 904             Objects.requireNonNull(mask);
 905             $masktype$ m = ($masktype$)mask;
 906             return xor(m.not());
 907         }
 908 
 909         // Unary operations
 910 
 911         @Override
 912         @ForceInline
 913         public $masktype$ not() {
 914             return xor(maskAll(true));
 915         }
 916 
 917         // Binary operations
 918 
 919         @Override
 920         @ForceInline
 921         public $masktype$ and(VectorMask<$Boxtype$> mask) {
 922             Objects.requireNonNull(mask);
 923             $masktype$ m = ($masktype$)mask;
 924             return VectorSupport.binaryOp(VECTOR_OP_AND, $masktype$.class, null, $bitstype$.class, VLENGTH,
 925                                           this, m, null,
 926                                           (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b));
 927         }
 928 
 929         @Override
 930         @ForceInline
 931         public $masktype$ or(VectorMask<$Boxtype$> mask) {
 932             Objects.requireNonNull(mask);
 933             $masktype$ m = ($masktype$)mask;
 934             return VectorSupport.binaryOp(VECTOR_OP_OR, $masktype$.class, null, $bitstype$.class, VLENGTH,
 935                                           this, m, null,
 936                                           (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b));
 937         }
 938 
 939         @ForceInline
 940         /* package-private */
 941         $masktype$ xor(VectorMask<$Boxtype$> mask) {
 942             Objects.requireNonNull(mask);
 943             $masktype$ m = ($masktype$)mask;
 944             return VectorSupport.binaryOp(VECTOR_OP_XOR, $masktype$.class, null, $bitstype$.class, VLENGTH,
 945                                           this, m, null,
 946                                           (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b));
 947         }
 948 
 949         // Mask Query operations
 950 
 951         @Override
 952         @ForceInline
 953         public int trueCount() {
 954             return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, $masktype$.class, $bitstype$.class, VLENGTH, this,
 955                                                       (m) -> trueCountHelper(m.getBits()));
 956         }
 957 
 958         @Override
 959         @ForceInline
 960         public int firstTrue() {
 961             return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, $masktype$.class, $bitstype$.class, VLENGTH, this,
 962                                                       (m) -> firstTrueHelper(m.getBits()));
 963         }
 964 
 965         @Override
 966         @ForceInline
 967         public int lastTrue() {
 968             return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, $masktype$.class, $bitstype$.class, VLENGTH, this,
 969                                                       (m) -> lastTrueHelper(m.getBits()));
 970         }
 971 
 972         @Override
 973         @ForceInline
 974         public long toLong() {
 975             if (length() > Long.SIZE) {
 976                 throw new UnsupportedOperationException("too many lanes for one long");
 977             }
 978             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, $masktype$.class, $bitstype$.class, VLENGTH, this,
 979                                                       (m) -> toLongHelper(m.getBits()));
 980         }
 981 
 982         // Reductions
 983 
 984         @Override
 985         @ForceInline
 986         public boolean anyTrue() {
 987             return VectorSupport.test(BT_ne, $masktype$.class, $bitstype$.class, VLENGTH,
 988                                          this, vspecies().maskAll(true),
 989                                          (m, __) -> anyTrueHelper((($masktype$)m).getBits()));
 990         }
 991 
 992         @Override
 993         @ForceInline
 994         public boolean allTrue() {
 995             return VectorSupport.test(BT_overflow, $masktype$.class, $bitstype$.class, VLENGTH,
 996                                          this, vspecies().maskAll(true),
 997                                          (m, __) -> allTrueHelper((($masktype$)m).getBits()));
 998         }
 999 

1085             byte[] r = new byte[reorder1.length];
1086             for (int i = 0; i < reorder1.length; i++) {
1087                 int ssi = reorder2[i];
1088                 r[i] = reorder1[ssi];  // throws on exceptional index
1089             }
1090             return new $shuffletype$(r);
1091         }
1092     }
1093 
1094     // ================================================
1095 
1096     // Specialized low-level memory operations.
1097 
1098     @ForceInline
1099     @Override
1100     final
1101     $abstractvectortype$ fromArray0($type$[] a, int offset) {
1102         return super.fromArray0Template(a, offset);  // specialize
1103     }
1104 
1105     @ForceInline
1106     @Override
1107     final
1108     $abstractvectortype$ fromArray0($type$[] a, int offset, VectorMask<$Boxtype$> m) {
1109         return super.fromArray0Template($masktype$.class, a, offset, ($masktype$) m);  // specialize
1110     }
1111 
1112 #if[!byteOrShort]
1113     @ForceInline
1114     @Override
1115     final
1116     $abstractvectortype$ fromArray0($type$[] a, int offset, int[] indexMap, int mapOffset, VectorMask<$Boxtype$> m) {
1117         return super.fromArray0Template($masktype$.class, a, offset, indexMap, mapOffset, ($masktype$) m);
1118     }
1119 #end[!byteOrShort]
1120 
1121 #if[short]
1122     @ForceInline
1123     @Override
1124     final
1125     $abstractvectortype$ fromCharArray0(char[] a, int offset) {
1126         return super.fromCharArray0Template(a, offset);  // specialize
1127     }
1128 
1129     @ForceInline
1130     @Override
1131     final
1132     $abstractvectortype$ fromCharArray0(char[] a, int offset, VectorMask<$Boxtype$> m) {
1133         return super.fromCharArray0Template($masktype$.class, a, offset, ($masktype$) m);  // specialize
1134     }
1135 #end[short]
1136 
1137 #if[byte]
1138     @ForceInline
1139     @Override
1140     final
1141     $abstractvectortype$ fromBooleanArray0(boolean[] a, int offset) {
1142         return super.fromBooleanArray0Template(a, offset);  // specialize
1143     }
1144 
1145     @ForceInline
1146     @Override
1147     final
1148     $abstractvectortype$ fromBooleanArray0(boolean[] a, int offset, VectorMask<$Boxtype$> m) {
1149         return super.fromBooleanArray0Template($masktype$.class, a, offset, ($masktype$) m);  // specialize
1150     }
1151 #end[byte]
1152 
1153     @ForceInline
1154     @Override
1155     final
1156     $abstractvectortype$ fromByteArray0(byte[] a, int offset) {
1157         return super.fromByteArray0Template(a, offset);  // specialize
1158     }
1159 
1160     @ForceInline
1161     @Override
1162     final
1163     $abstractvectortype$ fromByteArray0(byte[] a, int offset, VectorMask<$Boxtype$> m) {
1164         return super.fromByteArray0Template($masktype$.class, a, offset, ($masktype$) m);  // specialize
1165     }
1166 
1167     @ForceInline
1168     @Override
1169     final
1170     $abstractvectortype$ fromByteBuffer0(ByteBuffer bb, int offset) {
1171         return super.fromByteBuffer0Template(bb, offset);  // specialize
1172     }
1173 
1174     @ForceInline
1175     @Override
1176     final
1177     $abstractvectortype$ fromByteBuffer0(ByteBuffer bb, int offset, VectorMask<$Boxtype$> m) {
1178         return super.fromByteBuffer0Template($masktype$.class, bb, offset, ($masktype$) m);  // specialize
1179     }
1180 
1181     @ForceInline
1182     @Override
1183     final
1184     void intoArray0($type$[] a, int offset) {
1185         super.intoArray0Template(a, offset);  // specialize
1186     }
1187 
1188     @ForceInline
1189     @Override
1190     final
1191     void intoArray0($type$[] a, int offset, VectorMask<$Boxtype$> m) {
1192         super.intoArray0Template($masktype$.class, a, offset, ($masktype$) m);
1193     }
1194 
1195 #if[!byteOrShort]
1196     @ForceInline
1197     @Override
1198     final
1199     void intoArray0($type$[] a, int offset, int[] indexMap, int mapOffset, VectorMask<$Boxtype$> m) {
1200         super.intoArray0Template($masktype$.class, a, offset, indexMap, mapOffset, ($masktype$) m);
1201     }
1202 #end[!byteOrShort]
1203 
1204 #if[byte]
1205     @ForceInline
1206     @Override
1207     final
1208     void intoBooleanArray0(boolean[] a, int offset, VectorMask<$Boxtype$> m) {
1209         super.intoBooleanArray0Template($masktype$.class, a, offset, ($masktype$) m);
1210     }
1211 #end[byte]
1212 
1213     @ForceInline
1214     @Override
1215     final
1216     void intoByteArray0(byte[] a, int offset) {
1217         super.intoByteArray0Template(a, offset);  // specialize
1218     }
1219 
1220     @ForceInline
1221     @Override
1222     final
1223     void intoByteArray0(byte[] a, int offset, VectorMask<$Boxtype$> m) {
1224         super.intoByteArray0Template($masktype$.class, a, offset, ($masktype$) m);  // specialize
1225     }
1226 
1227     @ForceInline
1228     @Override
1229     final
1230     void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask<$Boxtype$> m) {
1231         super.intoByteBuffer0Template($masktype$.class, bb, offset, ($masktype$) m);
1232     }
1233 
1234 #if[short]
1235     @ForceInline
1236     @Override
1237     final
1238     void intoCharArray0(char[] a, int offset, VectorMask<$Boxtype$> m) {
1239         super.intoCharArray0Template($masktype$.class, a, offset, ($masktype$) m);
1240     }
1241 #end[short]
1242 
1243     // End of specialized low-level memory operations.
1244 
1245     // ================================================
1246 
1247 }
< prev index next >