8265128: [REDO] Optimize Vector API slice and unslice operations
Reviewed-by: psandoz, vlivanov
This commit is contained in:
parent
e5d3ee394a
commit
23446f1f5e
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class Byte128Vector extends ByteVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Byte128Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Byte128Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class Byte128Vector extends ByteVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Byte128Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Byte128Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class Byte256Vector extends ByteVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Byte256Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Byte256Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class Byte256Vector extends ByteVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Byte256Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Byte256Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class Byte512Vector extends ByteVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Byte512Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Byte512Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class Byte512Vector extends ByteVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Byte512Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Byte512Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class Byte64Vector extends ByteVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Byte64Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Byte64Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class Byte64Vector extends ByteVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Byte64Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Byte64Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class ByteMaxVector extends ByteVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public ByteMaxVector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (ByteMaxVector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class ByteMaxVector extends ByteVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public ByteMaxVector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (ByteMaxVector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1981,14 +1981,11 @@ public abstract class ByteVector extends AbstractVector<Byte> {
|
||||
ByteVector sliceTemplate(int origin, Vector<Byte> v1) {
|
||||
ByteVector that = (ByteVector) v1;
|
||||
that.check(this);
|
||||
byte[] a0 = this.vec();
|
||||
byte[] a1 = that.vec();
|
||||
byte[] res = new byte[a0.length];
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
System.arraycopy(a0, origin, res, 0, firstPart);
|
||||
System.arraycopy(a1, 0, res, firstPart, origin);
|
||||
return vectorFactory(res);
|
||||
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 that.rearrange(iota).blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2010,6 +2007,17 @@ public abstract class ByteVector extends AbstractVector<Byte> {
|
||||
public abstract
|
||||
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-->
|
||||
*/
|
||||
@ -2024,21 +2032,12 @@ public abstract class ByteVector extends AbstractVector<Byte> {
|
||||
unsliceTemplate(int origin, Vector<Byte> w, int part) {
|
||||
ByteVector that = (ByteVector) w;
|
||||
that.check(this);
|
||||
byte[] slice = this.vec();
|
||||
byte[] res = that.vec().clone();
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
switch (part) {
|
||||
case 0:
|
||||
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);
|
||||
Objects.checkIndex(origin, length() + 1);
|
||||
VectorShuffle<Byte> iota = iotaShuffle();
|
||||
VectorMask<Byte> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
|
||||
(broadcast((byte)(origin))));
|
||||
iota = iotaShuffle(-origin, 1, true);
|
||||
return that.blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/*package-private*/
|
||||
@ -2068,6 +2067,19 @@ public abstract class ByteVector extends AbstractVector<Byte> {
|
||||
public abstract
|
||||
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
|
||||
wrongPartForSlice(int part) {
|
||||
String msg = String.format("bad part number %d for slice operation",
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -381,14 +381,7 @@ final class Double128Vector extends DoubleVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Double128Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Double128Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -409,14 +402,7 @@ final class Double128Vector extends DoubleVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Double128Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Double128Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -381,14 +381,7 @@ final class Double256Vector extends DoubleVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Double256Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Double256Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -409,14 +402,7 @@ final class Double256Vector extends DoubleVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Double256Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Double256Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -381,14 +381,7 @@ final class Double512Vector extends DoubleVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Double512Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Double512Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -409,14 +402,7 @@ final class Double512Vector extends DoubleVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Double512Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Double512Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -381,14 +381,7 @@ final class Double64Vector extends DoubleVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Double64Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Double64Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -409,14 +402,7 @@ final class Double64Vector extends DoubleVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Double64Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Double64Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -381,14 +381,7 @@ final class DoubleMaxVector extends DoubleVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public DoubleMaxVector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (DoubleMaxVector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -409,14 +402,7 @@ final class DoubleMaxVector extends DoubleVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public DoubleMaxVector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (DoubleMaxVector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1894,14 +1894,11 @@ public abstract class DoubleVector extends AbstractVector<Double> {
|
||||
DoubleVector sliceTemplate(int origin, Vector<Double> v1) {
|
||||
DoubleVector that = (DoubleVector) v1;
|
||||
that.check(this);
|
||||
double[] a0 = this.vec();
|
||||
double[] a1 = that.vec();
|
||||
double[] res = new double[a0.length];
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
System.arraycopy(a0, origin, res, 0, firstPart);
|
||||
System.arraycopy(a1, 0, res, firstPart, origin);
|
||||
return vectorFactory(res);
|
||||
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 that.rearrange(iota).blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1923,6 +1920,17 @@ public abstract class DoubleVector extends AbstractVector<Double> {
|
||||
public abstract
|
||||
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-->
|
||||
*/
|
||||
@ -1937,21 +1945,12 @@ public abstract class DoubleVector extends AbstractVector<Double> {
|
||||
unsliceTemplate(int origin, Vector<Double> w, int part) {
|
||||
DoubleVector that = (DoubleVector) w;
|
||||
that.check(this);
|
||||
double[] slice = this.vec();
|
||||
double[] res = that.vec().clone();
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
switch (part) {
|
||||
case 0:
|
||||
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);
|
||||
Objects.checkIndex(origin, length() + 1);
|
||||
VectorShuffle<Double> iota = iotaShuffle();
|
||||
VectorMask<Double> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
|
||||
(broadcast((double)(origin))));
|
||||
iota = iotaShuffle(-origin, 1, true);
|
||||
return that.blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/*package-private*/
|
||||
@ -1981,6 +1980,19 @@ public abstract class DoubleVector extends AbstractVector<Double> {
|
||||
public abstract
|
||||
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
|
||||
wrongPartForSlice(int part) {
|
||||
String msg = String.format("bad part number %d for slice operation",
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -381,14 +381,7 @@ final class Float128Vector extends FloatVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Float128Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Float128Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -409,14 +402,7 @@ final class Float128Vector extends FloatVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Float128Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Float128Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -381,14 +381,7 @@ final class Float256Vector extends FloatVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Float256Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Float256Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -409,14 +402,7 @@ final class Float256Vector extends FloatVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Float256Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Float256Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -381,14 +381,7 @@ final class Float512Vector extends FloatVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Float512Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Float512Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -409,14 +402,7 @@ final class Float512Vector extends FloatVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Float512Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Float512Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -381,14 +381,7 @@ final class Float64Vector extends FloatVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Float64Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Float64Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -409,14 +402,7 @@ final class Float64Vector extends FloatVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Float64Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Float64Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -381,14 +381,7 @@ final class FloatMaxVector extends FloatVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public FloatMaxVector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (FloatMaxVector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -409,14 +402,7 @@ final class FloatMaxVector extends FloatVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public FloatMaxVector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (FloatMaxVector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1906,14 +1906,11 @@ public abstract class FloatVector extends AbstractVector<Float> {
|
||||
FloatVector sliceTemplate(int origin, Vector<Float> v1) {
|
||||
FloatVector that = (FloatVector) v1;
|
||||
that.check(this);
|
||||
float[] a0 = this.vec();
|
||||
float[] a1 = that.vec();
|
||||
float[] res = new float[a0.length];
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
System.arraycopy(a0, origin, res, 0, firstPart);
|
||||
System.arraycopy(a1, 0, res, firstPart, origin);
|
||||
return vectorFactory(res);
|
||||
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 that.rearrange(iota).blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1935,6 +1932,17 @@ public abstract class FloatVector extends AbstractVector<Float> {
|
||||
public abstract
|
||||
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-->
|
||||
*/
|
||||
@ -1949,21 +1957,12 @@ public abstract class FloatVector extends AbstractVector<Float> {
|
||||
unsliceTemplate(int origin, Vector<Float> w, int part) {
|
||||
FloatVector that = (FloatVector) w;
|
||||
that.check(this);
|
||||
float[] slice = this.vec();
|
||||
float[] res = that.vec().clone();
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
switch (part) {
|
||||
case 0:
|
||||
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);
|
||||
Objects.checkIndex(origin, length() + 1);
|
||||
VectorShuffle<Float> iota = iotaShuffle();
|
||||
VectorMask<Float> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
|
||||
(broadcast((float)(origin))));
|
||||
iota = iotaShuffle(-origin, 1, true);
|
||||
return that.blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/*package-private*/
|
||||
@ -1993,6 +1992,19 @@ public abstract class FloatVector extends AbstractVector<Float> {
|
||||
public abstract
|
||||
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
|
||||
wrongPartForSlice(int part) {
|
||||
String msg = String.format("bad part number %d for slice operation",
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class Int128Vector extends IntVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Int128Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Int128Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class Int128Vector extends IntVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Int128Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Int128Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class Int256Vector extends IntVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Int256Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Int256Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class Int256Vector extends IntVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Int256Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Int256Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class Int512Vector extends IntVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Int512Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Int512Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class Int512Vector extends IntVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Int512Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Int512Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class Int64Vector extends IntVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Int64Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Int64Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class Int64Vector extends IntVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Int64Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Int64Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class IntMaxVector extends IntVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public IntMaxVector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (IntMaxVector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class IntMaxVector extends IntVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public IntMaxVector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (IntMaxVector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1980,14 +1980,11 @@ public abstract class IntVector extends AbstractVector<Integer> {
|
||||
IntVector sliceTemplate(int origin, Vector<Integer> v1) {
|
||||
IntVector that = (IntVector) v1;
|
||||
that.check(this);
|
||||
int[] a0 = this.vec();
|
||||
int[] a1 = that.vec();
|
||||
int[] res = new int[a0.length];
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
System.arraycopy(a0, origin, res, 0, firstPart);
|
||||
System.arraycopy(a1, 0, res, firstPart, origin);
|
||||
return vectorFactory(res);
|
||||
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 that.rearrange(iota).blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2009,6 +2006,17 @@ public abstract class IntVector extends AbstractVector<Integer> {
|
||||
public abstract
|
||||
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-->
|
||||
*/
|
||||
@ -2023,21 +2031,12 @@ public abstract class IntVector extends AbstractVector<Integer> {
|
||||
unsliceTemplate(int origin, Vector<Integer> w, int part) {
|
||||
IntVector that = (IntVector) w;
|
||||
that.check(this);
|
||||
int[] slice = this.vec();
|
||||
int[] res = that.vec().clone();
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
switch (part) {
|
||||
case 0:
|
||||
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);
|
||||
Objects.checkIndex(origin, length() + 1);
|
||||
VectorShuffle<Integer> iota = iotaShuffle();
|
||||
VectorMask<Integer> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
|
||||
(broadcast((int)(origin))));
|
||||
iota = iotaShuffle(-origin, 1, true);
|
||||
return that.blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/*package-private*/
|
||||
@ -2067,6 +2066,19 @@ public abstract class IntVector extends AbstractVector<Integer> {
|
||||
public abstract
|
||||
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
|
||||
wrongPartForSlice(int part) {
|
||||
String msg = String.format("bad part number %d for slice operation",
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -377,14 +377,7 @@ final class Long128Vector extends LongVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Long128Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Long128Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -405,14 +398,7 @@ final class Long128Vector extends LongVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Long128Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Long128Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -377,14 +377,7 @@ final class Long256Vector extends LongVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Long256Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Long256Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -405,14 +398,7 @@ final class Long256Vector extends LongVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Long256Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Long256Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -377,14 +377,7 @@ final class Long512Vector extends LongVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Long512Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Long512Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -405,14 +398,7 @@ final class Long512Vector extends LongVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Long512Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Long512Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -377,14 +377,7 @@ final class Long64Vector extends LongVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Long64Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Long64Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -405,14 +398,7 @@ final class Long64Vector extends LongVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Long64Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Long64Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -377,14 +377,7 @@ final class LongMaxVector extends LongVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public LongMaxVector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (LongMaxVector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -405,14 +398,7 @@ final class LongMaxVector extends LongVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public LongMaxVector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (LongMaxVector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1851,14 +1851,11 @@ public abstract class LongVector extends AbstractVector<Long> {
|
||||
LongVector sliceTemplate(int origin, Vector<Long> v1) {
|
||||
LongVector that = (LongVector) v1;
|
||||
that.check(this);
|
||||
long[] a0 = this.vec();
|
||||
long[] a1 = that.vec();
|
||||
long[] res = new long[a0.length];
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
System.arraycopy(a0, origin, res, 0, firstPart);
|
||||
System.arraycopy(a1, 0, res, firstPart, origin);
|
||||
return vectorFactory(res);
|
||||
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 that.rearrange(iota).blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1880,6 +1877,17 @@ public abstract class LongVector extends AbstractVector<Long> {
|
||||
public abstract
|
||||
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-->
|
||||
*/
|
||||
@ -1894,21 +1902,12 @@ public abstract class LongVector extends AbstractVector<Long> {
|
||||
unsliceTemplate(int origin, Vector<Long> w, int part) {
|
||||
LongVector that = (LongVector) w;
|
||||
that.check(this);
|
||||
long[] slice = this.vec();
|
||||
long[] res = that.vec().clone();
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
switch (part) {
|
||||
case 0:
|
||||
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);
|
||||
Objects.checkIndex(origin, length() + 1);
|
||||
VectorShuffle<Long> iota = iotaShuffle();
|
||||
VectorMask<Long> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
|
||||
(broadcast((long)(origin))));
|
||||
iota = iotaShuffle(-origin, 1, true);
|
||||
return that.blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/*package-private*/
|
||||
@ -1938,6 +1937,19 @@ public abstract class LongVector extends AbstractVector<Long> {
|
||||
public abstract
|
||||
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
|
||||
wrongPartForSlice(int part) {
|
||||
String msg = String.format("bad part number %d for slice operation",
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class Short128Vector extends ShortVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Short128Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Short128Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class Short128Vector extends ShortVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Short128Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Short128Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class Short256Vector extends ShortVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Short256Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Short256Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class Short256Vector extends ShortVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Short256Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Short256Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class Short512Vector extends ShortVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Short512Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Short512Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class Short512Vector extends ShortVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Short512Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Short512Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class Short64Vector extends ShortVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Short64Vector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Short64Vector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class Short64Vector extends ShortVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public Short64Vector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (Short64Vector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -387,14 +387,7 @@ final class ShortMaxVector extends ShortVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public ShortMaxVector slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (ShortMaxVector) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -415,14 +408,7 @@ final class ShortMaxVector extends ShortVector {
|
||||
@Override
|
||||
@ForceInline
|
||||
public ShortMaxVector unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return (ShortMaxVector) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1981,14 +1981,11 @@ public abstract class ShortVector extends AbstractVector<Short> {
|
||||
ShortVector sliceTemplate(int origin, Vector<Short> v1) {
|
||||
ShortVector that = (ShortVector) v1;
|
||||
that.check(this);
|
||||
short[] a0 = this.vec();
|
||||
short[] a1 = that.vec();
|
||||
short[] res = new short[a0.length];
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
System.arraycopy(a0, origin, res, 0, firstPart);
|
||||
System.arraycopy(a1, 0, res, firstPart, origin);
|
||||
return vectorFactory(res);
|
||||
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 that.rearrange(iota).blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2010,6 +2007,17 @@ public abstract class ShortVector extends AbstractVector<Short> {
|
||||
public abstract
|
||||
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-->
|
||||
*/
|
||||
@ -2024,21 +2032,12 @@ public abstract class ShortVector extends AbstractVector<Short> {
|
||||
unsliceTemplate(int origin, Vector<Short> w, int part) {
|
||||
ShortVector that = (ShortVector) w;
|
||||
that.check(this);
|
||||
short[] slice = this.vec();
|
||||
short[] res = that.vec().clone();
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
switch (part) {
|
||||
case 0:
|
||||
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);
|
||||
Objects.checkIndex(origin, length() + 1);
|
||||
VectorShuffle<Short> iota = iotaShuffle();
|
||||
VectorMask<Short> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
|
||||
(broadcast((short)(origin))));
|
||||
iota = iotaShuffle(-origin, 1, true);
|
||||
return that.blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/*package-private*/
|
||||
@ -2068,6 +2067,19 @@ public abstract class ShortVector extends AbstractVector<Short> {
|
||||
public abstract
|
||||
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
|
||||
wrongPartForSlice(int part) {
|
||||
String msg = String.format("bad part number %d for slice operation",
|
||||
|
@ -2250,14 +2250,11 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
|
||||
$abstractvectortype$ sliceTemplate(int origin, Vector<$Boxtype$> v1) {
|
||||
$abstractvectortype$ that = ($abstractvectortype$) v1;
|
||||
that.check(this);
|
||||
$type$[] a0 = this.vec();
|
||||
$type$[] a1 = that.vec();
|
||||
$type$[] res = new $type$[a0.length];
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
System.arraycopy(a0, origin, res, 0, firstPart);
|
||||
System.arraycopy(a1, 0, res, firstPart, origin);
|
||||
return vectorFactory(res);
|
||||
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 that.rearrange(iota).blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2279,6 +2276,17 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
|
||||
public abstract
|
||||
$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-->
|
||||
*/
|
||||
@ -2293,21 +2301,12 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
|
||||
unsliceTemplate(int origin, Vector<$Boxtype$> w, int part) {
|
||||
$abstractvectortype$ that = ($abstractvectortype$) w;
|
||||
that.check(this);
|
||||
$type$[] slice = this.vec();
|
||||
$type$[] res = that.vec().clone();
|
||||
int vlen = res.length;
|
||||
int firstPart = vlen - origin;
|
||||
switch (part) {
|
||||
case 0:
|
||||
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);
|
||||
Objects.checkIndex(origin, length() + 1);
|
||||
VectorShuffle<$Boxtype$> iota = iotaShuffle();
|
||||
VectorMask<$Boxtype$> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT,
|
||||
(broadcast(($type$)(origin))));
|
||||
iota = iotaShuffle(-origin, 1, true);
|
||||
return that.blend(this.rearrange(iota), blendMask);
|
||||
}
|
||||
|
||||
/*package-private*/
|
||||
@ -2337,6 +2336,19 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
|
||||
public abstract
|
||||
$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
|
||||
wrongPartForSlice(int part) {
|
||||
String msg = String.format("bad part number %d for slice operation",
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -393,14 +393,7 @@ final class $vectortype$ extends $abstractvectortype$ {
|
||||
@Override
|
||||
@ForceInline
|
||||
public $vectortype$ slice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return ($vectortype$) super.sliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -421,14 +414,7 @@ final class $vectortype$ extends $abstractvectortype$ {
|
||||
@Override
|
||||
@ForceInline
|
||||
public $vectortype$ unslice(int origin) {
|
||||
if ((origin < 0) || (origin >= VLENGTH)) {
|
||||
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);
|
||||
}
|
||||
return ($vectortype$) super.unsliceTemplate(origin); // specialize
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
* 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");
|
||||
}
|
||||
|
||||
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) {
|
||||
return new IntFunction<>() {
|
||||
|
@ -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.
|
||||
*
|
||||
* 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 {
|
||||
|
||||
static final VectorShape SHAPE = VectorShape.S_128_BIT;
|
||||
static final int BUFFER_SIZE = Integer.getInteger("jdk.incubator.vector.test.buffer-size", 1024);
|
||||
|
||||
@DataProvider
|
||||
public Object[][] fixedShapeXfixedShape() {
|
||||
@ -53,25 +54,25 @@ public class Vector128ConversionTests extends AbstractVectorConversionTest {
|
||||
|
||||
@Test(dataProvider = "fixedShapeXfixedShape")
|
||||
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);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "fixedShapeXShape")
|
||||
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);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "fixedShapeXShape")
|
||||
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);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "fixedShapeXShape")
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
*
|
||||
* 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 {
|
||||
|
||||
static final VectorShape SHAPE = VectorShape.S_256_BIT;
|
||||
static final int BUFFER_SIZE = Integer.getInteger("jdk.incubator.vector.test.buffer-size", 1024);
|
||||
|
||||
@DataProvider
|
||||
public Object[][] fixedShapeXfixedShape() {
|
||||
@ -53,25 +54,25 @@ public class Vector256ConversionTests extends AbstractVectorConversionTest {
|
||||
|
||||
@Test(dataProvider = "fixedShapeXfixedShape")
|
||||
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);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "fixedShapeXShape")
|
||||
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);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "fixedShapeXShape")
|
||||
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);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "fixedShapeXShape")
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
*
|
||||
* 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 {
|
||||
|
||||
static final VectorShape SHAPE = VectorShape.S_512_BIT;
|
||||
static final int BUFFER_SIZE = Integer.getInteger("jdk.incubator.vector.test.buffer-size", 1024);
|
||||
|
||||
@DataProvider
|
||||
public Object[][] fixedShapeXfixedShape() {
|
||||
@ -53,25 +54,25 @@ public class Vector512ConversionTests extends AbstractVectorConversionTest {
|
||||
|
||||
@Test(dataProvider = "fixedShapeXfixedShape")
|
||||
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);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "fixedShapeXShape")
|
||||
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);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "fixedShapeXShape")
|
||||
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);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "fixedShapeXShape")
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ import java.util.function.IntFunction;
|
||||
public class Vector64ConversionTests extends AbstractVectorConversionTest {
|
||||
|
||||
static final VectorShape SHAPE = VectorShape.S_64_BIT;
|
||||
static final int BUFFER_SIZE = Integer.getInteger("jdk.incubator.vector.test.buffer-size", 1024);
|
||||
|
||||
@DataProvider
|
||||
public Object[][] fixedShapeXfixedShape() {
|
||||
@ -75,25 +76,25 @@ public class Vector64ConversionTests extends AbstractVectorConversionTest {
|
||||
|
||||
@Test(dataProvider = "fixedShapeXfixedShape")
|
||||
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);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "fixedShapeXShape")
|
||||
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);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "fixedShapeXShape")
|
||||
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);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "fixedShapeXShape")
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user