[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180523183447.GV17342@gate.crashing.org>
Date: Wed, 23 May 2018 13:34:47 -0500
From: Segher Boessenkool <segher@...nel.crashing.org>
To: Christophe Leroy <christophe.leroy@....fr>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
netdev@...r.kernel.org
Subject: Re: [PATCH v3] powerpc: Implement csum_ipv6_magic in assembly
On Tue, May 22, 2018 at 08:57:01AM +0200, Christophe Leroy wrote:
> The generic csum_ipv6_magic() generates a pretty bad result
<snip>
Please try with a more recent compiler, what you used is pretty ancient.
It's not like recent compilers do great on this either, but it's not
*that* bad anymore ;-)
> --- a/arch/powerpc/lib/checksum_32.S
> +++ b/arch/powerpc/lib/checksum_32.S
> @@ -293,3 +293,36 @@ dst_error:
> EX_TABLE(51b, dst_error);
>
> EXPORT_SYMBOL(csum_partial_copy_generic)
> +
> +/*
> + * static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
> + * const struct in6_addr *daddr,
> + * __u32 len, __u8 proto, __wsum sum)
> + */
> +
> +_GLOBAL(csum_ipv6_magic)
> + lwz r8, 0(r3)
> + lwz r9, 4(r3)
> + lwz r10, 8(r3)
> + lwz r11, 12(r3)
> + addc r0, r5, r6
> + adde r0, r0, r7
> + adde r0, r0, r8
> + adde r0, r0, r9
> + adde r0, r0, r10
> + adde r0, r0, r11
> + lwz r8, 0(r4)
> + lwz r9, 4(r4)
> + lwz r10, 8(r4)
> + lwz r11, 12(r4)
> + adde r0, r0, r8
> + adde r0, r0, r9
> + adde r0, r0, r10
> + adde r0, r0, r11
> + addze r0, r0
> + rotlwi r3, r0, 16
> + add r3, r0, r3
> + not r3, r3
> + rlwinm r3, r3, 16, 16, 31
> + blr
> +EXPORT_SYMBOL(csum_ipv6_magic)
Clustering the loads and carry insns together is pretty much the worst you
can do on most 32-bit CPUs.
Segher
Powered by blists - more mailing lists