< prev index next >

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

Print this page

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






276     @Override
277     @ForceInline
278     public ShortMaxVector lanewise(Binary op, Vector<Short> v) {
279         return (ShortMaxVector) super.lanewiseTemplate(op, v);  // specialize
280     }
281 






282     /*package-private*/
283     @Override
284     @ForceInline ShortMaxVector
285     lanewiseShift(VectorOperators.Binary op, int e) {
286         return (ShortMaxVector) super.lanewiseShiftTemplate(op, e);  // specialize
287     }
288 







289     /*package-private*/
290     @Override
291     @ForceInline
292     public final
293     ShortMaxVector
294     lanewise(VectorOperators.Ternary op, Vector<Short> v1, Vector<Short> v2) {
295         return (ShortMaxVector) super.lanewiseTemplate(op, v1, v2);  // specialize
296     }
297 








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







366     @Override
367     @ForceInline
368     public ShortMaxVector blend(Vector<Short> v, VectorMask<Short> m) {
369         return (ShortMaxVector)
370             super.blendTemplate(ShortMaxMask.class,
371                                 (ShortMaxVector) v,
372                                 (ShortMaxMask) m);  // specialize
373     }
374 
375     @Override
376     @ForceInline
377     public ShortMaxVector slice(int origin, Vector<Short> v) {
378         return (ShortMaxVector) super.sliceTemplate(origin, v);  // specialize
379     }
380 
381     @Override
382     @ForceInline
383     public ShortMaxVector slice(int origin) {
384         return (ShortMaxVector) super.sliceTemplate(origin);  // specialize
385     }

402     @Override
403     @ForceInline
404     public ShortMaxVector unslice(int origin) {
405         return (ShortMaxVector) super.unsliceTemplate(origin);  // specialize
406     }
407 
408     @Override
409     @ForceInline
410     public ShortMaxVector rearrange(VectorShuffle<Short> s) {
411         return (ShortMaxVector)
412             super.rearrangeTemplate(ShortMaxShuffle.class,
413                                     (ShortMaxShuffle) s);  // specialize
414     }
415 
416     @Override
417     @ForceInline
418     public ShortMaxVector rearrange(VectorShuffle<Short> shuffle,
419                                   VectorMask<Short> m) {
420         return (ShortMaxVector)
421             super.rearrangeTemplate(ShortMaxShuffle.class,

422                                     (ShortMaxShuffle) shuffle,
423                                     (ShortMaxMask) m);  // specialize
424     }
425 
426     @Override
427     @ForceInline
428     public ShortMaxVector rearrange(VectorShuffle<Short> s,
429                                   Vector<Short> v) {
430         return (ShortMaxVector)
431             super.rearrangeTemplate(ShortMaxShuffle.class,
432                                     (ShortMaxShuffle) s,
433                                     (ShortMaxVector) v);  // specialize
434     }
435 
436     @Override
437     @ForceInline
438     public ShortMaxVector selectFrom(Vector<Short> v) {
439         return (ShortMaxVector)
440             super.selectFromTemplate((ShortMaxVector) v);  // specialize
441     }

