Mercurial > hg > truffle
annotate graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/IntegerBits.java @ 7282:390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
the HP_series and FloatingReads tests have been disabled temporarily
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 20 Dec 2012 14:59:57 +0100 |
parents | f368ec89e231 |
children | 5e3d1a68664e |
rev | line source |
---|---|
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
1 /* |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
4 * |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
8 * |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
14 * |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
18 * |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
21 * questions. |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
22 */ |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
23 package com.oracle.graal.jtt.jdk; |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
24 |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
25 import com.oracle.graal.jtt.*; |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
26 import org.junit.*; |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
27 |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
28 |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
29 public class IntegerBits extends JTTTest { |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
30 @SuppressWarnings("unused") |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
31 private static int init = Integer.reverseBytes(42); |
7120
3b91556bd518
make jtt test cases static
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5875
diff
changeset
|
32 private static int original = 0x01020304; |
3b91556bd518
make jtt test cases static
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5875
diff
changeset
|
33 private static int v = 0b1000; |
3b91556bd518
make jtt test cases static
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5875
diff
changeset
|
34 private static int zero = 0; |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
35 |
7120
3b91556bd518
make jtt test cases static
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5875
diff
changeset
|
36 public static int test(int o) { |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
37 return Integer.reverseBytes(o); |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
38 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
39 |
7120
3b91556bd518
make jtt test cases static
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5875
diff
changeset
|
40 public static int test2(int o) { |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
41 return Integer.numberOfLeadingZeros(o); |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
42 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
43 |
7120
3b91556bd518
make jtt test cases static
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5875
diff
changeset
|
44 public static int test3(int o) { |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
45 return Integer.numberOfTrailingZeros(o); |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
46 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
47 |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7120
diff
changeset
|
48 public static int test4(int o) { |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7120
diff
changeset
|
49 return Integer.bitCount(o); |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7120
diff
changeset
|
50 } |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7120
diff
changeset
|
51 |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
52 @Test |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
53 public void run0() { |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
54 runTest("test", original); |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
55 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
56 |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
57 @Test |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
58 public void run1() { |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
59 runTest("test3", v); |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
60 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
61 |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
62 @Test |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
63 public void run2() { |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
64 runTest("test2", v); |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
65 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
66 |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
67 @Test |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
68 public void run3() { |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
69 runTest("test3", zero); |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
70 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
71 |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
72 @Test |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
73 public void run4() { |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
74 runTest("test2", zero); |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
75 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
76 |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
77 @Test |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
78 public void run5() { |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
79 runTest("test", 0x01020304); |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
80 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
81 |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
82 @Test |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
83 public void run6() { |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
84 runTest("test3", 0b1000); |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
85 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
86 |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
87 @Test |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
88 public void run7() { |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
89 runTest("test2", 0b1000); |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
90 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
91 |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
92 @Test |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
93 public void run8() { |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
94 runTest("test3", 0); |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
95 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
96 |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
97 @Test |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
98 public void run9() { |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
99 runTest("test2", 0); |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
100 } |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7120
diff
changeset
|
101 |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7120
diff
changeset
|
102 @Test |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7120
diff
changeset
|
103 public void run10() { |
7282
390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
7280
diff
changeset
|
104 runTest("test4", 0xffffffff); |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7120
diff
changeset
|
105 } |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
106 } |