From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ardb+git@google.com>
Cc: linux-arm-kernel@lists.infradead.org,
Ard Biesheuvel <ardb@kernel.org>, Christoph Hellwig <hch@lst.de>,
Demian Shulhan <demyansh@gmail.com>
Subject: Re: [PATCH 1/2] raid6: neon: process four data disks per Horner step
Date: Thu, 19 Nov 2026 14:44:18 -0800 [thread overview]
Message-ID: <20261119224418.GC1894@quark> (raw)
In-Reply-To: <20261118183335.1944213-5-ardb+git@google.com>
On Wed, Nov 18, 2026 at 07:33:37PM +0100, Ard Biesheuvel wrote:
> diff --git a/lib/raid/raid6/arm/neon.uc b/lib/raid/raid6/arm/neon.uc
> index 14a9fc2c60fa..6f74e2b82fc4 100644
> --- a/lib/raid/raid6/arm/neon.uc
> +++ b/lib/raid/raid6/arm/neon.uc
> @@ -22,15 +22,29 @@
> * $#-way unrolled NEON intrinsics math RAID-6 instruction set
> *
> * This file is postprocessed using unroll.awk
> + *
> + * The Q syndrome is evaluated using Horner's rule, but four data disks at a
> + * time, i.e.,
> + *
> + * Q' = x^4 * Q + x^3 * D[z+3] + x^2 * D[z+2] + x * D[z+1] + D[z]
In gen_syndrome_real() and xor_syndrome_real() later in the file, z is
the highest disk index in each 4-disk step rather than the lowest. So
it might make more sense to write this as:
Q' = x^4 * Q + x^3 * D[z] + x^2 * D[z-1] + x * D[z-2] + D[z-3]
> +/* Q * x^4 + D3 * x^3 + D2 * x^2 + D1 * x + D0 */
> +static inline unative_t HORNER4(unative_t q, unative_t d3, unative_t d2,
> + unative_t d1, unative_t d0, unative_t x1d)
> +{
> + unative_t lo = vshlq_n_u8(q, 4) ^ vshlq_n_u8(d3, 3) ^
> + vshlq_n_u8(d2, 2) ^ vshlq_n_u8(d1, 1) ^ d0;
> + unative_t hi = vshrq_n_u8(q, 4) ^ vshrq_n_u8(d3, 5) ^
> + vshrq_n_u8(d2, 6) ^ vshrq_n_u8(d1, 7);
> +
> + return lo ^ PMUL(hi, x1d);
> +}
This is called right after 'q' is updated, so it will take a bit longer
to be available than the other inputs, and ideally the generated code
would XOR together the other inputs first. Putting 'q' last might make
it more likely for the compiler to do that:
unative_t lo = vshlq_n_u8(d3, 3) ^ vshlq_n_u8(d2, 2) ^
vshlq_n_u8(d1, 1) ^ d0 ^ vshlq_n_u8(q, 4);
unative_t hi = vshrq_n_u8(d3, 5) ^ vshrq_n_u8(d2, 6) ^
vshrq_n_u8(d1, 7) ^ vshrq_n_u8(q, 4);
- Eric
next prev parent reply other threads:[~2026-11-19 22:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 18:33 [PATCH 0/2] raid6/arm64: Use aggregation and 3-way XOR Ard Biesheuvel
2026-11-18 18:33 ` [PATCH 1/2] raid6: neon: process four data disks per Horner step Ard Biesheuvel
2026-11-19 22:44 ` Eric Biggers [this message]
2026-11-18 18:33 ` [PATCH 2/2] raid6: arm64: use the EOR3 instruction where available Ard Biesheuvel
2026-11-19 22:35 ` Eric Biggers
2026-11-19 22:50 ` [PATCH 0/2] raid6/arm64: Use aggregation and 3-way XOR Eric Biggers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261119224418.GC1894@quark \
--to=ebiggers@kernel.org \
--cc=ardb+git@google.com \
--cc=ardb@kernel.org \
--cc=demyansh@gmail.com \
--cc=hch@lst.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox