Patchwork [v5,10/10] softfloat: Use [u]int_fast64_t consistently

login
register
mail settings
Submitter Andreas Färber
Date March 7, 2011, 12:34 a.m.
Message ID <1299458053-69428-10-git-send-email-andreas.faerber@web.de>
Download mbox | patch
Permalink /patch/85611/
State New
Headers show

Comments

Andreas Färber - March 7, 2011, 12:34 a.m.
v5:
* Initial.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 fpu/softfloat-native.c |   26 +++++++++++++-------------
 fpu/softfloat-native.h |   28 ++++++++++++++--------------
 fpu/softfloat.c        |    4 ++--
 3 files changed, 29 insertions(+), 29 deletions(-)
Aurelien Jarno - March 7, 2011, 9:56 a.m.
On Mon, Mar 07, 2011 at 01:34:13AM +0100, Andreas Färber wrote:
> v5:
> * Initial.
> 
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> ---
>  fpu/softfloat-native.c |   26 +++++++++++++-------------
>  fpu/softfloat-native.h |   28 ++++++++++++++--------------
>  fpu/softfloat.c        |    4 ++--
>  3 files changed, 29 insertions(+), 29 deletions(-)
> 
> diff --git a/fpu/softfloat-native.c b/fpu/softfloat-native.c
> index 2c08958..3aa64f6 100644
> --- a/fpu/softfloat-native.c
> +++ b/fpu/softfloat-native.c
> @@ -103,24 +103,24 @@ floatx80 int32_to_floatx80(int_fast32_t v STATUS_PARAM)
>      return (floatx80)v;
>  }
>  #endif
> -float32 int64_to_float32( int64_t v STATUS_PARAM)
> +float32 int64_to_float32( int_fast64_t v STATUS_PARAM)
>  {
>      return (float32)v;
>  }
> -float32 uint64_to_float32( uint64_t v STATUS_PARAM)
> +float32 uint64_to_float32( uint_fast64_t v STATUS_PARAM)
>  {
>      return (float32)v;
>  }
> -float64 int64_to_float64( int64_t v STATUS_PARAM)
> +float64 int64_to_float64( int_fast64_t v STATUS_PARAM)
>  {
>      return (float64)v;
>  }
> -float64 uint64_to_float64( uint64_t v STATUS_PARAM)
> +float64 uint64_to_float64( uint_fast64_t v STATUS_PARAM)
>  {
>      return (float64)v;
>  }
>  #ifdef FLOATX80
> -floatx80 int64_to_floatx80( int64_t v STATUS_PARAM)
> +floatx80 int64_to_floatx80( int_fast64_t v STATUS_PARAM)
>  {
>      return (floatx80)v;
>  }
> @@ -152,12 +152,12 @@ int_fast32_t float32_to_int32_round_to_zero( float32 a STATUS_PARAM)
>  {
>      return (int32_t)a;
>  }
> -int64_t float32_to_int64( float32 a STATUS_PARAM)
> +int_fast64_t float32_to_int64( float32 a STATUS_PARAM)
>  {
>      return llrintf(a);
>  }
>  
> -int64_t float32_to_int64_round_to_zero( float32 a STATUS_PARAM)
> +int_fast64_t float32_to_int64_round_to_zero( float32 a STATUS_PARAM)
>  {
>      return (int64_t)a;
>  }
> @@ -274,11 +274,11 @@ int_fast32_t float64_to_int32_round_to_zero( float64 a STATUS_PARAM)
>  {
>      return (int32_t)a;
>  }
> -int64_t float64_to_int64( float64 a STATUS_PARAM)
> +int_fast64_t float64_to_int64( float64 a STATUS_PARAM)
>  {
>      return llrint(a);
>  }
> -int64_t float64_to_int64_round_to_zero( float64 a STATUS_PARAM)
> +int_fast64_t float64_to_int64_round_to_zero( float64 a STATUS_PARAM)
>  {
>      return (int64_t)a;
>  }
> @@ -329,7 +329,7 @@ uint_fast32_t float64_to_uint32_round_to_zero( float64 a STATUS_PARAM)
>      }
>      return res;
>  }
> -uint64_t float64_to_uint64 (float64 a STATUS_PARAM)
> +uint_fast64_t float64_to_uint64 (float64 a STATUS_PARAM)
>  {
>      int64_t v;
>  
> @@ -337,7 +337,7 @@ uint64_t float64_to_uint64 (float64 a STATUS_PARAM)
>  
>      return v - INT64_MIN;
>  }
> -uint64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM)
> +uint_fast64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM)
>  {
>      int64_t v;
>  
> @@ -435,11 +435,11 @@ int_fast32_t floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM)
>  {
>      return (int)a;
>  }
> -int64_t floatx80_to_int64( floatx80 a STATUS_PARAM)
> +int_fast64_t floatx80_to_int64( floatx80 a STATUS_PARAM)
>  {
>      return llrintl(a);
>  }
> -int64_t floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM)
> +int_fast64_t floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM)
>  {
>      return (int64_t)a;
>  }
> diff --git a/fpu/softfloat-native.h b/fpu/softfloat-native.h
> index 6cf5dc3..b198f48 100644
> --- a/fpu/softfloat-native.h
> +++ b/fpu/softfloat-native.h
> @@ -160,15 +160,15 @@ floatx80 int32_to_floatx80( int_fast32_t STATUS_PARAM);
>  #ifdef FLOAT128
>  float128 int32_to_float128( int_fast32_t STATUS_PARAM);
>  #endif
> -float32 int64_to_float32( int64_t STATUS_PARAM);
> -float32 uint64_to_float32( uint64_t STATUS_PARAM);
> -float64 int64_to_float64( int64_t STATUS_PARAM);
> -float64 uint64_to_float64( uint64_t v STATUS_PARAM);
> +float32 int64_to_float32( int_fast64_t STATUS_PARAM);
> +float32 uint64_to_float32( uint_fast64_t STATUS_PARAM);
> +float64 int64_to_float64( int_fast64_t STATUS_PARAM);
> +float64 uint64_to_float64( uint_fast64_t v STATUS_PARAM);
>  #ifdef FLOATX80
> -floatx80 int64_to_floatx80( int64_t STATUS_PARAM);
> +floatx80 int64_to_floatx80( int_fast64_t STATUS_PARAM);
>  #endif
>  #ifdef FLOAT128
> -float128 int64_to_float128( int64_t STATUS_PARAM);
> +float128 int64_to_float128( int_fast64_t STATUS_PARAM);
>  #endif
>  
>  /*----------------------------------------------------------------------------
> @@ -178,8 +178,8 @@ int_fast32_t float32_to_int32( float32  STATUS_PARAM);
>  int_fast32_t float32_to_int32_round_to_zero( float32  STATUS_PARAM);
>  uint_fast32_t float32_to_uint32( float32 a STATUS_PARAM);
>  uint_fast32_t float32_to_uint32_round_to_zero( float32 a STATUS_PARAM);
> -int64_t float32_to_int64( float32  STATUS_PARAM);
> -int64_t float32_to_int64_round_to_zero( float32  STATUS_PARAM);
> +int_fast64_t float32_to_int64( float32  STATUS_PARAM);
> +int_fast64_t float32_to_int64_round_to_zero( float32  STATUS_PARAM);
>  float64 float32_to_float64( float32  STATUS_PARAM);
>  #ifdef FLOATX80
>  floatx80 float32_to_floatx80( float32  STATUS_PARAM);
> @@ -283,10 +283,10 @@ int_fast32_t float64_to_int32( float64 STATUS_PARAM );
>  int_fast32_t float64_to_int32_round_to_zero( float64 STATUS_PARAM );
>  uint_fast32_t float64_to_uint32( float64 STATUS_PARAM );
>  uint_fast32_t float64_to_uint32_round_to_zero( float64 STATUS_PARAM );
> -int64_t float64_to_int64( float64 STATUS_PARAM );
> -int64_t float64_to_int64_round_to_zero( float64 STATUS_PARAM );
> -uint64_t float64_to_uint64( float64 STATUS_PARAM );
> -uint64_t float64_to_uint64_round_to_zero( float64 STATUS_PARAM );
> +int_fast64_t float64_to_int64( float64 STATUS_PARAM );
> +int_fast64_t float64_to_int64_round_to_zero( float64 STATUS_PARAM );
> +uint_fast64_t float64_to_uint64( float64 STATUS_PARAM );
> +uint_fast64_t float64_to_uint64_round_to_zero( float64 STATUS_PARAM );
>  float32 float64_to_float32( float64 STATUS_PARAM );
>  #ifdef FLOATX80
>  floatx80 float64_to_floatx80( float64 STATUS_PARAM );
> @@ -392,8 +392,8 @@ INLINE float64 float64_scalbn(float64 a, int n)
>  *----------------------------------------------------------------------------*/
>  int_fast32_t floatx80_to_int32( floatx80 STATUS_PARAM );
>  int_fast32_t floatx80_to_int32_round_to_zero( floatx80 STATUS_PARAM );
> -int64_t floatx80_to_int64( floatx80 STATUS_PARAM);
> -int64_t floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM);
> +int64_fast_t floatx80_to_int64( floatx80 STATUS_PARAM);
> +int64_fast_t floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM);

