< prev index next >

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

Print this page

        

*** 1165,1216 **** return new IntMaxVector(res); } @Override public FloatMaxVector rotateLanesLeft(int j) { ! float[] vec = getElements(); ! float[] res = new float[length()]; ! for (int i = 0; i < length(); i++){ ! res[(j + i) % length()] = vec[i]; } - return new FloatMaxVector(res); } @Override public FloatMaxVector rotateLanesRight(int j) { ! float[] vec = getElements(); ! float[] res = new float[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 FloatMaxVector(res); } @Override public FloatMaxVector shiftLanesLeft(int j) { ! float[] vec = getElements(); ! float[] res = new float[length()]; ! for (int i = 0; i < length() - j; i++) { ! res[i] = vec[i + j]; } - return new FloatMaxVector(res); } @Override public FloatMaxVector shiftLanesRight(int j) { ! float[] vec = getElements(); ! float[] res = new float[length()]; ! for (int i = 0; i < length() - j; i++){ ! res[i + j] = vec[i]; } - return new FloatMaxVector(res); } @Override @ForceInline public FloatMaxVector rearrange(Vector<Float> v, --- 1165,1231 ---- return new IntMaxVector(res); } @Override + @ForceInline public FloatMaxVector 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<Float> PermMask = VectorShuffle.shuffleIota(SPECIES, L - j); ! return this.rearrange(PermMask); } } @Override + @ForceInline public FloatMaxVector 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<Float> PermMask = VectorShuffle.shuffleIota(SPECIES, j); ! return this.rearrange(PermMask); } } @Override + @ForceInline + @SuppressWarnings("unchecked") public FloatMaxVector 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 { ! FloatMaxShuffle Iota = (FloatMaxShuffle)(VectorShuffle.shuffleIota(SPECIES, L-j)); ! VectorMask<Float> BlendMask = Iota.toVector().lessThan(FloatMaxVector.broadcast(SPECIES, (float)(L-j))); ! Iota = (FloatMaxShuffle)(VectorShuffle.shuffleIota(SPECIES, L -j)); ! return ZERO.blend(this.rearrange(Iota),BlendMask); } } @Override + @ForceInline + @SuppressWarnings("unchecked") public FloatMaxVector 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 { ! FloatMaxShuffle Iota = (FloatMaxShuffle)(VectorShuffle.shuffleIota(SPECIES, j)); ! VectorMask<Float> BlendMask = Iota.toVector().greaterThanEq(FloatMaxVector.broadcast(SPECIES, (float)(j))); ! Iota = (FloatMaxShuffle)(VectorShuffle.shuffleIota(SPECIES, j)); ! return ZERO.blend(this.rearrange(Iota),BlendMask); } } @Override @ForceInline public FloatMaxVector rearrange(Vector<Float> v,
*** 1446,1466 **** @Override public VectorSpecies<Float> species() { return SPECIES; } ! @Override ! public FloatVector toVector() { float[] va = new float[SPECIES.length()]; for (int i = 0; i < va.length; i++) { va[i] = (float) lane(i); } return FloatVector.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(); --- 1461,1488 ---- @Override public VectorSpecies<Float> species() { return SPECIES; } ! private FloatVector toVector_helper() { float[] va = new float[SPECIES.length()]; for (int i = 0; i < va.length; i++) { va[i] = (float) lane(i); } return FloatVector.fromArray(SPECIES, va, 0); } @Override @ForceInline + public FloatVector toVector() { + return VectorIntrinsics.shuffleToVector(FloatMaxVector.class, float.class, FloatMaxShuffle.class, this, + SPECIES.length(), + (s) -> (((FloatMaxShuffle)(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();
*** 1480,1489 **** --- 1502,1512 ---- } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } + @Override public FloatMaxShuffle rearrange(VectorShuffle<Float> o) { FloatMaxShuffle s = (FloatMaxShuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) {
< prev index next >