Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopUnroll.java @ 12749:d36c39829943
Test case for loop unrolling.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Mon, 11 Nov 2013 17:49:41 +0100 |
parents | |
children | 64dcb92ee75a |
rev | line source |
---|---|
12749
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
1 /* |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
4 * |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
8 * |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
14 * |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
18 * |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
21 * questions. |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
22 */ |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.jtt.loop; |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
24 |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
25 import com.oracle.graal.jtt.*; |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
26 import org.junit.*; |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
27 |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
28 /* |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
29 */ |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
30 public class LoopUnroll extends JTTTest { |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
31 |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
32 public static int test(int input) { |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
33 int ret = 2; |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
34 int current = input; |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
35 for (int i = 0; i < 7; i++) { |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
36 ret *= 2 + current; |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
37 current /= 50; |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
38 } |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
39 return ret; |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
40 } |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
41 |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
42 @Test |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
43 public void run0() throws Throwable { |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
44 runTest("test", 42); |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
45 } |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
46 |
d36c39829943
Test case for loop unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
47 } |