This type doesn't exist, so the code doesn't even compile...
Andreas Färber - March 7, 2011, 11:10 p.m.
Am 07.03.2011 um 10:56 schrieb Aurelien Jarno:

> On Mon, Mar 07, 2011 at 01:34:13AM +0100, Andreas Färber wrote:
>> v5:
>> * Initial.
>>
>> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
>> ---
>> fpu/softfloat-native.c |   26 +++++++++++++-------------
>> fpu/softfloat-native.h |   28 ++++++++++++++--------------
>> fpu/softfloat.c        |    4 ++--
>> 3 files changed, 29 insertions(+), 29 deletions(-)

>> diff --git a/fpu/softfloat-native.h b/fpu/softfloat-native.h
>> index 6cf5dc3..b198f48 100644
>> --- a/fpu/softfloat-native.h
>> +++ b/fpu/softfloat-native.h

>> @@ -392,8 +392,8 @@ INLINE float64 float64_scalbn(float64 a, int n)
>> *----------------------------------------------------------------------------*/
>> int_fast32_t floatx80_to_int32( floatx80 STATUS_PARAM );
>> int_fast32_t floatx80_to_int32_round_to_zero( floatx80  
>> STATUS_PARAM );
>> -int64_t floatx80_to_int64( floatx80 STATUS_PARAM);
>> -int64_t floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM);
>> +int64_fast_t floatx80_to_int64( floatx80 STATUS_PARAM);
>> +int64_fast_t floatx80_to_int64_round_to_zero( floatx80  
>> STATUS_PARAM);
>
> This type doesn't exist, so the code doesn't even compile...

