annotate test/compiler/intrinsics/mathexact/GVNTest.java @ 17726:085b304a1cc5

8027754: Enable loop optimizations for loops with MathExact inside Reviewed-by: kvn, iveresov
author rbackman
date Thu, 23 Jan 2014 12:08:28 +0100
parents 9949533a8623
children 4ca6dc0799b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13077
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
1 /*
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
4 *
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
7 * published by the Free Software Foundation.
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
8 *
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
13 * accompanied this code).
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
14 *
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
18 *
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
21 * questions.
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
22 */
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
23
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
24 /*
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
25 * @test
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
26 * @bug 8028207
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
27 * @summary Verify that GVN doesn't mess up the two addExacts
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
28 * @compile GVNTest.java
17726
085b304a1cc5 8027754: Enable loop optimizations for loops with MathExact inside
rbackman
parents: 13421
diff changeset
29 * @run main GVNTest
13077
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
30 *
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
31 */
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
32
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
33 public class GVNTest {
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
34 public static int result = 0;
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
35 public static int value = 93;
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
36 public static void main(String[] args) {
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
37 for (int i = 0; i < 50000; ++i) {
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
38 result = runTest(value + i);
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
39 result = runTest(value + i);
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
40 result = runTest(value + i);
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
41 result = runTest(value + i);
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
42 result = runTest(value + i);
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
43 }
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
44 }
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
45
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
46 public static int runTest(int value) {
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
47 int v = value + value;
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
48 int sum = 0;
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
49 if (v < 4032) {
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
50 for (int i = 0; i < 1023; ++i) {
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
51 sum += Math.addExact(value, value);
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
52 }
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
53 } else {
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
54 for (int i = 0; i < 321; ++i) {
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
55 sum += Math.addExact(value, value);
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
56 }
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
57 }
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
58 return sum + v;
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
59 }
b957c650babb 8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff changeset
60 }