Re: [RFC PATCH] MIPS: math-emu: do not use bools for arithmetic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 31 Jul 2017, Manuel Lauss wrote:

> I'm unsure whether the patch is really correct, due to the unexpected
> binary size reduction.  I do not have a hardfloat mips32 userland at hand
> therefore I'd appreciate it if someone could test it!

 What exactly are you unsure about?  Double operations using odd register 
indices in the 32-bit FPR mode are architecturally unpredictable.  Is this 
what concerns you?

> diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
> index f08a7b4facb9..f3a9bf5285e0 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) == 0 ? 1 : 0)], 0))

 Umm, I find the expression somewhat hard to follow.  How about:

	((di) = get_fpr64(&ctx->fpr[(x) & ~(cop1_64bit(xcp) ^ 1))

?

>  #define DITOREG(di, x)							\
>  do {									\
>  	unsigned fpr, i;						\
> -	fpr = (x) & ~(cop1_64bit(xcp) == 0);				\
> +	fpr = (x) & ~(cop1_64bit(xcp) == 0 ? 1 : 0);			\

 Likewise:

	fpr = (x) & ~(cop1_64bit(xcp) ^ 1);				\

?

  Maciej




[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux