blob: fb666eaaea8e0e9e58eb2c2517bc29a16499013f [file] [log] [blame]
Mark Mendellb8b97692015-05-22 16:58:19 -04001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18public class Main {
19 public static int FIBCOUNT = 64;
20 public static int[] fibs;
21
22 /// CHECK-START-X86_64: int Main.test() disassembly (after)
23 /// CHECK: If
24 /// CHECK-NEXT: cmp
25 /// CHECK-NEXT: jnl/ge
26 /// CHECK-NOT: jmp
27 /// CHECK: ArrayGet
28 // Checks that there is no conditional jump over a jmp. The ArrayGet is in
29 // the next block.
30 public static int test() {
31 for (int i = 1; ; i++) {
32 if (i >= FIBCOUNT) {
33 return fibs[0];
34 }
35 fibs[i] = (i + fibs[(i - 1)]);
36 }
37 }
38
39 public static void main(String[] args) {
40 fibs = new int[FIBCOUNT];
41 fibs[0] = 1;
42 test();
43 }
44}