Re: [hatari-devel] FPU update

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Le 20/04/2017 à 23:37, Nicolas Pomarède a écrit :
Thanks, I noticed this today and already merged these changes into
Hatari :) I still have a few warnings about unused functions that I need
to look at and provide some patches.

Hi

a few more patches to remove more warnings :

--------------------------------------

fpu.7_warning_unused_file.patch :

the content of softfloat_extension.c is not used anymore in fact ; I added a "#if 0", but maybe whole file could be removed in case those functions are really not needed in the future.

At the same time the block "#if 0 /* Old fallback functions disabled */" in fpp_softfloat.c could also be removed (as it was the only part using softfloat_extension.c)

--------------------------------------

fpu.8_warning_prototype.patch :

just a few missing prototypes for 3 functions

--------------------------------------

fpu.9_warning_unused_function.patch :

2 unused functions normalizeRoundAndPackFloat32 and normalizeRoundAndPackFloat64

--------------------------------------

fpu.10_warning_unused_inline.patch

many functions are declared directly in .h files as static. This means those functions will be duplicated in each .o file including those .h, possibly giving some warning when those functions are in fact not used.

eg :

/home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat-specialize.h:269:16: attention : 'propagateFloat64NaN' defined but not used [-Wunused-function] static float64 propagateFloat64NaN( float64 a, float64 b, float_status *status )

The solution to remove those warning and compile only the necessary code in each .o is to use the missing "inline" to these functions (all other functions in softfloat-specialize.h and softfloat-macro.h are correctly declared as "static inline"

--------------------------------------


The following warnings are remaining, they required small code change (mostly signed/unsigned warnings). Maybe some "cast" are needed, it's a matter of choice :)

/home/npomarede/src/hatari-fpu/src/cpu/fpp.c: In function 'fpsr_check_arithmetic_exception': /home/npomarede/src/hatari-fpu/src/cpu/fpp.c:502:59: attention : signed and unsigned type in conditional expression [-Wsign-compare]
       fsave_data.stag = get_ftag(src, (opclass == 0) ? -1 : size);
                                                           ^
/home/npomarede/src/hatari-fpu/src/cpu/fpp.c:513:59: attention : signed and unsigned type in conditional expression [-Wsign-compare]
       fsave_data.stag = get_ftag(src, (opclass == 0) ? -1 : size);
                                                           ^
/home/npomarede/src/hatari-fpu/src/cpu/fpp.c:517:58: attention : signed and unsigned type in conditional expression [-Wsign-compare]
      fsave_data.stag = get_ftag(src, (opclass == 0) ? -1 : size);
                                                          ^
/home/npomarede/src/hatari-fpu/src/cpu/fpp.c: In function 'fp_unimp_datatype': /home/npomarede/src/hatari-fpu/src/cpu/fpp.c:875:57: attention : signed and unsigned type in conditional expression [-Wsign-compare]
     fsave_data.stag = get_ftag(src, (opclass == 0) ? -1 : size);

----------

/home/npomarede/src/hatari-fpu/src/cpu/fpp_native.c: In function 'fp_print':
/home/npomarede/src/hatari-fpu/src/cpu/fpp_native.c:581:24: attention : comparaison entre des expressions entières signée et non signée [-Wsign-compare]
  if (mode == 0 || mode > _tcslen(fsout))
                        ^
/home/npomarede/src/hatari-fpu/src/cpu/fpp_native.c:556:10: attention : variable 'd' set but not used [-Wunused-but-set-variable]
  bool n, d;
          ^
----------
                                                         ^
In file included from /home/npomarede/src/hatari-fpu/src/cpu/fpp_softfloat.c:30:0: /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat-macros.h: In function 'add192': /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat-macros.h:439:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     z0 += ( z1 < carry1 );
                ^
In file included from /home/npomarede/src/hatari-fpu/src/cpu/fpp_softfloat.c:31:0: /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat-specialize.h: In function 'propagateFloatx80NaN': /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat-specialize.h:349:35: warning: variable 'bIsNaN' set but not used [-Wunused-but-set-variable]
     flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
                                   ^
/home/npomarede/src/hatari-fpu/src/cpu/fpp_softfloat.c: In function 'fp_printx80': /home/npomarede/src/hatari-fpu/src/cpu/fpp_softfloat.c:145:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (mode == 0 || mode > _tcslen(fsout))
                        ^
/home/npomarede/src/hatari-fpu/src/cpu/fpp_softfloat.c: In function 'fp_mod': /home/npomarede/src/hatari-fpu/src/cpu/fpp_softfloat.c:354:40: warning: passing argument 3 of 'floatx80_mod' from incompatible pointer type
  a->fpx = floatx80_mod(a->fpx, b->fpx, q, s, &fs);
                                        ^
In file included from /home/npomarede/src/hatari-fpu/src/cpu/newcpu.h:44:0,
from /home/npomarede/src/hatari-fpu/src/cpu/fpp_softfloat.c:26: /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.h:417:10: note: expected 'uint64_t *' but argument is of type 'uae_u64 *' floatx80 floatx80_mod( floatx80 a, floatx80 b, uint64_t *q, flag *s, float_status *status );
          ^
/home/npomarede/src/hatari-fpu/src/cpu/fpp_softfloat.c: In function 'fp_rem': /home/npomarede/src/hatari-fpu/src/cpu/fpp_softfloat.c:366:40: warning: passing argument 3 of 'floatx80_rem' from incompatible pointer type
  a->fpx = floatx80_rem(a->fpx, b->fpx, q, s, &fs);
                                        ^
In file included from /home/npomarede/src/hatari-fpu/src/cpu/newcpu.h:44:0,
from /home/npomarede/src/hatari-fpu/src/cpu/fpp_softfloat.c:26: /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.h:416:10: note: expected 'uint64_t *' but argument is of type 'uae_u64 *' floatx80 floatx80_rem( floatx80 a, floatx80 b, uint64_t *q, flag *s, float_status *status );

----------

/home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.c: In function 'roundSaveFloatx80Internal': /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.c:150:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if ( zSig0 < roundIncrement ) {
                ^
/home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.c: In function 'getRoundedFloatInternal': /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.c:265:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if ( zSig0 < roundIncrement ) {
                ^
In file included from /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.c:459:0: /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat-specialize.h: In function 'propagateFloatx80NaN': /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat-specialize.h:349:35: warning: variable 'bIsNaN' set but not used [-Wunused-but-set-variable]
     flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
                                   ^
/home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.c: In function 'roundAndPackInt64': /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.c:645:13: warning: signed and unsigned type in conditional expression [-Wsign-compare]
             : LIT64( 0x7FFFFFFFFFFFFFFF );
             ^
/home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.c: In function 'roundAndPackFloatx80': /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.c:1459:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if ( zSig0 < roundIncrement ) {
                ^
/home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.c: In function 'roundSigAndPackFloatx80': /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat.c:1620:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if ( zSig0 < roundIncrement ) {
                ^
----------

/home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat_fpsp.c: In function 'floatx80_cosh': /home/npomarede/src/hatari-fpu/src/cpu/softfloat/softfloat_fpsp.c:609:7: attention : variable 'aSign' set but not used [-Wunused-but-set-variable]
  flag aSign;

----------



Nicolas





--- softfloat/softfloat_extension.c.orig	2017-04-21 14:44:39.687879675 +0200
+++ softfloat/softfloat_extension.c	2017-04-21 14:45:06.585821431 +0200
@@ -1,5 +1,5 @@
 
-
+#if 0
 #define SOFTFLOAT_68K
 
 #include <stdint.h>
@@ -656,3 +656,4 @@
     *e = 0;
     return a;
 }
+#endif
--- softfloat/softfloat.h.orig	2017-04-21 14:52:06.740906522 +0200
+++ softfloat/softfloat.h	2017-04-21 14:57:01.757253423 +0200
@@ -404,6 +404,9 @@
 
 #ifdef SOFTFLOAT_68K
 // functions are in softfloat.c
+floatx80 roundSaveFloatx80Internal( int8_t roundingPrecision, flag zSign, int32_t zExp, uint64_t zSig0, uint64_t zSig1, float_status *status );
+void getRoundedFloatInternal( int8_t roundingPrecision, flag *pzSign, int32_t *pzExp, uint64_t *pzSig );
+floatx80 roundSigAndPackFloatx80( int8_t roundingPrecision, flag zSign, int32_t zExp, uint64_t zSig0, uint64_t zSig1, float_status *status );
 floatx80 floatx80_move( floatx80 a, float_status *status );
 floatx80 floatx80_abs( floatx80 a, float_status *status );
 floatx80 floatx80_neg( floatx80 a, float_status *status );
--- softfloat/softfloat.c.orig	2017-04-21 15:07:31.347954963 +0200
+++ softfloat/softfloat.c	2017-04-21 15:08:20.781857243 +0200
@@ -830,6 +830,7 @@
 | floating-point exponent.
 *----------------------------------------------------------------------------*/
 
+#if 0
 static float32
  normalizeRoundAndPackFloat32(flag zSign, int zExp, uint32_t zSig,
                               float_status *status)
@@ -841,6 +842,7 @@
                                status);
 
 }
+#endif
 
 /*----------------------------------------------------------------------------
 | Returns the fraction bits of the double-precision floating-point value `a'.
@@ -1035,6 +1037,7 @@
 | floating-point exponent.
 *----------------------------------------------------------------------------*/
 
+#if 0
 static float64
  normalizeRoundAndPackFloat64(flag zSign, int zExp, uint64_t zSig,
                               float_status *status)
@@ -1046,6 +1049,7 @@
                                status);
 
 }
