From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Subject: Re: Triple parity and beyond Date: Wed, 20 Nov 2013 10:59:32 -0800 Message-ID: <528D0694.3060703@zytor.com> References: <528A90B7.5010905@zytor.com> <528AA1EB.3010909@zytor.com> <528B3A6F.2010304@hesbynett.no> <528C8F8E.9030908@hesbynett.no> <1fe6f763-a5a4-4cc7-b23d-7928b0925f09@email.android.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-raid-owner@vger.kernel.org To: Andrea Mazzoleni Cc: David Brown , Linux RAID Mailing List , Btrfs BTRFS , David Smith List-Id: linux-raid.ids On 11/20/2013 10:56 AM, Andrea Mazzoleni wrote: > Hi, > > Yep. At present to multiply for 2^-1 I'm using in C: > > static inline uint64_t d2_64(uint64_t v) > { > uint64_t mask = v & 0x0101010101010101U; > mask = (mask << 8) - mask; > v = (v >> 1) & 0x7f7f7f7f7f7f7f7fU; > v ^= mask & 0x8e8e8e8e8e8e8e8eU; > return v; > } > > and for SSE2: > > asm volatile("movdqa %xmm2,%xmm4"); > asm volatile("pxor %xmm5,%xmm5"); > asm volatile("psllw $7,%xmm4"); > asm volatile("psrlw $1,%xmm2"); > asm volatile("pcmpgtb %xmm4,%xmm5"); > asm volatile("pand %xmm6,%xmm2"); with xmm6 == 7f7f7f7f7f7f... > asm volatile("pand %xmm3,%xmm5"); with xmm3 == 8e8e8e8e8e... > asm volatile("pxor %xmm5,%xmm2"); > > where xmm2 is the intput/output > Now, that doesn't sound like something that can get neatly meshed into the Cauchy matrix scheme, I assume. It is somewhat nice to have a scheme which is arbitrarily expandable without having to fall back to dual parity during the restripe operation. It probably also reduces the amount of code necessary. -hpa