xref: /PHP-8.2/ext/opcache/tests/jit/cmp_003.phpt (revision e9f783fc)
1--TEST--
2JIT CMP: 003 Comparison with NaN
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7opcache.jit_buffer_size=1M
8opcache.protect_memory=1
9--EXTENSIONS--
10opcache
11--FILE--
12<?php
13function t() {
14    echo "!";
15    return true;
16}
17function f() {
18    echo "!";
19    return false;
20}
21$a = 0.0;
22$i = 0;
23$b = NAN;
24$c = true;
25$d = false;
26var_dump($a == $b);
27var_dump($a != $b);
28var_dump($a < $b);
29var_dump($a > $b);
30var_dump($a <= $b);
31var_dump($a >= $b);
32var_dump($a == $b ? 1 : 0);
33var_dump($a != $b ? 1 : 0);
34var_dump($a < $b ? 1 : 0);
35var_dump($a > $b ? 1 : 0);
36var_dump($a <= $b ? 1 : 0);
37var_dump($a >= $b ? 1 : 0);
38if ($a == $b) {
39} else {
40    echo "1\n";
41}
42if ($a != $b) {
43} else {
44    echo "2\n";
45}
46if ($a < $b) {
47} else {
48    echo "3\n";
49}
50if ($a > $b) {
51} else {
52    echo "4\n";
53}
54if ($a <= $b) {
55} else {
56    echo "5\n";
57}
58if ($a >= $b) {
59} else {
60    echo "6\n";
61}
62var_dump($i == $b ? 1 : 0);
63var_dump($i != $b ? 1 : 0);
64var_dump($i < $b ? 1 : 0);
65var_dump($i > $b ? 1 : 0);
66var_dump($i <= $b ? 1 : 0);
67var_dump($i >= $b ? 1 : 0);
68if ($i == $b) {
69} else {
70    echo "1\n";
71}
72if ($i != $b) {
73} else {
74    echo "2\n";
75}
76if ($i < $b) {
77} else {
78    echo "3\n";
79}
80if ($i > $b) {
81} else {
82    echo "4\n";
83}
84if ($i <= $b) {
85} else {
86    echo "5\n";
87}
88if ($i >= $b) {
89} else {
90    echo "6\n";
91}
92var_dump($a == $b && t());
93var_dump($a != $b && t());
94var_dump($a < $b && t());
95var_dump($a > $b && t());
96var_dump($a <= $b && t());
97var_dump($a >= $b && t());
98var_dump($a == $b || f());
99var_dump($a != $b || f());
100var_dump($a < $b || f());
101var_dump($a > $b || f());
102var_dump($a <= $b || f());
103var_dump($a >= $b || f());
104var_dump($i == $b && t());
105var_dump($i != $b && t());
106var_dump($i < $b && t());
107var_dump($i > $b && t());
108var_dump($i <= $b && t());
109var_dump($i >= $b && t());
110var_dump($i == $b || f());
111var_dump($i != $b || f());
112var_dump($i < $b || f());
113var_dump($i > $b || f());
114var_dump($i <= $b || f());
115var_dump($i >= $b || f());
116$a=NAN;
117var_dump($a == $b);
118var_dump($a != $b);
119var_dump($a < $b);
120var_dump($a > $b);
121var_dump($a <= $b);
122var_dump($a >= $b);
123var_dump($a == $b ? 1 : 0);
124var_dump($a != $b ? 1 : 0);
125var_dump($a < $b ? 1 : 0);
126var_dump($a > $b ? 1 : 0);
127var_dump($a <= $b ? 1 : 0);
128var_dump($a >= $b ? 1 : 0);
129?>
130--EXPECT--
131bool(false)
132bool(true)
133bool(false)
134bool(false)
135bool(false)
136bool(false)
137int(0)
138int(1)
139int(0)
140int(0)
141int(0)
142int(0)
1431
1443
1454
1465
1476
148int(0)
149int(1)
150int(0)
151int(0)
152int(0)
153int(0)
1541
1553
1564
1575
1586
159bool(false)
160!bool(true)
161bool(false)
162bool(false)
163bool(false)
164bool(false)
165!bool(false)
166bool(true)
167!bool(false)
168!bool(false)
169!bool(false)
170!bool(false)
171bool(false)
172!bool(true)
173bool(false)
174bool(false)
175bool(false)
176bool(false)
177!bool(false)
178bool(true)
179!bool(false)
180!bool(false)
181!bool(false)
182!bool(false)
183bool(false)
184bool(true)
185bool(false)
186bool(false)
187bool(false)
188bool(false)
189int(0)
190int(1)
191int(0)
192int(0)
193int(0)
194int(0)
195