author | lana |
Thu, 23 Feb 2017 17:30:12 +0000 (2017-02-23) | |
changeset 44011 | 5eea3031ae7b |
parent 41705 | 332239c052cc |
permissions | -rw-r--r-- |
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
1 |
/* |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
2 |
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
4 |
* |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
8 |
* |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
13 |
* accompanied this code). |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
14 |
* |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
18 |
* |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
21 |
* questions. |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
22 |
*/ |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
23 |
|
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
24 |
/** |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
25 |
* @test |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
26 |
* @bug 7196199 |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
27 |
* @summary java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
28 |
* |
40059 | 29 |
* @run main/othervm/timeout=400 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions |
30 |
* -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation |
|
31 |
* -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 |
|
32 |
* -XX:CompileCommand=exclude,compiler.runtime.Test7196199::test |
|
33 |
* compiler.runtime.Test7196199 |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
34 |
*/ |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
35 |
|
40059 | 36 |
package compiler.runtime; |
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
37 |
|
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
38 |
public class Test7196199 { |
40059 | 39 |
private static final int ARRLEN = 97; |
40 |
private static final int ITERS = 5000; |
|
41 |
private static final int INI_ITERS = 1000; |
|
42 |
private static final int SFP_ITERS = 10000; |
|
43 |
private static final float SFP_ITERS_F = 10000.f; |
|
44 |
private static final float VALUE = 15.f; |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
45 |
|
40059 | 46 |
public static void main(String args[]) { |
47 |
int errn = test(); |
|
48 |
if (errn > 0) { |
|
49 |
System.err.println("FAILED: " + errn + " errors"); |
|
50 |
System.exit(97); |
|
51 |
} |
|
52 |
System.out.println("PASSED"); |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
53 |
} |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
54 |
|
40059 | 55 |
static int test() { |
56 |
float[] a0 = new float[ARRLEN]; |
|
57 |
float[] a1 = new float[ARRLEN]; |
|
58 |
// Initialize |
|
59 |
for (int i = 0; i < ARRLEN; i++) { |
|
60 |
a0[i] = 0.f; |
|
61 |
a1[i] = (float) i; |
|
62 |
} |
|
63 |
System.out.println("Warmup"); |
|
64 |
for (int i = 0; i < INI_ITERS; i++) { |
|
65 |
test_incrc(a0); |
|
66 |
test_incrv(a0, VALUE); |
|
67 |
test_addc(a0, a1); |
|
68 |
test_addv(a0, a1, VALUE); |
|
69 |
} |
|
70 |
// Test and verify results |
|
71 |
System.out.println("Verification"); |
|
72 |
int errn = 0; |
|
73 |
for (int i = 0; i < ARRLEN; i++) |
|
74 |
a0[i] = 0.f; |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
75 |
|
40059 | 76 |
System.out.println(" test_incrc"); |
77 |
for (int j = 0; j < ITERS; j++) { |
|
78 |
test_incrc(a0); |
|
79 |
for (int i = 0; i < ARRLEN; i++) { |
|
80 |
errn += verify("test_incrc: ", i, a0[i], VALUE * SFP_ITERS_F); |
|
81 |
a0[i] = 0.f; // Reset |
|
82 |
} |
|
83 |
} |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
84 |
|
40059 | 85 |
System.out.println(" test_incrv"); |
86 |
for (int j = 0; j < ITERS; j++) { |
|
87 |
test_incrv(a0, VALUE); |
|
88 |
for (int i = 0; i < ARRLEN; i++) { |
|
89 |
errn += verify("test_incrv: ", i, a0[i], VALUE * SFP_ITERS_F); |
|
90 |
a0[i] = 0.f; // Reset |
|
91 |
} |
|
92 |
} |
|
93 |
||
94 |
System.out.println(" test_addc"); |
|
95 |
for (int j = 0; j < ITERS; j++) { |
|
96 |
test_addc(a0, a1); |
|
97 |
for (int i = 0; i < ARRLEN; i++) { |
|
98 |
errn += verify("test_addc: ", i, a0[i], ((float) i + VALUE) * SFP_ITERS_F); |
|
99 |
a0[i] = 0.f; // Reset |
|
100 |
} |
|
101 |
} |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
102 |
|
40059 | 103 |
System.out.println(" test_addv"); |
104 |
for (int j = 0; j < ITERS; j++) { |
|
105 |
test_addv(a0, a1, VALUE); |
|
106 |
for (int i = 0; i < ARRLEN; i++) { |
|
107 |
errn += verify("test_addv: ", i, a0[i], ((float) i + VALUE) * SFP_ITERS_F); |
|
108 |
a0[i] = 0.f; // Reset |
|
109 |
} |
|
110 |
} |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
111 |
|
40059 | 112 |
if (errn > 0) |
113 |
return errn; |
|
114 |
||
115 |
System.out.println("Time"); |
|
116 |
long start, end; |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
117 |
|
40059 | 118 |
start = System.currentTimeMillis(); |
119 |
for (int i = 0; i < INI_ITERS; i++) { |
|
120 |
test_incrc(a0); |
|
121 |
} |
|
122 |
end = System.currentTimeMillis(); |
|
123 |
System.out.println("test_incrc: " + (end - start)); |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
124 |
|
40059 | 125 |
start = System.currentTimeMillis(); |
126 |
for (int i = 0; i < INI_ITERS; i++) { |
|
127 |
test_incrv(a0, VALUE); |
|
128 |
} |
|
129 |
end = System.currentTimeMillis(); |
|
130 |
System.out.println("test_incrv: " + (end - start)); |
|
131 |
||
132 |
start = System.currentTimeMillis(); |
|
133 |
for (int i = 0; i < INI_ITERS; i++) { |
|
134 |
test_addc(a0, a1); |
|
135 |
} |
|
136 |
end = System.currentTimeMillis(); |
|
137 |
System.out.println("test_addc: " + (end - start)); |
|
138 |
||
139 |
start = System.currentTimeMillis(); |
|
140 |
for (int i = 0; i < INI_ITERS; i++) { |
|
141 |
test_addv(a0, a1, VALUE); |
|
142 |
} |
|
143 |
end = System.currentTimeMillis(); |
|
144 |
System.out.println("test_addv: " + (end - start)); |
|
145 |
||
146 |
return errn; |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
147 |
} |
40059 | 148 |
|
149 |
static void test_incrc(float[] a0) { |
|
150 |
// Non-counted loop with safepoint. |
|
151 |
for (long l = 0; l < SFP_ITERS; l++) { |
|
152 |
// Counted and vectorized loop. |
|
153 |
for (int i = 0; i < a0.length; i += 1) { |
|
154 |
a0[i] += VALUE; |
|
155 |
} |
|
156 |
} |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
157 |
} |
40059 | 158 |
|
159 |
static void test_incrv(float[] a0, float b) { |
|
160 |
// Non-counted loop with safepoint. |
|
161 |
for (long l = 0; l < SFP_ITERS; l++) { |
|
162 |
// Counted and vectorized loop. |
|
163 |
for (int i = 0; i < a0.length; i += 1) { |
|
164 |
a0[i] += b; |
|
165 |
} |
|
166 |
} |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
167 |
} |
40059 | 168 |
|
169 |
static void test_addc(float[] a0, float[] a1) { |
|
170 |
// Non-counted loop with safepoint. |
|
171 |
for (long l = 0; l < SFP_ITERS; l++) { |
|
172 |
// Counted and vectorized loop. |
|
173 |
for (int i = 0; i < a0.length; i += 1) { |
|
174 |
a0[i] += a1[i] + VALUE; |
|
175 |
} |
|
176 |
} |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
177 |
} |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
178 |
|
40059 | 179 |
static void test_addv(float[] a0, float[] a1, float b) { |
180 |
// Non-counted loop with safepoint. |
|
181 |
for (long l = 0; l < SFP_ITERS; l++) { |
|
182 |
// Counted and vectorized loop. |
|
183 |
for (int i = 0; i < a0.length; i += 1) { |
|
184 |
a0[i] += a1[i] + b; |
|
185 |
} |
|
186 |
} |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
187 |
} |
40059 | 188 |
|
189 |
static int verify(String text, int i, float elem, float val) { |
|
190 |
if (elem != val) { |
|
191 |
System.err.println(text + "[" + i + "] = " + elem + " != " + val); |
|
192 |
return 1; |
|
193 |
} |
|
194 |
return 0; |
|
195 |
} |
|
13883
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
196 |
} |
6979b9850feb
7196199: java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
kvn
parents:
diff
changeset
|
197 |