[linux-yocto] [yocto-4.12][PATCH] Mips kernel warining:resolve some warning when compiling arch/mips/math-emu/cp1emu.c
Bruce Ashfield
bruce.ashfield at windriver.com
Thu Jan 18 08:02:10 PST 2018
I had already merged this, when I realized that the patch headers
are wrong on this.
I'm not sure how you prepared and sent this, but make sure to not
modify the shortlog, and put the "commit <> upstream", after the
upstream shortlog.
Bruce
n 01/18/2018 01:04 AM, Hongzhi.Song wrote:
> From: Manuel Lauss <manuel.lauss at gmail.com>
>
> commit 8535f2ba0a9b971df62a5890699b9dfe2e0d5580 upstream
>
> MIPS: math-emu: do not use bools for arithmetic
>
> GCC-7 complains about a boolean value being used with an arithmetic
> AND:
>
> arch/mips/math-emu/cp1emu.c: In function 'cop1Emulate':
> arch/mips/math-emu/cp1emu.c:838:14: warning: '~' on a boolean expression [-Wbool-operation]
> fpr = (x) & ~(cop1_64bit(xcp) == 0); \
> ^
> arch/mips/math-emu/cp1emu.c:1068:3: note: in expansion of macro 'DITOREG'
> DITOREG(dval, MIPSInst_RT(ir));
> ^~~~~~~
> arch/mips/math-emu/cp1emu.c:838:14: note: did you mean to use logical not?
> fpr = (x) & ~(cop1_64bit(xcp) == 0); \
>
> Since cop1_64bit() returns and int, just flip the LSB.
>
> Suggested-by: Maciej W. Rozycki <macro at imgtec.com>
> Signed-off-by: Manuel Lauss <manuel.lauss at gmail.com>
> Reviewed-by: Maciej W. Rozycki <macro at imgtec.com>
> Cc: linux-mips at linux-mips.org
> Patchwork: https://patchwork.linux-mips.org/patch/17058/
> Signed-off-by: Ralf Baechle <ralf at linux-mips.org>
>
> Signed-off-by: Hongzhi Song <hongzhi.song at windriver.com>
> ---
> arch/mips/math-emu/cp1emu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
> index add2320..ad20b69 100644
> --- a/arch/mips/math-emu/cp1emu.c
> +++ b/arch/mips/math-emu/cp1emu.c
> @@ -830,12 +830,12 @@ do { \
> } while (0)
>
> #define DIFROMREG(di, x) \
> - ((di) = get_fpr64(&ctx->fpr[(x) & ~(cop1_64bit(xcp) == 0)], 0))
> + ((di) = get_fpr64(&ctx->fpr[(x) & ~(cop1_64bit(xcp) ^ 1)], 0))
>
> #define DITOREG(di, x) \
> do { \
> unsigned fpr, i; \
> - fpr = (x) & ~(cop1_64bit(xcp) == 0); \
> + fpr = (x) & ~(cop1_64bit(xcp) ^ 1); \
> set_fpr64(&ctx->fpr[fpr], 0, di); \
> for (i = 1; i < ARRAY_SIZE(ctx->fpr[x].val64); i++) \
> set_fpr64(&ctx->fpr[fpr], i, 0); \
>
More information about the linux-yocto
mailing list