qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value
@ 2012-09-24 16:28 Peter Maydell
  2012-09-24 16:43 ` Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Maydell @ 2012-09-24 16:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, patches

In float16_to_float32, when returning an infinity, just pass zero
as the mantissa argument to packFloat32(), rather than shifting
a value which we know must be zero.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Spotted by the clang static analyzer. This brings this code into line with
the other float-to-float conversion functions and was probably a harmless
cut-n-paste error from the normal-return codepath.

 fpu/softfloat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index b29256a..01a28ca 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -3007,7 +3007,7 @@ float32 float16_to_float32(float16 a, flag ieee STATUS_PARAM)
         if (aSig) {
             return commonNaNToFloat32(float16ToCommonNaN(a STATUS_VAR) STATUS_VAR);
         }
-        return packFloat32(aSign, 0xff, aSig << 13);
+        return packFloat32(aSign, 0xff, 0);
     }
     if (aExp == 0) {
         int8 shiftCount;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value
  2012-09-24 16:28 [Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value Peter Maydell
@ 2012-09-24 16:43 ` Richard Henderson
  2012-09-24 17:23 ` Aurelien Jarno
  2012-10-01 20:12 ` Aurelien Jarno
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2012-09-24 16:43 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-trivial, qemu-devel, patches

On 2012-09-24 09:28, Peter Maydell wrote:
> In float16_to_float32, when returning an infinity, just pass zero
> as the mantissa argument to packFloat32(), rather than shifting
> a value which we know must be zero.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value
  2012-09-24 16:28 [Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value Peter Maydell
  2012-09-24 16:43 ` Richard Henderson
@ 2012-09-24 17:23 ` Aurelien Jarno
  2012-10-01 20:12 ` Aurelien Jarno
  2 siblings, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2012-09-24 17:23 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-trivial, qemu-devel, patches

On Mon, Sep 24, 2012 at 05:28:35PM +0100, Peter Maydell wrote:
> In float16_to_float32, when returning an infinity, just pass zero
> as the mantissa argument to packFloat32(), rather than shifting
> a value which we know must be zero.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Spotted by the clang static analyzer. This brings this code into line with
> the other float-to-float conversion functions and was probably a harmless
> cut-n-paste error from the normal-return codepath.
> 
>  fpu/softfloat.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index b29256a..01a28ca 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -3007,7 +3007,7 @@ float32 float16_to_float32(float16 a, flag ieee STATUS_PARAM)
>          if (aSig) {
>              return commonNaNToFloat32(float16ToCommonNaN(a STATUS_VAR) STATUS_VAR);
>          }
> -        return packFloat32(aSign, 0xff, aSig << 13);
> +        return packFloat32(aSign, 0xff, 0);
>      }
>      if (aExp == 0) {
>          int8 shiftCount;
> -- 
> 1.7.9.5

Good catch!

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value
  2012-09-24 16:28 [Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value Peter Maydell
  2012-09-24 16:43 ` Richard Henderson
  2012-09-24 17:23 ` Aurelien Jarno
@ 2012-10-01 20:12 ` Aurelien Jarno
  2 siblings, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2012-10-01 20:12 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-trivial, qemu-devel, patches

On Mon, Sep 24, 2012 at 05:28:35PM +0100, Peter Maydell wrote:
> In float16_to_float32, when returning an infinity, just pass zero
> as the mantissa argument to packFloat32(), rather than shifting
> a value which we know must be zero.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Spotted by the clang static analyzer. This brings this code into line with
> the other float-to-float conversion functions and was probably a harmless
> cut-n-paste error from the normal-return codepath.
> 
>  fpu/softfloat.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index b29256a..01a28ca 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -3007,7 +3007,7 @@ float32 float16_to_float32(float16 a, flag ieee STATUS_PARAM)
>          if (aSig) {
>              return commonNaNToFloat32(float16ToCommonNaN(a STATUS_VAR) STATUS_VAR);
>          }
> -        return packFloat32(aSign, 0xff, aSig << 13);
> +        return packFloat32(aSign, 0xff, 0);
>      }
>      if (aExp == 0) {
>          int8 shiftCount;

Thanks, applied.


-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-01 20:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-24 16:28 [Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value Peter Maydell
2012-09-24 16:43 ` Richard Henderson
2012-09-24 17:23 ` Aurelien Jarno
2012-10-01 20:12 ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).