565 
566         /**
567          * Helper function for lane-wise mask conversions.
568          * This function kicks in after intrinsic failure.
569          */
570         @ForceInline
571         private final <E>
572         VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
573             if (length() != dsp.laneCount())
574                 throw new IllegalArgumentException("VectorMask length and species length differ");
575             boolean[] maskArray = toArray();
576             return  dsp.maskFactory(maskArray).check(dsp);
577         }
578 
579         @Override
580         @ForceInline
581         public <E> VectorMask<E> cast(VectorSpecies<E> dsp) {
582             AbstractSpecies<E> species = (AbstractSpecies<E>) dsp;
583             if (length() != species.laneCount())
584                 throw new IllegalArgumentException("VectorMask length and species length differ");
585             if (VSIZE == species.vectorBitSize()) {
586                 Class<?> dtype = species.elementType();
587                 Class<?> dmtype = species.maskType();
588                 return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET,
589                     this.getClass(), ETYPE, VLENGTH,
590                     dmtype, dtype, VLENGTH,
591                     this, species,
592                     ShortMaxMask::defaultMaskCast);
593             }
594             return this.defaultMaskCast(species);
595         }
596 
597         @Override
598         @ForceInline
599         public ShortMaxMask eq(VectorMask<Short> mask) {
600             Objects.requireNonNull(mask);
601             ShortMaxMask m = (ShortMaxMask)mask;
602             return xor(m.not());
603         }
604 
605         // Unary operations
606 
607         @Override
608         @ForceInline
609         public ShortMaxMask not() {
610             return xor(maskAll(true));
611         }
612 
613         // Binary operations
614 
615         @Override
616         @ForceInline
617         public ShortMaxMask and(VectorMask<Short> mask) {
618             Objects.requireNonNull(mask);
619             ShortMaxMask m = (ShortMaxMask)mask;
620             return VectorSupport.binaryOp(VECTOR_OP_AND, ShortMaxMask.class, short.class, VLENGTH,
621                                              this, m,
622                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b));
623         }
624 
625         @Override
626         @ForceInline
627         public ShortMaxMask or(VectorMask<Short> mask) {
628             Objects.requireNonNull(mask);
629             ShortMaxMask m = (ShortMaxMask)mask;
630             return VectorSupport.binaryOp(VECTOR_OP_OR, ShortMaxMask.class, short.class, VLENGTH,
631                                              this, m,
632                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
633         }
634 
635         @ForceInline
636         /* package-private */
637         ShortMaxMask xor(VectorMask<Short> mask) {
638             Objects.requireNonNull(mask);
639             ShortMaxMask m = (ShortMaxMask)mask;
640             return VectorSupport.binaryOp(VECTOR_OP_XOR, ShortMaxMask.class, short.class, VLENGTH,
641                                           this, m,
642                                           (m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
643         }
644 
645         // Mask Query operations
646 
647         @Override
648         @ForceInline
649         public int trueCount() {
650             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, ShortMaxMask.class, short.class, VLENGTH, this,
651                                                       (m) -> trueCountHelper(((ShortMaxMask)m).getBits()));
652         }
653 
654         @Override
655         @ForceInline
656         public int firstTrue() {
657             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, ShortMaxMask.class, short.class, VLENGTH, this,
658                                                       (m) -> firstTrueHelper(((ShortMaxMask)m).getBits()));
659         }
660 
661         @Override
662         @ForceInline
663         public int lastTrue() {
664             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, ShortMaxMask.class, short.class, VLENGTH, this,
665                                                       (m) -> lastTrueHelper(((ShortMaxMask)m).getBits()));










666         }
667 
668         // Reductions
669 
670         @Override
671         @ForceInline
672         public boolean anyTrue() {
673             return VectorSupport.test(BT_ne, ShortMaxMask.class, short.class, VLENGTH,
674                                          this, vspecies().maskAll(true),
675                                          (m, __) -> anyTrueHelper(((ShortMaxMask)m).getBits()));
676         }
677 
678         @Override
679         @ForceInline
680         public boolean allTrue() {
681             return VectorSupport.test(BT_overflow, ShortMaxMask.class, short.class, VLENGTH,
682                                          this, vspecies().maskAll(true),
683                                          (m, __) -> allTrueHelper(((ShortMaxMask)m).getBits()));
684         }
685 

756             byte[] r = new byte[reorder1.length];
757             for (int i = 0; i < reorder1.length; i++) {
758                 int ssi = reorder2[i];
759                 r[i] = reorder1[ssi];  // throws on exceptional index
760             }
761             return new ShortMaxShuffle(r);
762         }
763     }
764 
765     // ================================================
766 
767     // Specialized low-level memory operations.
768 
769     @ForceInline
770     @Override
771     final
772     ShortVector fromArray0(short[] a, int offset) {
773         return super.fromArray0Template(a, offset);  // specialize
774     }
775 








776     @ForceInline
777     @Override
778     final
779     ShortVector fromCharArray0(char[] a, int offset) {
780         return super.fromCharArray0Template(a, offset);  // specialize
781     }
782 







783 
784     @ForceInline
785     @Override
786     final
787     ShortVector fromByteArray0(byte[] a, int offset) {
788         return super.fromByteArray0Template(a, offset);  // specialize
789     }
790 







791     @ForceInline
792     @Override
793     final
794     ShortVector fromByteBuffer0(ByteBuffer bb, int offset) {
795         return super.fromByteBuffer0Template(bb, offset);  // specialize
796     }
797 







798     @ForceInline
799     @Override
800     final
801     void intoArray0(short[] a, int offset) {
802         super.intoArray0Template(a, offset);  // specialize
803     }
804 









805     @ForceInline
806     @Override
807     final
808     void intoByteArray0(byte[] a, int offset) {
809         super.intoByteArray0Template(a, offset);  // specialize
810     }
811 





















812     // End of specialized low-level memory operations.
813 
814     // ================================================
815 
816 }

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

436     @Override
437     @ForceInline
438     public ShortMaxVector unslice(int origin) {
439         return (ShortMaxVector) super.unsliceTemplate(origin);  // specialize
440     }
441 
442     @Override
443     @ForceInline
444     public ShortMaxVector rearrange(VectorShuffle<Short> s) {
445         return (ShortMaxVector)
446             super.rearrangeTemplate(ShortMaxShuffle.class,
447                                     (ShortMaxShuffle) s);  // specialize
448     }
449 
450     @Override
451     @ForceInline
452     public ShortMaxVector rearrange(VectorShuffle<Short> shuffle,
453                                   VectorMask<Short> m) {
454         return (ShortMaxVector)
455             super.rearrangeTemplate(ShortMaxShuffle.class,
456                                     ShortMaxMask.class,
457                                     (ShortMaxShuffle) shuffle,
458                                     (ShortMaxMask) m);  // specialize
459     }
460 
461     @Override
462     @ForceInline
463     public ShortMaxVector rearrange(VectorShuffle<Short> s,
464                                   Vector<Short> v) {
465         return (ShortMaxVector)
466             super.rearrangeTemplate(ShortMaxShuffle.class,
467                                     (ShortMaxShuffle) s,
468                                     (ShortMaxVector) v);  // specialize
469     }
470 
471     @Override
472     @ForceInline
473     public ShortMaxVector selectFrom(Vector<Short> v) {
474         return (ShortMaxVector)
475             super.selectFromTemplate((ShortMaxVector) v);  // specialize
476     }

600 
601         /**
602          * Helper function for lane-wise mask conversions.
603          * This function kicks in after intrinsic failure.
604          */
605         @ForceInline
606         private final <E>
607         VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
608             if (length() != dsp.laneCount())
609                 throw new IllegalArgumentException("VectorMask length and species length differ");
610             boolean[] maskArray = toArray();
611             return  dsp.maskFactory(maskArray).check(dsp);
612         }
613 
614         @Override
615         @ForceInline
616         public <E> VectorMask<E> cast(VectorSpecies<E> dsp) {
617             AbstractSpecies<E> species = (AbstractSpecies<E>) dsp;
618             if (length() != species.laneCount())
619                 throw new IllegalArgumentException("VectorMask length and species length differ");
620 
621             return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST,
622                 this.getClass(), ETYPE, VLENGTH,
623                 species.maskType(), species.elementType(), VLENGTH,
624                 this, species,
625                 (m, s) -> s.maskFactory(m.toArray()).check(s));




626         }
627 
628         @Override
629         @ForceInline
630         public ShortMaxMask eq(VectorMask<Short> mask) {
631             Objects.requireNonNull(mask);
632             ShortMaxMask m = (ShortMaxMask)mask;
633             return xor(m.not());
634         }
635 
636         // Unary operations
637 
638         @Override
639         @ForceInline
640         public ShortMaxMask not() {
641             return xor(maskAll(true));
642         }
643 
644         // Binary operations
645 
646         @Override
647         @ForceInline
648         public ShortMaxMask and(VectorMask<Short> mask) {
649             Objects.requireNonNull(mask);
650             ShortMaxMask m = (ShortMaxMask)mask;
651             return VectorSupport.binaryOp(VECTOR_OP_AND, ShortMaxMask.class, null, short.class, VLENGTH,
652                                           this, m, null,
653                                           (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b));
654         }
655 
656         @Override
657         @ForceInline
658         public ShortMaxMask or(VectorMask<Short> mask) {
659             Objects.requireNonNull(mask);
660             ShortMaxMask m = (ShortMaxMask)mask;
661             return VectorSupport.binaryOp(VECTOR_OP_OR, ShortMaxMask.class, null, short.class, VLENGTH,
662                                           this, m, null,
663                                           (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b));
664         }
665 
666         @ForceInline
667         /* package-private */
668         ShortMaxMask xor(VectorMask<Short> mask) {
669             Objects.requireNonNull(mask);
670             ShortMaxMask m = (ShortMaxMask)mask;
671             return VectorSupport.binaryOp(VECTOR_OP_XOR, ShortMaxMask.class, null, short.class, VLENGTH,
672                                           this, m, null,
673                                           (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b));
674         }
675 
676         // Mask Query operations
677 
678         @Override
679         @ForceInline
680         public int trueCount() {
681             return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, ShortMaxMask.class, short.class, VLENGTH, this,
682                                                       (m) -> trueCountHelper(m.getBits()));
683         }
684 
685         @Override
686         @ForceInline
687         public int firstTrue() {
688             return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, ShortMaxMask.class, short.class, VLENGTH, this,
689                                                       (m) -> firstTrueHelper(m.getBits()));
690         }
691 
692         @Override
693         @ForceInline
694         public int lastTrue() {
695             return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, ShortMaxMask.class, short.class, VLENGTH, this,
696                                                       (m) -> lastTrueHelper(m.getBits()));
697         }
698 
699         @Override
700         @ForceInline
701         public long toLong() {
702             if (length() > Long.SIZE) {
703                 throw new UnsupportedOperationException("too many lanes for one long");
704             }
705             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, ShortMaxMask.class, short.class, VLENGTH, this,
706                                                       (m) -> toLongHelper(m.getBits()));
707         }
708 
709         // Reductions
710 
711         @Override
712         @ForceInline
713         public boolean anyTrue() {
714             return VectorSupport.test(BT_ne, ShortMaxMask.class, short.class, VLENGTH,
715                                          this, vspecies().maskAll(true),
716                                          (m, __) -> anyTrueHelper(((ShortMaxMask)m).getBits()));
717         }
718 
719         @Override
720         @ForceInline
721         public boolean allTrue() {
722             return VectorSupport.test(BT_overflow, ShortMaxMask.class, short.class, VLENGTH,
723                                          this, vspecies().maskAll(true),
724                                          (m, __) -> allTrueHelper(((ShortMaxMask)m).getBits()));
725         }
726 

