Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751754AbdCQLUo convert rfc822-to-8bit (ORCPT ); Fri, 17 Mar 2017 07:20:44 -0400 Received: from smtp-out4.electric.net ([192.162.216.187]:50471 "EHLO smtp-out4.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751303AbdCQLUk (ORCPT ); Fri, 17 Mar 2017 07:20:40 -0400 From: David Laight To: "'Hayes Wang'" , "netdev@vger.kernel.org" CC: nic_swsd , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" Subject: RE: [PATCH net-next] r8152: simply the arguments Thread-Topic: [PATCH net-next] r8152: simply the arguments Thread-Index: AQHSnh6ABe1sQXPSR0SS5nuMXefGeKGXhkQQgADSiwCAAIdwoA== Date: Fri, 17 Mar 2017 11:08:05 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6DCFFB3ABD@AcuExch.aculab.com> References: <1394712342-15778-253-Taiwan-albertk@realtek.com> <063D6719AE5E284EB5DD2968C1650D6DCFFB29DA@AcuExch.aculab.com> <0835B3720019904CB8F7AA43166CEEB201A32FCB@RTITMBSV06.realtek.com.tw> In-Reply-To: <0835B3720019904CB8F7AA43166CEEB201A32FCB@RTITMBSV06.realtek.com.tw> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuExch.aculab.com X-TLS: TLSv1:AES128-SHA:128 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 939 Lines: 26 From: Hayes Wang > Sent: 17 March 2017 03:00 > To: David Laight; netdev@vger.kernel.org > Cc: nic_swsd; linux-kernel@vger.kernel.org; linux-usb@vger.kernel.org > Subject: RE: [PATCH net-next] r8152: simply the arguments > > David Laight [mailto:David.Laight@ACULAB.COM] > > 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