[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] * include/fpu/softfloat.h (floatx80_invalid_enc
From: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] [PATCH] * include/fpu/softfloat.h (floatx80_invalid_encoding): Handle m68k specific infinity pattern. |
Date: |
Wed, 18 Sep 2019 10:59:02 +0100 |
User-agent: |
mu4e 1.3.4; emacs 27.0.50 |
Pierre Muller <address@hidden> writes:
> Hi Thomas,
>
> I tried to use git format-patch -s below,
> and change the commit message that appears below:
>
>
> muller@gcc123:~/gnu/qemu/qemu$ git format-patch -s
> a017dc6d43aaa4ffc7be40ae3adee4086be9cec2^
> 0001-Fix-floatx80_invalid_encoding-function-for-m68k-cpu.patch
> muller@gcc123:~/gnu/qemu/qemu$ cat
> 0001-Fix-floatx80_invalid_encoding-function-for-m68k-cpu.patch
It's best to send the patches directly (i.e. don't include them in a
larger email). This is because when maintainers apply the email they end
up with a bunch of additional stuff and the corrupting of subject line.
> From a017dc6d43aaa4ffc7be40ae3adee4086be9cec2 Mon Sep 17 00:00:00 2001
> From: Pierre Muller <address@hidden>
> Date: Wed, 18 Sep 2019 08:04:19 +0000
> Subject: [PATCH] Fix floatx80_invalid_encoding function for m68k cpu
>
> As m68k accepts different patterns for infinity,
> and additional test for valid infinity must be added
> for m68k cpu target.
>
> Signed-off-by: Pierre Muller <address@hidden>
> ---
> include/fpu/softfloat.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
> index ecb8ba0114..dea24384e9 100644
> --- a/include/fpu/softfloat.h
> +++ b/include/fpu/softfloat.h
> @@ -685,10 +685,17 @@ static inline int floatx80_is_any_nan(floatx80 a)
> | pseudo-infinities and un-normal numbers. It does not include
> | pseudo-denormals, which must still be correctly handled as inputs even
> | if they are never generated as outputs.
> +| As m68k accepts different patterns for infinity, thus an additional test
> +| for valid infinity value must be added for m68k CPU.
>
> *----------------------------------------------------------------------------*/
> static inline bool floatx80_invalid_encoding(floatx80 a)
> {
> +#if defined (TARGET_M68K)
> + return ((a.low & (1ULL << 63)) == 0 && (a.high & 0x7FFF) != 0)
> + && (! floatx80_is_infinity(a));
> +#else
> return (a.low & (1ULL << 63)) == 0 && (a.high & 0x7FFF) != 0;
> +#endif
> }
As most of the test is the same we could rewrite this to:
bool invalid = (a.low & (1ULL << 63)) == 0 && (a.high & 0x7FFF) != 0;
#if defined (TARGET_M68K)
invalid &= !floatx80_is_infinity(a)
#endif
return invalid;
The compiler should be able to simplify the logic from there.
Do we have any test cases that we could add to tests/tcg/m68k?
>
> #define floatx80_zero make_floatx80(0x0000, 0x0000000000000000LL)
--
Alex Bennée