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