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