mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00
fpu: Make targets specify floatx80 default Inf at runtime
Currently we hardcode at compile time whether the floatx80 default Infinity value has the explicit integer bit set or not (x86 sets it; m68k does not). To be able to compile softfloat once for all targets we'd like to move this setting to runtime. Define a new FloatX80Behaviour enum which is a set of flags that define the target's floatx80 handling. Initially we define just one flag, for whether the default Infinity has the Integer bit set or not, but we will expand this in future commits to cover the other floatx80 target specifics that we currently make compile-time settings. Define a new function floatx80_default_inf() which returns the appropriate default Infinity value of the given sign, and use it in the code that was previously directly using the compile-time constant floatx80_infinity_{low,high} values when packing an infinity into a floatx80. Since floatx80 is highly unlikely to be supported in any new architecture, and the existing code is generally written as "default to like x87, with an ifdef for m68k", we make the default value for the floatx80 behaviour flags be "what x87 does". This means we only need to change the m68k target to specify the behaviour flags. (Other users of floatx80 are the Arm NWFPE emulation, which is obsolete and probably not actually doing the right thing anyway, and the PPC xsrqpxp insn. Making the default be "like x87" avoids our needing to review and test for behaviour changes there.) We will clean up the remaining uses of the floatx80_infinity global constant in subsequent commits. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20250224111524.1101196-2-peter.maydell@linaro.org Message-id: 20250217125055.160887-2-peter.maydell@linaro.org
This commit is contained in:
parent
bb09b7bfd3
commit
9b6e986e28
6 changed files with 45 additions and 4 deletions
|
@ -1860,7 +1860,8 @@ static floatx80 floatx80_round_pack_canonical(FloatParts128 *p,
|
|||
|
||||
case float_class_inf:
|
||||
/* x86 and m68k differ in the setting of the integer bit. */
|
||||
frac = floatx80_infinity_low;
|
||||
frac = s->floatx80_behaviour & floatx80_default_inf_int_bit_is_zero ?
|
||||
0 : (1ULL << 63);
|
||||
exp = fmt->exp_max;
|
||||
break;
|
||||
|
||||
|
@ -5144,9 +5145,7 @@ floatx80 roundAndPackFloatx80(FloatX80RoundPrec roundingPrecision, bool zSign,
|
|||
) {
|
||||
return packFloatx80( zSign, 0x7FFE, ~ roundMask );
|
||||
}
|
||||
return packFloatx80(zSign,
|
||||
floatx80_infinity_high,
|
||||
floatx80_infinity_low);
|
||||
return floatx80_default_inf(zSign, status);
|
||||
}
|
||||
if ( zExp <= 0 ) {
|
||||
isTiny = status->tininess_before_rounding
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue