8265128: [REDO] Optimize Vector API slice and unslice operations

Reviewed-by: psandoz, vlivanov
This commit is contained in:
Sandhya Viswanathan 2021-05-10 21:49:49 +00:00
parent e5d3ee394a
commit 23446f1f5e
43 changed files with 363 additions and 709 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class Byte128Vector extends ByteVector {
@Override @Override
@ForceInline @ForceInline
public Byte128Vector slice(int origin) { public Byte128Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Byte128Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Byte128Shuffle Iota = iotaShuffle();
VectorMask<Byte> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((byte)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class Byte128Vector extends ByteVector {
@Override @Override
@ForceInline @ForceInline
public Byte128Vector unslice(int origin) { public Byte128Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Byte128Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Byte128Shuffle Iota = iotaShuffle();
VectorMask<Byte> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((byte)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class Byte256Vector extends ByteVector {
@Override @Override
@ForceInline @ForceInline
public Byte256Vector slice(int origin) { public Byte256Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Byte256Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Byte256Shuffle Iota = iotaShuffle();
VectorMask<Byte> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((byte)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class Byte256Vector extends ByteVector {
@Override @Override
@ForceInline @ForceInline
public Byte256Vector unslice(int origin) { public Byte256Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Byte256Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Byte256Shuffle Iota = iotaShuffle();
VectorMask<Byte> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((byte)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class Byte512Vector extends ByteVector {
@Override @Override
@ForceInline @ForceInline
public Byte512Vector slice(int origin) { public Byte512Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Byte512Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Byte512Shuffle Iota = iotaShuffle();
VectorMask<Byte> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((byte)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class Byte512Vector extends ByteVector {
@Override @Override
@ForceInline @ForceInline
public Byte512Vector unslice(int origin) { public Byte512Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Byte512Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Byte512Shuffle Iota = iotaShuffle();
VectorMask<Byte> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((byte)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class Byte64Vector extends ByteVector {
@Override @Override
@ForceInline @ForceInline
public Byte64Vector slice(int origin) { public Byte64Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Byte64Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Byte64Shuffle Iota = iotaShuffle();
VectorMask<Byte> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((byte)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class Byte64Vector extends ByteVector {
@Override @Override
@ForceInline @ForceInline
public Byte64Vector unslice(int origin) { public Byte64Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Byte64Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Byte64Shuffle Iota = iotaShuffle();
VectorMask<Byte> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((byte)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class ByteMaxVector extends ByteVector {
@Override @Override
@ForceInline @ForceInline
public ByteMaxVector slice(int origin) { public ByteMaxVector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (ByteMaxVector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
ByteMaxShuffle Iota = iotaShuffle();
VectorMask<Byte> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((byte)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class ByteMaxVector extends ByteVector {
@Override @Override
@ForceInline @ForceInline
public ByteMaxVector unslice(int origin) { public ByteMaxVector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (ByteMaxVector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
ByteMaxShuffle Iota = iotaShuffle();
VectorMask<Byte> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((byte)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1981,14 +1981,11 @@ public abstract class ByteVector extends AbstractVector<Byte> {
ByteVector sliceTemplate(int origin, Vector<Byte> v1) { ByteVector sliceTemplate(int origin, Vector<Byte> v1) {
ByteVector that = (ByteVector) v1; ByteVector that = (ByteVector) v1;
that.check(this); that.check(this);
byte[] a0 = this.vec(); Objects.checkIndex(origin, length() + 1);
byte[] a1 = that.vec(); VectorShuffle<Byte> iota = iotaShuffle();
byte[] res = new byte[a0.length]; VectorMask<Byte> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((byte)(length() - origin))));
int vlen = res.length; iota = iotaShuffle(origin, 1, true);
int firstPart = vlen - origin; return that.rearrange(iota).blend(this.rearrange(iota), blendMask);
System.arraycopy(a0, origin, res, 0, firstPart);
System.arraycopy(a1, 0, res, firstPart, origin);
return vectorFactory(res);
} }
/** /**
@ -2010,6 +2007,17 @@ public abstract class ByteVector extends AbstractVector<Byte> {
public abstract public abstract
ByteVector slice(int origin); ByteVector slice(int origin);
/*package-private*/
final
@ForceInline
ByteVector sliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<Byte> iota = iotaShuffle();
VectorMask<Byte> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((byte)(length() - origin))));
iota = iotaShuffle(origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
/** /**
* {@inheritDoc} <!--workaround--> * {@inheritDoc} <!--workaround-->
*/ */
@ -2024,21 +2032,12 @@ public abstract class ByteVector extends AbstractVector<Byte> {
unsliceTemplate(int origin, Vector<Byte> w, int part) { unsliceTemplate(int origin, Vector<Byte> w, int part) {
ByteVector that = (ByteVector) w; ByteVector that = (ByteVector) w;
that.check(this); that.check(this);
byte[] slice = this.vec(); Objects.checkIndex(origin, length() + 1);
byte[] res = that.vec().clone(); VectorShuffle<Byte> iota = iotaShuffle();
int vlen = res.length; VectorMask<Byte> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
int firstPart = vlen - origin; (broadcast((byte)(origin))));
switch (part) { iota = iotaShuffle(-origin, 1, true);
case 0: return that.blend(this.rearrange(iota), blendMask);
System.arraycopy(slice, 0, res, origin, firstPart);
break;
case 1:
System.arraycopy(slice, firstPart, res, 0, origin);
break;
default:
throw wrongPartForSlice(part);
}
return vectorFactory(res);
} }
/*package-private*/ /*package-private*/
@ -2068,6 +2067,19 @@ public abstract class ByteVector extends AbstractVector<Byte> {
public abstract public abstract
ByteVector unslice(int origin); ByteVector unslice(int origin);
/*package-private*/
final
@ForceInline
ByteVector
unsliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<Byte> iota = iotaShuffle();
VectorMask<Byte> blendMask = iota.toVector().compare(VectorOperators.GE,
(broadcast((byte)(origin))));
iota = iotaShuffle(-origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
private ArrayIndexOutOfBoundsException private ArrayIndexOutOfBoundsException
wrongPartForSlice(int part) { wrongPartForSlice(int part) {
String msg = String.format("bad part number %d for slice operation", String msg = String.format("bad part number %d for slice operation",

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -381,14 +381,7 @@ final class Double128Vector extends DoubleVector {
@Override @Override
@ForceInline @ForceInline
public Double128Vector slice(int origin) { public Double128Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Double128Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Double128Shuffle Iota = iotaShuffle();
VectorMask<Double> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((double)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -409,14 +402,7 @@ final class Double128Vector extends DoubleVector {
@Override @Override
@ForceInline @ForceInline
public Double128Vector unslice(int origin) { public Double128Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Double128Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Double128Shuffle Iota = iotaShuffle();
VectorMask<Double> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((double)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -381,14 +381,7 @@ final class Double256Vector extends DoubleVector {
@Override @Override
@ForceInline @ForceInline
public Double256Vector slice(int origin) { public Double256Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Double256Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Double256Shuffle Iota = iotaShuffle();
VectorMask<Double> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((double)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -409,14 +402,7 @@ final class Double256Vector extends DoubleVector {
@Override @Override
@ForceInline @ForceInline
public Double256Vector unslice(int origin) { public Double256Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Double256Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Double256Shuffle Iota = iotaShuffle();
VectorMask<Double> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((double)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -381,14 +381,7 @@ final class Double512Vector extends DoubleVector {
@Override @Override
@ForceInline @ForceInline
public Double512Vector slice(int origin) { public Double512Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Double512Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Double512Shuffle Iota = iotaShuffle();
VectorMask<Double> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((double)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -409,14 +402,7 @@ final class Double512Vector extends DoubleVector {
@Override @Override
@ForceInline @ForceInline
public Double512Vector unslice(int origin) { public Double512Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Double512Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Double512Shuffle Iota = iotaShuffle();
VectorMask<Double> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((double)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -381,14 +381,7 @@ final class Double64Vector extends DoubleVector {
@Override @Override
@ForceInline @ForceInline
public Double64Vector slice(int origin) { public Double64Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Double64Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Double64Shuffle Iota = iotaShuffle();
VectorMask<Double> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((double)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -409,14 +402,7 @@ final class Double64Vector extends DoubleVector {
@Override @Override
@ForceInline @ForceInline
public Double64Vector unslice(int origin) { public Double64Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Double64Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Double64Shuffle Iota = iotaShuffle();
VectorMask<Double> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((double)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -381,14 +381,7 @@ final class DoubleMaxVector extends DoubleVector {
@Override @Override
@ForceInline @ForceInline
public DoubleMaxVector slice(int origin) { public DoubleMaxVector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (DoubleMaxVector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
DoubleMaxShuffle Iota = iotaShuffle();
VectorMask<Double> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((double)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -409,14 +402,7 @@ final class DoubleMaxVector extends DoubleVector {
@Override @Override
@ForceInline @ForceInline
public DoubleMaxVector unslice(int origin) { public DoubleMaxVector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (DoubleMaxVector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
DoubleMaxShuffle Iota = iotaShuffle();
VectorMask<Double> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((double)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1894,14 +1894,11 @@ public abstract class DoubleVector extends AbstractVector<Double> {
DoubleVector sliceTemplate(int origin, Vector<Double> v1) { DoubleVector sliceTemplate(int origin, Vector<Double> v1) {
DoubleVector that = (DoubleVector) v1; DoubleVector that = (DoubleVector) v1;
that.check(this); that.check(this);
double[] a0 = this.vec(); Objects.checkIndex(origin, length() + 1);
double[] a1 = that.vec(); VectorShuffle<Double> iota = iotaShuffle();
double[] res = new double[a0.length]; VectorMask<Double> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((double)(length() - origin))));
int vlen = res.length; iota = iotaShuffle(origin, 1, true);
int firstPart = vlen - origin; return that.rearrange(iota).blend(this.rearrange(iota), blendMask);
System.arraycopy(a0, origin, res, 0, firstPart);
System.arraycopy(a1, 0, res, firstPart, origin);
return vectorFactory(res);
} }
/** /**
@ -1923,6 +1920,17 @@ public abstract class DoubleVector extends AbstractVector<Double> {
public abstract public abstract
DoubleVector slice(int origin); DoubleVector slice(int origin);
/*package-private*/
final
@ForceInline
DoubleVector sliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<Double> iota = iotaShuffle();
VectorMask<Double> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((double)(length() - origin))));
iota = iotaShuffle(origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
/** /**
* {@inheritDoc} <!--workaround--> * {@inheritDoc} <!--workaround-->
*/ */
@ -1937,21 +1945,12 @@ public abstract class DoubleVector extends AbstractVector<Double> {
unsliceTemplate(int origin, Vector<Double> w, int part) { unsliceTemplate(int origin, Vector<Double> w, int part) {
DoubleVector that = (DoubleVector) w; DoubleVector that = (DoubleVector) w;
that.check(this); that.check(this);
double[] slice = this.vec(); Objects.checkIndex(origin, length() + 1);
double[] res = that.vec().clone(); VectorShuffle<Double> iota = iotaShuffle();
int vlen = res.length; VectorMask<Double> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
int firstPart = vlen - origin; (broadcast((double)(origin))));
switch (part) { iota = iotaShuffle(-origin, 1, true);
case 0: return that.blend(this.rearrange(iota), blendMask);
System.arraycopy(slice, 0, res, origin, firstPart);
break;
case 1:
System.arraycopy(slice, firstPart, res, 0, origin);
break;
default:
throw wrongPartForSlice(part);
}
return vectorFactory(res);
} }
/*package-private*/ /*package-private*/
@ -1981,6 +1980,19 @@ public abstract class DoubleVector extends AbstractVector<Double> {
public abstract public abstract
DoubleVector unslice(int origin); DoubleVector unslice(int origin);
/*package-private*/
final
@ForceInline
DoubleVector
unsliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<Double> iota = iotaShuffle();
VectorMask<Double> blendMask = iota.toVector().compare(VectorOperators.GE,
(broadcast((double)(origin))));
iota = iotaShuffle(-origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
private ArrayIndexOutOfBoundsException private ArrayIndexOutOfBoundsException
wrongPartForSlice(int part) { wrongPartForSlice(int part) {
String msg = String.format("bad part number %d for slice operation", String msg = String.format("bad part number %d for slice operation",

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -381,14 +381,7 @@ final class Float128Vector extends FloatVector {
@Override @Override
@ForceInline @ForceInline
public Float128Vector slice(int origin) { public Float128Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Float128Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Float128Shuffle Iota = iotaShuffle();
VectorMask<Float> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((float)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -409,14 +402,7 @@ final class Float128Vector extends FloatVector {
@Override @Override
@ForceInline @ForceInline
public Float128Vector unslice(int origin) { public Float128Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Float128Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Float128Shuffle Iota = iotaShuffle();
VectorMask<Float> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((float)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -381,14 +381,7 @@ final class Float256Vector extends FloatVector {
@Override @Override
@ForceInline @ForceInline
public Float256Vector slice(int origin) { public Float256Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Float256Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Float256Shuffle Iota = iotaShuffle();
VectorMask<Float> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((float)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -409,14 +402,7 @@ final class Float256Vector extends FloatVector {
@Override @Override
@ForceInline @ForceInline
public Float256Vector unslice(int origin) { public Float256Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Float256Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Float256Shuffle Iota = iotaShuffle();
VectorMask<Float> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((float)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -381,14 +381,7 @@ final class Float512Vector extends FloatVector {
@Override @Override
@ForceInline @ForceInline
public Float512Vector slice(int origin) { public Float512Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Float512Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Float512Shuffle Iota = iotaShuffle();
VectorMask<Float> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((float)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -409,14 +402,7 @@ final class Float512Vector extends FloatVector {
@Override @Override
@ForceInline @ForceInline
public Float512Vector unslice(int origin) { public Float512Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Float512Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Float512Shuffle Iota = iotaShuffle();
VectorMask<Float> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((float)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -381,14 +381,7 @@ final class Float64Vector extends FloatVector {
@Override @Override
@ForceInline @ForceInline
public Float64Vector slice(int origin) { public Float64Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Float64Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Float64Shuffle Iota = iotaShuffle();
VectorMask<Float> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((float)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -409,14 +402,7 @@ final class Float64Vector extends FloatVector {
@Override @Override
@ForceInline @ForceInline
public Float64Vector unslice(int origin) { public Float64Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Float64Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Float64Shuffle Iota = iotaShuffle();
VectorMask<Float> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((float)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -381,14 +381,7 @@ final class FloatMaxVector extends FloatVector {
@Override @Override
@ForceInline @ForceInline
public FloatMaxVector slice(int origin) { public FloatMaxVector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (FloatMaxVector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
FloatMaxShuffle Iota = iotaShuffle();
VectorMask<Float> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((float)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -409,14 +402,7 @@ final class FloatMaxVector extends FloatVector {
@Override @Override
@ForceInline @ForceInline
public FloatMaxVector unslice(int origin) { public FloatMaxVector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (FloatMaxVector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
FloatMaxShuffle Iota = iotaShuffle();
VectorMask<Float> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((float)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1906,14 +1906,11 @@ public abstract class FloatVector extends AbstractVector<Float> {
FloatVector sliceTemplate(int origin, Vector<Float> v1) { FloatVector sliceTemplate(int origin, Vector<Float> v1) {
FloatVector that = (FloatVector) v1; FloatVector that = (FloatVector) v1;
that.check(this); that.check(this);
float[] a0 = this.vec(); Objects.checkIndex(origin, length() + 1);
float[] a1 = that.vec(); VectorShuffle<Float> iota = iotaShuffle();
float[] res = new float[a0.length]; VectorMask<Float> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((float)(length() - origin))));
int vlen = res.length; iota = iotaShuffle(origin, 1, true);
int firstPart = vlen - origin; return that.rearrange(iota).blend(this.rearrange(iota), blendMask);
System.arraycopy(a0, origin, res, 0, firstPart);
System.arraycopy(a1, 0, res, firstPart, origin);
return vectorFactory(res);
} }
/** /**
@ -1935,6 +1932,17 @@ public abstract class FloatVector extends AbstractVector<Float> {
public abstract public abstract
FloatVector slice(int origin); FloatVector slice(int origin);
/*package-private*/
final
@ForceInline
FloatVector sliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<Float> iota = iotaShuffle();
VectorMask<Float> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((float)(length() - origin))));
iota = iotaShuffle(origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
/** /**
* {@inheritDoc} <!--workaround--> * {@inheritDoc} <!--workaround-->
*/ */
@ -1949,21 +1957,12 @@ public abstract class FloatVector extends AbstractVector<Float> {
unsliceTemplate(int origin, Vector<Float> w, int part) { unsliceTemplate(int origin, Vector<Float> w, int part) {
FloatVector that = (FloatVector) w; FloatVector that = (FloatVector) w;
that.check(this); that.check(this);
float[] slice = this.vec(); Objects.checkIndex(origin, length() + 1);
float[] res = that.vec().clone(); VectorShuffle<Float> iota = iotaShuffle();
int vlen = res.length; VectorMask<Float> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
int firstPart = vlen - origin; (broadcast((float)(origin))));
switch (part) { iota = iotaShuffle(-origin, 1, true);
case 0: return that.blend(this.rearrange(iota), blendMask);
System.arraycopy(slice, 0, res, origin, firstPart);
break;
case 1:
System.arraycopy(slice, firstPart, res, 0, origin);
break;
default:
throw wrongPartForSlice(part);
}
return vectorFactory(res);
} }
/*package-private*/ /*package-private*/
@ -1993,6 +1992,19 @@ public abstract class FloatVector extends AbstractVector<Float> {
public abstract public abstract
FloatVector unslice(int origin); FloatVector unslice(int origin);
/*package-private*/
final
@ForceInline
FloatVector
unsliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<Float> iota = iotaShuffle();
VectorMask<Float> blendMask = iota.toVector().compare(VectorOperators.GE,
(broadcast((float)(origin))));
iota = iotaShuffle(-origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
private ArrayIndexOutOfBoundsException private ArrayIndexOutOfBoundsException
wrongPartForSlice(int part) { wrongPartForSlice(int part) {
String msg = String.format("bad part number %d for slice operation", String msg = String.format("bad part number %d for slice operation",

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class Int128Vector extends IntVector {
@Override @Override
@ForceInline @ForceInline
public Int128Vector slice(int origin) { public Int128Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Int128Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Int128Shuffle Iota = iotaShuffle();
VectorMask<Integer> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((int)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class Int128Vector extends IntVector {
@Override @Override
@ForceInline @ForceInline
public Int128Vector unslice(int origin) { public Int128Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Int128Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Int128Shuffle Iota = iotaShuffle();
VectorMask<Integer> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((int)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class Int256Vector extends IntVector {
@Override @Override
@ForceInline @ForceInline
public Int256Vector slice(int origin) { public Int256Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Int256Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Int256Shuffle Iota = iotaShuffle();
VectorMask<Integer> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((int)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class Int256Vector extends IntVector {
@Override @Override
@ForceInline @ForceInline
public Int256Vector unslice(int origin) { public Int256Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Int256Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Int256Shuffle Iota = iotaShuffle();
VectorMask<Integer> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((int)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class Int512Vector extends IntVector {
@Override @Override
@ForceInline @ForceInline
public Int512Vector slice(int origin) { public Int512Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Int512Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Int512Shuffle Iota = iotaShuffle();
VectorMask<Integer> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((int)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class Int512Vector extends IntVector {
@Override @Override
@ForceInline @ForceInline
public Int512Vector unslice(int origin) { public Int512Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Int512Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Int512Shuffle Iota = iotaShuffle();
VectorMask<Integer> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((int)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class Int64Vector extends IntVector {
@Override @Override
@ForceInline @ForceInline
public Int64Vector slice(int origin) { public Int64Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Int64Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Int64Shuffle Iota = iotaShuffle();
VectorMask<Integer> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((int)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class Int64Vector extends IntVector {
@Override @Override
@ForceInline @ForceInline
public Int64Vector unslice(int origin) { public Int64Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Int64Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Int64Shuffle Iota = iotaShuffle();
VectorMask<Integer> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((int)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class IntMaxVector extends IntVector {
@Override @Override
@ForceInline @ForceInline
public IntMaxVector slice(int origin) { public IntMaxVector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (IntMaxVector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
IntMaxShuffle Iota = iotaShuffle();
VectorMask<Integer> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((int)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class IntMaxVector extends IntVector {
@Override @Override
@ForceInline @ForceInline
public IntMaxVector unslice(int origin) { public IntMaxVector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (IntMaxVector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
IntMaxShuffle Iota = iotaShuffle();
VectorMask<Integer> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((int)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1980,14 +1980,11 @@ public abstract class IntVector extends AbstractVector<Integer> {
IntVector sliceTemplate(int origin, Vector<Integer> v1) { IntVector sliceTemplate(int origin, Vector<Integer> v1) {
IntVector that = (IntVector) v1; IntVector that = (IntVector) v1;
that.check(this); that.check(this);
int[] a0 = this.vec(); Objects.checkIndex(origin, length() + 1);
int[] a1 = that.vec(); VectorShuffle<Integer> iota = iotaShuffle();
int[] res = new int[a0.length]; VectorMask<Integer> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((int)(length() - origin))));
int vlen = res.length; iota = iotaShuffle(origin, 1, true);
int firstPart = vlen - origin; return that.rearrange(iota).blend(this.rearrange(iota), blendMask);
System.arraycopy(a0, origin, res, 0, firstPart);
System.arraycopy(a1, 0, res, firstPart, origin);
return vectorFactory(res);
} }
/** /**
@ -2009,6 +2006,17 @@ public abstract class IntVector extends AbstractVector<Integer> {
public abstract public abstract
IntVector slice(int origin); IntVector slice(int origin);
/*package-private*/
final
@ForceInline
IntVector sliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<Integer> iota = iotaShuffle();
VectorMask<Integer> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((int)(length() - origin))));
iota = iotaShuffle(origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
/** /**
* {@inheritDoc} <!--workaround--> * {@inheritDoc} <!--workaround-->
*/ */
@ -2023,21 +2031,12 @@ public abstract class IntVector extends AbstractVector<Integer> {
unsliceTemplate(int origin, Vector<Integer> w, int part) { unsliceTemplate(int origin, Vector<Integer> w, int part) {
IntVector that = (IntVector) w; IntVector that = (IntVector) w;
that.check(this); that.check(this);
int[] slice = this.vec(); Objects.checkIndex(origin, length() + 1);
int[] res = that.vec().clone(); VectorShuffle<Integer> iota = iotaShuffle();
int vlen = res.length; VectorMask<Integer> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
int firstPart = vlen - origin; (broadcast((int)(origin))));
switch (part) { iota = iotaShuffle(-origin, 1, true);
case 0: return that.blend(this.rearrange(iota), blendMask);
System.arraycopy(slice, 0, res, origin, firstPart);
break;
case 1:
System.arraycopy(slice, firstPart, res, 0, origin);
break;
default:
throw wrongPartForSlice(part);
}
return vectorFactory(res);
} }
/*package-private*/ /*package-private*/
@ -2067,6 +2066,19 @@ public abstract class IntVector extends AbstractVector<Integer> {
public abstract public abstract
IntVector unslice(int origin); IntVector unslice(int origin);
/*package-private*/
final
@ForceInline
IntVector
unsliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<Integer> iota = iotaShuffle();
VectorMask<Integer> blendMask = iota.toVector().compare(VectorOperators.GE,
(broadcast((int)(origin))));
iota = iotaShuffle(-origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
private ArrayIndexOutOfBoundsException private ArrayIndexOutOfBoundsException
wrongPartForSlice(int part) { wrongPartForSlice(int part) {
String msg = String.format("bad part number %d for slice operation", String msg = String.format("bad part number %d for slice operation",

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -377,14 +377,7 @@ final class Long128Vector extends LongVector {
@Override @Override
@ForceInline @ForceInline
public Long128Vector slice(int origin) { public Long128Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Long128Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Long128Shuffle Iota = iotaShuffle();
VectorMask<Long> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((long)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -405,14 +398,7 @@ final class Long128Vector extends LongVector {
@Override @Override
@ForceInline @ForceInline
public Long128Vector unslice(int origin) { public Long128Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Long128Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Long128Shuffle Iota = iotaShuffle();
VectorMask<Long> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((long)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -377,14 +377,7 @@ final class Long256Vector extends LongVector {
@Override @Override
@ForceInline @ForceInline
public Long256Vector slice(int origin) { public Long256Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Long256Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Long256Shuffle Iota = iotaShuffle();
VectorMask<Long> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((long)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -405,14 +398,7 @@ final class Long256Vector extends LongVector {
@Override @Override
@ForceInline @ForceInline
public Long256Vector unslice(int origin) { public Long256Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Long256Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Long256Shuffle Iota = iotaShuffle();
VectorMask<Long> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((long)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -377,14 +377,7 @@ final class Long512Vector extends LongVector {
@Override @Override
@ForceInline @ForceInline
public Long512Vector slice(int origin) { public Long512Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Long512Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Long512Shuffle Iota = iotaShuffle();
VectorMask<Long> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((long)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -405,14 +398,7 @@ final class Long512Vector extends LongVector {
@Override @Override
@ForceInline @ForceInline
public Long512Vector unslice(int origin) { public Long512Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Long512Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Long512Shuffle Iota = iotaShuffle();
VectorMask<Long> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((long)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -377,14 +377,7 @@ final class Long64Vector extends LongVector {
@Override @Override
@ForceInline @ForceInline
public Long64Vector slice(int origin) { public Long64Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Long64Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Long64Shuffle Iota = iotaShuffle();
VectorMask<Long> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((long)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -405,14 +398,7 @@ final class Long64Vector extends LongVector {
@Override @Override
@ForceInline @ForceInline
public Long64Vector unslice(int origin) { public Long64Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Long64Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Long64Shuffle Iota = iotaShuffle();
VectorMask<Long> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((long)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -377,14 +377,7 @@ final class LongMaxVector extends LongVector {
@Override @Override
@ForceInline @ForceInline
public LongMaxVector slice(int origin) { public LongMaxVector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (LongMaxVector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
LongMaxShuffle Iota = iotaShuffle();
VectorMask<Long> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((long)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -405,14 +398,7 @@ final class LongMaxVector extends LongVector {
@Override @Override
@ForceInline @ForceInline
public LongMaxVector unslice(int origin) { public LongMaxVector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (LongMaxVector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
LongMaxShuffle Iota = iotaShuffle();
VectorMask<Long> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((long)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1851,14 +1851,11 @@ public abstract class LongVector extends AbstractVector<Long> {
LongVector sliceTemplate(int origin, Vector<Long> v1) { LongVector sliceTemplate(int origin, Vector<Long> v1) {
LongVector that = (LongVector) v1; LongVector that = (LongVector) v1;
that.check(this); that.check(this);
long[] a0 = this.vec(); Objects.checkIndex(origin, length() + 1);
long[] a1 = that.vec(); VectorShuffle<Long> iota = iotaShuffle();
long[] res = new long[a0.length]; VectorMask<Long> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((long)(length() - origin))));
int vlen = res.length; iota = iotaShuffle(origin, 1, true);
int firstPart = vlen - origin; return that.rearrange(iota).blend(this.rearrange(iota), blendMask);
System.arraycopy(a0, origin, res, 0, firstPart);
System.arraycopy(a1, 0, res, firstPart, origin);
return vectorFactory(res);
} }
/** /**
@ -1880,6 +1877,17 @@ public abstract class LongVector extends AbstractVector<Long> {
public abstract public abstract
LongVector slice(int origin); LongVector slice(int origin);
/*package-private*/
final
@ForceInline
LongVector sliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<Long> iota = iotaShuffle();
VectorMask<Long> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((long)(length() - origin))));
iota = iotaShuffle(origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
/** /**
* {@inheritDoc} <!--workaround--> * {@inheritDoc} <!--workaround-->
*/ */
@ -1894,21 +1902,12 @@ public abstract class LongVector extends AbstractVector<Long> {
unsliceTemplate(int origin, Vector<Long> w, int part) { unsliceTemplate(int origin, Vector<Long> w, int part) {
LongVector that = (LongVector) w; LongVector that = (LongVector) w;
that.check(this); that.check(this);
long[] slice = this.vec(); Objects.checkIndex(origin, length() + 1);
long[] res = that.vec().clone(); VectorShuffle<Long> iota = iotaShuffle();
int vlen = res.length; VectorMask<Long> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
int firstPart = vlen - origin; (broadcast((long)(origin))));
switch (part) { iota = iotaShuffle(-origin, 1, true);
case 0: return that.blend(this.rearrange(iota), blendMask);
System.arraycopy(slice, 0, res, origin, firstPart);
break;
case 1:
System.arraycopy(slice, firstPart, res, 0, origin);
break;
default:
throw wrongPartForSlice(part);
}
return vectorFactory(res);
} }
/*package-private*/ /*package-private*/
@ -1938,6 +1937,19 @@ public abstract class LongVector extends AbstractVector<Long> {
public abstract public abstract
LongVector unslice(int origin); LongVector unslice(int origin);
/*package-private*/
final
@ForceInline
LongVector
unsliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<Long> iota = iotaShuffle();
VectorMask<Long> blendMask = iota.toVector().compare(VectorOperators.GE,
(broadcast((long)(origin))));
iota = iotaShuffle(-origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
private ArrayIndexOutOfBoundsException private ArrayIndexOutOfBoundsException
wrongPartForSlice(int part) { wrongPartForSlice(int part) {
String msg = String.format("bad part number %d for slice operation", String msg = String.format("bad part number %d for slice operation",

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class Short128Vector extends ShortVector {
@Override @Override
@ForceInline @ForceInline
public Short128Vector slice(int origin) { public Short128Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Short128Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Short128Shuffle Iota = iotaShuffle();
VectorMask<Short> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((short)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class Short128Vector extends ShortVector {
@Override @Override
@ForceInline @ForceInline
public Short128Vector unslice(int origin) { public Short128Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Short128Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Short128Shuffle Iota = iotaShuffle();
VectorMask<Short> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((short)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class Short256Vector extends ShortVector {
@Override @Override
@ForceInline @ForceInline
public Short256Vector slice(int origin) { public Short256Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Short256Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Short256Shuffle Iota = iotaShuffle();
VectorMask<Short> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((short)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class Short256Vector extends ShortVector {
@Override @Override
@ForceInline @ForceInline
public Short256Vector unslice(int origin) { public Short256Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Short256Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Short256Shuffle Iota = iotaShuffle();
VectorMask<Short> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((short)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class Short512Vector extends ShortVector {
@Override @Override
@ForceInline @ForceInline
public Short512Vector slice(int origin) { public Short512Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Short512Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Short512Shuffle Iota = iotaShuffle();
VectorMask<Short> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((short)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class Short512Vector extends ShortVector {
@Override @Override
@ForceInline @ForceInline
public Short512Vector unslice(int origin) { public Short512Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Short512Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Short512Shuffle Iota = iotaShuffle();
VectorMask<Short> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((short)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class Short64Vector extends ShortVector {
@Override @Override
@ForceInline @ForceInline
public Short64Vector slice(int origin) { public Short64Vector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Short64Vector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Short64Shuffle Iota = iotaShuffle();
VectorMask<Short> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((short)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class Short64Vector extends ShortVector {
@Override @Override
@ForceInline @ForceInline
public Short64Vector unslice(int origin) { public Short64Vector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (Short64Vector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
Short64Shuffle Iota = iotaShuffle();
VectorMask<Short> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((short)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -387,14 +387,7 @@ final class ShortMaxVector extends ShortVector {
@Override @Override
@ForceInline @ForceInline
public ShortMaxVector slice(int origin) { public ShortMaxVector slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (ShortMaxVector) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
ShortMaxShuffle Iota = iotaShuffle();
VectorMask<Short> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast((short)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -415,14 +408,7 @@ final class ShortMaxVector extends ShortVector {
@Override @Override
@ForceInline @ForceInline
public ShortMaxVector unslice(int origin) { public ShortMaxVector unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return (ShortMaxVector) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
ShortMaxShuffle Iota = iotaShuffle();
VectorMask<Short> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast((short)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1981,14 +1981,11 @@ public abstract class ShortVector extends AbstractVector<Short> {
ShortVector sliceTemplate(int origin, Vector<Short> v1) { ShortVector sliceTemplate(int origin, Vector<Short> v1) {
ShortVector that = (ShortVector) v1; ShortVector that = (ShortVector) v1;
that.check(this); that.check(this);
short[] a0 = this.vec(); Objects.checkIndex(origin, length() + 1);
short[] a1 = that.vec(); VectorShuffle<Short> iota = iotaShuffle();
short[] res = new short[a0.length]; VectorMask<Short> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((short)(length() - origin))));
int vlen = res.length; iota = iotaShuffle(origin, 1, true);
int firstPart = vlen - origin; return that.rearrange(iota).blend(this.rearrange(iota), blendMask);
System.arraycopy(a0, origin, res, 0, firstPart);
System.arraycopy(a1, 0, res, firstPart, origin);
return vectorFactory(res);
} }
/** /**
@ -2010,6 +2007,17 @@ public abstract class ShortVector extends AbstractVector<Short> {
public abstract public abstract
ShortVector slice(int origin); ShortVector slice(int origin);
/*package-private*/
final
@ForceInline
ShortVector sliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<Short> iota = iotaShuffle();
VectorMask<Short> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((short)(length() - origin))));
iota = iotaShuffle(origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
/** /**
* {@inheritDoc} <!--workaround--> * {@inheritDoc} <!--workaround-->
*/ */
@ -2024,21 +2032,12 @@ public abstract class ShortVector extends AbstractVector<Short> {
unsliceTemplate(int origin, Vector<Short> w, int part) { unsliceTemplate(int origin, Vector<Short> w, int part) {
ShortVector that = (ShortVector) w; ShortVector that = (ShortVector) w;
that.check(this); that.check(this);
short[] slice = this.vec(); Objects.checkIndex(origin, length() + 1);
short[] res = that.vec().clone(); VectorShuffle<Short> iota = iotaShuffle();
int vlen = res.length; VectorMask<Short> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
int firstPart = vlen - origin; (broadcast((short)(origin))));
switch (part) { iota = iotaShuffle(-origin, 1, true);
case 0: return that.blend(this.rearrange(iota), blendMask);
System.arraycopy(slice, 0, res, origin, firstPart);
break;
case 1:
System.arraycopy(slice, firstPart, res, 0, origin);
break;
default:
throw wrongPartForSlice(part);
}
return vectorFactory(res);
} }
/*package-private*/ /*package-private*/
@ -2068,6 +2067,19 @@ public abstract class ShortVector extends AbstractVector<Short> {
public abstract public abstract
ShortVector unslice(int origin); ShortVector unslice(int origin);
/*package-private*/
final
@ForceInline
ShortVector
unsliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<Short> iota = iotaShuffle();
VectorMask<Short> blendMask = iota.toVector().compare(VectorOperators.GE,
(broadcast((short)(origin))));
iota = iotaShuffle(-origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
private ArrayIndexOutOfBoundsException private ArrayIndexOutOfBoundsException
wrongPartForSlice(int part) { wrongPartForSlice(int part) {
String msg = String.format("bad part number %d for slice operation", String msg = String.format("bad part number %d for slice operation",

View File

@ -2250,14 +2250,11 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
$abstractvectortype$ sliceTemplate(int origin, Vector<$Boxtype$> v1) { $abstractvectortype$ sliceTemplate(int origin, Vector<$Boxtype$> v1) {
$abstractvectortype$ that = ($abstractvectortype$) v1; $abstractvectortype$ that = ($abstractvectortype$) v1;
that.check(this); that.check(this);
$type$[] a0 = this.vec(); Objects.checkIndex(origin, length() + 1);
$type$[] a1 = that.vec(); VectorShuffle<$Boxtype$> iota = iotaShuffle();
$type$[] res = new $type$[a0.length]; VectorMask<$Boxtype$> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast(($type$)(length() - origin))));
int vlen = res.length; iota = iotaShuffle(origin, 1, true);
int firstPart = vlen - origin; return that.rearrange(iota).blend(this.rearrange(iota), blendMask);
System.arraycopy(a0, origin, res, 0, firstPart);
System.arraycopy(a1, 0, res, firstPart, origin);
return vectorFactory(res);
} }
/** /**
@ -2279,6 +2276,17 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
public abstract public abstract
$abstractvectortype$ slice(int origin); $abstractvectortype$ slice(int origin);
/*package-private*/
final
@ForceInline
$abstractvectortype$ sliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<$Boxtype$> iota = iotaShuffle();
VectorMask<$Boxtype$> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast(($type$)(length() - origin))));
iota = iotaShuffle(origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
/** /**
* {@inheritDoc} <!--workaround--> * {@inheritDoc} <!--workaround-->
*/ */
@ -2293,21 +2301,12 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
unsliceTemplate(int origin, Vector<$Boxtype$> w, int part) { unsliceTemplate(int origin, Vector<$Boxtype$> w, int part) {
$abstractvectortype$ that = ($abstractvectortype$) w; $abstractvectortype$ that = ($abstractvectortype$) w;
that.check(this); that.check(this);
$type$[] slice = this.vec(); Objects.checkIndex(origin, length() + 1);
$type$[] res = that.vec().clone(); VectorShuffle<$Boxtype$> iota = iotaShuffle();
int vlen = res.length; VectorMask<$Boxtype$> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
int firstPart = vlen - origin; (broadcast(($type$)(origin))));
switch (part) { iota = iotaShuffle(-origin, 1, true);
case 0: return that.blend(this.rearrange(iota), blendMask);
System.arraycopy(slice, 0, res, origin, firstPart);
break;
case 1:
System.arraycopy(slice, firstPart, res, 0, origin);
break;
default:
throw wrongPartForSlice(part);
}
return vectorFactory(res);
} }
/*package-private*/ /*package-private*/
@ -2337,6 +2336,19 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
public abstract public abstract
$abstractvectortype$ unslice(int origin); $abstractvectortype$ unslice(int origin);
/*package-private*/
final
@ForceInline
$abstractvectortype$
unsliceTemplate(int origin) {
Objects.checkIndex(origin, length() + 1);
VectorShuffle<$Boxtype$> iota = iotaShuffle();
VectorMask<$Boxtype$> blendMask = iota.toVector().compare(VectorOperators.GE,
(broadcast(($type$)(origin))));
iota = iotaShuffle(-origin, 1, true);
return vspecies().zero().blend(this.rearrange(iota), blendMask);
}
private ArrayIndexOutOfBoundsException private ArrayIndexOutOfBoundsException
wrongPartForSlice(int part) { wrongPartForSlice(int part) {
String msg = String.format("bad part number %d for slice operation", String msg = String.format("bad part number %d for slice operation",

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -393,14 +393,7 @@ final class $vectortype$ extends $abstractvectortype$ {
@Override @Override
@ForceInline @ForceInline
public $vectortype$ slice(int origin) { public $vectortype$ slice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return ($vectortype$) super.sliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
$shuffletype$ Iota = iotaShuffle();
VectorMask<$Boxtype$> BlendMask = Iota.toVector().compare(VectorOperators.LT, (broadcast(($type$)(VLENGTH-origin))));
Iota = iotaShuffle(origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override
@ -421,14 +414,7 @@ final class $vectortype$ extends $abstractvectortype$ {
@Override @Override
@ForceInline @ForceInline
public $vectortype$ unslice(int origin) { public $vectortype$ unslice(int origin) {
if ((origin < 0) || (origin >= VLENGTH)) { return ($vectortype$) super.unsliceTemplate(origin); // specialize
throw new ArrayIndexOutOfBoundsException("Index " + origin + " out of bounds for vector length " + VLENGTH);
} else {
$shuffletype$ Iota = iotaShuffle();
VectorMask<$Boxtype$> BlendMask = Iota.toVector().compare(VectorOperators.GE, (broadcast(($type$)(origin))));
Iota = iotaShuffle(-origin, 1, true);
return ZERO.blend(this.rearrange(Iota), BlendMask);
}
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -48,7 +48,7 @@ abstract class AbstractVectorConversionTest {
System.out.println(tr.getName() + " took " + time + " ms"); System.out.println(tr.getName() + " took " + time + " ms");
} }
static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 1000); static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
static <T> IntFunction<T> withToString(String s, IntFunction<T> f) { static <T> IntFunction<T> withToString(String s, IntFunction<T> f) {
return new IntFunction<>() { return new IntFunction<>() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -40,6 +40,7 @@ import java.util.function.IntFunction;
public class Vector128ConversionTests extends AbstractVectorConversionTest { public class Vector128ConversionTests extends AbstractVectorConversionTest {
static final VectorShape SHAPE = VectorShape.S_128_BIT; static final VectorShape SHAPE = VectorShape.S_128_BIT;
static final int BUFFER_SIZE = Integer.getInteger("jdk.incubator.vector.test.buffer-size", 1024);
@DataProvider @DataProvider
public Object[][] fixedShapeXfixedShape() { public Object[][] fixedShapeXfixedShape() {
@ -53,25 +54,25 @@ public class Vector128ConversionTests extends AbstractVectorConversionTest {
@Test(dataProvider = "fixedShapeXfixedShape") @Test(dataProvider = "fixedShapeXfixedShape")
static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
conversion_kernel(src, dst, a, ConvAPI.CONVERT); conversion_kernel(src, dst, a, ConvAPI.CONVERT);
} }
@Test(dataProvider = "fixedShapeXShape") @Test(dataProvider = "fixedShapeXShape")
static <I, O> void convertShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void convertShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
conversion_kernel(src, dst, a, ConvAPI.CONVERTSHAPE); conversion_kernel(src, dst, a, ConvAPI.CONVERTSHAPE);
} }
@Test(dataProvider = "fixedShapeXShape") @Test(dataProvider = "fixedShapeXShape")
static <I, O> void castShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void castShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
conversion_kernel(src, dst, a, ConvAPI.CASTSHAPE); conversion_kernel(src, dst, a, ConvAPI.CASTSHAPE);
} }
@Test(dataProvider = "fixedShapeXShape") @Test(dataProvider = "fixedShapeXShape")
static <I, O> void reinterpret(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void reinterpret(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
reinterpret_kernel(src, dst, a); reinterpret_kernel(src, dst, a);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -40,6 +40,7 @@ import java.util.function.IntFunction;
public class Vector256ConversionTests extends AbstractVectorConversionTest { public class Vector256ConversionTests extends AbstractVectorConversionTest {
static final VectorShape SHAPE = VectorShape.S_256_BIT; static final VectorShape SHAPE = VectorShape.S_256_BIT;
static final int BUFFER_SIZE = Integer.getInteger("jdk.incubator.vector.test.buffer-size", 1024);
@DataProvider @DataProvider
public Object[][] fixedShapeXfixedShape() { public Object[][] fixedShapeXfixedShape() {
@ -53,25 +54,25 @@ public class Vector256ConversionTests extends AbstractVectorConversionTest {
@Test(dataProvider = "fixedShapeXfixedShape") @Test(dataProvider = "fixedShapeXfixedShape")
static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
conversion_kernel(src, dst, a, ConvAPI.CONVERT); conversion_kernel(src, dst, a, ConvAPI.CONVERT);
} }
@Test(dataProvider = "fixedShapeXShape") @Test(dataProvider = "fixedShapeXShape")
static <I, O> void convertShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void convertShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
conversion_kernel(src, dst, a, ConvAPI.CONVERTSHAPE); conversion_kernel(src, dst, a, ConvAPI.CONVERTSHAPE);
} }
@Test(dataProvider = "fixedShapeXShape") @Test(dataProvider = "fixedShapeXShape")
static <I, O> void castShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void castShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
conversion_kernel(src, dst, a, ConvAPI.CASTSHAPE); conversion_kernel(src, dst, a, ConvAPI.CASTSHAPE);
} }
@Test(dataProvider = "fixedShapeXShape") @Test(dataProvider = "fixedShapeXShape")
static <I, O> void reinterpret(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void reinterpret(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
reinterpret_kernel(src, dst, a); reinterpret_kernel(src, dst, a);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -40,6 +40,7 @@ import java.util.function.IntFunction;
public class Vector512ConversionTests extends AbstractVectorConversionTest { public class Vector512ConversionTests extends AbstractVectorConversionTest {
static final VectorShape SHAPE = VectorShape.S_512_BIT; static final VectorShape SHAPE = VectorShape.S_512_BIT;
static final int BUFFER_SIZE = Integer.getInteger("jdk.incubator.vector.test.buffer-size", 1024);
@DataProvider @DataProvider
public Object[][] fixedShapeXfixedShape() { public Object[][] fixedShapeXfixedShape() {
@ -53,25 +54,25 @@ public class Vector512ConversionTests extends AbstractVectorConversionTest {
@Test(dataProvider = "fixedShapeXfixedShape") @Test(dataProvider = "fixedShapeXfixedShape")
static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
conversion_kernel(src, dst, a, ConvAPI.CONVERT); conversion_kernel(src, dst, a, ConvAPI.CONVERT);
} }
@Test(dataProvider = "fixedShapeXShape") @Test(dataProvider = "fixedShapeXShape")
static <I, O> void convertShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void convertShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
conversion_kernel(src, dst, a, ConvAPI.CONVERTSHAPE); conversion_kernel(src, dst, a, ConvAPI.CONVERTSHAPE);
} }
@Test(dataProvider = "fixedShapeXShape") @Test(dataProvider = "fixedShapeXShape")
static <I, O> void castShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void castShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
conversion_kernel(src, dst, a, ConvAPI.CASTSHAPE); conversion_kernel(src, dst, a, ConvAPI.CASTSHAPE);
} }
@Test(dataProvider = "fixedShapeXShape") @Test(dataProvider = "fixedShapeXShape")
static <I, O> void reinterpret(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void reinterpret(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
reinterpret_kernel(src, dst, a); reinterpret_kernel(src, dst, a);
} }
} }

View File

@ -62,6 +62,7 @@ import java.util.function.IntFunction;
public class Vector64ConversionTests extends AbstractVectorConversionTest { public class Vector64ConversionTests extends AbstractVectorConversionTest {
static final VectorShape SHAPE = VectorShape.S_64_BIT; static final VectorShape SHAPE = VectorShape.S_64_BIT;
static final int BUFFER_SIZE = Integer.getInteger("jdk.incubator.vector.test.buffer-size", 1024);
@DataProvider @DataProvider
public Object[][] fixedShapeXfixedShape() { public Object[][] fixedShapeXfixedShape() {
@ -75,25 +76,25 @@ public class Vector64ConversionTests extends AbstractVectorConversionTest {
@Test(dataProvider = "fixedShapeXfixedShape") @Test(dataProvider = "fixedShapeXfixedShape")
static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
conversion_kernel(src, dst, a, ConvAPI.CONVERT); conversion_kernel(src, dst, a, ConvAPI.CONVERT);
} }
@Test(dataProvider = "fixedShapeXShape") @Test(dataProvider = "fixedShapeXShape")
static <I, O> void convertShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void convertShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
conversion_kernel(src, dst, a, ConvAPI.CONVERTSHAPE); conversion_kernel(src, dst, a, ConvAPI.CONVERTSHAPE);
} }
@Test(dataProvider = "fixedShapeXShape") @Test(dataProvider = "fixedShapeXShape")
static <I, O> void castShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void castShape(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
conversion_kernel(src, dst, a, ConvAPI.CASTSHAPE); conversion_kernel(src, dst, a, ConvAPI.CASTSHAPE);
} }
@Test(dataProvider = "fixedShapeXShape") @Test(dataProvider = "fixedShapeXShape")
static <I, O> void reinterpret(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) { static <I, O> void reinterpret(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024); Object a = fa.apply(BUFFER_SIZE);
reinterpret_kernel(src, dst, a); reinterpret_kernel(src, dst, a);
} }
} }