8339677: [vectorapi] YYYXXXVector::withLaneHelper and laneHelper should use Double::doubleToRawLongBits/Float::floatToRawIntBits

Reviewed-by: psandoz
This commit is contained in:
Quan Anh Mai 2024-09-10 12:44:57 +00:00
parent fb51c1e57b
commit 38441b3f2d
65 changed files with 695 additions and 1624 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -512,7 +512,7 @@ final class Double128Vector extends DoubleVector {
this, i,
(vec, ix) -> {
double[] vecarr = vec.vec();
return (long)Double.doubleToLongBits(vecarr[ix]);
return (long)Double.doubleToRawLongBits(vecarr[ix]);
});
}
@ -529,7 +529,7 @@ final class Double128Vector extends DoubleVector {
public Double128Vector withLaneHelper(int i, double e) {
return VectorSupport.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)Double.doubleToLongBits(e),
this, i, (long)Double.doubleToRawLongBits(e),
(v, ix, bits) -> {
double[] res = v.vec().clone();
res[ix] = Double.longBitsToDouble((long)bits);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -514,7 +514,7 @@ final class Double256Vector extends DoubleVector {
this, i,
(vec, ix) -> {
double[] vecarr = vec.vec();
return (long)Double.doubleToLongBits(vecarr[ix]);
return (long)Double.doubleToRawLongBits(vecarr[ix]);
});
}
@ -533,7 +533,7 @@ final class Double256Vector extends DoubleVector {
public Double256Vector withLaneHelper(int i, double e) {
return VectorSupport.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)Double.doubleToLongBits(e),
this, i, (long)Double.doubleToRawLongBits(e),
(v, ix, bits) -> {
double[] res = v.vec().clone();
res[ix] = Double.longBitsToDouble((long)bits);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -518,7 +518,7 @@ final class Double512Vector extends DoubleVector {
this, i,
(vec, ix) -> {
double[] vecarr = vec.vec();
return (long)Double.doubleToLongBits(vecarr[ix]);
return (long)Double.doubleToRawLongBits(vecarr[ix]);
});
}
@ -541,7 +541,7 @@ final class Double512Vector extends DoubleVector {
public Double512Vector withLaneHelper(int i, double e) {
return VectorSupport.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)Double.doubleToLongBits(e),
this, i, (long)Double.doubleToRawLongBits(e),
(v, ix, bits) -> {
double[] res = v.vec().clone();
res[ix] = Double.longBitsToDouble((long)bits);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -511,7 +511,7 @@ final class Double64Vector extends DoubleVector {
this, i,
(vec, ix) -> {
double[] vecarr = vec.vec();
return (long)Double.doubleToLongBits(vecarr[ix]);
return (long)Double.doubleToRawLongBits(vecarr[ix]);
});
}
@ -527,7 +527,7 @@ final class Double64Vector extends DoubleVector {
public Double64Vector withLaneHelper(int i, double e) {
return VectorSupport.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)Double.doubleToLongBits(e),
this, i, (long)Double.doubleToRawLongBits(e),
(v, ix, bits) -> {
double[] res = v.vec().clone();
res[ix] = Double.longBitsToDouble((long)bits);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -510,7 +510,7 @@ final class DoubleMaxVector extends DoubleVector {
this, i,
(vec, ix) -> {
double[] vecarr = vec.vec();
return (long)Double.doubleToLongBits(vecarr[ix]);
return (long)Double.doubleToRawLongBits(vecarr[ix]);
});
}
@ -526,7 +526,7 @@ final class DoubleMaxVector extends DoubleVector {
public DoubleMaxVector withLaneHelper(int i, double e) {
return VectorSupport.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)Double.doubleToLongBits(e),
this, i, (long)Double.doubleToRawLongBits(e),
(v, ix, bits) -> {
double[] res = v.vec().clone();
res[ix] = Double.longBitsToDouble((long)bits);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -514,7 +514,7 @@ final class Float128Vector extends FloatVector {
this, i,
(vec, ix) -> {
float[] vecarr = vec.vec();
return (long)Float.floatToIntBits(vecarr[ix]);
return (long)Float.floatToRawIntBits(vecarr[ix]);
});
}
@ -533,7 +533,7 @@ final class Float128Vector extends FloatVector {
public Float128Vector withLaneHelper(int i, float e) {
return VectorSupport.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)Float.floatToIntBits(e),
this, i, (long)Float.floatToRawIntBits(e),
(v, ix, bits) -> {
float[] res = v.vec().clone();
res[ix] = Float.intBitsToFloat((int)bits);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -518,7 +518,7 @@ final class Float256Vector extends FloatVector {
this, i,
(vec, ix) -> {
float[] vecarr = vec.vec();
return (long)Float.floatToIntBits(vecarr[ix]);
return (long)Float.floatToRawIntBits(vecarr[ix]);
});
}
@ -541,7 +541,7 @@ final class Float256Vector extends FloatVector {
public Float256Vector withLaneHelper(int i, float e) {
return VectorSupport.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)Float.floatToIntBits(e),
this, i, (long)Float.floatToRawIntBits(e),
(v, ix, bits) -> {
float[] res = v.vec().clone();
res[ix] = Float.intBitsToFloat((int)bits);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -526,7 +526,7 @@ final class Float512Vector extends FloatVector {
this, i,
(vec, ix) -> {
float[] vecarr = vec.vec();
return (long)Float.floatToIntBits(vecarr[ix]);
return (long)Float.floatToRawIntBits(vecarr[ix]);
});
}
@ -557,7 +557,7 @@ final class Float512Vector extends FloatVector {
public Float512Vector withLaneHelper(int i, float e) {
return VectorSupport.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)Float.floatToIntBits(e),
this, i, (long)Float.floatToRawIntBits(e),
(v, ix, bits) -> {
float[] res = v.vec().clone();
res[ix] = Float.intBitsToFloat((int)bits);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -512,7 +512,7 @@ final class Float64Vector extends FloatVector {
this, i,
(vec, ix) -> {
float[] vecarr = vec.vec();
return (long)Float.floatToIntBits(vecarr[ix]);
return (long)Float.floatToRawIntBits(vecarr[ix]);
});
}
@ -529,7 +529,7 @@ final class Float64Vector extends FloatVector {
public Float64Vector withLaneHelper(int i, float e) {
return VectorSupport.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)Float.floatToIntBits(e),
this, i, (long)Float.floatToRawIntBits(e),
(v, ix, bits) -> {
float[] res = v.vec().clone();
res[ix] = Float.intBitsToFloat((int)bits);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -510,7 +510,7 @@ final class FloatMaxVector extends FloatVector {
this, i,
(vec, ix) -> {
float[] vecarr = vec.vec();
return (long)Float.floatToIntBits(vecarr[ix]);
return (long)Float.floatToRawIntBits(vecarr[ix]);
});
}
@ -526,7 +526,7 @@ final class FloatMaxVector extends FloatVector {
public FloatMaxVector withLaneHelper(int i, float e) {
return VectorSupport.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)Float.floatToIntBits(e),
this, i, (long)Float.floatToRawIntBits(e),
(v, ix, bits) -> {
float[] res = v.vec().clone();
res[ix] = Float.intBitsToFloat((int)bits);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -561,7 +561,7 @@ final class $vectortype$ extends $abstractvectortype$ {
this, i,
(vec, ix) -> {
$type$[] vecarr = vec.vec();
return (long)$Type$.$type$To$Bitstype$Bits(vecarr[ix]);
return (long)$Type$.$type$ToRaw$Bitstype$Bits(vecarr[ix]);
});
}
@ -607,7 +607,7 @@ final class $vectortype$ extends $abstractvectortype$ {
public $vectortype$ withLaneHelper(int i, $type$ e) {
return VectorSupport.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)$Type$.$type$To$Bitstype$Bits(e),
this, i, (long)$Type$.$type$ToRaw$Bitstype$Bits(e),
(v, ix, bits) -> {
$type$[] res = v.vec().clone();
res[ix] = $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits);

View File

@ -67,6 +67,14 @@ public class Byte128VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
static void assertArraysStrictlyEquals(byte[] r, byte[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
byte apply(byte a);
}
@ -231,25 +239,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(byte[] r, byte[] a, byte element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(byte[] r, byte[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -704,21 +693,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
byte apply(byte[] a, int b);
}
static void assertArraysEquals(byte[] r, byte[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
byte[] apply(byte[] a, int ix, int[] b, int iy);
}
@ -1212,10 +1186,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
}
}
static byte get(byte[] a, int i) {
return (byte) a[i];
}
static final IntFunction<byte[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new byte[length];
@ -3748,22 +3718,23 @@ public class Byte128VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Byte128VectorTests::allTrue);
}
@Test(dataProvider = "byteUnaryOpProvider")
static void withByte128VectorTests(IntFunction<byte []> fa) {
@Test(dataProvider = "byteBinaryOpProvider")
static void withByte128VectorTests(IntFunction<byte []> fa, IntFunction<byte []> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (byte)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (byte)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(byte a) {
@ -4698,7 +4669,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Byte128VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "byteUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Byte256VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
static void assertArraysStrictlyEquals(byte[] r, byte[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
byte apply(byte a);
}
@ -231,25 +239,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(byte[] r, byte[] a, byte element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(byte[] r, byte[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -704,21 +693,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
byte apply(byte[] a, int b);
}
static void assertArraysEquals(byte[] r, byte[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
byte[] apply(byte[] a, int ix, int[] b, int iy);
}
@ -1212,10 +1186,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
}
}
static byte get(byte[] a, int i) {
return (byte) a[i];
}
static final IntFunction<byte[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new byte[length];
@ -3748,22 +3718,23 @@ public class Byte256VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Byte256VectorTests::allTrue);
}
@Test(dataProvider = "byteUnaryOpProvider")
static void withByte256VectorTests(IntFunction<byte []> fa) {
@Test(dataProvider = "byteBinaryOpProvider")
static void withByte256VectorTests(IntFunction<byte []> fa, IntFunction<byte []> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (byte)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (byte)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(byte a) {
@ -4698,7 +4669,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Byte256VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "byteUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Byte512VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
static void assertArraysStrictlyEquals(byte[] r, byte[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
byte apply(byte a);
}
@ -231,25 +239,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(byte[] r, byte[] a, byte element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(byte[] r, byte[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -704,21 +693,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
byte apply(byte[] a, int b);
}
static void assertArraysEquals(byte[] r, byte[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
byte[] apply(byte[] a, int ix, int[] b, int iy);
}
@ -1212,10 +1186,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
}
}
static byte get(byte[] a, int i) {
return (byte) a[i];
}
static final IntFunction<byte[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new byte[length];
@ -3748,22 +3718,23 @@ public class Byte512VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Byte512VectorTests::allTrue);
}
@Test(dataProvider = "byteUnaryOpProvider")
static void withByte512VectorTests(IntFunction<byte []> fa) {
@Test(dataProvider = "byteBinaryOpProvider")
static void withByte512VectorTests(IntFunction<byte []> fa, IntFunction<byte []> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (byte)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (byte)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(byte a) {
@ -4698,7 +4669,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Byte512VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "byteUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Byte64VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
static void assertArraysStrictlyEquals(byte[] r, byte[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
byte apply(byte a);
}
@ -231,25 +239,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(byte[] r, byte[] a, byte element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(byte[] r, byte[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -704,21 +693,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
byte apply(byte[] a, int b);
}
static void assertArraysEquals(byte[] r, byte[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
byte[] apply(byte[] a, int ix, int[] b, int iy);
}
@ -1212,10 +1186,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
}
}
static byte get(byte[] a, int i) {
return (byte) a[i];
}
static final IntFunction<byte[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new byte[length];
@ -3748,22 +3718,23 @@ public class Byte64VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Byte64VectorTests::allTrue);
}
@Test(dataProvider = "byteUnaryOpProvider")
static void withByte64VectorTests(IntFunction<byte []> fa) {
@Test(dataProvider = "byteBinaryOpProvider")
static void withByte64VectorTests(IntFunction<byte []> fa, IntFunction<byte []> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (byte)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (byte)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(byte a) {
@ -4698,7 +4669,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Byte64VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "byteUnaryOpProvider")

View File

@ -72,6 +72,14 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max);
static void assertArraysStrictlyEquals(byte[] r, byte[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
byte apply(byte a);
}
@ -236,25 +244,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(byte[] r, byte[] a, byte element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(byte[] r, byte[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -709,21 +698,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
interface FBinArrayOp {
byte apply(byte[] a, int b);
}
static void assertArraysEquals(byte[] r, byte[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
byte[] apply(byte[] a, int ix, int[] b, int iy);
}
@ -1217,10 +1191,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
}
}
static byte get(byte[] a, int i) {
return (byte) a[i];
}
static final IntFunction<byte[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new byte[length];
@ -3753,22 +3723,23 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, ByteMaxVectorTests::allTrue);
}
@Test(dataProvider = "byteUnaryOpProvider")
static void withByteMaxVectorTests(IntFunction<byte []> fa) {
@Test(dataProvider = "byteBinaryOpProvider")
static void withByteMaxVectorTests(IntFunction<byte []> fa, IntFunction<byte []> fb) {
byte[] a = fa.apply(SPECIES.length());
byte[] b = fb.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (byte)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (byte)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(byte a) {
@ -4703,7 +4674,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, ByteMaxVectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "byteUnaryOpProvider")

View File

@ -71,6 +71,16 @@ public class Double128VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
static void assertArraysStrictlyEquals(double[] r, double[] a) {
for (int i = 0; i < a.length; i++) {
long ir = Double.doubleToRawLongBits(r[i]);
long ia = Double.doubleToRawLongBits(a[i]);
if (ir != ia) {
Assert.fail(String.format("at index #%d, expected = %016X, actual = %016X", i, ia, ir));
}
}
}
interface FUnOp {
double apply(double a);
}
@ -248,25 +258,6 @@ relativeError));
}
}
static void assertInsertArraysEquals(double[] r, double[] a, double element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(double[] r, double[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -795,21 +786,6 @@ relativeError));
}
}
interface FBinArrayOp {
double apply(double[] a, int b);
}
static void assertArraysEquals(double[] r, double[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
double[] apply(double[] a, int ix, int[] b, int iy);
}
@ -1356,26 +1332,16 @@ relativeError));
}
static double cornerCaseValue(int i) {
switch(i % 7) {
case 0:
return Double.MAX_VALUE;
case 1:
return Double.MIN_VALUE;
case 2:
return Double.NEGATIVE_INFINITY;
case 3:
return Double.POSITIVE_INFINITY;
case 4:
return Double.NaN;
case 5:
return (double)0.0;
default:
return (double)-0.0;
}
}
static double get(double[] a, int i) {
return (double) a[i];
return switch(i % 8) {
case 0 -> Double.MAX_VALUE;
case 1 -> Double.MIN_VALUE;
case 2 -> Double.NEGATIVE_INFINITY;
case 3 -> Double.POSITIVE_INFINITY;
case 4 -> Double.NaN;
case 5 -> Double.longBitsToDouble(0x7FF123456789ABCDL);
case 6 -> (double)0.0;
default -> (double)-0.0;
};
}
static final IntFunction<double[]> fr = (vl) -> {
@ -2602,22 +2568,23 @@ relativeError));
Double128VectorTests::FIRST_NONZEROReduceMasked, Double128VectorTests::FIRST_NONZEROReduceAllMasked);
}
@Test(dataProvider = "doubleUnaryOpProvider")
static void withDouble128VectorTests(IntFunction<double []> fa) {
@Test(dataProvider = "doubleBinaryOpProvider")
static void withDouble128VectorTests(IntFunction<double []> fa, IntFunction<double []> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (double)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (double)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(double a) {
@ -3507,7 +3474,7 @@ relativeError));
}
}
assertArraysEquals(r, a, Double128VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "doubleUnaryOpProvider")

View File

@ -71,6 +71,16 @@ public class Double256VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
static void assertArraysStrictlyEquals(double[] r, double[] a) {
for (int i = 0; i < a.length; i++) {
long ir = Double.doubleToRawLongBits(r[i]);
long ia = Double.doubleToRawLongBits(a[i]);
if (ir != ia) {
Assert.fail(String.format("at index #%d, expected = %016X, actual = %016X", i, ia, ir));
}
}
}
interface FUnOp {
double apply(double a);
}
@ -248,25 +258,6 @@ relativeError));
}
}
static void assertInsertArraysEquals(double[] r, double[] a, double element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(double[] r, double[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -795,21 +786,6 @@ relativeError));
}
}
interface FBinArrayOp {
double apply(double[] a, int b);
}
static void assertArraysEquals(double[] r, double[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
double[] apply(double[] a, int ix, int[] b, int iy);
}
@ -1356,26 +1332,16 @@ relativeError));
}
static double cornerCaseValue(int i) {
switch(i % 7) {
case 0:
return Double.MAX_VALUE;
case 1:
return Double.MIN_VALUE;
case 2:
return Double.NEGATIVE_INFINITY;
case 3:
return Double.POSITIVE_INFINITY;
case 4:
return Double.NaN;
case 5:
return (double)0.0;
default:
return (double)-0.0;
}
}
static double get(double[] a, int i) {
return (double) a[i];
return switch(i % 8) {
case 0 -> Double.MAX_VALUE;
case 1 -> Double.MIN_VALUE;
case 2 -> Double.NEGATIVE_INFINITY;
case 3 -> Double.POSITIVE_INFINITY;
case 4 -> Double.NaN;
case 5 -> Double.longBitsToDouble(0x7FF123456789ABCDL);
case 6 -> (double)0.0;
default -> (double)-0.0;
};
}
static final IntFunction<double[]> fr = (vl) -> {
@ -2602,22 +2568,23 @@ relativeError));
Double256VectorTests::FIRST_NONZEROReduceMasked, Double256VectorTests::FIRST_NONZEROReduceAllMasked);
}
@Test(dataProvider = "doubleUnaryOpProvider")
static void withDouble256VectorTests(IntFunction<double []> fa) {
@Test(dataProvider = "doubleBinaryOpProvider")
static void withDouble256VectorTests(IntFunction<double []> fa, IntFunction<double []> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (double)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (double)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(double a) {
@ -3507,7 +3474,7 @@ relativeError));
}
}
assertArraysEquals(r, a, Double256VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "doubleUnaryOpProvider")

View File

@ -71,6 +71,16 @@ public class Double512VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
static void assertArraysStrictlyEquals(double[] r, double[] a) {
for (int i = 0; i < a.length; i++) {
long ir = Double.doubleToRawLongBits(r[i]);
long ia = Double.doubleToRawLongBits(a[i]);
if (ir != ia) {
Assert.fail(String.format("at index #%d, expected = %016X, actual = %016X", i, ia, ir));
}
}
}
interface FUnOp {
double apply(double a);
}
@ -248,25 +258,6 @@ relativeError));
}
}
static void assertInsertArraysEquals(double[] r, double[] a, double element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(double[] r, double[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -795,21 +786,6 @@ relativeError));
}
}
interface FBinArrayOp {
double apply(double[] a, int b);
}
static void assertArraysEquals(double[] r, double[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
double[] apply(double[] a, int ix, int[] b, int iy);
}
@ -1356,26 +1332,16 @@ relativeError));
}
static double cornerCaseValue(int i) {
switch(i % 7) {
case 0:
return Double.MAX_VALUE;
case 1:
return Double.MIN_VALUE;
case 2:
return Double.NEGATIVE_INFINITY;
case 3:
return Double.POSITIVE_INFINITY;
case 4:
return Double.NaN;
case 5:
return (double)0.0;
default:
return (double)-0.0;
}
}
static double get(double[] a, int i) {
return (double) a[i];
return switch(i % 8) {
case 0 -> Double.MAX_VALUE;
case 1 -> Double.MIN_VALUE;
case 2 -> Double.NEGATIVE_INFINITY;
case 3 -> Double.POSITIVE_INFINITY;
case 4 -> Double.NaN;
case 5 -> Double.longBitsToDouble(0x7FF123456789ABCDL);
case 6 -> (double)0.0;
default -> (double)-0.0;
};
}
static final IntFunction<double[]> fr = (vl) -> {
@ -2602,22 +2568,23 @@ relativeError));
Double512VectorTests::FIRST_NONZEROReduceMasked, Double512VectorTests::FIRST_NONZEROReduceAllMasked);
}
@Test(dataProvider = "doubleUnaryOpProvider")
static void withDouble512VectorTests(IntFunction<double []> fa) {
@Test(dataProvider = "doubleBinaryOpProvider")
static void withDouble512VectorTests(IntFunction<double []> fa, IntFunction<double []> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (double)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (double)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(double a) {
@ -3507,7 +3474,7 @@ relativeError));
}
}
assertArraysEquals(r, a, Double512VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "doubleUnaryOpProvider")

