Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1230285
| From | Christophe Leroy <christophe.leroy@c-s.fr> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 8/9] powerpc: simplify csum_add(a, b) in case a or b is constant 0 |
| Date | 2015-09-22 16:40 +0200 |
| Message-ID | <qbwTF-86z-51@gated-at.bofh.it> (permalink) |
| References | <qbwTD-86z-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Simplify csum_add(a, b) in case a or b is constant 0
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
arch/powerpc/include/asm/checksum.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/powerpc/include/asm/checksum.h b/arch/powerpc/include/asm/checksum.h
index 56deea8..f8a9704 100644
--- a/arch/powerpc/include/asm/checksum.h
+++ b/arch/powerpc/include/asm/checksum.h
@@ -119,7 +119,13 @@ static inline __wsum csum_add(__wsum csum, __wsum addend)
{
#ifdef __powerpc64__
u64 res = (__force u64)csum;
+#endif
+ if (__builtin_constant_p(csum) && csum == 0)
+ return addend;
+ if (__builtin_constant_p(addend) && addend == 0)
+ return csum;
+#ifdef __powerpc64__
res += (__force u64)addend;
return (__force __wsum)((u32)res + (res >> 32));
#else
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/9] powerpc32: set of optimisation of network checksum functions Christophe Leroy <christophe.leroy@c-s.fr> - 2015-09-22 16:40 +0200 [PATCH 7/9] powerpc32: optimise csum_partial() loop Christophe Leroy <christophe.leroy@c-s.fr> - 2015-09-22 16:40 +0200 [PATCH 1/9] powerpc: unexport csum_tcpudp_magic Christophe Leroy <christophe.leroy@c-s.fr> - 2015-09-22 16:40 +0200 [PATCH 6/9] powerpc32: optimise a few instructions in csum_partial() Christophe Leroy <christophe.leroy@c-s.fr> - 2015-09-22 16:40 +0200 [PATCH 9/9] powerpc: optimise csum_partial() call when len is constant Christophe Leroy <christophe.leroy@c-s.fr> - 2015-09-22 16:40 +0200 [PATCH 3/9] powerpc32: checksum_wrappers_64 becomes checksum_wrappers Christophe Leroy <christophe.leroy@c-s.fr> - 2015-09-22 16:40 +0200 [PATCH 5/9] powerpc32: rewrite csum_partial_copy_generic() based on copy_tofrom_user() Christophe Leroy <christophe.leroy@c-s.fr> - 2015-09-22 16:40 +0200 [PATCH 8/9] powerpc: simplify csum_add(a, b) in case a or b is constant 0 Christophe Leroy <christophe.leroy@c-s.fr> - 2015-09-22 16:40 +0200 Re: [PATCH 0/9] powerpc32: set of optimisation of network checksum functions David Miller <davem@davemloft.net> - 2015-09-24 00:40 +0200
csiph-web