797             byte[] r = new byte[reorder1.length];
798             for (int i = 0; i < reorder1.length; i++) {
799                 int ssi = reorder2[i];
800                 r[i] = reorder1[ssi];  // throws on exceptional index
801             }
802             return new ShortMaxShuffle(r);
803         }
804     }
805 
806     // ================================================
807 
808     // Specialized low-level memory operations.
809 
810     @ForceInline
811     @Override
812     final
813     ShortVector fromArray0(short[] a, int offset) {
814         return super.fromArray0Template(a, offset);  // specialize
815     }
816 
817     @ForceInline
818     @Override
819     final
820     ShortVector fromArray0(short[] a, int offset, VectorMask<Short> m) {
821         return super.fromArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);  // specialize
822     }
823 
824 
825     @ForceInline
826     @Override
827     final
828     ShortVector fromCharArray0(char[] a, int offset) {
829         return super.fromCharArray0Template(a, offset);  // specialize
830     }
831 
832     @ForceInline
833     @Override
834     final
835     ShortVector fromCharArray0(char[] a, int offset, VectorMask<Short> m) {
836         return super.fromCharArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);  // specialize
837     }
838 
839 
840     @ForceInline
841     @Override
842     final
843     ShortVector fromByteArray0(byte[] a, int offset) {
844         return super.fromByteArray0Template(a, offset);  // specialize
845     }
846 
847     @ForceInline
848     @Override
849     final
850     ShortVector fromByteArray0(byte[] a, int offset, VectorMask<Short> m) {
851         return super.fromByteArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);  // specialize
852     }
853 
854     @ForceInline
855     @Override
856     final
857     ShortVector fromByteBuffer0(ByteBuffer bb, int offset) {
858         return super.fromByteBuffer0Template(bb, offset);  // specialize
859     }
860 
861     @ForceInline
862     @Override
863     final
864     ShortVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask<Short> m) {
865         return super.fromByteBuffer0Template(ShortMaxMask.class, bb, offset, (ShortMaxMask) m);  // specialize
866     }
867 
868     @ForceInline
869     @Override
870     final
871     void intoArray0(short[] a, int offset) {
872         super.intoArray0Template(a, offset);  // specialize
873     }
874 
875     @ForceInline
876     @Override
877     final
878     void intoArray0(short[] a, int offset, VectorMask<Short> m) {
879         super.intoArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);
880     }
881 
882 
883 
884     @ForceInline
885     @Override
886     final
887     void intoByteArray0(byte[] a, int offset) {
888         super.intoByteArray0Template(a, offset);  // specialize
889     }
890 
891     @ForceInline
892     @Override
893     final
894     void intoByteArray0(byte[] a, int offset, VectorMask<Short> m) {
895         super.intoByteArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);  // specialize
896     }
897 
898     @ForceInline
899     @Override
900     final
901     void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask<Short> m) {
902         super.intoByteBuffer0Template(ShortMaxMask.class, bb, offset, (ShortMaxMask) m);
903     }
904 
905     @ForceInline
906     @Override
907     final
908     void intoCharArray0(char[] a, int offset, VectorMask<Short> m) {
909         super.intoCharArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);
910     }
911 
912     // End of specialized low-level memory operations.
913 
914     // ================================================
915 
916 }
< prev index next >