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