I did compile-tested these, so apparently my host or targets do not  
use softfloat-native... It was late so I can't rule out other mistakes  
there.

Would you prefer to treat softfloat-native as a separate API and not  
touch it in this series?

Andreas
Aurelien Jarno - March 8, 2011, 6:04 a.m.
On Tue, Mar 08, 2011 at 12:10:50AM +0100, Andreas Färber wrote:
> Am 07.03.2011 um 10:56 schrieb Aurelien Jarno:
> 
> >On Mon, Mar 07, 2011 at 01:34:13AM +0100, Andreas Färber wrote:
> >>v5:
> >>* Initial.
> >>
> >>Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> >>---
> >>fpu/softfloat-native.c |   26 +++++++++++++-------------
> >>fpu/softfloat-native.h |   28 ++++++++++++++--------------
> >>fpu/softfloat.c        |    4 ++--
> >>3 files changed, 29 insertions(+), 29 deletions(-)
> 
> >>diff --git a/fpu/softfloat-native.h b/fpu/softfloat-native.h
> >>index 6cf5dc3..b198f48 100644
> >>--- a/fpu/softfloat-native.h
> >>+++ b/fpu/softfloat-native.h
> 
> >>@@ -392,8 +392,8 @@ INLINE float64 float64_scalbn(float64 a, int n)
> >>*----------------------------------------------------------------------------*/
> >>int_fast32_t floatx80_to_int32( floatx80 STATUS_PARAM );
> >>int_fast32_t floatx80_to_int32_round_to_zero( floatx80
> >>STATUS_PARAM );
> >>-int64_t floatx80_to_int64( floatx80 STATUS_PARAM);
> >>-int64_t floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM);
> >>+int64_fast_t floatx80_to_int64( floatx80 STATUS_PARAM);
> >>+int64_fast_t floatx80_to_int64_round_to_zero( floatx80
> >>STATUS_PARAM);
> >
> >This type doesn't exist, so the code doesn't even compile...
> 
> I did compile-tested these, so apparently my host or targets do not
> use softfloat-native... It was late so I can't rule out other
> mistakes there.

softfloat-native is used on i386 and x86_64 targets, which are enabled
by default when running ./configure.

