qemu/include
Peter Maydell 8a132968b2 softfloat: Allow 2-operand NaN propagation rule to be set at runtime
IEEE 758 does not define a fixed rule for which NaN to pick as the
result if both operands of a 2-operand operation are NaNs.  As a
result different architectures have ended up with different rules for
propagating NaNs.

QEMU currently hardcodes the NaN propagation logic into the binary
because pickNaN() has an ifdef ladder for different targets.  We want
to make the propagation rule instead be selectable at runtime,
because:
 * this will let us have multiple targets in one QEMU binary
 * the Arm FEAT_AFP architectural feature includes letting
   the guest select a NaN propagation rule at runtime
 * x86 specifies different propagation rules for x87 FPU ops
   and for SSE ops, and specifying the rule in the float_status
   would let us emulate this, instead of wrongly using the
   x87 rules everywhere

In this commit we add an enum for the propagation rule, the field in
float_status, and the corresponding getters and setters.  We change
pickNaN to honour this, but because all targets still leave this
field at its default 0 value, the fallback logic will pick the rule
type with the old ifdef ladder.

It's valid not to set a propagation rule if default_nan_mode is
enabled, because in that case there's no need to pick a NaN; all the
callers of pickNaN() catch this case and skip calling it.  So we can
already assert that we don't get into the "no rule defined" codepath
for our four targets which always set default_nan_mode: Hexagon,
RiscV, SH4 and Tricore, and for the one target which does not have FP
at all: avr.  These targets will not need to be updated to call
set_float_2nan_prop_rule().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20241025141254.2141506-2-peter.maydell@linaro.org
2024-11-05 10:09:52 +00:00
..
authz Prefer 'on' | 'off' over 'yes' | 'no' for bool options 2021-01-29 17:07:53 +00:00
block include: Move QemuLockCnt APIs to their own header 2024-10-15 15:16:17 +01:00
chardev chardev/mux: convert size members to unsigned int 2024-10-15 12:26:01 +04:00
crypto include/crypto: clarify @result/@result_len for hash/hmac APIs 2024-10-22 11:44:23 +01:00
disas disas: Remove CRIS disassembler 2024-10-07 11:33:20 +02:00
exec exec/memtxattr: add process identifier to the transaction attributes 2024-10-31 13:51:24 +10:00
fpu softfloat: Allow 2-operand NaN propagation rule to be set at runtime 2024-11-05 10:09:52 +00:00
gdbstub gdbstub/helpers: Introduce ldtul_$endian_p() helpers 2024-10-15 11:55:09 -03:00
hw * target/i386: new feature bits for AMD processors 2024-11-02 16:21:38 +00:00
io qio: add support for SO_PEERCRED for socket channel 2024-07-22 13:47:41 +02:00
libdecnumber Replace config-time define HOST_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
migration migration: Drop migration_is_idle() 2024-10-31 15:48:18 -04:00
monitor monitor: Remove obsolete stubs 2024-06-30 19:51:44 +03:00
net net: Remove deadcode 2024-10-03 17:26:05 +03:00
qapi qerror: QERR_PROPERTY_VALUE_OUT_OF_RANGE is no longer used, drop 2024-10-18 15:03:35 +02:00
qemu target/i386: use compiler builtin to compute PF 2024-10-31 18:28:33 +01:00
qom qom: remove unused function 2024-10-31 18:28:32 +01:00
scsi hw/ufs: Support for UFS logical unit 2023-09-07 14:01:29 -04:00
semihosting semihosting: Include missing 'gdbstub/syscalls.h' header 2024-07-22 09:38:01 +01:00
standard-headers linux-headers: Update to Linux v6.12-rc5 2024-11-02 15:20:41 +08:00
sysemu Migration pull request for softfreeze 2024-11-04 12:31:45 +00:00
tcg tcg/riscv: Add basic support for vector 2024-10-22 11:57:25 -07:00
ui ui: refactor using a common qemu_pixman_shareable 2024-10-14 17:34:09 +04:00
user linux-user: Remove support for CRIS target 2024-09-13 20:10:50 +02:00
elf.h util: spelling fixes 2023-08-31 19:47:43 +02:00
glib-compat.h Bump minimum glib version to v2.66 2024-05-14 12:46:24 +02:00
qemu-io.h
qemu-main.h ui/cocoa: Run qemu_init in the main thread 2022-09-23 14:36:33 +02:00