Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1401722

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

From "H. Peter Anvin" <hpa@zytor.com>
Newsgroups linux.kernel
Subject Re: [patch V4 09/31] bitops: Add x86-specific parity functions
Date 2016-05-16 21:30 +0200
Message-ID <rzwng-2Fv-17@gated-at.bofh.it> (permalink)
References <rxxGP-4ls-49@gated-at.bofh.it> <rxytb-5fG-5@gated-at.bofh.it> <rxyMz-5vM-35@gated-at.bofh.it> <rzt61-rV-7@gated-at.bofh.it> <rzubM-1me-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On May 16, 2016 10:06:08 AM PDT, Peter Zijlstra <peterz@infradead.org> 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 the parity, or compare it with other
>variables.
>> 
>> For example, in drivers/net/ethernet/broadcom/tg3.c,
>> 
>> static int tg3_test_nvram(struct tg3 *tp)
>> {
>> 	......
>> 	if (parity8(data[i]) == !!parity[i])
>> 		goto out;
>> 	......
>> }
>> 
>> If use GEN_BINARY_RMWcc stuff,
>> 
>> static inline unsigned int __arch_parity8(unsigned int w)
>> {
>> 	GEN_BINARY_RMWcc("testb", w, "er", 0xff, "%0", "po");
>> }
>
>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 worth, I have a patchset for cc out just about ready to post.  It is in gcc 6.1.
-- 
Sent from my Android device with K-9 Mail. Please excuse brevity and formatting.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [patch V4 09/31] bitops: Add x86-specific parity functions Zhaoxiu Zeng <zengzhaoxiu@163.com> - 2016-05-16 18:00 +0200
  Re: [patch V4 09/31] bitops: Add x86-specific parity functions Peter Zijlstra <peterz@infradead.org> - 2016-05-16 19:10 +0200
    Re: [patch V4 09/31] bitops: Add x86-specific parity functions "H. Peter Anvin" <hpa@zytor.com> - 2016-05-16 21:30 +0200
      Re: [patch V4 09/31] bitops: Add x86-specific parity functions Peter Zijlstra <peterz@infradead.org> - 2016-05-17 13:30 +0200

csiph-web