Re: [PATCH] net: Remove branch in csum_shift()

2022-03-01 Thread Russell King (Oracle)
On Tue, Mar 01, 2022 at 11:41:06AM +, David Laight wrote: > From: Christophe Leroy > > Sent: 01 March 2022 11:15 > ... > > Looks like ARM also does better code with the generic implementation as > > it seems to have some looking like conditional instructions 'rorne' and > > 'strne'. > > In

RE: [PATCH] net: Remove branch in csum_shift()

2022-03-01 Thread David Laight
From: Christophe Leroy > Sent: 01 March 2022 11:15 ... > Looks like ARM also does better code with the generic implementation as > it seems to have some looking like conditional instructions 'rorne' and > 'strne'. In arm32 (and I think arm64) every instruction is conditional. > static

Re: [PATCH] net: Remove branch in csum_shift()

2022-03-01 Thread Christophe Leroy
Le 01/03/2022 à 11:47, David Laight a écrit : > From: Christophe Leroy >> Sent: 01 March 2022 10:20 >> >> Le 13/02/2022 à 18:47, David Laight a écrit : >>> From: Segher Boessenkool Sent: 13 February 2022 09:16 >>> > What happens on x86-64? > > Trying to do the same in

RE: [PATCH] net: Remove branch in csum_shift()

2022-03-01 Thread David Laight
From: Christophe Leroy > Sent: 01 March 2022 10:20 > > Le 13/02/2022 à 18:47, David Laight a écrit : > > From: Segher Boessenkool > >> Sent: 13 February 2022 09:16 > > > >> > >>> What happens on x86-64? > >>> > >>> Trying to do the same in the x86 ipcsum code tended to make the code > >>>

Re: [PATCH] net: Remove branch in csum_shift()

2022-03-01 Thread Christophe Leroy
Le 13/02/2022 à 18:47, David Laight a écrit : > From: Segher Boessenkool >> Sent: 13 February 2022 09:16 > >> >>> What happens on x86-64? >>> >>> Trying to do the same in the x86 ipcsum code tended to make the code worse. >>> (Although that test is for an odd length fragment and can just be

Re: [PATCH] net: Remove branch in csum_shift()

2022-02-14 Thread Segher Boessenkool
On Sun, Feb 13, 2022 at 05:47:52PM +, David Laight wrote: > From: Segher Boessenkool > > Sent: 13 February 2022 09:16 > > In an ideal world the compiler could choose the optimal code sequences > > everywhere. But that won't ever happen, the search space is way too > > big. So compilers just

RE: [PATCH] net: Remove branch in csum_shift()

2022-02-13 Thread David Laight
From: Segher Boessenkool > Sent: 13 February 2022 09:16 > > > What happens on x86-64? > > > > Trying to do the same in the x86 ipcsum code tended to make the code worse. > > (Although that test is for an odd length fragment and can just be removed.) > > In an ideal world the compiler could

Re: [PATCH] net: Remove branch in csum_shift()

2022-02-13 Thread Segher Boessenkool
On Sun, Feb 13, 2022 at 02:39:06AM +, David Laight wrote: > From: Christophe Leroy > > Sent: 11 February 2022 08:48 > > > > Today's implementation of csum_shift() leads to branching based on > > parity of 'offset' > > > > 02f8 : > > 2f8: 70 a5 00 01 andi. r5,r5,1

RE: [PATCH] net: Remove branch in csum_shift()

2022-02-12 Thread David Laight
From: Christophe Leroy > Sent: 11 February 2022 08:48 > > Today's implementation of csum_shift() leads to branching based on > parity of 'offset' > > 02f8 : >2f8: 70 a5 00 01 andi. r5,r5,1 >2fc: 41 a2 00 08 beq 304 >300: