RE: [PATCH net-next] r8152: simply the arguments

From: David Laight
Date: Fri Mar 17 2017 - 07:20:52 EST


From: Hayes Wang
> Sent: 17 March 2017 03:00
> To: David Laight; netdev@xxxxxxxxxxxxxxx
> Cc: nic_swsd; linux-kernel@xxxxxxxxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx
> Subject: RE: [PATCH net-next] r8152: simply the arguments
>
> David Laight [mailto:David.Laight@xxxxxxxxxx]
> > Sent: Thursday, March 16, 2017 10:28 PM
> [...]
> > If you are really lucky the compiler will optimise it away.
> > Otherwise it will generate another local variable and possibly
> > a register spill to stack.
>
> However, I could reduce the time for calculating the address,
> because I only calculate it once and save the result to a variable.
> Right?

address you want is just an offset from another pointer that is
commonly used and ought to be assigned to a register variable.

The offset can be added by the instruction that puts the value into
the register used for the first function argument.

So 'saving' it in another variable is extra work.

David