< prev index next >

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

Print this page

        

*** 1054,1105 **** } @Override public Byte128Vector rotateLanesLeft(int j) { ! byte[] vec = getElements(); ! byte[] res = new byte[length()]; ! for (int i = 0; i < length(); i++){ ! res[(j + i) % length()] = vec[i]; } - return new Byte128Vector(res); } @Override public Byte128Vector rotateLanesRight(int j) { ! byte[] vec = getElements(); ! byte[] res = new byte[length()]; ! for (int i = 0; i < length(); i++){ ! int z = i - j; ! if(j < 0) { ! res[length() + z] = vec[i]; } else { ! res[z] = vec[i]; ! } } - return new Byte128Vector(res); } @Override public Byte128Vector shiftLanesLeft(int j) { ! byte[] vec = getElements(); ! byte[] res = new byte[length()]; ! for (int i = 0; i < length() - j; i++) { ! res[i] = vec[i + j]; } - return new Byte128Vector(res); } @Override public Byte128Vector shiftLanesRight(int j) { ! byte[] vec = getElements(); ! byte[] res = new byte[length()]; ! for (int i = 0; i < length() - j; i++){ ! res[i + j] = vec[i]; } - return new Byte128Vector(res); } @Override @ForceInline public Byte128Vector rearrange(Vector<Byte> v, --- 1054,1120 ---- } @Override + @ForceInline public Byte128Vector rotateLanesLeft(int j) { ! int L = length(); ! if (j < 0) { ! throw new IllegalArgumentException("Index " + j + " must be zero or positive"); ! } else { ! j = j & (L-1); ! VectorShuffle<Byte> PermMask = VectorShuffle.shuffleIota(SPECIES, L - j); ! return this.rearrange(PermMask); } } @Override + @ForceInline public Byte128Vector rotateLanesRight(int j) { ! int L = length(); ! if (j < 0) { ! throw new IllegalArgumentException("Index " + j + " must be zero or positive"); } else { ! j = j & (L-1); ! VectorShuffle<Byte> PermMask = VectorShuffle.shuffleIota(SPECIES, j); ! return this.rearrange(PermMask); } } @Override + @ForceInline + @SuppressWarnings("unchecked") public Byte128Vector shiftLanesLeft(int j) { ! int L = length(); ! if (j < 0) { ! throw new IllegalArgumentException("Index " + j + " must be zero or positive"); ! } else if ( j >= L ) { ! return ZERO; ! } else { ! Byte128Shuffle Iota = (Byte128Shuffle)(VectorShuffle.shuffleIota(SPECIES, L-j)); ! VectorMask<Byte> BlendMask = Iota.toVector().lessThan(Byte128Vector.broadcast(SPECIES, (byte)(L-j))); ! Iota = (Byte128Shuffle)(VectorShuffle.shuffleIota(SPECIES, L -j)); ! return ZERO.blend(this.rearrange(Iota),BlendMask); } } @Override + @ForceInline + @SuppressWarnings("unchecked") public Byte128Vector shiftLanesRight(int j) { ! int L = length(); ! if (j < 0) { ! throw new IllegalArgumentException("Index " + j + " must be zero or positive"); ! } else if ( j >= L ) { ! return ZERO; ! } else { ! Byte128Shuffle Iota = (Byte128Shuffle)(VectorShuffle.shuffleIota(SPECIES, j)); ! VectorMask<Byte> BlendMask = Iota.toVector().greaterThanEq(Byte128Vector.broadcast(SPECIES, (byte)(j))); ! Iota = (Byte128Shuffle)(VectorShuffle.shuffleIota(SPECIES, j)); ! return ZERO.blend(this.rearrange(Iota),BlendMask); } } @Override @ForceInline public Byte128Vector rearrange(Vector<Byte> v,
*** 1334,1354 **** @Override public VectorSpecies<Byte> species() { return SPECIES; } ! @Override ! public ByteVector toVector() { byte[] va = new byte[SPECIES.length()]; for (int i = 0; i < va.length; i++) { va[i] = (byte) lane(i); } return ByteVector.fromArray(SPECIES, va, 0); } @Override @ForceInline @SuppressWarnings("unchecked") public <F> VectorShuffle<F> cast(VectorSpecies<F> species) { if (length() != species.length()) throw new IllegalArgumentException("Shuffle length and species length differ"); Class<?> stype = species.elementType(); --- 1349,1376 ---- @Override public VectorSpecies<Byte> species() { return SPECIES; } ! private ByteVector toVector_helper() { byte[] va = new byte[SPECIES.length()]; for (int i = 0; i < va.length; i++) { va[i] = (byte) lane(i); } return ByteVector.fromArray(SPECIES, va, 0); } @Override @ForceInline + public ByteVector toVector() { + return VectorIntrinsics.shuffleToVector(Byte128Vector.class, byte.class, Byte128Shuffle.class, this, + SPECIES.length(), + (s) -> (((Byte128Shuffle)(s)).toVector_helper())); + } + + @Override + @ForceInline @SuppressWarnings("unchecked") public <F> VectorShuffle<F> cast(VectorSpecies<F> species) { if (length() != species.length()) throw new IllegalArgumentException("Shuffle length and species length differ"); Class<?> stype = species.elementType();
*** 1368,1377 **** --- 1390,1400 ---- } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } + @Override public Byte128Shuffle rearrange(VectorShuffle<Byte> o) { Byte128Shuffle s = (Byte128Shuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) {
< prev index next >