34 * @bug 8300256
35 * @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64")
36 * @modules java.base/jdk.internal.misc
37 * @library /test/lib /
38 * @run driver compiler.c2.irTests.TestVectorizationNotRun
39 */
40
41 public class TestVectorizationNotRun {
42 private static final Unsafe UNSAFE = Unsafe.getUnsafe();
43
44 public static void main(String[] args) {
45 TestFramework.runWithFlags("--add-modules", "java.base", "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED");
46 }
47
48 static int size = 1024;
49 static int sizeBytes = 8 * size;
50 static byte[] byteArray = new byte[sizeBytes];
51 static long[] longArray = new long[size];
52
53 @Test
54 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
55 public static void test(byte[] dest, long[] src) {
56 for (int i = 0; i < src.length; i++) {
57 if ((i < 0) || (8 > sizeBytes - i)) {
58 throw new IndexOutOfBoundsException();
59 }
60 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + i * 8, src[i]);
61 }
62 }
63
64 @Run(test = "test")
65 public static void test_runner() {
66 test(byteArray, longArray);
67 }
68
69 }
|
34 * @bug 8300256
35 * @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64")
36 * @modules java.base/jdk.internal.misc
37 * @library /test/lib /
38 * @run driver compiler.c2.irTests.TestVectorizationNotRun
39 */
40
41 public class TestVectorizationNotRun {
42 private static final Unsafe UNSAFE = Unsafe.getUnsafe();
43
44 public static void main(String[] args) {
45 TestFramework.runWithFlags("--add-modules", "java.base", "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED");
46 }
47
48 static int size = 1024;
49 static int sizeBytes = 8 * size;
50 static byte[] byteArray = new byte[sizeBytes];
51 static long[] longArray = new long[size];
52
53 @Test
54 @IR(applyIf = {"UseCompactObjectHeaders", "false"},
55 counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
56 public static void test(byte[] dest, long[] src) {
57 for (int i = 0; i < src.length; i++) {
58 if ((i < 0) || (8 > sizeBytes - i)) {
59 throw new IndexOutOfBoundsException();
60 }
61 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + i * 8, src[i]);
62 }
63 }
64
65 @Run(test = "test")
66 public static void test_runner() {
67 test(byteArray, longArray);
68 }
69
70 }
|