View File

@ -71,6 +71,16 @@ public class Double64VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
static void assertArraysStrictlyEquals(double[] r, double[] a) {
for (int i = 0; i < a.length; i++) {
long ir = Double.doubleToRawLongBits(r[i]);
long ia = Double.doubleToRawLongBits(a[i]);
if (ir != ia) {
Assert.fail(String.format("at index #%d, expected = %016X, actual = %016X", i, ia, ir));
}
}
}
interface FUnOp {
double apply(double a);
}
@ -248,25 +258,6 @@ relativeError));
}
}
static void assertInsertArraysEquals(double[] r, double[] a, double element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(double[] r, double[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -795,21 +786,6 @@ relativeError));
}
}
interface FBinArrayOp {
double apply(double[] a, int b);
}
static void assertArraysEquals(double[] r, double[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
double[] apply(double[] a, int ix, int[] b, int iy);
}
@ -1356,26 +1332,16 @@ relativeError));
}
static double cornerCaseValue(int i) {
switch(i % 7) {
case 0:
return Double.MAX_VALUE;
case 1:
return Double.MIN_VALUE;
case 2:
return Double.NEGATIVE_INFINITY;
case 3:
return Double.POSITIVE_INFINITY;
case 4:
return Double.NaN;
case 5:
return (double)0.0;
default:
return (double)-0.0;
}
}
static double get(double[] a, int i) {
return (double) a[i];
return switch(i % 8) {
case 0 -> Double.MAX_VALUE;
case 1 -> Double.MIN_VALUE;
case 2 -> Double.NEGATIVE_INFINITY;
case 3 -> Double.POSITIVE_INFINITY;
case 4 -> Double.NaN;
case 5 -> Double.longBitsToDouble(0x7FF123456789ABCDL);
case 6 -> (double)0.0;
default -> (double)-0.0;
};
}
static final IntFunction<double[]> fr = (vl) -> {
@ -2602,22 +2568,23 @@ relativeError));
Double64VectorTests::FIRST_NONZEROReduceMasked, Double64VectorTests::FIRST_NONZEROReduceAllMasked);
}
@Test(dataProvider = "doubleUnaryOpProvider")
static void withDouble64VectorTests(IntFunction<double []> fa) {
@Test(dataProvider = "doubleBinaryOpProvider")
static void withDouble64VectorTests(IntFunction<double []> fa, IntFunction<double []> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (double)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (double)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(double a) {
@ -3507,7 +3474,7 @@ relativeError));
}
}
assertArraysEquals(r, a, Double64VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "doubleUnaryOpProvider")

View File

@ -76,6 +76,16 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max);
static void assertArraysStrictlyEquals(double[] r, double[] a) {
for (int i = 0; i < a.length; i++) {
long ir = Double.doubleToRawLongBits(r[i]);
long ia = Double.doubleToRawLongBits(a[i]);
if (ir != ia) {
Assert.fail(String.format("at index #%d, expected = %016X, actual = %016X", i, ia, ir));
}
}
}
interface FUnOp {
double apply(double a);
}
@ -253,25 +263,6 @@ relativeError));
}
}
static void assertInsertArraysEquals(double[] r, double[] a, double element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(double[] r, double[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -800,21 +791,6 @@ relativeError));
}
}
interface FBinArrayOp {
double apply(double[] a, int b);
}
static void assertArraysEquals(double[] r, double[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
double[] apply(double[] a, int ix, int[] b, int iy);
}
@ -1361,26 +1337,16 @@ relativeError));
}
static double cornerCaseValue(int i) {
switch(i % 7) {
case 0:
return Double.MAX_VALUE;
case 1:
return Double.MIN_VALUE;
case 2:
return Double.NEGATIVE_INFINITY;
case 3:
return Double.POSITIVE_INFINITY;
case 4:
return Double.NaN;
case 5:
return (double)0.0;
default:
return (double)-0.0;
}
}
static double get(double[] a, int i) {
return (double) a[i];
return switch(i % 8) {
case 0 -> Double.MAX_VALUE;
case 1 -> Double.MIN_VALUE;
case 2 -> Double.NEGATIVE_INFINITY;
case 3 -> Double.POSITIVE_INFINITY;
case 4 -> Double.NaN;
case 5 -> Double.longBitsToDouble(0x7FF123456789ABCDL);
case 6 -> (double)0.0;
default -> (double)-0.0;
};
}
static final IntFunction<double[]> fr = (vl) -> {
@ -2607,22 +2573,23 @@ relativeError));
DoubleMaxVectorTests::FIRST_NONZEROReduceMasked, DoubleMaxVectorTests::FIRST_NONZEROReduceAllMasked);
}
@Test(dataProvider = "doubleUnaryOpProvider")
static void withDoubleMaxVectorTests(IntFunction<double []> fa) {
@Test(dataProvider = "doubleBinaryOpProvider")
static void withDoubleMaxVectorTests(IntFunction<double []> fa, IntFunction<double []> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (double)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (double)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(double a) {
@ -3512,7 +3479,7 @@ relativeError));
}
}
assertArraysEquals(r, a, DoubleMaxVectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "doubleUnaryOpProvider")

View File

@ -71,6 +71,16 @@ public class Float128VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
static void assertArraysStrictlyEquals(float[] r, float[] a) {
for (int i = 0; i < a.length; i++) {
int ir = Float.floatToRawIntBits(r[i]);
int ia = Float.floatToRawIntBits(a[i]);
if (ir != ia) {
Assert.fail(String.format("at index #%d, expected = %08X, actual = %08X", i, ia, ir));
}
}
}
interface FUnOp {
float apply(float a);
}
@ -248,25 +258,6 @@ relativeError));
}
}
static void assertInsertArraysEquals(float[] r, float[] a, float element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(float[] r, float[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -795,21 +786,6 @@ relativeError));
}
}
interface FBinArrayOp {
float apply(float[] a, int b);
}
static void assertArraysEquals(float[] r, float[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
float[] apply(float[] a, int ix, int[] b, int iy);
}
@ -1367,26 +1343,16 @@ relativeError));
}
static float cornerCaseValue(int i) {
switch(i % 7) {
case 0:
return Float.MAX_VALUE;
case 1:
return Float.MIN_VALUE;
case 2:
return Float.NEGATIVE_INFINITY;
case 3:
return Float.POSITIVE_INFINITY;
case 4:
return Float.NaN;
case 5:
return (float)0.0;
default:
return (float)-0.0;
}
}
static float get(float[] a, int i) {
return (float) a[i];
return switch(i % 8) {
case 0 -> Float.MAX_VALUE;
case 1 -> Float.MIN_VALUE;
case 2 -> Float.NEGATIVE_INFINITY;
case 3 -> Float.POSITIVE_INFINITY;
case 4 -> Float.NaN;
case 5 -> Float.intBitsToFloat(0x7F812345);
case 6 -> (float)0.0;
default -> (float)-0.0;
};
}
static final IntFunction<float[]> fr = (vl) -> {
@ -2613,22 +2579,23 @@ relativeError));
Float128VectorTests::FIRST_NONZEROReduceMasked, Float128VectorTests::FIRST_NONZEROReduceAllMasked);
}
@Test(dataProvider = "floatUnaryOpProvider")
static void withFloat128VectorTests(IntFunction<float []> fa) {
@Test(dataProvider = "floatBinaryOpProvider")
static void withFloat128VectorTests(IntFunction<float []> fa, IntFunction<float []> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
FloatVector av = FloatVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (float)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(float a) {
@ -3518,7 +3485,7 @@ relativeError));
}
}
assertArraysEquals(r, a, Float128VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "floatUnaryOpProvider")

View File

@ -71,6 +71,16 @@ public class Float256VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
static void assertArraysStrictlyEquals(float[] r, float[] a) {
for (int i = 0; i < a.length; i++) {
int ir = Float.floatToRawIntBits(r[i]);
int ia = Float.floatToRawIntBits(a[i]);
if (ir != ia) {
Assert.fail(String.format("at index #%d, expected = %08X, actual = %08X", i, ia, ir));
}
}
}
interface FUnOp {
float apply(float a);
}
@ -248,25 +258,6 @@ relativeError));
}
}
static void assertInsertArraysEquals(float[] r, float[] a, float element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(float[] r, float[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -795,21 +786,6 @@ relativeError));
}
}
interface FBinArrayOp {
float apply(float[] a, int b);
}
static void assertArraysEquals(float[] r, float[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
float[] apply(float[] a, int ix, int[] b, int iy);
}
@ -1367,26 +1343,16 @@ relativeError));
}
static float cornerCaseValue(int i) {
switch(i % 7) {
case 0:
return Float.MAX_VALUE;
case 1:
return Float.MIN_VALUE;
case 2:
return Float.NEGATIVE_INFINITY;
case 3:
return Float.POSITIVE_INFINITY;
case 4:
return Float.NaN;
case 5:
return (float)0.0;
default:
return (float)-0.0;
}
}
static float get(float[] a, int i) {
return (float) a[i];
return switch(i % 8) {
case 0 -> Float.MAX_VALUE;
case 1 -> Float.MIN_VALUE;
case 2 -> Float.NEGATIVE_INFINITY;
case 3 -> Float.POSITIVE_INFINITY;
case 4 -> Float.NaN;
case 5 -> Float.intBitsToFloat(0x7F812345);
case 6 -> (float)0.0;
default -> (float)-0.0;
};
}
static final IntFunction<float[]> fr = (vl) -> {
@ -2613,22 +2579,23 @@ relativeError));
Float256VectorTests::FIRST_NONZEROReduceMasked, Float256VectorTests::FIRST_NONZEROReduceAllMasked);
}
@Test(dataProvider = "floatUnaryOpProvider")
static void withFloat256VectorTests(IntFunction<float []> fa) {
@Test(dataProvider = "floatBinaryOpProvider")
static void withFloat256VectorTests(IntFunction<float []> fa, IntFunction<float []> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
FloatVector av = FloatVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (float)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(float a) {
@ -3518,7 +3485,7 @@ relativeError));
}
}
assertArraysEquals(r, a, Float256VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "floatUnaryOpProvider")

View File

@ -71,6 +71,16 @@ public class Float512VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
static void assertArraysStrictlyEquals(float[] r, float[] a) {
for (int i = 0; i < a.length; i++) {
int ir = Float.floatToRawIntBits(r[i]);
int ia = Float.floatToRawIntBits(a[i]);
if (ir != ia) {
Assert.fail(String.format("at index #%d, expected = %08X, actual = %08X", i, ia, ir));
}
}
}
interface FUnOp {
float apply(float a);
}
@ -248,25 +258,6 @@ relativeError));
}
}
static void assertInsertArraysEquals(float[] r, float[] a, float element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(float[] r, float[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -795,21 +786,6 @@ relativeError));
}
}
interface FBinArrayOp {
float apply(float[] a, int b);
}
static void assertArraysEquals(float[] r, float[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
float[] apply(float[] a, int ix, int[] b, int iy);
}
@ -1367,26 +1343,16 @@ relativeError));
}
static float cornerCaseValue(int i) {
switch(i % 7) {
case 0:
return Float.MAX_VALUE;
case 1:
return Float.MIN_VALUE;
case 2:
return Float.NEGATIVE_INFINITY;
case 3:
return Float.POSITIVE_INFINITY;
case 4:
return Float.NaN;
case 5:
return (float)0.0;
default:
return (float)-0.0;
}
}
static float get(float[] a, int i) {
return (float) a[i];
return switch(i % 8) {
case 0 -> Float.MAX_VALUE;
case 1 -> Float.MIN_VALUE;
case 2 -> Float.NEGATIVE_INFINITY;
case 3 -> Float.POSITIVE_INFINITY;
case 4 -> Float.NaN;
case 5 -> Float.intBitsToFloat(0x7F812345);
case 6 -> (float)0.0;
default -> (float)-0.0;
};
}
static final IntFunction<float[]> fr = (vl) -> {
@ -2613,22 +2579,23 @@ relativeError));
Float512VectorTests::FIRST_NONZEROReduceMasked, Float512VectorTests::FIRST_NONZEROReduceAllMasked);
}
@Test(dataProvider = "floatUnaryOpProvider")
static void withFloat512VectorTests(IntFunction<float []> fa) {
@Test(dataProvider = "floatBinaryOpProvider")
static void withFloat512VectorTests(IntFunction<float []> fa, IntFunction<float []> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
FloatVector av = FloatVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (float)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(float a) {
@ -3518,7 +3485,7 @@ relativeError));
}
}
assertArraysEquals(r, a, Float512VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "floatUnaryOpProvider")

View File

@ -71,6 +71,16 @@ public class Float64VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
static void assertArraysStrictlyEquals(float[] r, float[] a) {
for (int i = 0; i < a.length; i++) {
int ir = Float.floatToRawIntBits(r[i]);
int ia = Float.floatToRawIntBits(a[i]);
if (ir != ia) {
Assert.fail(String.format("at index #%d, expected = %08X, actual = %08X", i, ia, ir));
}
}
}
interface FUnOp {
float apply(float a);
}
@ -248,25 +258,6 @@ relativeError));
}
}
static void assertInsertArraysEquals(float[] r, float[] a, float element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(float[] r, float[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -795,21 +786,6 @@ relativeError));
}
}
interface FBinArrayOp {
float apply(float[] a, int b);
}
static void assertArraysEquals(float[] r, float[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
float[] apply(float[] a, int ix, int[] b, int iy);
}
@ -1367,26 +1343,16 @@ relativeError));
}
static float cornerCaseValue(int i) {
switch(i % 7) {
case 0:
return Float.MAX_VALUE;
case 1:
return Float.MIN_VALUE;
case 2:
return Float.NEGATIVE_INFINITY;
case 3:
return Float.POSITIVE_INFINITY;
case 4:
return Float.NaN;
case 5:
return (float)0.0;
default:
return (float)-0.0;
}
}
static float get(float[] a, int i) {
return (float) a[i];
return switch(i % 8) {
case 0 -> Float.MAX_VALUE;
case 1 -> Float.MIN_VALUE;
case 2 -> Float.NEGATIVE_INFINITY;
case 3 -> Float.POSITIVE_INFINITY;
case 4 -> Float.NaN;
case 5 -> Float.intBitsToFloat(0x7F812345);
case 6 -> (float)0.0;
default -> (float)-0.0;
};
}
static final IntFunction<float[]> fr = (vl) -> {
@ -2613,22 +2579,23 @@ relativeError));
Float64VectorTests::FIRST_NONZEROReduceMasked, Float64VectorTests::FIRST_NONZEROReduceAllMasked);
}
@Test(dataProvider = "floatUnaryOpProvider")
static void withFloat64VectorTests(IntFunction<float []> fa) {
@Test(dataProvider = "floatBinaryOpProvider")
static void withFloat64VectorTests(IntFunction<float []> fa, IntFunction<float []> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
FloatVector av = FloatVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (float)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(float a) {
@ -3518,7 +3485,7 @@ relativeError));
}
}
assertArraysEquals(r, a, Float64VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "floatUnaryOpProvider")

View File

