< prev index next >
test/jdk/jdk/incubator/vector/benchmark/src/main/java/benchmark/jdk/incubator/vector/Long128Vector.java
Print this page
rev 55894 : 8222897: [vector] Renaming of shift, rotate operations. Few other api changes.
Summary: Renaming of shift, rotate operations. Few other api changes.
Reviewed-by: jrose, briangoetz
@@ -22,10 +22,11 @@
*/
package benchmark.jdk.incubator.vector;
import jdk.incubator.vector.Vector;
+import jdk.incubator.vector.VectorMask;
import jdk.incubator.vector.VectorShape;
import jdk.incubator.vector.VectorSpecies;
import jdk.incubator.vector.VectorShuffle;
import jdk.incubator.vector.LongVector;
@@ -316,235 +317,255 @@
}
@Benchmark
- public void shiftR(Blackhole bh) {
+ public void shiftLeft(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
- av.shiftR(bv).intoArray(r, i);
+ av.shiftLeft(bv).intoArray(r, i);
}
}
bh.consume(r);
}
@Benchmark
- public void shiftRMasked(Blackhole bh) {
+ public void shiftLeftMasked(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
- av.shiftR(bv, vmask).intoArray(r, i);
+ av.shiftLeft(bv, vmask).intoArray(r, i);
}
}
bh.consume(r);
}
+
+
+
+
@Benchmark
- public void shiftL(Blackhole bh) {
+ public void shiftRight(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
- av.shiftL(bv).intoArray(r, i);
+ av.shiftRight(bv).intoArray(r, i);
}
}
bh.consume(r);
}
@Benchmark
- public void shiftLMasked(Blackhole bh) {
+ public void shiftRightMasked(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
- av.shiftL(bv, vmask).intoArray(r, i);
+ av.shiftRight(bv, vmask).intoArray(r, i);
}
}
bh.consume(r);
}
+
+
+
+
@Benchmark
- public void aShiftR(Blackhole bh) {
+ public void shiftArithmeticRight(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
- av.aShiftR(bv).intoArray(r, i);
+ av.shiftArithmeticRight(bv).intoArray(r, i);
}
}
bh.consume(r);
}
@Benchmark
- public void aShiftRMasked(Blackhole bh) {
+ public void shiftArithmeticRightMasked(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
- av.aShiftR(bv, vmask).intoArray(r, i);
+ av.shiftArithmeticRight(bv, vmask).intoArray(r, i);
}
}
bh.consume(r);
}
+
+
+
+
@Benchmark
- public void aShiftRShift(Blackhole bh) {
+ public void shiftLeftShift(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- av.aShiftR((int)b[i]).intoArray(r, i);
+ av.shiftLeft((int)b[i]).intoArray(r, i);
}
}
bh.consume(r);
}
@Benchmark
- public void aShiftRMaskedShift(Blackhole bh) {
+ public void shiftLeftMaskedShift(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- av.aShiftR((int)b[i], vmask).intoArray(r, i);
+ av.shiftLeft((int)b[i], vmask).intoArray(r, i);
}
}
bh.consume(r);
}
+
+
+
+
@Benchmark
- public void shiftRShift(Blackhole bh) {
+ public void shiftRightShift(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- av.shiftR((int)b[i]).intoArray(r, i);
+ av.shiftRight((int)b[i]).intoArray(r, i);
}
}
bh.consume(r);
}
@Benchmark
- public void shiftRMaskedShift(Blackhole bh) {
+ public void shiftRightMaskedShift(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- av.shiftR((int)b[i], vmask).intoArray(r, i);
+ av.shiftRight((int)b[i], vmask).intoArray(r, i);
}
}
bh.consume(r);
}
+
+
+
+
@Benchmark
- public void shiftLShift(Blackhole bh) {
+ public void shiftArithmeticRightShift(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- av.shiftL((int)b[i]).intoArray(r, i);
+ av.shiftArithmeticRight((int)b[i]).intoArray(r, i);
}
}
bh.consume(r);
}
@Benchmark
- public void shiftLMaskedShift(Blackhole bh) {
+ public void shiftArithmeticRightMaskedShift(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- av.shiftL((int)b[i], vmask).intoArray(r, i);
+ av.shiftArithmeticRight((int)b[i], vmask).intoArray(r, i);
}
}
bh.consume(r);
}
@@ -552,18 +573,10 @@
-
-
-
-
-
-
-
-
@Benchmark
public void max(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
@@ -596,114 +609,114 @@
bh.consume(r);
}
@Benchmark
- public void andAll(Blackhole bh) {
+ public void andLanes(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long ra = -1;
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = -1;
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- ra &= av.andAll();
+ ra &= av.andLanes();
}
}
bh.consume(ra);
}
@Benchmark
- public void orAll(Blackhole bh) {
+ public void orLanes(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long ra = 0;
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- ra |= av.orAll();
+ ra |= av.orLanes();
}
}
bh.consume(ra);
}
@Benchmark
- public void xorAll(Blackhole bh) {
+ public void xorLanes(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long ra = 0;
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- ra ^= av.xorAll();
+ ra ^= av.xorLanes();
}
}
bh.consume(ra);
}
@Benchmark
- public void addAll(Blackhole bh) {
+ public void addLanes(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long ra = 0;
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = 0;
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- ra += av.addAll();
+ ra += av.addLanes();
}
}
bh.consume(ra);
}
@Benchmark
- public void mulAll(Blackhole bh) {
+ public void mulLanes(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long ra = 1;
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = 1;
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- ra *= av.mulAll();
+ ra *= av.mulLanes();
}
}
bh.consume(ra);
}
@Benchmark
- public void minAll(Blackhole bh) {
+ public void minLanes(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long ra = Long.MAX_VALUE;
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = Long.MAX_VALUE;
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- ra = (long)Math.min(ra, av.minAll());
+ ra = (long)Math.min(ra, av.minLanes());
}
}
bh.consume(ra);
}
@Benchmark
- public void maxAll(Blackhole bh) {
+ public void maxLanes(Blackhole bh) {
long[] a = fa.apply(SPECIES.length());
long ra = Long.MIN_VALUE;
for (int ic = 0; ic < INVOC_COUNT; ic++) {
ra = Long.MIN_VALUE;
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
- ra = (long)Math.max(ra, av.maxAll());
+ ra = (long)Math.max(ra, av.maxLanes());
}
}
bh.consume(ra);
}
@@ -759,11 +772,11 @@
@Benchmark
public Object lessThan() {
long[] a = fa.apply(size);
long[] b = fb.apply(size);
boolean[] ms = fm.apply(size);
- VectorMask<Long> m = VectorMask.maskFromArray(SPECIES, ms, 0);
+ VectorMask<Long> m = VectorMask.fromArray(SPECIES, ms, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
@@ -779,11 +792,11 @@
@Benchmark
public Object greaterThan() {
long[] a = fa.apply(size);
long[] b = fb.apply(size);
boolean[] ms = fm.apply(size);
- VectorMask<Long> m = VectorMask.maskFromArray(SPECIES, ms, 0);
+ VectorMask<Long> m = VectorMask.fromArray(SPECIES, ms, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
@@ -799,11 +812,11 @@
@Benchmark
public Object equal() {
long[] a = fa.apply(size);
long[] b = fb.apply(size);
boolean[] ms = fm.apply(size);
- VectorMask<Long> m = VectorMask.maskFromArray(SPECIES, ms, 0);
+ VectorMask<Long> m = VectorMask.fromArray(SPECIES, ms, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
@@ -819,11 +832,11 @@
@Benchmark
public Object notEqual() {
long[] a = fa.apply(size);
long[] b = fb.apply(size);
boolean[] ms = fm.apply(size);
- VectorMask<Long> m = VectorMask.maskFromArray(SPECIES, ms, 0);
+ VectorMask<Long> m = VectorMask.fromArray(SPECIES, ms, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
@@ -839,11 +852,11 @@
@Benchmark
public Object lessThanEq() {
long[] a = fa.apply(size);
long[] b = fb.apply(size);
boolean[] ms = fm.apply(size);
- VectorMask<Long> m = VectorMask.maskFromArray(SPECIES, ms, 0);
+ VectorMask<Long> m = VectorMask.fromArray(SPECIES, ms, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
@@ -859,11 +872,11 @@
@Benchmark
public Object greaterThanEq() {
long[] a = fa.apply(size);
long[] b = fb.apply(size);
boolean[] ms = fm.apply(size);
- VectorMask<Long> m = VectorMask.maskFromArray(SPECIES, ms, 0);
+ VectorMask<Long> m = VectorMask.fromArray(SPECIES, ms, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
LongVector bv = LongVector.fromArray(SPECIES, b, i);
< prev index next >