1 /*
   2  * Copyright (c) 2017, 2019, 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
  23  * questions.
  24  */
  25 package jdk.incubator.vector;
  26 
  27 import java.nio.ByteBuffer;
  28 import java.nio.ByteOrder;
  29 import java.nio.LongBuffer;
  30 import java.nio.ReadOnlyBufferException;
  31 import java.util.Arrays;
  32 import java.util.Objects;
  33 import java.util.function.IntUnaryOperator;
  34 
  35 import jdk.internal.misc.Unsafe;
  36 import jdk.internal.vm.annotation.ForceInline;
  37 import jdk.internal.vm.annotation.Stable;
  38 
  39 import static jdk.incubator.vector.VectorIntrinsics.*;
  40 import static jdk.incubator.vector.VectorOperators.*;
  41 
  42 // -- This file was mechanically generated: Do not edit! -- //
  43 
  44 @SuppressWarnings("cast")  // warning: redundant cast
  45 final class Long128Vector extends LongVector {
  46     static final LongSpecies VSPECIES =
  47         (LongSpecies) LongVector.SPECIES_128;
  48 
  49     static final VectorShape VSHAPE =
  50         VSPECIES.vectorShape();
  51 
  52     static final Class<Long128Vector> VCLASS = Long128Vector.class;
  53 
  54     static final int VSIZE = VSPECIES.vectorBitSize();
  55 
  56     static final int VLENGTH = VSPECIES.laneCount();
  57 
  58     static final Class<Long> ETYPE = long.class;
  59 
  60     // The JVM expects to find the state here.
  61     private final long[] vec; // Don't access directly, use vec() instead.
  62 
  63     Long128Vector(long[] v) {
  64         vec = v;
  65     }
  66 
  67     // For compatibility as Long128Vector::new,
  68     // stored into species.vectorFactory.
  69     Long128Vector(Object v) {
  70         this((long[]) v);
  71     }
  72 
  73     static final Long128Vector ZERO = new Long128Vector(new long[VLENGTH]);
  74     static final Long128Vector IOTA = new Long128Vector(VSPECIES.iotaArray());
  75 
  76     static {
  77         // Warm up a few species caches.
  78         // If we do this too much we will
  79         // get NPEs from bootstrap circularity.
  80         VSPECIES.dummyVector();
  81         VSPECIES.withLanes(LaneType.BYTE);
  82     }
  83 
  84     // Specialized extractors
  85 
  86     @ForceInline
  87     final @Override
  88     public LongSpecies vspecies() {
  89         // ISSUE:  This should probably be a @Stable
  90         // field inside AbstractVector, rather than
  91         // a megamorphic method.
  92         return VSPECIES;
  93     }
  94 
  95     @ForceInline
  96     @Override
  97     public final Class<Long> elementType() { return long.class; }
  98 
  99     @ForceInline
 100     @Override
 101     public final int elementSize() { return Long.SIZE; }
 102 
 103     @ForceInline
 104     @Override
 105     public final VectorShape shape() { return VSHAPE; }
 106 
 107     @ForceInline
 108     @Override
 109     public final int length() { return VLENGTH; }
 110 
 111     @ForceInline
 112     @Override
 113     public final int bitSize() { return VSIZE; }
 114 
 115     @ForceInline
 116     @Override
 117     public final int byteSize() { return VSIZE / Byte.SIZE; }
 118 
 119     /*package-private*/
 120     @ForceInline
 121     final @Override
 122     long[] vec() {
 123         return VectorIntrinsics.maybeRebox(this).vec;
 124     }
 125 
 126     // Virtualized constructors
 127 
 128     @Override
 129     @ForceInline
 130     public final Long128Vector broadcast(long e) {
 131         return (Long128Vector) super.broadcastTemplate(e);  // specialize
 132     }
 133 
 134 
 135     @Override
 136     @ForceInline
 137     Long128Mask maskFromArray(boolean[] bits) {
 138         return new Long128Mask(bits);
 139     }
 140 
 141     @Override
 142     @ForceInline
 143     Long128Shuffle iotaShuffle() { return Long128Shuffle.IOTA; }
 144 
 145     @ForceInline
 146     Long128Shuffle iotaShuffle(int start) {
 147         return (Long128Shuffle)VectorIntrinsics.shuffleIota(ETYPE, Long128Shuffle.class, VSPECIES, VLENGTH, start, (val, l) -> new Long128Shuffle(i -> (VectorIntrinsics.wrapToRange(i + val, l))));
 148     }
 149 
 150     @Override
 151     @ForceInline
 152     Long128Shuffle shuffleFromBytes(byte[] reorder) { return new Long128Shuffle(reorder); }
 153 
 154     @Override
 155     @ForceInline
 156     Long128Shuffle shuffleFromArray(int[] indexes, int i) { return new Long128Shuffle(indexes, i); }
 157 
 158     @Override
 159     @ForceInline
 160     Long128Shuffle shuffleFromOp(IntUnaryOperator fn) { return new Long128Shuffle(fn); }
 161 
 162     // Make a vector of the same species but the given elements:
 163     @ForceInline
 164     final @Override
 165     Long128Vector vectorFactory(long[] vec) {
 166         return new Long128Vector(vec);
 167     }
 168 
 169     @ForceInline
 170     final @Override
 171     Byte128Vector asByteVectorRaw() {
 172         return (Byte128Vector) 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     final @Override
 184     Long128Vector uOp(FUnOp f) {
 185         return (Long128Vector) super.uOpTemplate(f);  // specialize
 186     }
 187 
 188     @ForceInline
 189     final @Override
 190     Long128Vector uOp(VectorMask<Long> m, FUnOp f) {
 191         return (Long128Vector)
 192             super.uOpTemplate((Long128Mask)m, f);  // specialize
 193     }
 194 
 195     // Binary operator
 196 
 197     @ForceInline
 198     final @Override
 199     Long128Vector bOp(Vector<Long> v, FBinOp f) {
 200         return (Long128Vector) super.bOpTemplate((Long128Vector)v, f);  // specialize
 201     }
 202 
 203     @ForceInline
 204     final @Override
 205     Long128Vector bOp(Vector<Long> v,
 206                      VectorMask<Long> m, FBinOp f) {
 207         return (Long128Vector)
 208             super.bOpTemplate((Long128Vector)v, (Long128Mask)m,
 209                               f);  // specialize
 210     }
 211 
 212     // Ternary operator
 213 
 214     @ForceInline
 215     final @Override
 216     Long128Vector tOp(Vector<Long> v1, Vector<Long> v2, FTriOp f) {
 217         return (Long128Vector)
 218             super.tOpTemplate((Long128Vector)v1, (Long128Vector)v2,
 219                               f);  // specialize
 220     }
 221 
 222     @ForceInline
 223     final @Override
 224     Long128Vector tOp(Vector<Long> v1, Vector<Long> v2,
 225                      VectorMask<Long> m, FTriOp f) {
 226         return (Long128Vector)
 227             super.tOpTemplate((Long128Vector)v1, (Long128Vector)v2,
 228                               (Long128Mask)m, f);  // specialize
 229     }
 230 
 231     @ForceInline
 232     final @Override
 233     long rOp(long v, FBinOp f) {
 234         return super.rOpTemplate(v, f);  // specialize
 235     }
 236 
 237     @Override
 238     @ForceInline
 239     public final <F>
 240     Vector<F> convertShape(VectorOperators.Conversion<Long,F> conv,
 241                            VectorSpecies<F> rsp, int part) {
 242         return super.convertShapeTemplate(conv, rsp, part);  // specialize
 243     }
 244 
 245     @Override
 246     @ForceInline
 247     public final <F>
 248     Vector<F> reinterpretShape(VectorSpecies<F> toSpecies, int part) {
 249         return super.reinterpretShapeTemplate(toSpecies, part);  // specialize
 250     }
 251 
 252     // Specialized algebraic operations:
 253 
 254     // The following definition forces a specialized version of this
 255     // crucial method into the v-table of this class.  A call to add()
 256     // will inline to a call to lanewise(ADD,), at which point the JIT
 257     // intrinsic will have the opcode of ADD, plus all the metadata
 258     // for this particular class, enabling it to generate precise
 259     // code.
 260     //
 261     // There is probably no benefit to the JIT to specialize the
 262     // masked or broadcast versions of the lanewise method.
 263 
 264     @Override
 265     @ForceInline
 266     public Long128Vector lanewise(Unary op) {
 267         return (Long128Vector) super.lanewiseTemplate(op);  // specialize
 268     }
 269 
 270     @Override
 271     @ForceInline
 272     public Long128Vector lanewise(Binary op, Vector<Long> v) {
 273         return (Long128Vector) super.lanewiseTemplate(op, v);  // specialize
 274     }
 275 
 276     /*package-private*/
 277     @Override
 278     @ForceInline Long128Vector
 279     lanewiseShift(VectorOperators.Binary op, int e) {
 280         return (Long128Vector) super.lanewiseShiftTemplate(op, e);  // specialize
 281     }
 282 
 283     /*package-private*/
 284     @Override
 285     @ForceInline
 286     public final
 287     Long128Vector
 288     lanewise(VectorOperators.Ternary op, Vector<Long> v1, Vector<Long> v2) {
 289         return (Long128Vector) super.lanewiseTemplate(op, v1, v2);  // specialize
 290     }
 291 
 292     @Override
 293     @ForceInline
 294     public final
 295     Long128Vector addIndex(int scale) {
 296         return (Long128Vector) super.addIndexTemplate(scale);  // specialize
 297     }
 298 
 299     // Type specific horizontal reductions
 300 
 301     @Override
 302     @ForceInline
 303     public final long reduceLanes(VectorOperators.Associative op) {
 304         return super.reduceLanesTemplate(op);  // specialized
 305     }
 306 
 307     @Override
 308     @ForceInline
 309     public final long reduceLanes(VectorOperators.Associative op,
 310                                     VectorMask<Long> m) {
 311         return super.reduceLanesTemplate(op, m);  // specialized
 312     }
 313 
 314     @Override
 315     @ForceInline
 316     public final long reduceLanesToLong(VectorOperators.Associative op) {
 317         return (long) super.reduceLanesTemplate(op);  // specialized
 318     }
 319 
 320     @Override
 321     @ForceInline
 322     public final long reduceLanesToLong(VectorOperators.Associative op,
 323                                         VectorMask<Long> m) {
 324         return (long) super.reduceLanesTemplate(op, m);  // specialized
 325     }
 326 
 327     @Override
 328     @ForceInline
 329     public VectorShuffle<Long> toShuffle() {
 330         long[] a = toArray();
 331         int[] sa = new int[a.length];
 332         for (int i = 0; i < a.length; i++) {
 333             sa[i] = (int) a[i];
 334         }
 335         return VectorShuffle.fromArray(VSPECIES, sa, 0);
 336     }
 337 
 338     // Specialized unary testing
 339 
 340     @Override
 341     @ForceInline
 342     public final Long128Mask test(Test op) {
 343         return super.testTemplate(Long128Mask.class, op);  // specialize
 344     }
 345 
 346     // Specialized comparisons
 347 
 348     @Override
 349     @ForceInline
 350     public final Long128Mask compare(Comparison op, Vector<Long> v) {
 351         return super.compareTemplate(Long128Mask.class, op, v);  // specialize
 352     }
 353 
 354     @Override
 355     @ForceInline
 356     public final Long128Mask compare(Comparison op, long s) {
 357         return super.compareTemplate(Long128Mask.class, op, s);  // specialize
 358     }
 359 
 360 
 361     @Override
 362     @ForceInline
 363     public Long128Vector blend(Vector<Long> v, VectorMask<Long> m) {
 364         return (Long128Vector)
 365             super.blendTemplate(Long128Mask.class,
 366                                 (Long128Vector) v,
 367                                 (Long128Mask) m);  // specialize
 368     }
 369 
 370     @Override
 371     @ForceInline
 372     public Long128Vector slice(int origin, Vector<Long> v) {
 373         return (Long128Vector) super.sliceTemplate(origin, v);  // specialize
 374     }
 375 
 376     @Override
 377     @ForceInline
 378     public Long128Vector slice(int origin) {
 379        if ((origin < 0) || (origin >= VLENGTH)) {
 380          throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
 381        } else {
 382          Long128Shuffle Iota = (Long128Shuffle)VectorShuffle.iota(VSPECIES, 0, 1, true);
 383          VectorMask<Long> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((long)(VLENGTH-origin))));
 384          Iota = (Long128Shuffle)VectorShuffle.iota(VSPECIES, origin, 1, true);
 385          return ZERO.blend(this.rearrange(Iota), BlendMask);
 386        }
 387     }
 388 
 389     @Override
 390     @ForceInline
 391     public Long128Vector unslice(int origin, Vector<Long> w, int part) {
 392         return (Long128Vector) super.unsliceTemplate(origin, w, part);  // specialize
 393     }
 394 
 395     @Override
 396     @ForceInline
 397     public Long128Vector unslice(int origin, Vector<Long> w, int part, VectorMask<Long> m) {
 398         return (Long128Vector)
 399             super.unsliceTemplate(Long128Mask.class,
 400                                   origin, w, part,
 401                                   (Long128Mask) m);  // specialize
 402     }
 403 
 404     @Override
 405     @ForceInline
 406     public Long128Vector unslice(int origin) {
 407        if ((origin < 0) || (origin >= VLENGTH)) {
 408          throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
 409        } else {
 410          Long128Shuffle Iota = (Long128Shuffle)VectorShuffle.iota(VSPECIES, 0, 1, true);
 411          VectorMask<Long> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((long)(origin))));
 412          Iota = (Long128Shuffle)VectorShuffle.iota(VSPECIES, -origin, 1, true);
 413          return ZERO.blend(this.rearrange(Iota), BlendMask);
 414        }
 415     }
 416 
 417     @Override
 418     @ForceInline
 419     public Long128Vector rearrange(VectorShuffle<Long> s) {
 420         return (Long128Vector)
 421             super.rearrangeTemplate(Long128Shuffle.class,
 422                                     (Long128Shuffle) s);  // specialize
 423     }
 424 
 425     @Override
 426     @ForceInline
 427     public Long128Vector rearrange(VectorShuffle<Long> shuffle,
 428                                   VectorMask<Long> m) {
 429         return (Long128Vector)
 430             super.rearrangeTemplate(Long128Shuffle.class,
 431                                     (Long128Shuffle) shuffle,
 432                                     (Long128Mask) m);  // specialize
 433     }
 434 
 435     @Override
 436     @ForceInline
 437     public Long128Vector rearrange(VectorShuffle<Long> s,
 438                                   Vector<Long> v) {
 439         return (Long128Vector)
 440             super.rearrangeTemplate(Long128Shuffle.class,
 441                                     (Long128Shuffle) s,
 442                                     (Long128Vector) v);  // specialize
 443     }
 444 
 445     @Override
 446     @ForceInline
 447     public Long128Vector selectFrom(Vector<Long> v) {
 448         return (Long128Vector)
 449             super.selectFromTemplate((Long128Vector) v);  // specialize
 450     }
 451 
 452     @Override
 453     @ForceInline
 454     public Long128Vector selectFrom(Vector<Long> v,
 455                                    VectorMask<Long> m) {
 456         return (Long128Vector)
 457             super.selectFromTemplate((Long128Vector) v,
 458                                      (Long128Mask) m);  // specialize
 459     }
 460 
 461 
 462     @Override
 463     public long lane(int i) {
 464         if (i < 0 || i >= VLENGTH) {
 465             throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
 466         }
 467         return (long) VectorIntrinsics.extract(
 468                                 VCLASS, ETYPE, VLENGTH,
 469                                 this, i,
 470                                 (vec, ix) -> {
 471                                     long[] vecarr = vec.vec();
 472                                     return (long)vecarr[ix];
 473                                 });
 474     }
 475 
 476     @Override
 477     public Long128Vector withLane(int i, long e) {
 478         if (i < 0 || i >= VLENGTH) {
 479             throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
 480         }
 481         return VectorIntrinsics.insert(
 482                                 VCLASS, ETYPE, VLENGTH,
 483                                 this, i, (long)e,
 484                                 (v, ix, bits) -> {
 485                                     long[] res = v.vec().clone();
 486                                     res[ix] = (long)bits;
 487                                     return v.vectorFactory(res);
 488                                 });
 489     }
 490 
 491     // Mask
 492 
 493     static final class Long128Mask extends AbstractMask<Long> {
 494 
 495         private final boolean[] bits; // Don't access directly, use getBits() instead.
 496 
 497         public Long128Mask(boolean[] bits) {
 498             this(bits, 0);
 499         }
 500 
 501         public Long128Mask(boolean[] bits, int offset) {
 502             boolean[] a = new boolean[vspecies().laneCount()];
 503             for (int i = 0; i < a.length; i++) {
 504                 a[i] = bits[offset + i];
 505             }
 506             this.bits = a;
 507         }
 508 
 509         public Long128Mask(boolean val) {
 510             boolean[] bits = new boolean[vspecies().laneCount()];
 511             Arrays.fill(bits, val);
 512             this.bits = bits;
 513         }
 514 
 515         @ForceInline
 516         final @Override
 517         public LongSpecies vspecies() {
 518             // ISSUE:  This should probably be a @Stable
 519             // field inside AbstractMask, rather than
 520             // a megamorphic method.
 521             return VSPECIES;
 522         }
 523 
 524         boolean[] getBits() {
 525             return VectorIntrinsics.maybeRebox(this).bits;
 526         }
 527 
 528         @Override
 529         Long128Mask uOp(MUnOp f) {
 530             boolean[] res = new boolean[vspecies().laneCount()];
 531             boolean[] bits = getBits();
 532             for (int i = 0; i < res.length; i++) {
 533                 res[i] = f.apply(i, bits[i]);
 534             }
 535             return new Long128Mask(res);
 536         }
 537 
 538         @Override
 539         Long128Mask bOp(VectorMask<Long> m, MBinOp f) {
 540             boolean[] res = new boolean[vspecies().laneCount()];
 541             boolean[] bits = getBits();
 542             boolean[] mbits = ((Long128Mask)m).getBits();
 543             for (int i = 0; i < res.length; i++) {
 544                 res[i] = f.apply(i, bits[i], mbits[i]);
 545             }
 546             return new Long128Mask(res);
 547         }
 548 
 549         @ForceInline
 550         @Override
 551         public final
 552         Long128Vector toVector() {
 553             return (Long128Vector) super.toVectorTemplate();  // specialize
 554         }
 555 
 556         @Override
 557         @ForceInline
 558         public <E> VectorMask<E> cast(VectorSpecies<E> s) {
 559             AbstractSpecies<E> species = (AbstractSpecies<E>) s;
 560             if (length() != species.laneCount())
 561                 throw new IllegalArgumentException("VectorMask length and species length differ");
 562             boolean[] maskArray = toArray();
 563             // enum-switches don't optimize properly JDK-8161245
 564             switch (species.laneType.switchKey) {
 565             case LaneType.SK_BYTE:
 566                 return new Byte128Vector.Byte128Mask(maskArray).check(species);
 567             case LaneType.SK_SHORT:
 568                 return new Short128Vector.Short128Mask(maskArray).check(species);
 569             case LaneType.SK_INT:
 570                 return new Int128Vector.Int128Mask(maskArray).check(species);
 571             case LaneType.SK_LONG:
 572                 return new Long128Vector.Long128Mask(maskArray).check(species);
 573             case LaneType.SK_FLOAT:
 574                 return new Float128Vector.Float128Mask(maskArray).check(species);
 575             case LaneType.SK_DOUBLE:
 576                 return new Double128Vector.Double128Mask(maskArray).check(species);
 577             }
 578 
 579             // Should not reach here.
 580             throw new AssertionError(species);
 581         }
 582 
 583         // Unary operations
 584 
 585         @Override
 586         @ForceInline
 587         public Long128Mask not() {
 588             return (Long128Mask) VectorIntrinsics.unaryOp(
 589                                              VECTOR_OP_NOT, Long128Mask.class, long.class, VLENGTH,
 590                                              this,
 591                                              (m1) -> m1.uOp((i, a) -> !a));
 592         }
 593 
 594         // Binary operations
 595 
 596         @Override
 597         @ForceInline
 598         public Long128Mask and(VectorMask<Long> mask) {
 599             Objects.requireNonNull(mask);
 600             Long128Mask m = (Long128Mask)mask;
 601             return VectorIntrinsics.binaryOp(VECTOR_OP_AND, Long128Mask.class, long.class, VLENGTH,
 602                                              this, m,
 603                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b));
 604         }
 605 
 606         @Override
 607         @ForceInline
 608         public Long128Mask or(VectorMask<Long> mask) {
 609             Objects.requireNonNull(mask);
 610             Long128Mask m = (Long128Mask)mask;
 611             return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Long128Mask.class, long.class, VLENGTH,
 612                                              this, m,
 613                                              (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
 614         }
 615 
 616         // Reductions
 617 
 618         @Override
 619         @ForceInline
 620         public boolean anyTrue() {
 621             return VectorIntrinsics.test(BT_ne, Long128Mask.class, long.class, VLENGTH,
 622                                          this, this,
 623                                          (m, __) -> anyTrueHelper(((Long128Mask)m).getBits()));
 624         }
 625 
 626         @Override
 627         @ForceInline
 628         public boolean allTrue() {
 629             return VectorIntrinsics.test(BT_overflow, Long128Mask.class, long.class, VLENGTH,
 630                                          this, vspecies().maskAll(true),
 631                                          (m, __) -> allTrueHelper(((Long128Mask)m).getBits()));
 632         }
 633 
 634         /*package-private*/
 635         static Long128Mask maskAll(boolean bit) {
 636             return bit ? TRUE_MASK : FALSE_MASK;
 637         }
 638         static final Long128Mask TRUE_MASK = new Long128Mask(true);
 639         static final Long128Mask FALSE_MASK = new Long128Mask(false);
 640     }
 641 
 642     // Shuffle
 643 
 644     static final class Long128Shuffle extends AbstractShuffle<Long> {
 645         Long128Shuffle(byte[] reorder) {
 646             super(reorder);
 647         }
 648 
 649         public Long128Shuffle(int[] reorder) {
 650             super(reorder);
 651         }
 652 
 653         public Long128Shuffle(int[] reorder, int i) {
 654             super(reorder, i);
 655         }
 656 
 657         public Long128Shuffle(IntUnaryOperator fn) {
 658             super(fn);
 659         }
 660 
 661         @Override
 662         public LongSpecies vspecies() {
 663             return VSPECIES;
 664         }
 665 
 666         static {
 667             // There must be enough bits in the shuffle lanes to encode
 668             // VLENGTH valid indexes and VLENGTH exceptional ones.
 669             assert(VLENGTH < Byte.MAX_VALUE);
 670             assert(Byte.MIN_VALUE <= -VLENGTH);
 671         }
 672         static final Long128Shuffle IOTA = new Long128Shuffle(IDENTITY);
 673 
 674         @Override
 675         @ForceInline
 676         public Long128Vector toVector() {
 677             return VectorIntrinsics.shuffleToVector(VCLASS, ETYPE, Long128Shuffle.class, this, VLENGTH,
 678                                                     (s) -> ((Long128Vector)(((AbstractShuffle<Long>)(s)).toVectorTemplate())));
 679         }
 680 
 681         @Override
 682         @ForceInline
 683         public <F> VectorShuffle<F> cast(VectorSpecies<F> s) {
 684             AbstractSpecies<F> species = (AbstractSpecies<F>) s;
 685             if (length() != species.laneCount())
 686                 throw new IllegalArgumentException("VectorShuffle length and species length differ");
 687             int[] shuffleArray = toArray();
 688             // enum-switches don't optimize properly JDK-8161245
 689             switch (species.laneType.switchKey) {
 690             case LaneType.SK_BYTE:
 691                 return new Byte128Vector.Byte128Shuffle(shuffleArray).check(species);
 692             case LaneType.SK_SHORT:
 693                 return new Short128Vector.Short128Shuffle(shuffleArray).check(species);
 694             case LaneType.SK_INT:
 695                 return new Int128Vector.Int128Shuffle(shuffleArray).check(species);
 696             case LaneType.SK_LONG:
 697                 return new Long128Vector.Long128Shuffle(shuffleArray).check(species);
 698             case LaneType.SK_FLOAT:
 699                 return new Float128Vector.Float128Shuffle(shuffleArray).check(species);
 700             case LaneType.SK_DOUBLE:
 701                 return new Double128Vector.Double128Shuffle(shuffleArray).check(species);
 702             }
 703 
 704             // Should not reach here.
 705             throw new AssertionError(species);
 706         }
 707 
 708         @Override
 709         public Long128Shuffle rearrange(VectorShuffle<Long> shuffle) {
 710             Long128Shuffle s = (Long128Shuffle) shuffle;
 711             byte[] r = new byte[reorder.length];
 712             for (int i = 0; i < reorder.length; i++) {
 713                 int ssi = s.reorder[i];
 714                 r[i] = this.reorder[ssi];  // throws on exceptional index
 715             }
 716             return new Long128Shuffle(r);
 717         }
 718     }
 719 
 720     // ================================================
 721 
 722     // Specialized low-level memory operations.
 723 
 724     @ForceInline
 725     @Override
 726     final
 727     LongVector fromArray0(long[] a, int offset) {
 728         return super.fromArray0Template(a, offset);  // specialize
 729     }
 730 
 731     @ForceInline
 732     @Override
 733     final
 734     LongVector fromByteArray0(byte[] a, int offset) {
 735         return super.fromByteArray0Template(a, offset);  // specialize
 736     }
 737 
 738     @ForceInline
 739     @Override
 740     final
 741     LongVector fromByteBuffer0(ByteBuffer bb, int offset) {
 742         return super.fromByteBuffer0Template(bb, offset);  // specialize
 743     }
 744 
 745     @ForceInline
 746     @Override
 747     final
 748     void intoArray0(long[] a, int offset) {
 749         super.intoArray0Template(a, offset);  // specialize
 750     }
 751 
 752     @ForceInline
 753     @Override
 754     final
 755     void intoByteArray0(byte[] a, int offset) {
 756         super.intoByteArray0Template(a, offset);  // specialize
 757     }
 758 
 759     // End of specialized low-level memory operations.
 760 
 761     // ================================================
 762 
 763 }