author | sundar |
Wed, 06 May 2015 20:04:42 +0530 | |
changeset 30394 | 72a59e4dffea |
parent 24778 | 2ff5d7041566 |
permissions | -rw-r--r-- |
24737
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
1 |
/* |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
2 |
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24737
diff
changeset
|
4 |
* |
24737
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24737
diff
changeset
|
8 |
* |
24737
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
13 |
* accompanied this code). |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24737
diff
changeset
|
14 |
* |
24737
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24737
diff
changeset
|
18 |
* |
24737
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
21 |
* questions. |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
22 |
*/ |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
23 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
24 |
/** |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
25 |
* JDK-8040024: NaN comparisons were failing |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
26 |
* |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
27 |
* @test |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
28 |
* @run |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
29 |
*/ |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
30 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
31 |
function f(x) { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
32 |
if((x - '0') <= 9) { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
33 |
print("FAIL if <="); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
34 |
} else { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
35 |
print("OK"); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
36 |
} |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
37 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
38 |
if((x - '0') < 9) { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
39 |
print("FAIL if <"); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
40 |
} else { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
41 |
print("OK"); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
42 |
} |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
43 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
44 |
if((x - '0') >= 9) { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
45 |
print("FAIL if >="); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
46 |
} else { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
47 |
print("OK"); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
48 |
} |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
49 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
50 |
if((x - '0') > 9) { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
51 |
print("FAIL if >"); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
52 |
} else { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
53 |
print("OK"); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
54 |
} |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
55 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
56 |
while((x - '0') <= 9) { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
57 |
print("FAIL while <="); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
58 |
break; |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
59 |
} |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
60 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
61 |
while((x - '0') < 9) { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
62 |
print("FAIL while <"); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
63 |
break; |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
64 |
} |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
65 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
66 |
while((x - '0') > 9) { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
67 |
print("FAIL while >"); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
68 |
break; |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
69 |
} |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
70 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
71 |
while((x - '0') >= 9) { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
72 |
print("FAIL while >="); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
73 |
break; |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
74 |
} |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
75 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
76 |
var i = 0; |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
77 |
do { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
78 |
print("do-while <= only once"); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
79 |
if(++i == 2) { break; } |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
80 |
} while((x - '0') <= 9); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
81 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
82 |
var i = 0; |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
83 |
do { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
84 |
print("do-while < only once"); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
85 |
if(++i == 2) { break; } |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
86 |
} while((x - '0') < 9); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
87 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
88 |
var i = 0; |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
89 |
do { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
90 |
print("do-while >= only once"); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
91 |
if(++i == 2) { break; } |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
92 |
} while((x - '0') >= 9); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
93 |
|
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
94 |
var i = 0; |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
95 |
do { |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
96 |
print("do-while > only once"); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
97 |
if(++i == 2) { break; } |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
98 |
} while((x - '0') > 9); |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
99 |
} |
4e15e10f771f
8040024: BranchOptimizer produces bad code for NaN FP comparison
attila
parents:
diff
changeset
|
100 |
f('%') |