< prev index next >

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

Print this page

        

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