< prev index next >

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

Print this page




  98         void apply(int i, $type$ a);
  99     }
 100 
 101     abstract void forEach(FUnCon f);
 102 
 103     abstract void forEach(VectorMask<$Boxtype$> m, FUnCon f);
 104 
 105     // Static factories
 106 
 107     /**
 108      * Returns a vector where all lane elements are set to the default
 109      * primitive value.
 110      *
 111      * @param species species of desired vector
 112      * @return a zero vector of given species
 113      */
 114     @ForceInline
 115     @SuppressWarnings("unchecked")
 116     public static $abstractvectortype$ zero(VectorSpecies<$Boxtype$> species) {
 117 #if[FP]
 118         return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.boxType(), $type$.class, species.length(),
 119                                                  $Type$.$type$To$Bitstype$Bits(0.0f), species,
 120                                                  ((bits, s) -> (($Type$Species)s).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
 121 #else[FP]
 122         return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.boxType(), $type$.class, species.length(),
 123                                                  0, species,
 124                                                  ((bits, s) -> (($Type$Species)s).op(i -> ($type$)bits)));
 125 #end[FP]
 126     }
 127 
 128     /**
 129      * Loads a vector from a byte array starting at an offset.
 130      * <p>
 131      * Bytes are composed into primitive lane elements according to the
 132      * native byte order of the underlying platform
 133      * <p>
 134      * This method behaves as if it returns the result of calling the
 135      * byte buffer, offset, and mask accepting
 136      * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows:
 137      * <pre>{@code
 138      * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, VectorMask.allTrue());
 139      * }</pre>
 140      *
 141      * @param species species of desired vector
 142      * @param a the byte array
 143      * @param offset the offset into the array
 144      * @return a vector loaded from a byte array
 145      * @throws IndexOutOfBoundsException if {@code i < 0} or
 146      * {@code offset > a.length - (species.length() * species.elementSize() / Byte.SIZE)}
 147      */
 148     @ForceInline
 149     @SuppressWarnings("unchecked")
 150     public static $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, byte[] a, int offset) {
 151         Objects.requireNonNull(a);
 152         offset = VectorIntrinsics.checkIndex(offset, a.length, species.bitSize() / Byte.SIZE);
 153         return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
 154                                      a, ((long) offset) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
 155                                      a, offset, species,
 156                                      (c, idx, s) -> {
 157                                          ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder());
 158                                          $Type$Buffer tb = bbc{#if[byte]?;:.as$Type$Buffer();}
 159                                          return (($Type$Species)s).op(i -> tb.get());
 160                                      });
 161     }
 162 
 163     /**
 164      * Loads a vector from a byte array starting at an offset and using a
 165      * mask.
 166      * <p>
 167      * Bytes are composed into primitive lane elements according to the
 168      * native byte order of the underlying platform.
 169      * <p>
 170      * This method behaves as if it returns the result of calling the
 171      * byte buffer, offset, and mask accepting
 172      * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows:
 173      * <pre>{@code


 191 
 192     /**
 193      * Loads a vector from an array starting at offset.
 194      * <p>
 195      * For each vector lane, where {@code N} is the vector lane index, the
 196      * array element at index {@code offset + N} is placed into the
 197      * resulting vector at lane index {@code N}.
 198      *
 199      * @param species species of desired vector
 200      * @param a the array
 201      * @param offset the offset into the array
 202      * @return the vector loaded from an array
 203      * @throws IndexOutOfBoundsException if {@code offset < 0}, or
 204      * {@code offset > a.length - species.length()}
 205      */
 206     @ForceInline
 207     @SuppressWarnings("unchecked")
 208     public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int offset){
 209         Objects.requireNonNull(a);
 210         offset = VectorIntrinsics.checkIndex(offset, a.length, species.length());
 211         return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
 212                                      a, (((long) offset) << ARRAY_SHIFT) + Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
 213                                      a, offset, species,
 214                                      (c, idx, s) -> (($Type$Species)s).op(n -> c[idx + n]));
 215     }
 216 
 217 
 218     /**
 219      * Loads a vector from an array starting at offset and using a mask.
 220      * <p>
 221      * For each vector lane, where {@code N} is the vector lane index,
 222      * if the mask lane at index {@code N} is set then the array element at
 223      * index {@code offset + N} is placed into the resulting vector at lane index
 224      * {@code N}, otherwise the default element value is placed into the
 225      * resulting vector at lane index {@code N}.
 226      *
 227      * @param species species of desired vector
 228      * @param a the array
 229      * @param offset the offset into the array
 230      * @param m the mask
 231      * @return the vector loaded from an array


 264         return (($Type$Species)species).op(n -> a[a_offset + indexMap[i_offset + n]]);
 265     }
 266 #else[byteOrShort]
 267     @ForceInline
 268     @SuppressWarnings("unchecked")
 269     public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int a_offset, int[] indexMap, int i_offset) {
 270         Objects.requireNonNull(a);
 271         Objects.requireNonNull(indexMap);
 272 
 273 #if[longOrDouble]
 274         if (species.length() == 1) {
 275           return $abstractvectortype$.fromArray(species, a, a_offset + indexMap[i_offset]);
 276         }
 277 #end[longOrDouble]
 278 
 279         // Index vector: vix[0:n] = k -> a_offset + indexMap[i_offset + k]
 280         IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, i_offset).add(a_offset);
 281 
 282         vix = VectorIntrinsics.checkIndex(vix, a.length);
 283 
 284         return VectorIntrinsics.loadWithMap((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
 285                                             IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, vix,
 286                                             a, a_offset, indexMap, i_offset, species,
 287                                             ($type$[] c, int idx, int[] iMap, int idy, VectorSpecies<$Boxtype$> s) ->
 288                                                 (($Type$Species)s).op(n -> c[idx + iMap[idy+n]]));
 289         }
 290 
 291 #end[byteOrShort]
 292     /**
 293      * Loads a vector from an array using indexes obtained from an index
 294      * map and using a mask.
 295      * <p>
 296      * For each vector lane, where {@code N} is the vector lane index,
 297      * if the mask lane at index {@code N} is set then the array element at
 298      * index {@code a_offset + indexMap[i_offset + N]} is placed into the resulting vector
 299      * at lane index {@code N}.
 300      *
 301      * @param species species of desired vector
 302      * @param a the array
 303      * @param a_offset the offset into the array, may be negative if relative
 304      * indexes in the index map compensate to produce a value within the
 305      * array bounds


 341      *   return fromByteBuffer(b, offset, VectorMask.allTrue())
 342      * }</pre>
 343      *
 344      * @param species species of desired vector
 345      * @param bb the byte buffer
 346      * @param offset the offset into the byte buffer
 347      * @return a vector loaded from a byte buffer
 348      * @throws IndexOutOfBoundsException if the offset is {@code < 0},
 349      * or {@code > b.limit()},
 350      * or if there are fewer than
 351      * {@code species.length() * species.elementSize() / Byte.SIZE} bytes
 352      * remaining in the byte buffer from the given offset
 353      */
 354     @ForceInline
 355     @SuppressWarnings("unchecked")
 356     public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int offset) {
 357         if (bb.order() != ByteOrder.nativeOrder()) {
 358             throw new IllegalArgumentException();
 359         }
 360         offset = VectorIntrinsics.checkIndex(offset, bb.limit(), species.bitSize() / Byte.SIZE);
 361         return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
 362                                      U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + offset,
 363                                      bb, offset, species,
 364                                      (c, idx, s) -> {
 365                                          ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder());
 366                                          $Type$Buffer tb = bbc{#if[byte]?;:.as$Type$Buffer();}
 367                                          return (($Type$Species)s).op(i -> tb.get());
 368                                      });
 369     }
 370 
 371     /**
 372      * Loads a vector from a {@link ByteBuffer byte buffer} starting at an
 373      * offset into the byte buffer and using a mask.
 374      * <p>
 375      * This method behaves as if the byte buffer is viewed as a primitive
 376      * {@link java.nio.Buffer buffer} for the primitive element type,
 377      * according to the native byte order of the underlying platform, and
 378      * the returned vector is loaded with a mask from a primitive array
 379      * obtained from the primitive buffer.
 380      * The following pseudocode expresses the behaviour, where
 381      * {@code EBuffer} is the primitive buffer type, {@code e} is the


 406      */
 407     @ForceInline
 408     public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int offset, VectorMask<$Boxtype$> m) {
 409         return zero(species).blend(fromByteBuffer(species, bb, offset), m);
 410     }
 411 
 412     /**
 413      * Returns a vector where all lane elements are set to the primitive
 414      * value {@code e}.
 415      *
 416      * @param species species of the desired vector
 417      * @param e the value
 418      * @return a vector of vector where all lane elements are set to
 419      * the primitive value {@code e}
 420      */
 421 #if[FP]
 422     @ForceInline
 423     @SuppressWarnings("unchecked")
 424     public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> species, $type$ e) {
 425         return VectorIntrinsics.broadcastCoerced(
 426             (Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
 427             $Type$.$type$To$Bitstype$Bits(e), species,
 428             ((bits, sp) -> (($Type$Species)sp).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
 429     }
 430 #else[FP]
 431     @ForceInline
 432     @SuppressWarnings("unchecked")
 433     public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> species, $type$ e) {
 434         return VectorIntrinsics.broadcastCoerced(
 435             (Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
 436             e, species,
 437             ((bits, sp) -> (($Type$Species)sp).op(i -> ($type$)bits)));
 438     }
 439 #end[FP]
 440 
 441     /**
 442      * Returns a vector where each lane element is set to given
 443      * primitive values.
 444      * <p>
 445      * For each vector lane, where {@code N} is the vector lane index, the
 446      * the primitive value at index {@code N} is placed into the resulting
 447      * vector at lane index {@code N}.
 448      *
 449      * @param species species of the desired vector
 450      * @param es the given primitive values
 451      * @return a vector where each lane element is set to given primitive
 452      * values
 453      * @throws IndexOutOfBoundsException if {@code es.length < species.length()}
 454      */
 455     @ForceInline
 456     @SuppressWarnings("unchecked")
 457     public static $abstractvectortype$ scalars(VectorSpecies<$Boxtype$> species, $type$... es) {
 458         Objects.requireNonNull(es);
 459         int ix = VectorIntrinsics.checkIndex(0, es.length, species.length());
 460         return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
 461                                      es, Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
 462                                      es, ix, species,
 463                                      (c, idx, sp) -> (($Type$Species)sp).op(n -> c[idx + n]));
 464     }
 465 
 466     /**
 467      * Returns a vector where the first lane element is set to the primtive
 468      * value {@code e}, all other lane elements are set to the default
 469      * value.
 470      *
 471      * @param species species of the desired vector
 472      * @param e the value
 473      * @return a vector where the first lane element is set to the primitive
 474      * value {@code e}
 475      */
 476     @ForceInline
 477     public static final $abstractvectortype$ single(VectorSpecies<$Boxtype$> species, $type$ e) {
 478         return zero(species).with(0, e);
 479     }
 480 


 836     @Override
 837     public abstract $abstractvectortype$ rearrange(Vector<$Boxtype$> v,
 838                                                       VectorShuffle<$Boxtype$> s, VectorMask<$Boxtype$> m);
 839 
 840     /**
 841      * {@inheritDoc}
 842      */
 843     @Override
 844     public abstract $abstractvectortype$ rearrange(VectorShuffle<$Boxtype$> m);
 845 
 846     /**
 847      * {@inheritDoc}
 848      */
 849     @Override
 850     public abstract $abstractvectortype$ reshape(VectorSpecies<$Boxtype$> s);
 851 
 852     /**
 853      * {@inheritDoc}
 854      */
 855     @Override
 856     public abstract $abstractvectortype$ rotateEL(int i);
 857 
 858     /**
 859      * {@inheritDoc}
 860      */
 861     @Override
 862     public abstract $abstractvectortype$ rotateER(int i);
 863 
 864     /**
 865      * {@inheritDoc}
 866      */
 867     @Override
 868     public abstract $abstractvectortype$ shiftEL(int i);
 869 
 870     /**
 871      * {@inheritDoc}
 872      */
 873     @Override
 874     public abstract $abstractvectortype$ shiftER(int i);
 875 
 876 #if[FP]
 877     /**
 878      * Divides this vector by an input vector.
 879      * <p>
 880      * This is a lane-wise binary operation which applies the primitive division
 881      * operation ({@code /}) to each lane.
 882      *
 883      * @param v the input vector
 884      * @return the result of dividing this vector by the input vector
 885      */
 886     public abstract $abstractvectortype$ div(Vector<$Boxtype$> v);
 887 
 888     /**
 889      * Divides this vector by the broadcast of an input scalar.
 890      * <p>
 891      * This is a lane-wise binary operation which applies the primitive division
 892      * operation ({@code /}) to each lane.
 893      *
 894      * @param s the input scalar


1886      * Bitwise NOTs this vector.
1887      * <p>
1888      * This is a lane-wise unary operation which applies the primitive bitwise NOT
1889      * operation ({@code ~}) to each lane.
1890      *
1891      * @return the bitwise NOT of this vector
1892      */
1893     public abstract $abstractvectortype$ not();
1894 
1895     /**
1896      * Bitwise NOTs this vector, selecting lane elements controlled by a mask.
1897      * <p>
1898      * This is a lane-wise unary operation which applies the primitive bitwise NOT
1899      * operation ({@code ~}) to each lane.
1900      *
1901      * @param m the mask controlling lane selection
1902      * @return the bitwise NOT of this vector
1903      */
1904     public abstract $abstractvectortype$ not(VectorMask<$Boxtype$> m);
1905 
1906 #if[byte]
1907     /**
1908      * Logically left shifts this vector by the broadcast of an input scalar.
1909      * <p>
1910      * This is a lane-wise binary operation which applies the primitive logical left shift
1911      * operation ({@code <<}) to each lane to left shift the
1912      * element by shift value as specified by the input scalar. Only the 3
1913      * lowest-order bits of shift value are used. It is as if the shift value

1914      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
1915      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
1916      *
1917      * @param s the input scalar; the number of the bits to left shift
1918      * @return the result of logically left shifting left this vector by the
1919      * broadcast of an input scalar
1920      */
1921 #end[byte]
1922 #if[short]
1923     /**
1924      * Logically left shifts this vector by the broadcast of an input scalar.
1925      * <p>
1926      * This is a lane-wise binary operation which applies the primitive logical left shift
1927      * operation ({@code <<}) to each lane to left shift the
1928      * element by shift value as specified by the input scalar. Only the 4
1929      * lowest-order bits of shift value are used. It is as if the shift value
1930      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
1931      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
1932      *
1933      * @param s the input scalar; the number of the bits to left shift
1934      * @return the result of logically left shifting left this vector by the
1935      * broadcast of an input scalar
1936      */
1937 #end[short]
1938 #if[intOrLong]
1939     /**
1940      * Logically left shifts this vector by the broadcast of an input scalar.
1941      * <p>
1942      * This is a lane-wise binary operation which applies the primitive logical left shift
1943      * operation ({@code <<}) to each lane.
1944      *
1945      * @param s the input scalar; the number of the bits to left shift
1946      * @return the result of logically left shifting left this vector by the
1947      * broadcast of an input scalar
1948      */
1949 #end[intOrLong]
1950     public abstract $abstractvectortype$ shiftL(int s);
1951 
1952 #if[byte]
1953     /**
1954      * Logically left shifts this vector by the broadcast of an input scalar,
1955      * selecting lane elements controlled by a mask.
1956      * <p>
1957      * This is a lane-wise binary operation which applies the primitive logical left shift
1958      * operation ({@code <<}) to each lane to left shift the
1959      * element by shift value as specified by the input scalar. Only the 3
1960      * lowest-order bits of shift value are used. It is as if the shift value

1961      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
1962      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
1963      *
1964      * @param s the input scalar; the number of the bits to left shift
1965      * @param m the mask controlling lane selection
1966      * @return the result of logically left shifting left this vector by the
1967      * broadcast of an input scalar
1968      */
1969 #end[byte]
1970 #if[short]
1971     /**
1972      * Logically left shifts this vector by the broadcast of an input scalar,
1973      * selecting lane elements controlled by a mask.
1974      * <p>
1975      * This is a lane-wise binary operation which applies the primitive logical left shift
1976      * operation ({@code <<}) to each lane to left shift the
1977      * element by shift value as specified by the input scalar. Only the 4
1978      * lowest-order bits of shift value are used. It is as if the shift value
1979      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
1980      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
1981      *
1982      * @param s the input scalar; the number of the bits to left shift
1983      * @param m the mask controlling lane selection
1984      * @return the result of logically left shifting left this vector by the
1985      * broadcast of an input scalar
1986      */
1987 #end[short]
1988 #if[intOrLong]
1989     /**
1990      * Logically left shifts this vector by the broadcast of an input scalar,
1991      * selecting lane elements controlled by a mask.
1992      * <p>
1993      * This is a lane-wise binary operation which applies the primitive logical left shift
1994      * operation ({@code <<}) to each lane.
1995      *
1996      * @param s the input scalar; the number of the bits to left shift
1997      * @param m the mask controlling lane selection
1998      * @return the result of logically left shifting this vector by the
1999      * broadcast of an input scalar
2000      */
2001 #end[intOrLong]
2002     public abstract $abstractvectortype$ shiftL(int s, VectorMask<$Boxtype$> m);
2003 
2004 #if[intOrLong]
2005     /**
2006      * Logically left shifts this vector by an input vector.
2007      * <p>
2008      * This is a lane-wise binary operation which applies the primitive logical left shift
2009      * operation ({@code <<}) to each lane.











2010      *
2011      * @param v the input vector
2012      * @return the result of logically left shifting this vector by the input
2013      * vector
2014      */
2015     public abstract $abstractvectortype$ shiftL(Vector<$Boxtype$> v);
2016 
2017     /**
2018      * Logically left shifts this vector by an input vector, selecting lane
2019      * elements controlled by a mask.
2020      * <p>
2021      * This is a lane-wise binary operation which applies the primitive logical left shift
2022      * operation ({@code <<}) to each lane.











2023      *
2024      * @param v the input vector
2025      * @param m the mask controlling lane selection
2026      * @return the result of logically left shifting this vector by the input
2027      * vector
2028      */
2029     public $abstractvectortype$ shiftL(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
2030         return bOp(v, m, (i, a, b) -> ($type$) (a << b));
2031     }
2032 #end[intOrLong]
2033 
2034     // logical, or unsigned, shift right
2035 
2036 #if[byte]
2037      /**
2038      * Logically right shifts (or unsigned right shifts) this vector by the
2039      * broadcast of an input scalar.
2040      * <p>
2041      * This is a lane-wise binary operation which applies the primitive logical right shift
2042      * operation ({@code >>>}) to each lane to logically right shift the
2043      * element by shift value as specified by the input scalar. Only the 3
2044      * lowest-order bits of shift value are used. It is as if the shift value

2045      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2046      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2047      *
2048      * @param s the input scalar; the number of the bits to right shift
2049      * @return the result of logically right shifting this vector by the
2050      * broadcast of an input scalar
2051      */
2052 #end[byte]
2053 #if[short]
2054      /**
2055      * Logically right shifts (or unsigned right shifts) this vector by the
2056      * broadcast of an input scalar.
2057      * <p>
2058      * This is a lane-wise binary operation which applies the primitive logical right shift
2059      * operation ({@code >>>}) to each lane to logically right shift the
2060      * element by shift value as specified by the input scalar. Only the 4
2061      * lowest-order bits of shift value are used. It is as if the shift value
2062      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2063      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2064      *
2065      * @param s the input scalar; the number of the bits to right shift
2066      * @return the result of logically right shifting this vector by the
2067      * broadcast of an input scalar
2068      */
2069 #end[short]
2070 #if[intOrLong]
2071     /**
2072      * Logically right shifts (or unsigned right shifts) this vector by the
2073      * broadcast of an input scalar.
2074      * <p>
2075      * This is a lane-wise binary operation which applies the primitive logical right shift
2076      * operation ({@code >>>}) to each lane.
2077      *
2078      * @param s the input scalar; the number of the bits to right shift
2079      * @return the result of logically right shifting this vector by the
2080      * broadcast of an input scalar
2081      */
2082 #end[intOrLong]
2083     public abstract $abstractvectortype$ shiftR(int s);
2084 
2085 #if[byte]
2086      /**
2087      * Logically right shifts (or unsigned right shifts) this vector by the
2088      * broadcast of an input scalar, selecting lane elements controlled by a
2089      * mask.
2090      * <p>
2091      * This is a lane-wise binary operation which applies the primitive logical right shift
2092      * operation ({@code >>}) to each lane to logically right shift the
2093      * element by shift value as specified by the input scalar. Only the 3
2094      * lowest-order bits of shift value are used. It is as if the shift value

2095      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2096      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2097      *
2098      * @param s the input scalar; the number of the bits to right shift
2099      * @param m the mask controlling lane selection
2100      * @return the result of logically right shifting this vector by the
2101      * broadcast of an input scalar
2102      */
2103 #end[byte]
2104 #if[short]
2105      /**
2106      * Logically right shifts (or unsigned right shifts) this vector by the
2107      * broadcast of an input scalar, selecting lane elements controlled by a
2108      * mask.
2109      * <p>
2110      * This is a lane-wise binary operation which applies the primitive logical right shift
2111      * operation ({@code >>>}) to each lane to logically right shift the
2112      * element by shift value as specified by the input scalar. Only the 4
2113      * lowest-order bits of shift value are used. It is as if the shift value
2114      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2115      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2116      *
2117      * @param s the input scalar; the number of the bits to right shift
2118      * @param m the mask controlling lane selection
2119      * @return the result of logically right shifting this vector by the
2120      * broadcast of an input scalar
2121      */
2122 #end[short]
2123 #if[intOrLong]
2124     /**
2125      * Logically right shifts (or unsigned right shifts) this vector by the
2126      * broadcast of an input scalar, selecting lane elements controlled by a
2127      * mask.
2128      * <p>
2129      * This is a lane-wise binary operation which applies the primitive logical right shift
2130      * operation ({@code >>>}) to each lane.
2131      *
2132      * @param s the input scalar; the number of the bits to right shift
2133      * @param m the mask controlling lane selection
2134      * @return the result of logically right shifting this vector by the
2135      * broadcast of an input scalar
2136      */
2137 #end[intOrLong]
2138     public abstract $abstractvectortype$ shiftR(int s, VectorMask<$Boxtype$> m);
2139 
2140 #if[intOrLong]
2141     /**
2142      * Logically right shifts (or unsigned right shifts) this vector by an
2143      * input vector.
2144      * <p>
2145      * This is a lane-wise binary operation which applies the primitive logical right shift
2146      * operation ({@code >>>}) to each lane.











2147      *
2148      * @param v the input vector
2149      * @return the result of logically right shifting this vector by the
2150      * input vector
2151      */
2152     public abstract $abstractvectortype$ shiftR(Vector<$Boxtype$> v);
2153 
2154     /**
2155      * Logically right shifts (or unsigned right shifts) this vector by an
2156      * input vector, selecting lane elements controlled by a mask.
2157      * <p>
2158      * This is a lane-wise binary operation which applies the primitive logical right shift
2159      * operation ({@code >>>}) to each lane.











2160      *
2161      * @param v the input vector
2162      * @param m the mask controlling lane selection
2163      * @return the result of logically right shifting this vector by the
2164      * input vector
2165      */
2166     public $abstractvectortype$ shiftR(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
2167         return bOp(v, m, (i, a, b) -> ($type$) (a >>> b));
2168     }
2169 #end[intOrLong]
2170 
2171 #if[byte]
2172     /**
2173      * Arithmetically right shifts (or signed right shifts) this vector by the
2174      * broadcast of an input scalar.
2175      * <p>
2176      * This is a lane-wise binary operation which applies the primitive arithmetic right
2177      * shift operation ({@code >>}) to each lane to arithmetically
2178      * right shift the element by shift value as specified by the input scalar.

2179      * Only the 3 lowest-order bits of shift value are used. It is as if the shift
2180      * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2181      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2182      *
2183      * @param s the input scalar; the number of the bits to right shift
2184      * @return the result of arithmetically right shifting this vector by the
2185      * broadcast of an input scalar
2186      */
2187 #end[byte]
2188 #if[short]
2189     /**
2190      * Arithmetically right shifts (or signed right shifts) this vector by the
2191      * broadcast of an input scalar.
2192      * <p>
2193      * This is a lane-wise binary operation which applies the primitive arithmetic right
2194      * shift operation ({@code >>}) to each lane to arithmetically
2195      * right shift the element by shift value as specified by the input scalar.
2196      * Only the 4 lowest-order bits of shift value are used. It is as if the shift
2197      * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2198      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2199      *
2200      * @param s the input scalar; the number of the bits to right shift
2201      * @return the result of arithmetically right shifting this vector by the
2202      * broadcast of an input scalar
2203      */
2204 #end[short]
2205 #if[intOrLong]
2206     /**
2207      * Arithmetically right shifts (or signed right shifts) this vector by the
2208      * broadcast of an input scalar.
2209      * <p>
2210      * This is a lane-wise binary operation which applies the primitive arithmetic right
2211      * shift operation ({@code >>}) to each lane.
2212      *
2213      * @param s the input scalar; the number of the bits to right shift
2214      * @return the result of arithmetically right shifting this vector by the
2215      * broadcast of an input scalar
2216      */
2217 #end[intOrLong]
2218     public abstract $abstractvectortype$ aShiftR(int s);
2219 
2220 #if[byte]
2221     /**
2222      * Arithmetically right shifts (or signed right shifts) this vector by the
2223      * broadcast of an input scalar, selecting lane elements controlled by a
2224      * mask.
2225      * <p>
2226      * This is a lane-wise binary operation which applies the primitive arithmetic right
2227      * shift operation ({@code >>}) to each lane to arithmetically
2228      * right shift the element by shift value as specified by the input scalar.

2229      * Only the 3 lowest-order bits of shift value are used. It is as if the shift
2230      * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2231      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2232      *
2233      * @param s the input scalar; the number of the bits to right shift
2234      * @param m the mask controlling lane selection
2235      * @return the result of arithmetically right shifting this vector by the
2236      * broadcast of an input scalar
2237      */
2238 #end[byte]
2239 #if[short]
2240     /**
2241      * Arithmetically right shifts (or signed right shifts) this vector by the
2242      * broadcast of an input scalar, selecting lane elements controlled by a
2243      * mask.
2244      * <p>
2245      * This is a lane-wise binary operation which applies the primitive arithmetic right
2246      * shift operation ({@code >>}) to each lane to arithmetically
2247      * right shift the element by shift value as specified by the input scalar.
2248      * Only the 4 lowest-order bits of shift value are used. It is as if the shift
2249      * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2250      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2251      *
2252      * @param s the input scalar; the number of the bits to right shift
2253      * @param m the mask controlling lane selection
2254      * @return the result of arithmetically right shifting this vector by the
2255      * broadcast of an input scalar
2256      */
2257 #end[short]
2258 #if[intOrLong]
2259     /**
2260      * Arithmetically right shifts (or signed right shifts) this vector by the
2261      * broadcast of an input scalar, selecting lane elements controlled by a
2262      * mask.
2263      * <p>
2264      * This is a lane-wise binary operation which applies the primitive arithmetic right
2265      * shift operation ({@code >>}) to each lane.
2266      *
2267      * @param s the input scalar; the number of the bits to right shift
2268      * @param m the mask controlling lane selection
2269      * @return the result of arithmetically right shifting this vector by the
2270      * broadcast of an input scalar
2271      */
2272 #end[intOrLong]
2273     public abstract $abstractvectortype$ aShiftR(int s, VectorMask<$Boxtype$> m);
2274 
2275 #if[intOrLong]
2276     /**
2277      * Arithmetically right shifts (or signed right shifts) this vector by an
2278      * input vector.
2279      * <p>
2280      * This is a lane-wise binary operation which applies the primitive arithmetic right
2281      * shift operation ({@code >>}) to each lane.











2282      *
2283      * @param v the input vector
2284      * @return the result of arithmetically right shifting this vector by the
2285      * input vector
2286      */
2287     public abstract $abstractvectortype$ aShiftR(Vector<$Boxtype$> v);
2288 
2289     /**
2290      * Arithmetically right shifts (or signed right shifts) this vector by an
2291      * input vector, selecting lane elements controlled by a mask.
2292      * <p>
2293      * This is a lane-wise binary operation which applies the primitive arithmetic right
2294      * shift operation ({@code >>}) to each lane.











2295      *
2296      * @param v the input vector
2297      * @param m the mask controlling lane selection
2298      * @return the result of arithmetically right shifting this vector by the
2299      * input vector
2300      */
2301     public $abstractvectortype$ aShiftR(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
2302         return bOp(v, m, (i, a, b) -> ($type$) (a >> b));
2303     }
2304 
2305     /**
2306      * Rotates left this vector by the broadcast of an input scalar.
2307      * <p>

2308      * This is a lane-wise binary operation which applies the operation
2309      * {@link $Wideboxtype$#rotateLeft} to each lane and where
2310      * lane elements of this vector apply to the first argument, and lane
2311      * elements of the broadcast vector apply to the second argument (the
2312      * rotation distance).















2313      *
2314      * @param s the input scalar; the number of the bits to rotate left
2315      * @return the result of rotating left this vector by the broadcast of an
2316      * input scalar
2317      */
2318     @ForceInline
2319     public final $abstractvectortype$ rotateL(int s) {
2320         return shiftL(s).or(shiftR(-s));
2321     }
2322 
2323     /**
2324      * Rotates left this vector by the broadcast of an input scalar, selecting
2325      * lane elements controlled by a mask.
2326      * <p>

2327      * This is a lane-wise binary operation which applies the operation
2328      * {@link $Wideboxtype$#rotateLeft} to each lane and where
2329      * lane elements of this vector apply to the first argument, and lane
2330      * elements of the broadcast vector apply to the second argument (the
2331      * rotation distance).















2332      *
2333      * @param s the input scalar; the number of the bits to rotate left
2334      * @param m the mask controlling lane selection
2335      * @return the result of rotating left this vector by the broadcast of an
2336      * input scalar
2337      */
2338     @ForceInline
2339     public final $abstractvectortype$ rotateL(int s, VectorMask<$Boxtype$> m) {
2340         return shiftL(s, m).or(shiftR(-s, m), m);
2341     }
2342 
2343     /**
2344      * Rotates right this vector by the broadcast of an input scalar.
2345      * <p>

2346      * This is a lane-wise binary operation which applies the operation
2347      * {@link $Wideboxtype$#rotateRight} to each lane and where
2348      * lane elements of this vector apply to the first argument, and lane
2349      * elements of the broadcast vector apply to the second argument (the
2350      * rotation distance).















2351      *
2352      * @param s the input scalar; the number of the bits to rotate right
2353      * @return the result of rotating right this vector by the broadcast of an
2354      * input scalar
2355      */
2356     @ForceInline
2357     public final $abstractvectortype$ rotateR(int s) {
2358         return shiftR(s).or(shiftL(-s));
2359     }
2360 
2361     /**
2362      * Rotates right this vector by the broadcast of an input scalar, selecting
2363      * lane elements controlled by a mask.
2364      * <p>

2365      * This is a lane-wise binary operation which applies the operation
2366      * {@link $Wideboxtype$#rotateRight} to each lane and where
2367      * lane elements of this vector apply to the first argument, and lane
2368      * elements of the broadcast vector apply to the second argument (the
2369      * rotation distance).















2370      *
2371      * @param s the input scalar; the number of the bits to rotate right
2372      * @param m the mask controlling lane selection
2373      * @return the result of rotating right this vector by the broadcast of an
2374      * input scalar
2375      */
2376     @ForceInline
2377     public final $abstractvectortype$ rotateR(int s, VectorMask<$Boxtype$> m) {
2378         return shiftR(s, m).or(shiftL(-s, m), m);
2379     }
2380 #end[intOrLong]
2381 #end[BITWISE]
2382 
2383     /**
2384      * {@inheritDoc}
2385      */
2386     @Override
2387     public abstract void intoByteArray(byte[] a, int ix);
2388 
2389     /**
2390      * {@inheritDoc}
2391      */
2392     @Override
2393     public abstract void intoByteArray(byte[] a, int ix, VectorMask<$Boxtype$> m);
2394 
2395     /**
2396      * {@inheritDoc}
2397      */
2398     @Override
2399     public abstract void intoByteBuffer(ByteBuffer bb, int ix);
2400 


2790         forEach(m, (n, e) -> a[a_offset + indexMap[i_offset + n]] = e);
2791     }
2792 #else[byteOrShort]
2793     public abstract void intoArray($type$[] a, int a_offset, VectorMask<$Boxtype$> m, int[] indexMap, int i_offset);
2794 #end[byteOrShort]
2795     // Species
2796 
2797     /**
2798      * {@inheritDoc}
2799      */
2800     @Override
2801     public abstract VectorSpecies<$Boxtype$> species();
2802 
2803     /**
2804      * Class representing {@link $abstractvectortype$}'s of the same {@link VectorShape VectorShape}.
2805      */
2806     static final class $Type$Species extends AbstractSpecies<$Boxtype$> {
2807         final Function<$type$[], $Type$Vector> vectorFactory;
2808 
2809         private $Type$Species(VectorShape shape,
2810                           Class<?> boxType,
2811                           Class<?> maskType,
2812                           Function<$type$[], $Type$Vector> vectorFactory,
2813                           Function<boolean[], VectorMask<$Boxtype$>> maskFactory,
2814                           Function<IntUnaryOperator, VectorShuffle<$Boxtype$>> shuffleFromArrayFactory,
2815                           fShuffleFromArray<$Boxtype$> shuffleFromOpFactory) {
2816             super(shape, $type$.class, $Boxtype$.SIZE, boxType, maskType, maskFactory,
2817                   shuffleFromArrayFactory, shuffleFromOpFactory);
2818             this.vectorFactory = vectorFactory;
2819         }
2820 
2821         interface FOp {
2822             $type$ apply(int i);
2823         }
2824 
2825         $Type$Vector op(FOp f) {
2826             $type$[] res = new $type$[length()];
2827             for (int i = 0; i < length(); i++) {
2828                 res[i] = f.apply(i);
2829             }
2830             return vectorFactory.apply(res);
2831         }
2832 
2833         $Type$Vector op(VectorMask<$Boxtype$> o, FOp f) {
2834             $type$[] res = new $type$[length()];
2835             boolean[] mbits = ((AbstractMask<$Boxtype$>)o).getBits();
2836             for (int i = 0; i < length(); i++) {




  98         void apply(int i, $type$ a);
  99     }
 100 
 101     abstract void forEach(FUnCon f);
 102 
 103     abstract void forEach(VectorMask<$Boxtype$> m, FUnCon f);
 104 
 105     // Static factories
 106 
 107     /**
 108      * Returns a vector where all lane elements are set to the default
 109      * primitive value.
 110      *
 111      * @param species species of desired vector
 112      * @return a zero vector of given species
 113      */
 114     @ForceInline
 115     @SuppressWarnings("unchecked")
 116     public static $abstractvectortype$ zero(VectorSpecies<$Boxtype$> species) {
 117 #if[FP]
 118         return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.vectorType(), $type$.class, species.length(),
 119                                                  $Type$.$type$To$Bitstype$Bits(0.0f), species,
 120                                                  ((bits, s) -> (($Type$Species)s).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
 121 #else[FP]
 122         return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.vectorType(), $type$.class, species.length(),
 123                                                  0, species,
 124                                                  ((bits, s) -> (($Type$Species)s).op(i -> ($type$)bits)));
 125 #end[FP]
 126     }
 127 
 128     /**
 129      * Loads a vector from a byte array starting at an offset.
 130      * <p>
 131      * Bytes are composed into primitive lane elements according to the
 132      * native byte order of the underlying platform
 133      * <p>
 134      * This method behaves as if it returns the result of calling the
 135      * byte buffer, offset, and mask accepting
 136      * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows:
 137      * <pre>{@code
 138      * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, VectorMask.allTrue());
 139      * }</pre>
 140      *
 141      * @param species species of desired vector
 142      * @param a the byte array
 143      * @param offset the offset into the array
 144      * @return a vector loaded from a byte array
 145      * @throws IndexOutOfBoundsException if {@code i < 0} or
 146      * {@code offset > a.length - (species.length() * species.elementSize() / Byte.SIZE)}
 147      */
 148     @ForceInline
 149     @SuppressWarnings("unchecked")
 150     public static $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, byte[] a, int offset) {
 151         Objects.requireNonNull(a);
 152         offset = VectorIntrinsics.checkIndex(offset, a.length, species.bitSize() / Byte.SIZE);
 153         return VectorIntrinsics.load((Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(),
 154                                      a, ((long) offset) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
 155                                      a, offset, species,
 156                                      (c, idx, s) -> {
 157                                          ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder());
 158                                          $Type$Buffer tb = bbc{#if[byte]?;:.as$Type$Buffer();}
 159                                          return (($Type$Species)s).op(i -> tb.get());
 160                                      });
 161     }
 162 
 163     /**
 164      * Loads a vector from a byte array starting at an offset and using a
 165      * mask.
 166      * <p>
 167      * Bytes are composed into primitive lane elements according to the
 168      * native byte order of the underlying platform.
 169      * <p>
 170      * This method behaves as if it returns the result of calling the
 171      * byte buffer, offset, and mask accepting
 172      * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows:
 173      * <pre>{@code


 191 
 192     /**
 193      * Loads a vector from an array starting at offset.
 194      * <p>
 195      * For each vector lane, where {@code N} is the vector lane index, the
 196      * array element at index {@code offset + N} is placed into the
 197      * resulting vector at lane index {@code N}.
 198      *
 199      * @param species species of desired vector
 200      * @param a the array
 201      * @param offset the offset into the array
 202      * @return the vector loaded from an array
 203      * @throws IndexOutOfBoundsException if {@code offset < 0}, or
 204      * {@code offset > a.length - species.length()}
 205      */
 206     @ForceInline
 207     @SuppressWarnings("unchecked")
 208     public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int offset){
 209         Objects.requireNonNull(a);
 210         offset = VectorIntrinsics.checkIndex(offset, a.length, species.length());
 211         return VectorIntrinsics.load((Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(),
 212                                      a, (((long) offset) << ARRAY_SHIFT) + Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
 213                                      a, offset, species,
 214                                      (c, idx, s) -> (($Type$Species)s).op(n -> c[idx + n]));
 215     }
 216 
 217 
 218     /**
 219      * Loads a vector from an array starting at offset and using a mask.
 220      * <p>
 221      * For each vector lane, where {@code N} is the vector lane index,
 222      * if the mask lane at index {@code N} is set then the array element at
 223      * index {@code offset + N} is placed into the resulting vector at lane index
 224      * {@code N}, otherwise the default element value is placed into the
 225      * resulting vector at lane index {@code N}.
 226      *
 227      * @param species species of desired vector
 228      * @param a the array
 229      * @param offset the offset into the array
 230      * @param m the mask
 231      * @return the vector loaded from an array


 264         return (($Type$Species)species).op(n -> a[a_offset + indexMap[i_offset + n]]);
 265     }
 266 #else[byteOrShort]
 267     @ForceInline
 268     @SuppressWarnings("unchecked")
 269     public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int a_offset, int[] indexMap, int i_offset) {
 270         Objects.requireNonNull(a);
 271         Objects.requireNonNull(indexMap);
 272 
 273 #if[longOrDouble]
 274         if (species.length() == 1) {
 275           return $abstractvectortype$.fromArray(species, a, a_offset + indexMap[i_offset]);
 276         }
 277 #end[longOrDouble]
 278 
 279         // Index vector: vix[0:n] = k -> a_offset + indexMap[i_offset + k]
 280         IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, i_offset).add(a_offset);
 281 
 282         vix = VectorIntrinsics.checkIndex(vix, a.length);
 283 
 284         return VectorIntrinsics.loadWithMap((Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(),
 285                                             IntVector.species(species.indexShape()).vectorType(), a, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, vix,
 286                                             a, a_offset, indexMap, i_offset, species,
 287                                             ($type$[] c, int idx, int[] iMap, int idy, VectorSpecies<$Boxtype$> s) ->
 288                                                 (($Type$Species)s).op(n -> c[idx + iMap[idy+n]]));
 289         }
 290 
 291 #end[byteOrShort]
 292     /**
 293      * Loads a vector from an array using indexes obtained from an index
 294      * map and using a mask.
 295      * <p>
 296      * For each vector lane, where {@code N} is the vector lane index,
 297      * if the mask lane at index {@code N} is set then the array element at
 298      * index {@code a_offset + indexMap[i_offset + N]} is placed into the resulting vector
 299      * at lane index {@code N}.
 300      *
 301      * @param species species of desired vector
 302      * @param a the array
 303      * @param a_offset the offset into the array, may be negative if relative
 304      * indexes in the index map compensate to produce a value within the
 305      * array bounds


 341      *   return fromByteBuffer(b, offset, VectorMask.allTrue())
 342      * }</pre>
 343      *
 344      * @param species species of desired vector
 345      * @param bb the byte buffer
 346      * @param offset the offset into the byte buffer
 347      * @return a vector loaded from a byte buffer
 348      * @throws IndexOutOfBoundsException if the offset is {@code < 0},
 349      * or {@code > b.limit()},
 350      * or if there are fewer than
 351      * {@code species.length() * species.elementSize() / Byte.SIZE} bytes
 352      * remaining in the byte buffer from the given offset
 353      */
 354     @ForceInline
 355     @SuppressWarnings("unchecked")
 356     public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int offset) {
 357         if (bb.order() != ByteOrder.nativeOrder()) {
 358             throw new IllegalArgumentException();
 359         }
 360         offset = VectorIntrinsics.checkIndex(offset, bb.limit(), species.bitSize() / Byte.SIZE);
 361         return VectorIntrinsics.load((Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(),
 362                                      U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + offset,
 363                                      bb, offset, species,
 364                                      (c, idx, s) -> {
 365                                          ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder());
 366                                          $Type$Buffer tb = bbc{#if[byte]?;:.as$Type$Buffer();}
 367                                          return (($Type$Species)s).op(i -> tb.get());
 368                                      });
 369     }
 370 
 371     /**
 372      * Loads a vector from a {@link ByteBuffer byte buffer} starting at an
 373      * offset into the byte buffer and using a mask.
 374      * <p>
 375      * This method behaves as if the byte buffer is viewed as a primitive
 376      * {@link java.nio.Buffer buffer} for the primitive element type,
 377      * according to the native byte order of the underlying platform, and
 378      * the returned vector is loaded with a mask from a primitive array
 379      * obtained from the primitive buffer.
 380      * The following pseudocode expresses the behaviour, where
 381      * {@code EBuffer} is the primitive buffer type, {@code e} is the


 406      */
 407     @ForceInline
 408     public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int offset, VectorMask<$Boxtype$> m) {
 409         return zero(species).blend(fromByteBuffer(species, bb, offset), m);
 410     }
 411 
 412     /**
 413      * Returns a vector where all lane elements are set to the primitive
 414      * value {@code e}.
 415      *
 416      * @param species species of the desired vector
 417      * @param e the value
 418      * @return a vector of vector where all lane elements are set to
 419      * the primitive value {@code e}
 420      */
 421 #if[FP]
 422     @ForceInline
 423     @SuppressWarnings("unchecked")
 424     public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> species, $type$ e) {
 425         return VectorIntrinsics.broadcastCoerced(
 426             (Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(),
 427             $Type$.$type$To$Bitstype$Bits(e), species,
 428             ((bits, sp) -> (($Type$Species)sp).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
 429     }
 430 #else[FP]
 431     @ForceInline
 432     @SuppressWarnings("unchecked")
 433     public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> species, $type$ e) {
 434         return VectorIntrinsics.broadcastCoerced(
 435             (Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(),
 436             e, species,
 437             ((bits, sp) -> (($Type$Species)sp).op(i -> ($type$)bits)));
 438     }
 439 #end[FP]
 440 
 441     /**
 442      * Returns a vector where each lane element is set to given
 443      * primitive values.
 444      * <p>
 445      * For each vector lane, where {@code N} is the vector lane index, the
 446      * the primitive value at index {@code N} is placed into the resulting
 447      * vector at lane index {@code N}.
 448      *
 449      * @param species species of the desired vector
 450      * @param es the given primitive values
 451      * @return a vector where each lane element is set to given primitive
 452      * values
 453      * @throws IndexOutOfBoundsException if {@code es.length < species.length()}
 454      */
 455     @ForceInline
 456     @SuppressWarnings("unchecked")
 457     public static $abstractvectortype$ scalars(VectorSpecies<$Boxtype$> species, $type$... es) {
 458         Objects.requireNonNull(es);
 459         int ix = VectorIntrinsics.checkIndex(0, es.length, species.length());
 460         return VectorIntrinsics.load((Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(),
 461                                      es, Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
 462                                      es, ix, species,
 463                                      (c, idx, sp) -> (($Type$Species)sp).op(n -> c[idx + n]));
 464     }
 465 
 466     /**
 467      * Returns a vector where the first lane element is set to the primtive
 468      * value {@code e}, all other lane elements are set to the default
 469      * value.
 470      *
 471      * @param species species of the desired vector
 472      * @param e the value
 473      * @return a vector where the first lane element is set to the primitive
 474      * value {@code e}
 475      */
 476     @ForceInline
 477     public static final $abstractvectortype$ single(VectorSpecies<$Boxtype$> species, $type$ e) {
 478         return zero(species).with(0, e);
 479     }
 480 


 836     @Override
 837     public abstract $abstractvectortype$ rearrange(Vector<$Boxtype$> v,
 838                                                       VectorShuffle<$Boxtype$> s, VectorMask<$Boxtype$> m);
 839 
 840     /**
 841      * {@inheritDoc}
 842      */
 843     @Override
 844     public abstract $abstractvectortype$ rearrange(VectorShuffle<$Boxtype$> m);
 845 
 846     /**
 847      * {@inheritDoc}
 848      */
 849     @Override
 850     public abstract $abstractvectortype$ reshape(VectorSpecies<$Boxtype$> s);
 851 
 852     /**
 853      * {@inheritDoc}
 854      */
 855     @Override
 856     public abstract $abstractvectortype$ rotateLanesLeft(int i);
 857 
 858     /**
 859      * {@inheritDoc}
 860      */
 861     @Override
 862     public abstract $abstractvectortype$ rotateLanesRight(int i);
 863 
 864     /**
 865      * {@inheritDoc}
 866      */
 867     @Override
 868     public abstract $abstractvectortype$ shiftLanesLeft(int i);
 869 
 870     /**
 871      * {@inheritDoc}
 872      */
 873     @Override
 874     public abstract $abstractvectortype$ shiftLanesRight(int i);
 875 
 876 #if[FP]
 877     /**
 878      * Divides this vector by an input vector.
 879      * <p>
 880      * This is a lane-wise binary operation which applies the primitive division
 881      * operation ({@code /}) to each lane.
 882      *
 883      * @param v the input vector
 884      * @return the result of dividing this vector by the input vector
 885      */
 886     public abstract $abstractvectortype$ div(Vector<$Boxtype$> v);
 887 
 888     /**
 889      * Divides this vector by the broadcast of an input scalar.
 890      * <p>
 891      * This is a lane-wise binary operation which applies the primitive division
 892      * operation ({@code /}) to each lane.
 893      *
 894      * @param s the input scalar


1886      * Bitwise NOTs this vector.
1887      * <p>
1888      * This is a lane-wise unary operation which applies the primitive bitwise NOT
1889      * operation ({@code ~}) to each lane.
1890      *
1891      * @return the bitwise NOT of this vector
1892      */
1893     public abstract $abstractvectortype$ not();
1894 
1895     /**
1896      * Bitwise NOTs this vector, selecting lane elements controlled by a mask.
1897      * <p>
1898      * This is a lane-wise unary operation which applies the primitive bitwise NOT
1899      * operation ({@code ~}) to each lane.
1900      *
1901      * @param m the mask controlling lane selection
1902      * @return the bitwise NOT of this vector
1903      */
1904     public abstract $abstractvectortype$ not(VectorMask<$Boxtype$> m);
1905 

1906     /**
1907      * Logically left shifts this vector by the broadcast of an input scalar.
1908      * <p>
1909      * This is a lane-wise binary operation which applies the primitive logical left shift
1910      * operation ({@code <<}) to each lane to left shift the
1911      * element by shift value as specified by the input scalar.
1912 #if[byte]
1913      * Only the 3 lowest-order bits of shift value are used. It is as if the shift value
1914      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
1915      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.





1916 #end[byte]
1917 #if[short]
1918      * Only the 4 lowest-order bits of shift value are used. It is as if the shift value






1919      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
1920      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.





1921 #end[short]






1922      *
1923      * @param s the input scalar; the number of the bits to left shift
1924      * @return the result of logically left shifting left this vector by the
1925      * broadcast of an input scalar
1926      */
1927     public abstract $abstractvectortype$ shiftLeft(int s);

1928 

1929     /**
1930      * Logically left shifts this vector by the broadcast of an input scalar,
1931      * selecting lane elements controlled by a mask.
1932      * <p>
1933      * This is a lane-wise binary operation which applies the primitive logical left shift
1934      * operation ({@code <<}) to each lane to left shift the
1935      * element by shift value as specified by the input scalar.
1936 #if[byte]
1937      * Only the 3 lowest-order bits of shift value are used. It is as if the shift value
1938      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
1939      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.






1940 #end[byte]
1941 #if[short]
1942      * Only the 4 lowest-order bits of shift value are used. It is as if the shift value







1943      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
1944      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.






1945 #end[short]







1946      *
1947      * @param s the input scalar; the number of the bits to left shift
1948      * @param m the mask controlling lane selection
1949      * @return the result of logically left shifting left this vector by the
1950      * broadcast of an input scalar
1951      */
1952     public abstract $abstractvectortype$ shiftLeft(int s, VectorMask<$Boxtype$> m);

1953 

1954     /**
1955      * Logically left shifts this vector by an input vector.
1956      * <p>
1957      * This is a lane-wise binary operation which applies the primitive logical left shift
1958      * operation ({@code <<}) to each lane. For each lane of this vector, the
1959      * shift value is the corresponding lane of input vector.
1960 #if[byte]
1961      * Only the 3 lowest-order bits of shift value are used. It is as if the shift value
1962      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
1963      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
1964 #end[byte]
1965 #if[short]
1966      * Only the 4 lowest-order bits of shift value are used. It is as if the shift value
1967      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
1968      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
1969 #end[short]
1970      *
1971      * @param v the input vector
1972      * @return the result of logically left shifting this vector by the input
1973      * vector
1974      */
1975     public abstract $abstractvectortype$ shiftLeft(Vector<$Boxtype$> v);
1976 
1977     /**
1978      * Logically left shifts this vector by an input vector, selecting lane
1979      * elements controlled by a mask.
1980      * <p>
1981      * This is a lane-wise binary operation which applies the primitive logical left shift
1982      * operation ({@code <<}) to each lane. For each lane of this vector, the
1983      * shift value is the corresponding lane of input vector.
1984 #if[byte]
1985      * Only the 3 lowest-order bits of shift value are used. It is as if the shift value
1986      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
1987      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
1988 #end[byte]
1989 #if[short]
1990      * Only the 4 lowest-order bits of shift value are used. It is as if the shift value
1991      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
1992      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
1993 #end[short]
1994      *
1995      * @param v the input vector
1996      * @param m the mask controlling lane selection
1997      * @return the result of logically left shifting this vector by the input
1998      * vector
1999      */
2000     public $abstractvectortype$ shiftLeft(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
2001         return blend(shiftLeft(v), m);
2002     }

2003 
2004     // logical, or unsigned, shift right
2005 

2006      /**
2007      * Logically right shifts (or unsigned right shifts) this vector by the
2008      * broadcast of an input scalar.
2009      * <p>
2010      * This is a lane-wise binary operation which applies the primitive logical right shift
2011      * operation ({@code >>>}) to each lane to logically right shift the
2012      * element by shift value as specified by the input scalar.
2013 #if[byte]
2014      * Only the 3 lowest-order bits of shift value are used. It is as if the shift value
2015      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2016      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.





2017 #end[byte]
2018 #if[short]
2019      * Only the 4 lowest-order bits of shift value are used. It is as if the shift value







2020      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2021      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.





2022 #end[short]







2023      *
2024      * @param s the input scalar; the number of the bits to right shift
2025      * @return the result of logically right shifting this vector by the
2026      * broadcast of an input scalar
2027      */
2028     public abstract $abstractvectortype$ shiftRight(int s);

2029 

2030      /**
2031      * Logically right shifts (or unsigned right shifts) this vector by the
2032      * broadcast of an input scalar, selecting lane elements controlled by a
2033      * mask.
2034      * <p>
2035      * This is a lane-wise binary operation which applies the primitive logical right shift
2036      * operation ({@code >>}) to each lane to logically right shift the
2037      * element by shift value as specified by the input scalar.
2038 #if[byte]
2039      * Only the 3 lowest-order bits of shift value are used. It is as if the shift value
2040      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2041      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.






2042 #end[byte]
2043 #if[short]
2044      * Only the 4 lowest-order bits of shift value are used. It is as if the shift value








2045      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2046      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.






2047 #end[short]








2048      *
2049      * @param s the input scalar; the number of the bits to right shift
2050      * @param m the mask controlling lane selection
2051      * @return the result of logically right shifting this vector by the
2052      * broadcast of an input scalar
2053      */
2054     public abstract $abstractvectortype$ shiftRight(int s, VectorMask<$Boxtype$> m);

2055 

2056     /**
2057      * Logically right shifts (or unsigned right shifts) this vector by an
2058      * input vector.
2059      * <p>
2060      * This is a lane-wise binary operation which applies the primitive logical right shift
2061      * operation ({@code >>>}) to each lane. For each lane of this vector, the
2062      * shift value is the corresponding lane of input vector.
2063 #if[byte]
2064      * Only the 3 lowest-order bits of shift value are used. It is as if the shift value
2065      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2066      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2067 #end[byte]
2068 #if[short]
2069      * Only the 4 lowest-order bits of shift value are used. It is as if the shift value
2070      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2071      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2072 #end[short]
2073      *
2074      * @param v the input vector
2075      * @return the result of logically right shifting this vector by the
2076      * input vector
2077      */
2078     public abstract $abstractvectortype$ shiftRight(Vector<$Boxtype$> v);
2079 
2080     /**
2081      * Logically right shifts (or unsigned right shifts) this vector by an
2082      * input vector, selecting lane elements controlled by a mask.
2083      * <p>
2084      * This is a lane-wise binary operation which applies the primitive logical right shift
2085      * operation ({@code >>>}) to each lane. For each lane of this vector, the
2086      * shift value is the corresponding lane of input vector.
2087 #if[byte]
2088      * Only the 3 lowest-order bits of shift value are used. It is as if the shift value
2089      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2090      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2091 #end[byte]
2092 #if[short]
2093      * Only the 4 lowest-order bits of shift value are used. It is as if the shift value
2094      * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2095      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2096 #end[short]
2097      *
2098      * @param v the input vector
2099      * @param m the mask controlling lane selection
2100      * @return the result of logically right shifting this vector by the
2101      * input vector
2102      */
2103     public $abstractvectortype$ shiftRight(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
2104         return blend(shiftRight(v), m);
2105     }

2106 

2107     /**
2108      * Arithmetically right shifts (or signed right shifts) this vector by the
2109      * broadcast of an input scalar.
2110      * <p>
2111      * This is a lane-wise binary operation which applies the primitive arithmetic right
2112      * shift operation ({@code >>}) to each lane to arithmetically
2113      * right shift the element by shift value as specified by the input scalar.
2114 #if[byte]
2115      * Only the 3 lowest-order bits of shift value are used. It is as if the shift
2116      * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2117      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.





2118 #end[byte]
2119 #if[short]







2120      * Only the 4 lowest-order bits of shift value are used. It is as if the shift
2121      * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2122      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.





2123 #end[short]







2124      *
2125      * @param s the input scalar; the number of the bits to right shift
2126      * @return the result of arithmetically right shifting this vector by the
2127      * broadcast of an input scalar
2128      */
2129     public abstract $abstractvectortype$ shiftArithmeticRight(int s);

2130 

2131     /**
2132      * Arithmetically right shifts (or signed right shifts) this vector by the
2133      * broadcast of an input scalar, selecting lane elements controlled by a
2134      * mask.
2135      * <p>
2136      * This is a lane-wise binary operation which applies the primitive arithmetic right
2137      * shift operation ({@code >>}) to each lane to arithmetically
2138      * right shift the element by shift value as specified by the input scalar.
2139 #if[byte]
2140      * Only the 3 lowest-order bits of shift value are used. It is as if the shift
2141      * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2142      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.






2143 #end[byte]
2144 #if[short]








2145      * Only the 4 lowest-order bits of shift value are used. It is as if the shift
2146      * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2147      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.






2148 #end[short]








2149      *
2150      * @param s the input scalar; the number of the bits to right shift
2151      * @param m the mask controlling lane selection
2152      * @return the result of arithmetically right shifting this vector by the
2153      * broadcast of an input scalar
2154      */
2155     public abstract $abstractvectortype$ shiftArithmeticRight(int s, VectorMask<$Boxtype$> m);

2156 

2157     /**
2158      * Arithmetically right shifts (or signed right shifts) this vector by an
2159      * input vector.
2160      * <p>
2161      * This is a lane-wise binary operation which applies the primitive arithmetic right
2162      * shift operation ({@code >>}) to each lane. For each lane of this vector, the
2163      * shift value is the corresponding lane of input vector.
2164 #if[byte]
2165      * Only the 3 lowest-order bits of shift value are used. It is as if the shift
2166      * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2167      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2168 #end[byte]
2169 #if[short]
2170      * Only the 4 lowest-order bits of shift value are used. It is as if the shift
2171      * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2172      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2173 #end[short]
2174      *
2175      * @param v the input vector
2176      * @return the result of arithmetically right shifting this vector by the
2177      * input vector
2178      */
2179     public abstract $abstractvectortype$ shiftArithmeticRight(Vector<$Boxtype$> v);
2180 
2181     /**
2182      * Arithmetically right shifts (or signed right shifts) this vector by an
2183      * input vector, selecting lane elements controlled by a mask.
2184      * <p>
2185      * This is a lane-wise binary operation which applies the primitive arithmetic right
2186      * shift operation ({@code >>}) to each lane. For each lane of this vector, the
2187      * shift value is the corresponding lane of input vector.
2188 #if[byte]
2189      * Only the 3 lowest-order bits of shift value are used. It is as if the shift
2190      * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2191      * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2192 #end[byte]
2193 #if[short]
2194      * Only the 4 lowest-order bits of shift value are used. It is as if the shift
2195      * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2196      * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2197 #end[short]
2198      *
2199      * @param v the input vector
2200      * @param m the mask controlling lane selection
2201      * @return the result of arithmetically right shifting this vector by the
2202      * input vector
2203      */
2204     public $abstractvectortype$ shiftArithmeticRight(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
2205         return blend(shiftArithmeticRight(v), m);
2206     }
2207 
2208     /**
2209      * Rotates left this vector by the broadcast of an input scalar.
2210      * <p>
2211 #if[intOrLong]
2212      * This is a lane-wise binary operation which applies the operation
2213      * {@link $Wideboxtype$#rotateLeft} to each lane and where
2214      * lane elements of this vector apply to the first argument, and lane
2215      * elements of the broadcast vector apply to the second argument (the
2216      * rotation distance).
2217 #end[intOrLong]
2218 #if[byte]
2219      * This is a lane-wise binary operation which produces the result of rotating left the two's
2220      * complement binary representation of each lane of first operand (this vector) by input scalar.
2221      * Rotation by any multiple of 8 is a no-op, so only the 3 lowest-order bits of input value are used.
2222      * It is as if the input value were subjected to a bitwise logical
2223      * AND operator ({@code &}) with the mask value 0x7.
2224 #end[byte]
2225 #if[short]
2226      * This is a lane-wise binary operation which produces the result of rotating left the two's
2227      * complement binary representation of each lane of first operand (this vector) by input scalar.
2228      * Rotation by any multiple of 16 is a no-op, so only the 4 lowest-order bits of input value are used.
2229      * It is as if the input value were subjected to a bitwise logical
2230      * AND operator ({@code &}) with the mask value 0x15.
2231 #end[short]
2232      *
2233      * @param s the input scalar; the number of the bits to rotate left
2234      * @return the result of rotating left this vector by the broadcast of an
2235      * input scalar
2236      */
2237     @ForceInline
2238     public final $abstractvectortype$ rotateLeft(int s) {
2239         return shiftLeft(s).or(shiftRight(-s));
2240     }
2241 
2242     /**
2243      * Rotates left this vector by the broadcast of an input scalar, selecting
2244      * lane elements controlled by a mask.
2245      * <p>
2246 #if[intOrLong]
2247      * This is a lane-wise binary operation which applies the operation
2248      * {@link $Wideboxtype$#rotateLeft} to each lane and where
2249      * lane elements of this vector apply to the first argument, and lane
2250      * elements of the broadcast vector apply to the second argument (the
2251      * rotation distance).
2252 #end[intOrLong]
2253 #if[byte]
2254      * This is a lane-wise binary operation which produces the result of rotating left the two's
2255      * complement binary representation of each lane of first operand (this vector) by input scalar.
2256      * Rotation by any multiple of 8 is a no-op, so only the 3 lowest-order bits of input value are used.
2257      * It is as if the input value were subjected to a bitwise logical
2258      * AND operator ({@code &}) with the mask value 0x7.
2259 #end[byte]
2260 #if[short]
2261      * This is a lane-wise binary operation which produces the result of rotating left the two's
2262      * complement binary representation of each lane of first operand (this vector) by input scalar.
2263      * Rotation by any multiple of 16 is a no-op, so only the 4 lowest-order bits of input value are used.
2264      * It is as if the input value were subjected to a bitwise logical
2265      * AND operator ({@code &}) with the mask value 0x15.
2266 #end[short]
2267      *
2268      * @param s the input scalar; the number of the bits to rotate left
2269      * @param m the mask controlling lane selection
2270      * @return the result of rotating left this vector by the broadcast of an
2271      * input scalar
2272      */
2273     @ForceInline
2274     public final $abstractvectortype$ rotateLeft(int s, VectorMask<$Boxtype$> m) {
2275         return shiftLeft(s, m).or(shiftRight(-s, m), m);
2276     }
2277 
2278     /**
2279      * Rotates right this vector by the broadcast of an input scalar.
2280      * <p>
2281 #if[intOrLong]
2282      * This is a lane-wise binary operation which applies the operation
2283      * {@link $Wideboxtype$#rotateRight} to each lane and where
2284      * lane elements of this vector apply to the first argument, and lane
2285      * elements of the broadcast vector apply to the second argument (the
2286      * rotation distance).
2287 #end[intOrLong]
2288 #if[byte]
2289      * This is a lane-wise binary operation which produces the result of rotating right the two's
2290      * complement binary representation of each lane of first operand (this vector) by input scalar.
2291      * Rotation by any multiple of 8 is a no-op, so only the 3 lowest-order bits of input value are used.
2292      * It is as if the input value were subjected to a bitwise logical
2293      * AND operator ({@code &}) with the mask value 0x7.
2294 #end[byte]
2295 #if[short]
2296      * This is a lane-wise binary operation which produces the result of rotating right the two's
2297      * complement binary representation of each lane of first operand (this vector) by input scalar.
2298      * Rotation by any multiple of 16 is a no-op, so only the 4 lowest-order bits of input value are used.
2299      * It is as if the input value were subjected to a bitwise logical
2300      * AND operator ({@code &}) with the mask value 0x15.
2301 #end[short]
2302      *
2303      * @param s the input scalar; the number of the bits to rotate right
2304      * @return the result of rotating right this vector by the broadcast of an
2305      * input scalar
2306      */
2307     @ForceInline
2308     public final $abstractvectortype$ rotateRight(int s) {
2309         return shiftRight(s).or(shiftLeft(-s));
2310     }
2311 
2312     /**
2313      * Rotates right this vector by the broadcast of an input scalar, selecting
2314      * lane elements controlled by a mask.
2315      * <p>
2316 #if[intOrLong]
2317      * This is a lane-wise binary operation which applies the operation
2318      * {@link $Wideboxtype$#rotateRight} to each lane and where
2319      * lane elements of this vector apply to the first argument, and lane
2320      * elements of the broadcast vector apply to the second argument (the
2321      * rotation distance).
2322 #end[intOrLong]
2323 #if[byte]
2324      * This is a lane-wise binary operation which produces the result of rotating right the two's
2325      * complement binary representation of each lane of first operand (this vector) by input scalar.
2326      * Rotation by any multiple of 8 is a no-op, so only the 3 lowest-order bits of input value are used.
2327      * It is as if the input value were subjected to a bitwise logical
2328      * AND operator ({@code &}) with the mask value 0x7.
2329 #end[byte]
2330 #if[short]
2331      * This is a lane-wise binary operation which produces the result of rotating right the two's
2332      * complement binary representation of each lane of first operand (this vector) by input scalar.
2333      * Rotation by any multiple of 16 is a no-op, so only the 4 lowest-order bits of input value are used.
2334      * It is as if the input value were subjected to a bitwise logical
2335      * AND operator ({@code &}) with the mask value 0x15.
2336 #end[short]
2337      *
2338      * @param s the input scalar; the number of the bits to rotate right
2339      * @param m the mask controlling lane selection
2340      * @return the result of rotating right this vector by the broadcast of an
2341      * input scalar
2342      */
2343     @ForceInline
2344     public final $abstractvectortype$ rotateRight(int s, VectorMask<$Boxtype$> m) {
2345         return shiftRight(s, m).or(shiftLeft(-s, m), m);
2346     }

2347 #end[BITWISE]
2348 
2349     /**
2350      * {@inheritDoc}
2351      */
2352     @Override
2353     public abstract void intoByteArray(byte[] a, int ix);
2354 
2355     /**
2356      * {@inheritDoc}
2357      */
2358     @Override
2359     public abstract void intoByteArray(byte[] a, int ix, VectorMask<$Boxtype$> m);
2360 
2361     /**
2362      * {@inheritDoc}
2363      */
2364     @Override
2365     public abstract void intoByteBuffer(ByteBuffer bb, int ix);
2366 


2756         forEach(m, (n, e) -> a[a_offset + indexMap[i_offset + n]] = e);
2757     }
2758 #else[byteOrShort]
2759     public abstract void intoArray($type$[] a, int a_offset, VectorMask<$Boxtype$> m, int[] indexMap, int i_offset);
2760 #end[byteOrShort]
2761     // Species
2762 
2763     /**
2764      * {@inheritDoc}
2765      */
2766     @Override
2767     public abstract VectorSpecies<$Boxtype$> species();
2768 
2769     /**
2770      * Class representing {@link $abstractvectortype$}'s of the same {@link VectorShape VectorShape}.
2771      */
2772     static final class $Type$Species extends AbstractSpecies<$Boxtype$> {
2773         final Function<$type$[], $Type$Vector> vectorFactory;
2774 
2775         private $Type$Species(VectorShape shape,
2776                           Class<?> vectorType,
2777                           Class<?> maskType,
2778                           Function<$type$[], $Type$Vector> vectorFactory,
2779                           Function<boolean[], VectorMask<$Boxtype$>> maskFactory,
2780                           Function<IntUnaryOperator, VectorShuffle<$Boxtype$>> shuffleFromArrayFactory,
2781                           fShuffleFromArray<$Boxtype$> shuffleFromOpFactory) {
2782             super(shape, $type$.class, $Boxtype$.SIZE, vectorType, maskType, maskFactory,
2783                   shuffleFromArrayFactory, shuffleFromOpFactory);
2784             this.vectorFactory = vectorFactory;
2785         }
2786 
2787         interface FOp {
2788             $type$ apply(int i);
2789         }
2790 
2791         $Type$Vector op(FOp f) {
2792             $type$[] res = new $type$[length()];
2793             for (int i = 0; i < length(); i++) {
2794                 res[i] = f.apply(i);
2795             }
2796             return vectorFactory.apply(res);
2797         }
2798 
2799         $Type$Vector op(VectorMask<$Boxtype$> o, FOp f) {
2800             $type$[] res = new $type$[length()];
2801             boolean[] mbits = ((AbstractMask<$Boxtype$>)o).getBits();
2802             for (int i = 0; i < length(); i++) {


< prev index next >