Re: [PATCH] MIPS: Fix input modify in __write_64bit_c0_split()

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

 



On Tue, 19 Sep 2017, James Hogan wrote:

> Avoid modifying the input by using a temporary variable as an output
> which is modified instead of the input and not otherwise used. The asm
> is always __volatile__ so GCC shouldn't optimise it out. The low
> register of the temporary output is written before the high register of
> the input is read, so we have two constraint alternatives, one where
> both use the same registers (for when the input value isn't subsequently
> used), and one with an early clobber on the output in case the low
> output uses the same register as the high input. This allows the
> resulting assembly to remain mostly unchanged.

 Clever and well-spotted!

Reviewed-by: Maciej W. Rozycki <macro@xxxxxxxxxx>

 NB you could use DINS on MIPS64r2+ (and `__read_64bit_c0_split' could 
use one instruction less; patch posted separately).

  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