softfloat: export float32_nan and float32_infinity.
PATCH 1/1 softfloat: export float32_nan and float32_infinity.
These two special values are needed to implement some helper functions, which return these values in some cases.
--- fpu/softfloat-specialize.h | 9 +++++++++ fpu/softfloat.h | 2 ++ 2 files changed, 11 insertions(+), 0 deletions(-)
fpu/softfloat-specialize.h +9 -0
@@ -201,6 +201,15 @@ int float32_is_signaling_nan( float32 a_ ) }/*---------------------------------------------------------------------------- +| Returns the default NaN. +*----------------------------------------------------------------------------*/ + +float32 float32_nan (void ) +{ +return float32_default_nan; +} + +/*---------------------------------------------------------------------------- | Returns a quiet NaN if the single-precision floating point value `a' is a | signaling NaN; otherwise returns `a'. *----------------------------------------------------------------------------*/
fpu/softfloat.h +2 -0
@@ -319,6 +319,7 @@ int float32_compare_quiet( float32, float32 STATUS_PARAM );int float32_is_quiet_nan (float32 );int float32_is_signaling_nan (float32 );float32 float32_maybe_silence_nan (float32 ); +float32 float32_nan (void );float32 float32_scalbn (float32 ,int STATUS_PARAM ); INLINE float32 float32_abs(float32 a)
@@ -365,6 +366,7 @@ INLINE int float32_is_zero_or_denormal(float32 a)#define float32_zero make_float32(0)#define float32_one make_float32(0x3f800000)#define float32_ln2 make_float32(0x3f317218) +#define float32_infinity make_float32(0x7f800000)/*---------------------------------------------------------------------------- | Software IEC/IEEE double-precision conversion routines.
Signature · 1 line
1.7.2.3
Quoted 2 lines · Christophe Lyon
These two special values are needed to implement some helper functions, which return these values in some cases.
I assume this is for vrecpe, right? I think it would be better to post this as part of that patchset; it's easier to see the rationale for adding the functions when you also have the code that's using them.
fpu/softfloat-specialize.h int float32_is_signaling_nan( float32 a_ ) · line 210
Quoted 8 lines
/*---------------------------------------------------------------------------- +| Returns the default NaN.
fpu/softfloat-specialize.h +6
-0+*----------------------------------------------------------------------------*/ + +float32 float32_nan (void ) +{ + return float32_default_nan; +}
Maybe we should just expose float32_default_nan in softfloat.h somehow; that would match float32_zero, float32_one, etc (ie it would not be a function).
Quoted 1 line
+#define
float32_infinitymake_float32(0x7f800000)
No objection to this one.
-- PMM
Quoted 8 lines · Peter Maydell
Quoted 2 lines · Christophe Lyon
These two special values are needed to implement some helper functions, which return these values in some cases.
I assume this is for vrecpe, right? I think it would be better to post this as part of that patchset; it's easier to see the rationale for adding the functions when you also have the code that's using them.
Indeed. I'll post the bigger patch.
Quoted 4 lines
Quoted 4 lines
/*----------------------------------------------------------------------------
+| Returns the default NaN.(quoted diff) +2
-0+*----------------------------------------------------------------------------*/ +
Quoted 9 lines
fpu/softfloat-specialize.h int float32_is_signaling_nan( float32 a_ ) · line 210
Quoted 4 lines
fpu/softfloat-specialize.h +4
-0+float32 float32_nan (void ) +{ +return float32_default_nan; +}Maybe we should just expose
float32_default_naninsoftfloat.hsomehow; that would matchfloat32_zero,float32_one, etc (ie it would not be a function).
It was my initial intention, but it implies adding a #if defined(TARGET_XXX) block in softfloat.h, and I feared this was not desirable.
Thanks.