2 * arch/alpha/lib/csum_ipv6_magic.S
3 * Contributed by Richard Henderson <rth@tamu.edu>
5 * unsigned short csum_ipv6_magic(struct in6_addr *saddr,
6 * struct in6_addr *daddr,
8 * unsigned short proto,
12 .globl csum_ipv6_magic
19 ldq $0,0($16) # e0 : load src & dst addr words
20 zapnot $20,15,$20 # .. e1 : zero extend incoming csum
21 extqh $18,1,$4 # e0 : byte swap len & proto while we wait
22 ldq $1,8($16) # .. e1 :
25 ldq $2,0($17) # .. e1 :
27 ldq $3,8($17) # .. e1 :
29 extbl $18,3,$18 # e0 :
32 addq $20,$0,$20 # .. e1 : begin summing the words
35 cmpult $20,$0,$0 # .. e1 :
37 or $4,$18,$18 # .. e1 :
39 extbl $19,1,$19 # e0 :
41 or $18,$5,$18 # e0 : len complete
42 or $19,$7,$19 # .. e1 :
45 addq $20,$1,$20 # .. e1 :
46 sra $19,32,$19 # e0 : proto complete
47 cmpult $20,$1,$1 # .. e1 :
50 addq $20,$2,$20 # .. e1 :
51 cmpult $20,$2,$2 # e0 :
52 addq $20,$3,$20 # .. e1 :
54 cmpult $20,$3,$3 # e0 :
55 addq $20,$18,$20 # .. e1 :
56 cmpult $20,$18,$18 # e0 :
57 addq $20,$19,$20 # .. e1 :
59 cmpult $20,$19,$19 # e0 :
60 addq $0,$1,$0 # .. e1 : merge the carries back into the csum
62 addq $18,$19,$18 # .. e1 :
65 addq $20,$18,$20 # .. e1 :
69 extwl $0,2,$2 # e0 : begin folding the 64-bit value
70 zapnot $0,3,$3 # .. e1 :
72 addq $2,$3,$3 # .. e1 :
75 addq $3,$1,$3 # .. e1 :
79 extwl $0,2,$1 # e0 : fold 18-bit value
80 zapnot $0,3,$0 # .. e1 :
84 extwl $0,2,$1 # e0 : fold 17-bit value
85 zapnot $0,3,$0 # .. e1 :
87 not $0,$0 # e1 : and complement.