< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template

Print this page

        

*** 1622,1673 **** return new $fpvectortype$(res); } #end[intOrLong] @Override public $vectortype$ rotateLanesLeft(int j) { ! $type$[] vec = getElements(); ! $type$[] res = new $type$[length()]; ! for (int i = 0; i < length(); i++){ ! res[(j + i) % length()] = vec[i]; } - return new $vectortype$(res); } @Override public $vectortype$ rotateLanesRight(int j) { ! $type$[] vec = getElements(); ! $type$[] res = new $type$[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 $vectortype$(res); } @Override public $vectortype$ shiftLanesLeft(int j) { ! $type$[] vec = getElements(); ! $type$[] res = new $type$[length()]; ! for (int i = 0; i < length() - j; i++) { ! res[i] = vec[i + j]; } - return new $vectortype$(res); } @Override public $vectortype$ shiftLanesRight(int j) { ! $type$[] vec = getElements(); ! $type$[] res = new $type$[length()]; ! for (int i = 0; i < length() - j; i++){ ! res[i + j] = vec[i]; } - return new $vectortype$(res); } @Override @ForceInline public $vectortype$ rearrange(Vector<$Boxtype$> v, --- 1622,1688 ---- return new $fpvectortype$(res); } #end[intOrLong] @Override + @ForceInline public $vectortype$ 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<$Boxtype$> PermMask = VectorShuffle.shuffleIota(SPECIES, L - j); ! return this.rearrange(PermMask); } } @Override + @ForceInline public $vectortype$ 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<$Boxtype$> PermMask = VectorShuffle.shuffleIota(SPECIES, j); ! return this.rearrange(PermMask); } } @Override + @ForceInline + @SuppressWarnings("unchecked") public $vectortype$ 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 { ! $shuffletype$ Iota = ($shuffletype$)(VectorShuffle.shuffleIota(SPECIES, L-j)); ! VectorMask<$Boxtype$> BlendMask = Iota.toVector().lessThan($vectortype$.broadcast(SPECIES, ($type$)(L-j))); ! Iota = ($shuffletype$)(VectorShuffle.shuffleIota(SPECIES, L -j)); ! return ZERO.blend(this.rearrange(Iota),BlendMask); } } @Override + @ForceInline + @SuppressWarnings("unchecked") public $vectortype$ 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 { ! $shuffletype$ Iota = ($shuffletype$)(VectorShuffle.shuffleIota(SPECIES, j)); ! VectorMask<$Boxtype$> BlendMask = Iota.toVector().greaterThanEq($vectortype$.broadcast(SPECIES, ($type$)(j))); ! Iota = ($shuffletype$)(VectorShuffle.shuffleIota(SPECIES, j)); ! return ZERO.blend(this.rearrange(Iota),BlendMask); } } @Override @ForceInline public $vectortype$ rearrange(Vector<$Boxtype$> v,
*** 1934,1954 **** @Override public VectorSpecies<$Boxtype$> species() { return SPECIES; } ! @Override ! public $abstractvectortype$ toVector() { $type$[] va = new $type$[SPECIES.length()]; for (int i = 0; i < va.length; i++) { va[i] = ($type$) lane(i); } return $abstractvectortype$.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(); --- 1949,1976 ---- @Override public VectorSpecies<$Boxtype$> species() { return SPECIES; } ! private $abstractvectortype$ toVector_helper() { $type$[] va = new $type$[SPECIES.length()]; for (int i = 0; i < va.length; i++) { va[i] = ($type$) lane(i); } return $abstractvectortype$.fromArray(SPECIES, va, 0); } @Override @ForceInline + public $abstractvectortype$ toVector() { + return VectorIntrinsics.shuffleToVector($vectortype$.class, $type$.class, $shuffletype$.class, this, + SPECIES.length(), + (s) -> ((($shuffletype$)(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();
*** 1968,1977 **** --- 1990,2000 ---- } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } + @Override public $shuffletype$ rearrange(VectorShuffle<$Boxtype$> o) { $shuffletype$ s = ($shuffletype$) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) {
< prev index next >