rizin/test/unit/meson.build
billow 19b1783c88
Improve RzIL floating-point support (#6626)
The `RzFloat` changes fix or improve:

- binary80 explicit-integer-bit, pseudo-value, infinity, and NaN handling;
- binary16 conversions;
- gradual underflow and directed rounding;
- overflow, underflow, invalid-operation, and inexact exception reporting;
- exception propagation through nested conversions and arithmetic operations;
- binary80 fused multiply-add rounding, including reduced-precision and double-rounding edge cases;
- thread-local SoftFloat state, preventing rounding state from leaking between threads.

The `RzIL` changes add scoped binary80 precision support through `RzFloatRPrecision` and `FWITH_RPREC`. The supported precisions are 32, 64, and 80. Precision scopes restore the
previous thread-local SoftFloat state after successful evaluation and evaluation failures.

Runtime rounding modes are represented explicitly by dedicated pure opcodes:

- `FCONVERT_WITH_RMODE`
- `FROUND_WITH_RMODE`
- `FSQRT_WITH_RMODE`
- `FADD_WITH_RMODE`
- `FSUB_WITH_RMODE`
- `FMUL_WITH_RMODE`
- `FDIV_WITH_RMODE`
- `FMOD_WITH_RMODE`

Their rounding-mode operand is a 32-bit IL bitvector whose values correspond to `RzFloatRMode`: RNE, RNA, RTP, RTN, and RTZ. Invalid operand widths are rejected by validation,
while invalid runtime values cause evaluation to fail with an error.

Dedicated opcodes keep runtime-controlled floating-point expressions compact. This is useful for architectures whose rounding mode is selected from register state and avoids the
expression duplication caused by expanding every operation into nested `ITE` branches.

The new operations are supported by:

- construction, duplication, and destruction;
- type and operand validation;
- VM evaluation;
- plain, Unicode, and JSON exporters;
- graph output and opcode stringification.

`FEXCEPT` now emits a VM event only when the queried exception is present, while preserving exceptions raised by nested conversions and arithmetic operations.
2026-08-10 01:06:17 +08:00

191 lines
3.5 KiB
Meson

if get_option('enable_tests')
test_conf_data = configuration_data()
test_conf_data.set_quoted('TEST_BUILD_TYPES_DIR', fs.as_posix(types_build_dir))
test_config_h = configure_file(
input: 'test_config.h.in',
output: 'test_config.h',
configuration: test_conf_data,
)
subdir('auxiliary')
tests = [
'addr_interval',
'agraph',
'analysis_block',
'analysis_cc',
'analysis_class_graph',
'analysis_coverage',
'analysis_function',
'analysis_hints',
'analysis_meta',
'analysis_var',
'analysis_xrefs',
'annotated_code',
'base16',
'base32',
'base36',
'base64',
'base85',
'big',
'bin_lines',
'bin_mach0',
'bitvector',
'bits',
'marks',
'buf',
'cmd',
'compare',
'config',
'cons',
'cons_bar',
'cons_canvas',
'cons_grep',
'cons_histogram',
'cons_html',
'cons_hud',
'cons_line',
'cons_pal',
'cons_pager',
'cons_pipe',
'cons_rgb',
'contrbtree',
'core_addr',
'core_analysis_stats',
'core_bin',
'core_cmd',
'core_plugin',
'core_seek',
'core_task',
'crypto',
'debruijn',
'debug',
'debug_session',
'diff',
'ebcdic',
'endian',
'encodings',
'event',
'file',
'flags',
'flirt',
'float',
'glob',
'graph',
'graph_new',
'graph_new_cfg',
'hash',
'hex',
'ht',
'id_storage',
'idpool',
'idstorage',
'inflate_deflate',
'il_definitions',
'il_reg',
'il_validate',
'il_vm',
'il_helpers',
'intervaltree',
'io',
'io_ihex',
'itv',
'json',
'leb128',
'list',
'log',
'lzma',
'math',
'mem',
'ovf',
'parse',
'pf',
'pj',
'rbtree',
'reg',
'regex',
'rop',
'rop_constraint',
'run',
'rz_test',
'sdb_array',
'sdb_diff',
'sdb_sdb',
'sdb_util',
'serialize_analysis',
'serialize_mark',
'serialize_config',
'serialize_debug',
'serialize_flag',
'serialize_seek',
'serialize_spaces',
'serialize_types',
'skiplist',
'skyline',
'socket',
'spaces',
'sparse',
'stack',
'str',
'strbuf',
'str_search',
'subprocess',
'syscall',
'table',
'task',
'threads',
'tokens',
'tree',
'trie',
'type',
'uleb128',
'unum',
'util',
'vector',
'yank',
]
if capstone_dep.type_name() == 'internal'
tests += 'analysis_op'
endif
unit_test_env = environment()
if test_env_common_path != []
unit_test_env.prepend('PATH', test_env_common_path)
endif
foreach test : tests
exe = executable('test_@0@'.format(test), 'test_@0@.c'.format(test),
include_directories: [platform_inc, '.'],
dependencies: [
rz_util_dep,
rz_main_dep,
rz_socket_dep,
rz_core_dep,
rz_io_dep,
rz_bin_dep,
rz_flag_dep,
rz_cons_dep,
rz_arch_dep,
rz_debug_dep,
rz_config_dep,
rz_reg_dep,
rz_syscall_dep,
rz_type_dep,
rz_egg_dep,
rz_search_dep,
rz_hash_dep,
rz_crypto_dep,
rz_magic_dep,
rz_il_dep,
rz_mark_dep,
rzheap_dep,
lrt,
] + (test == 'unum' ? [mth] : []),
install: false,
install_rpath: rpath_exe,
implicit_include_directories: false,
)
test(test, exe, workdir: join_paths(meson.current_source_dir(), '..'), env: unit_test_env, depends: [auxiliaries, types_files], suite: 'unit')
endforeach
endif