aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lib
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2008-10-11 11:18:53 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-10-11 11:18:53 -0400
commitb65a75b8c91c0f05047399401407371678fe9549 (patch)
tree39dfe83769129ee72e7f0028bb80f417d19b21bb /arch/mips/lib
parent60724ca59eda766a30be57aec6b49bc3e2bead91 (diff)
MIPS: IP checksums: Optimize adjust of sum on buffers of odd alignment.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/lib')
-rw-r--r--arch/mips/lib/csum_partial.S35
1 files changed, 24 insertions, 11 deletions
diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S
index 84d5e6a1e76f..6b876ca299ee 100644
--- a/arch/mips/lib/csum_partial.S
+++ b/arch/mips/lib/csum_partial.S
@@ -270,13 +270,20 @@ LEAF(csum_partial)
270#endif 270#endif
271 271
272 /* odd buffer alignment? */ 272 /* odd buffer alignment? */
273 beqz t7, 1f 273#ifdef CPU_MIPSR2
274 nop 274 wsbh v1, sum
275 sll v1, sum, 8 275 movn sum, v1, t7
276#else
277 beqz t7, 1f /* odd buffer alignment? */
278 lui v1, 0x00ff
279 addu v1, 0x00ff
280 and t0, sum, v1
281 sll t0, t0, 8
276 srl sum, sum, 8 282 srl sum, sum, 8
277 or sum, v1 283 and sum, sum, v1
278 andi sum, 0xffff 284 or sum, sum, t0
2791: 2851:
286#endif
280 .set reorder 287 .set reorder
281 /* Add the passed partial csum. */ 288 /* Add the passed partial csum. */
282 ADDC32(sum, a2) 289 ADDC32(sum, a2)
@@ -663,14 +670,20 @@ EXC( sb t0, NBYTES-2(dst), .Ls_exc)
663 addu sum, v1 670 addu sum, v1
664#endif 671#endif
665 672
666 /* odd buffer alignment? */ 673#ifdef CPU_MIPSR2
667 beqz odd, 1f 674 wsbh v1, sum
668 nop 675 movn sum, v1, odd
669 sll v1, sum, 8 676#else
677 beqz odd, 1f /* odd buffer alignment? */
678 lui v1, 0x00ff
679 addu v1, 0x00ff
680 and t0, sum, v1
681 sll t0, t0, 8
670 srl sum, sum, 8 682 srl sum, sum, 8
671 or sum, v1 683 and sum, sum, v1
672 andi sum, 0xffff 684 or sum, sum, t0
6731: 6851:
686#endif
674 .set reorder 687 .set reorder
675 ADDC32(sum, psum) 688 ADDC32(sum, psum)
676 jr ra 689 jr ra