> Would you prefer to treat softfloat-native as a separate API and not
> touch it in this series?
> 

In my opinion, if we do such change, we should do them in both 
softfloat and softfloat-native.

Patch

diff --git a/fpu/softfloat-native.c b/fpu/softfloat-native.c
index 2c08958..3aa64f6 100644
--- a/fpu/softfloat-native.c
+++ b/fpu/softfloat-native.c
@@ -103,24 +103,24 @@  floatx80 int32_to_floatx80(int_fast32_t v STATUS_PARAM)
     return (floatx80)v;
 }
 #endif
-float32 int64_to_float32( int64_t v STATUS_PARAM)
+float32 int64_to_float32( int_fast64_t v STATUS_PARAM)
 {
     return (float32)v;
 }
-float32 uint64_to_float32( uint64_t v STATUS_PARAM)
+float32 uint64_to_float32( uint_fast64_t v STATUS_PARAM)
 {
     return (float32)v;
 }
-float64 int64_to_float64( int64_t v STATUS_PARAM)
+float64 int64_to_float64( int_fast64_t v STATUS_PARAM)
 {
     return (float64)v;
 }
-float64 uint64_to_float64( uint64_t v STATUS_PARAM)
+float64 uint64_to_float64( uint_fast64_t v STATUS_PARAM)
 {
     return (float64)v;
 }
 #ifdef FLOATX80
-floatx80 int64_to_floatx80( int64_t v STATUS_PARAM)
+floatx80 int64_to_floatx80( int_fast64_t v STATUS_PARAM)
 {
     return (floatx80)v;
 }
@@ -152,12 +152,12 @@  int_fast32_t float32_to_int32_round_to_zero( float32 a STATUS_PARAM)
 {
     return (int32_t)a;
 }
-int64_t float32_to_int64( float32 a STATUS_PARAM)
+int_fast64_t float32_to_int64( float32 a STATUS_PARAM)
 {
     return llrintf(a);
 }
 
-int64_t float32_to_int64_round_to_zero( float32 a STATUS_PARAM)
+int_fast64_t float32_to_int64_round_to_zero( float32 a STATUS_PARAM)
 {
     return (int64_t)a;
 }
@@ -274,11 +274,11 @@  int_fast32_t float64_to_int32_round_to_zero( float64 a STATUS_PARAM)
 {
     return (int32_t)a;
 }
-int64_t float64_to_int64( float64 a STATUS_PARAM)
+int_fast64_t float64_to_int64( float64 a STATUS_PARAM)
 {
     return llrint(a);
 }
-int64_t float64_to_int64_round_to_zero( float64 a STATUS_PARAM)
+int_fast64_t float64_to_int64_round_to_zero( float64 a STATUS_PARAM)
 {
     return (int64_t)a;
 }
@@ -329,7 +329,7 @@  uint_fast32_t float64_to_uint32_round_to_zero( float64 a STATUS_PARAM)
     }
     return res;
 }
-uint64_t float64_to_uint64 (float64 a STATUS_PARAM)
+uint_fast64_t float64_to_uint64 (float64 a STATUS_PARAM)
 {
     int64_t v;
 
@@ -337,7 +337,7 @@  uint64_t float64_to_uint64 (float64 a STATUS_PARAM)
 
     return v - INT64_MIN;
 }
-uint64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM)
+uint_fast64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM)
 {
     int64_t v;
 
@@ -435,11 +435,11 @@  int_fast32_t floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM)
 {
     return (int)a;
 }
-int64_t floatx80_to_int64( floatx80 a STATUS_PARAM)
+int_fast64_t floatx80_to_int64( floatx80 a STATUS_PARAM)
 {
     return llrintl(a);
 }
-int64_t floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM)
+int_fast64_t floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM)
 {
     return (int64_t)a;
 }
diff --git a/fpu/softfloat-native.h b/fpu/softfloat-native.h
index 6cf5dc3..b198f48 100644
--- a/fpu/softfloat-native.h
+++ b/fpu/softfloat-native.h
@@ -160,15 +160,15 @@  floatx80 int32_to_floatx80( int_fast32_t STATUS_PARAM);
 #ifdef FLOAT128
 float128 int32_to_float128( int_fast32_t STATUS_PARAM);
 #endif
-float32 int64_to_float32( int64_t STATUS_PARAM);
-float32 uint64_to_float32( uint64_t STATUS_PARAM);
-float64 int64_to_float64( int64_t STATUS_PARAM);
-float64 uint64_to_float64( uint64_t v STATUS_PARAM);
+float32 int64_to_float32( int_fast64_t STATUS_PARAM);
+float32 uint64_to_float32( uint_fast64_t STATUS_PARAM);
+float64 int64_to_float64( int_fast64_t STATUS_PARAM);
+float64 uint64_to_float64( uint_fast64_t v STATUS_PARAM);
 #ifdef FLOATX80
-floatx80 int64_to_floatx80( int64_t STATUS_PARAM);
+floatx80 int64_to_floatx80( int_fast64_t STATUS_PARAM);
 #endif
 #ifdef FLOAT128
-float128 int64_to_float128( int64_t STATUS_PARAM);
+float128 int64_to_float128( int_fast64_t STATUS_PARAM);
 #endif
 
 /*----------------------------------------------------------------------------
@@ -178,8 +178,8 @@  int_fast32_t float32_to_int32( float32  STATUS_PARAM);
 int_fast32_t float32_to_int32_round_to_zero( float32  STATUS_PARAM);
 uint_fast32_t float32_to_uint32( float32 a STATUS_PARAM);
 uint_fast32_t float32_to_uint32_round_to_zero( float32 a STATUS_PARAM);
-int64_t float32_to_int64( float32  STATUS_PARAM);
-int64_t float32_to_int64_round_to_zero( float32  STATUS_PARAM);
+int_fast64_t float32_to_int64( float32  STATUS_PARAM);
+int_fast64_t float32_to_int64_round_to_zero( float32  STATUS_PARAM);
 float64 float32_to_float64( float32  STATUS_PARAM);
 #ifdef FLOATX80
 floatx80 float32_to_floatx80( float32  STATUS_PARAM);
@@ -283,10 +283,10 @@  int_fast32_t float64_to_int32( float64 STATUS_PARAM );
 int_fast32_t float64_to_int32_round_to_zero( float64 STATUS_PARAM );
 uint_fast32_t float64_to_uint32( float64 STATUS_PARAM );
 uint_fast32_t float64_to_uint32_round_to_zero( float64 STATUS_PARAM );
-int64_t float64_to_int64( float64 STATUS_PARAM );
-int64_t float64_to_int64_round_to_zero( float64 STATUS_PARAM );
-uint64_t float64_to_uint64( float64 STATUS_PARAM );
-uint64_t float64_to_uint64_round_to_zero( float64 STATUS_PARAM );
+int_fast64_t float64_to_int64( float64 STATUS_PARAM );
+int_fast64_t float64_to_int64_round_to_zero( float64 STATUS_PARAM );
+uint_fast64_t float64_to_uint64( float64 STATUS_PARAM );
+uint_fast64_t float64_to_uint64_round_to_zero( float64 STATUS_PARAM );
 float32 float64_to_float32( float64 STATUS_PARAM );
 #ifdef FLOATX80
 floatx80 float64_to_floatx80( float64 STATUS_PARAM );
@@ -392,8 +392,8 @@  INLINE float64 float64_scalbn(float64 a, int n)
 *----------------------------------------------------------------------------*/
 int_fast32_t floatx80_to_int32( floatx80 STATUS_PARAM );
 int_fast32_t floatx80_to_int32_round_to_zero( floatx80 STATUS_PARAM );
-int64_t floatx80_to_int64( floatx80 STATUS_PARAM);
-int64_t floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM);
+int64_fast_t floatx80_to_int64( floatx80 STATUS_PARAM);
+int64_fast_t floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM);
 float32 floatx80_to_float32( floatx80 STATUS_PARAM );
 float64 floatx80_to_float64( floatx80 STATUS_PARAM );
 #ifdef FLOAT128
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 6b2cbd7..1a1281d 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -5938,7 +5938,7 @@  uint_fast16_t float64_to_uint16_round_to_zero( float64 a STATUS_PARAM )
 }
 
 /* FIXME: This looks broken.  */
-uint64_t float64_to_uint64 (float64 a STATUS_PARAM)
+uint_fast64_t float64_to_uint64 (float64 a STATUS_PARAM)
 {
     int64_t v;
 
@@ -5949,7 +5949,7 @@  uint64_t float64_to_uint64 (float64 a STATUS_PARAM)
     return v - INT64_MIN;
 }
 
-uint64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM)
+uint_fast64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM)
 {
     int64_t v;