Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1230272
| From | Christophe Leroy <christophe.leroy@c-s.fr> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 7/9] powerpc32: optimise csum_partial() loop |
| Date | 2015-09-22 16:40 +0200 |
| Message-ID | <qbwTE-86z-15@gated-at.bofh.it> (permalink) |
| References | <qbwTD-86z-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On the 8xx, load latency is 2 cycles and taking branches also takes 2 cycles. So let's unroll the loop. This patch improves csum_partial() speed by around 10% on both: * 8xx (single issue processor with parallele execution) * 83xx (superscalar 6xx processor with dual instruction fetch and parallele execution) Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> --- arch/powerpc/lib/checksum_32.S | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/lib/checksum_32.S b/arch/powerpc/lib/checksum_32.S index 9c12602..0d34f47 100644 --- a/arch/powerpc/lib/checksum_32.S +++ b/arch/powerpc/lib/checksum_32.S @@ -38,10 +38,24 @@ _GLOBAL(csum_partial) srwi. r6,r4,2 /* # words to do */ adde r5,r5,r0 beq 3f -1: mtctr r6 +1: andi. r6,r6,3 /* Prepare to handle words 4 by 4 */ + beq 21f + mtctr r6 2: lwzu r0,4(r3) adde r5,r5,r0 bdnz 2b +21: srwi. r6,r4,4 /* # blocks of 4 words to do */ + beq 3f + mtctr r6 +22: lwz r0,4(r3) + lwz r6,8(r3) + lwz r7,12(r3) + lwzu r8,16(r3) + adde r5,r5,r0 + adde r5,r5,r6 + adde r5,r5,r7 + adde r5,r5,r8 + bdnz 22b 3: andi. r0,r4,2 beq+ 4f lhz r0,4(r3) -- 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