< prev index next >
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java
Print this page
*** 1105,1156 ****
}
return new FloatMaxVector(res);
}
@Override
public IntMaxVector rotateLanesLeft(int j) {
! int[] vec = getElements();
! int[] res = new int[length()];
! for (int i = 0; i < length(); i++){
! res[(j + i) % length()] = vec[i];
}
- return new IntMaxVector(res);
}
@Override
public IntMaxVector rotateLanesRight(int j) {
! int[] vec = getElements();
! int[] res = new int[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 IntMaxVector(res);
}
@Override
public IntMaxVector shiftLanesLeft(int j) {
! int[] vec = getElements();
! int[] res = new int[length()];
! for (int i = 0; i < length() - j; i++) {
! res[i] = vec[i + j];
}
- return new IntMaxVector(res);
}
@Override
public IntMaxVector shiftLanesRight(int j) {
! int[] vec = getElements();
! int[] res = new int[length()];
! for (int i = 0; i < length() - j; i++){
! res[i + j] = vec[i];
}
- return new IntMaxVector(res);
}
@Override
@ForceInline
public IntMaxVector rearrange(Vector<Integer> v,
--- 1105,1171 ----
}
return new FloatMaxVector(res);
}
@Override
+ @ForceInline
public IntMaxVector 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<Integer> PermMask = VectorShuffle.shuffleIota(SPECIES, L - j);
! return this.rearrange(PermMask);
}
}
@Override
+ @ForceInline
public IntMaxVector 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<Integer> PermMask = VectorShuffle.shuffleIota(SPECIES, j);
! return this.rearrange(PermMask);
}
}
@Override
+ @ForceInline
+ @SuppressWarnings("unchecked")
public IntMaxVector 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 {
! IntMaxShuffle Iota = (IntMaxShuffle)(VectorShuffle.shuffleIota(SPECIES, L-j));
! VectorMask<Integer> BlendMask = Iota.toVector().lessThan(IntMaxVector.broadcast(SPECIES, (int)(L-j)));
! Iota = (IntMaxShuffle)(VectorShuffle.shuffleIota(SPECIES, L -j));
! return ZERO.blend(this.rearrange(Iota),BlendMask);
}
}
@Override
+ @ForceInline
+ @SuppressWarnings("unchecked")
public IntMaxVector 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 {
! IntMaxShuffle Iota = (IntMaxShuffle)(VectorShuffle.shuffleIota(SPECIES, j));
! VectorMask<Integer> BlendMask = Iota.toVector().greaterThanEq(IntMaxVector.broadcast(SPECIES, (int)(j)));
! Iota = (IntMaxShuffle)(VectorShuffle.shuffleIota(SPECIES, j));
! return ZERO.blend(this.rearrange(Iota),BlendMask);
}
}
@Override
@ForceInline
public IntMaxVector rearrange(Vector<Integer> v,
*** 1385,1405 ****
@Override
public VectorSpecies<Integer> species() {
return SPECIES;
}
! @Override
! public IntVector toVector() {
int[] va = new int[SPECIES.length()];
for (int i = 0; i < va.length; i++) {
va[i] = (int) lane(i);
}
return IntVector.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();
--- 1400,1427 ----
@Override
public VectorSpecies<Integer> species() {
return SPECIES;
}
! private IntVector toVector_helper() {
int[] va = new int[SPECIES.length()];
for (int i = 0; i < va.length; i++) {
va[i] = (int) lane(i);
}
return IntVector.fromArray(SPECIES, va, 0);
}
@Override
@ForceInline
+ public IntVector toVector() {
+ return VectorIntrinsics.shuffleToVector(IntMaxVector.class, int.class, IntMaxShuffle.class, this,
+ SPECIES.length(),
+ (s) -> (((IntMaxShuffle)(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();
*** 1419,1428 ****
--- 1441,1451 ----
} else {
throw new UnsupportedOperationException("Bad lane type for casting.");
}
}
+
@Override
public IntMaxShuffle rearrange(VectorShuffle<Integer> o) {
IntMaxShuffle s = (IntMaxShuffle) o;
byte[] r = new byte[reorder.length];
for (int i = 0; i < reorder.length; i++) {
< prev index next >