5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 import jdk.test.lib.*;
26 import jdk.internal.misc.Unsafe;
27
28 /**
29 * @test
30 * @bug 8078497
31 * @summary Tests correct alignment of vectors with loop invariant offset.
32 * @modules java.base/jdk.internal.misc
33 * @library /testlibrary
34 * @run main TestVectorizationWithInvariant
35 */
36 public class TestVectorizationWithInvariant {
37
38 private static Unsafe unsafe;
39 private static final long BYTE_ARRAY_OFFSET;
40 private static final long CHAR_ARRAY_OFFSET;
41
42 static {
43 unsafe = Utils.getUnsafe();
44 BYTE_ARRAY_OFFSET = unsafe.arrayBaseOffset(byte[].class);
45 CHAR_ARRAY_OFFSET = unsafe.arrayBaseOffset(char[].class);
46 }
47
48 public static void main(String[] args) throws Exception {
49 byte[] byte_array1 = new byte[1000];
50 byte[] byte_array2 = new byte[1000];
51 char[] char_array = new char[1000];
52
53 for (int i = 0; i < 20_000; ++i) {
54 copyByteToChar(byte_array1, byte_array2, char_array, 1);
55 copyCharToByte(char_array, byte_array1, 1);
|
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /**
26 * @test
27 * @bug 8078497
28 * @summary Tests correct alignment of vectors with loop invariant offset.
29 * @modules java.base/jdk.internal.misc
30 * @library /testlibrary
31 * @run main compiler.loopopts.superword.TestVectorizationWithInvariant
32 */
33
34 package compiler.loopopts.superword;
35
36 import jdk.internal.misc.Unsafe;
37 import jdk.test.lib.Utils;
38
39 public class TestVectorizationWithInvariant {
40
41 private static Unsafe unsafe;
42 private static final long BYTE_ARRAY_OFFSET;
43 private static final long CHAR_ARRAY_OFFSET;
44
45 static {
46 unsafe = Utils.getUnsafe();
47 BYTE_ARRAY_OFFSET = unsafe.arrayBaseOffset(byte[].class);
48 CHAR_ARRAY_OFFSET = unsafe.arrayBaseOffset(char[].class);
49 }
50
51 public static void main(String[] args) throws Exception {
52 byte[] byte_array1 = new byte[1000];
53 byte[] byte_array2 = new byte[1000];
54 char[] char_array = new char[1000];
55
56 for (int i = 0; i < 20_000; ++i) {
57 copyByteToChar(byte_array1, byte_array2, char_array, 1);
58 copyCharToByte(char_array, byte_array1, 1);
|