< prev index next >

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

Print this page




 129     @ForceInline
 130     public static <E> VectorShuffle<E> shuffleIota(VectorSpecies<E> species) {
 131         return ((AbstractSpecies<E>) species).shuffleFromOpFactory.apply(AbstractShuffle.IDENTITY);
 132     }
 133 
 134     /**
 135      * Returns a shuffle with lane elements set to sequential {@code int} values starting from {@code start}.
 136      * <p>
 137      * This method behaves as if a shuffle is created from an identity
 138      * index mapping function as follows:
 139      * <pre>{@code
 140      *   return VectorShuffle.shuffle(i -> i + start);
 141      * }</pre>
 142      *
 143      * @param species shuffle species
 144      * @param start starting value of sequence
 145      * @return a shuffle of lane indexes
 146      * @see Vector#shuffleIota(int)
 147      */
 148     @ForceInline

 149     public static <E> VectorShuffle<E> shuffleIota(VectorSpecies<E> species, int start) {
 150         return ((AbstractSpecies<E>) species).shuffleFromOpFactory.apply(i -> i + start);















 151     }
 152 
 153     /**
 154      * Returns a shuffle with lane elements set to sequential {@code int} values starting from {@code start}
 155      * and looping around species length.
 156      * <p>
 157      * This method behaves as if a shuffle is created from an identity
 158      * index mapping function as follows:
 159      * <pre>{@code
 160      *   return VectorShuffle.shuffle(i -> (i + start) & (species.length() - 1));
 161      * }</pre>
 162      *
 163      * @param species shuffle species
 164      * @param start starting value of sequence
 165      * @return a shuffle of lane indexes
 166      * @see Vector#shuffleOffset(int)
 167      */
 168     @ForceInline
 169     public static <E> VectorShuffle<E> shuffleOffset(VectorSpecies<E> species, int start) {
 170         return ((AbstractSpecies<E>) species).shuffleFromOpFactory.apply(i -> (i + start) & (species.length() - 1));




 129     @ForceInline
 130     public static <E> VectorShuffle<E> shuffleIota(VectorSpecies<E> species) {
 131         return ((AbstractSpecies<E>) species).shuffleFromOpFactory.apply(AbstractShuffle.IDENTITY);
 132     }
 133 
 134     /**
 135      * Returns a shuffle with lane elements set to sequential {@code int} values starting from {@code start}.
 136      * <p>
 137      * This method behaves as if a shuffle is created from an identity
 138      * index mapping function as follows:
 139      * <pre>{@code
 140      *   return VectorShuffle.shuffle(i -> i + start);
 141      * }</pre>
 142      *
 143      * @param species shuffle species
 144      * @param start starting value of sequence
 145      * @return a shuffle of lane indexes
 146      * @see Vector#shuffleIota(int)
 147      */
 148     @ForceInline
 149     @SuppressWarnings("unchecked")
 150     public static <E> VectorShuffle<E> shuffleIota(VectorSpecies<E> species, int start) {
 151        Class<?> elementType = species.elementType();
 152        if (elementType == byte.class) {
 153            return (VectorShuffle) ByteVector.shuffleIotaHelper((VectorSpecies<Byte>) species, start);
 154        } else if (elementType == short.class) {
 155            return (VectorShuffle) ShortVector.shuffleIotaHelper((VectorSpecies<Short>) species, start);
 156        } else if (elementType == int.class) {
 157            return (VectorShuffle) IntVector.shuffleIotaHelper((VectorSpecies<Integer>) species, start);
 158        } else if (elementType == long.class) {
 159            return (VectorShuffle) LongVector.shuffleIotaHelper((VectorSpecies<Long>) species, start);
 160        } else if (elementType == float.class) {
 161            return (VectorShuffle) FloatVector.shuffleIotaHelper((VectorSpecies<Float>) species, start);
 162        } else if (elementType == double.class) {
 163            return (VectorShuffle) DoubleVector.shuffleIotaHelper((VectorSpecies<Double>) species, start);
 164        } else {
 165            throw new UnsupportedOperationException("Bad lane type for shuffleIota.");
 166        }
 167     }
 168 
 169     /**
 170      * Returns a shuffle with lane elements set to sequential {@code int} values starting from {@code start}
 171      * and looping around species length.
 172      * <p>
 173      * This method behaves as if a shuffle is created from an identity
 174      * index mapping function as follows:
 175      * <pre>{@code
 176      *   return VectorShuffle.shuffle(i -> (i + start) & (species.length() - 1));
 177      * }</pre>
 178      *
 179      * @param species shuffle species
 180      * @param start starting value of sequence
 181      * @return a shuffle of lane indexes
 182      * @see Vector#shuffleOffset(int)
 183      */
 184     @ForceInline
 185     public static <E> VectorShuffle<E> shuffleOffset(VectorSpecies<E> species, int start) {
 186         return ((AbstractSpecies<E>) species).shuffleFromOpFactory.apply(i -> (i + start) & (species.length() - 1));


< prev index next >