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

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

 



On Fri, Sep 29, 2017 at 04:29:25PM +0100, Maciej W. Rozycki wrote:
> 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>

Thanks Maciej!

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

Yes, that did occur to me, but it seemed simpler for this non-critical
case to use the more compatible sequence (whereas for the equivalent VZ
guest accessors, which imply R5+, I've used DINS in my not-yet-submitted
patches).

Cheers
James

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux