< prev index next >

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

Print this page

        

*** 1054,1105 **** } @Override public Byte512Vector 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 Byte512Vector(res); } @Override public Byte512Vector 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 Byte512Vector(res); } @Override public Byte512Vector 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 Byte512Vector(res); } @Override public Byte512Vector 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 Byte512Vector(res); } @Override @ForceInline public Byte512Vector rearrange(Vector<Byte> v, --- 1054,1120 ---- } @Override + @ForceInline public Byte512Vector 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 Byte512Vector 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 Byte512Vector 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 { ! Byte512Shuffle Iota = (Byte512Shuffle)(VectorShuffle.shuffleIota(SPECIES, L-j)); ! VectorMask<Byte> BlendMask = Iota.toVector().lessThan(Byte512Vector.broadcast(SPECIES, (byte)(L-j))); ! Iota = (Byte512Shuffle)(VectorShuffle.shuffleIota(SPECIES, L -j)); ! return ZERO.blend(this.rearrange(Iota),BlendMask); } } @Override + @ForceInline + @SuppressWarnings("unchecked") public Byte512Vector 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 { ! Byte512Shuffle Iota = (Byte512Shuffle)(VectorShuffle.shuffleIota(SPECIES, j)); ! VectorMask<Byte> BlendMask = Iota.toVector().greaterThanEq(Byte512Vector.broadcast(SPECIES, (byte)(j))); ! Iota = (Byte512Shuffle)(VectorShuffle.shuffleIota(SPECIES, j)); ! return ZERO.blend(this.rearrange(Iota),BlendMask); } } @Override @ForceInline public Byte512Vector 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(Byte512Vector.class, byte.class, Byte512Shuffle.class, this, + SPECIES.length(), + (s) -> (((Byte512Shuffle)(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 Byte512Shuffle rearrange(VectorShuffle<Byte> o) { Byte512Shuffle s = (Byte512Shuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) {
< prev index next >