[patch V4 09/31] bitops: Add x86-specific parity functions

2016-06-29 Thread zengzhaoxiu
From: Zhaoxiu Zeng Signed-off-by: Zhaoxiu Zeng --- arch/x86/include/asm/arch_parity.h | 60 ++ arch/x86/include/asm/bitops.h | 4 ++- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644

[patch V4 09/31] bitops: Add x86-specific parity functions

2016-06-29 Thread zengzhaoxiu
From: Zhaoxiu Zeng Signed-off-by: Zhaoxiu Zeng --- arch/x86/include/asm/arch_parity.h | 60 ++ arch/x86/include/asm/bitops.h | 4 ++- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 arch/x86/include/asm/arch_parity.h diff --git

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-17 Thread Peter Zijlstra
On Mon, May 16, 2016 at 12:22:05PM -0700, H. Peter Anvin wrote: > On May 16, 2016 10:06:08 AM PDT, Peter Zijlstra wrote: > >blergh; GCC does indeed make a mess of that. It looks we'll need the > >cc-output stuff for this in order for GCC to generates sane code for > >that

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-17 Thread Peter Zijlstra
On Mon, May 16, 2016 at 12:22:05PM -0700, H. Peter Anvin wrote: > On May 16, 2016 10:06:08 AM PDT, Peter Zijlstra wrote: > >blergh; GCC does indeed make a mess of that. It looks we'll need the > >cc-output stuff for this in order for GCC to generates sane code for > >that :/ > > For what it's

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-16 Thread H. Peter Anvin
On May 16, 2016 10:06:08 AM PDT, Peter Zijlstra wrote: >On Mon, May 16, 2016 at 11:49:05PM +0800, Zhaoxiu Zeng wrote: >> On 2016/5/11 17:31, Peter Zijlstra wrote: >> > Please use the GEN_*_RMWcc() stuff to avoid the setpo where >possible. >> >> Setpo is better. >> In most

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-16 Thread H. Peter Anvin
On May 16, 2016 10:06:08 AM PDT, Peter Zijlstra wrote: >On Mon, May 16, 2016 at 11:49:05PM +0800, Zhaoxiu Zeng wrote: >> On 2016/5/11 17:31, Peter Zijlstra wrote: >> > Please use the GEN_*_RMWcc() stuff to avoid the setpo where >possible. >> >> Setpo is better. >> In most cases, we need to store

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-16 Thread H. Peter Anvin
On May 11, 2016 2:31:39 AM PDT, Peter Zijlstra wrote: >On Wed, May 11, 2016 at 05:16:38PM +0800, zengzhao...@163.com wrote: > >> +static inline unsigned int __arch_parity4(unsigned int w) >> +{ >> +unsigned int res = 0; >> + >> +asm("test $0xf, %1; setpo %b0" >> +

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-16 Thread H. Peter Anvin
On May 11, 2016 2:31:39 AM PDT, Peter Zijlstra wrote: >On Wed, May 11, 2016 at 05:16:38PM +0800, zengzhao...@163.com wrote: > >> +static inline unsigned int __arch_parity4(unsigned int w) >> +{ >> +unsigned int res = 0; >> + >> +asm("test $0xf, %1; setpo %b0" >> +: "+q" (res)

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-16 Thread Peter Zijlstra
On Mon, May 16, 2016 at 11:49:05PM +0800, Zhaoxiu Zeng wrote: > On 2016/5/11 17:31, Peter Zijlstra wrote: > > Please use the GEN_*_RMWcc() stuff to avoid the setpo where possible. > > Setpo is better. > In most cases, we need to store the parity, or compare it with other > variables. > > For

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-16 Thread Peter Zijlstra
On Mon, May 16, 2016 at 11:49:05PM +0800, Zhaoxiu Zeng wrote: > On 2016/5/11 17:31, Peter Zijlstra wrote: > > Please use the GEN_*_RMWcc() stuff to avoid the setpo where possible. > > Setpo is better. > In most cases, we need to store the parity, or compare it with other > variables. > > For

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-16 Thread Zhaoxiu Zeng
On 2016/5/11 17:31, Peter Zijlstra wrote: > Please use the GEN_*_RMWcc() stuff to avoid the setpo where possible. Setpo is better. In most cases, we need to store the parity, or compare it with other variables. For example, in drivers/net/ethernet/broadcom/tg3.c, static int

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-16 Thread Zhaoxiu Zeng
On 2016/5/11 17:31, Peter Zijlstra wrote: > Please use the GEN_*_RMWcc() stuff to avoid the setpo where possible. Setpo is better. In most cases, we need to store the parity, or compare it with other variables. For example, in drivers/net/ethernet/broadcom/tg3.c, static int

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-11 Thread Borislav Petkov
On Wed, May 11, 2016 at 11:31:39AM +0200, Peter Zijlstra wrote: > How many bytes does that end up being? Should we make it a call? Those should call __arch_hweight* anyway - no need for the duplication at all. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard,

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-11 Thread Borislav Petkov
On Wed, May 11, 2016 at 11:31:39AM +0200, Peter Zijlstra wrote: > How many bytes does that end up being? Should we make it a call? Those should call __arch_hweight* anyway - no need for the duplication at all. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard,

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-11 Thread Peter Zijlstra
On Wed, May 11, 2016 at 05:16:38PM +0800, zengzhao...@163.com wrote: > +static inline unsigned int __arch_parity4(unsigned int w) > +{ > + unsigned int res = 0; > + > + asm("test $0xf, %1; setpo %b0" > + : "+q" (res) > + : "r" (w) > + : "cc"); > + > +

Re: [patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-11 Thread Peter Zijlstra
On Wed, May 11, 2016 at 05:16:38PM +0800, zengzhao...@163.com wrote: > +static inline unsigned int __arch_parity4(unsigned int w) > +{ > + unsigned int res = 0; > + > + asm("test $0xf, %1; setpo %b0" > + : "+q" (res) > + : "r" (w) > + : "cc"); > + > +

[patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-11 Thread zengzhaoxiu
From: Zhaoxiu Zeng Use alternatives, lifted from arch_hweight Signed-off-by: Zhaoxiu Zeng --- arch/x86/include/asm/arch_hweight.h | 5 ++ arch/x86/include/asm/arch_parity.h | 117

[patch V4 09/31] bitops: Add x86-specific parity functions

2016-05-11 Thread zengzhaoxiu
From: Zhaoxiu Zeng Use alternatives, lifted from arch_hweight Signed-off-by: Zhaoxiu Zeng --- arch/x86/include/asm/arch_hweight.h | 5 ++ arch/x86/include/asm/arch_parity.h | 117 arch/x86/include/asm/bitops.h | 4 +- 3 files changed, 125