8298632: [TESTBUG] Add IR checks in jtreg vectorization tests
Reviewed-by: kvn, jbhateja
This commit is contained in:
parent
910dffea86
commit
715b509f3d
@ -130,6 +130,12 @@ public class IRNode {
|
|||||||
static {
|
static {
|
||||||
beforeMatchingNameRegex(ABS_L, "AbsL");
|
beforeMatchingNameRegex(ABS_L, "AbsL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ABS_V = PREFIX + "ABS_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(ABS_V, "AbsV(B|S|I|L|F|D)");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String ADD = PREFIX + "ADD" + POSTFIX;
|
public static final String ADD = PREFIX + "ADD" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
beforeMatchingNameRegex(ADD, "Add(I|L|F|D|P)");
|
beforeMatchingNameRegex(ADD, "Add(I|L|F|D|P)");
|
||||||
@ -145,6 +151,11 @@ public class IRNode {
|
|||||||
beforeMatchingNameRegex(ADD_L, "AddL");
|
beforeMatchingNameRegex(ADD_L, "AddL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ADD_V = PREFIX + "ADD_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(ADD_V, "AddV(B|S|I|L|F|D)");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String ADD_VD = PREFIX + "ADD_VD" + POSTFIX;
|
public static final String ADD_VD = PREFIX + "ADD_VD" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
beforeMatchingNameRegex(ADD_VD, "AddVD");
|
beforeMatchingNameRegex(ADD_VD, "AddVD");
|
||||||
@ -155,6 +166,11 @@ public class IRNode {
|
|||||||
beforeMatchingNameRegex(ADD_VI, "AddVI");
|
beforeMatchingNameRegex(ADD_VI, "AddVI");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ADD_REDUCTION_V = PREFIX + "ADD_REDUCTION_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(ADD_REDUCTION_V, "AddReductionV(B|S|I|L|F|D)");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String ADD_REDUCTION_VD = PREFIX + "ADD_REDUCTION_VD" + POSTFIX;
|
public static final String ADD_REDUCTION_VD = PREFIX + "ADD_REDUCTION_VD" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
superWordNodes(ADD_REDUCTION_VD, "AddReductionVD");
|
superWordNodes(ADD_REDUCTION_VD, "AddReductionVD");
|
||||||
@ -360,6 +376,11 @@ public class IRNode {
|
|||||||
beforeMatchingNameRegex(DIV_L, "DivL");
|
beforeMatchingNameRegex(DIV_L, "DivL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String DIV_V = PREFIX + "DIV_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(DIV_V, "DivV(F|D)");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String DYNAMIC_CALL_OF_METHOD = COMPOSITE_PREFIX + "DYNAMIC_CALL_OF_METHOD" + POSTFIX;
|
public static final String DYNAMIC_CALL_OF_METHOD = COMPOSITE_PREFIX + "DYNAMIC_CALL_OF_METHOD" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
callOfNodes(DYNAMIC_CALL_OF_METHOD, "CallDynamicJava");
|
callOfNodes(DYNAMIC_CALL_OF_METHOD, "CallDynamicJava");
|
||||||
@ -387,6 +408,11 @@ public class IRNode {
|
|||||||
optoOnly(FIELD_ACCESS, regex);
|
optoOnly(FIELD_ACCESS, regex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String FMA_V = PREFIX + "FMA_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(FMA_V, "FmaV(F|D)");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String IF = PREFIX + "IF" + POSTFIX;
|
public static final String IF = PREFIX + "IF" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
beforeMatchingNameRegex(IF, "If\\b");
|
beforeMatchingNameRegex(IF, "If\\b");
|
||||||
@ -588,6 +614,11 @@ public class IRNode {
|
|||||||
beforeMatchingNameRegex(LSHIFT_L, "LShiftL");
|
beforeMatchingNameRegex(LSHIFT_L, "LShiftL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String LSHIFT_V = PREFIX + "LSHIFT_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(LSHIFT_V, "LShiftV(B|S|I|L)");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String MACRO_LOGIC_V = PREFIX + "MACRO_LOGIC_V" + POSTFIX;
|
public static final String MACRO_LOGIC_V = PREFIX + "MACRO_LOGIC_V" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
afterBarrierExpansionToBeforeMatching(MACRO_LOGIC_V, "MacroLogicV");
|
afterBarrierExpansionToBeforeMatching(MACRO_LOGIC_V, "MacroLogicV");
|
||||||
@ -658,6 +689,11 @@ public class IRNode {
|
|||||||
beforeMatchingNameRegex(MUL_L, "MulL");
|
beforeMatchingNameRegex(MUL_L, "MulL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String MUL_V = PREFIX + "MUL_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(MUL_V, "MulV(B|S|I|L|F|D)");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String MUL_VL = PREFIX + "MUL_VL" + POSTFIX;
|
public static final String MUL_VL = PREFIX + "MUL_VL" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
beforeMatchingNameRegex(MUL_VL, "MulVL");
|
beforeMatchingNameRegex(MUL_VL, "MulVL");
|
||||||
@ -673,6 +709,11 @@ public class IRNode {
|
|||||||
superWordNodes(MUL_REDUCTION_VF, "MulReductionVF");
|
superWordNodes(MUL_REDUCTION_VF, "MulReductionVF");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String NEG_V = PREFIX + "NEG_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(NEG_V, "NegV(F|D)");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String NULL_ASSERT_TRAP = PREFIX + "NULL_ASSERT_TRAP" + POSTFIX;
|
public static final String NULL_ASSERT_TRAP = PREFIX + "NULL_ASSERT_TRAP" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
trapNodes(NULL_ASSERT_TRAP,"null_assert");
|
trapNodes(NULL_ASSERT_TRAP,"null_assert");
|
||||||
@ -709,6 +750,11 @@ public class IRNode {
|
|||||||
beforeMatchingNameRegex(POPCOUNT_L, "PopCountL");
|
beforeMatchingNameRegex(POPCOUNT_L, "PopCountL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String POPCOUNT_VI = PREFIX + "POPCOUNT_VI" + POSTFIX;
|
||||||
|
static {
|
||||||
|
superWordNodes(POPCOUNT_VI, "PopCountVI");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String POPCOUNT_VL = PREFIX + "POPCOUNT_VL" + POSTFIX;
|
public static final String POPCOUNT_VL = PREFIX + "POPCOUNT_VL" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
superWordNodes(POPCOUNT_VL, "PopCountVL");
|
superWordNodes(POPCOUNT_VL, "PopCountVL");
|
||||||
@ -742,6 +788,54 @@ public class IRNode {
|
|||||||
trapNodes(RANGE_CHECK_TRAP,"range_check");
|
trapNodes(RANGE_CHECK_TRAP,"range_check");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String REPLICATE_B = PREFIX + "REPLICATE_B" + POSTFIX;
|
||||||
|
static {
|
||||||
|
String regex = START + "ReplicateB" + MID + END;
|
||||||
|
IR_NODE_MAPPINGS.put(REPLICATE_B, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
|
||||||
|
CompilePhase.AFTER_CLOOPS,
|
||||||
|
CompilePhase.BEFORE_MATCHING));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String REPLICATE_S = PREFIX + "REPLICATE_S" + POSTFIX;
|
||||||
|
static {
|
||||||
|
String regex = START + "ReplicateS" + MID + END;
|
||||||
|
IR_NODE_MAPPINGS.put(REPLICATE_S, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
|
||||||
|
CompilePhase.AFTER_CLOOPS,
|
||||||
|
CompilePhase.BEFORE_MATCHING));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String REPLICATE_I = PREFIX + "REPLICATE_I" + POSTFIX;
|
||||||
|
static {
|
||||||
|
String regex = START + "ReplicateI" + MID + END;
|
||||||
|
IR_NODE_MAPPINGS.put(REPLICATE_I, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
|
||||||
|
CompilePhase.AFTER_CLOOPS,
|
||||||
|
CompilePhase.BEFORE_MATCHING));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String REPLICATE_L = PREFIX + "REPLICATE_L" + POSTFIX;
|
||||||
|
static {
|
||||||
|
String regex = START + "ReplicateL" + MID + END;
|
||||||
|
IR_NODE_MAPPINGS.put(REPLICATE_L, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
|
||||||
|
CompilePhase.AFTER_CLOOPS,
|
||||||
|
CompilePhase.BEFORE_MATCHING));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String REPLICATE_F = PREFIX + "REPLICATE_F" + POSTFIX;
|
||||||
|
static {
|
||||||
|
String regex = START + "ReplicateF" + MID + END;
|
||||||
|
IR_NODE_MAPPINGS.put(REPLICATE_F, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
|
||||||
|
CompilePhase.AFTER_CLOOPS,
|
||||||
|
CompilePhase.BEFORE_MATCHING));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String REPLICATE_D = PREFIX + "REPLICATE_D" + POSTFIX;
|
||||||
|
static {
|
||||||
|
String regex = START + "ReplicateD" + MID + END;
|
||||||
|
IR_NODE_MAPPINGS.put(REPLICATE_D, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
|
||||||
|
CompilePhase.AFTER_CLOOPS,
|
||||||
|
CompilePhase.BEFORE_MATCHING));
|
||||||
|
}
|
||||||
|
|
||||||
public static final String REVERSE_BYTES_V = PREFIX + "REVERSE_BYTES_V" + POSTFIX;
|
public static final String REVERSE_BYTES_V = PREFIX + "REVERSE_BYTES_V" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
beforeMatchingNameRegex(REVERSE_BYTES_V, "ReverseBytesV");
|
beforeMatchingNameRegex(REVERSE_BYTES_V, "ReverseBytesV");
|
||||||
@ -782,6 +876,21 @@ public class IRNode {
|
|||||||
beforeMatchingNameRegex(ROTATE_RIGHT, "RotateRight");
|
beforeMatchingNameRegex(ROTATE_RIGHT, "RotateRight");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ROTATE_LEFT_V = PREFIX + "ROTATE_LEFT_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(ROTATE_LEFT_V, "RotateLeftV");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String ROTATE_RIGHT_V = PREFIX + "ROTATE_RIGHT_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(ROTATE_RIGHT_V, "RotateRightV");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String ROUND_DOUBLE_MODE_V = PREFIX + "ROUND_DOUBLE_MODE_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(ROUND_DOUBLE_MODE_V, "RoundDoubleModeV");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String RSHIFT = PREFIX + "RSHIFT" + POSTFIX;
|
public static final String RSHIFT = PREFIX + "RSHIFT" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
beforeMatchingNameRegex(RSHIFT, "RShift(I|L)");
|
beforeMatchingNameRegex(RSHIFT, "RShift(I|L)");
|
||||||
@ -807,6 +916,11 @@ public class IRNode {
|
|||||||
beforeMatchingNameRegex(RSHIFT_VS, "RShiftVS");
|
beforeMatchingNameRegex(RSHIFT_VS, "RShiftVS");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String RSHIFT_V = PREFIX + "RSHIFT_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(RSHIFT_V, "RShiftV(B|S|I|L)");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String SAFEPOINT = PREFIX + "SAFEPOINT" + POSTFIX;
|
public static final String SAFEPOINT = PREFIX + "SAFEPOINT" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
beforeMatchingNameRegex(SAFEPOINT, "SafePoint");
|
beforeMatchingNameRegex(SAFEPOINT, "SafePoint");
|
||||||
@ -828,6 +942,11 @@ public class IRNode {
|
|||||||
beforeMatchingNameRegex(SIGNUM_VF, "SignumVF");
|
beforeMatchingNameRegex(SIGNUM_VF, "SignumVF");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String SQRT_V = PREFIX + "SQRT_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(SQRT_V, "SqrtV(F|D)");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String STORE = PREFIX + "STORE" + POSTFIX;
|
public static final String STORE = PREFIX + "STORE" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
beforeMatchingNameRegex(STORE, "Store(B|C|S|I|L|F|D|P|N)");
|
beforeMatchingNameRegex(STORE, "Store(B|C|S|I|L|F|D|P|N)");
|
||||||
@ -964,6 +1083,11 @@ public class IRNode {
|
|||||||
beforeMatchingNameRegex(SUB_L, "SubL");
|
beforeMatchingNameRegex(SUB_L, "SubL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String SUB_V = PREFIX + "SUB_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(SUB_V, "SubV(B|S|I|L|F|D)");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String TRAP = PREFIX + "TRAP" + POSTFIX;
|
public static final String TRAP = PREFIX + "TRAP" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
trapNodes(TRAP,"reason");
|
trapNodes(TRAP,"reason");
|
||||||
@ -1034,6 +1158,11 @@ public class IRNode {
|
|||||||
beforeMatchingNameRegex(URSHIFT_S, "URShiftS");
|
beforeMatchingNameRegex(URSHIFT_S, "URShiftS");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String URSHIFT_V = PREFIX + "URSHIFT_V" + POSTFIX;
|
||||||
|
static {
|
||||||
|
beforeMatchingNameRegex(URSHIFT_V, "URShiftV(B|S|I|L)");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String VAND_NOT_I = PREFIX + "VAND_NOT_I" + POSTFIX;
|
public static final String VAND_NOT_I = PREFIX + "VAND_NOT_I" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
machOnlyNameRegex(VAND_NOT_I, "vand_notI");
|
machOnlyNameRegex(VAND_NOT_I, "vand_notI");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,9 +40,11 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
public class ArrayCopyTest extends VectorizationTestRunner {
|
public class ArrayCopyTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private byte[] bytes;
|
private byte[] bytes;
|
||||||
private short[] shorts;
|
private short[] shorts;
|
||||||
@ -73,6 +75,8 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Simple Copy ----------------
|
// ---------------- Simple Copy ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public byte[] copyByteArray() {
|
public byte[] copyByteArray() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -82,6 +86,8 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public short[] copyShortArray() {
|
public short[] copyShortArray() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -91,6 +97,8 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public char[] copyCharArray() {
|
public char[] copyCharArray() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -100,6 +108,8 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] copyIntArray() {
|
public int[] copyIntArray() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -109,6 +119,8 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public long[] copyLongArray() {
|
public long[] copyLongArray() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -118,6 +130,8 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public float[] copyFloatArray() {
|
public float[] copyFloatArray() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -127,6 +141,8 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public double[] copyDoubleArray() {
|
public double[] copyDoubleArray() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -137,6 +153,8 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Multiple Copies ----------------
|
// ---------------- Multiple Copies ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public float[] chainedCopy() {
|
public float[] chainedCopy() {
|
||||||
float[] res1 = new float[SIZE];
|
float[] res1 = new float[SIZE];
|
||||||
float[] res2 = new float[SIZE];
|
float[] res2 = new float[SIZE];
|
||||||
@ -147,6 +165,8 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] copy2ArraysSameSize() {
|
public int[] copy2ArraysSameSize() {
|
||||||
int[] res1 = new int[SIZE];
|
int[] res1 = new int[SIZE];
|
||||||
float[] res2 = new float[SIZE];
|
float[] res2 = new float[SIZE];
|
||||||
@ -158,6 +178,8 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public double[] copy2ArraysDifferentSizes() {
|
public double[] copy2ArraysDifferentSizes() {
|
||||||
int[] res1 = new int[SIZE];
|
int[] res1 = new int[SIZE];
|
||||||
double[] res2 = new double[SIZE];
|
double[] res2 = new double[SIZE];
|
||||||
@ -170,6 +192,8 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Copy Between Signed & Unsigned ----------------
|
// ---------------- Copy Between Signed & Unsigned ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public char[] copyFromSignedToUnsigned() {
|
public char[] copyFromSignedToUnsigned() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -179,6 +203,8 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public short[] copyFromUnsignedToSigned() {
|
public short[] copyFromUnsignedToSigned() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -187,4 +213,3 @@ public class ArrayCopyTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,9 +40,11 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
public class ArrayIndexFillTest extends VectorizationTestRunner {
|
public class ArrayIndexFillTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private int[] a;
|
private int[] a;
|
||||||
|
|
||||||
@ -54,6 +56,8 @@ public class ArrayIndexFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
|
||||||
|
counts = {IRNode.POPULATE_INDEX, ">0"})
|
||||||
public byte[] fillByteArray() {
|
public byte[] fillByteArray() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -63,6 +67,8 @@ public class ArrayIndexFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
|
||||||
|
counts = {IRNode.POPULATE_INDEX, ">0"})
|
||||||
public short[] fillShortArray() {
|
public short[] fillShortArray() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -72,6 +78,8 @@ public class ArrayIndexFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
|
||||||
|
counts = {IRNode.POPULATE_INDEX, ">0"})
|
||||||
public char[] fillCharArray() {
|
public char[] fillCharArray() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -81,6 +89,8 @@ public class ArrayIndexFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
|
||||||
|
counts = {IRNode.POPULATE_INDEX, ">0"})
|
||||||
public int[] fillIntArray() {
|
public int[] fillIntArray() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -99,6 +109,8 @@ public class ArrayIndexFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
|
||||||
|
counts = {IRNode.POPULATE_INDEX, ">0"})
|
||||||
public short[] fillShortArrayWithShortIndex() {
|
public short[] fillShortArrayWithShortIndex() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (short i = 0; i < SIZE; i++) {
|
for (short i = 0; i < SIZE; i++) {
|
||||||
@ -108,6 +120,8 @@ public class ArrayIndexFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
|
||||||
|
counts = {IRNode.POPULATE_INDEX, ">0"})
|
||||||
public int[] fillMultipleArraysDifferentTypes1() {
|
public int[] fillMultipleArraysDifferentTypes1() {
|
||||||
int[] res1 = new int[SIZE];
|
int[] res1 = new int[SIZE];
|
||||||
short[] res2 = new short[SIZE];
|
short[] res2 = new short[SIZE];
|
||||||
@ -119,6 +133,8 @@ public class ArrayIndexFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
|
||||||
|
counts = {IRNode.POPULATE_INDEX, ">0"})
|
||||||
public char[] fillMultipleArraysDifferentTypes2() {
|
public char[] fillMultipleArraysDifferentTypes2() {
|
||||||
int[] res1 = new int[SIZE];
|
int[] res1 = new int[SIZE];
|
||||||
char[] res2 = new char[SIZE];
|
char[] res2 = new char[SIZE];
|
||||||
@ -139,4 +155,3 @@ public class ArrayIndexFillTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -41,11 +41,13 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private int intInv;
|
private int intInv;
|
||||||
private char charInv;
|
private char charInv;
|
||||||
@ -62,6 +64,8 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Simple Fill ----------------
|
// ---------------- Simple Fill ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.REPLICATE_B, ">0"})
|
||||||
public byte[] fillByteArray() {
|
public byte[] fillByteArray() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -71,6 +75,8 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.REPLICATE_S, ">0"})
|
||||||
public short[] fillShortArray() {
|
public short[] fillShortArray() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -80,6 +86,8 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.REPLICATE_S, ">0"})
|
||||||
public char[] fillCharArray() {
|
public char[] fillCharArray() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -89,6 +97,8 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.REPLICATE_I, ">0"})
|
||||||
public int[] fillIntArray() {
|
public int[] fillIntArray() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -98,6 +108,8 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.REPLICATE_L, ">0"})
|
||||||
public long[] fillLongArray() {
|
public long[] fillLongArray() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -107,6 +119,8 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.REPLICATE_F, ">0"})
|
||||||
public float[] fillFloatArray() {
|
public float[] fillFloatArray() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -116,6 +130,8 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.REPLICATE_D, ">0"})
|
||||||
public double[] fillDoubleArray() {
|
public double[] fillDoubleArray() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -126,6 +142,8 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Fill With Type Change ----------------
|
// ---------------- Fill With Type Change ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.REPLICATE_L, ">0"})
|
||||||
public long[] fillLongArrayWithInt() {
|
public long[] fillLongArrayWithInt() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -135,6 +153,8 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.REPLICATE_L, ">0"})
|
||||||
public long[] fillLongArrayWithUnsigned() {
|
public long[] fillLongArrayWithUnsigned() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -144,6 +164,8 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.REPLICATE_L, ">0"})
|
||||||
public long[] fillLongArrayWithFloat() {
|
public long[] fillLongArrayWithFloat() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -153,6 +175,8 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.REPLICATE_I, ">0"})
|
||||||
public int[] fillIntArrayWithDouble() {
|
public int[] fillIntArrayWithDouble() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -161,4 +185,3 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,11 +40,13 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class ArrayShiftOpTest extends VectorizationTestRunner {
|
public class ArrayShiftOpTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private int[] ints;
|
private int[] ints;
|
||||||
private long[] longs;
|
private long[] longs;
|
||||||
@ -68,6 +70,10 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
|
@IR(applyIfCPUFeature = {"avx512f", "true"},
|
||||||
|
counts = {IRNode.ROTATE_RIGHT_V, ">0"})
|
||||||
public int[] intCombinedRotateShift() {
|
public int[] intCombinedRotateShift() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -77,6 +83,10 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
|
@IR(applyIfCPUFeature = {"avx512f", "true"},
|
||||||
|
counts = {IRNode.ROTATE_RIGHT_V, ">0"})
|
||||||
public long[] longCombinedRotateShift() {
|
public long[] longCombinedRotateShift() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -86,6 +96,8 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.RSHIFT_V, ">0"})
|
||||||
public int[] intShiftLargeDistConstant() {
|
public int[] intShiftLargeDistConstant() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -95,6 +107,8 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.RSHIFT_V, ">0"})
|
||||||
public int[] intShiftLargeDistInvariant() {
|
public int[] intShiftLargeDistInvariant() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -104,6 +118,30 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.RSHIFT_V, ">0"})
|
||||||
|
public short[] shortShiftLargeDistConstant() {
|
||||||
|
short[] res = new short[SIZE];
|
||||||
|
for (int i = 0; i < SIZE; i++) {
|
||||||
|
res[i] = (short) (shorts1[i] >> 65);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.RSHIFT_V, ">0"})
|
||||||
|
public short[] shortShiftLargeDistInvariant() {
|
||||||
|
short[] res = new short[SIZE];
|
||||||
|
for (int i = 0; i < SIZE; i++) {
|
||||||
|
res[i] = (short) (shorts2[i] >> (largeDist - 25));
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.LSHIFT_V, ">0"})
|
||||||
public long[] longShiftLargeDistConstant() {
|
public long[] longShiftLargeDistConstant() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -113,6 +151,8 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.URSHIFT_V, ">0"})
|
||||||
public long[] longShiftLargeDistInvariant() {
|
public long[] longShiftLargeDistInvariant() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -122,8 +162,8 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Note that any shift operation with distance value from another array
|
// Note that shift with variant distance cannot be vectorized.
|
||||||
// cannot be vectorized since C2 vector shift node doesn't support it.
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public long[] variantShiftDistance() {
|
public long[] variantShiftDistance() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -133,6 +173,19 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
// Note that shift with variant distance cannot be vectorized.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
|
public short[] loopIndexShiftDistance() {
|
||||||
|
short[] res = new short[SIZE];
|
||||||
|
for (int i = 0; i < SIZE; i++) {
|
||||||
|
res[i] = (short) (shorts1[i] >> i);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.RSHIFT_V, ">0"})
|
||||||
public short[] vectorUnsignedShiftRight() {
|
public short[] vectorUnsignedShiftRight() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -143,7 +196,8 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Note that right shift operations on subword expressions cannot be
|
// Note that right shift operations on subword expressions cannot be
|
||||||
// vectorized since precise type info about signness is missing.
|
// vectorized since precise type info about signedness is missing.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public short[] subwordExpressionRightShift() {
|
public short[] subwordExpressionRightShift() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -152,4 +206,3 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,9 +40,11 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private byte[] bytes;
|
private byte[] bytes;
|
||||||
private short[] shorts;
|
private short[] shorts;
|
||||||
@ -129,6 +131,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Convert I/L to F/D ----------------
|
// ---------------- Convert I/L to F/D ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_I2X, ">0"})
|
||||||
public float[] convertIntToFloat() {
|
public float[] convertIntToFloat() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -138,6 +142,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_I2X, ">0"})
|
||||||
public double[] convertIntToDouble() {
|
public double[] convertIntToDouble() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -147,6 +153,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx512dq", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_L2X, ">0"})
|
||||||
public float[] convertLongToFloat() {
|
public float[] convertLongToFloat() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -156,6 +164,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx512dq", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_L2X, ">0"})
|
||||||
public double[] convertLongToDouble() {
|
public double[] convertLongToDouble() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -166,6 +176,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Convert Subword-I to F/D ----------------
|
// ---------------- Convert Subword-I to F/D ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_S2X, ">0"})
|
||||||
public float[] convertShortToFloat() {
|
public float[] convertShortToFloat() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -175,6 +187,9 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
|
||||||
|
applyIf = {"MaxVectorSize", ">=32"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_S2X, ">0"})
|
||||||
public double[] convertShortToDouble() {
|
public double[] convertShortToDouble() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -203,6 +218,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Convert F/D to I/L ----------------
|
// ---------------- Convert F/D to I/L ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_F2X, ">0"})
|
||||||
public int[] convertFloatToInt() {
|
public int[] convertFloatToInt() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -212,6 +229,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx512dq", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_F2X, ">0"})
|
||||||
public long[] convertFloatToLong() {
|
public long[] convertFloatToLong() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -221,6 +240,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_D2X, ">0"})
|
||||||
public int[] convertDoubleToInt() {
|
public int[] convertDoubleToInt() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -230,6 +251,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx512dq", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_D2X, ">0"})
|
||||||
public long[] convertDoubleToLong() {
|
public long[] convertDoubleToLong() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -240,6 +263,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Convert F/D to Subword-I ----------------
|
// ---------------- Convert F/D to Subword-I ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_F2X, ">0"})
|
||||||
public short[] convertFloatToShort() {
|
public short[] convertFloatToShort() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -249,6 +274,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_F2X, ">0"})
|
||||||
public char[] convertFloatToChar() {
|
public char[] convertFloatToChar() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -258,6 +285,9 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx", "true"},
|
||||||
|
applyIf = {"MaxVectorSize", ">=32"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_D2X, ">0"})
|
||||||
public short[] convertDoubleToShort() {
|
public short[] convertDoubleToShort() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -267,6 +297,9 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx", "true"},
|
||||||
|
applyIf = {"MaxVectorSize", ">=32"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_D2X, ">0"})
|
||||||
public char[] convertDoubleToChar() {
|
public char[] convertDoubleToChar() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -277,6 +310,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Convert Between F & D ----------------
|
// ---------------- Convert Between F & D ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_F2X, ">0"})
|
||||||
public double[] convertFloatToDouble() {
|
public double[] convertFloatToDouble() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -286,6 +321,8 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
|
||||||
|
counts = {IRNode.VECTOR_CAST_D2X, ">0"})
|
||||||
public float[] convertDoubleToFloat() {
|
public float[] convertDoubleToFloat() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -294,4 +331,3 @@ public class ArrayTypeConvertTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,13 +40,15 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import sun.misc.Unsafe;
|
import sun.misc.Unsafe;
|
||||||
|
|
||||||
public class ArrayUnsafeOpTest extends VectorizationTestRunner {
|
public class ArrayUnsafeOpTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private static Unsafe unsafe;
|
private static Unsafe unsafe;
|
||||||
|
|
||||||
@ -92,6 +94,7 @@ public class ArrayUnsafeOpTest extends VectorizationTestRunner {
|
|||||||
// Note that this case cannot be vectorized since data dependence
|
// Note that this case cannot be vectorized since data dependence
|
||||||
// exists between adjacent iterations. (The memory address storing
|
// exists between adjacent iterations. (The memory address storing
|
||||||
// an int array is not increased by 4 per iteration.)
|
// an int array is not increased by 4 per iteration.)
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public int[] arrayUnsafeFillAddrIncrMismatch() {
|
public int[] arrayUnsafeFillAddrIncrMismatch() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < 500; i++) {
|
for (int i = 0; i < 500; i++) {
|
||||||
@ -100,4 +103,3 @@ public class ArrayUnsafeOpTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,9 +40,11 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
public class BasicBooleanOpTest extends VectorizationTestRunner {
|
public class BasicBooleanOpTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private boolean[] a;
|
private boolean[] a;
|
||||||
private boolean[] b;
|
private boolean[] b;
|
||||||
@ -69,6 +71,10 @@ public class BasicBooleanOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeature = {"asimd", "true"},
|
||||||
|
counts = {IRNode.AND_V, ">0"})
|
||||||
|
@IR(applyIfCPUFeature = {"avx512vl", "true"},
|
||||||
|
counts = {IRNode.MACRO_LOGIC_V, ">0"})
|
||||||
public boolean[] vectorAnd() {
|
public boolean[] vectorAnd() {
|
||||||
boolean[] res = new boolean[SIZE];
|
boolean[] res = new boolean[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -78,6 +84,8 @@ public class BasicBooleanOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.OR_V, ">0"})
|
||||||
public boolean[] vectorOr() {
|
public boolean[] vectorOr() {
|
||||||
boolean[] res = new boolean[SIZE];
|
boolean[] res = new boolean[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -87,6 +95,8 @@ public class BasicBooleanOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.XOR_V, ">0"})
|
||||||
public boolean[] vectorXor() {
|
public boolean[] vectorXor() {
|
||||||
boolean[] res = new boolean[SIZE];
|
boolean[] res = new boolean[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -95,4 +105,3 @@ public class BasicBooleanOpTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,9 +40,11 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
public class BasicByteOpTest extends VectorizationTestRunner {
|
public class BasicByteOpTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private byte[] a;
|
private byte[] a;
|
||||||
private byte[] b;
|
private byte[] b;
|
||||||
@ -61,6 +63,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Arithmetic ----------------
|
// ---------------- Arithmetic ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public byte[] vectorNeg() {
|
public byte[] vectorNeg() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -70,6 +74,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "ssse3", "true"},
|
||||||
|
counts = {IRNode.ABS_V, ">0"})
|
||||||
public byte[] vectorAbs() {
|
public byte[] vectorAbs() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -79,6 +85,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.ADD_V, ">0"})
|
||||||
public byte[] vectorAdd() {
|
public byte[] vectorAdd() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -88,6 +96,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public byte[] vectorSub() {
|
public byte[] vectorSub() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -97,6 +107,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0"})
|
||||||
public byte[] vectorMul() {
|
public byte[] vectorMul() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -106,6 +118,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0", IRNode.ADD_V, ">0"})
|
||||||
public byte[] vectorMulAdd() {
|
public byte[] vectorMulAdd() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -115,6 +129,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0", IRNode.SUB_V, ">0"})
|
||||||
public byte[] vectorMulSub() {
|
public byte[] vectorMulSub() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -125,6 +141,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Logic ----------------
|
// ---------------- Logic ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.XOR_V, ">0"})
|
||||||
public byte[] vectorNot() {
|
public byte[] vectorNot() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -134,6 +152,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.AND_V, ">0"})
|
||||||
public byte[] vectorAnd() {
|
public byte[] vectorAnd() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -143,6 +163,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.OR_V, ">0"})
|
||||||
public byte[] vectorOr() {
|
public byte[] vectorOr() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -152,6 +174,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.XOR_V, ">0"})
|
||||||
public byte[] vectorXor() {
|
public byte[] vectorXor() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -162,6 +186,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Shift ----------------
|
// ---------------- Shift ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.LSHIFT_V, ">0"})
|
||||||
public byte[] vectorShiftLeft() {
|
public byte[] vectorShiftLeft() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -171,6 +197,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.RSHIFT_V, ">0"})
|
||||||
public byte[] vectorSignedShiftRight() {
|
public byte[] vectorSignedShiftRight() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -180,6 +208,8 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.RSHIFT_V, ">0"})
|
||||||
public byte[] vectorUnsignedShiftRight() {
|
public byte[] vectorUnsignedShiftRight() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -188,4 +218,3 @@ public class BasicByteOpTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,9 +40,11 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
public class BasicCharOpTest extends VectorizationTestRunner {
|
public class BasicCharOpTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private char[] a;
|
private char[] a;
|
||||||
private char[] b;
|
private char[] b;
|
||||||
@ -64,6 +66,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Arithmetic ----------------
|
// ---------------- Arithmetic ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public char[] vectorNeg() {
|
public char[] vectorNeg() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -73,8 +77,9 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Note that Math.abs() on unsigned subword types can NOT be vectorized
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
// since all the values are non-negative according to the semantics.
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
|
@IR(failOn = {IRNode.ABS_V})
|
||||||
public char[] vectorAbs() {
|
public char[] vectorAbs() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -84,6 +89,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.ADD_V, ">0"})
|
||||||
public char[] vectorAdd() {
|
public char[] vectorAdd() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -93,6 +100,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public char[] vectorSub() {
|
public char[] vectorSub() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -102,6 +111,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0"})
|
||||||
public char[] vectorMul() {
|
public char[] vectorMul() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -111,6 +122,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0", IRNode.ADD_V, ">0"})
|
||||||
public char[] vectorMulAdd() {
|
public char[] vectorMulAdd() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -120,6 +133,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0", IRNode.SUB_V, ">0"})
|
||||||
public char[] vectorMulSub() {
|
public char[] vectorMulSub() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -130,6 +145,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Logic ----------------
|
// ---------------- Logic ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.XOR_V, ">0"})
|
||||||
public char[] vectorNot() {
|
public char[] vectorNot() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -139,6 +156,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.AND_V, ">0"})
|
||||||
public char[] vectorAnd() {
|
public char[] vectorAnd() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -148,6 +167,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.OR_V, ">0"})
|
||||||
public char[] vectorOr() {
|
public char[] vectorOr() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -157,6 +178,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.XOR_V, ">0"})
|
||||||
public char[] vectorXor() {
|
public char[] vectorXor() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -167,6 +190,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Shift ----------------
|
// ---------------- Shift ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.LSHIFT_V, ">0"})
|
||||||
public char[] vectorShiftLeft() {
|
public char[] vectorShiftLeft() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -176,6 +201,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.URSHIFT_V, ">0"})
|
||||||
public char[] vectorSignedShiftRight() {
|
public char[] vectorSignedShiftRight() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -185,6 +212,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.URSHIFT_V, ">0"})
|
||||||
public char[] vectorUnsignedShiftRight() {
|
public char[] vectorUnsignedShiftRight() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -195,6 +224,8 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ------------- ReverseBytes -------------
|
// ------------- ReverseBytes -------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"},
|
||||||
|
counts = {IRNode.REVERSE_BYTES_V, ">0"})
|
||||||
public char[] reverseBytesWithChar() {
|
public char[] reverseBytesWithChar() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -204,6 +235,9 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
// Note that reverseBytes cannot be vectorized if the vector element
|
||||||
|
// type doesn't match the caller's class type.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public int[] reverseBytesWithInt() {
|
public int[] reverseBytesWithInt() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -212,4 +246,3 @@ public class BasicCharOpTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,9 +40,11 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
public class BasicDoubleOpTest extends VectorizationTestRunner {
|
public class BasicDoubleOpTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private double[] a;
|
private double[] a;
|
||||||
private double[] b;
|
private double[] b;
|
||||||
@ -61,6 +63,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Arithmetic ----------------
|
// ---------------- Arithmetic ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.NEG_V, ">0"})
|
||||||
public double[] vectorNeg() {
|
public double[] vectorNeg() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -70,6 +74,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.ABS_V, ">0"})
|
||||||
public double[] vectorAbs() {
|
public double[] vectorAbs() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -79,6 +85,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
|
||||||
|
counts = {IRNode.SQRT_V, ">0"})
|
||||||
public double[] vectorSqrt() {
|
public double[] vectorSqrt() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -88,6 +96,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse", "true"},
|
||||||
|
counts = {IRNode.ROUND_DOUBLE_MODE_V, ">0"})
|
||||||
public double[] vectorCeil() {
|
public double[] vectorCeil() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -97,6 +107,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4_1", "true"},
|
||||||
|
counts = {IRNode.ROUND_DOUBLE_MODE_V, ">0"})
|
||||||
public double[] vectorFloor() {
|
public double[] vectorFloor() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -106,6 +118,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4_1", "true"},
|
||||||
|
counts = {IRNode.ROUND_DOUBLE_MODE_V, ">0"})
|
||||||
public double[] vectorRint() {
|
public double[] vectorRint() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -115,6 +129,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.ADD_V, ">0"})
|
||||||
public double[] vectorAdd() {
|
public double[] vectorAdd() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -124,6 +140,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public double[] vectorSub() {
|
public double[] vectorSub() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -133,6 +151,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0"})
|
||||||
public double[] vectorMul() {
|
public double[] vectorMul() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -142,6 +162,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.DIV_V, ">0"})
|
||||||
public double[] vectorDiv() {
|
public double[] vectorDiv() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -151,6 +173,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse", "true"},
|
||||||
|
counts = {IRNode.MAX_V, ">0"})
|
||||||
public double[] vectorMax() {
|
public double[] vectorMax() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -160,6 +184,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse", "true"},
|
||||||
|
counts = {IRNode.MIN_V, ">0"})
|
||||||
public double[] vectorMin() {
|
public double[] vectorMin() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -169,6 +195,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "fma", "true"},
|
||||||
|
counts = {IRNode.FMA_V, ">0"})
|
||||||
public double[] vectorMulAdd() {
|
public double[] vectorMulAdd() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -178,6 +206,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "fma", "true"},
|
||||||
|
counts = {IRNode.FMA_V, ">0"})
|
||||||
public double[] vectorMulSub1() {
|
public double[] vectorMulSub1() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -187,6 +217,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "fma", "true"},
|
||||||
|
counts = {IRNode.FMA_V, ">0"})
|
||||||
public double[] vectorMulSub2() {
|
public double[] vectorMulSub2() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -196,6 +228,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "fma", "true"},
|
||||||
|
counts = {IRNode.FMA_V, ">0"})
|
||||||
public double[] vectorNegateMulAdd1() {
|
public double[] vectorNegateMulAdd1() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -205,6 +239,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "fma", "true"},
|
||||||
|
counts = {IRNode.FMA_V, ">0"})
|
||||||
public double[] vectorNegateMulAdd2() {
|
public double[] vectorNegateMulAdd2() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -214,6 +250,8 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "fma", "true"},
|
||||||
|
counts = {IRNode.FMA_V, ">0"})
|
||||||
public double[] vectorNegateMulSub() {
|
public double[] vectorNegateMulSub() {
|
||||||
double[] res = new double[SIZE];
|
double[] res = new double[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -250,4 +288,3 @@ public class BasicDoubleOpTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,9 +40,11 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
public class BasicFloatOpTest extends VectorizationTestRunner {
|
public class BasicFloatOpTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private float[] a;
|
private float[] a;
|
||||||
private float[] b;
|
private float[] b;
|
||||||
@ -61,6 +63,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Arithmetic ----------------
|
// ---------------- Arithmetic ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse", "true"},
|
||||||
|
counts = {IRNode.NEG_V, ">0"})
|
||||||
public float[] vectorNeg() {
|
public float[] vectorNeg() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -70,6 +74,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse", "true"},
|
||||||
|
counts = {IRNode.ABS_V, ">0"})
|
||||||
public float[] vectorAbs() {
|
public float[] vectorAbs() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -79,6 +85,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
|
||||||
|
counts = {IRNode.SQRT_V, ">0"})
|
||||||
public float[] vectorSqrt() {
|
public float[] vectorSqrt() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -88,6 +96,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.ADD_V, ">0"})
|
||||||
public float[] vectorAdd() {
|
public float[] vectorAdd() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -97,6 +107,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public float[] vectorSub() {
|
public float[] vectorSub() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -106,6 +118,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0"})
|
||||||
public float[] vectorMul() {
|
public float[] vectorMul() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -115,6 +129,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.DIV_V, ">0"})
|
||||||
public float[] vectorDiv() {
|
public float[] vectorDiv() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -124,6 +140,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse", "true"},
|
||||||
|
counts = {IRNode.MAX_V, ">0"})
|
||||||
public float[] vectorMax() {
|
public float[] vectorMax() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -133,6 +151,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse", "true"},
|
||||||
|
counts = {IRNode.MIN_V, ">0"})
|
||||||
public float[] vectorMin() {
|
public float[] vectorMin() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -142,6 +162,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "fma", "true"},
|
||||||
|
counts = {IRNode.FMA_V, ">0"})
|
||||||
public float[] vectorMulAdd() {
|
public float[] vectorMulAdd() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -151,6 +173,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "fma", "true"},
|
||||||
|
counts = {IRNode.FMA_V, ">0"})
|
||||||
public float[] vectorMulSub1() {
|
public float[] vectorMulSub1() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -160,6 +184,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "fma", "true"},
|
||||||
|
counts = {IRNode.FMA_V, ">0"})
|
||||||
public float[] vectorMulSub2() {
|
public float[] vectorMulSub2() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -169,6 +195,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "fma", "true"},
|
||||||
|
counts = {IRNode.FMA_V, ">0"})
|
||||||
public float[] vectorNegateMulAdd1() {
|
public float[] vectorNegateMulAdd1() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -178,6 +206,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "fma", "true"},
|
||||||
|
counts = {IRNode.FMA_V, ">0"})
|
||||||
public float[] vectorNegateMulAdd2() {
|
public float[] vectorNegateMulAdd2() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -187,6 +217,8 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "fma", "true"},
|
||||||
|
counts = {IRNode.FMA_V, ">0"})
|
||||||
public float[] vectorNegateMulSub() {
|
public float[] vectorNegateMulSub() {
|
||||||
float[] res = new float[SIZE];
|
float[] res = new float[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -223,4 +255,3 @@ public class BasicFloatOpTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,9 +40,11 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
public class BasicIntOpTest extends VectorizationTestRunner {
|
public class BasicIntOpTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private int[] a;
|
private int[] a;
|
||||||
private int[] b;
|
private int[] b;
|
||||||
@ -61,6 +63,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Arithmetic ----------------
|
// ---------------- Arithmetic ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public int[] vectorNeg() {
|
public int[] vectorNeg() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -70,6 +74,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "ssse3", "true"},
|
||||||
|
counts = {IRNode.ABS_V, ">0"})
|
||||||
public int[] vectorAbs() {
|
public int[] vectorAbs() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -79,6 +85,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.ADD_V, ">0"})
|
||||||
public int[] vectorAdd() {
|
public int[] vectorAdd() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -88,6 +96,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public int[] vectorSub() {
|
public int[] vectorSub() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -97,6 +107,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4_1", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0"})
|
||||||
public int[] vectorMul() {
|
public int[] vectorMul() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -106,6 +118,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4_1", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0", IRNode.ADD_V, ">0"})
|
||||||
public int[] vectorMulAdd() {
|
public int[] vectorMulAdd() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -115,6 +129,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4_1", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0", IRNode.SUB_V, ">0"})
|
||||||
public int[] vectorMulSub() {
|
public int[] vectorMulSub() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -124,6 +140,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"},
|
||||||
|
counts = {IRNode.POPCOUNT_VI, ">0"})
|
||||||
public int[] vectorPopCount() {
|
public int[] vectorPopCount() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -134,6 +152,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Logic ----------------
|
// ---------------- Logic ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.XOR_V, ">0"})
|
||||||
public int[] vectorNot() {
|
public int[] vectorNot() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -143,6 +163,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.AND_V, ">0"})
|
||||||
public int[] vectorAnd() {
|
public int[] vectorAnd() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -152,6 +174,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.OR_V, ">0"})
|
||||||
public int[] vectorOr() {
|
public int[] vectorOr() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -161,6 +185,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.XOR_V, ">0"})
|
||||||
public int[] vectorXor() {
|
public int[] vectorXor() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -171,6 +197,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Shift ----------------
|
// ---------------- Shift ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.LSHIFT_V, ">0"})
|
||||||
public int[] vectorShiftLeft() {
|
public int[] vectorShiftLeft() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -180,6 +208,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.RSHIFT_V, ">0"})
|
||||||
public int[] vectorSignedShiftRight() {
|
public int[] vectorSignedShiftRight() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -189,6 +219,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.URSHIFT_V, ">0"})
|
||||||
public int[] vectorUnsignedShiftRight() {
|
public int[] vectorUnsignedShiftRight() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -235,6 +267,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
// Note that integer max produces non-vectorizable CMoveI node.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public int reductionMax() {
|
public int reductionMax() {
|
||||||
int res = Integer.MIN_VALUE;
|
int res = Integer.MIN_VALUE;
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -244,6 +278,8 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
// Note that integer min produces non-vectorizable CMoveI node.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public int reductionMin() {
|
public int reductionMin() {
|
||||||
int res = Integer.MAX_VALUE;
|
int res = Integer.MAX_VALUE;
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -252,4 +288,3 @@ public class BasicIntOpTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,9 +40,11 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
public class BasicLongOpTest extends VectorizationTestRunner {
|
public class BasicLongOpTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private long[] a;
|
private long[] a;
|
||||||
private long[] b;
|
private long[] b;
|
||||||
@ -61,6 +63,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Arithmetic ----------------
|
// ---------------- Arithmetic ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public long[] vectorNeg() {
|
public long[] vectorNeg() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -70,6 +74,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx512vl", "true"},
|
||||||
|
counts = {IRNode.ABS_V, ">0"})
|
||||||
public long[] vectorAbs() {
|
public long[] vectorAbs() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -79,6 +85,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.ADD_V, ">0"})
|
||||||
public long[] vectorAdd() {
|
public long[] vectorAdd() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -88,6 +96,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public long[] vectorSub() {
|
public long[] vectorSub() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -97,6 +107,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx512dq", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0"})
|
||||||
public long[] vectorMul() {
|
public long[] vectorMul() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -106,6 +118,10 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.ADD_V, ">0"})
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx512dq", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0"})
|
||||||
public long[] vectorMulAdd() {
|
public long[] vectorMulAdd() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -115,6 +131,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0", IRNode.SUB_V, ">0"})
|
||||||
public long[] vectorMulSub() {
|
public long[] vectorMulSub() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -125,6 +143,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Logic ----------------
|
// ---------------- Logic ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.XOR_V, ">0"})
|
||||||
public long[] vectorNot() {
|
public long[] vectorNot() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -134,6 +154,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.AND_V, ">0"})
|
||||||
public long[] vectorAnd() {
|
public long[] vectorAnd() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -143,6 +165,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.OR_V, ">0"})
|
||||||
public long[] vectorOr() {
|
public long[] vectorOr() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -152,6 +176,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.XOR_V, ">0"})
|
||||||
public long[] vectorXor() {
|
public long[] vectorXor() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -162,6 +188,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Shift ----------------
|
// ---------------- Shift ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.LSHIFT_V, ">0"})
|
||||||
public long[] vectorShiftLeft() {
|
public long[] vectorShiftLeft() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -171,6 +199,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.RSHIFT_V, ">0"})
|
||||||
public long[] vectorSignedShiftRight() {
|
public long[] vectorSignedShiftRight() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -180,6 +210,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.URSHIFT_V, ">0"})
|
||||||
public long[] vectorUnsignedShiftRight() {
|
public long[] vectorUnsignedShiftRight() {
|
||||||
long[] res = new long[SIZE];
|
long[] res = new long[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -226,6 +258,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
// Note that long integer max produces non-vectorizable CMoveL node.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public long reductionMax() {
|
public long reductionMax() {
|
||||||
long res = Long.MIN_VALUE;
|
long res = Long.MIN_VALUE;
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -235,6 +269,8 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
// Note that long integer min produces non-vectorizable CMoveL node.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public long reductionMin() {
|
public long reductionMin() {
|
||||||
long res = Long.MAX_VALUE;
|
long res = Long.MAX_VALUE;
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -243,4 +279,3 @@ public class BasicLongOpTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,9 +40,11 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
public class BasicShortOpTest extends VectorizationTestRunner {
|
public class BasicShortOpTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private short[] a;
|
private short[] a;
|
||||||
private short[] b;
|
private short[] b;
|
||||||
@ -64,6 +66,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Arithmetic ----------------
|
// ---------------- Arithmetic ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public short[] vectorNeg() {
|
public short[] vectorNeg() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -73,6 +77,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "ssse3", "true"},
|
||||||
|
counts = {IRNode.ABS_V, ">0"})
|
||||||
public short[] vectorAbs() {
|
public short[] vectorAbs() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -82,6 +88,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.ADD_V, ">0"})
|
||||||
public short[] vectorAdd() {
|
public short[] vectorAdd() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -91,6 +99,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public short[] vectorSub() {
|
public short[] vectorSub() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -100,6 +110,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0"})
|
||||||
public short[] vectorMul() {
|
public short[] vectorMul() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -109,6 +121,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0", IRNode.ADD_V, ">0"})
|
||||||
public short[] vectorMulAdd() {
|
public short[] vectorMulAdd() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -118,6 +132,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0", IRNode.SUB_V, ">0"})
|
||||||
public short[] vectorMulSub() {
|
public short[] vectorMulSub() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -128,6 +144,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Logic ----------------
|
// ---------------- Logic ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.XOR_V, ">0"})
|
||||||
public short[] vectorNot() {
|
public short[] vectorNot() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -137,6 +155,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.AND_V, ">0"})
|
||||||
public short[] vectorAnd() {
|
public short[] vectorAnd() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -146,6 +166,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.OR_V, ">0"})
|
||||||
public short[] vectorOr() {
|
public short[] vectorOr() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -155,6 +177,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.XOR_V, ">0"})
|
||||||
public short[] vectorXor() {
|
public short[] vectorXor() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -165,6 +189,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Shift ----------------
|
// ---------------- Shift ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.LSHIFT_V, ">0"})
|
||||||
public short[] vectorShiftLeft() {
|
public short[] vectorShiftLeft() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -174,6 +200,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.RSHIFT_V, ">0"})
|
||||||
public short[] vectorSignedShiftRight() {
|
public short[] vectorSignedShiftRight() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -183,6 +211,33 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
// Note that min operations on subword types cannot be vectorized
|
||||||
|
// because higher bits will be lost.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
|
public short[] vectorMin() {
|
||||||
|
short[] res = new short[SIZE];
|
||||||
|
int val = 65536;
|
||||||
|
for (int i = 0; i < SIZE; i++) {
|
||||||
|
res[i] = (short) Math.min(a[i], val);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
// Note that max operations on subword types cannot be vectorized
|
||||||
|
// because higher bits will be lost.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
|
public short[] vectorMax() {
|
||||||
|
short[] res = new short[SIZE];
|
||||||
|
for (int i = 0; i < SIZE; i++) {
|
||||||
|
res[i] = (short) Math.max(a[i], b[i]);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.RSHIFT_V, ">0"})
|
||||||
public short[] vectorUnsignedShiftRight() {
|
public short[] vectorUnsignedShiftRight() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -193,6 +248,8 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ------------- ReverseBytes -------------
|
// ------------- ReverseBytes -------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"},
|
||||||
|
counts = {IRNode.REVERSE_BYTES_V, ">0"})
|
||||||
public short[] reverseBytesWithShort() {
|
public short[] reverseBytesWithShort() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -202,6 +259,9 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
// Note that reverseBytes cannot be vectorized if the vector element
|
||||||
|
// type doesn't match the caller's class type.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public int[] reverseBytesWithInt() {
|
public int[] reverseBytesWithInt() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -210,4 +270,3 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,11 +40,13 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private int[] ints;
|
private int[] ints;
|
||||||
private short[] shorts;
|
private short[] shorts;
|
||||||
@ -75,6 +77,10 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Linear Indexes ----------------
|
// ---------------- Linear Indexes ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.ADD_VI, ">0"})
|
||||||
public int[] indexPlusConstant() {
|
public int[] indexPlusConstant() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE / 2; i++) {
|
for (int i = 0; i < SIZE / 2; i++) {
|
||||||
@ -84,6 +90,10 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "sse4_1", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0"})
|
||||||
public int[] indexMinusConstant() {
|
public int[] indexMinusConstant() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = SIZE / 2; i < SIZE; i++) {
|
for (int i = SIZE / 2; i < SIZE; i++) {
|
||||||
@ -93,6 +103,10 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4_1", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0"})
|
||||||
public int[] indexPlusInvariant() {
|
public int[] indexPlusInvariant() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
System.arraycopy(ints, 0, res, 0, SIZE);
|
System.arraycopy(ints, 0, res, 0, SIZE);
|
||||||
@ -103,6 +117,10 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "sse4_1", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0"})
|
||||||
public int[] indexMinusInvariant() {
|
public int[] indexMinusInvariant() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
System.arraycopy(ints, 0, res, 0, SIZE);
|
System.arraycopy(ints, 0, res, 0, SIZE);
|
||||||
@ -113,6 +131,10 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse4_1", "true"},
|
||||||
|
counts = {IRNode.MUL_V, ">0"})
|
||||||
public int[] indexWithInvariantAndConstant() {
|
public int[] indexWithInvariantAndConstant() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
System.arraycopy(ints, 0, res, 0, SIZE);
|
System.arraycopy(ints, 0, res, 0, SIZE);
|
||||||
@ -123,6 +145,10 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.SUB_V, ">0"})
|
||||||
public int[] indexWithTwoInvariants() {
|
public int[] indexWithTwoInvariants() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
System.arraycopy(ints, 0, res, 0, SIZE);
|
System.arraycopy(ints, 0, res, 0, SIZE);
|
||||||
@ -133,7 +159,8 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Note that this case cannot be vectorized due to data dependence
|
// Note that this case cannot be vectorized due to data dependence.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public int[] indexWithDifferentConstants() {
|
public int[] indexWithDifferentConstants() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE / 4; i++) {
|
for (int i = 0; i < SIZE / 4; i++) {
|
||||||
@ -143,7 +170,8 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Note that this case cannot be vectorized due to data dependence
|
// Note that this case cannot be vectorized due to data dependence.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public int[] indexWithDifferentInvariants() {
|
public int[] indexWithDifferentInvariants() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = SIZE / 4; i < SIZE / 2; i++) {
|
for (int i = SIZE / 4; i < SIZE / 2; i++) {
|
||||||
@ -204,8 +232,8 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Note that this case cannot be vectorized due to data dependence
|
// Note that this case cannot be vectorized due to data dependence.
|
||||||
// between src and dest of the assignment.
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public int[] sameArrayWithDifferentIndex() {
|
public int[] sameArrayWithDifferentIndex() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
System.arraycopy(ints, 0, res, 0, SIZE);
|
System.arraycopy(ints, 0, res, 0, SIZE);
|
||||||
@ -217,7 +245,8 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Subword Type Arrays ----------------
|
// ---------------- Subword Type Arrays ----------------
|
||||||
@Test
|
@Test
|
||||||
// Note that this case cannot be vectorized due to data dependence
|
// Note that this case cannot be vectorized due to data dependence.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public short[] shortArrayWithDependence() {
|
public short[] shortArrayWithDependence() {
|
||||||
short[] res = new short[SIZE];
|
short[] res = new short[SIZE];
|
||||||
System.arraycopy(shorts, 0, res, 0, SIZE);
|
System.arraycopy(shorts, 0, res, 0, SIZE);
|
||||||
@ -228,7 +257,8 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Note that this case cannot be vectorized due to data dependence
|
// Note that this case cannot be vectorized due to data dependence.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public char[] charArrayWithDependence() {
|
public char[] charArrayWithDependence() {
|
||||||
char[] res = new char[SIZE];
|
char[] res = new char[SIZE];
|
||||||
System.arraycopy(chars, 0, res, 0, SIZE);
|
System.arraycopy(chars, 0, res, 0, SIZE);
|
||||||
@ -239,7 +269,8 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Note that this case cannot be vectorized due to data dependence
|
// Note that this case cannot be vectorized due to data dependence.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public byte[] byteArrayWithDependence() {
|
public byte[] byteArrayWithDependence() {
|
||||||
byte[] res = new byte[SIZE];
|
byte[] res = new byte[SIZE];
|
||||||
System.arraycopy(bytes, 0, res, 0, SIZE);
|
System.arraycopy(bytes, 0, res, 0, SIZE);
|
||||||
@ -250,7 +281,8 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Note that this case cannot be vectorized due to data dependence
|
// Note that this case cannot be vectorized due to data dependence.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public boolean[] booleanArrayWithDependence() {
|
public boolean[] booleanArrayWithDependence() {
|
||||||
boolean[] res = new boolean[SIZE];
|
boolean[] res = new boolean[SIZE];
|
||||||
System.arraycopy(booleans, 0, res, 0, SIZE);
|
System.arraycopy(booleans, 0, res, 0, SIZE);
|
||||||
@ -262,6 +294,8 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------------- Multiple Operations ----------------
|
// ---------------- Multiple Operations ----------------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] differentIndexWithDifferentTypes() {
|
public int[] differentIndexWithDifferentTypes() {
|
||||||
int[] res1 = new int[SIZE];
|
int[] res1 = new int[SIZE];
|
||||||
short[] res2 = new short[SIZE];
|
short[] res2 = new short[SIZE];
|
||||||
@ -273,7 +307,8 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Note that this case cannot be vectorized due to data dependence
|
// Note that this case cannot be vectorized due to data dependence.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
public int[] differentIndexWithSameType() {
|
public int[] differentIndexWithSameType() {
|
||||||
int[] res1 = new int[SIZE];
|
int[] res1 = new int[SIZE];
|
||||||
int[] res2 = new int[SIZE];
|
int[] res2 = new int[SIZE];
|
||||||
@ -284,4 +319,3 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
|
|||||||
return res2;
|
return res2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,11 +40,13 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class LoopCombinedOpTest extends VectorizationTestRunner {
|
public class LoopCombinedOpTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private int[] a;
|
private int[] a;
|
||||||
private int[] b;
|
private int[] b;
|
||||||
@ -80,6 +82,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] opWithConstant() {
|
public int[] opWithConstant() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -89,6 +93,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] opWithLoopInvariant() {
|
public int[] opWithLoopInvariant() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -98,6 +104,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] opWithConstantAndLoopInvariant() {
|
public int[] opWithConstantAndLoopInvariant() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -107,6 +115,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] multipleOps() {
|
public int[] multipleOps() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -116,6 +126,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] multipleOpsWithMultipleConstants() {
|
public int[] multipleOpsWithMultipleConstants() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -125,6 +137,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] multipleStores() {
|
public int[] multipleStores() {
|
||||||
int[] res1 = new int[SIZE];
|
int[] res1 = new int[SIZE];
|
||||||
int[] res2 = new int[SIZE];
|
int[] res2 = new int[SIZE];
|
||||||
@ -138,6 +152,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] multipleStoresWithCommonSubExpression() {
|
public int[] multipleStoresWithCommonSubExpression() {
|
||||||
int[] res1 = new int[SIZE];
|
int[] res1 = new int[SIZE];
|
||||||
int[] res2 = new int[SIZE];
|
int[] res2 = new int[SIZE];
|
||||||
@ -151,6 +167,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] multipleOpsWith2DifferentTypes() {
|
public int[] multipleOpsWith2DifferentTypes() {
|
||||||
short[] res1 = new short[SIZE];
|
short[] res1 = new short[SIZE];
|
||||||
int[] res2 = new int[SIZE];
|
int[] res2 = new int[SIZE];
|
||||||
@ -162,6 +180,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public long[] multipleOpsWith3DifferentTypes() {
|
public long[] multipleOpsWith3DifferentTypes() {
|
||||||
short[] res1 = new short[SIZE];
|
short[] res1 = new short[SIZE];
|
||||||
int[] res2 = new int[SIZE];
|
int[] res2 = new int[SIZE];
|
||||||
@ -175,6 +195,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public long[] multipleOpsWith2NonAdjacentTypes() {
|
public long[] multipleOpsWith2NonAdjacentTypes() {
|
||||||
short[] res1 = new short[SIZE];
|
short[] res1 = new short[SIZE];
|
||||||
long[] res2 = new long[SIZE];
|
long[] res2 = new long[SIZE];
|
||||||
@ -186,6 +208,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] multipleOpsWith2DifferentTypesAndConstant() {
|
public int[] multipleOpsWith2DifferentTypesAndConstant() {
|
||||||
short[] res1 = new short[SIZE];
|
short[] res1 = new short[SIZE];
|
||||||
int[] res2 = new int[SIZE];
|
int[] res2 = new int[SIZE];
|
||||||
@ -197,6 +221,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] multipleOpsWith2DifferentTypesAndInvariant() {
|
public int[] multipleOpsWith2DifferentTypesAndInvariant() {
|
||||||
short[] res1 = new short[SIZE];
|
short[] res1 = new short[SIZE];
|
||||||
int[] res2 = new int[SIZE];
|
int[] res2 = new int[SIZE];
|
||||||
@ -208,6 +234,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] multipleOpsWith2DifferentTypesAndComplexExpression() {
|
public int[] multipleOpsWith2DifferentTypesAndComplexExpression() {
|
||||||
short[] res1 = new short[SIZE];
|
short[] res1 = new short[SIZE];
|
||||||
int[] res2 = new int[SIZE];
|
int[] res2 = new int[SIZE];
|
||||||
@ -218,6 +246,20 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
return res2;
|
return res2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
|
public int[] multipleOpsWith2DifferentTypesAndSharedOp() {
|
||||||
|
int i = 0, sum = 0;
|
||||||
|
int[] res1 = new int[SIZE];
|
||||||
|
short[] res2 = new short[SIZE];
|
||||||
|
while (++i < SIZE) {
|
||||||
|
sum += (res1[i]--);
|
||||||
|
res2[i]++;
|
||||||
|
}
|
||||||
|
return res1;
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public int[] fillIndexPlusStride() {
|
public int[] fillIndexPlusStride() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
@ -255,6 +297,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] manuallyUnrolledStride2() {
|
public int[] manuallyUnrolledStride2() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE - 1; i += 2) {
|
for (int i = 0; i < SIZE - 1; i += 2) {
|
||||||
@ -265,6 +309,8 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int partialVectorizableLoop() {
|
public int partialVectorizableLoop() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
int k = 9;
|
int k = 9;
|
||||||
@ -275,4 +321,3 @@ public class LoopCombinedOpTest extends VectorizationTestRunner {
|
|||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,11 +40,13 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class LoopControlFlowTest extends VectorizationTestRunner {
|
public class LoopControlFlowTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private int[] a;
|
private int[] a;
|
||||||
private int[] b;
|
private int[] b;
|
||||||
@ -62,6 +64,8 @@ public class LoopControlFlowTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] loopInvariantCondition() {
|
public int[] loopInvariantCondition() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -86,5 +90,16 @@ public class LoopControlFlowTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
// Note that this loop cannot be vectorized due to early break.
|
||||||
|
@IR(failOn = {IRNode.STORE_VECTOR})
|
||||||
|
public int conditionalBreakReduction() {
|
||||||
|
int sum = 0, i = 0;
|
||||||
|
for (i = 0; i < SIZE; i++) {
|
||||||
|
sum += i;
|
||||||
|
if (invCond) break;
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,27 +40,35 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class LoopLiveOutNodesTest extends VectorizationTestRunner {
|
public class LoopLiveOutNodesTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 3333;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private int[] a;
|
private int[] a;
|
||||||
private int start;
|
private int start;
|
||||||
private int limit;
|
private int limit;
|
||||||
|
|
||||||
|
// tmp[] may be modified and thus should not be returned in cases.
|
||||||
|
private int[] tmp;
|
||||||
|
|
||||||
public LoopLiveOutNodesTest() {
|
public LoopLiveOutNodesTest() {
|
||||||
a = new int[SIZE];
|
a = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
a[i] = -697989 * i;
|
a[i] = -697989 * i;
|
||||||
}
|
}
|
||||||
|
tmp = new int[SIZE];
|
||||||
Random ran = new Random(31415926);
|
Random ran = new Random(31415926);
|
||||||
start = 999 + ran.nextInt() % 100;
|
start = ran.nextInt() % 100;
|
||||||
limit = start + 1357;
|
limit = start + 235;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int SimpleIvUsed() {
|
public int SimpleIvUsed() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
@ -71,6 +79,8 @@ public class LoopLiveOutNodesTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int indexedByIvUsed() {
|
public int indexedByIvUsed() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
@ -81,6 +91,8 @@ public class LoopLiveOutNodesTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int ivUsedMultiple() {
|
public int ivUsedMultiple() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
@ -91,6 +103,8 @@ public class LoopLiveOutNodesTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int ivUsedComplexExpr() {
|
public int ivUsedComplexExpr() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
@ -101,6 +115,8 @@ public class LoopLiveOutNodesTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] ivUsedAnotherLoop() {
|
public int[] ivUsedAnotherLoop() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
@ -108,7 +124,7 @@ public class LoopLiveOutNodesTest extends VectorizationTestRunner {
|
|||||||
res[i] = a[i] * 100;
|
res[i] = a[i] * 100;
|
||||||
}
|
}
|
||||||
for (int j = i; j < i + 55; j++) {
|
for (int j = i; j < i + 55; j++) {
|
||||||
res[j] = a[j - 500] + 2323;
|
res[j] = a[j] + 2323;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -133,5 +149,15 @@ public class LoopLiveOutNodesTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public int nestedLoopIndexLiveOut() {
|
||||||
|
int k = 0;
|
||||||
|
for (int i = 0; i < 50; i += 2) {
|
||||||
|
for (int j = 0; j < 10; j++) {
|
||||||
|
tmp[k++] = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,11 +40,13 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class LoopRangeStrideTest extends VectorizationTestRunner {
|
public class LoopRangeStrideTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private int[] a;
|
private int[] a;
|
||||||
private int[] b;
|
private int[] b;
|
||||||
@ -60,8 +62,8 @@ public class LoopRangeStrideTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Random ran = new Random(0);
|
Random ran = new Random(0);
|
||||||
start = Math.abs(ran.nextInt() % 1000);
|
start = Math.abs(ran.nextInt() % 100);
|
||||||
end = start + 1315;
|
end = start + 315;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------- Range ----------------
|
// ---------------- Range ----------------
|
||||||
@ -75,6 +77,8 @@ public class LoopRangeStrideTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] nonConstantRange() {
|
public int[] nonConstantRange() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = start; i < end; i++) {
|
for (int i = start; i < end; i++) {
|
||||||
@ -84,6 +88,8 @@ public class LoopRangeStrideTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] crossZeroRange() {
|
public int[] crossZeroRange() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = -20; i < 20; i++) {
|
for (int i = -20; i < 20; i++) {
|
||||||
@ -93,6 +99,8 @@ public class LoopRangeStrideTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] nonEqualTestRange() {
|
public int[] nonEqualTestRange() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = start; i != end; i++) {
|
for (int i = start; i != end; i++) {
|
||||||
@ -102,15 +110,19 @@ public class LoopRangeStrideTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] shortInductionLoop() {
|
public int[] shortInductionLoop() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (short s = 123; s < 789; s++) {
|
for (short s = 123; s < 456; s++) {
|
||||||
res[s] = a[s] * b[s];
|
res[s] = a[s] * b[s];
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] whileLoop() {
|
public int[] whileLoop() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
int i = start;
|
int i = start;
|
||||||
@ -122,6 +134,8 @@ public class LoopRangeStrideTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] doWhileLoop() {
|
public int[] doWhileLoop() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
int i = start;
|
int i = start;
|
||||||
@ -160,8 +174,9 @@ public class LoopRangeStrideTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] countDownLoop() {
|
public int[] countDownLoop() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = SIZE - 1; i > 0; i--) {
|
for (int i = SIZE - 1; i > 0; i--) {
|
||||||
@ -181,6 +196,8 @@ public class LoopRangeStrideTest extends VectorizationTestRunner {
|
|||||||
|
|
||||||
// ---------- Stride with scale ----------
|
// ---------- Stride with scale ----------
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] countupLoopWithNegScale() {
|
public int[] countupLoopWithNegScale() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = SIZE / 2; i < SIZE; i++) {
|
for (int i = SIZE / 2; i < SIZE; i++) {
|
||||||
@ -190,6 +207,8 @@ public class LoopRangeStrideTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] countDownLoopWithNegScale() {
|
public int[] countDownLoopWithNegScale() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = SIZE / 2; i > 0; i--) {
|
for (int i = SIZE / 2; i > 0; i--) {
|
||||||
@ -198,4 +217,3 @@ public class LoopRangeStrideTest extends VectorizationTestRunner {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -36,15 +36,18 @@
|
|||||||
* compiler.vectorization.runner.LoopReductionOpTest
|
* compiler.vectorization.runner.LoopReductionOpTest
|
||||||
*
|
*
|
||||||
* @requires vm.compiler2.enabled & vm.flagless
|
* @requires vm.compiler2.enabled & vm.flagless
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class LoopReductionOpTest extends VectorizationTestRunner {
|
public class LoopReductionOpTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private int[] a;
|
private int[] a;
|
||||||
private int[] b;
|
private int[] b;
|
||||||
@ -74,6 +77,10 @@ public class LoopReductionOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.LOAD_VECTOR, ">0"})
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.ADD_REDUCTION_V, ">0"})
|
||||||
public int reductionAddSumOfArray() {
|
public int reductionAddSumOfArray() {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -92,8 +99,8 @@ public class LoopReductionOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Note that adding constant in loop would be directly optimized to
|
// Note that this loop should be optimized to straight-line code.
|
||||||
// scalar operations, hence this case is not vectorized.
|
@IR(failOn = {IRNode.COUNTED_LOOP})
|
||||||
public int reductionAddConstant() {
|
public int reductionAddConstant() {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -112,6 +119,10 @@ public class LoopReductionOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.LOAD_VECTOR, ">0"})
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sve", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.ADD_REDUCTION_V, ">0"})
|
||||||
public int reductionAddSumOfMultiple() {
|
public int reductionAddSumOfMultiple() {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -165,6 +176,10 @@ public class LoopReductionOpTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
|
@IR(applyIfCPUFeatureOr = {"sse2", "true"},
|
||||||
|
counts = {IRNode.ADD_REDUCTION_V, ">0"})
|
||||||
public long reductionWithNonReductionDifferentSizes() {
|
public long reductionWithNonReductionDifferentSizes() {
|
||||||
long res = 0L;
|
long res = 0L;
|
||||||
int[] arr = new int[SIZE];
|
int[] arr = new int[SIZE];
|
||||||
@ -186,4 +201,3 @@ public class LoopReductionOpTest extends VectorizationTestRunner {
|
|||||||
return intSum + 2 * longSum;
|
return intSum + 2 * longSum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,6 +40,8 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
public class MultipleLoopsTest extends VectorizationTestRunner {
|
public class MultipleLoopsTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 543;
|
private static final int SIZE = 543;
|
||||||
@ -60,6 +62,8 @@ public class MultipleLoopsTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] consecutiveLoops() {
|
public int[] consecutiveLoops() {
|
||||||
int[] res1 = new int[SIZE];
|
int[] res1 = new int[SIZE];
|
||||||
int[] res2 = new int[SIZE];
|
int[] res2 = new int[SIZE];
|
||||||
@ -77,6 +81,8 @@ public class MultipleLoopsTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] consecutiveLoopsNested() {
|
public int[] consecutiveLoopsNested() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int outer = 0; outer < 30; outer++) {
|
for (int outer = 0; outer < 30; outer++) {
|
||||||
@ -91,6 +97,8 @@ public class MultipleLoopsTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] nestedLoopOuterNonCounted() {
|
public int[] nestedLoopOuterNonCounted() {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
@ -105,6 +113,8 @@ public class MultipleLoopsTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] nestedLoopIndexCompute() {
|
public int[] nestedLoopIndexCompute() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 50; i < 100; i++) {
|
for (int i = 50; i < 100; i++) {
|
||||||
@ -114,5 +124,25 @@ public class MultipleLoopsTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
|
public float reductionLoopWithAnotherReductionInput() {
|
||||||
|
float res = 0.0F;
|
||||||
|
int N = 400;
|
||||||
|
int[] arr = new int[N];
|
||||||
|
int i1 = 0, i2 = 0, i3, i4;
|
||||||
|
for (int j = 0; j < N; ++j) {
|
||||||
|
for (i3 = 1; i3 < 63; ++i3) {
|
||||||
|
arr[i3] -= 1;
|
||||||
|
i1 += i3;
|
||||||
|
}
|
||||||
|
for (i4 = 2; i4 < 63; ++i4) {
|
||||||
|
res += i4 - i2;
|
||||||
|
i2 = i1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -41,11 +41,13 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class StripMinedLoopTest extends VectorizationTestRunner {
|
public class StripMinedLoopTest extends VectorizationTestRunner {
|
||||||
|
|
||||||
private static final int SIZE = 2345;
|
private static final int SIZE = 543;
|
||||||
|
|
||||||
private int[] a = new int[SIZE];
|
private int[] a = new int[SIZE];
|
||||||
private int[] b = new int[SIZE];
|
private int[] b = new int[SIZE];
|
||||||
@ -58,6 +60,8 @@ public class StripMinedLoopTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
|
||||||
|
counts = {IRNode.STORE_VECTOR, ">0"})
|
||||||
public int[] stripMinedVectorLoop() {
|
public int[] stripMinedVectorLoop() {
|
||||||
int[] res = new int[SIZE];
|
int[] res = new int[SIZE];
|
||||||
for (int i = 0; i < SIZE; i++) {
|
for (int i = 0; i < SIZE; i++) {
|
||||||
@ -74,5 +78,19 @@ public class StripMinedLoopTest extends VectorizationTestRunner {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public int stripMinedOneIterationLoop() {
|
||||||
|
int[] res = new int[SIZE];
|
||||||
|
int i1, i2, i3, i4 = 11937;
|
||||||
|
for (i1 = 1; i1 < SIZE; i1++) {
|
||||||
|
for (i2 = 1; i2 < 2; i2++) {
|
||||||
|
for (i3 = 1; i3 < 2; i3++) {
|
||||||
|
i4 &= i3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res[i1] = 0;
|
||||||
|
}
|
||||||
|
return res[0] + i4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
package compiler.vectorization.runner;
|
package compiler.vectorization.runner;
|
||||||
|
|
||||||
|
import compiler.lib.ir_framework.*;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
@ -34,6 +36,7 @@ import java.lang.reflect.Modifier;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
import jdk.test.whitebox.WhiteBox;
|
import jdk.test.whitebox.WhiteBox;
|
||||||
@ -50,21 +53,17 @@ public class VectorizationTestRunner {
|
|||||||
|
|
||||||
private static final long COMP_THRES_SECONDS = 30;
|
private static final long COMP_THRES_SECONDS = 30;
|
||||||
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
protected @interface Test {}
|
|
||||||
|
|
||||||
protected void run() {
|
protected void run() {
|
||||||
// Add extra VM options to enable post loop vectorization
|
// 1) Vectorization correctness test
|
||||||
WB.setBooleanVMFlag("UnlockExperimentalVMOptions", true);
|
|
||||||
WB.setBooleanVMFlag("PostLoopMultiversioning", true);
|
|
||||||
|
|
||||||
// For each method annotated with @Test in the test method, this test runner
|
// For each method annotated with @Test in the test method, this test runner
|
||||||
// invokes it twice - first time in the interpreter and second time compiled
|
// invokes it twice - first time in the interpreter and second time compiled
|
||||||
// by C2. Then this runner compares the two return values. Hence we require
|
// by C2. Then this runner compares the two return values. Hence we require
|
||||||
// each test method returning a primitive value or an array of primitive type.
|
// each test method returning a primitive value or an array of primitive type.
|
||||||
// And each test method should not throw any exceptions.
|
// And each test method should not throw any exceptions.
|
||||||
Class klass = getClass();
|
Class klass = getClass();
|
||||||
|
// Add extra VM options to verify experimental auto-vectorization
|
||||||
|
WB.setBooleanVMFlag("UnlockExperimentalVMOptions", true);
|
||||||
|
WB.setBooleanVMFlag("PostLoopMultiversioning", true);
|
||||||
for (Method method : klass.getDeclaredMethods()) {
|
for (Method method : klass.getDeclaredMethods()) {
|
||||||
try {
|
try {
|
||||||
if (method.isAnnotationPresent(Test.class)) {
|
if (method.isAnnotationPresent(Test.class)) {
|
||||||
@ -76,6 +75,14 @@ public class VectorizationTestRunner {
|
|||||||
"." + method.getName() + ": " + e.getMessage());
|
"." + method.getName() + ": " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 2) Vectorization ability test
|
||||||
|
// To test vectorizability, invoke the IR test framework to check existence of
|
||||||
|
// expected C2 IR node.
|
||||||
|
TestFramework irTest = new TestFramework(klass);
|
||||||
|
// Add extra VM options to enable more auto-vectorization chances
|
||||||
|
irTest.addFlags("-XX:-OptimizeFill");
|
||||||
|
irTest.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyTestMethod(Method method) {
|
private void verifyTestMethod(Method method) {
|
||||||
@ -204,4 +211,3 @@ public class VectorizationTestRunner {
|
|||||||
testObj.run();
|
testObj.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user