Re: [Qemu-devel] [PATCH v3 1/4] softfloat: export some functions

2018-02-23 Thread Richard Henderson
On 02/23/2018 06:59 AM, Laurent Vivier wrote:
> Move fpu/softfloat-macros.h to include/fpu/
> 
> Export floatx80 functions to be used by target floatx80
> specific implementations.
> 
> Exports:
>   propagateFloatx80NaN(), extractFloatx80Frac(),
>   extractFloatx80Exp(), extractFloatx80Sign(),
>   normalizeFloatx80Subnormal(), packFloatx80(),
>   roundAndPackFloatx80(), normalizeRoundAndPackFloatx80()
> 
> Also exports packFloat32() that will be used to implement
> m68k fsinh, fcos, fsin, ftan operations.
> 
> Signed-off-by: Laurent Vivier 
> ---
> CC: Aurelien Jarno 
> CC: Alex Bennée 
> CC: Peter Maydell 

Reviewed-by: Richard Henderson 


r~



[Qemu-devel] [PATCH v3 1/4] softfloat: export some functions

2018-02-23 Thread Laurent Vivier
Move fpu/softfloat-macros.h to include/fpu/

Export floatx80 functions to be used by target floatx80
specific implementations.

Exports:
  propagateFloatx80NaN(), extractFloatx80Frac(),
  extractFloatx80Exp(), extractFloatx80Sign(),
  normalizeFloatx80Subnormal(), packFloatx80(),
  roundAndPackFloatx80(), normalizeRoundAndPackFloatx80()

Also exports packFloat32() that will be used to implement
m68k fsinh, fcos, fsin, ftan operations.

Signed-off-by: Laurent Vivier 
---
CC: Aurelien Jarno 
CC: Alex Bennée 
CC: Peter Maydell 

 fpu/softfloat-specialize.h  |   3 +-
 fpu/softfloat.c |  91 +++-
 {fpu => include/fpu}/softfloat-macros.h |  10 +--
 include/fpu/softfloat.h | 120 
 4 files changed, 136 insertions(+), 88 deletions(-)
 rename {fpu => include/fpu}/softfloat-macros.h (98%)

diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index e81ca001e1..46126e9e0a 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -1011,8 +1011,7 @@ static floatx80 commonNaNToFloatx80(commonNaNT a, 
float_status *status)
 | `b' is a signaling NaN, the invalid exception is raised.
 **/
 
-static floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b,
- float_status *status)
+floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status)
 {
 flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
 flag aIsLargerSignificand;
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index e7fb0d357a..fb4853682e 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -93,7 +93,7 @@ this code that are retained.
 | division and square root approximations.  (Can be specialized to target if
 | desired.)
 **/
-#include "softfloat-macros.h"
+#include "fpu/softfloat-macros.h"
 
 /*
 | Functions and definitions to determine:  (1) whether tininess for underflow
@@ -2192,25 +2192,6 @@ static void
 
 }
 
-/*
-| Packs the sign `zSign', exponent `zExp', and significand `zSig' into a
-| single-precision floating-point value, returning the result.  After being
-| shifted into the proper positions, the three fields are simply added
-| together to form the result.  This means that any integer portion of `zSig'
-| will be added into the exponent.  Since a properly normalized significand
-| will have an integer portion equal to 1, the `zExp' input should be 1 less
-| than the desired result exponent whenever `zSig' is a complete, normalized
-| significand.
-**/
-
-static inline float32 packFloat32(flag zSign, int zExp, uint32_t zSig)
-{
-
-return make_float32(
-  ( ( (uint32_t) zSign )<<31 ) + ( ( (uint32_t) zExp )<<23 ) + zSig);
-
-}
-
 /*
 | Takes an abstract floating-point value having sign `zSign', exponent `zExp',
 | and significand `zSig', and returns the proper single-precision floating-
@@ -2490,42 +2471,6 @@ static float64
 
 }
 
-/*
-| Returns the fraction bits of the extended double-precision floating-point
-| value `a'.
-**/
-
-static inline uint64_t extractFloatx80Frac( floatx80 a )
-{
-
-return a.low;
-
-}
-
-/*
-| Returns the exponent bits of the extended double-precision floating-point
-| value `a'.
-**/
-
-static inline int32_t extractFloatx80Exp( floatx80 a )
-{
-
-return a.high & 0x7FFF;
-
-}
-
-/*
-| Returns the sign bit of the extended double-precision floating-point value
-| `a'.
-**/
-
-static inline flag extractFloatx80Sign( floatx80 a )
-{
-
-return a.high>>15;
-
-}
-
 /*
 | Normalizes the subnormal extended double-precision floating-point value
 | represented by the denormalized significand `aSig'.  The normalized exponent
@@ -2533,30 +2478,14 @@ static inline flag extractFloatx80Sign( floatx80 a )
 | `zSigPtr', respectively.
 **/
 
-static void
- normalizeFloatx80Subnormal(