mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-22 05:21:10 +00:00
fpu/softfloat: implement float16_squash_input_denormal
This will be required when expanding the MINMAX() macro for 16 bit/half-precision operations. Backports commit 210cbd4910ae9e41e0a1785b96890ea2c291b381 from qemu
This commit is contained in:
parent
19baeb5120
commit
8110bc8264
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_aarch64
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_aarch64
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_aarch64
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_aarch64
|
||||
#define float16_to_float32 float16_to_float32_aarch64
|
||||
#define float16_to_float64 float16_to_float64_aarch64
|
||||
#define float32ToCommonNaN float32ToCommonNaN_aarch64
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_aarch64eb
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_aarch64eb
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_aarch64eb
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_aarch64eb
|
||||
#define float16_to_float32 float16_to_float32_aarch64eb
|
||||
#define float16_to_float64 float16_to_float64_aarch64eb
|
||||
#define float32ToCommonNaN float32ToCommonNaN_aarch64eb
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_arm
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_arm
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_arm
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_arm
|
||||
#define float16_to_float32 float16_to_float32_arm
|
||||
#define float16_to_float64 float16_to_float64_arm
|
||||
#define float32ToCommonNaN float32ToCommonNaN_arm
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_armeb
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_armeb
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_armeb
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_armeb
|
||||
#define float16_to_float32 float16_to_float32_armeb
|
||||
#define float16_to_float64 float16_to_float64_armeb
|
||||
#define float32ToCommonNaN float32ToCommonNaN_armeb
|
||||
|
|
|
@ -3452,6 +3452,21 @@ static float16 roundAndPackFloat16(flag zSign, int zExp,
|
|||
return packFloat16(zSign, zExp, zSig >> 13);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
| If `a' is denormal and we are in flush-to-zero mode then set the
|
||||
| input-denormal exception and return zero. Otherwise just return the value.
|
||||
*----------------------------------------------------------------------------*/
|
||||
float16 float16_squash_input_denormal(float16 a, float_status *status)
|
||||
{
|
||||
if (status->flush_inputs_to_zero) {
|
||||
if (extractFloat16Exp(a) == 0 && extractFloat16Frac(a) != 0) {
|
||||
float_raise(float_flag_input_denormal, status);
|
||||
return make_float16(float16_val(a) & 0x8000);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
static void normalizeFloat16Subnormal(uint32_t aSig, int *zExpPtr,
|
||||
uint32_t *zSigPtr)
|
||||
{
|
||||
|
|
|
@ -497,6 +497,7 @@ symbols = (
|
|||
'float16_is_quiet_nan',
|
||||
'float16_is_signaling_nan',
|
||||
'float16_maybe_silence_nan',
|
||||
'float16_squash_input_denormal',
|
||||
'float16_to_float32',
|
||||
'float16_to_float64',
|
||||
'float32ToCommonNaN',
|
||||
|
|
|
@ -289,6 +289,7 @@ void float_raise(uint8_t flags, float_status *status);
|
|||
| If `a' is denormal and we are in flush-to-zero mode then set the
|
||||
| input-denormal exception and return zero. Otherwise just return the value.
|
||||
*----------------------------------------------------------------------------*/
|
||||
float16 float16_squash_input_denormal(float16 a, float_status *status);
|
||||
float32 float32_squash_input_denormal(float32 a, float_status *status);
|
||||
float64 float64_squash_input_denormal(float64 a, float_status *status);
|
||||
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_m68k
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_m68k
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_m68k
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_m68k
|
||||
#define float16_to_float32 float16_to_float32_m68k
|
||||
#define float16_to_float64 float16_to_float64_m68k
|
||||
#define float32ToCommonNaN float32ToCommonNaN_m68k
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_mips
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_mips
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_mips
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_mips
|
||||
#define float16_to_float32 float16_to_float32_mips
|
||||
#define float16_to_float64 float16_to_float64_mips
|
||||
#define float32ToCommonNaN float32ToCommonNaN_mips
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_mips64
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_mips64
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_mips64
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_mips64
|
||||
#define float16_to_float32 float16_to_float32_mips64
|
||||
#define float16_to_float64 float16_to_float64_mips64
|
||||
#define float32ToCommonNaN float32ToCommonNaN_mips64
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_mips64el
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_mips64el
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_mips64el
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_mips64el
|
||||
#define float16_to_float32 float16_to_float32_mips64el
|
||||
#define float16_to_float64 float16_to_float64_mips64el
|
||||
#define float32ToCommonNaN float32ToCommonNaN_mips64el
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_mipsel
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_mipsel
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_mipsel
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_mipsel
|
||||
#define float16_to_float32 float16_to_float32_mipsel
|
||||
#define float16_to_float64 float16_to_float64_mipsel
|
||||
#define float32ToCommonNaN float32ToCommonNaN_mipsel
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_powerpc
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_powerpc
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_powerpc
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_powerpc
|
||||
#define float16_to_float32 float16_to_float32_powerpc
|
||||
#define float16_to_float64 float16_to_float64_powerpc
|
||||
#define float32ToCommonNaN float32ToCommonNaN_powerpc
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_sparc
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_sparc
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_sparc
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_sparc
|
||||
#define float16_to_float32 float16_to_float32_sparc
|
||||
#define float16_to_float64 float16_to_float64_sparc
|
||||
#define float32ToCommonNaN float32ToCommonNaN_sparc
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_sparc64
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_sparc64
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_sparc64
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_sparc64
|
||||
#define float16_to_float32 float16_to_float32_sparc64
|
||||
#define float16_to_float64 float16_to_float64_sparc64
|
||||
#define float32ToCommonNaN float32ToCommonNaN_sparc64
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
#define float16_is_quiet_nan float16_is_quiet_nan_x86_64
|
||||
#define float16_is_signaling_nan float16_is_signaling_nan_x86_64
|
||||
#define float16_maybe_silence_nan float16_maybe_silence_nan_x86_64
|
||||
#define float16_squash_input_denormal float16_squash_input_denormal_x86_64
|
||||
#define float16_to_float32 float16_to_float32_x86_64
|
||||
#define float16_to_float64 float16_to_float64_x86_64
|
||||
#define float32ToCommonNaN float32ToCommonNaN_x86_64
|
||||
|
|
Loading…
Reference in a new issue