8310308: IR Framework: check for type and size of vector nodes

Reviewed-by: chagedorn, thartmann
This commit is contained in:
Emanuel Peter
2023-08-15 10:08:51 +00:00
parent dff99f7f3d
commit a02d65efcc
70 changed files with 3498 additions and 2068 deletions

View File

@@ -61,7 +61,7 @@ public class TestMinMaxSubword {
// as Java APIs for Math.min/max do not support integer subword types and superword
// should not generate vectorized Min/Max nodes for them.
@Test
@IR(failOn = {IRNode.MIN_V})
@IR(failOn = {IRNode.MIN_VI, IRNode.MIN_VF, IRNode.MIN_VD})
public static void testMinShort() {
for (int i = 0; i < LENGTH; i++) {
sb[i] = (short) Math.min(sa[i], val);
@@ -77,7 +77,7 @@ public class TestMinMaxSubword {
}
@Test
@IR(failOn = {IRNode.MAX_V})
@IR(failOn = {IRNode.MAX_VI, IRNode.MAX_VF, IRNode.MAX_VD})
public static void testMaxShort() {
for (int i = 0; i < LENGTH; i++) {
sb[i] = (short) Math.max(sa[i], val);
@@ -92,7 +92,7 @@ public class TestMinMaxSubword {
}
@Test
@IR(failOn = {IRNode.MIN_V})
@IR(failOn = {IRNode.MIN_VI, IRNode.MIN_VF, IRNode.MIN_VD})
public static void testMinByte() {
for (int i = 0; i < LENGTH; i++) {
bb[i] = (byte) Math.min(ba[i], val);
@@ -108,7 +108,7 @@ public class TestMinMaxSubword {
}
@Test
@IR(failOn = {IRNode.MAX_V})
@IR(failOn = {IRNode.MAX_VI, IRNode.MAX_VF, IRNode.MAX_VD})
public static void testMaxByte() {
for (int i = 0; i < LENGTH; i++) {
bb[i] = (byte) Math.max(ba[i], val);

View File

@@ -46,7 +46,7 @@ public class TestAutoVecCountingDownLoop {
@Test
@IR(counts = {IRNode.LOAD_VECTOR, " >0 "})
@IR(counts = {IRNode.LOAD_VECTOR_I, " >0 "})
@IR(counts = {IRNode.STORE_VECTOR, " >0 "})
private static void testCountingDown(int[] a, int[] b) {
for (int i = 2000; i > 0; i--) {

View File

@@ -48,9 +48,12 @@ public class TestAutoVectorization2DArray {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, " >0 " })
@IR(counts = { IRNode.ADD_VD, " >0 " })
@IR(counts = { IRNode.STORE_VECTOR, " >0 " })
// Given small iteration count, the unrolling factor is not very predictable,
// hence it is difficult to exactly predict the vector size. But let's at least
// check that there is some vectorization of any size.
@IR(counts = { IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE_ANY, " >0 " })
@IR(counts = { IRNode.ADD_VD, IRNode.VECTOR_SIZE_ANY, " >0 " })
@IR(counts = { IRNode.STORE_VECTOR, " >0 " })
private static void testDouble(double[][] a , double[][] b, double[][] c) {
for(int i = 0; i < a.length; i++) {
for (int j = 0; j < a[0].length; j++) {

View File

@@ -53,7 +53,7 @@ public class TestDisableAutoVectOpcodes {
}
@Test
@IR(failOn = {IRNode.VECTOR_CAST_D2X})
@IR(failOn = {IRNode.VECTOR_CAST_D2I})
private static void testConvD2I() {
for(int i = 0; i < SIZE; i++) {
inta[i] = (int) (doublea[i]);
@@ -61,7 +61,7 @@ public class TestDisableAutoVectOpcodes {
}
@Test
@IR(failOn = {IRNode.VECTOR_CAST_L2X})
@IR(failOn = {IRNode.VECTOR_CAST_L2F})
private static void testConvL2F() {
for(int i = 0; i < SIZE; i++) {
floata[i] = (float) (longa[i]);

View File

@@ -203,7 +203,10 @@ public class TestVectorConditionalMove {
// Compare 2 values, and pick one of them
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveVFGT(float[] a, float[] b, float[] c) {
for (int i = 0; i < a.length; i++) {
@@ -212,7 +215,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveVFGTSwap(float[] a, float[] b, float[] c) {
for (int i = 0; i < a.length; i++) {
@@ -221,7 +227,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveVFLT(float[] a, float[] b, float[] c) {
for (int i = 0; i < a.length; i++) {
@@ -230,7 +239,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveVFLTSwap(float[] a, float[] b, float[] c) {
for (int i = 0; i < a.length; i++) {
@@ -239,7 +251,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveVFEQ(float[] a, float[] b, float[] c) {
for (int i = 0; i < a.length; i++) {
@@ -248,7 +263,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
IRNode.VECTOR_MASK_CMP_D, ">0",
IRNode.VECTOR_BLEND_D, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveVDLE(double[] a, double[] b, double[] c) {
for (int i = 0; i < a.length; i++) {
@@ -257,7 +275,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
IRNode.VECTOR_MASK_CMP_D, ">0",
IRNode.VECTOR_BLEND_D, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveVDLESwap(double[] a, double[] b, double[] c) {
for (int i = 0; i < a.length; i++) {
@@ -266,7 +287,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
IRNode.VECTOR_MASK_CMP_D, ">0",
IRNode.VECTOR_BLEND_D, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveVDGE(double[] a, double[] b, double[] c) {
for (int i = 0; i < a.length; i++) {
@@ -275,7 +299,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
IRNode.VECTOR_MASK_CMP_D, ">0",
IRNode.VECTOR_BLEND_D, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveVDGESwap(double[] a, double[] b, double[] c) {
for (int i = 0; i < a.length; i++) {
@@ -284,7 +311,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
IRNode.VECTOR_MASK_CMP_D, ">0",
IRNode.VECTOR_BLEND_D, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveVDNE(double[] a, double[] b, double[] c) {
for (int i = 0; i < a.length; i++) {
@@ -294,7 +324,10 @@ public class TestVectorConditionalMove {
// Extensions: compare 2 values, and pick from 2 consts
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveFGTforFConst(float[] a, float[] b, float[] c) {
for (int i = 0; i < a.length; i++) {
@@ -303,7 +336,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveFGEforFConst(float[] a, float[] b, float[] c) {
for (int i = 0; i < a.length; i++) {
@@ -312,7 +348,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveFLTforFConst(float[] a, float[] b, float[] c) {
for (int i = 0; i < a.length; i++) {
@@ -321,7 +360,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveFLEforFConst(float[] a, float[] b, float[] c) {
for (int i = 0; i < a.length; i++) {
@@ -330,7 +372,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveFEQforFConst(float[] a, float[] b, float[] c) {
for (int i = 0; i < a.length; i++) {
@@ -339,7 +384,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveFNEQforFConst(float[] a, float[] b, float[] c) {
for (int i = 0; i < a.length; i++) {
@@ -348,7 +396,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
IRNode.VECTOR_MASK_CMP_D, ">0",
IRNode.VECTOR_BLEND_D, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveDGTforDConst(double[] a, double[] b, double[] c) {
for (int i = 0; i < a.length; i++) {
@@ -357,7 +408,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
IRNode.VECTOR_MASK_CMP_D, ">0",
IRNode.VECTOR_BLEND_D, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveDGEforDConst(double[] a, double[] b, double[] c) {
for (int i = 0; i < a.length; i++) {
@@ -366,7 +420,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
IRNode.VECTOR_MASK_CMP_D, ">0",
IRNode.VECTOR_BLEND_D, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveDLTforDConst(double[] a, double[] b, double[] c) {
for (int i = 0; i < a.length; i++) {
@@ -375,7 +432,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
IRNode.VECTOR_MASK_CMP_D, ">0",
IRNode.VECTOR_BLEND_D, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveDLEforDConst(double[] a, double[] b, double[] c) {
for (int i = 0; i < a.length; i++) {
@@ -384,7 +444,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
IRNode.VECTOR_MASK_CMP_D, ">0",
IRNode.VECTOR_BLEND_D, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveDEQforDConst(double[] a, double[] b, double[] c) {
for (int i = 0; i < a.length; i++) {
@@ -393,7 +456,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
IRNode.VECTOR_MASK_CMP_D, ">0",
IRNode.VECTOR_BLEND_D, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveDNEQforDConst(double[] a, double[] b, double[] c) {
for (int i = 0; i < a.length; i++) {
@@ -408,7 +474,7 @@ public class TestVectorConditionalMove {
// compilation does not know that).
// So far, vectorization only works for CMoveF/D, with same data-width comparison (F/I for F, D/L for D).
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveIGTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
for (int i = 0; i < a.length; i++) {
int cc = c[i];
@@ -419,7 +485,7 @@ public class TestVectorConditionalMove {
}
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveIGTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
for (int i = 0; i < a.length; i++) {
long cc = c[i];
@@ -430,7 +496,11 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveIGTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
for (int i = 0; i < a.length; i++) {
@@ -442,7 +512,7 @@ public class TestVectorConditionalMove {
}
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
for (int i = 0; i < a.length; i++) {
double cc = c[i];
@@ -453,7 +523,7 @@ public class TestVectorConditionalMove {
}
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveLGTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
for (int i = 0; i < a.length; i++) {
int cc = c[i];
@@ -464,7 +534,7 @@ public class TestVectorConditionalMove {
}
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveLGTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
for (int i = 0; i < a.length; i++) {
long cc = c[i];
@@ -475,7 +545,7 @@ public class TestVectorConditionalMove {
}
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveLGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
for (int i = 0; i < a.length; i++) {
float cc = c[i];
@@ -486,7 +556,11 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
// Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
private static void testCMoveLGTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
@@ -499,7 +573,7 @@ public class TestVectorConditionalMove {
}
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveFGTforI(float[] a, float[] b, int[] c, int[] d, int[] r, int[] r2) {
for (int i = 0; i < a.length; i++) {
int cc = c[i];
@@ -510,7 +584,7 @@ public class TestVectorConditionalMove {
}
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveFGTforL(float[] a, float[] b, long[] c, long[] d, long[] r, long[] r2) {
for (int i = 0; i < a.length; i++) {
long cc = c[i];
@@ -521,7 +595,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveFGTforF(float[] a, float[] b, float[] c, float[] d, float[] r, float[] r2) {
for (int i = 0; i < a.length; i++) {
@@ -533,7 +610,7 @@ public class TestVectorConditionalMove {
}
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveFGTforD(float[] a, float[] b, double[] c, double[] d, double[] r, double[] r2) {
for (int i = 0; i < a.length; i++) {
double cc = c[i];
@@ -544,7 +621,7 @@ public class TestVectorConditionalMove {
}
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveDGTforI(double[] a, double[] b, int[] c, int[] d, int[] r, int[] r2) {
for (int i = 0; i < a.length; i++) {
int cc = c[i];
@@ -555,7 +632,7 @@ public class TestVectorConditionalMove {
}
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveDGTforL(double[] a, double[] b, long[] c, long[] d, long[] r, long[] r2) {
for (int i = 0; i < a.length; i++) {
long cc = c[i];
@@ -566,7 +643,7 @@ public class TestVectorConditionalMove {
}
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveDGTforF(double[] a, double[] b, float[] c, float[] d, float[] r, float[] r2) {
for (int i = 0; i < a.length; i++) {
float cc = c[i];
@@ -577,7 +654,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
IRNode.VECTOR_MASK_CMP_D, ">0",
IRNode.VECTOR_BLEND_D, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveDGTforD(double[] a, double[] b, double[] c, double[] d, double[] r, double[] r2) {
for (int i = 0; i < a.length; i++) {
@@ -590,7 +670,10 @@ public class TestVectorConditionalMove {
// Use some constants in the comparison
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveFGTforFCmpCon1(float a, float[] b, float[] c, float[] d, float[] r, float[] r2) {
for (int i = 0; i < b.length; i++) {
@@ -602,7 +685,10 @@ public class TestVectorConditionalMove {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_MASK_CMP, ">0", IRNode.VECTOR_BLEND, ">0", IRNode.STORE_VECTOR, ">0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
IRNode.VECTOR_MASK_CMP_F, ">0",
IRNode.VECTOR_BLEND_F, ">0",
IRNode.STORE_VECTOR, ">0"},
applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
private static void testCMoveFGTforFCmpCon2(float[] a, float b, float[] c, float[] d, float[] r, float[] r2) {
for (int i = 0; i < a.length; i++) {
@@ -615,7 +701,7 @@ public class TestVectorConditionalMove {
// A case that is currently not supported and is not expected to vectorize
@Test
@IR(failOn = {IRNode.VECTOR_MASK_CMP, IRNode.VECTOR_BLEND})
@IR(failOn = {IRNode.STORE_VECTOR})
private static void testCMoveVDUnsupported() {
double[] doublec = new double[SIZE];
int seed = 1001;

View File

@@ -150,7 +150,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testByteLong1(byte[] dest, long[] src) {
for (int i = 0; i < src.length; i++) {
UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i, src[i]);
@@ -163,7 +163,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testByteLong2(byte[] dest, long[] src) {
for (int i = 1; i < src.length; i++) {
UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i - 1), src[i]);
@@ -176,7 +176,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testByteLong3(byte[] dest, long[] src) {
for (int i = 0; i < src.length - 1; i++) {
UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i + 1), src[i]);
@@ -189,7 +189,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testByteLong4(byte[] dest, long[] src, int start, int stop) {
for (int i = start; i < stop; i++) {
UNSAFE.putLongUnaligned(dest, 8 * i + baseOffset, src[i]);
@@ -203,7 +203,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testByteLong5(byte[] dest, long[] src, int start, int stop) {
for (int i = start; i < stop; i++) {
UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i + baseOffset), src[i]);
@@ -217,7 +217,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testByteByte1(byte[] dest, byte[] src) {
for (int i = 0; i < src.length / 8; i++) {
UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i, UNSAFE.getLongUnaligned(src, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i));
@@ -229,9 +229,8 @@ public class TestVectorizationMismatchedAccess {
runAndVerify2(() -> testByteByte1(byteArray, byteArray), 0);
}
// It would be legal to vectorize this one but it's not currently
@Test
//@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testByteByte2(byte[] dest, byte[] src) {
for (int i = 1; i < src.length / 8; i++) {
UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i - 1), UNSAFE.getLongUnaligned(src, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i));
@@ -244,7 +243,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(failOn = { IRNode.LOAD_VECTOR, IRNode.STORE_VECTOR })
@IR(failOn = { IRNode.LOAD_VECTOR_L, IRNode.STORE_VECTOR })
public static void testByteByte3(byte[] dest, byte[] src) {
for (int i = 0; i < src.length / 8 - 1; i++) {
UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i + 1), UNSAFE.getLongUnaligned(src, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i));
@@ -257,7 +256,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(failOn = { IRNode.LOAD_VECTOR, IRNode.STORE_VECTOR })
@IR(failOn = { IRNode.LOAD_VECTOR_L, IRNode.STORE_VECTOR })
public static void testByteByte4(byte[] dest, byte[] src, int start, int stop) {
for (int i = start; i < stop; i++) {
UNSAFE.putLongUnaligned(dest, 8 * i + baseOffset, UNSAFE.getLongUnaligned(src, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i));
@@ -271,7 +270,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(failOn = { IRNode.LOAD_VECTOR, IRNode.STORE_VECTOR })
@IR(failOn = { IRNode.LOAD_VECTOR_L, IRNode.STORE_VECTOR })
public static void testByteByte5(byte[] dest, byte[] src, int start, int stop) {
for (int i = start; i < stop; i++) {
UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i + baseOffset), UNSAFE.getLongUnaligned(src, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i));
@@ -285,7 +284,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testOffHeapLong1(long dest, long[] src) {
for (int i = 0; i < src.length; i++) {
UNSAFE.putLongUnaligned(null, dest + 8 * i, src[i]);
@@ -298,7 +297,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testOffHeapLong2(long dest, long[] src) {
for (int i = 1; i < src.length; i++) {
UNSAFE.putLongUnaligned(null, dest + 8 * (i - 1), src[i]);
@@ -311,7 +310,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testOffHeapLong3(long dest, long[] src) {
for (int i = 0; i < src.length - 1; i++) {
UNSAFE.putLongUnaligned(null, dest + 8 * (i + 1), src[i]);
@@ -324,7 +323,7 @@ public class TestVectorizationMismatchedAccess {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testOffHeapLong4(long dest, long[] src, int start, int stop) {
for (int i = start; i < stop; i++) {
UNSAFE.putLongUnaligned(null, dest + 8 * i + baseOffset, src[i]);

View File

@@ -60,7 +60,7 @@ public class TestVectorizationMultiInvar {
static long baseOffset = 0;
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testByteLong1(byte[] dest, long[] src) {
for (int i = 0; i < src.length; i++) {
long j = Objects.checkIndex(i * 8, (long)(src.length * 8));
@@ -75,7 +75,7 @@ public class TestVectorizationMultiInvar {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_B, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testLoopNest1(byte[] dest, byte[] src,
long start1, long stop1,
long start2, long stop2,
@@ -106,7 +106,7 @@ public class TestVectorizationMultiInvar {
}
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_I, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void testLoopNest2(int[] dest, int[] src,
long start1, long stop1,
long start2, long stop2,

View File

@@ -51,7 +51,7 @@ public class TestVectorizationNotRun {
static long[] longArray = new long[size];
@Test
@IR(counts = { IRNode.LOAD_VECTOR, ">=1", IRNode.STORE_VECTOR, ">=1" })
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
public static void test(byte[] dest, long[] src) {
for (int i = 0; i < src.length; i++) {
if ((i < 0) || (8 > sizeBytes - i)) {

View File

@@ -55,8 +55,9 @@ public class TestVectorizeTypeConversion {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0",
IRNode.VECTOR_CAST_I2X, ">0",
// Mixing types of different sizes has the effect that some vectors are shorter than the type allows.
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0",
IRNode.VECTOR_CAST_I2D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0",
IRNode.STORE_VECTOR, ">0"},
// The vectorization of some conversions may fail when `+AlignVector`.
// We can remove the condition after JDK-8303827.
@@ -68,9 +69,11 @@ public class TestVectorizeTypeConversion {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0",
IRNode.VECTOR_CAST_I2X, ">0",
IRNode.VECTOR_CAST_L2X, ">0",
// Mixing types of different sizes has the effect that some vectors are shorter than the type allows.
@IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_int, max_long)", ">0",
IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_long)", ">0",
IRNode.VECTOR_CAST_I2L, IRNode.VECTOR_SIZE + "min(max_int, max_long)", ">0",
IRNode.VECTOR_CAST_L2I, IRNode.VECTOR_SIZE + "min(max_int, max_long)", ">0",
IRNode.STORE_VECTOR, ">0"})
private static void testConvI2L(int[] d1, int d2[], long[] a1, long[] a2) {
for(int i = 0; i < d1.length; i++) {
@@ -80,9 +83,11 @@ public class TestVectorizeTypeConversion {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0",
IRNode.VECTOR_CAST_D2X, ">0",
IRNode.VECTOR_CAST_F2X, ">0",
// Mixing types of different sizes has the effect that some vectors are shorter than the type allows.
@IR(counts = {IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_float, max_double)", ">0",
IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_float, max_double)", ">0",
IRNode.VECTOR_CAST_D2F, IRNode.VECTOR_SIZE + "min(max_float, max_double)", ">0",
IRNode.VECTOR_CAST_F2D, IRNode.VECTOR_SIZE + "min(max_float, max_double)", ">0",
IRNode.STORE_VECTOR, ">0"})
private static void testConvF2D(double[] d1, double[] d2, float[] a1, float[] a2) {
for(int i = 0; i < d1.length; i++) {

View File

@@ -70,7 +70,7 @@ public class TestVectorizeURShiftSubword {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.RSHIFT_VB, ">0", IRNode.STORE_VECTOR, ">0"})
@IR(counts = {IRNode.LOAD_VECTOR_B, ">0", IRNode.RSHIFT_VB, ">0", IRNode.STORE_VECTOR, ">0"})
public void testByte0() {
for(int i = 0; i < NUM; i++) {
byteb[i] = (byte) (bytea[i] >>> 3);
@@ -78,7 +78,7 @@ public class TestVectorizeURShiftSubword {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.RSHIFT_VB, ">0", IRNode.STORE_VECTOR, ">0"})
@IR(counts = {IRNode.LOAD_VECTOR_B, ">0", IRNode.RSHIFT_VB, ">0", IRNode.STORE_VECTOR, ">0"})
public void testByte1() {
for(int i = 0; i < NUM; i++) {
byteb[i] = (byte) (bytea[i] >>> 24);
@@ -86,7 +86,7 @@ public class TestVectorizeURShiftSubword {
}
@Test
@IR(failOn = {IRNode.LOAD_VECTOR, IRNode.RSHIFT_VB, IRNode.STORE_VECTOR})
@IR(failOn = {IRNode.LOAD_VECTOR_B, IRNode.RSHIFT_VB, IRNode.STORE_VECTOR})
public void testByte2() {
for(int i = 0; i < NUM; i++) {
byteb[i] = (byte) (bytea[i] >>> 25);
@@ -94,7 +94,7 @@ public class TestVectorizeURShiftSubword {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.RSHIFT_VS, ">0", IRNode.STORE_VECTOR, ">0"})
@IR(counts = {IRNode.LOAD_VECTOR_S, ">0", IRNode.RSHIFT_VS, ">0", IRNode.STORE_VECTOR, ">0"})
public void testShort0() {
for(int i = 0; i < NUM; i++) {
shortb[i] = (short) (shorta[i] >>> 10);
@@ -102,7 +102,7 @@ public class TestVectorizeURShiftSubword {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.RSHIFT_VS, ">0", IRNode.STORE_VECTOR, ">0"})
@IR(counts = {IRNode.LOAD_VECTOR_S, ">0", IRNode.RSHIFT_VS, ">0", IRNode.STORE_VECTOR, ">0"})
public void testShort1() {
for(int i = 0; i < NUM; i++) {
shortb[i] = (short) (shorta[i] >>> 16);
@@ -110,7 +110,7 @@ public class TestVectorizeURShiftSubword {
}
@Test
@IR(failOn = {IRNode.LOAD_VECTOR, IRNode.RSHIFT_VS, IRNode.STORE_VECTOR})
@IR(failOn = {IRNode.LOAD_VECTOR_S, IRNode.RSHIFT_VS, IRNode.STORE_VECTOR})
public void testShort2() {
for(int i = 0; i < NUM; i++) {
shortb[i] = (short) (shorta[i] >>> 17);

File diff suppressed because it is too large Load Diff

View File

@@ -71,6 +71,26 @@ public void test() {
}
```
#### Vector IR Nodes
For vector nodes, we not only check for the presence of the node, but also its type and size (number of elements in the vector). Every node has an associated type, for example `IRNode.LOAD_VECTOR_I` has type `int` and `IRNode.LOAD_VECTOR_F` has type `float`. The size can be explicitly specified as an additional argument. For example:
```
@IR(counts = {IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE_16, "> 0"},
applyIf = {"MaxVectorSize", "=64"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
static float[] test() {
float[] a = new float[1024*8];
for (int i = 0; i < a.length; i++) {
a[i]++;
}
return a;
}
```
However, the size does not have to be specified. In most cases, one either wants to have vectorization at the maximal possible vector width, or no vectorization at all. Hence, for lower bound counts ('>' or '>=') and equal count comparisons with strictly positive count (e.g. "=2") the default size is `IRNode.VECTOR_SIZE_MAX`, and for upper bound counts ('<' or '<=' or '=0' or failOn) the default is `IRNode.VECTOR_SIZE_ANY`. On machines with 'canTrustVectorSize == false' (default Cascade Lake) the maximal vector width is not predictable currently (32 byte for SuperWord and 64 byte for VectorAPI). Hence, on such a machine we have to automatically weaken the IR rules. All lower bound counts are performed checking with `IRNode.VECTOR_SIZE_ANY`. Upper bound counts with no user specified size are performed with `IRNode.VECTOR_SIZE_ANY` but upper bound counts with a user specified size are not checked at all. Equal count comparisons with strictly positive count are also not checked at all. Details and reasoning can be found in [RawIRNode](./driver/irmatching/irrule/checkattribute/parsing/RawIRNode.java).
More examples can be found in [IRExample](../../../testlibrary_tests/ir_framework/examples/IRExample.java). You can also find many examples in the Vector API and SuperWord tests, when searching for `IRNode.VECTOR_SIZE` or `IRNode.LOAD_VECTOR`.
#### User-defined Regexes
The user can also directly specify user-defined regexes in combination with a required compile phase (there is no default compile phase known by the framework for custom regexes). If such a user-defined regex represents a not yet supported C2 IR node, it is highly encouraged to directly add a new IR node placeholder string definition to [IRNode](./IRNode.java) for it instead together with a static regex mapping block.

View File

@@ -0,0 +1,35 @@
/*
* Copyright (c) 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package compiler.lib.ir_framework.driver;
import compiler.lib.ir_framework.driver.irmatching.irrule.constraint.Constraint;
/**
* Exception used to signal that a {@link Constraint} should always succeed.
*/
public class SuccessOnlyConstraintException extends RuntimeException {
public SuccessOnlyConstraintException(String message) {
super("Unhandled SuccessOnlyConstraintException, should have created a Constraint that always succeeds:" + System.lineSeparator() + message);
}
}

View File

@@ -31,6 +31,7 @@ import compiler.lib.ir_framework.driver.irmatching.MatchResult;
import compiler.lib.ir_framework.driver.irmatching.Matchable;
import compiler.lib.ir_framework.driver.irmatching.MatchableMatcher;
import compiler.lib.ir_framework.driver.irmatching.irrule.IRRule;
import compiler.lib.ir_framework.driver.irmatching.parser.VMInfo;
import compiler.lib.ir_framework.shared.TestFormat;
import compiler.lib.ir_framework.shared.TestFormatException;
@@ -50,16 +51,16 @@ public class IRMethod implements IRMethodMatchable {
private final Method method;
private final MatchableMatcher matcher;
public IRMethod(Method method, int[] ruleIds, IR[] irAnnos, Compilation compilation) {
public IRMethod(Method method, int[] ruleIds, IR[] irAnnos, Compilation compilation, VMInfo vmInfo) {
this.method = method;
this.matcher = new MatchableMatcher(createIRRules(method, ruleIds, irAnnos, compilation));
this.matcher = new MatchableMatcher(createIRRules(method, ruleIds, irAnnos, compilation, vmInfo));
}
private List<Matchable> createIRRules(Method method, int[] ruleIds, IR[] irAnnos, Compilation compilation) {
private List<Matchable> createIRRules(Method method, int[] ruleIds, IR[] irAnnos, Compilation compilation, VMInfo vmInfo) {
List<Matchable> irRules = new ArrayList<>();
for (int ruleId : ruleIds) {
try {
irRules.add(new IRRule(ruleId, irAnnos[ruleId - 1], compilation));
irRules.add(new IRRule(ruleId, irAnnos[ruleId - 1], compilation, vmInfo));
} catch (TestFormatException e) {
String postfixErrorMsg = " for IR rule " + ruleId + " at " + method + ".";
TestFormat.failNoThrow(e.getMessage() + postfixErrorMsg);

View File

@@ -31,6 +31,7 @@ import compiler.lib.ir_framework.driver.irmatching.Matchable;
import compiler.lib.ir_framework.driver.irmatching.MatchableMatcher;
import compiler.lib.ir_framework.driver.irmatching.irrule.phase.CompilePhaseIRRule;
import compiler.lib.ir_framework.driver.irmatching.irrule.phase.CompilePhaseIRRuleBuilder;
import compiler.lib.ir_framework.driver.irmatching.parser.VMInfo;
/**
* This class represents a generic {@link IR @IR} rule of an IR method. It contains a list of compile phase specific
@@ -44,10 +45,10 @@ public class IRRule implements Matchable {
private final IR irAnno;
private final MatchableMatcher matcher;
public IRRule(int ruleId, IR irAnno, Compilation compilation) {
public IRRule(int ruleId, IR irAnno, Compilation compilation, VMInfo vmInfo) {
this.ruleId = ruleId;
this.irAnno = irAnno;
this.matcher = new MatchableMatcher(new CompilePhaseIRRuleBuilder(irAnno, compilation).build());
this.matcher = new MatchableMatcher(new CompilePhaseIRRuleBuilder(irAnno, compilation).build(vmInfo));
}
@Override

View File

@@ -60,16 +60,34 @@ public class CheckAttributeReader<R> {
public final CheckAttributeString readUserPostfix(String node) {
if (IRNode.isCompositeIRNode(node)) {
String irNode = IRNode.getIRNodeAccessString(node);
int nextIndex = iterator.nextIndex();
TestFormat.checkNoReport(iterator.hasNext(), "Must provide additional value at index " +
nextIndex + " right after " + irNode);
CheckAttributeString userPostfix = new CheckAttributeString(iterator.next());
TestFormat.checkNoReport(userPostfix.isValidUserPostfix(), "Provided empty string for composite node " +
irNode + " at index " + nextIndex);
return userPostfix;
return readUserPostfixForCompositeIRNode(node);
} else if (IRNode.isVectorIRNode(node)) {
return readUserPostfixForVectorIRNode(node);
} else {
return CheckAttributeString.invalid();
}
}
private final CheckAttributeString readUserPostfixForCompositeIRNode(String node) {
String irNode = IRNode.getIRNodeAccessString(node);
int nextIndex = iterator.nextIndex();
TestFormat.checkNoReport(iterator.hasNext(), "Must provide additional value at index " +
nextIndex + " right after " + irNode);
CheckAttributeString userPostfix = new CheckAttributeString(iterator.next());
TestFormat.checkNoReport(userPostfix.isValidUserPostfix(), "Provided empty string for composite node " +
irNode + " at index " + nextIndex);
return userPostfix;
}
private final CheckAttributeString readUserPostfixForVectorIRNode(String node) {
if (iterator.hasNext()) {
String maybeVectorType = iterator.next();
if (IRNode.isVectorSize(maybeVectorType)) {
return new CheckAttributeString(maybeVectorType);
}
// If we do not find that pattern, then revert the iterator once
iterator.previous();
}
return CheckAttributeString.invalid();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, 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
@@ -25,6 +25,10 @@ package compiler.lib.ir_framework.driver.irmatching.irrule.checkattribute.parsin
import compiler.lib.ir_framework.CompilePhase;
import compiler.lib.ir_framework.IRNode;
import compiler.lib.ir_framework.shared.Comparison;
import compiler.lib.ir_framework.shared.TestFormat;
import compiler.lib.ir_framework.driver.irmatching.parser.VMInfo;
import compiler.lib.ir_framework.driver.SuccessOnlyConstraintException;
/**
* This class represents a "raw IR node" as read from a check attribute. It has a node part that either represents an
@@ -51,14 +55,85 @@ public class RawIRNode {
return IRNode.getDefaultPhase(node);
}
public String regex(CompilePhase compilePhase) {
public String regex(CompilePhase compilePhase, VMInfo vmInfo, Comparison.Bound bound) {
String nodeRegex = node;
if (IRNode.isIRNode(node)) {
nodeRegex = IRNode.getRegexForCompilePhase(node, compilePhase);
if (userPostfix.isValid()) {
if (IRNode.isVectorIRNode(node)) {
nodeRegex = regexForVectorIRNode(nodeRegex, vmInfo, bound);
} else if (userPostfix.isValid()) {
nodeRegex = nodeRegex.replaceAll(IRNode.IS_REPLACED, userPostfix.value());
}
}
return nodeRegex;
}
private String regexForVectorIRNode(String nodeRegex, VMInfo vmInfo, Comparison.Bound bound) {
String type = IRNode.getVectorNodeType(node);
TestFormat.checkNoReport(IRNode.getTypeSizeInBytes(type) > 0,
"Vector node's type must have valid type, got \"" + type + "\" for \"" + node + "\"");
String size = null;
if (userPostfix.isValid()) {
// Size is explicitly stated
String value = userPostfix.value();
TestFormat.checkNoReport(value.startsWith(IRNode.VECTOR_SIZE),
"Vector node's vector size must start with IRNode.VECTOR_SIZE, got: \"" + value + "\"");
size = value.substring(2);
if (!vmInfo.canTrustVectorSize()) {
// Parse it already just to get errors before we overwrite size
IRNode.parseVectorNodeSize(size, type, vmInfo);
}
}
// Set default values in some cases:
if (!userPostfix.isValid() || !vmInfo.canTrustVectorSize()) {
switch (bound) {
case LOWER -> {
// For lower bound we check for the maximal size by default. But if we cannot trust the
// vector size we at least check there are vectors of any size.
if (vmInfo.canTrustVectorSize()) {
// No size specified, so assume maximal size
size = IRNode.VECTOR_SIZE_TAG_MAX;
} else {
System.out.println("WARNING: you are on a system with \"canTrustVectorSize == false\" (default Cascade Lake).");
System.out.println(" The lower bound rule for \"" + node + "\" is now performed with");
System.out.println(" \"IRNode.VECTOR_SIZE_TAG_ANY\" instead of \"IRNode.VECTOR_SIZE_TAG_MAX\".");
size = IRNode.VECTOR_SIZE_TAG_ANY;
}
}
case UPPER -> {
if (userPostfix.isValid()) {
TestFormat.checkNoReport(!vmInfo.canTrustVectorSize(), "sanity");
// If we have a size specified but cannot trust the size, and must check an upper
// bound, this can be impossible to count correctly - if we have an incorrect size
// we may count either too many nodes. We just create an impossible regex which will
// always have count zero and make the upper bound rule pass.
System.out.println("WARNING: you are on a system with \"canTrustVectorSize == false\" (default Cascade Lake).");
System.out.println(" The upper bound rule for \"" + node + "\" cannot be checked.");
throw new SuccessOnlyConstraintException("upper bound with specified size");
} else {
// For upper bound we check for vectors of any size by default.
size = IRNode.VECTOR_SIZE_TAG_ANY;
}
}
case EQUAL -> {
if (vmInfo.canTrustVectorSize()) {
// No size specified, so assume maximal size
size = IRNode.VECTOR_SIZE_TAG_MAX;
} else {
// Equal comparison to a strictly positive number would lead us to an impossible
// situation: we might have to know the exact vector size or else we count too many
// or too few cases. We therefore skip such a constraint and treat it as success.
System.out.println("WARNING: you are on a system with \"canTrustVectorSize == false\" (default Cascade Lake).");
System.out.println(" The equal count comparison rule for \"" + node + "\" cannot be checked.");
throw new SuccessOnlyConstraintException("equal count comparison");
}
}
}
}
String sizeRegex = IRNode.parseVectorNodeSize(size, type, vmInfo);
return nodeRegex.replaceAll(IRNode.IS_REPLACED,
"vector[A-Za-z]\\\\[" + sizeRegex + "\\\\]:\\\\{" + type + "\\\\}");
}
}

View File

@@ -61,6 +61,12 @@ public class Constraint implements Matchable {
return new Constraint(new CountsConstraintCheck(nodeRegex, constraintId, comparison), nodeRegex, compilationOutput);
}
public static Constraint createSuccess() {
String nodeRegex = "impossible_regex";
String compilationOutput = ""; // empty
return new Constraint(new SuccessConstraintCheck(), nodeRegex, compilationOutput);
}
public String nodeRegex() {
return nodeRegex;
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (c) 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package compiler.lib.ir_framework.driver.irmatching.irrule.constraint;
import compiler.lib.ir_framework.driver.irmatching.MatchResult;
import java.util.List;
/**
* This class provides a check that always succeeds.
*
* @see Constraint
*/
class SuccessConstraintCheck implements ConstraintCheck {
@Override
public MatchResult check(List<String> matchedNodes) {
return SuccessResult.getInstance();
}
}

View File

@@ -27,6 +27,7 @@ import compiler.lib.ir_framework.CompilePhase;
import compiler.lib.ir_framework.IR;
import compiler.lib.ir_framework.IRNode;
import compiler.lib.ir_framework.driver.irmatching.irrule.constraint.Constraint;
import compiler.lib.ir_framework.driver.irmatching.parser.VMInfo;
/**
* Interface to represent a single raw constraint as found in the {@link IR @IR} annotation (i.e. {@link IRNode}
@@ -38,5 +39,5 @@ import compiler.lib.ir_framework.driver.irmatching.irrule.constraint.Constraint;
*/
public interface RawConstraint {
CompilePhase defaultCompilePhase();
Constraint parse(CompilePhase compilePhase, String compilationOutput);
Constraint parse(CompilePhase compilePhase, String compilationOutput, VMInfo vmInfo);
}

View File

@@ -26,10 +26,15 @@ package compiler.lib.ir_framework.driver.irmatching.irrule.constraint.raw;
import compiler.lib.ir_framework.CompilePhase;
import compiler.lib.ir_framework.IR;
import compiler.lib.ir_framework.IRNode;
import compiler.lib.ir_framework.TestFramework;
import compiler.lib.ir_framework.driver.irmatching.irrule.checkattribute.parsing.RawIRNode;
import compiler.lib.ir_framework.driver.irmatching.irrule.constraint.Constraint;
import compiler.lib.ir_framework.driver.irmatching.parser.VMInfo;
import compiler.lib.ir_framework.driver.SuccessOnlyConstraintException;
import compiler.lib.ir_framework.shared.Comparison;
import compiler.lib.ir_framework.shared.TestFormat;
import compiler.lib.ir_framework.shared.TestFormatException;
/**
* This class represents a raw constraint of a {@link IR#counts()} attribute.
@@ -52,9 +57,49 @@ public class RawCountsConstraint implements RawConstraint {
return rawIRNode.defaultCompilePhase();
}
private Comparison.Bound getComparisonBound() {
switch (comparison.getComparator()) {
case "<" -> {
TestFormat.checkNoReport(comparison.getGivenValue() > 0, "Node count comparison \"<" +
comparison.getGivenValue() + "\" is not allowed: always false.");
TestFormat.checkNoReport(comparison.getGivenValue() > 1, "Node count comparison \"<" +
comparison.getGivenValue() + "\" should be rewritten as \"=0\"");
return Comparison.Bound.UPPER;
}
case "<=" -> {
TestFormat.checkNoReport(comparison.getGivenValue() >= 0, "Node count comparison \"<=" +
comparison.getGivenValue() + "\" is not allowed: always false.");
TestFormat.checkNoReport(comparison.getGivenValue() >= 1, "Node count comparison \"<=" +
comparison.getGivenValue() + "\" should be rewritten as \"=0\"");
return Comparison.Bound.UPPER;
}
case "=" -> {
// "=0" is same as setting upper bound - just like for failOn. But if we compare equals a
// strictly positive number it is like setting both upper and lower bound (equal).
return comparison.getGivenValue() > 0 ? Comparison.Bound.EQUAL : Comparison.Bound.UPPER;
}
case ">" -> {
TestFormat.checkNoReport(comparison.getGivenValue() >= 0, "Node count comparison \">" +
comparison.getGivenValue() + "\" is useless, please only use positive numbers.");
return Comparison.Bound.LOWER;
}
case ">=" -> {
TestFormat.checkNoReport(comparison.getGivenValue() > 0, "Node count comparison \">=" +
comparison.getGivenValue() + "\" is useless, please only use strictly positive numbers with greater-equal.");
return Comparison.Bound.LOWER;
}
case "!=" -> throw new TestFormatException("Not-equal comparator not supported. Please rewrite the rule.");
default -> throw new TestFormatException("Comparator not handled: " + comparison.getComparator());
}
}
@Override
public Constraint parse(CompilePhase compilePhase, String compilationOutput) {
public Constraint parse(CompilePhase compilePhase, String compilationOutput, VMInfo vmInfo) {
TestFramework.check(compilePhase != CompilePhase.DEFAULT, "must not be default");
return Constraint.createCounts(rawIRNode.regex(compilePhase), constraintIndex, comparison, compilationOutput);
try {
return Constraint.createCounts(rawIRNode.regex(compilePhase, vmInfo, getComparisonBound()), constraintIndex, comparison, compilationOutput);
} catch (SuccessOnlyConstraintException e) {
return Constraint.createSuccess();
}
}
}

View File

@@ -25,9 +25,12 @@ package compiler.lib.ir_framework.driver.irmatching.irrule.constraint.raw;
import compiler.lib.ir_framework.CompilePhase;
import compiler.lib.ir_framework.IR;
import compiler.lib.ir_framework.IRNode;
import compiler.lib.ir_framework.TestFramework;
import compiler.lib.ir_framework.shared.Comparison;
import compiler.lib.ir_framework.driver.irmatching.irrule.checkattribute.parsing.RawIRNode;
import compiler.lib.ir_framework.driver.irmatching.irrule.constraint.Constraint;
import compiler.lib.ir_framework.driver.irmatching.parser.VMInfo;
/**
* This class represents a raw constraint of a {@link IR#failOn()} attribute.
@@ -49,9 +52,9 @@ public class RawFailOnConstraint implements RawConstraint {
}
@Override
public Constraint parse(CompilePhase compilePhase, String compilationOutput) {
public Constraint parse(CompilePhase compilePhase, String compilationOutput, VMInfo vmInfo) {
TestFramework.check(compilePhase != CompilePhase.DEFAULT, "must not be default");
return Constraint.createFailOn(rawIRNode.regex(compilePhase), constraintIndex, compilationOutput);
return Constraint.createFailOn(rawIRNode.regex(compilePhase, vmInfo, Comparison.Bound.UPPER), constraintIndex, compilationOutput);
}
}

View File

@@ -34,6 +34,7 @@ import compiler.lib.ir_framework.driver.irmatching.irrule.checkattribute.parsing
import compiler.lib.ir_framework.driver.irmatching.irrule.checkattribute.parsing.RawFailOn;
import compiler.lib.ir_framework.driver.irmatching.irrule.constraint.Constraint;
import compiler.lib.ir_framework.driver.irmatching.irrule.constraint.raw.RawConstraint;
import compiler.lib.ir_framework.driver.irmatching.parser.VMInfo;
import compiler.lib.ir_framework.shared.TestFormat;
import java.util.*;
@@ -60,24 +61,24 @@ public class CompilePhaseIRRuleBuilder {
this.rawCountsConstraints = new RawCounts(irAnno.counts()).createRawConstraints();
}
public SortedSet<CompilePhaseIRRuleMatchable> build() {
public SortedSet<CompilePhaseIRRuleMatchable> build(VMInfo vmInfo) {
CompilePhase[] compilePhases = irAnno.phase();
TestFormat.checkNoReport(new HashSet<>(List.of(compilePhases)).size() == compilePhases.length,
"Cannot specify a compile phase twice");
for (CompilePhase compilePhase : compilePhases) {
if (compilePhase == CompilePhase.DEFAULT) {
createCompilePhaseIRRulesForDefault();
createCompilePhaseIRRulesForDefault(vmInfo);
} else {
createCompilePhaseIRRule(compilePhase);
createCompilePhaseIRRule(compilePhase, vmInfo);
}
}
return compilePhaseIRRules;
}
private void createCompilePhaseIRRulesForDefault() {
private void createCompilePhaseIRRulesForDefault(VMInfo vmInfo) {
DefaultPhaseRawConstraintParser parser = new DefaultPhaseRawConstraintParser(compilation);
Map<CompilePhase, List<Matchable>> checkAttributesForCompilePhase =
parser.parse(rawFailOnConstraints, rawCountsConstraints);
parser.parse(rawFailOnConstraints, rawCountsConstraints, vmInfo);
checkAttributesForCompilePhase.forEach((compilePhase, constraints) -> {
if (compilation.hasOutput(compilePhase)) {
compilePhaseIRRules.add(new CompilePhaseIRRule(compilePhase, constraints,
@@ -88,9 +89,9 @@ public class CompilePhaseIRRuleBuilder {
});
}
private void createCompilePhaseIRRule(CompilePhase compilePhase) {
List<Constraint> failOnConstraints = parseRawConstraints(rawFailOnConstraints, compilePhase);
List<Constraint> countsConstraints = parseRawConstraints(rawCountsConstraints, compilePhase);
private void createCompilePhaseIRRule(CompilePhase compilePhase, VMInfo vmInfo) {
List<Constraint> failOnConstraints = parseRawConstraints(rawFailOnConstraints, compilePhase, vmInfo);
List<Constraint> countsConstraints = parseRawConstraints(rawCountsConstraints, compilePhase, vmInfo);
if (compilation.hasOutput(compilePhase)) {
createValidCompilePhaseIRRule(compilePhase, failOnConstraints, countsConstraints);
} else {
@@ -113,10 +114,11 @@ public class CompilePhaseIRRuleBuilder {
}
private List<Constraint> parseRawConstraints(List<RawConstraint> rawConstraints,
CompilePhase compilePhase) {
CompilePhase compilePhase,
VMInfo vmInfo) {
List<Constraint> constraintResultList = new ArrayList<>();
for (RawConstraint rawConstraint : rawConstraints) {
constraintResultList.add(rawConstraint.parse(compilePhase, compilation.output(compilePhase)));
constraintResultList.add(rawConstraint.parse(compilePhase, compilation.output(compilePhase), vmInfo));
}
return constraintResultList;
}

View File

@@ -31,6 +31,7 @@ import compiler.lib.ir_framework.driver.irmatching.irrule.checkattribute.Counts;
import compiler.lib.ir_framework.driver.irmatching.irrule.checkattribute.FailOn;
import compiler.lib.ir_framework.driver.irmatching.irrule.constraint.Constraint;
import compiler.lib.ir_framework.driver.irmatching.irrule.constraint.raw.RawConstraint;
import compiler.lib.ir_framework.driver.irmatching.parser.VMInfo;
import compiler.lib.ir_framework.shared.TestFrameworkException;
import java.util.ArrayList;
@@ -52,22 +53,26 @@ class DefaultPhaseRawConstraintParser {
}
public Map<CompilePhase, List<Matchable>> parse(List<RawConstraint> rawFailOnConstraints,
List<RawConstraint> rawCountsConstraints) {
List<RawConstraint> rawCountsConstraints,
VMInfo vmInfo) {
Map<CompilePhase, Matchable> failOnForCompilePhase = parseRawConstraints(rawFailOnConstraints,
CheckAttributeType.FAIL_ON);
CheckAttributeType.FAIL_ON,
vmInfo);
Map<CompilePhase, Matchable> countsForCompilePhase = parseRawConstraints(rawCountsConstraints,
CheckAttributeType.COUNTS);
CheckAttributeType.COUNTS,
vmInfo);
return mergeCheckAttributesForCompilePhase(failOnForCompilePhase, countsForCompilePhase);
}
private Map<CompilePhase, Matchable> parseRawConstraints(List<RawConstraint> rawConstraints,
CheckAttributeType checkAttributeType) {
CheckAttributeType checkAttributeType,
VMInfo vmInfo) {
Map<CompilePhase, List<Constraint>> matchableForCompilePhase = new HashMap<>();
for (RawConstraint rawConstraint : rawConstraints) {
CompilePhase compilePhase = rawConstraint.defaultCompilePhase();
List<Constraint> checkAttribute =
matchableForCompilePhase.computeIfAbsent(compilePhase, k -> new ArrayList<>());
checkAttribute.add(rawConstraint.parse(compilePhase, compilation.output(compilePhase)));
checkAttribute.add(rawConstraint.parse(compilePhase, compilation.output(compilePhase), vmInfo));
}
return replaceConstraintsWithCheckAttribute(matchableForCompilePhase, checkAttributeType);
}

View File

@@ -51,18 +51,18 @@ class IRMethodBuilder {
* Create IR methods for all test methods identified by {@link IREncodingParser} by combining them with the parsed
* compilation output from {@link HotSpotPidFileParser}.
*/
public SortedSet<IRMethodMatchable> build() {
public SortedSet<IRMethodMatchable> build(VMInfo vmInfo) {
SortedSet<IRMethodMatchable> irMethods = new TreeSet<>();
testMethods.testMethods().forEach(
(methodName, testMethod) -> irMethods.add(createIRMethod(methodName, testMethod)));
(methodName, testMethod) -> irMethods.add(createIRMethod(methodName, testMethod, vmInfo)));
return irMethods;
}
private IRMethodMatchable createIRMethod(String methodName, TestMethod testMethod) {
private IRMethodMatchable createIRMethod(String methodName, TestMethod testMethod, VMInfo vmInfo) {
LoggedMethod loggedMethod = loggedMethods.get(methodName);
if (loggedMethod != null) {
return new IRMethod(testMethod.method(), testMethod.irRuleIds(), testMethod.irAnnos(),
new Compilation(loggedMethod.compilationOutput()));
new Compilation(loggedMethod.compilationOutput()), vmInfo);
} else {
return new NotCompiledIRMethod(testMethod.method(), testMethod.irRuleIds().length);
}

View File

@@ -54,10 +54,11 @@ public class TestClassParser {
public Matchable parse(String hotspotPidFileName, String irEncoding) {
IREncodingParser irEncodingParser = new IREncodingParser(testClass);
TestMethods testMethods = irEncodingParser.parse(irEncoding);
VMInfo vmInfo = VMInfoParser.parseVMInfo(irEncoding);
if (testMethods.hasTestMethods()) {
HotSpotPidFileParser hotSpotPidFileParser = new HotSpotPidFileParser(testClass.getName(), testMethods);
LoggedMethods loggedMethods = hotSpotPidFileParser.parse(hotspotPidFileName);
return createTestClass(testMethods, loggedMethods);
return createTestClass(testMethods, loggedMethods, vmInfo);
}
return new NonIRTestClass();
}
@@ -66,9 +67,9 @@ public class TestClassParser {
* Create test class with IR methods for all test methods identified by {@link IREncodingParser} by combining them
* with the parsed compilation output from {@link HotSpotPidFileParser}.
*/
private Matchable createTestClass(TestMethods testMethods, LoggedMethods loggedMethods) {
private Matchable createTestClass(TestMethods testMethods, LoggedMethods loggedMethods, VMInfo vmInfo) {
IRMethodBuilder irMethodBuilder = new IRMethodBuilder(testMethods, loggedMethods);
SortedSet<IRMethodMatchable> irMethods = irMethodBuilder.build();
SortedSet<IRMethodMatchable> irMethods = irMethodBuilder.build(vmInfo);
TestFormat.throwIfAnyFailures();
return new TestClass(irMethods);
}

View File

@@ -0,0 +1,107 @@
/*
* Copyright (c) 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package compiler.lib.ir_framework.driver.irmatching.parser;
import compiler.lib.ir_framework.TestFramework;
import compiler.lib.ir_framework.shared.TestFrameworkException;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* This class stores the key value mapping from the VMInfo.
*
* @see IREncodingParser
*/
public class VMInfo {
/**
* Stores the key-value mapping.
*/
private final Map<String, String> keyValueMap;
private static final Pattern CPU_SKYLAKE_PATTERN =
Pattern.compile("family 6 model 85 stepping (\\d) ");
public VMInfo(Map<String, String> map) {
this.keyValueMap = map;
TestFramework.check(isKey("cpuFeatures"), "VMInfo does not contain cpuFeatures");
TestFramework.check(isKey("MaxVectorSize"), "VMInfo does not contain MaxVectorSize");
TestFramework.check(isKey("MaxVectorSizeIsDefault"), "VMInfo does not contain MaxVectorSizeIsDefault");
TestFramework.check(isKey("LoopMaxUnroll"), "VMInfo does not contain LoopMaxUnroll");
TestFramework.check(isKey("UseAVX"), "VMInfo does not contain UseAVX");
TestFramework.check(isKey("UseAVXIsDefault"), "VMInfo does not contain UseAVXIsDefault");
}
public String getStringValue(String key) {
TestFramework.check(isKey(key), "VMInfo does not contain \"" + key + "\"");
return keyValueMap.get(key);
}
public long getLongValue(String key) {
try {
return Long.parseLong(getStringValue(key));
} catch (NumberFormatException e) {
throw new TestFrameworkException("VMInfo value for \"" + key + "\" is not a long, got \"" + getStringValue(key) + "\"");
}
}
public boolean hasCPUFeature(String feature) {
String features = getStringValue("cpuFeatures") + ",";
return features.contains(" " + feature + ",");
}
public boolean isCascadeLake() {
Matcher matcher = CPU_SKYLAKE_PATTERN.matcher(getStringValue("cpuFeatures"));
if (!matcher.find()) {
return false; // skylake pattern not found
}
String stepping = matcher.group(1).trim();
return Long.parseLong(stepping) >= 5; // this makes it Cascade Lake
}
public boolean isDefaultCascadeLake() {
// See VM_Version::is_default_intel_cascade_lake
return isCascadeLake() &&
getLongValue("MaxVectorSizeIsDefault") == 1 &&
getLongValue("UseAVXIsDefault") == 1 &&
getLongValue("UseAVX") > 2;
}
/**
* Some platforms do not behave as expected, and one cannot trust that the vectors
* make use of the full MaxVectorSize. For Cascade Lake, we only use 32 bytes for
* SuperWord by default even though MaxVectorSize is 64. But the VectorAPI still
* uses 64 bytes. Thus MaxVectorSize is not a reliable indicator for the expected
* maximal vector size on that platform.
*/
public boolean canTrustVectorSize() {
return !isDefaultCascadeLake();
}
public boolean isKey(String key) {
return keyValueMap.containsKey(key);
}
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package compiler.lib.ir_framework.driver.irmatching.parser;
import compiler.lib.ir_framework.TestFramework;
import compiler.lib.ir_framework.shared.TestFrameworkException;
import compiler.lib.ir_framework.test.VMInfoPrinter;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Class to parse the VMInfo emitted by the test VM and creating {@link VMInfo} objects for each entry.
*
* @see VMInfo
*/
public class VMInfoParser {
private static final Pattern VM_INFO_PATTERN =
Pattern.compile("(?<=" + VMInfoPrinter.START_VM_INFO + "\r?\n).*\\R([\\s\\S]*)(?=" + VMInfoPrinter.END_VM_INFO + ")");
/**
* Extract VMInfo from the irEncoding.
*/
public static VMInfo parseVMInfo(String irEncoding) {
Map<String, String> map = new HashMap<>();
String[] lines = getVMInfoLines(irEncoding);
for (String s : lines) {
String line = s.trim();
String[] splitLine = line.split(":", 2);
if (splitLine.length != 2) {
throw new TestFrameworkException("Invalid VMInfo key:value encoding. Found: " + splitLine[0]);
}
String key = splitLine[0];
String value = splitLine[1];
map.put(key, value);
}
return new VMInfo(map);
}
/**
* Extract the VMInfo from the irEncoding string, strip away the header and return the individual key-value lines.
*/
private static String[] getVMInfoLines(String irEncoding) {
Matcher matcher = VM_INFO_PATTERN.matcher(irEncoding);
TestFramework.check(matcher.find(), "Did not find VMInfo in:" + System.lineSeparator() + irEncoding);
String lines = matcher.group(1).trim();
if (lines.isEmpty()) {
// Nothing to IR match.
return new String[0];
}
return lines.split("\\R");
}
}

View File

@@ -38,6 +38,12 @@ public class Comparison<T extends Comparable<T>> {
private final BiPredicate<T, T> comparisonPredicate;
private final String comparator;
public enum Bound {
LOWER,
UPPER,
EQUAL,
}
public Comparison(T givenValue, String comparator, BiPredicate<T, T> comparisonPredicate) {
this.givenValue = givenValue;
this.comparator = comparator;

View File

@@ -266,6 +266,7 @@ public class TestVM {
addBaseTests();
if (PRINT_VALID_IR_RULES) {
irMatchRulePrinter.emit();
VMInfoPrinter.emit();
}
TestFormat.throwIfAnyFailures();
declaredTests.clear();

View File

@@ -0,0 +1,70 @@
/*
* Copyright (c) 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package compiler.lib.ir_framework.test;
import compiler.lib.ir_framework.shared.TestFrameworkSocket;
import jdk.test.whitebox.WhiteBox;
/**
* Prints some test VM info to the socket.
*/
public class VMInfoPrinter {
public static final String START_VM_INFO = "##### IRMatchingVMInfo - used by TestFramework #####";
public static final String END_VM_INFO = "----- END VMInfo -----";
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
public static void emit() {
StringBuilder vmInfo = new StringBuilder();
vmInfo.append(START_VM_INFO).append(System.lineSeparator());
vmInfo.append("<key>:<value>").append(System.lineSeparator());
// CPU feature independent info
String cpuFeatures = WHITE_BOX.getCPUFeatures();
vmInfo.append("cpuFeatures:").append(cpuFeatures).append(System.lineSeparator());
long maxVectorSize = WHITE_BOX.getIntxVMFlag("MaxVectorSize");
vmInfo.append("MaxVectorSize:").append(maxVectorSize).append(System.lineSeparator());
boolean maxVectorSizeIsDefault = WHITE_BOX.isDefaultVMFlag("MaxVectorSize");
vmInfo.append("MaxVectorSizeIsDefault:")
.append(maxVectorSizeIsDefault ? 1 : 0)
.append(System.lineSeparator());
long loopMaxUnroll = WHITE_BOX.getIntxVMFlag("LoopMaxUnroll");
vmInfo.append("LoopMaxUnroll:").append(loopMaxUnroll).append(System.lineSeparator());
// CPU feature dependent info
long useAVX = 0;
boolean useAVXIsDefault = true;
if (cpuFeatures.contains(" sse, ")) {
useAVX = WHITE_BOX.getIntVMFlag("UseAVX");
useAVXIsDefault = WHITE_BOX.isDefaultVMFlag("UseAVX");
}
vmInfo.append("UseAVX:").append(useAVX).append(System.lineSeparator());
vmInfo.append("UseAVXIsDefault:")
.append(useAVXIsDefault ? 1 : 0)
.append(System.lineSeparator());
vmInfo.append(END_VM_INFO);
TestFrameworkSocket.write(vmInfo.toString(), "VMInfo");
}
}

View File

@@ -92,7 +92,7 @@ public class SumRedAbsNeg_Double {
(with or without store) in SuperWord::profitable. */
@Test
@IR(applyIf = {"SuperWordReductions", "false"},
failOn = {IRNode.ADD_REDUCTION_VD, IRNode.ABS_V, IRNode.NEG_V})
failOn = {IRNode.ADD_REDUCTION_VD, IRNode.ABS_VD, IRNode.NEG_VD})
public static double sumReductionImplement(
double[] a,
double[] b,

View File

@@ -90,10 +90,12 @@ public class SumRedAbsNeg_Float {
@Test
@IR(applyIf = {"SuperWordReductions", "false"},
failOn = {IRNode.ADD_REDUCTION_VF, IRNode.ABS_V, IRNode.NEG_V})
failOn = {IRNode.ADD_REDUCTION_VF, IRNode.ABS_VF, IRNode.NEG_VF})
@IR(applyIfCPUFeature = {"sse2", "true"},
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
counts = {IRNode.ADD_REDUCTION_VF, ">= 1", IRNode.ABS_V, ">= 1", IRNode.NEG_V, ">= 1"})
counts = {IRNode.ADD_REDUCTION_VF, ">= 1",
IRNode.ABS_VF, IRNode.VECTOR_SIZE + "min(LoopMaxUnroll, max_float)", ">= 1",
IRNode.NEG_VF, IRNode.VECTOR_SIZE + "min(LoopMaxUnroll, max_float)", ">= 1"})
public static float sumReductionImplement(
float[] a,
float[] b,

View File

@@ -87,10 +87,10 @@ public class SumRedSqrt_Double {
Require avx for SQRT_VD. */
@Test
@IR(applyIf = {"SuperWordReductions", "false"},
failOn = {IRNode.ADD_REDUCTION_VD, IRNode.SQRT_V})
failOn = {IRNode.ADD_REDUCTION_VD, IRNode.SQRT_VD})
@IR(applyIfCPUFeature = {"avx", "true"},
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
counts = {IRNode.ADD_REDUCTION_VD, ">= 1", IRNode.SQRT_V, ">= 1"})
counts = {IRNode.ADD_REDUCTION_VD, ">= 1", IRNode.SQRT_VD, ">= 1"})
public static double sumReductionWithStoreImplement(
double[] a,
double[] b,

View File

@@ -240,7 +240,7 @@ public class TestCyclicDependency {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_VI, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0", IRNode.ADD_VI, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test0(int[] dataI, float[] dataF) {
for (int i = 0; i < RANGE; i++) {
@@ -346,7 +346,7 @@ public class TestCyclicDependency {
}
@Test
@IR(counts = {IRNode.ADD_VF, "> 0"},
@IR(counts = {IRNode.ADD_VF, IRNode.VECTOR_SIZE + "min(max_int, max_float)", "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
// Some aarch64 machines have AlignVector == true, like ThunderX2

View File

@@ -143,7 +143,7 @@ public class TestIndependentPacksWithCyclicDependency {
}
@Test
@IR(counts = {IRNode.ADD_VI, "> 0", IRNode.MUL_VF, "> 0", IRNode.VECTOR_CAST_F2X, "> 0", IRNode.VECTOR_CAST_I2X, "> 0"},
@IR(counts = {IRNode.ADD_VI, "> 0", IRNode.MUL_VF, "> 0", IRNode.VECTOR_CAST_F2I, "> 0", IRNode.VECTOR_CAST_I2F, "> 0"},
applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
static void test1(int[] dataIa, int[] dataIb, float[] dataFa, float[] dataFb) {
for (int i = 0; i < RANGE; i+=2) {

View File

@@ -75,7 +75,7 @@ public class TestUnorderedReduction {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0",
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
IRNode.ADD_VI, "= 0",
IRNode.ADD_REDUCTION_VI, "> 0"}, // count can be high
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
@@ -114,7 +114,7 @@ public class TestUnorderedReduction {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0",
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
IRNode.ADD_VI, "> 0",
IRNode.ADD_REDUCTION_VI, "> 0",
IRNode.ADD_REDUCTION_VI, "<= 2"}, // count must be low
@@ -149,7 +149,7 @@ public class TestUnorderedReduction {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0",
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
IRNode.MUL_VI, "> 0",
IRNode.ADD_VI, "= 0", // reduction not moved out of loop
IRNode.ADD_REDUCTION_VI, "> 0",},

View File

@@ -59,8 +59,9 @@ public class TestUnorderedReductionPartialVectorization {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0",
IRNode.OR_REDUCTION_V, "> 0",},
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
IRNode.VECTOR_CAST_I2L, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
IRNode.OR_REDUCTION_V, "> 0",},
applyIfCPUFeatureOr = {"avx2", "true"})
static long test1(int[] data, long sum) {
for (int i = 0; i < data.length; i++) {
@@ -75,7 +76,7 @@ public class TestUnorderedReductionPartialVectorization {
// PhaseIdealLoop::move_unordered_reduction_out_of_loop
int v = data[i]; // int read
data[0] = 0; // ruin the first pack
sum |= v; // long reduction
sum |= v; // long reduction (and implicit cast from int to long)
}
return sum;
}

View File

@@ -280,17 +280,23 @@ public class TestMaskedMacroLogicVector {
}
@Test
@IR(applyIfAnd = {"UseAVX", "3", "UseSSE", " > 3 "}, counts = {IRNode.AND_V, " > 0 ", IRNode.XOR_V, " > 0 "})
@IR(applyIfAnd = {"UseAVX", "3", "UseSSE", " > 3 "},
counts = {IRNode.AND_VI, IRNode.VECTOR_SIZE_4, " > 0 ",
IRNode.XOR_VI, IRNode.VECTOR_SIZE_4, " > 0 "})
public void testInt4_Int128(int[] r, int[] a, int[] b, int[] c, boolean [] mask) {
testInt4Kernel(IntVector.SPECIES_128, r, a, b, c, mask);
}
@Test
@IR(applyIfAnd = {"UseAVX", "3", "UseSSE", " > 3 "}, counts = {IRNode.AND_V, " > 0 ", IRNode.XOR_V, " > 0 "})
@IR(applyIfAnd = {"UseAVX", "3", "UseSSE", " > 3 "},
counts = {IRNode.AND_VI, IRNode.VECTOR_SIZE_8, " > 0 ",
IRNode.XOR_VI, IRNode.VECTOR_SIZE_8, " > 0 "})
public void testInt4_Int256(int[] r, int[] a, int[] b, int[] c, boolean [] mask) {
testInt4Kernel(IntVector.SPECIES_256, r, a, b, c, mask);
}
@Test
@IR(applyIfAnd = {"UseAVX", "3", "UseSSE", " > 3 "}, counts = {IRNode.AND_V, " > 0 ", IRNode.XOR_V, " > 0 "})
@IR(applyIfAnd = {"UseAVX", "3", "UseSSE", " > 3 "},
counts = {IRNode.AND_VI, IRNode.VECTOR_SIZE_16, " > 0 ",
IRNode.XOR_VI, IRNode.VECTOR_SIZE_16, " > 0 "})
public void testInt4_Int512(int[] r, int[] a, int[] b, int[] c, boolean [] mask) {
testInt4Kernel(IntVector.SPECIES_512, r, a, b, c, mask);
}

View File

@@ -81,7 +81,7 @@ public class TestReverseByteTransforms {
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, counts = {IRNode.REVERSE_BYTES_V , " > 0 "})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, counts = {IRNode.REVERSE_BYTES_VL, " > 0 "})
public void test_reversebytes_long_transform1(long[] lout, long[] linp) {
VectorMask<Long> mask = VectorMask.fromLong(LSPECIES, 3);
for (int i = 0; i < LSPECIES.loopBound(linp.length); i+=LSPECIES.length()) {
@@ -100,7 +100,7 @@ public class TestReverseByteTransforms {
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, counts = {IRNode.REVERSE_BYTES_V , " > 0 "})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, counts = {IRNode.REVERSE_BYTES_VL, " > 0 "})
public void test_reversebytes_long_transform2(long[] lout, long[] linp) {
VectorMask<Long> mask1 = VectorMask.fromLong(LSPECIES, 3);
VectorMask<Long> mask2 = VectorMask.fromLong(LSPECIES, 3);
@@ -120,7 +120,7 @@ public class TestReverseByteTransforms {
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, failOn = {IRNode.REVERSE_BYTES_V})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, failOn = {IRNode.REVERSE_BYTES_VL})
public void test_reversebytes_long_transform3(long[] lout, long[] linp) {
for (int i = 0; i < LSPECIES.loopBound(linp.length); i+=LSPECIES.length()) {
LongVector.fromArray(LSPECIES, linp, i)
@@ -138,7 +138,7 @@ public class TestReverseByteTransforms {
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, counts = {IRNode.REVERSE_BYTES_V , " > 0 "})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, counts = {IRNode.REVERSE_BYTES_VI, " > 0 "})
public void test_reversebytes_int_transform1(int[] iout, int[] iinp) {
VectorMask<Integer> mask = VectorMask.fromLong(ISPECIES, 3);
for (int i = 0; i < ISPECIES.loopBound(iinp.length); i+=ISPECIES.length()) {
@@ -157,7 +157,7 @@ public class TestReverseByteTransforms {
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, counts = {IRNode.REVERSE_BYTES_V , " > 0 "})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, counts = {IRNode.REVERSE_BYTES_VI, " > 0 "})
public void test_reversebytes_int_transform2(int[] iout, int[] iinp) {
VectorMask<Integer> mask1 = VectorMask.fromLong(ISPECIES, 3);
VectorMask<Integer> mask2 = VectorMask.fromLong(ISPECIES, 3);
@@ -177,7 +177,7 @@ public class TestReverseByteTransforms {
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, failOn = {IRNode.REVERSE_BYTES_V})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, failOn = {IRNode.REVERSE_BYTES_VI})
public void test_reversebytes_int_transform3(int[] iout, int[] iinp) {
for (int i = 0; i < ISPECIES.loopBound(iinp.length); i+=ISPECIES.length()) {
IntVector.fromArray(ISPECIES, iinp, i)
@@ -195,7 +195,7 @@ public class TestReverseByteTransforms {
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, counts = {IRNode.REVERSE_BYTES_V , " > 0 "})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, counts = {IRNode.REVERSE_BYTES_VS, " > 0 "})
public void test_reversebytes_short_transform1(short[] sout, short[] sinp) {
VectorMask<Short> mask = VectorMask.fromLong(SSPECIES, 3);
for (int i = 0; i < SSPECIES.loopBound(sinp.length); i+=SSPECIES.length()) {
@@ -214,7 +214,7 @@ public class TestReverseByteTransforms {
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, counts = {IRNode.REVERSE_BYTES_V , " > 0 "})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, counts = {IRNode.REVERSE_BYTES_VS, " > 0 "})
public void test_reversebytes_short_transform2(short[] sout, short[] sinp) {
VectorMask<Short> mask1 = VectorMask.fromLong(SSPECIES, 3);
VectorMask<Short> mask2 = VectorMask.fromLong(SSPECIES, 3);
@@ -234,7 +234,7 @@ public class TestReverseByteTransforms {
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, failOn = {IRNode.REVERSE_BYTES_V})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"}, failOn = {IRNode.REVERSE_BYTES_VS})
public void test_reversebytes_short_transform3(short[] sout, short[] sinp) {
for (int i = 0; i < SSPECIES.loopBound(sinp.length); i+=SSPECIES.length()) {
ShortVector.fromArray(SSPECIES, sinp, i)

View File

@@ -78,7 +78,7 @@ public class TestReverseByteTransformsSVE {
}
@Test
@IR(applyIf = {"UseSVE", " > 0"}, failOn = {IRNode.REVERSE_BYTES_V})
@IR(applyIf = {"UseSVE", " > 0"}, failOn = {IRNode.REVERSE_BYTES_VL})
public void test_reversebytes_long_transform(long[] lout, long[] linp) {
VectorMask<Long> mask = VectorMask.fromLong(LSPECIES, 3);
for (int i = 0; i < LSPECIES.loopBound(linp.length); i+=LSPECIES.length()) {
@@ -97,7 +97,7 @@ public class TestReverseByteTransformsSVE {
}
@Test
@IR(applyIf = {"UseSVE", " > 0"}, failOn = {IRNode.REVERSE_BYTES_V})
@IR(applyIf = {"UseSVE", " > 0"}, failOn = {IRNode.REVERSE_BYTES_VI})
public void test_reversebytes_int_transform(int[] iout, int[] iinp) {
VectorMask<Integer> mask = VectorMask.fromLong(ISPECIES, 3);
for (int i = 0; i < ISPECIES.loopBound(iinp.length); i+=ISPECIES.length()) {
@@ -116,7 +116,7 @@ public class TestReverseByteTransformsSVE {
}
@Test
@IR(applyIf = {"UseSVE", " > 0"}, failOn = {IRNode.REVERSE_BYTES_V})
@IR(applyIf = {"UseSVE", " > 0"}, failOn = {IRNode.REVERSE_BYTES_VS})
public void test_reversebytes_short_transform(short[] sout, short[] sinp) {
VectorMask<Short> mask = VectorMask.fromLong(SSPECIES, 3);
for (int i = 0; i < SSPECIES.loopBound(sinp.length); i+=SSPECIES.length()) {

View File

@@ -77,7 +77,7 @@ public class TestVectorCompressExpandBits {
// Test for vectorized Integer.compress operation in SVE2
@Test
@IR(counts = {IRNode.COMPRESS_BITSV, "> 0"})
@IR(counts = {IRNode.COMPRESS_BITS_VI, "> 0"})
public static void testIntCompress() {
for (int i = 0; i < LENGTH; i += I_SPECIES.length()) {
IntVector av = IntVector.fromArray(I_SPECIES, ia, i);
@@ -96,7 +96,7 @@ public class TestVectorCompressExpandBits {
// Test for vectorized Integer.expand operation in SVE2
@Test
@IR(counts = {IRNode.EXPAND_BITSV, "> 0"})
@IR(counts = {IRNode.EXPAND_BITS_VI, "> 0"})
public static void testIntExpand() {
for (int i = 0; i < LENGTH; i += I_SPECIES.length()) {
IntVector av = IntVector.fromArray(I_SPECIES, ia, i);
@@ -115,7 +115,7 @@ public class TestVectorCompressExpandBits {
// Test for vectorized Long.compress operation in SVE2
@Test
@IR(counts = {IRNode.COMPRESS_BITSV, "> 0"})
@IR(counts = {IRNode.COMPRESS_BITS_VL, "> 0"})
public static void testLongCompress() {
for (int i = 0; i < LENGTH; i += L_SPECIES.length()) {
LongVector av = LongVector.fromArray(L_SPECIES, la, i);
@@ -134,7 +134,7 @@ public class TestVectorCompressExpandBits {
// Test for vectorized Long.expand operation in SVE2
@Test
@IR(counts = {IRNode.EXPAND_BITSV, "> 0"})
@IR(counts = {IRNode.EXPAND_BITS_VL, "> 0"})
public static void testLongExpand() {
for (int i = 0; i < LENGTH; i += L_SPECIES.length()) {
LongVector av = LongVector.fromArray(L_SPECIES, la, i);

View File

@@ -86,7 +86,8 @@ public class VectorFPtoIntCastTest {
}
@Test
@IR(counts = {IRNode.VECTOR_CAST_F2X, "> 0"}, applyIfCPUFeature = {"avx512f", "true"})
@IR(counts = {IRNode.VECTOR_CAST_F2I, IRNode.VECTOR_SIZE_16, "> 0"},
applyIfCPUFeature = {"avx512f", "true"})
public void float2int() {
var cvec = (IntVector)fvec512.convertShape(VectorOperators.F2I, ispec512, 0);
cvec.intoArray(int_arr, 0);
@@ -103,7 +104,8 @@ public class VectorFPtoIntCastTest {
}
@Test
@IR(counts = {IRNode.VECTOR_CAST_F2X, "> 0"}, applyIfCPUFeature = {"avx512dq", "true"})
@IR(counts = {IRNode.VECTOR_CAST_F2L, IRNode.VECTOR_SIZE_8, "> 0"},
applyIfCPUFeature = {"avx512dq", "true"})
public void float2long() {
var cvec = (LongVector)fvec512.convertShape(VectorOperators.F2L, lspec512, 0);
cvec.intoArray(long_arr, 0);
@@ -120,7 +122,8 @@ public class VectorFPtoIntCastTest {
}
@Test
@IR(counts = {IRNode.VECTOR_CAST_F2X, "> 0"}, applyIfCPUFeature = {"avx512f", "true"})
@IR(counts = {IRNode.VECTOR_CAST_F2S, IRNode.VECTOR_SIZE_16, "> 0"},
applyIfCPUFeature = {"avx512f", "true"})
public void float2short() {
var cvec = (ShortVector)fvec512.convertShape(VectorOperators.F2S, sspec256, 0);
cvec.intoArray(short_arr, 0);
@@ -137,7 +140,8 @@ public class VectorFPtoIntCastTest {
}
@Test
@IR(counts = {IRNode.VECTOR_CAST_F2X, "> 0"}, applyIfCPUFeature = {"avx512f", "true"})
@IR(counts = {IRNode.VECTOR_CAST_F2B, IRNode.VECTOR_SIZE_16, "> 0"},
applyIfCPUFeature = {"avx512f", "true"})
public void float2byte() {
var cvec = (ByteVector)fvec512.convertShape(VectorOperators.F2B, bspec128, 0);
cvec.intoArray(byte_arr, 0);
@@ -154,7 +158,8 @@ public class VectorFPtoIntCastTest {
}
@Test
@IR(counts = {IRNode.VECTOR_CAST_D2X, "> 0"}, applyIfCPUFeature = {"avx512f", "true"})
@IR(counts = {IRNode.VECTOR_CAST_D2I, IRNode.VECTOR_SIZE_8, "> 0"},
applyIfCPUFeature = {"avx512f", "true"})
public void double2int() {
var cvec = (IntVector)dvec512.convertShape(VectorOperators.D2I, ispec256, 0);
cvec.intoArray(int_arr, 0);
@@ -171,7 +176,8 @@ public class VectorFPtoIntCastTest {
}
@Test
@IR(counts = {IRNode.VECTOR_CAST_D2X, "> 0"}, applyIfCPUFeature = {"avx512dq", "true"})
@IR(counts = {IRNode.VECTOR_CAST_D2L, IRNode.VECTOR_SIZE_8, "> 0"},
applyIfCPUFeature = {"avx512dq", "true"})
public void double2long() {
var cvec = (LongVector)dvec512.convertShape(VectorOperators.D2L, lspec512, 0);
cvec.intoArray(long_arr, 0);
@@ -188,7 +194,8 @@ public class VectorFPtoIntCastTest {
}
@Test
@IR(counts = {IRNode.VECTOR_CAST_D2X, "> 0"}, applyIfCPUFeature = {"avx512f", "true"})
@IR(counts = {IRNode.VECTOR_CAST_D2S, IRNode.VECTOR_SIZE_8, "> 0"},
applyIfCPUFeature = {"avx512f", "true"})
public void double2short() {
var cvec = (ShortVector)dvec512.convertShape(VectorOperators.D2S, sspec128, 0);
cvec.intoArray(short_arr, 0);
@@ -205,7 +212,8 @@ public class VectorFPtoIntCastTest {
}
@Test
@IR(counts = {IRNode.VECTOR_CAST_D2X, "> 0"}, applyIfCPUFeature = {"avx512f", "true"})
@IR(counts = {IRNode.VECTOR_CAST_D2B, IRNode.VECTOR_SIZE_8, "> 0"},
applyIfCPUFeature = {"avx512f", "true"})
public void double2byte() {
var cvec = (ByteVector)dvec512.convertShape(VectorOperators.D2B, bspec64, 0);
cvec.intoArray(byte_arr, 0);

View File

@@ -104,7 +104,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.AND_V, counts = {IRNode.LOAD_VECTOR, ">=1"})
@IR(failOn = IRNode.AND_VB, counts = {IRNode.LOAD_VECTOR_B, ">=1"})
public static void testAndMinusOne() {
ByteVector av = ByteVector.fromArray(B_SPECIES, ba, 0);
av.and((byte) -1).intoArray(br, 0);
@@ -117,7 +117,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.AND_V, counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = IRNode.AND_VS, counts = {IRNode.STORE_VECTOR, ">=1"})
public static void testAndZero() {
ShortVector av = ShortVector.fromArray(S_SPECIES, sa, 0);
av.and((short) 0).intoArray(sr, 0);
@@ -130,7 +130,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.AND_V, counts = {IRNode.LOAD_VECTOR, ">=1"})
@IR(failOn = IRNode.AND_VI, counts = {IRNode.LOAD_VECTOR_I, ">=1"})
public static void testAndSame() {
IntVector av = IntVector.fromArray(I_SPECIES, ia, 0);
av.and(av).intoArray(ir, 0);
@@ -143,7 +143,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.AND_V, counts = {IRNode.LOAD_VECTOR, ">=1"})
@IR(failOn = IRNode.AND_VL, counts = {IRNode.LOAD_VECTOR_L, ">=1"})
public static void testMaskedAndMinusOne1() {
VectorMask<Long> mask = VectorMask.fromArray(L_SPECIES, m, 0);
LongVector av = LongVector.fromArray(L_SPECIES, la, 0);
@@ -163,8 +163,8 @@ public class VectorLogicalOpIdentityTest {
// Masked AndV in this test should not be optimized out on SVE.
@Test
@Warmup(10000)
@IR(counts = {IRNode.LOAD_VECTOR, ">=1"})
@IR(failOn = IRNode.AND_V, applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"})
@IR(counts = {IRNode.LOAD_VECTOR_B, ">=1"})
@IR(failOn = IRNode.AND_VB, applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"})
public static void testMaskedAndMinusOne2() {
VectorMask<Byte> mask = VectorMask.fromArray(B_SPECIES, m, 0);
ByteVector av = ByteVector.fromArray(B_SPECIES, ba, 0);
@@ -185,7 +185,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = IRNode.AND_V, applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"})
@IR(failOn = IRNode.AND_VS, applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"})
public static void testMaskedAndZero1() {
VectorMask<Short> mask = VectorMask.fromArray(S_SPECIES, m, 0);
ShortVector av = ShortVector.fromArray(S_SPECIES, sa, 0);
@@ -204,7 +204,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.AND_V, counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = IRNode.AND_VI, counts = {IRNode.STORE_VECTOR, ">=1"})
public static void testMaskedAndZero2() {
VectorMask<Integer> mask = VectorMask.fromArray(I_SPECIES, m, 0);
IntVector av = IntVector.fromArray(I_SPECIES, ia, 0);
@@ -223,7 +223,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.AND_V, counts = {IRNode.LOAD_VECTOR, ">=1"})
@IR(failOn = IRNode.AND_VL, counts = {IRNode.LOAD_VECTOR_L, ">=1"})
public static void testMaskedAndSame() {
VectorMask<Long> mask = VectorMask.fromArray(L_SPECIES, m, 0);
LongVector av = LongVector.fromArray(L_SPECIES, la, 0);
@@ -242,7 +242,7 @@ public class VectorLogicalOpIdentityTest {
// Transform AndV(AndV(a, b), b) ==> AndV(a, b)
@Test
@Warmup(10000)
@IR(counts = {IRNode.AND_V, "1"})
@IR(counts = {IRNode.AND_VI, "1"})
public static void testAndSameValue1() {
IntVector av = IntVector.fromArray(I_SPECIES, ia, 0);
IntVector bv = IntVector.fromArray(I_SPECIES, ib, 0);
@@ -257,7 +257,7 @@ public class VectorLogicalOpIdentityTest {
// Transform AndV(AndV(a, b), a) ==> AndV(a, b)
@Test
@Warmup(10000)
@IR(counts = {IRNode.AND_V, "1"})
@IR(counts = {IRNode.AND_VL, "1"})
public static void testAndSameValue2() {
LongVector av = LongVector.fromArray(L_SPECIES, la, 0);
LongVector bv = LongVector.fromArray(L_SPECIES, lb, 0);
@@ -272,7 +272,7 @@ public class VectorLogicalOpIdentityTest {
// Transform AndV(b, AndV(a, b)) ==> AndV(a, b)
@Test
@Warmup(10000)
@IR(counts = {IRNode.AND_V, "1"})
@IR(counts = {IRNode.AND_VI, "1"})
public static void testAndSameValue3() {
IntVector av = IntVector.fromArray(I_SPECIES, ia, 0);
IntVector bv = IntVector.fromArray(I_SPECIES, ib, 0);
@@ -287,7 +287,7 @@ public class VectorLogicalOpIdentityTest {
// Transform AndV(a, AndV(a, b)) ==> AndV(a, b)
@Test
@Warmup(10000)
@IR(counts = {IRNode.AND_V, "1"})
@IR(counts = {IRNode.AND_VL, "1"})
public static void testAndSameValue4() {
LongVector av = LongVector.fromArray(L_SPECIES, la, 0);
LongVector bv = LongVector.fromArray(L_SPECIES, lb, 0);
@@ -302,7 +302,7 @@ public class VectorLogicalOpIdentityTest {
// Transform AndV(AndV(a, b, m), b, m) ==> AndV(a, b, m)
@Test
@Warmup(10000)
@IR(counts = {IRNode.AND_V, "1"}, applyIfCPUFeatureOr = {"sve", "true", "avx512", "true"})
@IR(counts = {IRNode.AND_VI, "1"}, applyIfCPUFeatureOr = {"sve", "true", "avx512", "true"})
public static void testAndMaskSameValue1() {
VectorMask<Integer> mask = VectorMask.fromArray(I_SPECIES, m, 0);
IntVector av = IntVector.fromArray(I_SPECIES, ia, 0);
@@ -323,7 +323,7 @@ public class VectorLogicalOpIdentityTest {
// Transform AndV(AndV(a, b, m), a, m) ==> AndV(a, b, m)
@Test
@Warmup(10000)
@IR(counts = {IRNode.AND_V, "1"}, applyIfCPUFeatureOr = {"sve", "true", "avx512", "true"})
@IR(counts = {IRNode.AND_VL, "1"}, applyIfCPUFeatureOr = {"sve", "true", "avx512", "true"})
public static void testAndMaskSameValue2() {
VectorMask<Long> mask = VectorMask.fromArray(L_SPECIES, m, 0);
LongVector av = LongVector.fromArray(L_SPECIES, la, 0);
@@ -344,7 +344,7 @@ public class VectorLogicalOpIdentityTest {
// Transform AndV(a, AndV(a, b, m), m) ==> AndV(a, b, m)
@Test
@Warmup(10000)
@IR(counts = {IRNode.AND_V, "1"}, applyIfCPUFeatureOr = {"sve", "true", "avx512", "true"})
@IR(counts = {IRNode.AND_VI, "1"}, applyIfCPUFeatureOr = {"sve", "true", "avx512", "true"})
public static void testAndMaskSameValue3() {
VectorMask<Integer> mask = VectorMask.fromArray(I_SPECIES, m, 0);
IntVector av = IntVector.fromArray(I_SPECIES, ia, 0);
@@ -368,7 +368,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.OR_V, counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = IRNode.OR_VB, counts = {IRNode.STORE_VECTOR, ">=1"})
public static void testOrMinusOne() {
ByteVector av = ByteVector.fromArray(B_SPECIES, ba, 0);
av.or((byte) -1).intoArray(br, 0);
@@ -381,7 +381,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.OR_V, counts = {IRNode.LOAD_VECTOR, ">=1"})
@IR(failOn = IRNode.OR_VS, counts = {IRNode.LOAD_VECTOR_S, ">=1"})
public static void testOrZero() {
ShortVector av = ShortVector.fromArray(S_SPECIES, sa, 0);
av.or((short) 0).intoArray(sr, 0);
@@ -394,7 +394,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.OR_V, counts = {IRNode.LOAD_VECTOR, ">=1"})
@IR(failOn = IRNode.OR_VI, counts = {IRNode.LOAD_VECTOR_I, ">=1"})
public static void testOrSame() {
IntVector av = IntVector.fromArray(I_SPECIES, ia, 0);
av.or(av).intoArray(ir, 0);
@@ -409,7 +409,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = IRNode.OR_V, applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"})
@IR(failOn = IRNode.OR_VB, applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"})
public static void testMaskedOrMinusOne1() {
VectorMask<Byte> mask = VectorMask.fromArray(B_SPECIES, m, 0);
ByteVector av = ByteVector.fromArray(B_SPECIES, ba, 0);
@@ -428,7 +428,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.OR_V, counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = IRNode.OR_VB, counts = {IRNode.STORE_VECTOR, ">=1"})
public static void testMaskedOrMinusOne2() {
VectorMask<Byte> mask = VectorMask.fromArray(B_SPECIES, m, 0);
ByteVector av = ByteVector.fromArray(B_SPECIES, ba, 0);
@@ -447,7 +447,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.OR_V, counts = {IRNode.LOAD_VECTOR, ">=1"})
@IR(failOn = IRNode.OR_VS, counts = {IRNode.LOAD_VECTOR_S, ">=1"})
public static void testMaskedOrZero1() {
VectorMask<Short> mask = VectorMask.fromArray(S_SPECIES, m, 0);
ShortVector av = ShortVector.fromArray(S_SPECIES, sa, 0);
@@ -467,8 +467,8 @@ public class VectorLogicalOpIdentityTest {
// Masked OrV in this test should not be optimized out on SVE.
@Test
@Warmup(10000)
@IR(counts = {IRNode.LOAD_VECTOR, ">=1"})
@IR(failOn = IRNode.OR_V, applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"})
@IR(counts = {IRNode.LOAD_VECTOR_B, ">=1"})
@IR(failOn = IRNode.OR_VB, applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"})
public static void testMaskedOrZero2() {
VectorMask<Byte> mask = VectorMask.fromArray(B_SPECIES, m, 0);
ByteVector av = ByteVector.fromArray(B_SPECIES, ba, 0);
@@ -487,7 +487,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.OR_V, counts = {IRNode.LOAD_VECTOR, ">=1"})
@IR(failOn = IRNode.OR_VL, counts = {IRNode.LOAD_VECTOR_L, ">=1"})
public static void testMaskedOrSame() {
VectorMask<Long> mask = VectorMask.fromArray(L_SPECIES, m, 0);
LongVector av = LongVector.fromArray(L_SPECIES, la, 0);
@@ -506,7 +506,7 @@ public class VectorLogicalOpIdentityTest {
// Transform OrV(OrV(a, b), b) ==> OrV(a, b)
@Test
@Warmup(10000)
@IR(counts = {IRNode.OR_V, "1"})
@IR(counts = {IRNode.OR_VI, "1"})
public static void testOrSameValue1() {
IntVector av = IntVector.fromArray(I_SPECIES, ia, 0);
IntVector bv = IntVector.fromArray(I_SPECIES, ib, 0);
@@ -521,7 +521,7 @@ public class VectorLogicalOpIdentityTest {
// Transform OrV(OrV(a, b), a) ==> OrV(a, b)
@Test
@Warmup(10000)
@IR(counts = {IRNode.OR_V, "1"})
@IR(counts = {IRNode.OR_VL, "1"})
public static void testOrSameValue2() {
LongVector av = LongVector.fromArray(L_SPECIES, la, 0);
LongVector bv = LongVector.fromArray(L_SPECIES, lb, 0);
@@ -536,7 +536,7 @@ public class VectorLogicalOpIdentityTest {
// Transform OrV(b, OrV(a, b)) ==> OrV(a, b)
@Test
@Warmup(10000)
@IR(counts = {IRNode.OR_V, "1"})
@IR(counts = {IRNode.OR_VI, "1"})
public static void testOrSameValue3() {
IntVector av = IntVector.fromArray(I_SPECIES, ia, 0);
IntVector bv = IntVector.fromArray(I_SPECIES, ib, 0);
@@ -551,7 +551,7 @@ public class VectorLogicalOpIdentityTest {
// Transform OrV(a, OrV(a, b)) ==> OrV(a, b)
@Test
@Warmup(10000)
@IR(counts = {IRNode.OR_V, "1"})
@IR(counts = {IRNode.OR_VL, "1"})
public static void testOrSameValue4() {
LongVector av = LongVector.fromArray(L_SPECIES, la, 0);
LongVector bv = LongVector.fromArray(L_SPECIES, lb, 0);
@@ -566,7 +566,7 @@ public class VectorLogicalOpIdentityTest {
// Transform OrV(OrV(a, b, m), b, m) ==> OrV(a, b, m)
@Test
@Warmup(10000)
@IR(counts = {IRNode.OR_V, "1"}, applyIfCPUFeatureOr = {"sve", "true", "avx512", "true"})
@IR(counts = {IRNode.OR_VI, "1"}, applyIfCPUFeatureOr = {"sve", "true", "avx512", "true"})
public static void testOrMaskSameValue1() {
VectorMask<Integer> mask = VectorMask.fromArray(I_SPECIES, m, 0);
IntVector av = IntVector.fromArray(I_SPECIES, ia, 0);
@@ -587,7 +587,7 @@ public class VectorLogicalOpIdentityTest {
// Transform OrV(OrV(a, b, m), a, m) ==> OrV(a, b, m)
@Test
@Warmup(10000)
@IR(counts = {IRNode.OR_V, "1"}, applyIfCPUFeatureOr = {"sve", "true", "avx512", "true"})
@IR(counts = {IRNode.OR_VL, "1"}, applyIfCPUFeatureOr = {"sve", "true", "avx512", "true"})
public static void testOrMaskSameValue2() {
VectorMask<Long> mask = VectorMask.fromArray(L_SPECIES, m, 0);
LongVector av = LongVector.fromArray(L_SPECIES, la, 0);
@@ -608,7 +608,7 @@ public class VectorLogicalOpIdentityTest {
// Transform OrV(a, OrV(a, b, m), m) ==> OrV(a, b, m)
@Test
@Warmup(10000)
@IR(counts = {IRNode.OR_V, "1"}, applyIfCPUFeatureOr = {"sve", "true", "avx512", "true"})
@IR(counts = {IRNode.OR_VI, "1"}, applyIfCPUFeatureOr = {"sve", "true", "avx512", "true"})
public static void testOrMaskSameValue3() {
VectorMask<Integer> mask = VectorMask.fromArray(I_SPECIES, m, 0);
IntVector av = IntVector.fromArray(I_SPECIES, ia, 0);
@@ -632,7 +632,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = IRNode.XOR_V, counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = IRNode.XOR_VB, counts = {IRNode.STORE_VECTOR, ">=1"})
public static void testXorSame() {
ByteVector av = ByteVector.fromArray(B_SPECIES, ba, 0);
av.lanewise(VectorOperators.XOR, av).intoArray(br, 0);
@@ -647,7 +647,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = IRNode.XOR_V, applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"})
@IR(failOn = IRNode.XOR_VS, applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"})
public static void testMaskedXorSame() {
VectorMask<Short> mask = VectorMask.fromArray(S_SPECIES, m, 0);
ShortVector av = ShortVector.fromArray(S_SPECIES, sa, 0);
@@ -666,7 +666,7 @@ public class VectorLogicalOpIdentityTest {
// Following are the vector mask logic operations tests
@Test
@Warmup(10000)
@IR(failOn = {IRNode.AND_V, IRNode.AND_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = {IRNode.AND_VI, IRNode.AND_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
public static void testMaskAndMinusOne() {
VectorMask<Integer> ma = VectorMask.fromArray(I_SPECIES, m, 0);
VectorMask<Integer> mb = I_SPECIES.maskAll(true);
@@ -680,7 +680,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = {IRNode.AND_V, IRNode.AND_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = {IRNode.AND_VS, IRNode.AND_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
public static void testMaskAndZero() {
VectorMask<Short> ma = VectorMask.fromArray(S_SPECIES, m, 0);
VectorMask<Short> mb = S_SPECIES.maskAll(false);
@@ -694,7 +694,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = {IRNode.AND_V, IRNode.AND_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = {IRNode.AND_VB, IRNode.AND_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
public static void testMaskAndSame() {
VectorMask<Byte> ma = VectorMask.fromArray(B_SPECIES, m, 0);
ma.and(ma).intoArray(mr, 0);
@@ -707,7 +707,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = {IRNode.OR_V, IRNode.OR_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = {IRNode.OR_VS, IRNode.OR_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
public static void testMaskOrMinusOne() {
VectorMask<Short> ma = VectorMask.fromArray(S_SPECIES, m, 0);
VectorMask<Short> mb = S_SPECIES.maskAll(true);
@@ -721,7 +721,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = {IRNode.OR_V, IRNode.OR_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = {IRNode.OR_VI, IRNode.OR_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
public static void testMaskOrZero() {
VectorMask<Integer> ma = VectorMask.fromArray(I_SPECIES, m, 0);
VectorMask<Integer> mb = I_SPECIES.maskAll(false);
@@ -735,7 +735,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = {IRNode.OR_V, IRNode.OR_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = {IRNode.OR_VB, IRNode.OR_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
public static void testMaskOrSame() {
VectorMask<Byte> ma = VectorMask.fromArray(B_SPECIES, m, 0);
ma.or(ma).intoArray(mr, 0);
@@ -748,7 +748,7 @@ public class VectorLogicalOpIdentityTest {
@Test
@Warmup(10000)
@IR(failOn = {IRNode.XOR_V, IRNode.XOR_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
@IR(failOn = {IRNode.XOR_VI, IRNode.XOR_V_MASK}, counts = {IRNode.STORE_VECTOR, ">=1"})
public static void testMaskXorSame() {
VectorMask<Integer> ma = I_SPECIES.maskAll(true);
ma.not().intoArray(mr, 0);

View File

@@ -70,7 +70,7 @@ public class VectorReverseBytesTest {
}
@Test
@IR(failOn = IRNode.REVERSE_BYTES_V)
@IR(failOn = IRNode.REVERSE_BYTES_VB)
public static void testReverseBytesV() {
for (int i = 0; i < LENGTH; i += B_SPECIES.length()) {
ByteVector v = ByteVector.fromArray(B_SPECIES, input, i);
@@ -84,8 +84,8 @@ public class VectorReverseBytesTest {
}
@Test
@IR(failOn = IRNode.REVERSE_BYTES_V)
@IR(failOn = IRNode.VECTOR_BLEND)
@IR(failOn = IRNode.REVERSE_BYTES_VB)
@IR(failOn = IRNode.VECTOR_BLEND_B)
public static void testReverseBytesVMasked() {
VectorMask<Byte> mask = VectorMask.fromArray(B_SPECIES, m, 0);
for (int i = 0; i < LENGTH; i += B_SPECIES.length()) {

View File

@@ -71,15 +71,6 @@ public class VectorReshapeHelper {
public static final VectorSpecies<Float> FSPEC512 = FloatVector.SPECIES_512;
public static final VectorSpecies<Double> DSPEC512 = DoubleVector.SPECIES_512;
public static final String B2X_NODE = IRNode.VECTOR_CAST_B2X;
public static final String S2X_NODE = IRNode.VECTOR_CAST_S2X;
public static final String I2X_NODE = IRNode.VECTOR_CAST_I2X;
public static final String L2X_NODE = IRNode.VECTOR_CAST_L2X;
public static final String F2X_NODE = IRNode.VECTOR_CAST_F2X;
public static final String D2X_NODE = IRNode.VECTOR_CAST_D2X;
public static final String UB2X_NODE = IRNode.VECTOR_UCAST_B2X;
public static final String US2X_NODE = IRNode.VECTOR_UCAST_S2X;
public static final String UI2X_NODE = IRNode.VECTOR_UCAST_I2X;
public static final String REINTERPRET_NODE = IRNode.VECTOR_REINTERPRET;
public static void runMainHelper(Class<?> testClass, Stream<VectorSpeciesPair> testMethods, String... flags) {

View File

@@ -62,8 +62,8 @@ public class TestAutoVecIntMinMax {
// Test for auto-vectorization of Math.min operation on an array of integers
@Test
@IR(counts = {IRNode.LOAD_VECTOR, " >0 "})
@IR(counts = {IRNode.MIN_V, " >0 "})
@IR(counts = {IRNode.LOAD_VECTOR_I, " >0 "})
@IR(counts = {IRNode.MIN_VI, " >0 "})
@IR(counts = {IRNode.STORE_VECTOR, " >0 "})
private static void testIntMin(int[] a, int[] b) {
for(int i = 0; i < LENGTH; i++) {
@@ -73,8 +73,8 @@ public class TestAutoVecIntMinMax {
// Test for auto-vectorization of StrictMath.min operation on an array of integers
@Test
@IR(counts = {IRNode.LOAD_VECTOR, " >0 "})
@IR(counts = {IRNode.MIN_V, " >0 "})
@IR(counts = {IRNode.LOAD_VECTOR_I, " >0 "})
@IR(counts = {IRNode.MIN_VI, " >0 "})
@IR(counts = {IRNode.STORE_VECTOR, " >0 "})
private static void testIntStrictMin(int[] a, int[] b) {
for(int i = 0; i < LENGTH; i++) {
@@ -84,8 +84,8 @@ public class TestAutoVecIntMinMax {
// Test for auto-vectorization of Math.max operation on an array of integers
@Test
@IR(counts = {IRNode.LOAD_VECTOR, " >0 "})
@IR(counts = {IRNode.MAX_V, " >0 "})
@IR(counts = {IRNode.LOAD_VECTOR_I, " >0 "})
@IR(counts = {IRNode.MAX_VI, " >0 "})
@IR(counts = {IRNode.STORE_VECTOR, " >0 "})
private static void testIntMax(int[] a, int[] b) {
for(int i = 0; i < LENGTH; i++) {
@@ -95,8 +95,8 @@ public class TestAutoVecIntMinMax {
// Test for auto-vectorization of StrictMath.max operation on an array of integers
@Test
@IR(counts = {IRNode.LOAD_VECTOR, " >0 "})
@IR(counts = {IRNode.MAX_V, " >0 "})
@IR(counts = {IRNode.LOAD_VECTOR_I, " >0 "})
@IR(counts = {IRNode.MAX_VI, " >0 "})
@IR(counts = {IRNode.STORE_VECTOR, " >0 "})
private static void testIntStrictMax(int[] a, int[] b) {
for(int i = 0; i < LENGTH; i++) {

View File

@@ -51,7 +51,7 @@ public class TestFloatConversionsVector {
}
@Test
@IR(counts = {IRNode.VECTOR_CAST_F2HF, "> 0"})
@IR(counts = {IRNode.VECTOR_CAST_F2HF, IRNode.VECTOR_SIZE + "min(max_float, max_short)", "> 0"})
public void test_float_float16(short[] sout, float[] finp) {
for (int i = 0; i < finp.length; i++) {
sout[i] = Float.floatToFloat16(finp[i]);
@@ -94,7 +94,7 @@ public class TestFloatConversionsVector {
}
@Test
@IR(counts = {IRNode.VECTOR_CAST_HF2F, "> 0"})
@IR(counts = {IRNode.VECTOR_CAST_HF2F, IRNode.VECTOR_SIZE + "min(max_float, max_short)", "> 0"})
public void test_float16_float(float[] fout, short[] sinp) {
for (int i = 0; i < sinp.length; i++) {
fout[i] = Float.float16ToFloat(sinp[i]);

View File

@@ -34,8 +34,8 @@ package compiler.vectorization;
import compiler.lib.ir_framework.*;
public class TestOptionVectorizeIR {
static final int RANGE = 512;
static final int ITER = 100;
static int RANGE = 1024*2;
static int ITER = 100;
int[] gold1 = new int[RANGE];
int[] gold2 = new int[RANGE];
int[] gold3 = new int[RANGE];
@@ -220,7 +220,7 @@ public class TestOptionVectorizeIR {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_VI, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0", IRNode.ADD_VI, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test2(int[] data) {
@@ -231,7 +231,7 @@ public class TestOptionVectorizeIR {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.REPLICATE_I, "> 0", IRNode.ADD_VI, "> 0", IRNode.MUL_VI, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0", IRNode.REPLICATE_I, "> 0", IRNode.ADD_VI, "> 0", IRNode.MUL_VI, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test3(int[] data, int A, int B) {
@@ -273,7 +273,7 @@ public class TestOptionVectorizeIR {
// ------------------------- Long -----------------------------
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_V, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_L, "> 0", IRNode.ADD_VL, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test10(long[] data) {
@@ -283,7 +283,7 @@ public class TestOptionVectorizeIR {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_V, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_L, "> 0", IRNode.ADD_VL, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test11(long[] data) {
@@ -347,7 +347,7 @@ public class TestOptionVectorizeIR {
// ------------------------- Short -----------------------------
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_V, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_S, "> 0", IRNode.ADD_VS, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test20(short[] data) {
@@ -357,7 +357,7 @@ public class TestOptionVectorizeIR {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_V, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_S, "> 0", IRNode.ADD_VS, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test21(short[] data) {
@@ -420,7 +420,7 @@ public class TestOptionVectorizeIR {
// ------------------------- Byte -----------------------------
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_V, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_B, "> 0", IRNode.ADD_VB, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test30(byte[] data) {
@@ -430,7 +430,7 @@ public class TestOptionVectorizeIR {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_V, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_B, "> 0", IRNode.ADD_VB, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test31(byte[] data) {
@@ -493,7 +493,7 @@ public class TestOptionVectorizeIR {
// ------------------------- Char -----------------------------
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_V, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_C, "> 0", IRNode.ADD_VS, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test40(char[] data) {
@@ -503,7 +503,7 @@ public class TestOptionVectorizeIR {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_V, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_C, "> 0", IRNode.ADD_VS, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test41(char[] data) {
@@ -565,7 +565,7 @@ public class TestOptionVectorizeIR {
// ------------------------- Float -----------------------------
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_V, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, "> 0", IRNode.ADD_VF, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test50(float[] data) {
@@ -575,7 +575,7 @@ public class TestOptionVectorizeIR {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_V, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_F, "> 0", IRNode.ADD_VF, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test51(float[] data) {
@@ -637,7 +637,7 @@ public class TestOptionVectorizeIR {
// ------------------------- Double -----------------------------
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_V, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, "> 0", IRNode.ADD_VD, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test60(double[] data) {
@@ -647,7 +647,7 @@ public class TestOptionVectorizeIR {
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR, "> 0", IRNode.ADD_V, "> 0", IRNode.STORE_VECTOR, "> 0"},
@IR(counts = {IRNode.LOAD_VECTOR_D, "> 0", IRNode.ADD_VD, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static void test61(double[] data) {

View File

@@ -73,7 +73,7 @@ public class TestReverseBitsVector {
}
@Test
@IR(counts = {IRNode.REVERSE_V, "> 0"})
@IR(counts = {IRNode.REVERSE_VL, "> 0"})
public void test_reverse_long1(long[] lout, long[] linp) {
for (int i = 0; i < lout.length; i+=1) {
lout[i] = Long.reverse(linp[i]);
@@ -89,7 +89,7 @@ public class TestReverseBitsVector {
}
@Test
@IR(failOn = {IRNode.REVERSE_V, IRNode.REVERSE_L})
@IR(failOn = {IRNode.REVERSE_VL, IRNode.REVERSE_L})
public void test_reverse_long2(long[] lout, long[] linp) {
for (int i = 0; i < lout.length; i+=1) {
lout[i] = Long.reverse(Long.reverse(linp[i]));
@@ -105,7 +105,7 @@ public class TestReverseBitsVector {
}
@Test
@IR(failOn = {IRNode.REVERSE_V, IRNode.REVERSE_L})
@IR(failOn = {IRNode.REVERSE_VL, IRNode.REVERSE_L})
public void test_reverse_long3(long[] lout, long[] linp) {
for (int i = 0; i < lout.length; i+=1) {
lout[i] = Long.reverse(linp[i] ^ linp[i]);
@@ -121,7 +121,7 @@ public class TestReverseBitsVector {
}
@Test
@IR(counts = {IRNode.REVERSE_V, "> 0"})
@IR(counts = {IRNode.REVERSE_VI, "> 0"})
public void test_reverse_int1(int[] iout, int[] iinp) {
for (int i = 0; i < iout.length; i+=1) {
iout[i] = Integer.reverse(iinp[i]);
@@ -137,7 +137,7 @@ public class TestReverseBitsVector {
}
@Test
@IR(failOn = {IRNode.REVERSE_V, IRNode.REVERSE_I})
@IR(failOn = {IRNode.REVERSE_VI, IRNode.REVERSE_I})
public void test_reverse_int2(int[] iout, int[] iinp) {
for (int i = 0; i < iout.length; i+=1) {
iout[i] = Integer.reverse(Integer.reverse(iinp[i]));
@@ -153,7 +153,7 @@ public class TestReverseBitsVector {
}
@Test
@IR(failOn = {IRNode.REVERSE_V, IRNode.REVERSE_I})
@IR(failOn = {IRNode.REVERSE_VI, IRNode.REVERSE_I})
public void test_reverse_int3(int[] iout, int[] iinp) {
for (int i = 0; i < iout.length; i+=1) {
iout[i] = Integer.reverse(iinp[i] ^ iinp[i]);

View File

@@ -74,7 +74,7 @@ public class TestReverseBytes {
}
@Test
@IR(counts = {IRNode.REVERSE_BYTES_V, "> 0"})
@IR(counts = {IRNode.REVERSE_BYTES_VL, "> 0"})
public void test_reverse_bytes_long(long[] lout, long[] linp) {
for (int i = 0; i < lout.length; i+=1) {
lout[i] = Long.reverseBytes(linp[i]);
@@ -90,7 +90,7 @@ public class TestReverseBytes {
}
@Test
@IR(counts = {IRNode.REVERSE_BYTES_V, "> 0"})
@IR(counts = {IRNode.REVERSE_BYTES_VI, "> 0"})
public void test_reverse_bytes_int(int[] iout, int[] iinp) {
for (int i = 0; i < iout.length; i+=1) {
iout[i] = Integer.reverseBytes(iinp[i]);
@@ -106,7 +106,7 @@ public class TestReverseBytes {
}
@Test
@IR(counts = {IRNode.REVERSE_BYTES_V, "> 0"})
@IR(counts = {IRNode.REVERSE_BYTES_VS, "> 0"})
public void test_reverse_bytes_short(short[] sout, short[] sinp) {
for (int i = 0; i < sout.length; i+=1) {
sout[i] = Short.reverseBytes(sinp[i]);
@@ -122,7 +122,7 @@ public class TestReverseBytes {
}
@Test
@IR(counts = {IRNode.REVERSE_BYTES_V, "> 0"})
@IR(counts = {IRNode.REVERSE_BYTES_VS, "> 0"})
public void test_reverse_bytes_char(char[] cout, char[] cinp) {
for (int i = 0; i < cout.length; i+=1) {
cout[i] = Character.reverseBytes(cinp[i]);

View File

@@ -54,7 +54,7 @@ public class TestSubwordReverseBytes {
}
@Test
@IR(failOn = {IRNode.REVERSE_BYTES_V})
@IR(failOn = {IRNode.REVERSE_BYTES_VS})
public static int[] testShortReverseBytes() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -75,7 +75,7 @@ public class TestSubwordReverseBytes {
}
@Test
@IR(failOn = {IRNode.REVERSE_BYTES_V})
@IR(failOn = {IRNode.REVERSE_BYTES_VS})
public static int[] testCharacterReverseBytes() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {

View File

@@ -98,7 +98,7 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.RSHIFT_V, ">0"})
counts = {IRNode.RSHIFT_VI, ">0"})
public int[] intShiftLargeDistConstant() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -109,7 +109,7 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.RSHIFT_V, ">0"})
counts = {IRNode.RSHIFT_VI, ">0"})
public int[] intShiftLargeDistInvariant() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -120,7 +120,7 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.RSHIFT_V, ">0"})
counts = {IRNode.RSHIFT_VS, ">0"})
public short[] shortShiftLargeDistConstant() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -131,7 +131,7 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.RSHIFT_V, ">0"})
counts = {IRNode.RSHIFT_VS, ">0"})
public short[] shortShiftLargeDistInvariant() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -142,7 +142,7 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.LSHIFT_V, ">0"})
counts = {IRNode.LSHIFT_VL, ">0"})
public long[] longShiftLargeDistConstant() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -153,7 +153,7 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.URSHIFT_V, ">0"})
counts = {IRNode.URSHIFT_VL, ">0"})
public long[] longShiftLargeDistInvariant() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -186,7 +186,7 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.RSHIFT_V, ">0"})
counts = {IRNode.RSHIFT_VS, ">0"})
public short[] vectorUnsignedShiftRight() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {

View File

@@ -132,7 +132,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
// ---------------- Convert I/L to F/D ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
counts = {IRNode.VECTOR_CAST_I2X, ">0"})
counts = {IRNode.VECTOR_CAST_I2F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0"})
public float[] convertIntToFloat() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -146,7 +146,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
// The vectorization of some conversions may fail when `+AlignVector`.
// We can remove the condition after JDK-8303827.
applyIf = {"AlignVector", "false"},
counts = {IRNode.VECTOR_CAST_I2X, ">0"})
counts = {IRNode.VECTOR_CAST_I2D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0"})
public double[] convertIntToDouble() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -157,7 +157,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx512dq", "true"},
counts = {IRNode.VECTOR_CAST_L2X, ">0"})
counts = {IRNode.VECTOR_CAST_L2F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0"})
public float[] convertLongToFloat() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -168,7 +168,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx512dq", "true"},
counts = {IRNode.VECTOR_CAST_L2X, ">0"})
counts = {IRNode.VECTOR_CAST_L2D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0"})
public double[] convertLongToDouble() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -180,7 +180,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
// ---------------- Convert Subword-I to F/D ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"},
counts = {IRNode.VECTOR_CAST_S2X, ">0"})
counts = {IRNode.VECTOR_CAST_S2F, IRNode.VECTOR_SIZE + "min(max_short, max_float)", ">0"})
public float[] convertShortToFloat() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -192,7 +192,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
applyIf = {"MaxVectorSize", ">=32"},
counts = {IRNode.VECTOR_CAST_S2X, ">0"})
counts = {IRNode.VECTOR_CAST_S2D, IRNode.VECTOR_SIZE + "min(max_short, max_double)", ">0"})
public double[] convertShortToDouble() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -222,7 +222,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
// ---------------- Convert F/D to I/L ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
counts = {IRNode.VECTOR_CAST_F2X, ">0"})
counts = {IRNode.VECTOR_CAST_F2I, IRNode.VECTOR_SIZE + "min(max_float, max_int)", ">0"})
public int[] convertFloatToInt() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -236,7 +236,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
// The vectorization of some conversions may fail when `+AlignVector`.
// We can remove the condition after JDK-8303827.
applyIf = {"AlignVector", "false"},
counts = {IRNode.VECTOR_CAST_F2X, ">0"})
counts = {IRNode.VECTOR_CAST_F2L, IRNode.VECTOR_SIZE + "min(max_float, max_long)", ">0"})
public long[] convertFloatToLong() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -247,7 +247,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx", "true"},
counts = {IRNode.VECTOR_CAST_D2X, ">0"})
counts = {IRNode.VECTOR_CAST_D2I, IRNode.VECTOR_SIZE + "min(max_double, max_int)", ">0"})
public int[] convertDoubleToInt() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -258,7 +258,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx512dq", "true"},
counts = {IRNode.VECTOR_CAST_D2X, ">0"})
counts = {IRNode.VECTOR_CAST_D2L, IRNode.VECTOR_SIZE + "min(max_double, max_long)", ">0"})
public long[] convertDoubleToLong() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -270,7 +270,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
// ---------------- Convert F/D to Subword-I ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"},
counts = {IRNode.VECTOR_CAST_F2X, ">0"})
counts = {IRNode.VECTOR_CAST_F2S, IRNode.VECTOR_SIZE + "min(max_float, max_short)", ">0"})
public short[] convertFloatToShort() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -281,7 +281,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"},
counts = {IRNode.VECTOR_CAST_F2X, ">0"})
counts = {IRNode.VECTOR_CAST_F2S, IRNode.VECTOR_SIZE + "min(max_float, max_char)", ">0"})
public char[] convertFloatToChar() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -293,7 +293,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx", "true"},
applyIf = {"MaxVectorSize", ">=32"},
counts = {IRNode.VECTOR_CAST_D2X, ">0"})
counts = {IRNode.VECTOR_CAST_D2S, IRNode.VECTOR_SIZE + "min(max_double, max_short)", ">0"})
public short[] convertDoubleToShort() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -305,7 +305,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx", "true"},
applyIf = {"MaxVectorSize", ">=32"},
counts = {IRNode.VECTOR_CAST_D2X, ">0"})
counts = {IRNode.VECTOR_CAST_D2S, IRNode.VECTOR_SIZE + "min(max_double, max_char)", ">0"})
public char[] convertDoubleToChar() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -320,7 +320,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
// The vectorization of some conversions may fail when `+AlignVector`.
// We can remove the condition after JDK-8303827.
applyIf = {"AlignVector", "false"},
counts = {IRNode.VECTOR_CAST_F2X, ">0"})
counts = {IRNode.VECTOR_CAST_F2D, IRNode.VECTOR_SIZE + "min(max_float, max_double)", ">0"})
public double[] convertFloatToDouble() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -331,7 +331,7 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
counts = {IRNode.VECTOR_CAST_D2X, ">0"})
counts = {IRNode.VECTOR_CAST_D2F, IRNode.VECTOR_SIZE + "min(max_double, max_float)", ">0"})
public float[] convertDoubleToFloat() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {

View File

@@ -44,7 +44,7 @@ import compiler.lib.ir_framework.*;
public class BasicBooleanOpTest extends VectorizationTestRunner {
private static final int SIZE = 543;
private static final int SIZE = 6543;
private boolean[] a;
private boolean[] b;
@@ -72,9 +72,9 @@ public class BasicBooleanOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.AND_V, ">0"})
counts = {IRNode.AND_VB, ">0"})
@IR(applyIfCPUFeatureAnd = {"avx512f", "false", "sse2", "true"},
counts = {IRNode.AND_V, ">0"})
counts = {IRNode.AND_VB, ">0"})
@IR(applyIfCPUFeature = {"avx512f", "true"},
counts = {IRNode.MACRO_LOGIC_V, ">0"})
public boolean[] vectorAnd() {
@@ -87,7 +87,7 @@ public class BasicBooleanOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.OR_V, ">0"})
counts = {IRNode.OR_VB, ">0"})
public boolean[] vectorOr() {
boolean[] res = new boolean[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -98,7 +98,7 @@ public class BasicBooleanOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.XOR_V, ">0"})
counts = {IRNode.XOR_VB, ">0"})
public boolean[] vectorXor() {
boolean[] res = new boolean[SIZE];
for (int i = 0; i < SIZE; i++) {

View File

@@ -34,6 +34,8 @@
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* -XX:CompileCommand=CompileOnly,compiler.vectorization.runner.BasicByteOpTest::*
* -XX:LoopUnrollLimit=1000
* compiler.vectorization.runner.BasicByteOpTest
*
* @requires vm.compiler2.enabled & vm.flagless
@@ -45,7 +47,7 @@ import compiler.lib.ir_framework.*;
public class BasicByteOpTest extends VectorizationTestRunner {
private static final int SIZE = 543;
private static int SIZE = 6543;
private byte[] a;
private byte[] b;
@@ -65,7 +67,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
// ---------------- Arithmetic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VB, ">0"})
public byte[] vectorNeg() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -76,7 +78,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "ssse3", "true"},
counts = {IRNode.ABS_V, ">0"})
counts = {IRNode.ABS_VB, ">0"})
public byte[] vectorAbs() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -87,7 +89,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.ADD_V, ">0"})
counts = {IRNode.ADD_VB, ">0"})
public byte[] vectorAdd() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -98,7 +100,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VB, ">0"})
public byte[] vectorSub() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -109,7 +111,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.MUL_V, ">0"})
counts = {IRNode.MUL_VB, ">0"})
public byte[] vectorMul() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -120,7 +122,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.MUL_V, ">0", IRNode.ADD_V, ">0"})
counts = {IRNode.MUL_VB, ">0", IRNode.ADD_VB, ">0"})
public byte[] vectorMulAdd() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -131,7 +133,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.MUL_V, ">0", IRNode.SUB_V, ">0"})
counts = {IRNode.MUL_VB, ">0", IRNode.SUB_VB, ">0"})
public byte[] vectorMulSub() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -143,7 +145,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
// ---------------- Logic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.XOR_V, ">0"})
counts = {IRNode.XOR_VB, ">0"})
public byte[] vectorNot() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -154,7 +156,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.AND_V, ">0"})
counts = {IRNode.AND_VB, ">0"})
public byte[] vectorAnd() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -165,7 +167,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.OR_V, ">0"})
counts = {IRNode.OR_VB, ">0"})
public byte[] vectorOr() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -176,7 +178,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.XOR_V, ">0"})
counts = {IRNode.XOR_VB, ">0"})
public byte[] vectorXor() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -188,7 +190,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
// ---------------- Shift ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.LSHIFT_V, ">0"})
counts = {IRNode.LSHIFT_VB, ">0"})
public byte[] vectorShiftLeft() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -199,7 +201,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.RSHIFT_V, ">0"})
counts = {IRNode.RSHIFT_VB, ">0"})
public byte[] vectorSignedShiftRight() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -210,7 +212,7 @@ public class BasicByteOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.RSHIFT_V, ">0"})
counts = {IRNode.RSHIFT_VB, ">0"})
public byte[] vectorUnsignedShiftRight() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {

View File

@@ -67,7 +67,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
// ---------------- Arithmetic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VS, ">0"})
public char[] vectorNeg() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -79,7 +79,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "ssse3", "true"},
counts = {IRNode.STORE_VECTOR, ">0"})
@IR(failOn = {IRNode.ABS_V})
@IR(failOn = {IRNode.ABS_VI, IRNode.ABS_VB, IRNode.ABS_VL}) // AVS_VC does not exist
public char[] vectorAbs() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -90,7 +90,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.ADD_V, ">0"})
counts = {IRNode.ADD_VS, ">0"}) // char add same as for short
public char[] vectorAdd() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -101,7 +101,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VS, ">0"})
public char[] vectorSub() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -112,7 +112,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.MUL_V, ">0"})
counts = {IRNode.MUL_VS, ">0"})
public char[] vectorMul() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -123,7 +123,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.MUL_V, ">0", IRNode.ADD_V, ">0"})
counts = {IRNode.MUL_VS, ">0",
IRNode.ADD_VS, ">0"}) // char add same as for short
public char[] vectorMulAdd() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -134,7 +135,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.MUL_V, ">0", IRNode.SUB_V, ">0"})
counts = {IRNode.MUL_VS, ">0", IRNode.SUB_VS, ">0"})
public char[] vectorMulSub() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -146,7 +147,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
// ---------------- Logic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.XOR_V, ">0"})
counts = {IRNode.XOR_VS, ">0"})
public char[] vectorNot() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -157,7 +158,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.AND_V, ">0"})
counts = {IRNode.AND_VS, ">0"})
public char[] vectorAnd() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -168,7 +169,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.OR_V, ">0"})
counts = {IRNode.OR_VS, ">0"})
public char[] vectorOr() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -179,7 +180,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.XOR_V, ">0"})
counts = {IRNode.XOR_VS, ">0"})
public char[] vectorXor() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -191,7 +192,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
// ---------------- Shift ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.LSHIFT_V, ">0"})
counts = {IRNode.LSHIFT_VC, ">0"})
public char[] vectorShiftLeft() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -202,7 +203,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.URSHIFT_V, ">0"})
counts = {IRNode.URSHIFT_VC, ">0"})
public char[] vectorSignedShiftRight() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -213,7 +214,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.URSHIFT_V, ">0"})
counts = {IRNode.URSHIFT_VC, ">0"})
public char[] vectorUnsignedShiftRight() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -225,7 +226,7 @@ public class BasicCharOpTest extends VectorizationTestRunner {
// ------------- ReverseBytes -------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"},
counts = {IRNode.REVERSE_BYTES_V, ">0"})
counts = {IRNode.REVERSE_BYTES_VS, ">0"})
public char[] reverseBytesWithChar() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {

View File

@@ -65,7 +65,7 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
// ---------------- Arithmetic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.NEG_V, ">0"})
counts = {IRNode.NEG_VD, ">0"})
public double[] vectorNeg() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -76,7 +76,7 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.ABS_V, ">0"})
counts = {IRNode.ABS_VD, ">0"})
public double[] vectorAbs() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -87,7 +87,7 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
counts = {IRNode.SQRT_V, ">0"})
counts = {IRNode.SQRT_VD, ">0"})
public double[] vectorSqrt() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -131,7 +131,7 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.ADD_V, ">0"})
counts = {IRNode.ADD_VD, ">0"})
public double[] vectorAdd() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -142,7 +142,7 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VD, ">0"})
public double[] vectorSub() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -153,7 +153,7 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.MUL_V, ">0"})
counts = {IRNode.MUL_VD, ">0"})
public double[] vectorMul() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -164,7 +164,7 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.DIV_V, ">0"})
counts = {IRNode.DIV_VD, ">0"})
public double[] vectorDiv() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -175,7 +175,7 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
counts = {IRNode.MAX_V, ">0"})
counts = {IRNode.MAX_VD, ">0"})
public double[] vectorMax() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -186,7 +186,7 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
counts = {IRNode.MIN_V, ">0"})
counts = {IRNode.MIN_VD, ">0"})
public double[] vectorMin() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -197,9 +197,9 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.FMA_V, ">0", IRNode.VFMLA, ">0"})
counts = {IRNode.FMA_VD, ">0", IRNode.VFMLA, ">0"})
@IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VD, ">0"})
public double[] vectorMulAdd() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -210,9 +210,9 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.FMA_V, ">0", IRNode.VFMLS, ">0"})
counts = {IRNode.FMA_VD, ">0", IRNode.VFMLS, ">0"})
@IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VD, ">0"})
public double[] vectorMulSub1() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -223,9 +223,9 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.FMA_V, ">0", IRNode.VFMLS, ">0"})
counts = {IRNode.FMA_VD, ">0", IRNode.VFMLS, ">0"})
@IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VD, ">0"})
public double[] vectorMulSub2() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -236,11 +236,11 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VD, ">0"})
@IR(applyIfCPUFeature = {"sve", "true"},
counts = {IRNode.VFNMLA, ">0"})
@IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VD, ">0"})
public double[] vectorNegateMulAdd1() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -251,11 +251,11 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VD, ">0"})
@IR(applyIfCPUFeature = {"sve", "true"},
counts = {IRNode.VFNMLA, ">0"})
@IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VD, ">0"})
public double[] vectorNegateMulAdd2() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -266,9 +266,9 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VD, ">0"})
@IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VD, ">0"})
public double[] vectorNegateMulSub() {
double[] res = new double[SIZE];
for (int i = 0; i < SIZE; i++) {

View File

@@ -65,7 +65,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
// ---------------- Arithmetic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse", "true"},
counts = {IRNode.NEG_V, ">0"})
counts = {IRNode.NEG_VF, ">0"})
public float[] vectorNeg() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -76,7 +76,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse", "true"},
counts = {IRNode.ABS_V, ">0"})
counts = {IRNode.ABS_VF, ">0"})
public float[] vectorAbs() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -87,7 +87,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
counts = {IRNode.SQRT_V, ">0"})
counts = {IRNode.SQRT_VF, ">0"})
public float[] vectorSqrt() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -98,7 +98,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.ADD_V, ">0"})
counts = {IRNode.ADD_VF, ">0"})
public float[] vectorAdd() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -109,7 +109,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VF, ">0"})
public float[] vectorSub() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -120,7 +120,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.MUL_V, ">0"})
counts = {IRNode.MUL_VF, ">0"})
public float[] vectorMul() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -131,7 +131,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.DIV_V, ">0"})
counts = {IRNode.DIV_VF, ">0"})
public float[] vectorDiv() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -142,7 +142,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
counts = {IRNode.MAX_V, ">0"})
counts = {IRNode.MAX_VF, ">0"})
public float[] vectorMax() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -153,7 +153,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
counts = {IRNode.MIN_V, ">0"})
counts = {IRNode.MIN_VF, ">0"})
public float[] vectorMin() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -164,9 +164,9 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.FMA_V, ">0", IRNode.VFMLA, ">0"})
counts = {IRNode.FMA_VF, ">0", IRNode.VFMLA, ">0"})
@IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VF, ">0"})
public float[] vectorMulAdd() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -177,9 +177,9 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.FMA_V, ">0", IRNode.VFMLS, ">0"})
counts = {IRNode.FMA_VF, ">0", IRNode.VFMLS, ">0"})
@IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VF, ">0"})
public float[] vectorMulSub1() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -190,9 +190,9 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.FMA_V, ">0", IRNode.VFMLS, ">0"})
counts = {IRNode.FMA_VF, ">0", IRNode.VFMLS, ">0"})
@IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VF, ">0"})
public float[] vectorMulSub2() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -203,11 +203,11 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VF, ">0"})
@IR(applyIfCPUFeature = {"sve", "true"},
counts = {IRNode.VFNMLA, ">0"})
@IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VF, ">0"})
public float[] vectorNegateMulAdd1() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -218,11 +218,11 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VF, ">0"})
@IR(applyIfCPUFeature = {"sve", "true"},
counts = {IRNode.VFNMLA, ">0"})
@IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VF, ">0"})
public float[] vectorNegateMulAdd2() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -233,9 +233,9 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeature = {"asimd", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VF, ">0"})
@IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"},
counts = {IRNode.FMA_V, ">0"})
counts = {IRNode.FMA_VF, ">0"})
public float[] vectorNegateMulSub() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {

View File

@@ -65,7 +65,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
// ---------------- Arithmetic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VI, ">0"})
public int[] vectorNeg() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -76,7 +76,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "ssse3", "true"},
counts = {IRNode.ABS_V, ">0"})
counts = {IRNode.ABS_VI, ">0"})
public int[] vectorAbs() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -87,7 +87,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.ADD_V, ">0"})
counts = {IRNode.ADD_VI, ">0"})
public int[] vectorAdd() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -98,7 +98,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VI, ">0"})
public int[] vectorSub() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -109,7 +109,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.MUL_V, ">0"})
counts = {IRNode.MUL_VI, ">0"})
public int[] vectorMul() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -120,7 +120,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.MUL_V, ">0", IRNode.ADD_V, ">0"})
counts = {IRNode.MUL_VI, ">0", IRNode.ADD_VI, ">0"})
public int[] vectorMulAdd() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -131,7 +131,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.MUL_V, ">0", IRNode.SUB_V, ">0"})
counts = {IRNode.MUL_VI, ">0", IRNode.SUB_VI, ">0"})
public int[] vectorMulSub() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -154,7 +154,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
// ---------------- Logic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.XOR_V, ">0"})
counts = {IRNode.XOR_VI, ">0"})
public int[] vectorNot() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -165,7 +165,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.AND_V, ">0"})
counts = {IRNode.AND_VI, ">0"})
public int[] vectorAnd() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -176,7 +176,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.OR_V, ">0"})
counts = {IRNode.OR_VI, ">0"})
public int[] vectorOr() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -187,7 +187,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.XOR_V, ">0"})
counts = {IRNode.XOR_VI, ">0"})
public int[] vectorXor() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -199,7 +199,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
// ---------------- Shift ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.LSHIFT_V, ">0"})
counts = {IRNode.LSHIFT_VI, ">0"})
public int[] vectorShiftLeft() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -210,7 +210,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.RSHIFT_V, ">0"})
counts = {IRNode.RSHIFT_VI, ">0"})
public int[] vectorSignedShiftRight() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -221,7 +221,7 @@ public class BasicIntOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.URSHIFT_V, ">0"})
counts = {IRNode.URSHIFT_VI, ">0"})
public int[] vectorUnsignedShiftRight() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {

View File

@@ -66,7 +66,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
// ---------------- Arithmetic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VL, ">0"})
public long[] vectorNeg() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -77,7 +77,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx512vl", "true"},
counts = {IRNode.ABS_V, ">0"})
counts = {IRNode.ABS_VL, ">0"})
public long[] vectorAbs() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -88,7 +88,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.ADD_V, ">0"})
counts = {IRNode.ADD_VL, ">0"})
public long[] vectorAdd() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -99,7 +99,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VL, ">0"})
public long[] vectorSub() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -110,7 +110,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx512dq", "true"},
counts = {IRNode.MUL_V, ">0"})
counts = {IRNode.MUL_VL, ">0"})
public long[] vectorMul() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -121,9 +121,9 @@ public class BasicLongOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"sve", "true", "sse4.1", "true"},
counts = {IRNode.ADD_V, ">0"})
counts = {IRNode.ADD_VL, ">0"})
@IR(applyIfCPUFeatureOr = {"sve", "true", "sse4.1", "true"},
counts = {IRNode.MUL_V, ">0"})
counts = {IRNode.MUL_VL, ">0"})
public long[] vectorMulAdd() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -134,7 +134,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"sve", "true", "sse4.1", "true"},
counts = {IRNode.MUL_V, ">0", IRNode.SUB_V, ">0"})
counts = {IRNode.MUL_VL, ">0", IRNode.SUB_VL, ">0"})
public long[] vectorMulSub() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -146,7 +146,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
// ---------------- Logic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.XOR_V, ">0"})
counts = {IRNode.XOR_VL, ">0"})
public long[] vectorNot() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -157,7 +157,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.AND_V, ">0"})
counts = {IRNode.AND_VL, ">0"})
public long[] vectorAnd() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -168,7 +168,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.OR_V, ">0"})
counts = {IRNode.OR_VL, ">0"})
public long[] vectorOr() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -179,7 +179,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.XOR_V, ">0"})
counts = {IRNode.XOR_VL, ">0"})
public long[] vectorXor() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -191,7 +191,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
// ---------------- Shift ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.LSHIFT_V, ">0"})
counts = {IRNode.LSHIFT_VL, ">0"})
public long[] vectorShiftLeft() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -202,7 +202,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.RSHIFT_V, ">0"})
counts = {IRNode.RSHIFT_VL, ">0"})
public long[] vectorSignedShiftRight() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -213,7 +213,7 @@ public class BasicLongOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.URSHIFT_V, ">0"})
counts = {IRNode.URSHIFT_VL, ">0"})
public long[] vectorUnsignedShiftRight() {
long[] res = new long[SIZE];
for (int i = 0; i < SIZE; i++) {

View File

@@ -67,7 +67,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
// ---------------- Arithmetic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VS, ">0"})
public short[] vectorNeg() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -78,7 +78,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "ssse3", "true"},
counts = {IRNode.ABS_V, ">0"})
counts = {IRNode.ABS_VS, ">0"})
public short[] vectorAbs() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -89,7 +89,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.ADD_V, ">0"})
counts = {IRNode.ADD_VS, ">0"})
public short[] vectorAdd() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -100,7 +100,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VS, ">0"})
public short[] vectorSub() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -111,7 +111,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.MUL_V, ">0"})
counts = {IRNode.MUL_VS, ">0"})
public short[] vectorMul() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -122,7 +122,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.MUL_V, ">0", IRNode.ADD_V, ">0"})
counts = {IRNode.MUL_VS, ">0", IRNode.ADD_VS, ">0"})
public short[] vectorMulAdd() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -133,7 +133,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.MUL_V, ">0", IRNode.SUB_V, ">0"})
counts = {IRNode.MUL_VS, ">0", IRNode.SUB_VS, ">0"})
public short[] vectorMulSub() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -145,7 +145,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
// ---------------- Logic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.XOR_V, ">0"})
counts = {IRNode.XOR_VS, ">0"})
public short[] vectorNot() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -156,7 +156,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.AND_V, ">0"})
counts = {IRNode.AND_VS, ">0"})
public short[] vectorAnd() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -167,7 +167,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.OR_V, ">0"})
counts = {IRNode.OR_VS, ">0"})
public short[] vectorOr() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -178,7 +178,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.XOR_V, ">0"})
counts = {IRNode.XOR_VS, ">0"})
public short[] vectorXor() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -190,7 +190,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
// ---------------- Shift ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.LSHIFT_V, ">0"})
counts = {IRNode.LSHIFT_VS, ">0"})
public short[] vectorShiftLeft() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -201,7 +201,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.RSHIFT_V, ">0"})
counts = {IRNode.RSHIFT_VS, ">0"})
public short[] vectorSignedShiftRight() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -237,7 +237,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.RSHIFT_V, ">0"})
counts = {IRNode.RSHIFT_VS, ">0"})
public short[] vectorUnsignedShiftRight() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -249,7 +249,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
// ------------- ReverseBytes -------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"},
counts = {IRNode.REVERSE_BYTES_V, ">0"})
counts = {IRNode.REVERSE_BYTES_VS, ">0"})
public short[] reverseBytesWithShort() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {

View File

@@ -48,7 +48,7 @@ import java.util.Random;
public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
private static final int SIZE = 543;
private static final int SIZE = 6543;
private int[] ints;
private short[] shorts;
@@ -95,7 +95,7 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
counts = {IRNode.STORE_VECTOR, ">0"})
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
counts = {IRNode.MUL_V, ">0"})
counts = {IRNode.MUL_VI, ">0"})
public int[] indexMinusConstant() {
int[] res = new int[SIZE];
for (int i = SIZE / 2; i < SIZE; i++) {
@@ -108,7 +108,7 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.STORE_VECTOR, ">0"})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.MUL_V, ">0"})
counts = {IRNode.MUL_VI, ">0"})
public int[] indexPlusInvariant() {
int[] res = new int[SIZE];
System.arraycopy(ints, 0, res, 0, SIZE);
@@ -122,7 +122,7 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
counts = {IRNode.STORE_VECTOR, ">0"})
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
counts = {IRNode.MUL_V, ">0"})
counts = {IRNode.MUL_VI, ">0"})
public int[] indexMinusInvariant() {
int[] res = new int[SIZE];
System.arraycopy(ints, 0, res, 0, SIZE);
@@ -136,7 +136,7 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.STORE_VECTOR, ">0"})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4.1", "true"},
counts = {IRNode.MUL_V, ">0"})
counts = {IRNode.MUL_VI, ">0"})
public int[] indexWithInvariantAndConstant() {
int[] res = new int[SIZE];
System.arraycopy(ints, 0, res, 0, SIZE);
@@ -150,7 +150,7 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.STORE_VECTOR, ">0"})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
counts = {IRNode.SUB_V, ">0"})
counts = {IRNode.SUB_VI, ">0"})
public int[] indexWithTwoInvariants() {
int[] res = new int[SIZE];
System.arraycopy(ints, 0, res, 0, SIZE);

View File

@@ -79,9 +79,8 @@ public class LoopReductionOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse3", "true"},
counts = {IRNode.LOAD_VECTOR, ">0"})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse3", "true"},
counts = {IRNode.ADD_REDUCTION_V, ">0"})
counts = {IRNode.LOAD_VECTOR_I, ">0",
IRNode.ADD_REDUCTION_V, ">0"})
public int reductionAddSumOfArray() {
int res = 0;
for (int i = 0; i < SIZE; i++) {
@@ -121,9 +120,8 @@ public class LoopReductionOpTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
counts = {IRNode.LOAD_VECTOR, ">0"})
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
counts = {IRNode.ADD_REDUCTION_V, ">0"})
counts = {IRNode.LOAD_VECTOR_I, ">0",
IRNode.ADD_REDUCTION_V, ">0"})
public int reductionAddSumOfMultiple() {
int res = 0;
for (int i = 0; i < SIZE; i++) {

View File

@@ -119,6 +119,109 @@ public class IRExample {
public void compilePhases() {
iFld = 42;
}
// Rules for vector nodes.
@Test
// By default, we search for the maximal size possible
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
// We can also specify that we want the maximum explicitly
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_MAX, "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
// Explicitly take the maximum size for this type (here int)
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "max_for_type", "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
// Exlicitly take the maximum size for the int type
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "max_int", "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
// As a last resort, we can match with any size
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_ANY, "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
// Specify comma separated list of numbers, match for any of them
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "2,4,8,16,32,64", "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
// Two or more arguments to min(...): the minimal value is applied
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_for_type, max_int, LoopMaxUnroll, 64)", "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
static int[] testVectorNode() {
int[] a = new int[1024*8];
for (int i = 0; i < a.length; i++) {
a[i]++;
}
return a;
}
// Rules for vector nodes.
@Test
// By default, we search for the maximal size possible
@IR(counts = {IRNode.LOAD_VECTOR_F, "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
// In some cases, we can know the exact size, here 16
@IR(counts = {IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE_16, "> 0"},
applyIf = {"MaxVectorSize", "=64"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
@IR(counts = {IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE_8, "> 0"},
applyIf = {"MaxVectorSize", "=32"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
// In some cases, we can know the exact size, here 4
@IR(counts = {IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE_4, "> 0"},
applyIf = {"MaxVectorSize", "=16"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
static float[] testVectorNodeExactSize1() {
float[] a = new float[1024*8];
for (int i = 0; i < a.length; i++) {
a[i]++;
}
return a;
}
// Rules for vector nodes. Same as badTestVectorNodeSize but with good rules.
@Test
// In some cases, we can know the exact size, here 4
@IR(counts = {IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE_4, "> 0"},
applyIf = {"MaxVectorSize", ">=16"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
// Hence, we know any other sizes are impossible.
// We can also specify that explicitly for failOn
@IR(failOn = {IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE_2,
IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE_8,
IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE_16,
IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE_32,
IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE_64,
IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "2,8,16,32,64"},
applyIf = {"MaxVectorSize", ">=16"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
static float[] testVectorNodeExactSize2() {
float[] a = new float[1024*8];
for (int i = 0; i < a.length/8; i++) {
a[i*8 + 0]++; // block of 4, then gap of 4
a[i*8 + 1]++;
a[i*8 + 2]++;
a[i*8 + 3]++;
}
return a;
}
@Test
// Here, we can pack at most 8 given the 8-blocks and 8-gaps.
// But we can also never pack more than max_float
@IR(counts = {IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(8, max_float)", "> 0"},
applyIf = {"MaxVectorSize", ">=16"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
static float[] testVectorNodeSizeMinClause() {
float[] a = new float[1024*8];
for (int i = 0; i < a.length/16; i++) {
a[i*16 + 0]++; // block of 8, then gap of 8
a[i*16 + 1]++;
a[i*16 + 2]++;
a[i*16 + 3]++;
a[i*16 + 4]++;
a[i*16 + 5]++;
a[i*16 + 6]++;
a[i*16 + 7]++;
}
return a;
}
}
class FailingExamples {
@@ -194,4 +297,29 @@ class FailingExamples {
public void badStandAloneNotCompiled() {
testNotCompiled();
}
// Failing rules for vector nodes. Same as testVectorNodeExactSize2 but with bad rules.
@Test
// By default we look for the IRNode.VECTOR_SIZE_MAX, which is more than 4.
@IR(counts = {IRNode.LOAD_VECTOR_F, "> 0"},
applyIf = {"MaxVectorSize", ">16"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
// By default, we look for IRNode.VECTOR_SIZE_ANY. But there are some of size 4.
@IR(failOn = {IRNode.LOAD_VECTOR_F},
applyIf = {"MaxVectorSize", ">=16"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
// By default, we look for IRNode.VECTOR_SIZE_ANY. But there are at least two of size 4.
@IR(counts = {IRNode.LOAD_VECTOR_F, "<2"},
applyIf = {"MaxVectorSize", ">=16"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
static float[] badTestVectorNodeSize() {
float[] a = new float[1024*8];
for (int i = 0; i < a.length/8; i++) {
a[i*8 + 0]++; // block of 4, then gap of 4
a[i*8 + 1]++;
a[i*8 + 2]++;
a[i*8 + 3]++;
}
return a;
}
}

View File

@@ -999,7 +999,7 @@ class BadIRAnnotationsAfterTestVM {
public void missingCountString() {}
@Test
@FailCount(45)
@FailCount(51)
@IR(counts = {IRNode.STORE, IRNode.STORE})
@IR(counts = {IRNode.STORE, IRNode.STORE, IRNode.STORE, IRNode.STORE})
@IR(counts = {IRNode.STORE_OF_CLASS, "Foo", IRNode.STORE})
@@ -1025,6 +1025,12 @@ class BadIRAnnotationsAfterTestVM {
@IR(counts = {IRNode.STORE, " > 3.0"})
@IR(counts = {IRNode.STORE, " > a3"})
@IR(counts = {IRNode.STORE, " > 0x1"})
@IR(counts = {IRNode.STORE, "!= 1000"})
@IR(counts = {IRNode.STORE, "< 0"})
@IR(counts = {IRNode.STORE, "< 1"})
@IR(counts = {IRNode.STORE, "<= 0"})
@IR(counts = {IRNode.STORE, "> -1"})
@IR(counts = {IRNode.STORE, ">= 0"})
@IR(counts = {IRNode.STORE_OF_CLASS, "Foo", "<"})
@IR(counts = {IRNode.STORE_OF_CLASS, "Foo", "!"})
@IR(counts = {IRNode.STORE_OF_CLASS, "Foo", "!3"})
@@ -1046,6 +1052,38 @@ class BadIRAnnotationsAfterTestVM {
@IR(counts = {IRNode.STORE_OF_CLASS, "Foo", " > a3"})
@IR(counts = {IRNode.STORE_OF_CLASS, "Foo", " > 0x1"})
public void wrongCountString() {}
@Test
@FailCount(8)
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_MAX, "> 0"}, // valid
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_ANY, "> 0"}, // valid
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "", "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "xxx", "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min()", "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_for_type)", "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "2,4,8,16,32,64,max_int", "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "2,4,8,16,32,64,-3", "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_for_type, xxx)", "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_for_type, min(max_for_type, max_for_type))", "> 0"},
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
public int[] badVectorNodeSize() {
int[] a = new int[1024*8];
for (int i = 0; i < a.length; i++) {
a[i]++;
}
return a;
}
}
class BadIRNodeForPhase {
@@ -1096,18 +1134,18 @@ class BadIRNodeForPhase {
@Test
@FailCount(6)
@IR(failOn = IRNode.LOAD_VECTOR, phase = CompilePhase.BEFORE_REMOVEUSELESS) // works
@IR(failOn = IRNode.LOAD_VECTOR_I, phase = CompilePhase.BEFORE_REMOVEUSELESS) // works
@IR(failOn = IRNode.STORE_VECTOR, phase = CompilePhase.BEFORE_REMOVEUSELESS) // works
@IR(failOn = IRNode.VECTOR_CAST_B2X, phase = CompilePhase.BEFORE_REMOVEUSELESS) // works
@IR(failOn = IRNode.LOAD_VECTOR, phase = CompilePhase.BEFORE_MATCHING) // works
@IR(failOn = IRNode.VECTOR_CAST_B2I, phase = CompilePhase.BEFORE_REMOVEUSELESS) // works
@IR(failOn = IRNode.LOAD_VECTOR_I, phase = CompilePhase.BEFORE_MATCHING) // works
@IR(failOn = IRNode.STORE_VECTOR, phase = CompilePhase.BEFORE_MATCHING) // works
@IR(failOn = IRNode.VECTOR_CAST_B2X, phase = CompilePhase.BEFORE_MATCHING) // works
@IR(failOn = IRNode.LOAD_VECTOR, phase = {CompilePhase.MATCHING, CompilePhase.MATCHING})
@IR(failOn = IRNode.VECTOR_CAST_B2I, phase = CompilePhase.BEFORE_MATCHING) // works
@IR(failOn = IRNode.LOAD_VECTOR_I, phase = {CompilePhase.MATCHING, CompilePhase.MATCHING})
@IR(failOn = IRNode.STORE_VECTOR, phase = {CompilePhase.MATCHING, CompilePhase.MATCHING})
@IR(failOn = IRNode.VECTOR_CAST_B2X, phase = {CompilePhase.MATCHING, CompilePhase.MATCHING})
@IR(failOn = IRNode.LOAD_VECTOR, phase = CompilePhase.FINAL_CODE)
@IR(failOn = IRNode.VECTOR_CAST_B2I, phase = {CompilePhase.MATCHING, CompilePhase.MATCHING})
@IR(failOn = IRNode.LOAD_VECTOR_I, phase = CompilePhase.FINAL_CODE)
@IR(failOn = IRNode.STORE_VECTOR, phase = CompilePhase.FINAL_CODE)
@IR(failOn = IRNode.VECTOR_CAST_B2X, phase = CompilePhase.FINAL_CODE)
@IR(failOn = IRNode.VECTOR_CAST_B2I, phase = CompilePhase.FINAL_CODE)
public void vector() {}
@Test

View File

@@ -100,12 +100,12 @@ public class TestIRMatching {
GoodFailOnRegexConstraint.create(MultipleFailOnBad.class, "fail10()", 1, 2, 3)
);
runCheck(BadCountsConstraint.create(BadCount.class, "bad1()", 1, 1, "Load"),
runCheck(BadCountsConstraint.create(BadCount.class, "bad1()", 1, 2, "Load"),
GoodCountsConstraint.create(BadCount.class, "bad1()", 2),
GoodCountsConstraint.create(BadCount.class, "bad2()", 1),
BadCountsConstraint.create(BadCount.class, "bad2()", 2, 1, "Store"),
BadCountsConstraint.create(BadCount.class, "bad3()", 1, 1, "Load"),
BadCountsConstraint.create(BadCount.class, "bad3()", 2, 1, "Store")
BadCountsConstraint.create(BadCount.class, "bad2()", 2, 2, "Store"),
BadCountsConstraint.create(BadCount.class, "bad3()", 1, 2, "Load"),
BadCountsConstraint.create(BadCount.class, "bad3()", 2, 2, "Store")
);
runCheck(GoodRuleConstraint.create(Calls.class, "calls()", 1),
@@ -629,10 +629,6 @@ class CountComparisons {
IRNode.STORE, "<=1",
IRNode.STORE, " <= 1",
IRNode.STORE, " <= 1",
IRNode.STORE, "!= 0",
IRNode.STORE, "!=0",
IRNode.STORE, " != 0",
IRNode.STORE, " != 0",
IRNode.STORE, "> 0",
IRNode.STORE, ">0",
IRNode.STORE, " > 0",
@@ -823,27 +819,32 @@ class GoodCount {
class BadCount {
int iFld;
int iFld2;
int result;
int result2;
@Test
@IR(counts = {IRNode.LOAD, "!= 1"}) // fail
@IR(counts = {IRNode.LOAD, "> 1000"}) // fail
@IR(counts = {IRNode.STORE, "> 0"})
public void bad1() {
result = iFld;
result2 = iFld2;
}
@Test
@IR(counts = {IRNode.LOAD, "1"}) // fail
@IR(counts = {IRNode.STORE, "< 1"})
@IR(counts = {IRNode.LOAD, "2"}) // fail
@IR(counts = {IRNode.STORE, "< 2"})
public void bad2() {
result = iFld;
result2 = iFld2;
}
@Test
@IR(counts = {IRNode.LOAD, "0"}) // fail
@IR(counts = {IRNode.STORE, " <= 0"}) // fail
@IR(counts = {IRNode.STORE, " <= 1"}) // fail
public void bad3() {
result = iFld;
result2 = iFld2;
}
}

View File

@@ -75,6 +75,15 @@ public class TestSafepointWhilePrinting {
testCompilePhaseBackToBackFirst,1
testCompilePhaseBackToBackLast,1
----- END -----
##### IRMatchingVMInfo - used by TestFramework #####
<key>:<value>
cpuFeatures:empty_cpu_info
MaxVectorSize:64
MaxVectorSizeIsDefault:1
LoopMaxUnroll:64
UseAVX:1
UseAVXIsDefault:1
----- END VMInfo -----
""";
TestClassParser testClassParser = new TestClassParser(TestSafepointWhilePrinting.class);
Matchable testClassMatchable = testClassParser.parse(hotspotPidFileName, irEncoding);