--- old/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java 2019-05-14 07:09:29.264513885 +0530 +++ new/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java 2019-05-14 07:09:29.024513879 +0530 @@ -1167,48 +1167,63 @@ @Override + @ForceInline public Float128Vector 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 Float128Vector(res); + int L = length(); + if (j < 0) { + throw new IllegalArgumentException("Index " + j + " must be zero or positive"); + } else { + j = j & (L-1); + VectorShuffle PermMask = VectorShuffle.shuffleIota(SPECIES, L - j); + return this.rearrange(PermMask); + } } @Override + @ForceInline public Float128Vector 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 Float128Vector(res); + int L = length(); + if (j < 0) { + throw new IllegalArgumentException("Index " + j + " must be zero or positive"); + } else { + j = j & (L-1); + VectorShuffle PermMask = VectorShuffle.shuffleIota(SPECIES, j); + return this.rearrange(PermMask); + } } @Override + @ForceInline + @SuppressWarnings("unchecked") public Float128Vector 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 Float128Vector(res); + int L = length(); + if (j < 0) { + throw new IllegalArgumentException("Index " + j + " must be zero or positive"); + } else if ( j >= L ) { + return ZERO; + } else { + Float128Shuffle Iota = (Float128Shuffle)(VectorShuffle.shuffleIota(SPECIES, L-j)); + VectorMask BlendMask = Iota.toVector().lessThan(Float128Vector.broadcast(SPECIES, (float)(L-j))); + Iota = (Float128Shuffle)(VectorShuffle.shuffleIota(SPECIES, L -j)); + return ZERO.blend(this.rearrange(Iota),BlendMask); + } } @Override + @ForceInline + @SuppressWarnings("unchecked") public Float128Vector 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 Float128Vector(res); + int L = length(); + if (j < 0) { + throw new IllegalArgumentException("Index " + j + " must be zero or positive"); + } else if ( j >= L ) { + return ZERO; + } else { + Float128Shuffle Iota = (Float128Shuffle)(VectorShuffle.shuffleIota(SPECIES, j)); + VectorMask BlendMask = Iota.toVector().greaterThanEq(Float128Vector.broadcast(SPECIES, (float)(j))); + Iota = (Float128Shuffle)(VectorShuffle.shuffleIota(SPECIES, j)); + return ZERO.blend(this.rearrange(Iota),BlendMask); + } } @Override @@ -1448,8 +1463,7 @@ return SPECIES; } - @Override - public FloatVector toVector() { + private FloatVector toVector_helper() { float[] va = new float[SPECIES.length()]; for (int i = 0; i < va.length; i++) { va[i] = (float) lane(i); @@ -1459,6 +1473,14 @@ @Override @ForceInline + public FloatVector toVector() { + return VectorIntrinsics.shuffleToVector(Float128Vector.class, float.class, Float128Shuffle.class, this, + SPECIES.length(), + (s) -> (((Float128Shuffle)(s)).toVector_helper())); + } + + @Override + @ForceInline @SuppressWarnings("unchecked") public VectorShuffle cast(VectorSpecies species) { if (length() != species.length()) @@ -1482,6 +1504,7 @@ } } + @Override public Float128Shuffle rearrange(VectorShuffle o) { Float128Shuffle s = (Float128Shuffle) o;