1 /*
  2  * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.  Oracle designates this
  8  * particular file as subject to the "Classpath" exception as provided
  9  * by Oracle in the LICENSE file that accompanied this code.
 10  *
 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  */
 25 package jdk.incubator.vector;
 26 
 27 import java.nio.ByteBuffer;
 28 import java.util.Arrays;
 29 import java.util.Objects;
 30 import java.util.function.IntUnaryOperator;
 31 
 32 import jdk.internal.vm.annotation.ForceInline;
 33 import jdk.internal.vm.vector.VectorSupport;
 34 
 35 import static jdk.internal.vm.vector.VectorSupport.*;
 36 
 37 import static jdk.incubator.vector.VectorOperators.*;
 38 
 39 // -- This file was mechanically generated: Do not edit! -- //
 40 
 41 @SuppressWarnings("cast")  // warning: redundant cast
 42 final class Long256Vector extends LongVector {
 43     static final LongSpecies VSPECIES =
 44         (LongSpecies) LongVector.SPECIES_256;
 45 
 46     static final VectorShape VSHAPE =
 47         VSPECIES.vectorShape();
 48 
 49     static final Class<Long256Vector> VCLASS = Long256Vector.class;
 50 
 51     static final int VSIZE = VSPECIES.vectorBitSize();
 52 
 53     static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM
 54 
 55     static final Class<Long> ETYPE = long.class; // used by the JVM
 56 
 57     Long256Vector(long[] v) {
 58         super(v);
 59     }
 60 
 61     // For compatibility as Long256Vector::new,
 62     // stored into species.vectorFactory.
 63     Long256Vector(Object v) {
 64         this((long[]) v);
 65     }
 66 
 67     static final Long256Vector ZERO = new Long256Vector(new long[VLENGTH]);
 68     static final Long256Vector IOTA = new Long256Vector(VSPECIES.iotaArray());
 69 
 70     static {
 71         // Warm up a few species caches.
 72         // If we do this too much we will
 73         // get NPEs from bootstrap circularity.
 74         VSPECIES.dummyVector();
 75         VSPECIES.withLanes(LaneType.BYTE);
 76     }
 77 
 78     // Specialized extractors
 79 
 80     @ForceInline
 81     final @Override
 82     public LongSpecies vspecies() {
 83         // ISSUE:  This should probably be a @Stable
 84         // field inside AbstractVector, rather than
 85         // a megamorphic method.
 86         return VSPECIES;
 87     }
 88 
 89     @ForceInline
 90     @Override
 91     public final Class<Long> elementType() { return long.class; }
 92 
 93     @ForceInline
 94     @Override
 95     public final int elementSize() { return Long.SIZE; }
 96 
 97     @ForceInline
 98     @Override
 99     public final VectorShape shape() { return VSHAPE; }
100 
101     @ForceInline
102     @Override
103     public final int length() { return VLENGTH; }
104 
105     @ForceInline
106     @Override
107     public final int bitSize() { return VSIZE; }
108 
109     @ForceInline
110     @Override
111     public final int byteSize() { return VSIZE / Byte.SIZE; }
112 
113     /*package-private*/
114     @ForceInline
115     final @Override
116     long[] vec() {
117         return (long[])getPayload();
118     }
119 
120     // Virtualized constructors
121 
122     @Override
123     @ForceInline
124     public final Long256Vector broadcast(long e) {
125         return (Long256Vector) super.broadcastTemplate(e);  // specialize
126     }
127 
128 
129     @Override
130     @ForceInline
131     Long256Mask maskFromArray(boolean[] bits) {
132         return new Long256Mask(bits);
133     }
134 
135     @Override
136     @ForceInline
137     Long256Shuffle iotaShuffle() { return Long256Shuffle.IOTA; }
138 
139     @ForceInline
140     Long256Shuffle iotaShuffle(int start, int step, boolean wrap) {
141       if (wrap) {
142         return (Long256Shuffle)VectorSupport.shuffleIota(ETYPE, Long256Shuffle.class, VSPECIES, VLENGTH, start, step, 1,
143                 (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l))));
144       } else {
145         return (Long256Shuffle)VectorSupport.shuffleIota(ETYPE, Long256Shuffle.class, VSPECIES, VLENGTH, start, step, 0,
146                 (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart)));
147       }
148     }
149 
150     @Override
151     @ForceInline
152     Long256Shuffle shuffleFromBytes(byte[] reorder) { return new Long256Shuffle(reorder); }
153 
154     @Override
155     @ForceInline
156     Long256Shuffle shuffleFromArray(int[] indexes, int i) { return new Long256Shuffle(indexes, i); }
157 
158     @Override
159     @ForceInline
160     Long256Shuffle shuffleFromOp(IntUnaryOperator fn) { return new Long256Shuffle(fn); }
161 
162     // Make a vector of the same species but the given elements:
163     @ForceInline
164     final @Override
165     Long256Vector vectorFactory(long[] vec) {
166         return new Long256Vector(vec);
167     }
168 
169     @ForceInline
170     final @Override
171     Byte256Vector asByteVectorRaw() {
172         return (Byte256Vector) super.asByteVectorRawTemplate();  // specialize
173     }
174 
175     @ForceInline
176     final @Override
177     AbstractVector<?> asVectorRaw(LaneType laneType) {
178         return super.asVectorRawTemplate(laneType);  // specialize
179     }
180 
181     // Unary operator
182 
183     @ForceInline
184     final @Override
185     Long256Vector uOp(FUnOp f) {
186         return (Long256Vector) super.uOpTemplate(f);  // specialize
187     }
188 
189     @ForceInline
190     final @Override
191     Long256Vector uOp(VectorMask<Long> m, FUnOp f) {
192         return (Long256Vector)
193             super.uOpTemplate((Long256Mask)m, f);  // specialize
194     }
195 
196     // Binary operator
197 
198     @ForceInline
199     final @Override
200     Long256Vector bOp(Vector<Long> v, FBinOp f) {
201         return (Long256Vector) super.bOpTemplate((Long256Vector)v, f);  // specialize
202     }
203 
204     @ForceInline
205     final @Override
206     Long256Vector bOp(Vector<Long> v,
207                      VectorMask<Long> m, FBinOp f) {
208         return (Long256Vector)
209             super.bOpTemplate((Long256Vector)v, (Long256Mask)m,
210                               f);  // specialize
211     }
212 
213     // Ternary operator
214 
215     @ForceInline
216     final @Override
217     Long256Vector tOp(Vector<Long> v1, Vector<Long> v2, FTriOp f) {
218         return (Long256Vector)
219             super.tOpTemplate((Long256Vector)v1, (Long256Vector)v2,
220                               f);  // specialize
221     }
222 
223     @ForceInline
224     final @Override
225     Long256Vector tOp(Vector<Long> v1, Vector<Long> v2,
226                      VectorMask<Long> m, FTriOp f) {
227         return (Long256Vector)
228             super.tOpTemplate((Long256Vector)v1, (Long256Vector)v2,
229                               (Long256Mask)m, f);  // specialize
230     }
231 
232     @ForceInline
233     final @Override
234     long rOp(long v, FBinOp f) {
235         return super.rOpTemplate(v, f);  // specialize
236     }
237 
238     @Override
239     @ForceInline
240     public final <F>
241     Vector<F> convertShape(VectorOperators.Conversion<Long,F> conv,
242                            VectorSpecies<F> rsp, int part) {
243         return super.convertShapeTemplate(conv, rsp, part);  // specialize
244     }
245 
246     @Override
247     @ForceInline
248     public final <F>
249     Vector<F> reinterpretShape(VectorSpecies<F> toSpecies, int part) {
250         return super.reinterpretShapeTemplate(toSpecies, part);  // specialize
251     }
252 
253     // Specialized algebraic operations:
254 
255     // The following definition forces a specialized version of this
256     // crucial method into the v-table of this class.  A call to add()
257     // will inline to a call to lanewise(ADD,), at which point the JIT
258     // intrinsic will have the opcode of ADD, plus all the metadata
259     // for this particular class, enabling it to generate precise
260     // code.
261     //
262     // There is probably no benefit to the JIT to specialize the
263     // masked or broadcast versions of the lanewise method.
264 
265     @Override
266     @ForceInline
267     public Long256Vector lanewise(Unary op) {
268         return (Long256Vector) super.lanewiseTemplate(op);  // specialize
269     }
270 
271     @Override
272     @ForceInline
273     public Long256Vector lanewise(Binary op, Vector<Long> v) {
274         return (Long256Vector) super.lanewiseTemplate(op, v);  // specialize
275     }
276 
277     /*package-private*/
278     @Override
279     @ForceInline Long256Vector
280     lanewiseShift(VectorOperators.Binary op, int e) {
281         return (Long256Vector) super.lanewiseShiftTemplate(op, e);  // specialize
282     }
283 
284     /*package-private*/
285     @Override
286     @ForceInline
287     public final
288     Long256Vector
289     lanewise(VectorOperators.Ternary op, Vector<Long> v1, Vector<Long> v2) {
290         return (Long256Vector) super.lanewiseTemplate(op, v1, v2);  // specialize
291     }
292 
293     @Override
294     @ForceInline
295     public final
296     Long256Vector addIndex(int scale) {
297         return (Long256Vector) super.addIndexTemplate(scale);  // specialize
298     }
299 
300     // Type specific horizontal reductions
301 
302     @Override
303     @ForceInline
304     public final long reduceLanes(VectorOperators.Associative op) {
305         return super.reduceLanesTemplate(op);  // specialized
306     }
307 
308     @Override
309     @ForceInline
310     public final long reduceLanes(VectorOperators.Associative op,
311                                     VectorMask<Long> m) {
312         return super.reduceLanesTemplate(op, m);  // specialized
313     }
314 
315     @Override
316     @ForceInline
317     public final long reduceLanesToLong(VectorOperators.Associative op) {
318         return (long) super.reduceLanesTemplate(op);  // specialized
319     }
320 
321     @Override
322     @ForceInline
323     public final long reduceLanesToLong(VectorOperators.Associative op,
324                                         VectorMask<Long> m) {
325         return (long) super.reduceLanesTemplate(op, m);  // specialized
326     }
327 
328     @ForceInline
329     public VectorShuffle<Long> toShuffle() {
330         return super.toShuffleTemplate(Long256Shuffle.class); // specialize
331     }
332 
333     // Specialized unary testing
334 
335     @Override
336     @ForceInline
337     public final Long256Mask test(Test op) {
338         return super.testTemplate(Long256Mask.class, op);  // specialize
339     }
340 
341     // Specialized comparisons
342 
343     @Override
344     @ForceInline
345     public final Long256Mask compare(Comparison op, Vector<Long> v) {
346         return super.compareTemplate(Long256Mask.class, op, v);  // specialize
347     }
348 
349     @Override
350     @ForceInline
351     public final Long256Mask compare(Comparison op, long s) {
352         return super.compareTemplate(Long256Mask.class, op, s);  // specialize
353     }
354 
355 
356     @Override
357     @ForceInline
358     public Long256Vector blend(Vector<Long> v, VectorMask<Long> m) {
359         return (Long256Vector)
360             super.blendTemplate(Long256Mask.class,
361                                 (Long256Vector) v,
362                                 (Long256Mask) m);  // specialize
363     }
364 
365     @Override
366     @ForceInline
367     public Long256Vector slice(int origin, Vector<Long> v) {
368         return (Long256Vector) super.sliceTemplate(origin, v);  // specialize
369     }
370 
371     @Override
372     @ForceInline
373     public Long256Vector slice(int origin) {
374         return (Long256Vector) super.sliceTemplate(origin);  // specialize
375     }
376 
377     @Override
378     @ForceInline
379     public Long256Vector unslice(int origin, Vector<Long> w, int part) {
380         return (Long256Vector) super.unsliceTemplate(origin, w, part);  // specialize
381     }
382 
383     @Override
384     @ForceInline
385     public Long256Vector unslice(int origin, Vector<Long> w, int part, VectorMask<Long> m) {
386         return (Long256Vector)
387             super.unsliceTemplate(Long256Mask.class,
388                                   origin, w, part,
389                                   (Long256Mask) m);  // specialize
390     }
391 
392     @Override
393     @ForceInline
394     public Long256Vector unslice(int origin) {
395         return (Long256Vector) super.unsliceTemplate(origin);  // specialize
396     }
397 
398     @Override
399     @ForceInline
400     public Long256Vector rearrange(VectorShuffle<Long> s) {
401         return (Long256Vector)
402             super.rearrangeTemplate(Long256Shuffle.class,
403                                     (Long256Shuffle) s);  // specialize
404     }
405 
406     @Override
407     @ForceInline
408     public Long256Vector rearrange(VectorShuffle<Long> shuffle,
409                                   VectorMask<Long> m) {
410         return (Long256Vector)
411             super.rearrangeTemplate(Long256Shuffle.class,
412                                     (Long256Shuffle) shuffle,
413                                     (Long256Mask) m);  // specialize
414     }
415 
416     @Override
417     @ForceInline
418     public Long256Vector rearrange(VectorShuffle<Long> s,
419                                   Vector<Long> v) {
420         return (Long256Vector)
421             super.rearrangeTemplate(Long256Shuffle.class,
422                                     (Long256Shuffle) s,
423                                     (Long256Vector) v);  // specialize
424     }
425 
426     @Override
427     @ForceInline
428     public Long256Vector selectFrom(Vector<Long> v) {
429         return (Long256Vector)
430             super.selectFromTemplate((Long256Vector) v);  // specialize
431     }
432 
433     @Override
434     @ForceInline
435     public Long256Vector selectFrom(Vector<Long> v,
436                                    VectorMask<Long> m) {
437         return (Long256Vector)
438             super.selectFromTemplate((Long256Vector) v,
439                                      (Long256Mask) m);  // specialize
440     }
441 
442 
443     @ForceInline
444     @Override
445     public long lane(int i) {
446         switch(i) {
447             case 0: return laneHelper(0);
448             case 1: return laneHelper(1);
449             case 2: return laneHelper(2);
450             case 3: return laneHelper(3);
451             default: throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
452         }
453     }
454 
455     public long laneHelper(int i) {
456         return (long) VectorSupport.extract(
457                                 VCLASS, ETYPE, VLENGTH,
458                                 this, i,
459                                 (vec, ix) -> {
460                                     long[] vecarr = vec.vec();
461                                     return (long)vecarr[ix];
462                                 });
463     }
464 
465     @ForceInline
466     @Override
467     public Long256Vector withLane(int i, long e) {
468         switch (i) {
469             case 0: return withLaneHelper(0, e);
470             case 1: return withLaneHelper(1, e);
471             case 2: return withLaneHelper(2, e);
472             case 3: return withLaneHelper(3, e);
473             default: throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
474         }
475     }
476 
477     public Long256Vector withLaneHelper(int i, long e) {
478         return VectorSupport.insert(
479                                 VCLASS, ETYPE, VLENGTH,
480                                 this, i, (long)e,
481                                 (v, ix, bits) -> {
482                                     long[] res = v.vec().clone();
483                                     res[ix] = (long)bits;
484                                     return v.vectorFactory(res);
485                                 });
486     }
487 
488     // Mask
489 
490     static final class Long256Mask extends AbstractMask<Long> {
491         static final int VLENGTH = VSPECIES.laneCount();    // used by the JVM
492         static final Class<Long> ETYPE = long.class; // used by the JVM
493 
494         Long256Mask(boolean[] bits) {
495             this(bits, 0);
496         }
497 
498         Long256Mask(boolean[] bits, int offset) {
499             super(prepare(bits, offset));
500         }
501 
502         Long256Mask(boolean val) {
503             super(prepare(val));
504         }
505 
506         private static boolean[] prepare(boolean[] bits, int offset) {
507             boolean[] newBits = new boolean[VSPECIES.laneCount()];
508             for (int i = 0; i < newBits.length; i++) {
509                 newBits[i] = bits[offset + i];
510             }
511             return newBits;
512         }
513 
514         private static boolean[] prepare(boolean val) {
515             boolean[] bits = new boolean[VSPECIES.laneCount()];
516             Arrays.fill(bits, val);
517             return bits;
518         }
519 
520         @ForceInline
521         final @Override
522         public LongSpecies vspecies() {
523             // ISSUE:  This should probably be a @Stable
524             // field inside AbstractMask, rather than
525             // a megamorphic method.
526             return VSPECIES;
527         }
528 
529         @ForceInline
530         boolean[] getBits() {
531             return (boolean[])getPayload();
532         }
533 
534         @Override
535         Long256Mask uOp(MUnOp f) {
536             boolean[] res = new boolean[vspecies().laneCount()];
537             boolean[] bits = getBits();
538             for (int i = 0; i < res.length; i++) {
539                 res[i] = f.apply(i, bits[i]);
540             }
541             return new Long256Mask(res);
542         }
543 
544         @Override
545         Long256Mask bOp(VectorMask<Long> m, MBinOp f) {
546             boolean[] res = new boolean[vspecies().laneCount()];
547             boolean[] bits = getBits();
548             boolean[] mbits = ((Long256Mask)m).getBits();
549             for (int i = 0; i < res.length; i++) {
550                 res[i] = f.apply(i, bits[i], mbits[i]);
551             }
552             return new Long256Mask(res);
553         }
554 
555         @ForceInline
556         @Override
557         public final
558         Long256Vector toVector() {
559             return (Long256Vector) super.toVectorTemplate();  // specialize
560         }
561 
562         /**
563          * Helper function for lane-wise mask conversions.
564          * This function kicks in after intrinsic failure.
565          */
566         @ForceInline
567         private final <E>
568         VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
569             if (length() != dsp.laneCount())
570                 throw new IllegalArgumentException("VectorMask length and species length differ");
571             boolean[] maskArray = toArray();
572             return  dsp.maskFactory(maskArray).check(dsp);
573         }
574 
575         @Override
576         @ForceInline
577         public <E> VectorMask<E> cast(VectorSpecies<E> dsp) {
578             AbstractSpecies<E> species = (AbstractSpecies<E>) dsp;
579             if (length() != species.laneCount())
580                 throw new IllegalArgumentException("VectorMask length and species length differ");
581             if (VSIZE == species.vectorBitSize()) {
582                 Class<?> dtype = species.elementType();
583                 Class<?> dmtype = species.maskType();
584                 return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET,
585                     this.getClass(), ETYPE, VLENGTH,
586                     dmtype, dtype, VLENGTH,
587                     this, species,
588                     Long256Mask::defaultMaskCast);
589             }
590             return this.defaultMaskCast(species);
591         }
592 
593         @Override
594         @ForceInline
595         public Long256Mask eq(VectorMask<Long> mask) {
596             Objects.requireNonNull(mask);
597             Long256Mask m = (Long256Mask)mask;
598             return xor(m.not());
599         }
600 
601         // Unary operations
602 
603         @Override
604         @ForceInline
605         public Long256Mask not() {
606             return xor(maskAll(true));
607         }
608 
609         // Binary operations
610 
611         @Override
612         @ForceInline
613         public Long256Mask and(VectorMask<Long> mask) {
614             Objects.requireNonNull(mask);
615             Long256Mask m = (Long256Mask)mask;
616             return VectorSupport.binaryOp(VECTOR_OP_AND, Long256Mask.class, long.class, VLENGTH,
617                                              this, m,
618                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b));
619         }
620 
621         @Override
622         @ForceInline
623         public Long256Mask or(VectorMask<Long> mask) {
624             Objects.requireNonNull(mask);
625             Long256Mask m = (Long256Mask)mask;
626             return VectorSupport.binaryOp(VECTOR_OP_OR, Long256Mask.class, long.class, VLENGTH,
627                                              this, m,
628                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
629         }
630 
631         @ForceInline
632         /* package-private */
633         Long256Mask xor(VectorMask<Long> mask) {
634             Objects.requireNonNull(mask);
635             Long256Mask m = (Long256Mask)mask;
636             return VectorSupport.binaryOp(VECTOR_OP_XOR, Long256Mask.class, long.class, VLENGTH,
637                                           this, m,
638                                           (m1, m2) -> m1.bOp(m2, (i, a, b) -> a ^ b));
639         }
640 
641         // Mask Query operations
642 
643         @Override
644         @ForceInline
645         public int trueCount() {
646             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long256Mask.class, long.class, VLENGTH, this,
647                                                       (m) -> trueCountHelper(((Long256Mask)m).getBits()));
648         }
649 
650         @Override
651         @ForceInline
652         public int firstTrue() {
653             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long256Mask.class, long.class, VLENGTH, this,
654                                                       (m) -> firstTrueHelper(((Long256Mask)m).getBits()));
655         }
656 
657         @Override
658         @ForceInline
659         public int lastTrue() {
660             return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long256Mask.class, long.class, VLENGTH, this,
661                                                       (m) -> lastTrueHelper(((Long256Mask)m).getBits()));
662         }
663 
664         // Reductions
665 
666         @Override
667         @ForceInline
668         public boolean anyTrue() {
669             return VectorSupport.test(BT_ne, Long256Mask.class, long.class, VLENGTH,
670                                          this, vspecies().maskAll(true),
671                                          (m, __) -> anyTrueHelper(((Long256Mask)m).getBits()));
672         }
673 
674         @Override
675         @ForceInline
676         public boolean allTrue() {
677             return VectorSupport.test(BT_overflow, Long256Mask.class, long.class, VLENGTH,
678                                          this, vspecies().maskAll(true),
679                                          (m, __) -> allTrueHelper(((Long256Mask)m).getBits()));
680         }
681 
682         @ForceInline
683         /*package-private*/
684         static Long256Mask maskAll(boolean bit) {
685             return VectorSupport.broadcastCoerced(Long256Mask.class, long.class, VLENGTH,
686                                                   (bit ? -1 : 0), null,
687                                                   (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK));
688         }
689         private static final Long256Mask  TRUE_MASK = new Long256Mask(true);
690         private static final Long256Mask FALSE_MASK = new Long256Mask(false);
691 
692     }
693 
694     // Shuffle
695 
696     static final class Long256Shuffle extends AbstractShuffle<Long> {
697         static final int VLENGTH = VSPECIES.laneCount();    // used by the JVM
698         static final Class<Long> ETYPE = long.class; // used by the JVM
699 
700         Long256Shuffle(byte[] reorder) {
701             super(VLENGTH, reorder);
702         }
703 
704         public Long256Shuffle(int[] reorder) {
705             super(VLENGTH, reorder);
706         }
707 
708         public Long256Shuffle(int[] reorder, int i) {
709             super(VLENGTH, reorder, i);
710         }
711 
712         public Long256Shuffle(IntUnaryOperator fn) {
713             super(VLENGTH, fn);
714         }
715 
716         @Override
717         public LongSpecies vspecies() {
718             return VSPECIES;
719         }
720 
721         static {
722             // There must be enough bits in the shuffle lanes to encode
723             // VLENGTH valid indexes and VLENGTH exceptional ones.
724             assert(VLENGTH < Byte.MAX_VALUE);
725             assert(Byte.MIN_VALUE <= -VLENGTH);
726         }
727         static final Long256Shuffle IOTA = new Long256Shuffle(IDENTITY);
728 
729         @Override
730         @ForceInline
731         public Long256Vector toVector() {
732             return VectorSupport.shuffleToVector(VCLASS, ETYPE, Long256Shuffle.class, this, VLENGTH,
733                                                     (s) -> ((Long256Vector)(((AbstractShuffle<Long>)(s)).toVectorTemplate())));
734         }
735 
736         @Override
737         @ForceInline
738         public <F> VectorShuffle<F> cast(VectorSpecies<F> s) {
739             AbstractSpecies<F> species = (AbstractSpecies<F>) s;
740             if (length() != species.laneCount())
741                 throw new IllegalArgumentException("VectorShuffle length and species length differ");
742             int[] shuffleArray = toArray();
743             return s.shuffleFromArray(shuffleArray, 0).check(s);
744         }
745 
746         @ForceInline
747         @Override
748         public Long256Shuffle rearrange(VectorShuffle<Long> shuffle) {
749             Long256Shuffle s = (Long256Shuffle) shuffle;
750             byte[] reorder1 = reorder();
751             byte[] reorder2 = s.reorder();
752             byte[] r = new byte[reorder1.length];
753             for (int i = 0; i < reorder1.length; i++) {
754                 int ssi = reorder2[i];
755                 r[i] = reorder1[ssi];  // throws on exceptional index
756             }
757             return new Long256Shuffle(r);
758         }
759     }
760 
761     // ================================================
762 
763     // Specialized low-level memory operations.
764 
765     @ForceInline
766     @Override
767     final
768     LongVector fromArray0(long[] a, int offset) {
769         return super.fromArray0Template(a, offset);  // specialize
770     }
771 
772 
773 
774     @ForceInline
775     @Override
776     final
777     LongVector fromByteArray0(byte[] a, int offset) {
778         return super.fromByteArray0Template(a, offset);  // specialize
779     }
780 
781     @ForceInline
782     @Override
783     final
784     LongVector fromByteBuffer0(ByteBuffer bb, int offset) {
785         return super.fromByteBuffer0Template(bb, offset);  // specialize
786     }
787 
788     @ForceInline
789     @Override
790     final
791     void intoArray0(long[] a, int offset) {
792         super.intoArray0Template(a, offset);  // specialize
793     }
794 
795     @ForceInline
796     @Override
797     final
798     void intoByteArray0(byte[] a, int offset) {
799         super.intoByteArray0Template(a, offset);  // specialize
800     }
801 
802     // End of specialized low-level memory operations.
803 
804     // ================================================
805 
806 }