Mercurial > hg > graal-jvmci-8
annotate test/compiler/loopopts/ConstFPVectorization.java @ 24094:9b69cec6d01b
Merge with jdk8u121-b13
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Mon, 06 Feb 2017 17:18:57 +0100 |
parents | aefa2e84b424 |
children |
rev | line source |
---|---|
22888
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
1 /* |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
4 * |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
8 * |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
13 * accompanied this code). |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
14 * |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
18 * |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
21 * questions. |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
22 * |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
23 */ |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
24 |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
25 /** |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
26 * @test |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
27 * @bug 8074869 |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
28 * @summary C2 code generator can replace -0.0f with +0.0f on Linux |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
29 * @run main ConstFPVectorization 8 |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
30 * @author volker.simonis@gmail.com |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
31 * |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
32 */ |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
33 |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
34 public class ConstFPVectorization { |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
35 |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
36 static float[] f = new float[16]; |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
37 static double[] d = new double[16]; |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
38 |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
39 static void floatLoop(int count) { |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
40 for (int i = 0; i < count; i++) { |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
41 f[i] = -0.0f; |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
42 } |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
43 } |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
44 |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
45 static void doubleLoop(int count) { |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
46 for (int i = 0; i < count; i++) { |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
47 d[i] = -0.0d; |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
48 } |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
49 } |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
50 |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
51 public static void main(String args[]) { |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
52 for (int i = 0; i < 10_000; i++) { |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
53 floatLoop(Integer.parseInt(args[0])); |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
54 doubleLoop(Integer.parseInt(args[0])); |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
55 } |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
56 for (int i = 0; i < Integer.parseInt(args[0]); i++) { |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
57 if (Float.floatToRawIntBits(f[i]) != Float.floatToRawIntBits(-0.0f)) |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
58 throw new Error("Float error at index " + i); |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
59 if (Double.doubleToRawLongBits(d[i]) != Double.doubleToRawLongBits(-0.0d)) |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
60 throw new Error("Double error at index " + i); |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
61 } |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
62 } |
aefa2e84b424
8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents:
diff
changeset
|
63 } |