< prev index next >

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

Print this page

        

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