xref: /qemu/tests/fp/meson.build (revision b83a80e8)
1# There are namespace pollution issues on Windows, due to osdep.h
2# bringing in Windows headers that define a FLOAT128 type.
3if targetos == 'windows'
4  subdir_done()
5endif
6
7fpcflags = [
8  # softfloat defines
9  '-DSOFTFLOAT_ROUND_ODD',
10  '-DINLINE_LEVEL=5',
11  '-DSOFTFLOAT_FAST_DIV32TO16',
12  '-DSOFTFLOAT_FAST_DIV64TO32',
13  '-DSOFTFLOAT_FAST_INT64',
14  # testfloat defines
15  '-DFLOAT16',
16  '-DFLOAT64',
17  '-DEXTFLOAT80',
18  '-DFLOAT128',
19  '-DFLOAT_ROUND_ODD',
20  '-DLONG_DOUBLE_IS_EXTFLOAT80',
21]
22
23sfdir = 'berkeley-softfloat-3/source'
24sfspedir = sfdir / '8086-SSE'
25tfdir = 'berkeley-testfloat-3/source'
26
27sfinc = include_directories(sfdir / 'include', sfspedir)
28
29tfcflags = [
30  '-Wno-implicit-fallthrough',
31  '-Wno-strict-prototypes',
32  '-Wno-unknown-pragmas',
33  '-Wno-uninitialized',
34  '-Wno-missing-prototypes',
35  '-Wno-return-type',
36  '-Wno-unused-function',
37  '-Wno-error',
38]
39
40tfgencases = [
41  tfdir / 'genCases_ui32.c',
42  tfdir / 'genCases_ui64.c',
43  tfdir / 'genCases_i32.c',
44  tfdir / 'genCases_i64.c',
45  tfdir / 'genCases_f16.c',
46  tfdir / 'genCases_f32.c',
47  tfdir / 'genCases_f64.c',
48  tfdir / 'genCases_extF80.c',
49  tfdir / 'genCases_f128.c',
50]
51
52tfwritecase = [
53  tfdir / 'writeCase_a_ui32.c',
54  tfdir / 'writeCase_a_ui64.c',
55  tfdir / 'writeCase_a_f16.c',
56  tfdir / 'writeCase_ab_f16.c',
57  tfdir / 'writeCase_abc_f16.c',
58  tfdir / 'writeCase_a_f32.c',
59  tfdir / 'writeCase_ab_f32.c',
60  tfdir / 'writeCase_abc_f32.c',
61  tfdir / 'writeCase_a_f64.c',
62  tfdir / 'writeCase_ab_f64.c',
63  tfdir / 'writeCase_abc_f64.c',
64  tfdir / 'writeCase_a_extF80M.c',
65  tfdir / 'writeCase_ab_extF80M.c',
66  tfdir / 'writeCase_a_f128M.c',
67  tfdir / 'writeCase_ab_f128M.c',
68  tfdir / 'writeCase_abc_f128M.c',
69  tfdir / 'writeCase_z_bool.c',
70  tfdir / 'writeCase_z_ui32.c',
71  tfdir / 'writeCase_z_ui64.c',
72  tfdir / 'writeCase_z_f16.c',
73  tfdir / 'writeCase_z_f32.c',
74  tfdir / 'writeCase_z_f64.c',
75  tfdir / 'writeCase_z_extF80M.c',
76  tfdir / 'writeCase_z_f128M.c',
77]
78
79tftest = [
80  tfdir / 'test_a_ui32_z_f16.c',
81  tfdir / 'test_a_ui32_z_f32.c',
82  tfdir / 'test_a_ui32_z_f64.c',
83  tfdir / 'test_a_ui32_z_extF80.c',
84  tfdir / 'test_a_ui32_z_f128.c',
85  tfdir / 'test_a_ui64_z_f16.c',
86  tfdir / 'test_a_ui64_z_f32.c',
87  tfdir / 'test_a_ui64_z_f64.c',
88  tfdir / 'test_a_ui64_z_extF80.c',
89  tfdir / 'test_a_ui64_z_f128.c',
90  tfdir / 'test_a_i32_z_f16.c',
91  tfdir / 'test_a_i32_z_f32.c',
92  tfdir / 'test_a_i32_z_f64.c',
93  tfdir / 'test_a_i32_z_extF80.c',
94  tfdir / 'test_a_i32_z_f128.c',
95  tfdir / 'test_a_i64_z_f16.c',
96  tfdir / 'test_a_i64_z_f32.c',
97  tfdir / 'test_a_i64_z_f64.c',
98  tfdir / 'test_a_i64_z_extF80.c',
99  tfdir / 'test_a_i64_z_f128.c',
100  tfdir / 'test_a_f16_z_ui32_rx.c',
101  tfdir / 'test_a_f16_z_ui64_rx.c',
102  tfdir / 'test_a_f16_z_i32_rx.c',
103  tfdir / 'test_a_f16_z_i64_rx.c',
104  tfdir / 'test_a_f16_z_ui32_x.c',
105  tfdir / 'test_a_f16_z_ui64_x.c',
106  tfdir / 'test_a_f16_z_i32_x.c',
107  tfdir / 'test_a_f16_z_i64_x.c',
108  tfdir / 'test_a_f16_z_f32.c',
109  tfdir / 'test_a_f16_z_f64.c',
110  tfdir / 'test_a_f16_z_extF80.c',
111  tfdir / 'test_a_f16_z_f128.c',
112  tfdir / 'test_az_f16.c',
113  tfdir / 'test_az_f16_rx.c',
114  tfdir / 'test_abz_f16.c',
115  tfdir / 'test_abcz_f16.c',
116  tfdir / 'test_ab_f16_z_bool.c',
117  tfdir / 'test_a_f32_z_ui32_rx.c',
118  tfdir / 'test_a_f32_z_ui64_rx.c',
119  tfdir / 'test_a_f32_z_i32_rx.c',
120  tfdir / 'test_a_f32_z_i64_rx.c',
121  tfdir / 'test_a_f32_z_ui32_x.c',
122  tfdir / 'test_a_f32_z_ui64_x.c',
123  tfdir / 'test_a_f32_z_i32_x.c',
124  tfdir / 'test_a_f32_z_i64_x.c',
125  tfdir / 'test_a_f32_z_f16.c',
126  tfdir / 'test_a_f32_z_f64.c',
127  tfdir / 'test_a_f32_z_extF80.c',
128  tfdir / 'test_a_f32_z_f128.c',
129  tfdir / 'test_az_f32.c',
130  tfdir / 'test_az_f32_rx.c',
131  tfdir / 'test_abz_f32.c',
132  tfdir / 'test_abcz_f32.c',
133  tfdir / 'test_ab_f32_z_bool.c',
134  tfdir / 'test_a_f64_z_ui32_rx.c',
135  tfdir / 'test_a_f64_z_ui64_rx.c',
136  tfdir / 'test_a_f64_z_i32_rx.c',
137  tfdir / 'test_a_f64_z_i64_rx.c',
138  tfdir / 'test_a_f64_z_ui32_x.c',
139  tfdir / 'test_a_f64_z_ui64_x.c',
140  tfdir / 'test_a_f64_z_i32_x.c',
141  tfdir / 'test_a_f64_z_i64_x.c',
142  tfdir / 'test_a_f64_z_f16.c',
143  tfdir / 'test_a_f64_z_f32.c',
144  tfdir / 'test_a_f64_z_extF80.c',
145  tfdir / 'test_a_f64_z_f128.c',
146  tfdir / 'test_az_f64.c',
147  tfdir / 'test_az_f64_rx.c',
148  tfdir / 'test_abz_f64.c',
149  tfdir / 'test_abcz_f64.c',
150  tfdir / 'test_ab_f64_z_bool.c',
151  tfdir / 'test_a_extF80_z_ui32_rx.c',
152  tfdir / 'test_a_extF80_z_ui64_rx.c',
153  tfdir / 'test_a_extF80_z_i32_rx.c',
154  tfdir / 'test_a_extF80_z_i64_rx.c',
155  tfdir / 'test_a_extF80_z_ui32_x.c',
156  tfdir / 'test_a_extF80_z_ui64_x.c',
157  tfdir / 'test_a_extF80_z_i32_x.c',
158  tfdir / 'test_a_extF80_z_i64_x.c',
159  tfdir / 'test_a_extF80_z_f16.c',
160  tfdir / 'test_a_extF80_z_f32.c',
161  tfdir / 'test_a_extF80_z_f64.c',
162  tfdir / 'test_a_extF80_z_f128.c',
163  tfdir / 'test_az_extF80.c',
164  tfdir / 'test_az_extF80_rx.c',
165  tfdir / 'test_abz_extF80.c',
166  tfdir / 'test_ab_extF80_z_bool.c',
167  tfdir / 'test_a_f128_z_ui32_rx.c',
168  tfdir / 'test_a_f128_z_ui64_rx.c',
169  tfdir / 'test_a_f128_z_i32_rx.c',
170  tfdir / 'test_a_f128_z_i64_rx.c',
171  tfdir / 'test_a_f128_z_ui32_x.c',
172  tfdir / 'test_a_f128_z_ui64_x.c',
173  tfdir / 'test_a_f128_z_i32_x.c',
174  tfdir / 'test_a_f128_z_i64_x.c',
175  tfdir / 'test_a_f128_z_f16.c',
176  tfdir / 'test_a_f128_z_f32.c',
177  tfdir / 'test_a_f128_z_f64.c',
178  tfdir / 'test_a_f128_z_extF80.c',
179  tfdir / 'test_az_f128.c',
180  tfdir / 'test_az_f128_rx.c',
181  tfdir / 'test_abz_f128.c',
182  tfdir / 'test_abcz_f128.c',
183  tfdir / 'test_ab_f128_z_bool.c',
184]
185
186libtestfloat = static_library(
187  'testfloat',
188  files(
189    tfdir / 'uint128_inline.c',
190    tfdir / 'uint128.c',
191    tfdir / 'fail.c',
192    tfdir / 'functions_common.c',
193    tfdir / 'functionInfos.c',
194    tfdir / 'standardFunctionInfos.c',
195    tfdir / 'random.c',
196    tfdir / 'genCases_common.c',
197    tfgencases,
198    tfdir / 'genCases_writeTestsTotal.c',
199    tfdir / 'verCases_inline.c',
200    tfdir / 'verCases_common.c',
201    tfdir / 'verCases_writeFunctionName.c',
202    tfdir / 'readHex.c',
203    tfdir / 'writeHex.c',
204    tfwritecase,
205    tfdir / 'testLoops_common.c',
206    tftest,
207  ),
208  include_directories: sfinc,
209  c_args: tfcflags + fpcflags,
210)
211
212sfcflags = [
213  '-Wno-implicit-fallthrough',
214  '-Wno-missing-prototypes',
215  '-Wno-redundant-decls',
216  '-Wno-return-type',
217  '-Wno-error',
218]
219
220libsoftfloat = static_library(
221  'softfloat',
222  files(
223    # primitives
224    sfdir / 's_eq128.c',
225    sfdir / 's_le128.c',
226    sfdir / 's_lt128.c',
227    sfdir / 's_shortShiftLeft128.c',
228    sfdir / 's_shortShiftRight128.c',
229    sfdir / 's_shortShiftRightJam64.c',
230    sfdir / 's_shortShiftRightJam64Extra.c',
231    sfdir / 's_shortShiftRightJam128.c',
232    sfdir / 's_shortShiftRightJam128Extra.c',
233    sfdir / 's_shiftRightJam32.c',
234    sfdir / 's_shiftRightJam64.c',
235    sfdir / 's_shiftRightJam64Extra.c',
236    sfdir / 's_shiftRightJam128.c',
237    sfdir / 's_shiftRightJam128Extra.c',
238    sfdir / 's_shiftRightJam256M.c',
239    sfdir / 's_countLeadingZeros8.c',
240    sfdir / 's_countLeadingZeros16.c',
241    sfdir / 's_countLeadingZeros32.c',
242    sfdir / 's_countLeadingZeros64.c',
243    sfdir / 's_add128.c',
244    sfdir / 's_add256M.c',
245    sfdir / 's_sub128.c',
246    sfdir / 's_sub256M.c',
247    sfdir / 's_mul64ByShifted32To128.c',
248    sfdir / 's_mul64To128.c',
249    sfdir / 's_mul128By32.c',
250    sfdir / 's_mul128To256M.c',
251    sfdir / 's_approxRecip_1Ks.c',
252    sfdir / 's_approxRecip32_1.c',
253    sfdir / 's_approxRecipSqrt_1Ks.c',
254    sfdir / 's_approxRecipSqrt32_1.c',
255    # others
256    sfdir / 's_roundToUI32.c',
257    sfdir / 's_roundToUI64.c',
258    sfdir / 's_roundToI32.c',
259    sfdir / 's_roundToI64.c',
260    sfdir / 's_normSubnormalF16Sig.c',
261    sfdir / 's_roundPackToF16.c',
262    sfdir / 's_normRoundPackToF16.c',
263    sfdir / 's_addMagsF16.c',
264    sfdir / 's_subMagsF16.c',
265    sfdir / 's_mulAddF16.c',
266    sfdir / 's_normSubnormalF32Sig.c',
267    sfdir / 's_roundPackToF32.c',
268    sfdir / 's_normRoundPackToF32.c',
269    sfdir / 's_addMagsF32.c',
270    sfdir / 's_subMagsF32.c',
271    sfdir / 's_mulAddF32.c',
272    sfdir / 's_normSubnormalF64Sig.c',
273    sfdir / 's_roundPackToF64.c',
274    sfdir / 's_normRoundPackToF64.c',
275    sfdir / 's_addMagsF64.c',
276    sfdir / 's_subMagsF64.c',
277    sfdir / 's_mulAddF64.c',
278    sfdir / 's_normSubnormalExtF80Sig.c',
279    sfdir / 's_roundPackToExtF80.c',
280    sfdir / 's_normRoundPackToExtF80.c',
281    sfdir / 's_addMagsExtF80.c',
282    sfdir / 's_subMagsExtF80.c',
283    sfdir / 's_normSubnormalF128Sig.c',
284    sfdir / 's_roundPackToF128.c',
285    sfdir / 's_normRoundPackToF128.c',
286    sfdir / 's_addMagsF128.c',
287    sfdir / 's_subMagsF128.c',
288    sfdir / 's_mulAddF128.c',
289    sfdir / 'softfloat_state.c',
290    sfdir / 'ui32_to_f16.c',
291    sfdir / 'ui32_to_f32.c',
292    sfdir / 'ui32_to_f64.c',
293    sfdir / 'ui32_to_extF80.c',
294    sfdir / 'ui32_to_extF80M.c',
295    sfdir / 'ui32_to_f128.c',
296    sfdir / 'ui32_to_f128M.c',
297    sfdir / 'ui64_to_f16.c',
298    sfdir / 'ui64_to_f32.c',
299    sfdir / 'ui64_to_f64.c',
300    sfdir / 'ui64_to_extF80.c',
301    sfdir / 'ui64_to_extF80M.c',
302    sfdir / 'ui64_to_f128.c',
303    sfdir / 'ui64_to_f128M.c',
304    sfdir / 'i32_to_f16.c',
305    sfdir / 'i32_to_f32.c',
306    sfdir / 'i32_to_f64.c',
307    sfdir / 'i32_to_extF80.c',
308    sfdir / 'i32_to_extF80M.c',
309    sfdir / 'i32_to_f128.c',
310    sfdir / 'i32_to_f128M.c',
311    sfdir / 'i64_to_f16.c',
312    sfdir / 'i64_to_f32.c',
313    sfdir / 'i64_to_f64.c',
314    sfdir / 'i64_to_extF80.c',
315    sfdir / 'i64_to_extF80M.c',
316    sfdir / 'i64_to_f128.c',
317    sfdir / 'i64_to_f128M.c',
318    sfdir / 'f16_to_ui32.c',
319    sfdir / 'f16_to_ui64.c',
320    sfdir / 'f16_to_i32.c',
321    sfdir / 'f16_to_i64.c',
322    sfdir / 'f16_to_ui32_r_minMag.c',
323    sfdir / 'f16_to_ui64_r_minMag.c',
324    sfdir / 'f16_to_i32_r_minMag.c',
325    sfdir / 'f16_to_i64_r_minMag.c',
326    sfdir / 'f16_to_f32.c',
327    sfdir / 'f16_to_f64.c',
328    sfdir / 'f16_to_extF80.c',
329    sfdir / 'f16_to_extF80M.c',
330    sfdir / 'f16_to_f128.c',
331    sfdir / 'f16_to_f128M.c',
332    sfdir / 'f16_roundToInt.c',
333    sfdir / 'f16_add.c',
334    sfdir / 'f16_sub.c',
335    sfdir / 'f16_mul.c',
336    sfdir / 'f16_mulAdd.c',
337    sfdir / 'f16_div.c',
338    sfdir / 'f16_rem.c',
339    sfdir / 'f16_sqrt.c',
340    sfdir / 'f16_eq.c',
341    sfdir / 'f16_le.c',
342    sfdir / 'f16_lt.c',
343    sfdir / 'f16_eq_signaling.c',
344    sfdir / 'f16_le_quiet.c',
345    sfdir / 'f16_lt_quiet.c',
346    sfdir / 'f16_isSignalingNaN.c',
347    sfdir / 'f32_to_ui32.c',
348    sfdir / 'f32_to_ui64.c',
349    sfdir / 'f32_to_i32.c',
350    sfdir / 'f32_to_i64.c',
351    sfdir / 'f32_to_ui32_r_minMag.c',
352    sfdir / 'f32_to_ui64_r_minMag.c',
353    sfdir / 'f32_to_i32_r_minMag.c',
354    sfdir / 'f32_to_i64_r_minMag.c',
355    sfdir / 'f32_to_f16.c',
356    sfdir / 'f32_to_f64.c',
357    sfdir / 'f32_to_extF80.c',
358    sfdir / 'f32_to_extF80M.c',
359    sfdir / 'f32_to_f128.c',
360    sfdir / 'f32_to_f128M.c',
361    sfdir / 'f32_roundToInt.c',
362    sfdir / 'f32_add.c',
363    sfdir / 'f32_sub.c',
364    sfdir / 'f32_mul.c',
365    sfdir / 'f32_mulAdd.c',
366    sfdir / 'f32_div.c',
367    sfdir / 'f32_rem.c',
368    sfdir / 'f32_sqrt.c',
369    sfdir / 'f32_eq.c',
370    sfdir / 'f32_le.c',
371    sfdir / 'f32_lt.c',
372    sfdir / 'f32_eq_signaling.c',
373    sfdir / 'f32_le_quiet.c',
374    sfdir / 'f32_lt_quiet.c',
375    sfdir / 'f32_isSignalingNaN.c',
376    sfdir / 'f64_to_ui32.c',
377    sfdir / 'f64_to_ui64.c',
378    sfdir / 'f64_to_i32.c',
379    sfdir / 'f64_to_i64.c',
380    sfdir / 'f64_to_ui32_r_minMag.c',
381    sfdir / 'f64_to_ui64_r_minMag.c',
382    sfdir / 'f64_to_i32_r_minMag.c',
383    sfdir / 'f64_to_i64_r_minMag.c',
384    sfdir / 'f64_to_f16.c',
385    sfdir / 'f64_to_f32.c',
386    sfdir / 'f64_to_extF80.c',
387    sfdir / 'f64_to_extF80M.c',
388    sfdir / 'f64_to_f128.c',
389    sfdir / 'f64_to_f128M.c',
390    sfdir / 'f64_roundToInt.c',
391    sfdir / 'f64_add.c',
392    sfdir / 'f64_sub.c',
393    sfdir / 'f64_mul.c',
394    sfdir / 'f64_mulAdd.c',
395    sfdir / 'f64_div.c',
396    sfdir / 'f64_rem.c',
397    sfdir / 'f64_sqrt.c',
398    sfdir / 'f64_eq.c',
399    sfdir / 'f64_le.c',
400    sfdir / 'f64_lt.c',
401    sfdir / 'f64_eq_signaling.c',
402    sfdir / 'f64_le_quiet.c',
403    sfdir / 'f64_lt_quiet.c',
404    sfdir / 'f64_isSignalingNaN.c',
405    sfdir / 'extF80_to_ui32.c',
406    sfdir / 'extF80_to_ui64.c',
407    sfdir / 'extF80_to_i32.c',
408    sfdir / 'extF80_to_i64.c',
409    sfdir / 'extF80_to_ui32_r_minMag.c',
410    sfdir / 'extF80_to_ui64_r_minMag.c',
411    sfdir / 'extF80_to_i32_r_minMag.c',
412    sfdir / 'extF80_to_i64_r_minMag.c',
413    sfdir / 'extF80_to_f16.c',
414    sfdir / 'extF80_to_f32.c',
415    sfdir / 'extF80_to_f64.c',
416    sfdir / 'extF80_to_f128.c',
417    sfdir / 'extF80_roundToInt.c',
418    sfdir / 'extF80_add.c',
419    sfdir / 'extF80_sub.c',
420    sfdir / 'extF80_mul.c',
421    sfdir / 'extF80_div.c',
422    sfdir / 'extF80_rem.c',
423    sfdir / 'extF80_sqrt.c',
424    sfdir / 'extF80_eq.c',
425    sfdir / 'extF80_le.c',
426    sfdir / 'extF80_lt.c',
427    sfdir / 'extF80_eq_signaling.c',
428    sfdir / 'extF80_le_quiet.c',
429    sfdir / 'extF80_lt_quiet.c',
430    sfdir / 'extF80_isSignalingNaN.c',
431    sfdir / 'extF80M_to_ui32.c',
432    sfdir / 'extF80M_to_ui64.c',
433    sfdir / 'extF80M_to_i32.c',
434    sfdir / 'extF80M_to_i64.c',
435    sfdir / 'extF80M_to_ui32_r_minMag.c',
436    sfdir / 'extF80M_to_ui64_r_minMag.c',
437    sfdir / 'extF80M_to_i32_r_minMag.c',
438    sfdir / 'extF80M_to_i64_r_minMag.c',
439    sfdir / 'extF80M_to_f16.c',
440    sfdir / 'extF80M_to_f32.c',
441    sfdir / 'extF80M_to_f64.c',
442    sfdir / 'extF80M_to_f128M.c',
443    sfdir / 'extF80M_roundToInt.c',
444    sfdir / 'extF80M_add.c',
445    sfdir / 'extF80M_sub.c',
446    sfdir / 'extF80M_mul.c',
447    sfdir / 'extF80M_div.c',
448    sfdir / 'extF80M_rem.c',
449    sfdir / 'extF80M_sqrt.c',
450    sfdir / 'extF80M_eq.c',
451    sfdir / 'extF80M_le.c',
452    sfdir / 'extF80M_lt.c',
453    sfdir / 'extF80M_eq_signaling.c',
454    sfdir / 'extF80M_le_quiet.c',
455    sfdir / 'extF80M_lt_quiet.c',
456    sfdir / 'f128_to_ui32.c',
457    sfdir / 'f128_to_ui64.c',
458    sfdir / 'f128_to_i32.c',
459    sfdir / 'f128_to_i64.c',
460    sfdir / 'f128_to_ui32_r_minMag.c',
461    sfdir / 'f128_to_ui64_r_minMag.c',
462    sfdir / 'f128_to_i32_r_minMag.c',
463    sfdir / 'f128_to_i64_r_minMag.c',
464    sfdir / 'f128_to_f16.c',
465    sfdir / 'f128_to_f32.c',
466    sfdir / 'f128_to_extF80.c',
467    sfdir / 'f128_to_f64.c',
468    sfdir / 'f128_roundToInt.c',
469    sfdir / 'f128_add.c',
470    sfdir / 'f128_sub.c',
471    sfdir / 'f128_mul.c',
472    sfdir / 'f128_mulAdd.c',
473    sfdir / 'f128_div.c',
474    sfdir / 'f128_rem.c',
475    sfdir / 'f128_sqrt.c',
476    sfdir / 'f128_eq.c',
477    sfdir / 'f128_le.c',
478    sfdir / 'f128_lt.c',
479    sfdir / 'f128_eq_signaling.c',
480    sfdir / 'f128_le_quiet.c',
481    sfdir / 'f128_lt_quiet.c',
482    sfdir / 'f128_isSignalingNaN.c',
483    sfdir / 'f128M_to_ui32.c',
484    sfdir / 'f128M_to_ui64.c',
485    sfdir / 'f128M_to_i32.c',
486    sfdir / 'f128M_to_i64.c',
487    sfdir / 'f128M_to_ui32_r_minMag.c',
488    sfdir / 'f128M_to_ui64_r_minMag.c',
489    sfdir / 'f128M_to_i32_r_minMag.c',
490    sfdir / 'f128M_to_i64_r_minMag.c',
491    sfdir / 'f128M_to_f16.c',
492    sfdir / 'f128M_to_f32.c',
493    sfdir / 'f128M_to_extF80M.c',
494    sfdir / 'f128M_to_f64.c',
495    sfdir / 'f128M_roundToInt.c',
496    sfdir / 'f128M_add.c',
497    sfdir / 'f128M_sub.c',
498    sfdir / 'f128M_mul.c',
499    sfdir / 'f128M_mulAdd.c',
500    sfdir / 'f128M_div.c',
501    sfdir / 'f128M_rem.c',
502    sfdir / 'f128M_sqrt.c',
503    sfdir / 'f128M_eq.c',
504    sfdir / 'f128M_le.c',
505    sfdir / 'f128M_lt.c',
506    sfdir / 'f128M_eq_signaling.c',
507    sfdir / 'f128M_le_quiet.c',
508    sfdir / 'f128M_lt_quiet.c',
509    # spe
510    sfspedir / 'softfloat_raiseFlags.c',
511    sfspedir / 's_f16UIToCommonNaN.c',
512    sfspedir / 's_commonNaNToF16UI.c',
513    sfspedir / 's_propagateNaNF16UI.c',
514    sfspedir / 's_f32UIToCommonNaN.c',
515    sfspedir / 's_commonNaNToF32UI.c',
516    sfspedir / 's_propagateNaNF32UI.c',
517    sfspedir / 's_f64UIToCommonNaN.c',
518    sfspedir / 's_commonNaNToF64UI.c',
519    sfspedir / 's_propagateNaNF64UI.c',
520    sfspedir / 'extF80M_isSignalingNaN.c',
521    sfspedir / 's_extF80UIToCommonNaN.c',
522    sfspedir / 's_commonNaNToExtF80UI.c',
523    sfspedir / 's_propagateNaNExtF80UI.c',
524    sfspedir / 'f128M_isSignalingNaN.c',
525    sfspedir / 's_f128UIToCommonNaN.c',
526    sfspedir / 's_commonNaNToF128UI.c',
527    sfspedir / 's_propagateNaNF128UI.c',
528  ),
529  include_directories: sfinc,
530  c_args: sfcflags + fpcflags,
531)
532
533fpcflags += [
534  # work around TARGET_* poisoning
535  '-DHW_POISON_H',
536  # define a target to match testfloat's implementation-defined choices, such as
537  # whether to raise the invalid flag when dealing with NaNs in muladd.
538  '-DTARGET_ARM',
539  # FIXME: uiZ may be used uninitialized in this function
540  '-Wno-uninitialized',
541]
542
543fptest = executable(
544  'fp-test',
545  ['fp-test.c', tfdir / 'slowfloat.c', '../../fpu/softfloat.c'],
546  link_with: [libtestfloat, libsoftfloat],
547  dependencies: [qemuutil],
548  include_directories: [sfinc, include_directories(tfdir)],
549  c_args: fpcflags,
550)
551softfloat_conv_tests = {
552    'float-to-float': 'f16_to_f32 f16_to_f64 f16_to_extF80 f16_to_f128 ' +
553                      'f32_to_f16 f32_to_f64 f32_to_extF80 ' +
554                      'f64_to_f16 f64_to_f32 ' +
555                      'extF80_to_f16 extF80_to_f32 ' +
556                      'extF80_to_f64 extF80_to_f128 ' +
557                      'f128_to_f16',
558    'int-to-float': 'i32_to_f16 i64_to_f16 i32_to_f32 i64_to_f32 ' +
559                    'i32_to_f64 i64_to_f64 ' +
560                    'i32_to_extF80 i64_to_extF80 ' +
561                    'i32_to_f128 i64_to_f128',
562    'uint-to-float': 'ui32_to_f16 ui64_to_f16 ui32_to_f32 ui64_to_f32 ' +
563                     'ui32_to_f64 ui64_to_f64 ui64_to_f128 ' +
564                     'ui32_to_extF80 ui64_to_extF80',
565    'float-to-int': 'f16_to_i32 f16_to_i32_r_minMag ' +
566                    'f32_to_i32 f32_to_i32_r_minMag ' +
567                    'f64_to_i32 f64_to_i32_r_minMag ' +
568                    'extF80_to_i32 extF80_to_i32_r_minMag ' +
569                    'f128_to_i32 f128_to_i32_r_minMag ' +
570                    'f16_to_i64 f16_to_i64_r_minMag ' +
571                    'f32_to_i64 f32_to_i64_r_minMag ' +
572                    'f64_to_i64 f64_to_i64_r_minMag ' +
573                    'extF80_to_i64 extF80_to_i64_r_minMag ' +
574                    'f128_to_i64 f128_to_i64_r_minMag',
575    'float-to-uint': 'f16_to_ui32 f16_to_ui32_r_minMag ' +
576                     'f32_to_ui32 f32_to_ui32_r_minMag ' +
577                     'f64_to_ui32 f64_to_ui32_r_minMag ' +
578                     'extF80_to_ui32 extF80_to_ui32_r_minMag ' +
579                     'f128_to_ui32 f128_to_ui32_r_minMag ' +
580                     'f16_to_ui64 f16_to_ui64_r_minMag ' +
581                     'f32_to_ui64 f32_to_ui64_r_minMag ' +
582                     'f64_to_ui64 f64_to_ui64_r_minMag ' +
583                     'extF80_to_ui64 extF80_to_ui64_r_minMag ' +
584                     'f128_to_ui64 f128_to_ui64_r_minMag',
585    'round-to-integer': 'f16_roundToInt f32_roundToInt ' +
586                        'f64_roundToInt extF80_roundToInt f128_roundToInt'
587}
588softfloat_tests = {
589    'eq_signaling' : 'compare',
590    'le' : 'compare',
591    'le_quiet' : 'compare',
592    'lt_quiet' : 'compare',
593    'add': 'ops',
594    'sub': 'ops',
595    'mul': 'ops',
596    'div': 'ops',
597    'rem': 'ops',
598    'sqrt': 'ops'
599}
600# The full test suite can take a bit of time, default to a quick run
601# "-l 2 -r all" can take more than a day for some operations and is best
602# run manually
603fptest_args = ['-s', '-l', '1']
604fptest_rounding_args = ['-r', 'all']
605
606# Conversion Routines:
607foreach k, v : softfloat_conv_tests
608  test('fp-test-' + k, fptest,
609       args: fptest_args + fptest_rounding_args + v.split(),
610       suite: ['softfloat', 'softfloat-conv'])
611endforeach
612
613foreach k, v : softfloat_tests
614  test('fp-test-' + k, fptest,
615       args: fptest_args + fptest_rounding_args +
616             ['f16_' + k, 'f32_' + k, 'f64_' + k, 'f128_' + k, 'extF80_' + k],
617       suite: ['softfloat', 'softfloat-' + v])
618endforeach
619
620# FIXME: extF80_{mulAdd} (missing)
621test('fp-test-mulAdd', fptest,
622     # no fptest_rounding_args
623     args: fptest_args +
624           ['f16_mulAdd', 'f32_mulAdd', 'f64_mulAdd', 'f128_mulAdd'],
625     suite: ['softfloat-slow', 'softfloat-ops-slow', 'slow'], timeout: 90)
626
627fpbench = executable(
628  'fp-bench',
629  ['fp-bench.c', '../../fpu/softfloat.c'],
630  link_with: [libtestfloat, libsoftfloat],
631  dependencies: [qemuutil],
632  include_directories: [sfinc, include_directories(tfdir)],
633  c_args: fpcflags,
634)
635
636fptestlog2 = executable(
637  'fp-test-log2',
638  ['fp-test-log2.c', '../../fpu/softfloat.c'],
639  link_with: [libsoftfloat],
640  dependencies: [qemuutil],
641  include_directories: [sfinc],
642  c_args: fpcflags,
643)
644test('fp-test-log2', fptestlog2,
645     suite: ['softfloat', 'softfloat-ops'])
646