2023-09-29 12:40:03 +03:00
|
|
|
if 'CONFIG_TCG' not in config_all_accel
|
2022-02-04 18:29:22 +03:00
|
|
|
subdir_done()
|
|
|
|
endif
|
2020-08-06 15:08:31 +03:00
|
|
|
# There are namespace pollution issues on Windows, due to osdep.h
|
|
|
|
# bringing in Windows headers that define a FLOAT128 type.
|
2023-11-03 11:17:48 +03:00
|
|
|
if host_os == 'windows'
|
2020-08-06 15:08:31 +03:00
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
2024-09-17 17:16:41 +03:00
|
|
|
# By default tests run with the usual 30s timeout; particularly
|
|
|
|
# slow tests can have that overridden here. The keys here are
|
|
|
|
# the testnames without their fp-test- prefix.
|
|
|
|
slow_fp_tests = {
|
|
|
|
'rem': 60,
|
|
|
|
'div': 60,
|
|
|
|
'mul': 60,
|
|
|
|
'mulAdd': 180,
|
|
|
|
}
|
|
|
|
|
2023-05-19 14:27:10 +03:00
|
|
|
sfcflags = [
|
2020-08-06 15:08:31 +03:00
|
|
|
# softfloat defines
|
|
|
|
'-DSOFTFLOAT_ROUND_ODD',
|
|
|
|
'-DINLINE_LEVEL=5',
|
|
|
|
'-DSOFTFLOAT_FAST_DIV32TO16',
|
|
|
|
'-DSOFTFLOAT_FAST_DIV64TO32',
|
|
|
|
'-DSOFTFLOAT_FAST_INT64',
|
2023-05-19 14:27:10 +03:00
|
|
|
]
|
|
|
|
tfcflags = [
|
2020-08-06 15:08:31 +03:00
|
|
|
# testfloat defines
|
|
|
|
'-DFLOAT16',
|
|
|
|
'-DFLOAT64',
|
|
|
|
'-DEXTFLOAT80',
|
|
|
|
'-DFLOAT128',
|
|
|
|
'-DFLOAT_ROUND_ODD',
|
|
|
|
'-DLONG_DOUBLE_IS_EXTFLOAT80',
|
|
|
|
]
|
|
|
|
|
2023-05-19 14:27:10 +03:00
|
|
|
libsoftfloat_proj = subproject('berkeley-softfloat-3', required: true,
|
|
|
|
default_options: 'defines=' + ','.join(sfcflags))
|
|
|
|
libsoftfloat = libsoftfloat_proj.get_variable('libsoftfloat_dep')
|
2020-08-06 15:08:31 +03:00
|
|
|
|
2023-05-19 14:27:10 +03:00
|
|
|
libtestfloat_proj = subproject('berkeley-testfloat-3', required: true,
|
|
|
|
default_options: 'defines=' + ','.join(tfcflags))
|
|
|
|
libtestfloat = libtestfloat_proj.get_variable('libtestfloat_dep')
|
|
|
|
libslowfloat = libtestfloat_proj.get_variable('libslowfloat_dep')
|
2020-08-06 15:08:31 +03:00
|
|
|
|
2023-05-19 14:27:10 +03:00
|
|
|
fpcflags = [
|
2020-08-06 15:08:31 +03:00
|
|
|
# work around TARGET_* poisoning
|
|
|
|
'-DHW_POISON_H',
|
|
|
|
# define a target to match testfloat's implementation-defined choices, such as
|
|
|
|
# whether to raise the invalid flag when dealing with NaNs in muladd.
|
|
|
|
'-DTARGET_ARM',
|
|
|
|
# FIXME: uiZ may be used uninitialized in this function
|
|
|
|
'-Wno-uninitialized',
|
|
|
|
]
|
|
|
|
|
|
|
|
fptest = executable(
|
|
|
|
'fp-test',
|
2023-05-19 14:27:10 +03:00
|
|
|
['fp-test.c', '../../fpu/softfloat.c'],
|
|
|
|
dependencies: [qemuutil, libsoftfloat, libtestfloat, libslowfloat],
|
2020-08-06 15:08:31 +03:00
|
|
|
c_args: fpcflags,
|
|
|
|
)
|
|
|
|
softfloat_conv_tests = {
|
|
|
|
'float-to-float': 'f16_to_f32 f16_to_f64 f16_to_extF80 f16_to_f128 ' +
|
|
|
|
'f32_to_f16 f32_to_f64 f32_to_extF80 ' +
|
|
|
|
'f64_to_f16 f64_to_f32 ' +
|
|
|
|
'extF80_to_f16 extF80_to_f32 ' +
|
|
|
|
'extF80_to_f64 extF80_to_f128 ' +
|
|
|
|
'f128_to_f16',
|
|
|
|
'int-to-float': 'i32_to_f16 i64_to_f16 i32_to_f32 i64_to_f32 ' +
|
2021-05-12 03:47:49 +03:00
|
|
|
'i32_to_f64 i64_to_f64 ' +
|
|
|
|
'i32_to_extF80 i64_to_extF80 ' +
|
|
|
|
'i32_to_f128 i64_to_f128',
|
2020-08-06 15:08:31 +03:00
|
|
|
'uint-to-float': 'ui32_to_f16 ui64_to_f16 ui32_to_f32 ui64_to_f32 ' +
|
|
|
|
'ui32_to_f64 ui64_to_f64 ui64_to_f128 ' +
|
|
|
|
'ui32_to_extF80 ui64_to_extF80',
|
|
|
|
'float-to-int': 'f16_to_i32 f16_to_i32_r_minMag ' +
|
|
|
|
'f32_to_i32 f32_to_i32_r_minMag ' +
|
|
|
|
'f64_to_i32 f64_to_i32_r_minMag ' +
|
|
|
|
'extF80_to_i32 extF80_to_i32_r_minMag ' +
|
|
|
|
'f128_to_i32 f128_to_i32_r_minMag ' +
|
|
|
|
'f16_to_i64 f16_to_i64_r_minMag ' +
|
|
|
|
'f32_to_i64 f32_to_i64_r_minMag ' +
|
|
|
|
'f64_to_i64 f64_to_i64_r_minMag ' +
|
|
|
|
'extF80_to_i64 extF80_to_i64_r_minMag ' +
|
|
|
|
'f128_to_i64 f128_to_i64_r_minMag',
|
|
|
|
'float-to-uint': 'f16_to_ui32 f16_to_ui32_r_minMag ' +
|
|
|
|
'f32_to_ui32 f32_to_ui32_r_minMag ' +
|
|
|
|
'f64_to_ui32 f64_to_ui32_r_minMag ' +
|
|
|
|
'extF80_to_ui32 extF80_to_ui32_r_minMag ' +
|
|
|
|
'f128_to_ui32 f128_to_ui32_r_minMag ' +
|
|
|
|
'f16_to_ui64 f16_to_ui64_r_minMag ' +
|
|
|
|
'f32_to_ui64 f32_to_ui64_r_minMag ' +
|
|
|
|
'f64_to_ui64 f64_to_ui64_r_minMag ' +
|
|
|
|
'extF80_to_ui64 extF80_to_ui64_r_minMag ' +
|
|
|
|
'f128_to_ui64 f128_to_ui64_r_minMag',
|
|
|
|
'round-to-integer': 'f16_roundToInt f32_roundToInt ' +
|
2021-05-12 03:47:49 +03:00
|
|
|
'f64_roundToInt extF80_roundToInt f128_roundToInt'
|
2020-08-06 15:08:31 +03:00
|
|
|
}
|
|
|
|
softfloat_tests = {
|
|
|
|
'eq_signaling' : 'compare',
|
|
|
|
'le' : 'compare',
|
|
|
|
'le_quiet' : 'compare',
|
|
|
|
'lt_quiet' : 'compare',
|
|
|
|
'add': 'ops',
|
|
|
|
'sub': 'ops',
|
|
|
|
'mul': 'ops',
|
|
|
|
'div': 'ops',
|
|
|
|
'rem': 'ops',
|
|
|
|
'sqrt': 'ops'
|
|
|
|
}
|
|
|
|
# The full test suite can take a bit of time, default to a quick run
|
|
|
|
# "-l 2 -r all" can take more than a day for some operations and is best
|
|
|
|
# run manually
|
2023-02-28 22:06:33 +03:00
|
|
|
fptest_args = ['-q', '-s', '-l', '1']
|
2020-08-06 15:08:31 +03:00
|
|
|
fptest_rounding_args = ['-r', 'all']
|
|
|
|
|
|
|
|
# Conversion Routines:
|
|
|
|
foreach k, v : softfloat_conv_tests
|
2020-10-19 13:22:43 +03:00
|
|
|
test('fp-test-' + k, fptest,
|
2020-08-06 15:08:31 +03:00
|
|
|
args: fptest_args + fptest_rounding_args + v.split(),
|
2024-09-17 17:16:41 +03:00
|
|
|
timeout: slow_fp_tests.get(k, 30),
|
2020-08-06 15:08:31 +03:00
|
|
|
suite: ['softfloat', 'softfloat-conv'])
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
foreach k, v : softfloat_tests
|
2020-10-19 13:22:43 +03:00
|
|
|
test('fp-test-' + k, fptest,
|
2020-08-06 15:08:31 +03:00
|
|
|
args: fptest_args + fptest_rounding_args +
|
2021-05-12 03:47:49 +03:00
|
|
|
['f16_' + k, 'f32_' + k, 'f64_' + k, 'f128_' + k, 'extF80_' + k],
|
2024-09-17 17:16:41 +03:00
|
|
|
timeout: slow_fp_tests.get(k, 30),
|
2020-08-06 15:08:31 +03:00
|
|
|
suite: ['softfloat', 'softfloat-' + v])
|
|
|
|
endforeach
|
2021-05-12 03:47:49 +03:00
|
|
|
|
|
|
|
# FIXME: extF80_{mulAdd} (missing)
|
2020-10-19 13:22:43 +03:00
|
|
|
test('fp-test-mulAdd', fptest,
|
2020-08-06 15:08:31 +03:00
|
|
|
# no fptest_rounding_args
|
|
|
|
args: fptest_args +
|
|
|
|
['f16_mulAdd', 'f32_mulAdd', 'f64_mulAdd', 'f128_mulAdd'],
|
2024-09-17 17:16:41 +03:00
|
|
|
timeout: slow_fp_tests.get('mulAdd', 30),
|
|
|
|
suite: ['softfloat-slow', 'softfloat-ops-slow', 'slow'])
|
2020-08-06 15:08:31 +03:00
|
|
|
|
2022-07-14 11:43:57 +03:00
|
|
|
executable(
|
2020-08-06 15:08:31 +03:00
|
|
|
'fp-bench',
|
|
|
|
['fp-bench.c', '../../fpu/softfloat.c'],
|
2023-05-19 14:27:10 +03:00
|
|
|
dependencies: [qemuutil, libtestfloat, libsoftfloat],
|
2020-08-06 15:08:31 +03:00
|
|
|
c_args: fpcflags,
|
|
|
|
)
|
2020-11-22 21:42:22 +03:00
|
|
|
|
|
|
|
fptestlog2 = executable(
|
|
|
|
'fp-test-log2',
|
|
|
|
['fp-test-log2.c', '../../fpu/softfloat.c'],
|
2023-05-19 14:27:10 +03:00
|
|
|
dependencies: [qemuutil, libsoftfloat],
|
2020-11-22 21:42:22 +03:00
|
|
|
c_args: fpcflags,
|
|
|
|
)
|
|
|
|
test('fp-test-log2', fptestlog2,
|
2024-09-17 17:16:41 +03:00
|
|
|
timeout: slow_fp_tests.get('log2', 30),
|
2020-11-22 21:42:22 +03:00
|
|
|
suite: ['softfloat', 'softfloat-ops'])
|