License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-2.6-block.git] / arch / metag / lib / ip_fast_csum.S
1 /* SPDX-License-Identifier: GPL-2.0 */
2
3         .text
4 /*
5  * This is a version of ip_compute_csum() optimized for IP headers,
6  * which always checksum on 4 octet boundaries.
7  *
8  * extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
9  *
10  */
11         .global _ip_fast_csum
12         .type   _ip_fast_csum,function
13 _ip_fast_csum:
14         !! TXRPT needs loops - 1
15         SUBS    TXRPT,D0Ar2,#1
16         MOV     D0Re0,#0
17         BLO     $Lfast_csum_exit
18 $Lfast_csum_loop:
19         GETD    D1Ar3,[D1Ar1++]
20         ADDS    D0Re0,D0Re0,D1Ar3
21         ADDCS   D0Re0,D0Re0,#1
22         BR      $Lfast_csum_loop
23         LSR     D0Ar4,D0Re0,#16
24         AND     D0Re0,D0Re0,#0xffff
25         AND     D0Ar4,D0Ar4,#0xffff
26         ADD     D0Re0,D0Re0,D0Ar4
27         LSR     D0Ar4,D0Re0,#16
28         ADD     D0Re0,D0Re0,D0Ar4
29         XOR     D0Re0,D0Re0,#-1
30         AND     D0Re0,D0Re0,#0xffff
31 $Lfast_csum_exit:
32         MOV     PC,D1RtP
33         .size _ip_fast_csum,.-_ip_fast_csum