The work I needed to do to make various softfloat emulation behaviours runtime-selectable for Arm FEAT_AFP has left the fpu code with very few remaning target ifdefs. So this series turns the last remaning ones into runtime behaviour choices and switches the fpu code into "build once" rather than "build per target". The main driver of this is that we're going to want to do this for the "multiple targets in one binary" work.
The remaining fpu target ifdefs fall into two categories: (1) floatx80 behaviours Two QEMU targets implement floatx80: x86 and m68k. (PPC also has one use in the xsrqpxp round-to-80-bit-precision operation, and the Linux-user NWFPE emulation nominally supports it, but these are minor.) x86 and m68k disagree about some of the corner cases of floatx80 where the value has the explicit Integer bit wrongly set. At the moment the fpu code defaults to "floatx80 behaves like x86", with TARGET_M68K ifdefs to get the other option. The first six patches in this series remove those ifdefs, replacing them with a floatx80_behaviour field in float_status which can have various flags set to select the individual behaviours. The default is "like x86", which allows us to set these only for m68k and not worry about the minor "technically makes some use of floatx80" cases. I do have a question about whether I've correctly understood what we do (or don't do) for handling input pseudo-denormals, which we currently do via the FloatFmt::m68k_denormal flag; see patch 6. I'm confident that the patch is correct, in the sense of not being a behaviour change, but less sure about whether the TODO comment I've added about existing incorrect handling is right. (2) simple optimizations A handful of the target ifdefs are making compile-time choices that can trivially be pushed back to runtime by deleting the ifdef. Patches 7-9 do these changes. Then patch 10 can update the meson.build file to "build once". Tested with 'make check-tcg' and 'make check-functional'; the series is supposed to not have any behaviour changes. thanks -- PMM Peter Maydell (10): fpu: Make targets specify floatx80 default Inf at runtime target/m68k: Avoid using floatx80_infinity global const target/i386: Avoid using floatx80_infinity global const fpu: Make targets specify whether floatx80 Inf can have Int bit clear fpu: Make floatx80 invalid encoding settable at runtime fpu: Move m68k_denormal fmt flag into floatx80_behaviour fpu: Always decide no_signaling_nans() at runtime fpu: Always decide snan_bit_is_one() at runtime fpu: Don't compile-time disable hardfloat for PPC targets fpu: Build only once include/fpu/softfloat-helpers.h | 12 +++++ include/fpu/softfloat-types.h | 42 +++++++++++++++ include/fpu/softfloat.h | 91 ++++++++++++++++++--------------- fpu/softfloat.c | 23 +++------ target/hppa/fpu_helper.c | 1 + target/i386/tcg/fpu_helper.c | 51 +++++++++--------- target/m68k/cpu.c | 35 +++++++++++++ target/m68k/fpu_helper.c | 2 +- target/m68k/softfloat.c | 47 ++++++----------- target/sh4/cpu.c | 1 + fpu/softfloat-parts.c.inc | 20 ++++++-- fpu/softfloat-specialize.c.inc | 29 ++++------- fpu/meson.build | 2 +- 13 files changed, 220 insertions(+), 136 deletions(-) -- 2.43.0