@ -76,6 +76,16 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max);
static void assertArraysStrictlyEquals(float[] r, float[] a) {
for (int i = 0; i < a.length; i++) {
int ir = Float.floatToRawIntBits(r[i]);
int ia = Float.floatToRawIntBits(a[i]);
if (ir != ia) {
Assert.fail(String.format("at index #%d, expected = %08X, actual = %08X", i, ia, ir));
}
}
}
interface FUnOp {
float apply(float a);
}
@ -253,25 +263,6 @@ relativeError));
}
}
static void assertInsertArraysEquals(float[] r, float[] a, float element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(float[] r, float[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -800,21 +791,6 @@ relativeError));
}
}
interface FBinArrayOp {
float apply(float[] a, int b);
}
static void assertArraysEquals(float[] r, float[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
float[] apply(float[] a, int ix, int[] b, int iy);
}
@ -1372,26 +1348,16 @@ relativeError));
}
static float cornerCaseValue(int i) {
switch(i % 7) {
case 0:
return Float.MAX_VALUE;
case 1:
return Float.MIN_VALUE;
case 2:
return Float.NEGATIVE_INFINITY;
case 3:
return Float.POSITIVE_INFINITY;
case 4:
return Float.NaN;
case 5:
return (float)0.0;
default:
return (float)-0.0;
}
}
static float get(float[] a, int i) {
return (float) a[i];
return switch(i % 8) {
case 0 -> Float.MAX_VALUE;
case 1 -> Float.MIN_VALUE;
case 2 -> Float.NEGATIVE_INFINITY;
case 3 -> Float.POSITIVE_INFINITY;
case 4 -> Float.NaN;
case 5 -> Float.intBitsToFloat(0x7F812345);
case 6 -> (float)0.0;
default -> (float)-0.0;
};
}
static final IntFunction<float[]> fr = (vl) -> {
@ -2618,22 +2584,23 @@ relativeError));
FloatMaxVectorTests::FIRST_NONZEROReduceMasked, FloatMaxVectorTests::FIRST_NONZEROReduceAllMasked);
}
@Test(dataProvider = "floatUnaryOpProvider")
static void withFloatMaxVectorTests(IntFunction<float []> fa) {
@Test(dataProvider = "floatBinaryOpProvider")
static void withFloatMaxVectorTests(IntFunction<float []> fa, IntFunction<float []> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
FloatVector av = FloatVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (float)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(float a) {
@ -3523,7 +3490,7 @@ relativeError));
}
}
assertArraysEquals(r, a, FloatMaxVectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "floatUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Int128VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
static void assertArraysStrictlyEquals(int[] r, int[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
int apply(int a);
}
@ -231,25 +239,6 @@ public class Int128VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(int[] r, int[] a, int element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -704,21 +693,6 @@ public class Int128VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
int apply(int[] a, int b);
}
static void assertArraysEquals(int[] r, int[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
int[] apply(int[] a, int ix, int[] b, int iy);
}
@ -1172,10 +1146,6 @@ public class Int128VectorTests extends AbstractVectorTest {
}
}
static int get(int[] a, int i) {
return (int) a[i];
}
static final IntFunction<int[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new int[length];
@ -3792,22 +3762,23 @@ public class Int128VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Int128VectorTests::allTrue);
}
@Test(dataProvider = "intUnaryOpProvider")
static void withInt128VectorTests(IntFunction<int []> fa) {
@Test(dataProvider = "intBinaryOpProvider")
static void withInt128VectorTests(IntFunction<int []> fa, IntFunction<int []> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (int)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (int)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(int a) {
@ -4742,7 +4713,7 @@ public class Int128VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Int128VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "intUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Int256VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
static void assertArraysStrictlyEquals(int[] r, int[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
int apply(int a);
}
@ -231,25 +239,6 @@ public class Int256VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(int[] r, int[] a, int element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -704,21 +693,6 @@ public class Int256VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
int apply(int[] a, int b);
}
static void assertArraysEquals(int[] r, int[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
int[] apply(int[] a, int ix, int[] b, int iy);
}
@ -1172,10 +1146,6 @@ public class Int256VectorTests extends AbstractVectorTest {
}
}
static int get(int[] a, int i) {
return (int) a[i];
}
static final IntFunction<int[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new int[length];
@ -3792,22 +3762,23 @@ public class Int256VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Int256VectorTests::allTrue);
}
@Test(dataProvider = "intUnaryOpProvider")
static void withInt256VectorTests(IntFunction<int []> fa) {
@Test(dataProvider = "intBinaryOpProvider")
static void withInt256VectorTests(IntFunction<int []> fa, IntFunction<int []> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (int)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (int)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(int a) {
@ -4742,7 +4713,7 @@ public class Int256VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Int256VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "intUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Int512VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
static void assertArraysStrictlyEquals(int[] r, int[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
int apply(int a);
}
@ -231,25 +239,6 @@ public class Int512VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(int[] r, int[] a, int element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -704,21 +693,6 @@ public class Int512VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
int apply(int[] a, int b);
}
static void assertArraysEquals(int[] r, int[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
int[] apply(int[] a, int ix, int[] b, int iy);
}
@ -1172,10 +1146,6 @@ public class Int512VectorTests extends AbstractVectorTest {
}
}
static int get(int[] a, int i) {
return (int) a[i];
}
static final IntFunction<int[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new int[length];
@ -3792,22 +3762,23 @@ public class Int512VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Int512VectorTests::allTrue);
}
@Test(dataProvider = "intUnaryOpProvider")
static void withInt512VectorTests(IntFunction<int []> fa) {
@Test(dataProvider = "intBinaryOpProvider")
static void withInt512VectorTests(IntFunction<int []> fa, IntFunction<int []> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (int)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (int)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(int a) {
@ -4742,7 +4713,7 @@ public class Int512VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Int512VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "intUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Int64VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
static void assertArraysStrictlyEquals(int[] r, int[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
int apply(int a);
}
@ -231,25 +239,6 @@ public class Int64VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(int[] r, int[] a, int element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -704,21 +693,6 @@ public class Int64VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
int apply(int[] a, int b);
}
static void assertArraysEquals(int[] r, int[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
int[] apply(int[] a, int ix, int[] b, int iy);
}
@ -1172,10 +1146,6 @@ public class Int64VectorTests extends AbstractVectorTest {
}
}
static int get(int[] a, int i) {
return (int) a[i];
}
static final IntFunction<int[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new int[length];
@ -3792,22 +3762,23 @@ public class Int64VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Int64VectorTests::allTrue);
}
@Test(dataProvider = "intUnaryOpProvider")
static void withInt64VectorTests(IntFunction<int []> fa) {
@Test(dataProvider = "intBinaryOpProvider")
static void withInt64VectorTests(IntFunction<int []> fa, IntFunction<int []> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (int)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (int)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(int a) {
@ -4742,7 +4713,7 @@ public class Int64VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Int64VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "intUnaryOpProvider")

View File

@ -72,6 +72,14 @@ public class IntMaxVectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max);
static void assertArraysStrictlyEquals(int[] r, int[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
int apply(int a);
}
@ -236,25 +244,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(int[] r, int[] a, int element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -709,21 +698,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
interface FBinArrayOp {
int apply(int[] a, int b);
}
static void assertArraysEquals(int[] r, int[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
int[] apply(int[] a, int ix, int[] b, int iy);
}
@ -1177,10 +1151,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
}
}
static int get(int[] a, int i) {
return (int) a[i];
}
static final IntFunction<int[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new int[length];
@ -3797,22 +3767,23 @@ public class IntMaxVectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, IntMaxVectorTests::allTrue);
}
@Test(dataProvider = "intUnaryOpProvider")
static void withIntMaxVectorTests(IntFunction<int []> fa) {
@Test(dataProvider = "intBinaryOpProvider")
static void withIntMaxVectorTests(IntFunction<int []> fa, IntFunction<int []> fb) {
int[] a = fa.apply(SPECIES.length());
int[] b = fb.apply(SPECIES.length());
int[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
IntVector av = IntVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (int)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (int)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(int a) {
@ -4747,7 +4718,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, IntMaxVectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "intUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Long128VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
static void assertArraysStrictlyEquals(long[] r, long[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
long apply(long a);
}
@ -188,25 +196,6 @@ public class Long128VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(long[] r, long[] a, long element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(long[] r, long[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -661,21 +650,6 @@ public class Long128VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
long apply(long[] a, int b);
}
static void assertArraysEquals(long[] r, long[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
long[] apply(long[] a, int ix, int[] b, int iy);
}
@ -1199,10 +1173,6 @@ public class Long128VectorTests extends AbstractVectorTest {
}
}
static long get(long[] a, int i) {
return (long) a[i];
}
static final IntFunction<long[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new long[length];
@ -3814,22 +3784,23 @@ public class Long128VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Long128VectorTests::allTrue);
}
@Test(dataProvider = "longUnaryOpProvider")
static void withLong128VectorTests(IntFunction<long []> fa) {
@Test(dataProvider = "longBinaryOpProvider")
static void withLong128VectorTests(IntFunction<long []> fa, IntFunction<long []> fb) {
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, j = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (long)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(long a) {
@ -4694,7 +4665,7 @@ public class Long128VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Long128VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "longUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Long256VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
static void assertArraysStrictlyEquals(long[] r, long[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
long apply(long a);
}
@ -188,25 +196,6 @@ public class Long256VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(long[] r, long[] a, long element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(long[] r, long[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -661,21 +650,6 @@ public class Long256VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
long apply(long[] a, int b);
}
static void assertArraysEquals(long[] r, long[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
long[] apply(long[] a, int ix, int[] b, int iy);
}
@ -1199,10 +1173,6 @@ public class Long256VectorTests extends AbstractVectorTest {
}
}
static long get(long[] a, int i) {
return (long) a[i];
}
static final IntFunction<long[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new long[length];
@ -3814,22 +3784,23 @@ public class Long256VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Long256VectorTests::allTrue);
}
@Test(dataProvider = "longUnaryOpProvider")
static void withLong256VectorTests(IntFunction<long []> fa) {
@Test(dataProvider = "longBinaryOpProvider")
static void withLong256VectorTests(IntFunction<long []> fa, IntFunction<long []> fb) {
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, j = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (long)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(long a) {
@ -4694,7 +4665,7 @@ public class Long256VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Long256VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "longUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Long512VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
static void assertArraysStrictlyEquals(long[] r, long[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
long apply(long a);
}
@ -188,25 +196,6 @@ public class Long512VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(long[] r, long[] a, long element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(long[] r, long[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -661,21 +650,6 @@ public class Long512VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
long apply(long[] a, int b);
}
static void assertArraysEquals(long[] r, long[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
long[] apply(long[] a, int ix, int[] b, int iy);
}
@ -1199,10 +1173,6 @@ public class Long512VectorTests extends AbstractVectorTest {
}
}
static long get(long[] a, int i) {
return (long) a[i];
}
static final IntFunction<long[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new long[length];
@ -3814,22 +3784,23 @@ public class Long512VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Long512VectorTests::allTrue);
}
@Test(dataProvider = "longUnaryOpProvider")
static void withLong512VectorTests(IntFunction<long []> fa) {
@Test(dataProvider = "longBinaryOpProvider")
static void withLong512VectorTests(IntFunction<long []> fa, IntFunction<long []> fb) {
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, j = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (long)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(long a) {
@ -4694,7 +4665,7 @@ public class Long512VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Long512VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "longUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Long64VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
static void assertArraysStrictlyEquals(long[] r, long[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
long apply(long a);
}
@ -188,25 +196,6 @@ public class Long64VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(long[] r, long[] a, long element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(long[] r, long[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -661,21 +650,6 @@ public class Long64VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
long apply(long[] a, int b);
}
static void assertArraysEquals(long[] r, long[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
long[] apply(long[] a, int ix, int[] b, int iy);
}
@ -1199,10 +1173,6 @@ public class Long64VectorTests extends AbstractVectorTest {
}
}
static long get(long[] a, int i) {
return (long) a[i];
}
static final IntFunction<long[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new long[length];
@ -3814,22 +3784,23 @@ public class Long64VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Long64VectorTests::allTrue);
}
@Test(dataProvider = "longUnaryOpProvider")
static void withLong64VectorTests(IntFunction<long []> fa) {
@Test(dataProvider = "longBinaryOpProvider")
static void withLong64VectorTests(IntFunction<long []> fa, IntFunction<long []> fb) {
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, j = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (long)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(long a) {
@ -4694,7 +4665,7 @@ public class Long64VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Long64VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "longUnaryOpProvider")

View File

@ -72,6 +72,14 @@ public class LongMaxVectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max);
static void assertArraysStrictlyEquals(long[] r, long[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
long apply(long a);
}
@ -193,25 +201,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(long[] r, long[] a, long element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(long[] r, long[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -666,21 +655,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
interface FBinArrayOp {
long apply(long[] a, int b);
}
static void assertArraysEquals(long[] r, long[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
long[] apply(long[] a, int ix, int[] b, int iy);
}
@ -1204,10 +1178,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
}
}
static long get(long[] a, int i) {
return (long) a[i];
}
static final IntFunction<long[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new long[length];
@ -3819,22 +3789,23 @@ public class LongMaxVectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, LongMaxVectorTests::allTrue);
}
@Test(dataProvider = "longUnaryOpProvider")
static void withLongMaxVectorTests(IntFunction<long []> fa) {
@Test(dataProvider = "longBinaryOpProvider")
static void withLongMaxVectorTests(IntFunction<long []> fa, IntFunction<long []> fb) {
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, j = 0; i < a.length; i += SPECIES.length()) {
LongVector av = LongVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (long)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(long a) {
@ -4699,7 +4670,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, LongMaxVectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "longUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Short128VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
static void assertArraysStrictlyEquals(short[] r, short[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
short apply(short a);
}
@ -231,25 +239,6 @@ public class Short128VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(short[] r, short[] a, short element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(short[] r, short[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -704,21 +693,6 @@ public class Short128VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
short apply(short[] a, int b);
}
static void assertArraysEquals(short[] r, short[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
short[] apply(short[] a, int ix, int[] b, int iy);
}
@ -1202,10 +1176,6 @@ public class Short128VectorTests extends AbstractVectorTest {
}
}
static short get(short[] a, int i) {
return (short) a[i];
}
static final IntFunction<short[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new short[length];
@ -3739,22 +3709,23 @@ public class Short128VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Short128VectorTests::allTrue);
}
@Test(dataProvider = "shortUnaryOpProvider")
static void withShort128VectorTests(IntFunction<short []> fa) {
@Test(dataProvider = "shortBinaryOpProvider")
static void withShort128VectorTests(IntFunction<short []> fa, IntFunction<short []> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (short)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (short)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(short a) {
@ -4689,7 +4660,7 @@ public class Short128VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Short128VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "shortUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Short256VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
static void assertArraysStrictlyEquals(short[] r, short[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
short apply(short a);
}
@ -231,25 +239,6 @@ public class Short256VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(short[] r, short[] a, short element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(short[] r, short[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -704,21 +693,6 @@ public class Short256VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
short apply(short[] a, int b);
}
static void assertArraysEquals(short[] r, short[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
short[] apply(short[] a, int ix, int[] b, int iy);
}
@ -1202,10 +1176,6 @@ public class Short256VectorTests extends AbstractVectorTest {
}
}
static short get(short[] a, int i) {
return (short) a[i];
}
static final IntFunction<short[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new short[length];
@ -3739,22 +3709,23 @@ public class Short256VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Short256VectorTests::allTrue);
}
@Test(dataProvider = "shortUnaryOpProvider")
static void withShort256VectorTests(IntFunction<short []> fa) {
@Test(dataProvider = "shortBinaryOpProvider")
static void withShort256VectorTests(IntFunction<short []> fa, IntFunction<short []> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (short)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (short)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(short a) {
@ -4689,7 +4660,7 @@ public class Short256VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Short256VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "shortUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Short512VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
static void assertArraysStrictlyEquals(short[] r, short[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
short apply(short a);
}
@ -231,25 +239,6 @@ public class Short512VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(short[] r, short[] a, short element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(short[] r, short[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -704,21 +693,6 @@ public class Short512VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
short apply(short[] a, int b);
}
static void assertArraysEquals(short[] r, short[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
short[] apply(short[] a, int ix, int[] b, int iy);
}
@ -1202,10 +1176,6 @@ public class Short512VectorTests extends AbstractVectorTest {
}
}
static short get(short[] a, int i) {
return (short) a[i];
}
static final IntFunction<short[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new short[length];
@ -3739,22 +3709,23 @@ public class Short512VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Short512VectorTests::allTrue);
}
@Test(dataProvider = "shortUnaryOpProvider")
static void withShort512VectorTests(IntFunction<short []> fa) {
@Test(dataProvider = "shortBinaryOpProvider")
static void withShort512VectorTests(IntFunction<short []> fa, IntFunction<short []> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (short)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (short)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(short a) {
@ -4689,7 +4660,7 @@ public class Short512VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Short512VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "shortUnaryOpProvider")

View File

@ -67,6 +67,14 @@ public class Short64VectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
static void assertArraysStrictlyEquals(short[] r, short[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
short apply(short a);
}
@ -231,25 +239,6 @@ public class Short64VectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(short[] r, short[] a, short element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(short[] r, short[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -704,21 +693,6 @@ public class Short64VectorTests extends AbstractVectorTest {
interface FBinArrayOp {
short apply(short[] a, int b);
}
static void assertArraysEquals(short[] r, short[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
short[] apply(short[] a, int ix, int[] b, int iy);
}
@ -1202,10 +1176,6 @@ public class Short64VectorTests extends AbstractVectorTest {
}
}
static short get(short[] a, int i) {
return (short) a[i];
}
static final IntFunction<short[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new short[length];
@ -3739,22 +3709,23 @@ public class Short64VectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, Short64VectorTests::allTrue);
}
@Test(dataProvider = "shortUnaryOpProvider")
static void withShort64VectorTests(IntFunction<short []> fa) {
@Test(dataProvider = "shortBinaryOpProvider")
static void withShort64VectorTests(IntFunction<short []> fa, IntFunction<short []> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (short)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (short)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(short a) {
@ -4689,7 +4660,7 @@ public class Short64VectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, Short64VectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "shortUnaryOpProvider")

View File

@ -72,6 +72,14 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max);
static void assertArraysStrictlyEquals(short[] r, short[] a) {
for (int i = 0; i < a.length; i++) {
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
}
}
interface FUnOp {
short apply(short a);
}
@ -236,25 +244,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
}
}
static void assertInsertArraysEquals(short[] r, short[] a, short element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals(short[] r, short[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -709,21 +698,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
interface FBinArrayOp {
short apply(short[] a, int b);
}
static void assertArraysEquals(short[] r, short[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
short[] apply(short[] a, int ix, int[] b, int iy);
}
@ -1207,10 +1181,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
}
}
static short get(short[] a, int i) {
return (short) a[i];
}
static final IntFunction<short[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new short[length];
@ -3744,22 +3714,23 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
assertReductionBoolArraysEquals(r, mask, ShortMaxVectorTests::allTrue);
}
@Test(dataProvider = "shortUnaryOpProvider")
static void withShortMaxVectorTests(IntFunction<short []> fa) {
@Test(dataProvider = "shortBinaryOpProvider")
static void withShortMaxVectorTests(IntFunction<short []> fa, IntFunction<short []> fb) {
short[] a = fa.apply(SPECIES.length());
short[] b = fb.apply(SPECIES.length());
short[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
ShortVector av = ShortVector.fromArray(SPECIES, a, i);
av.withLane((j++ & (SPECIES.length()-1)), (short)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) & (SPECIES.length() - 1);
}
}
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (short)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}
static boolean testIS_DEFAULT(short a) {
@ -4694,7 +4665,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
}
}
assertArraysEquals(r, a, ShortMaxVectorTests::get);
assertArraysStrictlyEquals(r, a);
}
@Test(dataProvider = "shortUnaryOpProvider")

View File

@ -1,10 +1,13 @@
$type$[] a = fa.apply(SPECIES.length());
$type$[] b = fb.apply(SPECIES.length());
$type$[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
$abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i);
av.withLane((j++ \& (SPECIES.length()-1)), ($type$)(65535+i)).intoArray(r, i);
av.withLane(j, b[i + j]).intoArray(r, i);
a[i + j] = b[i + j];
j = (j + 1) \& (SPECIES.length() - 1);
}
}

View File

@ -2,5 +2,5 @@
@Test(dataProvider = "$type$UnaryOpProvider")
static void get$vectorteststype$(IntFunction<$type$[]> fa) {
[[KERNEL]]
assertArraysEquals(r, a, $vectorteststype$::get);
assertArraysStrictlyEquals(r, a);
}

View File

@ -1,9 +1,7 @@
@Test(dataProvider = "$type$UnaryOpProvider")
static void with$vectorteststype$(IntFunction<$type$ []> fa) {
@Test(dataProvider = "$type$BinaryOpProvider")
static void with$vectorteststype$(IntFunction<$type$ []> fa, IntFunction<$type$ []> fb) {
[[KERNEL]]
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, ($type$)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
assertArraysStrictlyEquals(r, a);
}

View File

@ -105,6 +105,26 @@ public class $vectorteststype$ extends AbstractVectorTest {
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / $bits$);
static void assertArraysStrictlyEquals($type$[] r, $type$[] a) {
for (int i = 0; i < a.length; i++) {
#if[FP]
$bitstype$ ir = $Wideboxtype$.$type$ToRaw$Bitstype$Bits(r[i]);
$bitstype$ ia = $Wideboxtype$.$type$ToRaw$Bitstype$Bits(a[i]);
if (ir != ia) {
#if[Float]
Assert.fail(String.format("at index #%d, expected = %08X, actual = %08X", i, ia, ir));
#else[Float]
Assert.fail(String.format("at index #%d, expected = %016X, actual = %016X", i, ia, ir));
#end[Float]
}
#else[FP]
if (r[i] != a[i]) {
Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
}
#end[FP]
}
}
interface FUnOp {
$type$ apply($type$ a);
}
@ -314,25 +334,6 @@ relativeError));
}
}
static void assertInsertArraysEquals($type$[] r, $type$[] a, $type$ element, int index, int start, int end) {
int i = start;
try {
for (; i < end; i += 1) {
if(i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element);
} else {
Assert.assertEquals(r[i], a[i]);
}
}
} catch (AssertionError e) {
if (i%SPECIES.length() == index) {
Assert.assertEquals(r[i], element, "at index #" + i);
} else {
Assert.assertEquals(r[i], a[i], "at index #" + i);
}
}
}
static void assertRearrangeArraysEquals($type$[] r, $type$[] a, int[] order, int vector_len) {
int i = 0, j = 0;
try {
@ -863,21 +864,6 @@ relativeError));
}
#end[FP]
interface FBinArrayOp {
$type$ apply($type$[] a, int b);
}
static void assertArraysEquals($type$[] r, $type$[] a, FBinArrayOp f) {
int i = 0;
try {
for (; i < a.length; i++) {
Assert.assertEquals(r[i], f.apply(a, i));
}
} catch (AssertionError e) {
Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
}
}
interface FGatherScatterOp {
$type$[] apply($type$[] a, int ix, int[] b, int iy);
}
@ -1472,22 +1458,20 @@ relativeError));
static $type$ cornerCaseValue(int i) {
#if[FP]
switch(i % 7) {
case 0:
return $Wideboxtype$.MAX_VALUE;
case 1:
return $Wideboxtype$.MIN_VALUE;
case 2:
return $Wideboxtype$.NEGATIVE_INFINITY;
case 3:
return $Wideboxtype$.POSITIVE_INFINITY;
case 4:
return $Wideboxtype$.NaN;
case 5:
return ($type$)0.0;
default:
return ($type$)-0.0;
}
return switch(i % 8) {
case 0 -> $Wideboxtype$.MAX_VALUE;
case 1 -> $Wideboxtype$.MIN_VALUE;
case 2 -> $Wideboxtype$.NEGATIVE_INFINITY;
case 3 -> $Wideboxtype$.POSITIVE_INFINITY;
case 4 -> $Wideboxtype$.NaN;
#if[Float]
case 5 -> Float.intBitsToFloat(0x7F812345);
#else[Float]
case 5 -> Double.longBitsToDouble(0x7FF123456789ABCDL);
#end[Float]
case 6 -> ($type$)0.0;
default -> ($type$)-0.0;
};
#else[FP]
switch(i % 5) {
case 0:
@ -1504,10 +1488,6 @@ relativeError));
#end[FP]
}
static $type$ get($type$[] a, int i) {
return ($type$) a[i];
}
static final IntFunction<$type$[]> fr = (vl) -> {
int length = BUFFER_REPS * vl;
return new $type$[length];