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