Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-14 Thread Segher Boessenkool
On Wed, Apr 14, 2021 at 03:32:04PM +, David Laight wrote: > From: Segher Boessenkool > > Sent: 14 April 2021 16:19 > ... > > > Could the kernel use GCC builtin atomic functions instead ? > > > > > > https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html > > > > Certainly that

RE: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-14 Thread David Laight
From: Segher Boessenkool > Sent: 14 April 2021 16:19 ... > > Could the kernel use GCC builtin atomic functions instead ? > > > > https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html > > Certainly that should work fine for the simpler cases that the atomic > operations are meant to

Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-14 Thread Segher Boessenkool
On Wed, Apr 14, 2021 at 02:42:51PM +0200, Christophe Leroy wrote: > Le 14/04/2021 à 14:24, Segher Boessenkool a écrit : > >On Wed, Apr 14, 2021 at 12:01:21PM +1000, Nicholas Piggin wrote: > >>Would be nice if we could let the compiler deal with it all... > >> > >>static inline unsigned long

Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-14 Thread Christophe Leroy
Le 14/04/2021 à 14:24, Segher Boessenkool a écrit : On Wed, Apr 14, 2021 at 12:01:21PM +1000, Nicholas Piggin wrote: Would be nice if we could let the compiler deal with it all... static inline unsigned long lr(unsigned long *mem) { unsigned long val; /* * This

Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-14 Thread Segher Boessenkool
On Wed, Apr 14, 2021 at 12:01:21PM +1000, Nicholas Piggin wrote: > Would be nice if we could let the compiler deal with it all... > > static inline unsigned long lr(unsigned long *mem) > { > unsigned long val; > > /* > * This doesn't clobber memory but want to avoid

Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-13 Thread Nicholas Piggin
Excerpts from Segher Boessenkool's message of April 14, 2021 7:58 am: > On Tue, Apr 13, 2021 at 06:33:19PM +0200, Christophe Leroy wrote: >> Le 12/04/2021 à 23:54, Segher Boessenkool a écrit : >> >On Thu, Apr 08, 2021 at 03:33:44PM +, Christophe Leroy wrote: >> >>For clear bits, on 32 bits

Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-13 Thread Segher Boessenkool
On Tue, Apr 13, 2021 at 06:33:19PM +0200, Christophe Leroy wrote: > Le 12/04/2021 à 23:54, Segher Boessenkool a écrit : > >On Thu, Apr 08, 2021 at 03:33:44PM +, Christophe Leroy wrote: > >>For clear bits, on 32 bits 'rlwinm' can be used instead or 'andc' for > >>when all bits to be cleared are

Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-13 Thread Christophe Leroy
Le 12/04/2021 à 23:54, Segher Boessenkool a écrit : Hi! On Thu, Apr 08, 2021 at 03:33:44PM +, Christophe Leroy wrote: For clear bits, on 32 bits 'rlwinm' can be used instead or 'andc' for when all bits to be cleared are consecutive. Also on 64-bits, as long as both the top and bottom

Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-12 Thread Segher Boessenkool
Hi! On Thu, Apr 08, 2021 at 03:33:44PM +, Christophe Leroy wrote: > For clear bits, on 32 bits 'rlwinm' can be used instead or 'andc' for > when all bits to be cleared are consecutive. Also on 64-bits, as long as both the top and bottom bits are in the low 32-bit half (for 32 bit mode, it