diff options
Diffstat (limited to 'arch/ia64/lib/ip_fast_csum.S')
-rw-r--r-- | arch/ia64/lib/ip_fast_csum.S | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/arch/ia64/lib/ip_fast_csum.S b/arch/ia64/lib/ip_fast_csum.S index 19674ca2acfc..1f86aeb2c948 100644 --- a/arch/ia64/lib/ip_fast_csum.S +++ b/arch/ia64/lib/ip_fast_csum.S | |||
@@ -8,8 +8,8 @@ | |||
8 | * in0: address of buffer to checksum (char *) | 8 | * in0: address of buffer to checksum (char *) |
9 | * in1: length of the buffer (int) | 9 | * in1: length of the buffer (int) |
10 | * | 10 | * |
11 | * Copyright (C) 2002 Intel Corp. | 11 | * Copyright (C) 2002, 2006 Intel Corp. |
12 | * Copyright (C) 2002 Ken Chen <kenneth.w.chen@intel.com> | 12 | * Copyright (C) 2002, 2006 Ken Chen <kenneth.w.chen@intel.com> |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <asm/asmmacro.h> | 15 | #include <asm/asmmacro.h> |
@@ -25,6 +25,9 @@ | |||
25 | 25 | ||
26 | #define in0 r32 | 26 | #define in0 r32 |
27 | #define in1 r33 | 27 | #define in1 r33 |
28 | #define in2 r34 | ||
29 | #define in3 r35 | ||
30 | #define in4 r36 | ||
28 | #define ret0 r8 | 31 | #define ret0 r8 |
29 | 32 | ||
30 | GLOBAL_ENTRY(ip_fast_csum) | 33 | GLOBAL_ENTRY(ip_fast_csum) |
@@ -65,8 +68,9 @@ GLOBAL_ENTRY(ip_fast_csum) | |||
65 | zxt2 r20=r20 | 68 | zxt2 r20=r20 |
66 | ;; | 69 | ;; |
67 | add r20=ret0,r20 | 70 | add r20=ret0,r20 |
71 | mov r9=0xffff | ||
68 | ;; | 72 | ;; |
69 | andcm ret0=-1,r20 | 73 | andcm ret0=r9,r20 |
70 | .restore sp // reset frame state | 74 | .restore sp // reset frame state |
71 | br.ret.sptk.many b0 | 75 | br.ret.sptk.many b0 |
72 | ;; | 76 | ;; |
@@ -88,3 +92,51 @@ GLOBAL_ENTRY(ip_fast_csum) | |||
88 | mov b0=r34 | 92 | mov b0=r34 |
89 | br.ret.sptk.many b0 | 93 | br.ret.sptk.many b0 |
90 | END(ip_fast_csum) | 94 | END(ip_fast_csum) |
95 | |||
96 | GLOBAL_ENTRY(csum_ipv6_magic) | ||
97 | ld4 r20=[in0],4 | ||
98 | ld4 r21=[in1],4 | ||
99 | dep r15=in3,in2,32,16 | ||
100 | ;; | ||
101 | ld4 r22=[in0],4 | ||
102 | ld4 r23=[in1],4 | ||
103 | mux1 r15=r15,@rev | ||
104 | ;; | ||
105 | ld4 r24=[in0],4 | ||
106 | ld4 r25=[in1],4 | ||
107 | shr.u r15=r15,16 | ||
108 | add r16=r20,r21 | ||
109 | add r17=r22,r23 | ||
110 | ;; | ||
111 | ld4 r26=[in0],4 | ||
112 | ld4 r27=[in1],4 | ||
113 | add r18=r24,r25 | ||
114 | add r8=r16,r17 | ||
115 | ;; | ||
116 | add r19=r26,r27 | ||
117 | add r8=r8,r18 | ||
118 | ;; | ||
119 | add r8=r8,r19 | ||
120 | add r15=r15,in4 | ||
121 | ;; | ||
122 | add r8=r8,r15 | ||
123 | ;; | ||
124 | shr.u r10=r8,32 // now fold sum into short | ||
125 | zxt4 r11=r8 | ||
126 | ;; | ||
127 | add r8=r10,r11 | ||
128 | ;; | ||
129 | shr.u r10=r8,16 // yeah, keep it rolling | ||
130 | zxt2 r11=r8 | ||
131 | ;; | ||
132 | add r8=r10,r11 | ||
133 | ;; | ||
134 | shr.u r10=r8,16 // three times lucky | ||
135 | zxt2 r11=r8 | ||
136 | ;; | ||
137 | add r8=r10,r11 | ||
138 | mov r9=0xffff | ||
139 | ;; | ||
140 | andcm r8=r9,r8 | ||
141 | br.ret.sptk.many b0 | ||
142 | END(csum_ipv6_magic) | ||