compiler.h: for newer gcc attributes, we can use __has_attribute()
[nasm.git] / test / floatexp.asm
blob2bc359eb33f9e6afd3f87628c2783fa455be0cca
1 ;Testname=unoptimized; Arguments=-O0 -fbin -ofloatexp.bin; Files=stdout stderr floatexp.bin
2 ;Testname=optimized; Arguments=-Ox -fbin -ofloatexp.bin; Files=stdout stderr floatexp.bin
4 bits 64
6 ; Test of floating-point formats
9 ; 8-bit
10 mov al,__float8__(1.0)
11 mov al,__float8__(+1.0)
12 mov al,__float8__(-1.0)
13 mov al,__float8__(0.0)
14 mov al,__float8__(+0.0)
15 mov al,__float8__(-0.0)
16 mov al,__float8__(1.83203125)
17 mov al,__float8__(+1.83203125)
18 mov al,__float8__(-1.83203125)
19 mov al,__float8__(1.83203125e1)
20 mov al,__float8__(+1.83203125e1)
21 mov al,__float8__(-1.83203125e1)
22 mov al,__float8__(1.83203125e-1)
23 mov al,__float8__(+1.83203125e-1)
24 mov al,__float8__(-1.83203125e-1)
25 mov al,__float8__(1.13203125e-2) ; Denormal!
26 mov al,__float8__(+1.13203125e-2) ; Denormal!
27 mov al,__float8__(-1.13203125e-2) ; Denormal!
28 mov al,__float8__(__Infinity__)
29 mov al,__float8__(+__Infinity__)
30 mov al,__float8__(-__Infinity__)
31 mov al,__float8__(__NaN__)
32 mov al,__float8__(__QNaN__)
33 mov al,__float8__(__SNaN__)
35 ; 16-bit
36 mov ax,__float16__(1.0)
37 mov ax,__float16__(+1.0)
38 mov ax,__float16__(-1.0)
39 mov ax,__float16__(0.0)
40 mov ax,__float16__(+0.0)
41 mov ax,__float16__(-0.0)
42 mov ax,__float16__(1.83203125)
43 mov ax,__float16__(+1.83203125)
44 mov ax,__float16__(-1.83203125)
45 mov ax,__float16__(1.83203125e3)
46 mov ax,__float16__(+1.83203125e3)
47 mov ax,__float16__(-1.83203125e3)
48 mov ax,__float16__(1.83203125e-3)
49 mov ax,__float16__(+1.83203125e-3)
50 mov ax,__float16__(-1.83203125e-3)
51 mov ax,__float16__(1.83203125e-6) ; Denormal!
52 mov ax,__float16__(+1.83203125e-6) ; Denormal!
53 mov ax,__float16__(-1.83203125e-6) ; Denormal!
54 mov ax,__float16__(__Infinity__)
55 mov ax,__float16__(+__Infinity__)
56 mov ax,__float16__(-__Infinity__)
57 mov ax,__float16__(__NaN__)
58 mov ax,__float16__(__QNaN__)
59 mov ax,__float16__(__SNaN__)
61 ; 32-bit
62 mov eax,__float32__(1.0)
63 mov eax,__float32__(+1.0)
64 mov eax,__float32__(-1.0)
65 mov eax,__float32__(0.0)
66 mov eax,__float32__(+0.0)
67 mov eax,__float32__(-0.0)
68 mov eax,__float32__(1.83203125)
69 mov eax,__float32__(+1.83203125)
70 mov eax,__float32__(-1.83203125)
71 mov eax,__float32__(1.83203125e15)
72 mov eax,__float32__(+1.83203125e15)
73 mov eax,__float32__(-1.83203125e15)
74 mov eax,__float32__(1.83203125e-15)
75 mov eax,__float32__(+1.83203125e-15)
76 mov eax,__float32__(-1.83203125e-15)
77 mov eax,__float32__(1.83203125e-40) ; Denormal!
78 mov eax,__float32__(+1.83203125e-40) ; Denormal!
79 mov eax,__float32__(-1.83203125e-40) ; Denormal!
80 mov eax,__float32__(__Infinity__)
81 mov eax,__float32__(+__Infinity__)
82 mov eax,__float32__(-__Infinity__)
83 mov eax,__float32__(__NaN__)
84 mov eax,__float32__(__QNaN__)
85 mov eax,__float32__(__SNaN__)
87 ; 64-bit
88 mov rax,__float64__(1.0)
89 mov rax,__float64__(+1.0)
90 mov rax,__float64__(-1.0)
91 mov rax,__float64__(0.0)
92 mov rax,__float64__(+0.0)
93 mov rax,__float64__(-0.0)
94 mov rax,__float64__(1.83203125)
95 mov rax,__float64__(+1.83203125)
96 mov rax,__float64__(-1.83203125)
97 mov rax,__float64__(1.83203125e300)
98 mov rax,__float64__(+1.83203125e300)
99 mov rax,__float64__(-1.83203125e300)
100 mov rax,__float64__(1.83203125e-300)
101 mov rax,__float64__(+1.83203125e-300)
102 mov rax,__float64__(-1.83203125e-300)
103 mov rax,__float64__(1.83203125e-320) ; Denormal!
104 mov rax,__float64__(+1.83203125e-320) ; Denormal!
105 mov rax,__float64__(-1.83203125e-320) ; Denormal!
106 mov rax,__float64__(__Infinity__)
107 mov rax,__float64__(+__Infinity__)
108 mov rax,__float64__(-__Infinity__)
109 mov rax,__float64__(__NaN__)
110 mov rax,__float64__(__QNaN__)
111 mov rax,__float64__(__SNaN__)
113 ; 80-bit
114 mov rax,__float80m__(1.0)
115 mov ax,__float80e__(1.0)
116 mov rax,__float80m__(+1.0)
117 mov ax,__float80e__(+1.0)
118 mov rax,__float80m__(-1.0)
119 mov ax,__float80e__(-1.0)
120 mov rax,__float80m__(0.0)
121 mov ax,__float80e__(0.0)
122 mov rax,__float80m__(+0.0)
123 mov ax,__float80e__(+0.0)
124 mov rax,__float80m__(-0.0)
125 mov ax,__float80e__(-0.0)
126 mov rax,__float80m__(1.83203125)
127 mov ax,__float80e__(1.83203125)
128 mov rax,__float80m__(+1.83203125)
129 mov ax,__float80e__(+1.83203125)
130 mov rax,__float80m__(-1.83203125)
131 mov ax,__float80e__(-1.83203125)
132 mov rax,__float80m__(1.83203125e+4000)
133 mov ax,__float80e__(1.83203125e+4000)
134 mov rax,__float80m__(+1.83203125e+4000)
135 mov ax,__float80e__(+1.83203125e+4000)
136 mov rax,__float80m__(-1.83203125e+4000)
137 mov ax,__float80e__(-1.83203125e+4000)
138 mov rax,__float80m__(1.83203125e-4000)
139 mov ax,__float80e__(1.83203125e-4000)
140 mov rax,__float80m__(+1.83203125e-4000)
141 mov ax,__float80e__(+1.83203125e-4000)
142 mov rax,__float80m__(-1.83203125e-4000)
143 mov ax,__float80e__(-1.83203125e-4000)
144 mov rax,__float80m__(1.83203125e-4940) ; Denormal!
145 mov ax,__float80e__(1.83203125e-4940) ; Denormal!
146 mov rax,__float80m__(+1.83203125e-4940) ; Denormal!
147 mov ax,__float80e__(+1.83203125e-4940) ; Denormal!
148 mov rax,__float80m__(-1.83203125e-4940) ; Denormal!
149 mov ax,__float80e__(-1.83203125e-4940) ; Denormal!
150 mov rax,__float80m__(__Infinity__)
151 mov ax,__float80e__(__Infinity__)
152 mov rax,__float80m__(+__Infinity__)
153 mov ax,__float80e__(+__Infinity__)
154 mov rax,__float80m__(-__Infinity__)
155 mov ax,__float80e__(-__Infinity__)
156 mov rax,__float80m__(__NaN__)
157 mov ax,__float80e__(__NaN__)
158 mov rax,__float80m__(__QNaN__)
159 mov ax,__float80e__(__QNaN__)
160 mov rax,__float80m__(__SNaN__)
161 mov ax,__float80e__(__SNaN__)
163 ; 128-bit
164 mov rax,__float128l__(1.0)
165 mov rax,__float128h__(1.0)
166 mov rax,__float128l__(+1.0)
167 mov rax,__float128h__(+1.0)
168 mov rax,__float128l__(-1.0)
169 mov rax,__float128h__(-1.0)
170 mov rax,__float128l__(0.0)
171 mov rax,__float128h__(0.0)
172 mov rax,__float128l__(+0.0)
173 mov rax,__float128h__(+0.0)
174 mov rax,__float128l__(-0.0)
175 mov rax,__float128h__(-0.0)
176 mov rax,__float128l__(1.83203125)
177 mov rax,__float128h__(1.83203125)
178 mov rax,__float128l__(+1.83203125)
179 mov rax,__float128h__(+1.83203125)
180 mov rax,__float128l__(-1.83203125)
181 mov rax,__float128h__(-1.83203125)
182 mov rax,__float128l__(1.83203125e+4000)
183 mov rax,__float128h__(1.83203125e+4000)
184 mov rax,__float128l__(+1.83203125e+4000)
185 mov rax,__float128h__(+1.83203125e+4000)
186 mov rax,__float128l__(-1.83203125e+4000)
187 mov rax,__float128h__(-1.83203125e+4000)
188 mov rax,__float128l__(1.83203125e-4000)
189 mov rax,__float128h__(1.83203125e-4000)
190 mov rax,__float128l__(+1.83203125e-4000)
191 mov rax,__float128h__(+1.83203125e-4000)
192 mov rax,__float128l__(-1.83203125e-4000)
193 mov rax,__float128h__(-1.83203125e-4000)
194 mov rax,__float128l__(1.83203125e-4940) ; Denormal!
195 mov rax,__float128h__(1.83203125e-4940) ; Denormal!
196 mov rax,__float128l__(+1.83203125e-4940) ; Denormal!
197 mov rax,__float128h__(+1.83203125e-4940) ; Denormal!
198 mov rax,__float128l__(-1.83203125e-4940) ; Denormal!
199 mov rax,__float128h__(-1.83203125e-4940) ; Denormal!
200 mov rax,__float128l__(__Infinity__)
201 mov rax,__float128h__(__Infinity__)
202 mov rax,__float128l__(+__Infinity__)
203 mov rax,__float128h__(+__Infinity__)
204 mov rax,__float128l__(-__Infinity__)
205 mov rax,__float128h__(-__Infinity__)
206 mov rax,__float128l__(__NaN__)
207 mov rax,__float128h__(__NaN__)
208 mov rax,__float128l__(__QNaN__)
209 mov rax,__float128h__(__QNaN__)
210 mov rax,__float128l__(__SNaN__)
211 mov rax,__float128h__(__SNaN__)
214 ; Test hexadecimal floating-point numbers
217 ; 16-bit
218 mov ax,__float16__(1.0)
219 mov ax,__float16__(0x1.0)
220 mov ax,__float16__(2.0)
221 mov ax,__float16__(0x2.0)
222 mov ax,__float16__(0x1.0p+1)
223 mov ax,__float16__(0x1.0p-1)
224 mov ax,__float16__(0x0.0)
225 mov ax,__float16__(0x1.23456789)
226 mov ax,__float16__(0x0.123456789)
227 mov ax,__float16__(0x0.0000123456789)
228 mov ax,__float16__(0x1.23456789p10)
229 mov ax,__float16__(0x1.23456789p+10)
230 mov ax,__float16__(0x1.23456789p-10)
231 mov ax,__float16__(0x0.123456789p10)
232 mov ax,__float16__(0x0.123456789p+10)
233 mov ax,__float16__(0x0.123456789abcdef0123456789abcdef012345p-10)
234 mov ax,__float16__(0x0.0000123456789)
235 mov ax,__float16__(0x0.0000123456789p+10)
236 mov ax,__float16__(0x0.0000123456789p-10)
238 ; 32-bit
239 mov eax,__float32__(1.0)
240 mov eax,__float32__(0x1.0)
241 mov eax,__float32__(2.0)
242 mov eax,__float32__(0x2.0)
243 mov eax,__float32__(0x1.0p+1)
244 mov eax,__float32__(0x1.0p-1)
245 mov eax,__float32__(0x0.0)
246 mov eax,__float32__(0x1.23456789)
247 mov eax,__float32__(0x0.123456789)
248 mov eax,__float32__(0x0.0000123456789)
249 mov eax,__float32__(0x1.23456789p10)
250 mov eax,__float32__(0x1.23456789p+10)
251 mov eax,__float32__(0x1.23456789p-10)
252 mov eax,__float32__(0x0.123456789p10)
253 mov eax,__float32__(0x0.123456789p+10)
254 mov eax,__float32__(0x0.123456789abcdef0123456789abcdef012345p-10)
255 mov eax,__float32__(0x0.0000123456789)
256 mov eax,__float32__(0x0.0000123456789p+10)
257 mov eax,__float32__(0x0.0000123456789p-10)
258 mov eax,__float32__(0x123456789.0)
259 mov eax,__float32__(0x0000123456789.0)
260 mov eax,__float32__(0x123456789.0p+0)
261 mov eax,__float32__(0x123456789.0p+64)
263 ; 64-bit
264 mov rax,__float64__(1.0)
265 mov rax,__float64__(0x1.0)
266 mov rax,__float64__(2.0)
267 mov rax,__float64__(0x2.0)
268 mov rax,__float64__(0x1.0p+1)
269 mov rax,__float64__(0x1.0p-1)
270 mov rax,__float64__(0x0.0)
271 mov rax,__float64__(0x1.23456789)
272 mov rax,__float64__(0x0.123456789)
273 mov rax,__float64__(0x0.0000123456789)
274 mov rax,__float64__(0x1.23456789p10)
275 mov rax,__float64__(0x1.23456789p+10)
276 mov rax,__float64__(0x1.23456789p-10)
277 mov rax,__float64__(0x0.123456789p10)
278 mov rax,__float64__(0x0.123456789p+10)
279 mov rax,__float64__(0x0.123456789abcdef0123456789abcdef012345p-10)
280 mov rax,__float64__(0x0.0000123456789)
281 mov rax,__float64__(0x0.0000123456789p+10)
282 mov rax,__float64__(0x0.0000123456789p-10)
283 mov rax,__float64__(0x123456789.0)
284 mov rax,__float64__(0x0000123456789.0)
285 mov rax,__float64__(0x123456789.0p+0)
286 mov rax,__float64__(0x123456789.0p+300)
288 ; 80-bit
289 mov rax,__float80m__(1.0)
290 mov ax,__float80e__(1.0)
291 mov rax,__float80m__(0x1.0)
292 mov ax,__float80e__(0x1.0)
293 mov rax,__float80m__(2.0)
294 mov ax,__float80e__(2.0)
295 mov rax,__float80m__(0x2.0)
296 mov ax,__float80e__(0x2.0)
297 mov rax,__float80m__(0x1.0p+1)
298 mov ax,__float80e__(0x1.0p+1)
299 mov rax,__float80m__(0x1.0p-1)
300 mov ax,__float80e__(0x1.0p-1)
301 mov rax,__float80m__(0x0.0)
302 mov ax,__float80e__(0x0.0)
303 mov rax,__float80m__(0x1.23456789)
304 mov ax,__float80e__(0x1.23456789)
305 mov rax,__float80m__(0x0.123456789)
306 mov ax,__float80e__(0x0.123456789)
307 mov rax,__float80m__(0x0.0000123456789)
308 mov ax,__float80e__(0x0.0000123456789)
309 mov rax,__float80m__(0x1.23456789p10)
310 mov ax,__float80e__(0x1.23456789p10)
311 mov rax,__float80m__(0x1.23456789p+10)
312 mov ax,__float80e__(0x1.23456789p+10)
313 mov rax,__float80m__(0x1.23456789p-10)
314 mov ax,__float80e__(0x1.23456789p-10)
315 mov rax,__float80m__(0x0.123456789p10)
316 mov ax,__float80e__(0x0.123456789p10)
317 mov rax,__float80m__(0x0.123456789p+10)
318 mov ax,__float80e__(0x0.123456789p+10)
319 mov rax,__float80m__(0x0.123456789abcdef0123456789abcdef012345p-10)
320 mov ax,__float80e__(0x0.123456789abcdef0123456789abcdef012345p-10)
321 mov rax,__float80m__(0x0.0000123456789)
322 mov ax,__float80e__(0x0.0000123456789)
323 mov rax,__float80m__(0x0.0000123456789p+10)
324 mov ax,__float80e__(0x0.0000123456789p+10)
325 mov rax,__float80m__(0x0.0000123456789p-10)
326 mov ax,__float80e__(0x0.0000123456789p-10)
327 mov rax,__float80m__(0x123456789.0)
328 mov ax,__float80e__(0x123456789.0)
329 mov rax,__float80m__(0x0000123456789.0)
330 mov ax,__float80e__(0x0000123456789.0)
331 mov rax,__float80m__(0x123456789.0p+0)
332 mov ax,__float80e__(0x123456789.0p+0)
333 mov rax,__float80m__(0x123456789.0p+1024)
334 mov ax,__float80e__(0x123456789.0p+1024)
336 ; 128-bit
337 mov rax,__float128l__(1.0)
338 mov rax,__float128h__(1.0)
339 mov rax,__float128l__(0x1.0)
340 mov rax,__float128h__(0x1.0)
341 mov rax,__float128l__(2.0)
342 mov rax,__float128h__(2.0)
343 mov rax,__float128l__(0x2.0)
344 mov rax,__float128h__(0x2.0)
345 mov rax,__float128l__(0x1.0p+1)
346 mov rax,__float128h__(0x1.0p+1)
347 mov rax,__float128l__(0x1.0p-1)
348 mov rax,__float128h__(0x1.0p-1)
349 mov rax,__float128l__(0x0.0)
350 mov rax,__float128h__(0x0.0)
351 mov rax,__float128l__(0x1.23456789)
352 mov rax,__float128h__(0x1.23456789)
353 mov rax,__float128l__(0x0.123456789)
354 mov rax,__float128h__(0x0.123456789)
355 mov rax,__float128l__(0x0.0000123456789)
356 mov rax,__float128h__(0x0.0000123456789)
357 mov rax,__float128l__(0x1.23456789p10)
358 mov rax,__float128h__(0x1.23456789p10)
359 mov rax,__float128l__(0x1.23456789p+10)
360 mov rax,__float128h__(0x1.23456789p+10)
361 mov rax,__float128l__(0x1.23456789p-10)
362 mov rax,__float128h__(0x1.23456789p-10)
363 mov rax,__float128l__(0x0.123456789p10)
364 mov rax,__float128h__(0x0.123456789p10)
365 mov rax,__float128l__(0x0.123456789p+10)
366 mov rax,__float128h__(0x0.123456789p+10)
367 mov rax,__float128l__(0x0.123456789abcdef0123456789abcdef012345p-10)
368 mov rax,__float128h__(0x0.123456789abcdef0123456789abcdef012345p-10)
369 mov rax,__float128l__(0x0.0000123456789)
370 mov rax,__float128h__(0x0.0000123456789)
371 mov rax,__float128l__(0x0.0000123456789p+10)
372 mov rax,__float128h__(0x0.0000123456789p+10)
373 mov rax,__float128l__(0x0.0000123456789p-10)
374 mov rax,__float128h__(0x0.0000123456789p-10)
375 mov rax,__float128l__(0x123456789.0)
376 mov rax,__float128h__(0x123456789.0)
377 mov rax,__float128l__(0x0000123456789.0)
378 mov rax,__float128h__(0x0000123456789.0)
379 mov rax,__float128l__(0x123456789.0p+0)
380 mov rax,__float128h__(0x123456789.0p+0)
381 mov rax,__float128l__(0x123456789.0p+1024)
382 mov rax,__float128h__(0x123456789.0p+1024)