+#endif
 
 /*----------------------------------------------------------------------------
 | Returns the fraction bits of the extended double-precision floating-point
--- softfloat/softfloat-macros.h.orig	2017-04-21 15:03:50.458379763 +0200
+++ softfloat/softfloat-macros.h	2017-04-21 15:04:35.248295434 +0200
@@ -603,7 +603,7 @@
 | unsigned integer is returned.
 *----------------------------------------------------------------------------*/
 
-static uint64_t estimateDiv128To64( uint64_t a0, uint64_t a1, uint64_t b )
+static inline uint64_t estimateDiv128To64( uint64_t a0, uint64_t a1, uint64_t b )
 {
     uint64_t b0, b1;
     uint64_t rem0, rem1, term0, term1;
@@ -635,7 +635,7 @@
 | value.
 *----------------------------------------------------------------------------*/
 
-static uint32_t estimateSqrt32(int aExp, uint32_t a)
+static inline uint32_t estimateSqrt32(int aExp, uint32_t a)
 {
     static const uint16_t sqrtOddAdjustments[] = {
         0x0004, 0x0022, 0x005D, 0x00B1, 0x011D, 0x019F, 0x0236, 0x02E0,
--- softfloat/softfloat-specialize.h.orig	2017-04-21 14:59:19.957947745 +0200
+++ softfloat/softfloat-specialize.h	2017-04-21 15:01:35.006649193 +0200
@@ -94,7 +94,7 @@
 /*----------------------------------------------------------------------------
 | The pattern for a default generated extended double-precision NaN.
 *----------------------------------------------------------------------------*/
-static floatx80 floatx80_default_nan(float_status *status)
+static inline floatx80 floatx80_default_nan(float_status *status)
 {
     floatx80 r;
     r.high = 0x7FFF;
@@ -152,7 +152,7 @@
 | exception is raised.
 *----------------------------------------------------------------------------*/
 
-static commonNaNT float32ToCommonNaN( float32 a, float_status *status )
+static inline commonNaNT float32ToCommonNaN( float32 a, float_status *status )
 {
     commonNaNT z;
 
@@ -169,7 +169,7 @@
 | precision floating-point format.
 *----------------------------------------------------------------------------*/
 
-static float32 commonNaNToFloat32( commonNaNT a )
+static inline float32 commonNaNToFloat32( commonNaNT a )
 {
 
     return ( ( (uint32_t) a.sign )<<31 ) | 0x7FC00000 | ( a.high>>41 );
@@ -182,7 +182,7 @@
 | signaling NaN, the invalid exception is raised.
 *----------------------------------------------------------------------------*/
 
-static float32 propagateFloat32NaN( float32 a, float32 b, float_status *status )
+static inline float32 propagateFloat32NaN( float32 a, float32 b, float_status *status )
 {
     flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
 
@@ -234,7 +234,7 @@
 | exception is raised.
 *----------------------------------------------------------------------------*/
 
-static commonNaNT float64ToCommonNaN(float64 a, float_status *status)
+static inline commonNaNT float64ToCommonNaN(float64 a, float_status *status)
 {
     commonNaNT z;
 
@@ -252,7 +252,7 @@
 | precision floating-point format.
 *----------------------------------------------------------------------------*/
 
-static float64 commonNaNToFloat64(commonNaNT a, float_status *status)
+static inline float64 commonNaNToFloat64(commonNaNT a, float_status *status)
 {
      return
           ( ( (uint64_t) a.sign )<<63 )
@@ -266,7 +266,7 @@
 | signaling NaN, the invalid exception is raised.
 *----------------------------------------------------------------------------*/
 
-static float64 propagateFloat64NaN( float64 a, float64 b, float_status *status )
+static inline float64 propagateFloat64NaN( float64 a, float64 b, float_status *status )
 {
     flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
 
@@ -309,7 +309,7 @@
 | invalid exception is raised.
 *----------------------------------------------------------------------------*/
 
-static commonNaNT floatx80ToCommonNaN( floatx80 a, float_status *status )
+static inline commonNaNT floatx80ToCommonNaN( floatx80 a, float_status *status )
 {
     commonNaNT z;
 
@@ -326,7 +326,7 @@
 | double-precision floating-point format.
 *----------------------------------------------------------------------------*/
 
-static floatx80 commonNaNToFloatx80(commonNaNT a, float_status *status)
+static inline floatx80 commonNaNToFloatx80(commonNaNT a, float_status *status)
 {
     floatx80 z;
 #ifdef SOFTFLOAT_68K
@@ -344,7 +344,7 @@
 | `b' is a signaling NaN, the invalid exception is raised.
 *----------------------------------------------------------------------------*/
 
-static floatx80 propagateFloatx80NaN( floatx80 a, floatx80 b, float_status *status )
+static inline floatx80 propagateFloatx80NaN( floatx80 a, floatx80 b, float_status *status )
 {
     flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/