Mercurial > hg > truffle
annotate graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Logic0.java @ 14991:64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 06 Apr 2014 17:46:24 +0200 |
parents | 6d28ce8cdeb7 |
children |
rev | line source |
---|---|
11278
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
1 /* |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
4 * |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
8 * |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
14 * |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
18 * |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
21 * questions. |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
22 */ |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
23 package com.oracle.graal.jtt.optimize; |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
24 |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11278
diff
changeset
|
25 import org.junit.*; |
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11278
diff
changeset
|
26 |
11278
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
27 import com.oracle.graal.jtt.*; |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
28 |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
29 /* |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
30 */ |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
31 public class Logic0 extends JTTTest { |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
32 |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
33 public static int test(int a, int b) { |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
34 if (((a != 0 ? 1 : 0) & (a != b ? 1 : 0)) != 0) { |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
35 return 42; |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
36 } |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
37 return 11; |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
38 } |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
39 |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
40 @Test |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
41 public void run0() throws Throwable { |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
42 runTest("test", 0, 0); |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
43 } |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
44 |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
45 @Test |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
46 public void run1() throws Throwable { |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
47 runTest("test", 0, 33); |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
48 } |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
49 |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
50 @Test |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
51 public void run2() throws Throwable { |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
52 runTest("test", 33, 66); |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
53 } |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
54 |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
55 @Test |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
56 public void run3() throws Throwable { |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
57 runTest("test", 33, 67); |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
58 } |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
59 |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
60 @Test |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
61 public void run4() throws Throwable { |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
62 runTest("test", 33, 33); |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
63 } |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
64 |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
65 @Test |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
66 public void run5() throws Throwable { |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
67 runTest("test", 0, 32); |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
68 } |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
69 |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
70 @Test |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
71 public void run6() throws Throwable { |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
72 runTest("test", 32, 66); |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
73 } |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
74 |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
75 @Test |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
76 public void run7() throws Throwable { |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
77 runTest("test", 32, 67); |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
78 } |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
79 |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
80 @Test |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
81 public void run8() throws Throwable { |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
82 runTest("test", 32, 32); |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
83 } |
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
84 } |