[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DCFE733A0@AcuExch.aculab.com>
Date: Thu, 2 Mar 2017 10:24:42 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Eric Dumazet' <eric.dumazet@...il.com>,
Alexander Duyck <alexander.duyck@...il.com>
CC: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
"Tariq Toukan" <tariqt@...lanox.com>,
Saeed Mahameed <saeedm@...lanox.com>
Subject: RE: [PATCH v2 net] net: solve a NAPI race
From: Eric Dumazet
> Sent: 01 March 2017 17:33
> On Wed, 2017-03-01 at 08:14 -0800, Alexander Duyck wrote:
>
> > What build flags are you using? With -Os or -O2 I have seen it
> > convert the /b * c into a single shift.
> >
>
>
> Because b & c are unsigned in our case.
>
> I presume David tried signed integers, this is why gcc does that.
I was using integer constants but an unsigned variable.
Changing the constants to unsigned makes no difference (they would get
promoted anyway).
After some experiments I can get gcc to generate a single shift if the
variable being tested is 32bits, the constants are 64bits and a 64bit
result is required.
In every other case it does either and-shr-shl or shr-and-shl (all the
shr are logical).
David
Powered by blists - more mailing lists