< prev index next >

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

Print this page

        

*** 1054,1105 **** } @Override public ShortMaxVector rotateLanesLeft(int j) { ! short[] vec = getElements(); ! short[] res = new short[length()]; ! for (int i = 0; i < length(); i++){ ! res[(j + i) % length()] = vec[i]; } - return new ShortMaxVector(res); } @Override public ShortMaxVector rotateLanesRight(int j) { ! short[] vec = getElements(); ! short[] res = new short[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 ShortMaxVector(res); } @Override public ShortMaxVector shiftLanesLeft(int j) { ! short[] vec = getElements(); ! short[] res = new short[length()]; ! for (int i = 0; i < length() - j; i++) { ! res[i] = vec[i + j]; } - return new ShortMaxVector(res); } @Override public ShortMaxVector shiftLanesRight(int j) { ! short[] vec = getElements(); ! short[] res = new short[length()]; ! for (int i = 0; i < length() - j; i++){ ! res[i + j] = vec[i]; } - return new ShortMaxVector(res); } @Override @ForceInline public ShortMaxVector rearrange(Vector<Short> v, --- 1054,1120 ---- } @Override + @ForceInline public ShortMaxVector 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<Short> PermMask = VectorShuffle.shuffleIota(SPECIES, L - j); ! return this.rearrange(PermMask); } } @Override + @ForceInline public ShortMaxVector 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<Short> PermMask = VectorShuffle.shuffleIota(SPECIES, j); ! return this.rearrange(PermMask); } } @Override + @ForceInline + @SuppressWarnings("unchecked") public ShortMaxVector 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 { ! ShortMaxShuffle Iota = (ShortMaxShuffle)(VectorShuffle.shuffleIota(SPECIES, L-j)); ! VectorMask<Short> BlendMask = Iota.toVector().lessThan(ShortMaxVector.broadcast(SPECIES, (short)(L-j))); ! Iota = (ShortMaxShuffle)(VectorShuffle.shuffleIota(SPECIES, L -j)); ! return ZERO.blend(this.rearrange(Iota),BlendMask); } } @Override + @ForceInline + @SuppressWarnings("unchecked") public ShortMaxVector 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 { ! ShortMaxShuffle Iota = (ShortMaxShuffle)(VectorShuffle.shuffleIota(SPECIES, j)); ! VectorMask<Short> BlendMask = Iota.toVector().greaterThanEq(ShortMaxVector.broadcast(SPECIES, (short)(j))); ! Iota = (ShortMaxShuffle)(VectorShuffle.shuffleIota(SPECIES, j)); ! return ZERO.blend(this.rearrange(Iota),BlendMask); } } @Override @ForceInline public ShortMaxVector rearrange(Vector<Short> v,
*** 1334,1354 **** @Override public VectorSpecies<Short> species() { return SPECIES; } ! @Override ! public ShortVector toVector() { short[] va = new short[SPECIES.length()]; for (int i = 0; i < va.length; i++) { va[i] = (short) lane(i); } return ShortVector.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<Short> species() { return SPECIES; } ! private ShortVector toVector_helper() { short[] va = new short[SPECIES.length()]; for (int i = 0; i < va.length; i++) { va[i] = (short) lane(i); } return ShortVector.fromArray(SPECIES, va, 0); } @Override @ForceInline + public ShortVector toVector() { + return VectorIntrinsics.shuffleToVector(ShortMaxVector.class, short.class, ShortMaxShuffle.class, this, + SPECIES.length(), + (s) -> (((ShortMaxShuffle)(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 ShortMaxShuffle rearrange(VectorShuffle<Short> o) { ShortMaxShuffle s = (ShortMaxShuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) {
< prev index next >