LoopUnroll.java revision 12651:6ef01bd40ce2
1203288Srnoland/*
2203288Srnoland * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
3203288Srnoland * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4203288Srnoland *
5203288Srnoland * This code is free software; you can redistribute it and/or modify it
6203288Srnoland * under the terms of the GNU General Public License version 2 only, as
7203288Srnoland * published by the Free Software Foundation.
8203288Srnoland *
9203288Srnoland * This code is distributed in the hope that it will be useful, but WITHOUT
10203288Srnoland * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11203288Srnoland * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12203288Srnoland * version 2 for more details (a copy is included in the LICENSE file that
13203288Srnoland * accompanied this code).
14203288Srnoland *
15203288Srnoland * You should have received a copy of the GNU General Public License version
16203288Srnoland * 2 along with this work; if not, write to the Free Software Foundation,
17203288Srnoland * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18203288Srnoland *
19203288Srnoland * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20203288Srnoland * or visit www.oracle.com if you need additional information or have any
21203288Srnoland * questions.
22203288Srnoland */
23203288Srnolandpackage org.graalvm.compiler.jtt.loop;
24203288Srnoland
25203288Srnolandimport org.junit.Test;
26203288Srnoland
27203288Srnolandimport org.graalvm.compiler.jtt.JTTTest;
28203288Srnoland
29203288Srnoland/*
30203288Srnoland */
31203288Srnolandpublic class LoopUnroll extends JTTTest {
32203288Srnoland
33203288Srnoland    public static int test(int input) {
34203288Srnoland        int ret = 2;
35203288Srnoland        int current = input;
36203288Srnoland        for (int i = 0; i < 7; i++) {
37203288Srnoland            ret *= 2 + current;
38203288Srnoland            current /= 50;
39203288Srnoland        }
40203288Srnoland        return ret;
41203288Srnoland    }
42203288Srnoland
43203288Srnoland    @Test
44203288Srnoland    public void run0() throws Throwable {
45203288Srnoland        runTest("test", 42);
46203288Srnoland    }
47203288Srnoland
48203288Srnoland}
49203288Srnoland