2 * Author......: Jens Steube <jens.steube@gmail.com>
6 static u32
generate_cmask (u32 buf
)
8 const u32 rmask
= ((buf
& 0x40404040) >> 1)
9 & ~((buf
& 0x80808080) >> 2);
11 const u32 hmask
= (buf
& 0x1f1f1f1f) + 0x05050505;
12 const u32 lmask
= (buf
& 0x1f1f1f1f) + 0x1f1f1f1f;
14 return rmask
& ~hmask
& lmask
;
17 static void truncate_right (u32 w0
[4], u32 w1
[4], const u32 len
)
19 const u32 tmp
= (1 << ((len
% 4) * 8)) - 1;
70 static void truncate_left (u32 w0
[4], u32 w1
[4], const u32 len
)
72 const u32 tmp
= ~((1 << ((len
% 4) * 8)) - 1);
123 static void lshift_block (const u32 in0
[4], const u32 in1
[4], u32 out0
[4], u32 out1
[4])
126 out0
[0] = __byte_perm (in0
[0], in0
[1], 0x4321);
127 out0
[1] = __byte_perm (in0
[1], in0
[2], 0x4321);
128 out0
[2] = __byte_perm (in0
[2], in0
[3], 0x4321);
129 out0
[3] = __byte_perm (in0
[3], in1
[0], 0x4321);
130 out1
[0] = __byte_perm (in1
[0], in1
[1], 0x4321);
131 out1
[1] = __byte_perm (in1
[1], in1
[2], 0x4321);
132 out1
[2] = __byte_perm (in1
[2], in1
[3], 0x4321);
133 out1
[3] = __byte_perm (in1
[3], 0, 0x4321);
136 #if defined IS_AMD || defined IS_GENERIC
137 out0
[0] = amd_bytealign (in0
[1], in0
[0], 1);
138 out0
[1] = amd_bytealign (in0
[2], in0
[1], 1);
139 out0
[2] = amd_bytealign (in0
[3], in0
[2], 1);
140 out0
[3] = amd_bytealign (in1
[0], in0
[3], 1);
141 out1
[0] = amd_bytealign (in1
[1], in1
[0], 1);
142 out1
[1] = amd_bytealign (in1
[2], in1
[1], 1);
143 out1
[2] = amd_bytealign (in1
[3], in1
[2], 1);
144 out1
[3] = amd_bytealign ( 0, in1
[3], 1);
148 static void rshift_block (const u32 in0
[4], const u32 in1
[4], u32 out0
[4], u32 out1
[4])
151 out1
[3] = __byte_perm (in1
[2], in1
[3], 0x6543);
152 out1
[2] = __byte_perm (in1
[1], in1
[2], 0x6543);
153 out1
[1] = __byte_perm (in1
[0], in1
[1], 0x6543);
154 out1
[0] = __byte_perm (in0
[3], in1
[0], 0x6543);
155 out0
[3] = __byte_perm (in0
[2], in0
[3], 0x6543);
156 out0
[2] = __byte_perm (in0
[1], in0
[2], 0x6543);
157 out0
[1] = __byte_perm (in0
[0], in0
[1], 0x6543);
158 out0
[0] = __byte_perm ( 0, in0
[0], 0x6543);
161 #if defined IS_AMD || defined IS_GENERIC
162 out1
[3] = amd_bytealign (in1
[3], in1
[2], 3);
163 out1
[2] = amd_bytealign (in1
[2], in1
[1], 3);
164 out1
[1] = amd_bytealign (in1
[1], in1
[0], 3);
165 out1
[0] = amd_bytealign (in1
[0], in0
[3], 3);
166 out0
[3] = amd_bytealign (in0
[3], in0
[2], 3);
167 out0
[2] = amd_bytealign (in0
[2], in0
[1], 3);
168 out0
[1] = amd_bytealign (in0
[1], in0
[0], 3);
169 out0
[0] = amd_bytealign (in0
[0], 0, 3);
173 static void lshift_block_N (const u32 in0
[4], const u32 in1
[4], u32 out0
[4], u32 out1
[4], const u32 num
)
178 case 0: out1
[3] = in1
[3];
187 case 1: out1
[3] = __byte_perm (in1
[2], in1
[3], 0x6543);
188 out1
[2] = __byte_perm (in1
[1], in1
[2], 0x6543);
189 out1
[1] = __byte_perm (in1
[0], in1
[1], 0x6543);
190 out1
[0] = __byte_perm (in0
[3], in1
[0], 0x6543);
191 out0
[3] = __byte_perm (in0
[2], in0
[3], 0x6543);
192 out0
[2] = __byte_perm (in0
[1], in0
[2], 0x6543);
193 out0
[1] = __byte_perm (in0
[0], in0
[1], 0x6543);
194 out0
[0] = __byte_perm ( 0, in0
[0], 0x6543);
196 case 2: out1
[3] = __byte_perm (in1
[2], in1
[3], 0x5432);
197 out1
[2] = __byte_perm (in1
[1], in1
[2], 0x5432);
198 out1
[1] = __byte_perm (in1
[0], in1
[1], 0x5432);
199 out1
[0] = __byte_perm (in0
[3], in1
[0], 0x5432);
200 out0
[3] = __byte_perm (in0
[2], in0
[3], 0x5432);
201 out0
[2] = __byte_perm (in0
[1], in0
[2], 0x5432);
202 out0
[1] = __byte_perm (in0
[0], in0
[1], 0x5432);
203 out0
[0] = __byte_perm ( 0, in0
[0], 0x5432);
205 case 3: out1
[3] = __byte_perm (in1
[2], in1
[3], 0x4321);
206 out1
[2] = __byte_perm (in1
[1], in1
[2], 0x4321);
207 out1
[1] = __byte_perm (in1
[0], in1
[1], 0x4321);
208 out1
[0] = __byte_perm (in0
[3], in1
[0], 0x4321);
209 out0
[3] = __byte_perm (in0
[2], in0
[3], 0x4321);
210 out0
[2] = __byte_perm (in0
[1], in0
[2], 0x4321);
211 out0
[1] = __byte_perm (in0
[0], in0
[1], 0x4321);
212 out0
[0] = __byte_perm ( 0, in0
[0], 0x4321);
214 case 4: out1
[3] = in1
[2];
223 case 5: out1
[3] = __byte_perm (in1
[1], in1
[2], 0x6543);
224 out1
[2] = __byte_perm (in1
[0], in1
[1], 0x6543);
225 out1
[1] = __byte_perm (in0
[3], in1
[0], 0x6543);
226 out1
[0] = __byte_perm (in0
[2], in0
[3], 0x6543);
227 out0
[3] = __byte_perm (in0
[1], in0
[2], 0x6543);
228 out0
[2] = __byte_perm (in0
[0], in0
[1], 0x6543);
229 out0
[1] = __byte_perm ( 0, in0
[0], 0x6543);
232 case 6: out1
[3] = __byte_perm (in1
[1], in1
[2], 0x5432);
233 out1
[2] = __byte_perm (in1
[0], in1
[1], 0x5432);
234 out1
[1] = __byte_perm (in0
[3], in1
[0], 0x5432);
235 out1
[0] = __byte_perm (in0
[2], in0
[3], 0x5432);
236 out0
[3] = __byte_perm (in0
[1], in0
[2], 0x5432);
237 out0
[2] = __byte_perm (in0
[0], in0
[1], 0x5432);
238 out0
[1] = __byte_perm ( 0, in0
[0], 0x5432);
241 case 7: out1
[3] = __byte_perm (in1
[1], in1
[2], 0x4321);
242 out1
[2] = __byte_perm (in1
[0], in1
[1], 0x4321);
243 out1
[1] = __byte_perm (in0
[3], in1
[0], 0x4321);
244 out1
[0] = __byte_perm (in0
[2], in0
[3], 0x4321);
245 out0
[3] = __byte_perm (in0
[1], in0
[2], 0x4321);
246 out0
[2] = __byte_perm (in0
[0], in0
[1], 0x4321);
247 out0
[1] = __byte_perm ( 0, in0
[0], 0x4321);
250 case 8: out1
[3] = in1
[1];
259 case 9: out1
[3] = __byte_perm (in1
[0], in1
[1], 0x6543);
260 out1
[2] = __byte_perm (in0
[3], in1
[0], 0x6543);
261 out1
[1] = __byte_perm (in0
[2], in0
[3], 0x6543);
262 out1
[0] = __byte_perm (in0
[1], in0
[2], 0x6543);
263 out0
[3] = __byte_perm (in0
[0], in0
[1], 0x6543);
264 out0
[2] = __byte_perm ( 0, in0
[0], 0x6543);
268 case 10: out1
[3] = __byte_perm (in1
[0], in1
[1], 0x5432);
269 out1
[2] = __byte_perm (in0
[3], in1
[0], 0x5432);
270 out1
[1] = __byte_perm (in0
[2], in0
[3], 0x5432);
271 out1
[0] = __byte_perm (in0
[1], in0
[2], 0x5432);
272 out0
[3] = __byte_perm (in0
[0], in0
[1], 0x5432);
273 out0
[2] = __byte_perm ( 0, in0
[0], 0x5432);
277 case 11: out1
[3] = __byte_perm (in1
[0], in1
[1], 0x4321);
278 out1
[2] = __byte_perm (in0
[3], in1
[0], 0x4321);
279 out1
[1] = __byte_perm (in0
[2], in0
[3], 0x4321);
280 out1
[0] = __byte_perm (in0
[1], in0
[2], 0x4321);
281 out0
[3] = __byte_perm (in0
[0], in0
[1], 0x4321);
282 out0
[2] = __byte_perm ( 0, in0
[0], 0x4321);
286 case 12: out1
[3] = in1
[0];
295 case 13: out1
[3] = __byte_perm (in0
[3], in1
[0], 0x6543);
296 out1
[2] = __byte_perm (in0
[2], in0
[3], 0x6543);
297 out1
[1] = __byte_perm (in0
[1], in0
[2], 0x6543);
298 out1
[0] = __byte_perm (in0
[0], in0
[1], 0x6543);
299 out0
[3] = __byte_perm ( 0, in0
[0], 0x6543);
304 case 14: out1
[3] = __byte_perm (in0
[3], in1
[0], 0x5432);
305 out1
[2] = __byte_perm (in0
[2], in0
[3], 0x5432);
306 out1
[1] = __byte_perm (in0
[1], in0
[2], 0x5432);
307 out1
[0] = __byte_perm (in0
[0], in0
[1], 0x5432);
308 out0
[3] = __byte_perm ( 0, in0
[0], 0x5432);
313 case 15: out1
[3] = __byte_perm (in0
[3], in1
[0], 0x4321);
314 out1
[2] = __byte_perm (in0
[2], in0
[3], 0x4321);
315 out1
[1] = __byte_perm (in0
[1], in0
[2], 0x4321);
316 out1
[0] = __byte_perm (in0
[0], in0
[1], 0x4321);
317 out0
[3] = __byte_perm ( 0, in0
[0], 0x4321);
322 case 16: out1
[3] = in0
[3];
331 case 17: out1
[3] = __byte_perm (in0
[2], in0
[3], 0x6543);
332 out1
[2] = __byte_perm (in0
[1], in0
[2], 0x6543);
333 out1
[1] = __byte_perm (in0
[0], in0
[1], 0x6543);
334 out1
[0] = __byte_perm ( 0, in0
[0], 0x6543);
340 case 18: out1
[3] = __byte_perm (in0
[2], in0
[3], 0x5432);
341 out1
[2] = __byte_perm (in0
[1], in0
[2], 0x5432);
342 out1
[1] = __byte_perm (in0
[0], in0
[1], 0x5432);
343 out1
[0] = __byte_perm ( 0, in0
[0], 0x5432);
349 case 19: out1
[3] = __byte_perm (in0
[2], in0
[3], 0x4321);
350 out1
[2] = __byte_perm (in0
[1], in0
[2], 0x4321);
351 out1
[1] = __byte_perm (in0
[0], in0
[1], 0x4321);
352 out1
[0] = __byte_perm ( 0, in0
[0], 0x4321);
358 case 20: out1
[3] = in0
[2];
367 case 21: out1
[3] = __byte_perm (in0
[1], in0
[2], 0x6543);
368 out1
[2] = __byte_perm (in0
[0], in0
[1], 0x6543);
369 out1
[1] = __byte_perm ( 0, in0
[0], 0x6543);
376 case 22: out1
[3] = __byte_perm (in0
[1], in0
[2], 0x5432);
377 out1
[2] = __byte_perm (in0
[0], in0
[1], 0x5432);
378 out1
[1] = __byte_perm ( 0, in0
[0], 0x5432);
385 case 23: out1
[3] = __byte_perm (in0
[1], in0
[2], 0x4321);
386 out1
[2] = __byte_perm (in0
[0], in0
[1], 0x4321);
387 out1
[1] = __byte_perm ( 0, in0
[0], 0x4321);
394 case 24: out1
[3] = in0
[1];
403 case 25: out1
[3] = __byte_perm (in0
[0], in0
[1], 0x6543);
404 out1
[2] = __byte_perm ( 0, in0
[0], 0x6543);
412 case 26: out1
[3] = __byte_perm (in0
[0], in0
[1], 0x5432);
413 out1
[2] = __byte_perm ( 0, in0
[0], 0x5432);
421 case 27: out1
[3] = __byte_perm (in0
[0], in0
[1], 0x4321);
422 out1
[2] = __byte_perm ( 0, in0
[0], 0x4321);
430 case 28: out1
[3] = in0
[0];
439 case 29: out1
[3] = __byte_perm ( 0, in0
[0], 0x6543);
448 case 30: out1
[3] = __byte_perm ( 0, in0
[0], 0x5432);
457 case 31: out1
[3] = __byte_perm ( 0, in0
[0], 0x4321);
469 #if defined IS_AMD || defined IS_GENERIC
472 case 0: out0
[0] = in0
[0];
481 case 1: out0
[0] = amd_bytealign (in0
[1], in0
[0], 1);
482 out0
[1] = amd_bytealign (in0
[2], in0
[1], 1);
483 out0
[2] = amd_bytealign (in0
[3], in0
[2], 1);
484 out0
[3] = amd_bytealign (in1
[0], in0
[3], 1);
485 out1
[0] = amd_bytealign (in1
[1], in1
[0], 1);
486 out1
[1] = amd_bytealign (in1
[2], in1
[1], 1);
487 out1
[2] = amd_bytealign (in1
[3], in1
[2], 1);
488 out1
[3] = amd_bytealign ( 0, in1
[3], 1);
490 case 2: out0
[0] = amd_bytealign (in0
[1], in0
[0], 2);
491 out0
[1] = amd_bytealign (in0
[2], in0
[1], 2);
492 out0
[2] = amd_bytealign (in0
[3], in0
[2], 2);
493 out0
[3] = amd_bytealign (in1
[0], in0
[3], 2);
494 out1
[0] = amd_bytealign (in1
[1], in1
[0], 2);
495 out1
[1] = amd_bytealign (in1
[2], in1
[1], 2);
496 out1
[2] = amd_bytealign (in1
[3], in1
[2], 2);
497 out1
[3] = amd_bytealign ( 0, in1
[3], 2);
499 case 3: out0
[0] = amd_bytealign (in0
[1], in0
[0], 3);
500 out0
[1] = amd_bytealign (in0
[2], in0
[1], 3);
501 out0
[2] = amd_bytealign (in0
[3], in0
[2], 3);
502 out0
[3] = amd_bytealign (in1
[0], in0
[3], 3);
503 out1
[0] = amd_bytealign (in1
[1], in1
[0], 3);
504 out1
[1] = amd_bytealign (in1
[2], in1
[1], 3);
505 out1
[2] = amd_bytealign (in1
[3], in1
[2], 3);
506 out1
[3] = amd_bytealign ( 0, in1
[3], 3);
508 case 4: out0
[0] = in0
[1];
517 case 5: out0
[0] = amd_bytealign (in0
[2], in0
[1], 1);
518 out0
[1] = amd_bytealign (in0
[3], in0
[2], 1);
519 out0
[2] = amd_bytealign (in1
[0], in0
[3], 1);
520 out0
[3] = amd_bytealign (in1
[1], in1
[0], 1);
521 out1
[0] = amd_bytealign (in1
[2], in1
[1], 1);
522 out1
[1] = amd_bytealign (in1
[3], in1
[2], 1);
523 out1
[2] = amd_bytealign ( 0, in1
[3], 1);
526 case 6: out0
[0] = amd_bytealign (in0
[2], in0
[1], 2);
527 out0
[1] = amd_bytealign (in0
[3], in0
[2], 2);
528 out0
[2] = amd_bytealign (in1
[0], in0
[3], 2);
529 out0
[3] = amd_bytealign (in1
[1], in1
[0], 2);
530 out1
[0] = amd_bytealign (in1
[2], in1
[1], 2);
531 out1
[1] = amd_bytealign (in1
[3], in1
[2], 2);
532 out1
[2] = amd_bytealign ( 0, in1
[3], 2);
535 case 7: out0
[0] = amd_bytealign (in0
[2], in0
[1], 3);
536 out0
[1] = amd_bytealign (in0
[3], in0
[2], 3);
537 out0
[2] = amd_bytealign (in1
[0], in0
[3], 3);
538 out0
[3] = amd_bytealign (in1
[1], in1
[0], 3);
539 out1
[0] = amd_bytealign (in1
[2], in1
[1], 3);
540 out1
[1] = amd_bytealign (in1
[3], in1
[2], 3);
541 out1
[2] = amd_bytealign ( 0, in1
[3], 3);
544 case 8: out0
[0] = in0
[2];
553 case 9: out0
[0] = amd_bytealign (in0
[3], in0
[2], 1);
554 out0
[1] = amd_bytealign (in1
[0], in0
[3], 1);
555 out0
[2] = amd_bytealign (in1
[1], in1
[0], 1);
556 out0
[3] = amd_bytealign (in1
[2], in1
[1], 1);
557 out1
[0] = amd_bytealign (in1
[3], in1
[2], 1);
558 out1
[1] = amd_bytealign ( 0, in1
[3], 1);
562 case 10: out0
[0] = amd_bytealign (in0
[3], in0
[2], 2);
563 out0
[1] = amd_bytealign (in1
[0], in0
[3], 2);
564 out0
[2] = amd_bytealign (in1
[1], in1
[0], 2);
565 out0
[3] = amd_bytealign (in1
[2], in1
[1], 2);
566 out1
[0] = amd_bytealign (in1
[3], in1
[2], 2);
567 out1
[1] = amd_bytealign ( 0, in1
[3], 2);
571 case 11: out0
[0] = amd_bytealign (in0
[3], in0
[2], 3);
572 out0
[1] = amd_bytealign (in1
[0], in0
[3], 3);
573 out0
[2] = amd_bytealign (in1
[1], in1
[0], 3);
574 out0
[3] = amd_bytealign (in1
[2], in1
[1], 3);
575 out1
[0] = amd_bytealign (in1
[3], in1
[2], 3);
576 out1
[1] = amd_bytealign ( 0, in1
[3], 3);
580 case 12: out0
[0] = in0
[3];
589 case 13: out0
[0] = amd_bytealign (in1
[0], in0
[3], 1);
590 out0
[1] = amd_bytealign (in1
[1], in1
[0], 1);
591 out0
[2] = amd_bytealign (in1
[2], in1
[1], 1);
592 out0
[3] = amd_bytealign (in1
[3], in1
[2], 1);
593 out1
[0] = amd_bytealign ( 0, in1
[3], 1);
598 case 14: out0
[0] = amd_bytealign (in1
[0], in0
[3], 2);
599 out0
[1] = amd_bytealign (in1
[1], in1
[0], 2);
600 out0
[2] = amd_bytealign (in1
[2], in1
[1], 2);
601 out0
[3] = amd_bytealign (in1
[3], in1
[2], 2);
602 out1
[0] = amd_bytealign ( 0, in1
[3], 2);
607 case 15: out0
[0] = amd_bytealign (in1
[0], in0
[3], 3);
608 out0
[1] = amd_bytealign (in1
[1], in1
[0], 3);
609 out0
[2] = amd_bytealign (in1
[2], in1
[1], 3);
610 out0
[3] = amd_bytealign (in1
[3], in1
[2], 3);
611 out1
[0] = amd_bytealign ( 0, in1
[3], 3);
616 case 16: out0
[0] = in1
[0];
625 case 17: out0
[0] = amd_bytealign (in1
[1], in1
[0], 1);
626 out0
[1] = amd_bytealign (in1
[2], in1
[1], 1);
627 out0
[2] = amd_bytealign (in1
[3], in1
[2], 1);
628 out0
[3] = amd_bytealign ( 0, in1
[3], 1);
634 case 18: out0
[0] = amd_bytealign (in1
[1], in1
[0], 2);
635 out0
[1] = amd_bytealign (in1
[2], in1
[1], 2);
636 out0
[2] = amd_bytealign (in1
[3], in1
[2], 2);
637 out0
[3] = amd_bytealign ( 0, in1
[3], 2);
643 case 19: out0
[0] = amd_bytealign (in1
[1], in1
[0], 3);
644 out0
[1] = amd_bytealign (in1
[2], in1
[1], 3);
645 out0
[2] = amd_bytealign (in1
[3], in1
[2], 3);
646 out0
[3] = amd_bytealign ( 0, in1
[3], 3);
652 case 20: out0
[0] = in1
[1];
661 case 21: out0
[0] = amd_bytealign (in1
[2], in1
[1], 1);
662 out0
[1] = amd_bytealign (in1
[3], in1
[2], 1);
663 out0
[2] = amd_bytealign ( 0, in1
[3], 1);
670 case 22: out0
[0] = amd_bytealign (in1
[2], in1
[1], 2);
671 out0
[1] = amd_bytealign (in1
[3], in1
[2], 2);
672 out0
[2] = amd_bytealign ( 0, in1
[3], 2);
679 case 23: out0
[0] = amd_bytealign (in1
[2], in1
[1], 3);
680 out0
[1] = amd_bytealign (in1
[3], in1
[2], 3);
681 out0
[2] = amd_bytealign ( 0, in1
[3], 3);
688 case 24: out0
[0] = in1
[2];
697 case 25: out0
[0] = amd_bytealign (in1
[3], in1
[2], 1);
698 out0
[1] = amd_bytealign ( 0, in1
[3], 1);
706 case 26: out0
[0] = amd_bytealign (in1
[3], in1
[2], 2);
707 out0
[1] = amd_bytealign ( 0, in1
[3], 2);
715 case 27: out0
[0] = amd_bytealign (in1
[3], in1
[2], 3);
716 out0
[1] = amd_bytealign ( 0, in1
[3], 3);
724 case 28: out0
[0] = in1
[3];
733 case 29: out0
[0] = amd_bytealign ( 0, in1
[3], 1);
742 case 30: out0
[0] = amd_bytealign ( 0, in1
[3], 2);
751 case 31: out0
[0] = amd_bytealign ( 0, in1
[3], 3);
764 static void rshift_block_N (const u32 in0
[4], const u32 in1
[4], u32 out0
[4], u32 out1
[4], const u32 num
)
769 case 0: out0
[0] = in0
[0];
778 case 1: out0
[0] = __byte_perm (in0
[0], in0
[1], 0x4321);
779 out0
[1] = __byte_perm (in0
[1], in0
[2], 0x4321);
780 out0
[2] = __byte_perm (in0
[2], in0
[3], 0x4321);
781 out0
[3] = __byte_perm (in0
[3], in1
[0], 0x4321);
782 out1
[0] = __byte_perm (in1
[0], in1
[1], 0x4321);
783 out1
[1] = __byte_perm (in1
[1], in1
[2], 0x4321);
784 out1
[2] = __byte_perm (in1
[2], in1
[3], 0x4321);
785 out1
[3] = __byte_perm (in1
[3], 0, 0x4321);
787 case 2: out0
[0] = __byte_perm (in0
[0], in0
[1], 0x5432);
788 out0
[1] = __byte_perm (in0
[1], in0
[2], 0x5432);
789 out0
[2] = __byte_perm (in0
[2], in0
[3], 0x5432);
790 out0
[3] = __byte_perm (in0
[3], in1
[0], 0x5432);
791 out1
[0] = __byte_perm (in1
[0], in1
[1], 0x5432);
792 out1
[1] = __byte_perm (in1
[1], in1
[2], 0x5432);
793 out1
[2] = __byte_perm (in1
[2], in1
[3], 0x5432);
794 out1
[3] = __byte_perm (in1
[3], 0, 0x5432);
796 case 3: out0
[0] = __byte_perm (in0
[0], in0
[1], 0x6543);
797 out0
[1] = __byte_perm (in0
[1], in0
[2], 0x6543);
798 out0
[2] = __byte_perm (in0
[2], in0
[3], 0x6543);
799 out0
[3] = __byte_perm (in0
[3], in1
[0], 0x6543);
800 out1
[0] = __byte_perm (in1
[0], in1
[1], 0x6543);
801 out1
[1] = __byte_perm (in1
[1], in1
[2], 0x6543);
802 out1
[2] = __byte_perm (in1
[2], in1
[3], 0x6543);
803 out1
[3] = __byte_perm (in1
[3], 0, 0x6543);
805 case 4: out0
[0] = in0
[1];
814 case 5: out0
[0] = __byte_perm (in0
[1], in0
[2], 0x4321);
815 out0
[1] = __byte_perm (in0
[2], in0
[3], 0x4321);
816 out0
[2] = __byte_perm (in0
[3], in1
[0], 0x4321);
817 out0
[3] = __byte_perm (in1
[0], in1
[1], 0x4321);
818 out1
[0] = __byte_perm (in1
[1], in1
[2], 0x4321);
819 out1
[1] = __byte_perm (in1
[2], in1
[3], 0x4321);
820 out1
[2] = __byte_perm (in1
[3], 0, 0x4321);
823 case 6: out0
[0] = __byte_perm (in0
[1], in0
[2], 0x5432);
824 out0
[1] = __byte_perm (in0
[2], in0
[3], 0x5432);
825 out0
[2] = __byte_perm (in0
[3], in1
[0], 0x5432);
826 out0
[3] = __byte_perm (in1
[0], in1
[1], 0x5432);
827 out1
[0] = __byte_perm (in1
[1], in1
[2], 0x5432);
828 out1
[1] = __byte_perm (in1
[2], in1
[3], 0x5432);
829 out1
[2] = __byte_perm (in1
[3], 0, 0x5432);
832 case 7: out0
[0] = __byte_perm (in0
[1], in0
[2], 0x6543);
833 out0
[1] = __byte_perm (in0
[2], in0
[3], 0x6543);
834 out0
[2] = __byte_perm (in0
[3], in1
[0], 0x6543);
835 out0
[3] = __byte_perm (in1
[0], in1
[1], 0x6543);
836 out1
[0] = __byte_perm (in1
[1], in1
[2], 0x6543);
837 out1
[1] = __byte_perm (in1
[2], in1
[3], 0x6543);
838 out1
[2] = __byte_perm (in1
[3], 0, 0x6543);
841 case 8: out0
[0] = in0
[2];
850 case 9: out0
[0] = __byte_perm (in0
[2], in0
[3], 0x4321);
851 out0
[1] = __byte_perm (in0
[3], in1
[0], 0x4321);
852 out0
[2] = __byte_perm (in1
[0], in1
[1], 0x4321);
853 out0
[3] = __byte_perm (in1
[1], in1
[2], 0x4321);
854 out1
[0] = __byte_perm (in1
[2], in1
[3], 0x4321);
855 out1
[1] = __byte_perm (in1
[3], 0, 0x4321);
859 case 10: out0
[0] = __byte_perm (in0
[2], in0
[3], 0x5432);
860 out0
[1] = __byte_perm (in0
[3], in1
[0], 0x5432);
861 out0
[2] = __byte_perm (in1
[0], in1
[1], 0x5432);
862 out0
[3] = __byte_perm (in1
[1], in1
[2], 0x5432);
863 out1
[0] = __byte_perm (in1
[2], in1
[3], 0x5432);
864 out1
[1] = __byte_perm (in1
[3], 0, 0x5432);
868 case 11: out0
[0] = __byte_perm (in0
[2], in0
[3], 0x6543);
869 out0
[1] = __byte_perm (in0
[3], in1
[0], 0x6543);
870 out0
[2] = __byte_perm (in1
[0], in1
[1], 0x6543);
871 out0
[3] = __byte_perm (in1
[1], in1
[2], 0x6543);
872 out1
[0] = __byte_perm (in1
[2], in1
[3], 0x6543);
873 out1
[1] = __byte_perm (in1
[3], 0, 0x6543);
877 case 12: out0
[0] = in0
[3];
887 out0
[0] = __byte_perm (in0
[3], in1
[0], 0x4321);
888 out0
[1] = __byte_perm (in1
[0], in1
[1], 0x4321);
889 out0
[2] = __byte_perm (in1
[1], in1
[2], 0x4321);
890 out0
[3] = __byte_perm (in1
[2], in1
[3], 0x4321);
891 out1
[0] = __byte_perm (in1
[3], 0, 0x4321);
896 case 14: out0
[0] = __byte_perm (in0
[3], in1
[0], 0x5432);
897 out0
[1] = __byte_perm (in1
[0], in1
[1], 0x5432);
898 out0
[2] = __byte_perm (in1
[1], in1
[2], 0x5432);
899 out0
[3] = __byte_perm (in1
[2], in1
[3], 0x5432);
900 out1
[0] = __byte_perm (in1
[3], 0, 0x5432);
905 case 15: out0
[0] = __byte_perm (in0
[3], in1
[0], 0x6543);
906 out0
[1] = __byte_perm (in1
[0], in1
[1], 0x6543);
907 out0
[2] = __byte_perm (in1
[1], in1
[2], 0x6543);
908 out0
[3] = __byte_perm (in1
[2], in1
[3], 0x6543);
909 out1
[0] = __byte_perm (in1
[3], 0, 0x6543);
914 case 16: out0
[0] = in1
[0];
923 case 17: out0
[0] = __byte_perm (in1
[0], in1
[1], 0x4321);
924 out0
[1] = __byte_perm (in1
[1], in1
[2], 0x4321);
925 out0
[2] = __byte_perm (in1
[2], in1
[3], 0x4321);
926 out0
[3] = __byte_perm (in1
[3], 0, 0x4321);
932 case 18: out0
[0] = __byte_perm (in1
[0], in1
[1], 0x5432);
933 out0
[1] = __byte_perm (in1
[1], in1
[2], 0x5432);
934 out0
[2] = __byte_perm (in1
[2], in1
[3], 0x5432);
935 out0
[3] = __byte_perm (in1
[3], 0, 0x5432);
941 case 19: out0
[0] = __byte_perm (in1
[0], in1
[1], 0x6543);
942 out0
[1] = __byte_perm (in1
[1], in1
[2], 0x6543);
943 out0
[2] = __byte_perm (in1
[2], in1
[3], 0x6543);
944 out0
[3] = __byte_perm (in1
[3], 0, 0x6543);
950 case 20: out0
[0] = in1
[1];
959 case 21: out0
[0] = __byte_perm (in1
[1], in1
[2], 0x4321);
960 out0
[1] = __byte_perm (in1
[2], in1
[3], 0x4321);
961 out0
[2] = __byte_perm (in1
[3], 0, 0x4321);
968 case 22: out0
[0] = __byte_perm (in1
[1], in1
[2], 0x5432);
969 out0
[1] = __byte_perm (in1
[2], in1
[3], 0x5432);
970 out0
[2] = __byte_perm (in1
[3], 0, 0x5432);
977 case 23: out0
[0] = __byte_perm (in1
[1], in1
[2], 0x6543);
978 out0
[1] = __byte_perm (in1
[2], in1
[3], 0x6543);
979 out0
[2] = __byte_perm (in1
[3], 0, 0x6543);
986 case 24: out0
[0] = in1
[2];
995 case 25: out0
[0] = __byte_perm (in1
[2], in1
[3], 0x4321);
996 out0
[1] = __byte_perm (in1
[3], 0, 0x4321);
1004 case 26: out0
[0] = __byte_perm (in1
[2], in1
[3], 0x5432);
1005 out0
[1] = __byte_perm (in1
[3], 0, 0x5432);
1013 case 27: out0
[0] = __byte_perm (in1
[2], in1
[3], 0x6543);
1014 out0
[1] = __byte_perm (in1
[3], 0, 0x6543);
1022 case 28: out0
[0] = in1
[3];
1031 case 29: out0
[0] = __byte_perm (in1
[3], 0, 0x4321);
1040 case 30: out0
[0] = __byte_perm (in1
[3], 0, 0x5432);
1049 case 31: out0
[0] = __byte_perm (in1
[3], 0, 0x6543);
1061 #if defined IS_AMD || defined IS_GENERIC
1064 case 0: out1
[3] = in1
[3];
1073 case 1: out1
[3] = amd_bytealign (in1
[3], in1
[2], 3);
1074 out1
[2] = amd_bytealign (in1
[2], in1
[1], 3);
1075 out1
[1] = amd_bytealign (in1
[1], in1
[0], 3);
1076 out1
[0] = amd_bytealign (in1
[0], in0
[3], 3);
1077 out0
[3] = amd_bytealign (in0
[3], in0
[2], 3);
1078 out0
[2] = amd_bytealign (in0
[2], in0
[1], 3);
1079 out0
[1] = amd_bytealign (in0
[1], in0
[0], 3);
1080 out0
[0] = amd_bytealign (in0
[0], 0, 3);
1082 case 2: out1
[3] = amd_bytealign (in1
[3], in1
[2], 2);
1083 out1
[2] = amd_bytealign (in1
[2], in1
[1], 2);
1084 out1
[1] = amd_bytealign (in1
[1], in1
[0], 2);
1085 out1
[0] = amd_bytealign (in1
[0], in0
[3], 2);
1086 out0
[3] = amd_bytealign (in0
[3], in0
[2], 2);
1087 out0
[2] = amd_bytealign (in0
[2], in0
[1], 2);
1088 out0
[1] = amd_bytealign (in0
[1], in0
[0], 2);
1089 out0
[0] = amd_bytealign (in0
[0], 0, 2);
1091 case 3: out1
[3] = amd_bytealign (in1
[3], in1
[2], 1);
1092 out1
[2] = amd_bytealign (in1
[2], in1
[1], 1);
1093 out1
[1] = amd_bytealign (in1
[1], in1
[0], 1);
1094 out1
[0] = amd_bytealign (in1
[0], in0
[3], 1);
1095 out0
[3] = amd_bytealign (in0
[3], in0
[2], 1);
1096 out0
[2] = amd_bytealign (in0
[2], in0
[1], 1);
1097 out0
[1] = amd_bytealign (in0
[1], in0
[0], 1);
1098 out0
[0] = amd_bytealign (in0
[0], 0, 1);
1100 case 4: out1
[3] = in1
[2];
1109 case 5: out1
[3] = amd_bytealign (in1
[2], in1
[1], 3);
1110 out1
[2] = amd_bytealign (in1
[1], in1
[0], 3);
1111 out1
[1] = amd_bytealign (in1
[0], in0
[3], 3);
1112 out1
[0] = amd_bytealign (in0
[3], in0
[2], 3);
1113 out0
[3] = amd_bytealign (in0
[2], in0
[1], 3);
1114 out0
[2] = amd_bytealign (in0
[1], in0
[0], 3);
1115 out0
[1] = amd_bytealign (in0
[0], 0, 3);
1118 case 6: out1
[3] = amd_bytealign (in1
[2], in1
[1], 2);
1119 out1
[2] = amd_bytealign (in1
[1], in1
[0], 2);
1120 out1
[1] = amd_bytealign (in1
[0], in0
[3], 2);
1121 out1
[0] = amd_bytealign (in0
[3], in0
[2], 2);
1122 out0
[3] = amd_bytealign (in0
[2], in0
[1], 2);
1123 out0
[2] = amd_bytealign (in0
[1], in0
[0], 2);
1124 out0
[1] = amd_bytealign (in0
[0], 0, 2);
1127 case 7: out1
[3] = amd_bytealign (in1
[2], in1
[1], 1);
1128 out1
[2] = amd_bytealign (in1
[1], in1
[0], 1);
1129 out1
[1] = amd_bytealign (in1
[0], in0
[3], 1);
1130 out1
[0] = amd_bytealign (in0
[3], in0
[2], 1);
1131 out0
[3] = amd_bytealign (in0
[2], in0
[1], 1);
1132 out0
[2] = amd_bytealign (in0
[1], in0
[0], 1);
1133 out0
[1] = amd_bytealign (in0
[0], 0, 1);
1136 case 8: out1
[3] = in1
[1];
1145 case 9: out1
[3] = amd_bytealign (in1
[1], in1
[0], 3);
1146 out1
[2] = amd_bytealign (in1
[0], in0
[3], 3);
1147 out1
[1] = amd_bytealign (in0
[3], in0
[2], 3);
1148 out1
[0] = amd_bytealign (in0
[2], in0
[1], 3);
1149 out0
[3] = amd_bytealign (in0
[1], in0
[0], 3);
1150 out0
[2] = amd_bytealign (in0
[0], 0, 3);
1154 case 10: out1
[3] = amd_bytealign (in1
[1], in1
[0], 2);
1155 out1
[2] = amd_bytealign (in1
[0], in0
[3], 2);
1156 out1
[1] = amd_bytealign (in0
[3], in0
[2], 2);
1157 out1
[0] = amd_bytealign (in0
[2], in0
[1], 2);
1158 out0
[3] = amd_bytealign (in0
[1], in0
[0], 2);
1159 out0
[2] = amd_bytealign (in0
[0], 0, 2);
1163 case 11: out1
[3] = amd_bytealign (in1
[1], in1
[0], 1);
1164 out1
[2] = amd_bytealign (in1
[0], in0
[3], 1);
1165 out1
[1] = amd_bytealign (in0
[3], in0
[2], 1);
1166 out1
[0] = amd_bytealign (in0
[2], in0
[1], 1);
1167 out0
[3] = amd_bytealign (in0
[1], in0
[0], 1);
1168 out0
[2] = amd_bytealign (in0
[0], 0, 1);
1172 case 12: out1
[3] = in1
[0];
1181 case 13: out1
[3] = amd_bytealign (in1
[0], in0
[3], 3);
1182 out1
[2] = amd_bytealign (in0
[3], in0
[2], 3);
1183 out1
[1] = amd_bytealign (in0
[2], in0
[1], 3);
1184 out1
[0] = amd_bytealign (in0
[1], in0
[0], 3);
1185 out0
[3] = amd_bytealign (in0
[0], 0, 3);
1190 case 14: out1
[3] = amd_bytealign (in1
[0], in0
[3], 2);
1191 out1
[2] = amd_bytealign (in0
[3], in0
[2], 2);
1192 out1
[1] = amd_bytealign (in0
[2], in0
[1], 2);
1193 out1
[0] = amd_bytealign (in0
[1], in0
[0], 2);
1194 out0
[3] = amd_bytealign (in0
[0], 0, 2);
1199 case 15: out1
[3] = amd_bytealign (in1
[0], in0
[3], 1);
1200 out1
[2] = amd_bytealign (in0
[3], in0
[2], 1);
1201 out1
[1] = amd_bytealign (in0
[2], in0
[1], 1);
1202 out1
[0] = amd_bytealign (in0
[1], in0
[0], 1);
1203 out0
[3] = amd_bytealign (in0
[0], 0, 1);
1208 case 16: out1
[3] = in0
[3];
1217 case 17: out1
[3] = amd_bytealign (in0
[3], in0
[2], 3);
1218 out1
[2] = amd_bytealign (in0
[2], in0
[1], 3);
1219 out1
[1] = amd_bytealign (in0
[1], in0
[0], 3);
1220 out1
[0] = amd_bytealign (in0
[0], 0, 3);
1226 case 18: out1
[3] = amd_bytealign (in0
[3], in0
[2], 2);
1227 out1
[2] = amd_bytealign (in0
[2], in0
[1], 2);
1228 out1
[1] = amd_bytealign (in0
[1], in0
[0], 2);
1229 out1
[0] = amd_bytealign (in0
[0], 0, 2);
1235 case 19: out1
[3] = amd_bytealign (in0
[3], in0
[2], 1);
1236 out1
[2] = amd_bytealign (in0
[2], in0
[1], 1);
1237 out1
[1] = amd_bytealign (in0
[1], in0
[0], 1);
1238 out1
[0] = amd_bytealign (in0
[0], 0, 1);
1244 case 20: out1
[3] = in0
[2];
1253 case 21: out1
[3] = amd_bytealign (in0
[2], in0
[1], 3);
1254 out1
[2] = amd_bytealign (in0
[1], in0
[0], 3);
1255 out1
[1] = amd_bytealign (in0
[0], 0, 3);
1262 case 22: out1
[3] = amd_bytealign (in0
[2], in0
[1], 2);
1263 out1
[2] = amd_bytealign (in0
[1], in0
[0], 2);
1264 out1
[1] = amd_bytealign (in0
[0], 0, 2);
1271 case 23: out1
[3] = amd_bytealign (in0
[2], in0
[1], 1);
1272 out1
[2] = amd_bytealign (in0
[1], in0
[0], 1);
1273 out1
[1] = amd_bytealign (in0
[0], 0, 1);
1280 case 24: out1
[3] = in0
[1];
1289 case 25: out1
[3] = amd_bytealign (in0
[1], in0
[0], 3);
1290 out1
[2] = amd_bytealign (in0
[0], 0, 3);
1298 case 26: out1
[3] = amd_bytealign (in0
[1], in0
[0], 2);
1299 out1
[2] = amd_bytealign (in0
[0], 0, 2);
1307 case 27: out1
[3] = amd_bytealign (in0
[1], in0
[0], 1);
1308 out1
[2] = amd_bytealign (in0
[0], 0, 1);
1316 case 28: out1
[3] = in0
[0];
1325 case 29: out1
[3] = amd_bytealign (in0
[0], 0, 3);
1334 case 30: out1
[3] = amd_bytealign (in0
[0], 0, 2);
1343 case 31: out1
[3] = amd_bytealign (in0
[0], 0, 1);
1356 static void append_block1 (const u32 offset
, u32 dst0
[4], u32 dst1
[4], const u32 src_r0
)
1362 case 0: tmp
[0] = src_r0
;
1365 case 1: tmp
[0] = src_r0
<< 8;
1366 tmp
[1] = src_r0
>> 24;
1368 case 2: tmp
[0] = src_r0
<< 16;
1369 tmp
[1] = src_r0
>> 16;
1371 case 3: tmp
[0] = src_r0
<< 24;
1372 tmp
[1] = src_r0
>> 8;
1378 case 0: dst0
[0] |= tmp
[0];
1381 case 1: dst0
[1] |= tmp
[0];
1384 case 2: dst0
[2] |= tmp
[0];
1387 case 3: dst0
[3] |= tmp
[0];
1390 case 4: dst1
[0] |= tmp
[0];
1393 case 5: dst1
[1] |= tmp
[0];
1396 case 6: dst1
[2] |= tmp
[0];
1399 case 7: dst1
[3] |= tmp
[0];
1404 static void append_block8 (const u32 offset
, u32 dst0
[4], u32 dst1
[4], const u32 src_l0
[4], const u32 src_l1
[4], const u32 src_r0
[4], const u32 src_r1
[4])
1410 dst0
[0] = src_r0
[0];
1411 dst0
[1] = src_r0
[1];
1412 dst0
[2] = src_r0
[2];
1413 dst0
[3] = src_r0
[3];
1414 dst1
[0] = src_r1
[0];
1415 dst1
[1] = src_r1
[1];
1416 dst1
[2] = src_r1
[2];
1417 dst1
[3] = src_r1
[3];
1421 dst0
[0] = __byte_perm (src_l0
[0], src_r0
[0], 0x6540);
1422 dst0
[1] = __byte_perm (src_r0
[0], src_r0
[1], 0x6543);
1423 dst0
[2] = __byte_perm (src_r0
[1], src_r0
[2], 0x6543);
1424 dst0
[3] = __byte_perm (src_r0
[2], src_r0
[3], 0x6543);
1425 dst1
[0] = __byte_perm (src_r0
[3], src_r1
[0], 0x6543);
1426 dst1
[1] = __byte_perm (src_r1
[0], src_r1
[1], 0x6543);
1427 dst1
[2] = __byte_perm (src_r1
[1], src_r1
[2], 0x6543);
1428 dst1
[3] = __byte_perm (src_r1
[2], src_r1
[3], 0x6543);
1432 dst0
[0] = __byte_perm (src_l0
[0], src_r0
[0], 0x5410);
1433 dst0
[1] = __byte_perm (src_r0
[0], src_r0
[1], 0x5432);
1434 dst0
[2] = __byte_perm (src_r0
[1], src_r0
[2], 0x5432);
1435 dst0
[3] = __byte_perm (src_r0
[2], src_r0
[3], 0x5432);
1436 dst1
[0] = __byte_perm (src_r0
[3], src_r1
[0], 0x5432);
1437 dst1
[1] = __byte_perm (src_r1
[0], src_r1
[1], 0x5432);
1438 dst1
[2] = __byte_perm (src_r1
[1], src_r1
[2], 0x5432);
1439 dst1
[3] = __byte_perm (src_r1
[2], src_r1
[3], 0x5432);
1443 dst0
[0] = __byte_perm (src_l0
[0], src_r0
[0], 0x4210);
1444 dst0
[1] = __byte_perm (src_r0
[0], src_r0
[1], 0x4321);
1445 dst0
[2] = __byte_perm (src_r0
[1], src_r0
[2], 0x4321);
1446 dst0
[3] = __byte_perm (src_r0
[2], src_r0
[3], 0x4321);
1447 dst1
[0] = __byte_perm (src_r0
[3], src_r1
[0], 0x4321);
1448 dst1
[1] = __byte_perm (src_r1
[0], src_r1
[1], 0x4321);
1449 dst1
[2] = __byte_perm (src_r1
[1], src_r1
[2], 0x4321);
1450 dst1
[3] = __byte_perm (src_r1
[2], src_r1
[3], 0x4321);
1454 dst0
[1] = src_r0
[0];
1455 dst0
[2] = src_r0
[1];
1456 dst0
[3] = src_r0
[2];
1457 dst1
[0] = src_r0
[3];
1458 dst1
[1] = src_r1
[0];
1459 dst1
[2] = src_r1
[1];
1460 dst1
[3] = src_r1
[2];
1464 dst0
[1] = __byte_perm (src_l0
[1], src_r0
[0], 0x6540);
1465 dst0
[2] = __byte_perm (src_r0
[0], src_r0
[1], 0x6543);
1466 dst0
[3] = __byte_perm (src_r0
[1], src_r0
[2], 0x6543);
1467 dst1
[0] = __byte_perm (src_r0
[2], src_r0
[3], 0x6543);
1468 dst1
[1] = __byte_perm (src_r0
[3], src_r1
[0], 0x6543);
1469 dst1
[2] = __byte_perm (src_r1
[0], src_r1
[1], 0x6543);
1470 dst1
[3] = __byte_perm (src_r1
[1], src_r1
[2], 0x6543);
1474 dst0
[1] = __byte_perm (src_l0
[1], src_r0
[0], 0x5410);
1475 dst0
[2] = __byte_perm (src_r0
[0], src_r0
[1], 0x5432);
1476 dst0
[3] = __byte_perm (src_r0
[1], src_r0
[2], 0x5432);
1477 dst1
[0] = __byte_perm (src_r0
[2], src_r0
[3], 0x5432);
1478 dst1
[1] = __byte_perm (src_r0
[3], src_r1
[0], 0x5432);
1479 dst1
[2] = __byte_perm (src_r1
[0], src_r1
[1], 0x5432);
1480 dst1
[3] = __byte_perm (src_r1
[1], src_r1
[2], 0x5432);
1484 dst0
[1] = __byte_perm (src_l0
[1], src_r0
[0], 0x4210);
1485 dst0
[2] = __byte_perm (src_r0
[0], src_r0
[1], 0x4321);
1486 dst0
[3] = __byte_perm (src_r0
[1], src_r0
[2], 0x4321);
1487 dst1
[0] = __byte_perm (src_r0
[2], src_r0
[3], 0x4321);
1488 dst1
[1] = __byte_perm (src_r0
[3], src_r1
[0], 0x4321);
1489 dst1
[2] = __byte_perm (src_r1
[0], src_r1
[1], 0x4321);
1490 dst1
[3] = __byte_perm (src_r1
[1], src_r1
[2], 0x4321);
1494 dst0
[2] = src_r0
[0];
1495 dst0
[3] = src_r0
[1];
1496 dst1
[0] = src_r0
[2];
1497 dst1
[1] = src_r0
[3];
1498 dst1
[2] = src_r1
[0];
1499 dst1
[3] = src_r1
[1];
1503 dst0
[2] = __byte_perm (src_l0
[2], src_r0
[0], 0x6540);
1504 dst0
[3] = __byte_perm (src_r0
[0], src_r0
[1], 0x6543);
1505 dst1
[0] = __byte_perm (src_r0
[1], src_r0
[2], 0x6543);
1506 dst1
[1] = __byte_perm (src_r0
[2], src_r0
[3], 0x6543);
1507 dst1
[2] = __byte_perm (src_r0
[3], src_r1
[0], 0x6543);
1508 dst1
[3] = __byte_perm (src_r1
[0], src_r1
[1], 0x6543);
1512 dst0
[2] = __byte_perm (src_l0
[2], src_r0
[0], 0x5410);
1513 dst0
[3] = __byte_perm (src_r0
[0], src_r0
[1], 0x5432);
1514 dst1
[0] = __byte_perm (src_r0
[1], src_r0
[2], 0x5432);
1515 dst1
[1] = __byte_perm (src_r0
[2], src_r0
[3], 0x5432);
1516 dst1
[2] = __byte_perm (src_r0
[3], src_r1
[0], 0x5432);
1517 dst1
[3] = __byte_perm (src_r1
[0], src_r1
[1], 0x5432);
1521 dst0
[2] = __byte_perm (src_l0
[2], src_r0
[0], 0x4210);
1522 dst0
[3] = __byte_perm (src_r0
[0], src_r0
[1], 0x4321);
1523 dst1
[0] = __byte_perm (src_r0
[1], src_r0
[2], 0x4321);
1524 dst1
[1] = __byte_perm (src_r0
[2], src_r0
[3], 0x4321);
1525 dst1
[2] = __byte_perm (src_r0
[3], src_r1
[0], 0x4321);
1526 dst1
[3] = __byte_perm (src_r1
[0], src_r1
[1], 0x4321);
1530 dst0
[3] = src_r0
[0];
1531 dst1
[0] = src_r0
[1];
1532 dst1
[1] = src_r0
[2];
1533 dst1
[2] = src_r0
[3];
1534 dst1
[3] = src_r1
[0];
1538 dst0
[3] = __byte_perm (src_l0
[3], src_r0
[0], 0x6540);
1539 dst1
[0] = __byte_perm (src_r0
[0], src_r0
[1], 0x6543);
1540 dst1
[1] = __byte_perm (src_r0
[1], src_r0
[2], 0x6543);
1541 dst1
[2] = __byte_perm (src_r0
[2], src_r0
[3], 0x6543);
1542 dst1
[3] = __byte_perm (src_r0
[3], src_r1
[0], 0x6543);
1546 dst0
[3] = __byte_perm (src_l0
[3], src_r0
[0], 0x5410);
1547 dst1
[0] = __byte_perm (src_r0
[0], src_r0
[1], 0x5432);
1548 dst1
[1] = __byte_perm (src_r0
[1], src_r0
[2], 0x5432);
1549 dst1
[2] = __byte_perm (src_r0
[2], src_r0
[3], 0x5432);
1550 dst1
[3] = __byte_perm (src_r0
[3], src_r1
[0], 0x5432);
1554 dst0
[3] = __byte_perm (src_l0
[3], src_r0
[0], 0x4210);
1555 dst1
[0] = __byte_perm (src_r0
[0], src_r0
[1], 0x4321);
1556 dst1
[1] = __byte_perm (src_r0
[1], src_r0
[2], 0x4321);
1557 dst1
[2] = __byte_perm (src_r0
[2], src_r0
[3], 0x4321);
1558 dst1
[3] = __byte_perm (src_r0
[3], src_r1
[0], 0x4321);
1562 dst1
[0] = src_r0
[0];
1563 dst1
[1] = src_r0
[1];
1564 dst1
[2] = src_r0
[2];
1565 dst1
[3] = src_r0
[3];
1569 dst1
[0] = __byte_perm (src_l1
[0], src_r0
[0], 0x6540);
1570 dst1
[1] = __byte_perm (src_r0
[0], src_r0
[1], 0x6543);
1571 dst1
[2] = __byte_perm (src_r0
[1], src_r0
[2], 0x6543);
1572 dst1
[3] = __byte_perm (src_r0
[2], src_r0
[3], 0x6543);
1576 dst1
[0] = __byte_perm (src_l1
[0], src_r0
[0], 0x5410);
1577 dst1
[1] = __byte_perm (src_r0
[0], src_r0
[1], 0x5432);
1578 dst1
[2] = __byte_perm (src_r0
[1], src_r0
[2], 0x5432);
1579 dst1
[3] = __byte_perm (src_r0
[2], src_r0
[3], 0x5432);
1583 dst1
[0] = __byte_perm (src_l1
[0], src_r0
[0], 0x4210);
1584 dst1
[1] = __byte_perm (src_r0
[0], src_r0
[1], 0x4321);
1585 dst1
[2] = __byte_perm (src_r0
[1], src_r0
[2], 0x4321);
1586 dst1
[3] = __byte_perm (src_r0
[2], src_r0
[3], 0x4321);
1590 dst1
[1] = src_r0
[0];
1591 dst1
[2] = src_r0
[1];
1592 dst1
[3] = src_r0
[2];
1596 dst1
[1] = __byte_perm (src_l1
[1], src_r0
[0], 0x6540);
1597 dst1
[2] = __byte_perm (src_r0
[0], src_r0
[1], 0x6543);
1598 dst1
[3] = __byte_perm (src_r0
[1], src_r0
[2], 0x6543);
1602 dst1
[1] = __byte_perm (src_l1
[1], src_r0
[0], 0x5410);
1603 dst1
[2] = __byte_perm (src_r0
[0], src_r0
[1], 0x5432);
1604 dst1
[3] = __byte_perm (src_r0
[1], src_r0
[2], 0x5432);
1608 dst1
[1] = __byte_perm (src_l1
[1], src_r0
[0], 0x4210);
1609 dst1
[2] = __byte_perm (src_r0
[0], src_r0
[1], 0x4321);
1610 dst1
[3] = __byte_perm (src_r0
[1], src_r0
[2], 0x4321);
1614 dst1
[2] = src_r0
[0];
1615 dst1
[3] = src_r0
[1];
1619 dst1
[2] = __byte_perm (src_l1
[2], src_r0
[0], 0x6540);
1620 dst1
[3] = __byte_perm (src_r0
[0], src_r0
[1], 0x6543);
1624 dst1
[2] = __byte_perm (src_l1
[2], src_r0
[0], 0x5410);
1625 dst1
[3] = __byte_perm (src_r0
[0], src_r0
[1], 0x5432);
1629 dst1
[2] = __byte_perm (src_l1
[2], src_r0
[0], 0x4210);
1630 dst1
[3] = __byte_perm (src_r0
[0], src_r0
[1], 0x4321);
1634 dst1
[3] = src_r0
[0];
1638 dst1
[3] = __byte_perm (src_l1
[3], src_r0
[0], 0x6540);
1642 dst1
[3] = __byte_perm (src_l1
[3], src_r0
[0], 0x5410);
1646 dst1
[3] = __byte_perm (src_l1
[3], src_r0
[0], 0x4210);
1651 #if defined IS_AMD || defined IS_GENERIC
1655 dst0
[0] = src_r0
[0];
1656 dst0
[1] = src_r0
[1];
1657 dst0
[2] = src_r0
[2];
1658 dst0
[3] = src_r0
[3];
1659 dst1
[0] = src_r1
[0];
1660 dst1
[1] = src_r1
[1];
1661 dst1
[2] = src_r1
[2];
1662 dst1
[3] = src_r1
[3];
1668 dst0
[1] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1669 dst0
[2] = amd_bytealign (src_r0
[2], src_r0
[1], 3);
1670 dst0
[3] = amd_bytealign (src_r0
[3], src_r0
[2], 3);
1671 dst1
[0] = amd_bytealign (src_r1
[0], src_r0
[3], 3);
1672 dst1
[1] = amd_bytealign (src_r1
[1], src_r1
[0], 3);
1673 dst1
[2] = amd_bytealign (src_r1
[2], src_r1
[1], 3);
1674 dst1
[3] = amd_bytealign (src_r1
[3], src_r1
[2], 3);
1680 dst0
[1] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1681 dst0
[2] = amd_bytealign (src_r0
[2], src_r0
[1], 2);
1682 dst0
[3] = amd_bytealign (src_r0
[3], src_r0
[2], 2);
1683 dst1
[0] = amd_bytealign (src_r1
[0], src_r0
[3], 2);
1684 dst1
[1] = amd_bytealign (src_r1
[1], src_r1
[0], 2);
1685 dst1
[2] = amd_bytealign (src_r1
[2], src_r1
[1], 2);
1686 dst1
[3] = amd_bytealign (src_r1
[3], src_r1
[2], 2);
1692 dst0
[1] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1693 dst0
[2] = amd_bytealign (src_r0
[2], src_r0
[1], 1);
1694 dst0
[3] = amd_bytealign (src_r0
[3], src_r0
[2], 1);
1695 dst1
[0] = amd_bytealign (src_r1
[0], src_r0
[3], 1);
1696 dst1
[1] = amd_bytealign (src_r1
[1], src_r1
[0], 1);
1697 dst1
[2] = amd_bytealign (src_r1
[2], src_r1
[1], 1);
1698 dst1
[3] = amd_bytealign (src_r1
[3], src_r1
[2], 1);
1702 dst0
[1] = src_r0
[0];
1703 dst0
[2] = src_r0
[1];
1704 dst0
[3] = src_r0
[2];
1705 dst1
[0] = src_r0
[3];
1706 dst1
[1] = src_r1
[0];
1707 dst1
[2] = src_r1
[1];
1708 dst1
[3] = src_r1
[2];
1714 dst0
[2] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1715 dst0
[3] = amd_bytealign (src_r0
[2], src_r0
[1], 3);
1716 dst1
[0] = amd_bytealign (src_r0
[3], src_r0
[2], 3);
1717 dst1
[1] = amd_bytealign (src_r1
[0], src_r0
[3], 3);
1718 dst1
[2] = amd_bytealign (src_r1
[1], src_r1
[0], 3);
1719 dst1
[3] = amd_bytealign (src_r1
[2], src_r1
[1], 3);
1725 dst0
[2] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1726 dst0
[3] = amd_bytealign (src_r0
[2], src_r0
[1], 2);
1727 dst1
[0] = amd_bytealign (src_r0
[3], src_r0
[2], 2);
1728 dst1
[1] = amd_bytealign (src_r1
[0], src_r0
[3], 2);
1729 dst1
[2] = amd_bytealign (src_r1
[1], src_r1
[0], 2);
1730 dst1
[3] = amd_bytealign (src_r1
[2], src_r1
[1], 2);
1736 dst0
[2] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1737 dst0
[3] = amd_bytealign (src_r0
[2], src_r0
[1], 1);
1738 dst1
[0] = amd_bytealign (src_r0
[3], src_r0
[2], 1);
1739 dst1
[1] = amd_bytealign (src_r1
[0], src_r0
[3], 1);
1740 dst1
[2] = amd_bytealign (src_r1
[1], src_r1
[0], 1);
1741 dst1
[3] = amd_bytealign (src_r1
[2], src_r1
[1], 1);
1745 dst0
[2] = src_r0
[0];
1746 dst0
[3] = src_r0
[1];
1747 dst1
[0] = src_r0
[2];
1748 dst1
[1] = src_r0
[3];
1749 dst1
[2] = src_r1
[0];
1750 dst1
[3] = src_r1
[1];
1756 dst0
[3] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1757 dst1
[0] = amd_bytealign (src_r0
[2], src_r0
[1], 3);
1758 dst1
[1] = amd_bytealign (src_r0
[3], src_r0
[2], 3);
1759 dst1
[2] = amd_bytealign (src_r1
[0], src_r0
[3], 3);
1760 dst1
[3] = amd_bytealign (src_r1
[1], src_r1
[0], 3);
1766 dst0
[3] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1767 dst1
[0] = amd_bytealign (src_r0
[2], src_r0
[1], 2);
1768 dst1
[1] = amd_bytealign (src_r0
[3], src_r0
[2], 2);
1769 dst1
[2] = amd_bytealign (src_r1
[0], src_r0
[3], 2);
1770 dst1
[3] = amd_bytealign (src_r1
[1], src_r1
[0], 2);
1776 dst0
[3] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1777 dst1
[0] = amd_bytealign (src_r0
[2], src_r0
[1], 1);
1778 dst1
[1] = amd_bytealign (src_r0
[3], src_r0
[2], 1);
1779 dst1
[2] = amd_bytealign (src_r1
[0], src_r0
[3], 1);
1780 dst1
[3] = amd_bytealign (src_r1
[1], src_r1
[0], 1);
1784 dst0
[3] = src_r0
[0];
1785 dst1
[0] = src_r0
[1];
1786 dst1
[1] = src_r0
[2];
1787 dst1
[2] = src_r0
[3];
1788 dst1
[3] = src_r1
[0];
1794 dst1
[0] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1795 dst1
[1] = amd_bytealign (src_r0
[2], src_r0
[1], 3);
1796 dst1
[2] = amd_bytealign (src_r0
[3], src_r0
[2], 3);
1797 dst1
[3] = amd_bytealign (src_r1
[0], src_r0
[3], 3);
1803 dst1
[0] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1804 dst1
[1] = amd_bytealign (src_r0
[2], src_r0
[1], 2);
1805 dst1
[2] = amd_bytealign (src_r0
[3], src_r0
[2], 2);
1806 dst1
[3] = amd_bytealign (src_r1
[0], src_r0
[3], 2);
1812 dst1
[0] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1813 dst1
[1] = amd_bytealign (src_r0
[2], src_r0
[1], 1);
1814 dst1
[2] = amd_bytealign (src_r0
[3], src_r0
[2], 1);
1815 dst1
[3] = amd_bytealign (src_r1
[0], src_r0
[3], 1);
1819 dst1
[0] = src_r0
[0];
1820 dst1
[1] = src_r0
[1];
1821 dst1
[2] = src_r0
[2];
1822 dst1
[3] = src_r0
[3];
1828 dst1
[1] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1829 dst1
[2] = amd_bytealign (src_r0
[2], src_r0
[1], 3);
1830 dst1
[3] = amd_bytealign (src_r0
[3], src_r0
[2], 3);
1836 dst1
[1] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1837 dst1
[2] = amd_bytealign (src_r0
[2], src_r0
[1], 2);
1838 dst1
[3] = amd_bytealign (src_r0
[3], src_r0
[2], 2);
1844 dst1
[1] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1845 dst1
[2] = amd_bytealign (src_r0
[2], src_r0
[1], 1);
1846 dst1
[3] = amd_bytealign (src_r0
[3], src_r0
[2], 1);
1850 dst1
[1] = src_r0
[0];
1851 dst1
[2] = src_r0
[1];
1852 dst1
[3] = src_r0
[2];
1858 dst1
[2] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1859 dst1
[3] = amd_bytealign (src_r0
[2], src_r0
[1], 3);
1865 dst1
[2] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1866 dst1
[3] = amd_bytealign (src_r0
[2], src_r0
[1], 2);
1872 dst1
[2] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1873 dst1
[3] = amd_bytealign (src_r0
[2], src_r0
[1], 1);
1877 dst1
[2] = src_r0
[0];
1878 dst1
[3] = src_r0
[1];
1884 dst1
[3] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1890 dst1
[3] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1896 dst1
[3] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1900 dst1
[3] = src_r0
[0];
1921 static void reverse_block (u32 in0
[4], u32 in1
[4], u32 out0
[4], u32 out1
[4], const u32 len
)
1923 rshift_block_N (in0
, in1
, out0
, out1
, 32 - len
);
1937 out0
[0] = swap32 (tib40
[0]);
1938 out0
[1] = swap32 (tib40
[1]);
1939 out0
[2] = swap32 (tib40
[2]);
1940 out0
[3] = swap32 (tib40
[3]);
1941 out1
[0] = swap32 (tib41
[0]);
1942 out1
[1] = swap32 (tib41
[1]);
1943 out1
[2] = swap32 (tib41
[2]);
1944 out1
[3] = swap32 (tib41
[3]);
1947 static u32
rule_op_mangle_lrest (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1949 buf0
[0] |= (generate_cmask (buf0
[0]));
1950 buf0
[1] |= (generate_cmask (buf0
[1]));
1951 buf0
[2] |= (generate_cmask (buf0
[2]));
1952 buf0
[3] |= (generate_cmask (buf0
[3]));
1953 buf1
[0] |= (generate_cmask (buf1
[0]));
1954 buf1
[1] |= (generate_cmask (buf1
[1]));
1955 buf1
[2] |= (generate_cmask (buf1
[2]));
1956 buf1
[3] |= (generate_cmask (buf1
[3]));
1961 static u32
rule_op_mangle_urest (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1963 buf0
[0] &= ~(generate_cmask (buf0
[0]));
1964 buf0
[1] &= ~(generate_cmask (buf0
[1]));
1965 buf0
[2] &= ~(generate_cmask (buf0
[2]));
1966 buf0
[3] &= ~(generate_cmask (buf0
[3]));
1967 buf1
[0] &= ~(generate_cmask (buf1
[0]));
1968 buf1
[1] &= ~(generate_cmask (buf1
[1]));
1969 buf1
[2] &= ~(generate_cmask (buf1
[2]));
1970 buf1
[3] &= ~(generate_cmask (buf1
[3]));
1975 static u32
rule_op_mangle_lrest_ufirst (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1977 rule_op_mangle_lrest (p0
, p1
, buf0
, buf1
, in_len
);
1979 buf0
[0] &= ~(0x00000020 & generate_cmask (buf0
[0]));
1984 static u32
rule_op_mangle_urest_lfirst (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1986 rule_op_mangle_urest (p0
, p1
, buf0
, buf1
, in_len
);
1988 buf0
[0] |= (0x00000020 & generate_cmask (buf0
[0]));
1993 static u32
rule_op_mangle_trest (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1995 buf0
[0] ^= (generate_cmask (buf0
[0]));
1996 buf0
[1] ^= (generate_cmask (buf0
[1]));
1997 buf0
[2] ^= (generate_cmask (buf0
[2]));
1998 buf0
[3] ^= (generate_cmask (buf0
[3]));
1999 buf1
[0] ^= (generate_cmask (buf1
[0]));
2000 buf1
[1] ^= (generate_cmask (buf1
[1]));
2001 buf1
[2] ^= (generate_cmask (buf1
[2]));
2002 buf1
[3] ^= (generate_cmask (buf1
[3]));
2007 static u32
rule_op_mangle_toggle_at (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2009 if (p0
>= in_len
) return (in_len
);
2011 const u32 tmp
= 0x20 << ((p0
& 3) * 8);
2015 case 0: buf0
[0] ^= (tmp
& generate_cmask (buf0
[0])); break;
2016 case 1: buf0
[1] ^= (tmp
& generate_cmask (buf0
[1])); break;
2017 case 2: buf0
[2] ^= (tmp
& generate_cmask (buf0
[2])); break;
2018 case 3: buf0
[3] ^= (tmp
& generate_cmask (buf0
[3])); break;
2019 case 4: buf1
[0] ^= (tmp
& generate_cmask (buf1
[0])); break;
2020 case 5: buf1
[1] ^= (tmp
& generate_cmask (buf1
[1])); break;
2021 case 6: buf1
[2] ^= (tmp
& generate_cmask (buf1
[2])); break;
2022 case 7: buf1
[3] ^= (tmp
& generate_cmask (buf1
[3])); break;
2028 static u32
rule_op_mangle_reverse (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2030 reverse_block (buf0
, buf1
, buf0
, buf1
, in_len
);
2035 static u32
rule_op_mangle_dupeword (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2037 if ((in_len
+ in_len
) >= 32) return (in_len
);
2039 u32 out_len
= in_len
;
2053 append_block8 (out_len
, buf0
, buf1
, buf0
, buf1
, tib40
, tib41
);
2060 static u32
rule_op_mangle_dupeword_times (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2062 if (((in_len
* p0
) + in_len
) >= 32) return (in_len
);
2064 u32 out_len
= in_len
;
2078 for (u32 i
= 0; i
< p0
; i
++)
2080 append_block8 (out_len
, buf0
, buf1
, buf0
, buf1
, tib40
, tib41
);
2088 static u32
rule_op_mangle_reflect (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2090 if ((in_len
+ in_len
) >= 32) return (in_len
);
2092 u32 out_len
= in_len
;
2097 reverse_block (buf0
, buf1
, tib40
, tib41
, out_len
);
2099 append_block8 (out_len
, buf0
, buf1
, buf0
, buf1
, tib40
, tib41
);
2106 static u32
rule_op_mangle_append (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2108 if ((in_len
+ 1) >= 32) return (in_len
);
2110 u32 out_len
= in_len
;
2112 append_block1 (out_len
, buf0
, buf1
, p0
);
2119 static u32
rule_op_mangle_prepend (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2121 if ((in_len
+ 1) >= 32) return (in_len
);
2123 u32 out_len
= in_len
;
2125 rshift_block (buf0
, buf1
, buf0
, buf1
);
2127 buf0
[0] = buf0
[0] | p0
;
2134 static u32
rule_op_mangle_rotate_left (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2136 if (in_len
== 0) return (in_len
);
2138 const u32 in_len1
= in_len
- 1;
2140 const u32 sh
= (in_len1
& 3) * 8;
2142 const u32 tmp
= (buf0
[0] & 0xff) << sh
;
2144 lshift_block (buf0
, buf1
, buf0
, buf1
);
2146 switch (in_len1
/ 4)
2148 case 0: buf0
[0] |= tmp
; break;
2149 case 1: buf0
[1] |= tmp
; break;
2150 case 2: buf0
[2] |= tmp
; break;
2151 case 3: buf0
[3] |= tmp
; break;
2152 case 4: buf1
[0] |= tmp
; break;
2153 case 5: buf1
[1] |= tmp
; break;
2154 case 6: buf1
[2] |= tmp
; break;
2155 case 7: buf1
[3] |= tmp
; break;
2161 static u32
rule_op_mangle_rotate_right (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2163 if (in_len
== 0) return (in_len
);
2165 const u32 in_len1
= in_len
- 1;
2167 const u32 sh
= (in_len1
& 3) * 8;
2171 switch (in_len1
/ 4)
2173 case 0: tmp
= (buf0
[0] >> sh
) & 0xff; break;
2174 case 1: tmp
= (buf0
[1] >> sh
) & 0xff; break;
2175 case 2: tmp
= (buf0
[2] >> sh
) & 0xff; break;
2176 case 3: tmp
= (buf0
[3] >> sh
) & 0xff; break;
2177 case 4: tmp
= (buf1
[0] >> sh
) & 0xff; break;
2178 case 5: tmp
= (buf1
[1] >> sh
) & 0xff; break;
2179 case 6: tmp
= (buf1
[2] >> sh
) & 0xff; break;
2180 case 7: tmp
= (buf1
[3] >> sh
) & 0xff; break;
2183 rshift_block (buf0
, buf1
, buf0
, buf1
);
2187 truncate_right (buf0
, buf1
, in_len
);
2192 static u32
rule_op_mangle_delete_first (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2194 if (in_len
== 0) return (in_len
);
2196 const u32 in_len1
= in_len
- 1;
2198 lshift_block (buf0
, buf1
, buf0
, buf1
);
2203 static u32
rule_op_mangle_delete_last (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2205 if (in_len
== 0) return (in_len
);
2207 const u32 in_len1
= in_len
- 1;
2209 const u32 tmp
= (1 << ((in_len1
& 3) * 8)) - 1;
2211 switch (in_len1
/ 4)
2213 case 0: buf0
[0] &= tmp
; break;
2214 case 1: buf0
[1] &= tmp
; break;
2215 case 2: buf0
[2] &= tmp
; break;
2216 case 3: buf0
[3] &= tmp
; break;
2217 case 4: buf1
[0] &= tmp
; break;
2218 case 5: buf1
[1] &= tmp
; break;
2219 case 6: buf1
[2] &= tmp
; break;
2220 case 7: buf1
[3] &= tmp
; break;
2226 static u32
rule_op_mangle_delete_at (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2228 if (p0
>= in_len
) return (in_len
);
2230 u32 out_len
= in_len
;
2235 lshift_block (buf0
, buf1
, tib40
, tib41
);
2237 const u32 ml
= (1 << ((p0
& 3) * 8)) - 1;
2242 case 0: buf0
[0] = (buf0
[0] & ml
)
2252 case 1: buf0
[1] = (buf0
[1] & ml
)
2261 case 2: buf0
[2] = (buf0
[2] & ml
)
2269 case 3: buf0
[3] = (buf0
[3] & ml
)
2276 case 4: buf1
[0] = (buf1
[0] & ml
)
2282 case 5: buf1
[1] = (buf1
[1] & ml
)
2287 case 6: buf1
[2] = (buf1
[2] & ml
)
2291 case 7: buf1
[3] = (buf1
[3] & ml
)
2301 static u32
rule_op_mangle_extract (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2303 if (p0
>= in_len
) return (in_len
);
2305 if ((p0
+ p1
) > in_len
) return (in_len
);
2309 lshift_block_N (buf0
, buf1
, buf0
, buf1
, p0
);
2311 truncate_right (buf0
, buf1
, out_len
);
2316 static u32
rule_op_mangle_omit (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2318 if (p0
>= in_len
) return (in_len
);
2320 if ((p0
+ p1
) > in_len
) return (in_len
);
2322 u32 out_len
= in_len
;
2336 lshift_block_N (buf0
, buf1
, tib40
, tib41
, p1
);
2338 const u32 ml
= (1 << ((p0
& 3) * 8)) - 1;
2343 case 0: buf0
[0] = (buf0
[0] & ml
)
2353 case 1: buf0
[1] = (buf0
[1] & ml
)
2362 case 2: buf0
[2] = (buf0
[2] & ml
)
2370 case 3: buf0
[3] = (buf0
[3] & ml
)
2377 case 4: buf1
[0] = (buf1
[0] & ml
)
2383 case 5: buf1
[1] = (buf1
[1] & ml
)
2388 case 6: buf1
[2] = (buf1
[2] & ml
)
2392 case 7: buf1
[3] = (buf1
[3] & ml
)
2402 static u32
rule_op_mangle_insert (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2404 if (p0
> in_len
) return (in_len
);
2406 if ((in_len
+ 1) >= 32) return (in_len
);
2408 u32 out_len
= in_len
;
2413 rshift_block (buf0
, buf1
, tib40
, tib41
);
2415 const u32 p1n
= p1
<< ((p0
& 3) * 8);
2417 const u32 ml
= (1 << ((p0
& 3) * 8)) - 1;
2419 const u32 mr
= 0xffffff00 << ((p0
& 3) * 8);
2423 case 0: buf0
[0] = (buf0
[0] & ml
) | p1n
| (tib40
[0] & mr
);
2432 case 1: buf0
[1] = (buf0
[1] & ml
) | p1n
| (tib40
[1] & mr
);
2440 case 2: buf0
[2] = (buf0
[2] & ml
) | p1n
| (tib40
[2] & mr
);
2447 case 3: buf0
[3] = (buf0
[3] & ml
) | p1n
| (tib40
[3] & mr
);
2453 case 4: buf1
[0] = (buf1
[0] & ml
) | p1n
| (tib41
[0] & mr
);
2458 case 5: buf1
[1] = (buf1
[1] & ml
) | p1n
| (tib41
[1] & mr
);
2462 case 6: buf1
[2] = (buf1
[2] & ml
) | p1n
| (tib41
[2] & mr
);
2465 case 7: buf1
[3] = (buf1
[3] & ml
) | p1n
| (tib41
[3] & mr
);
2474 static u32
rule_op_mangle_overstrike (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2476 if (p0
>= in_len
) return (in_len
);
2478 const u32 p1n
= p1
<< ((p0
& 3) * 8);
2480 const u32 m
= ~(0xff << ((p0
& 3) * 8));
2484 case 0: buf0
[0] = (buf0
[0] & m
) | p1n
; break;
2485 case 1: buf0
[1] = (buf0
[1] & m
) | p1n
; break;
2486 case 2: buf0
[2] = (buf0
[2] & m
) | p1n
; break;
2487 case 3: buf0
[3] = (buf0
[3] & m
) | p1n
; break;
2488 case 4: buf1
[0] = (buf1
[0] & m
) | p1n
; break;
2489 case 5: buf1
[1] = (buf1
[1] & m
) | p1n
; break;
2490 case 6: buf1
[2] = (buf1
[2] & m
) | p1n
; break;
2491 case 7: buf1
[3] = (buf1
[3] & m
) | p1n
; break;
2497 static u32
rule_op_mangle_truncate_at (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2499 if (p0
>= in_len
) return (in_len
);
2501 truncate_right (buf0
, buf1
, p0
);
2506 static u32
rule_op_mangle_replace (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2509 for (u32 i
= 0; i
< in_len
; i
++)
2513 case 0: if ((__byte_perm (buf0
[0], 0, 0x6540)) == p0
) buf0
[0] = __byte_perm (p1
, buf0
[0], 0x7650);
2515 case 1: if ((__byte_perm (buf0
[0], 0, 0x6541)) == p0
) buf0
[0] = __byte_perm (p1
, buf0
[0], 0x7604);
2517 case 2: if ((__byte_perm (buf0
[0], 0, 0x6542)) == p0
) buf0
[0] = __byte_perm (p1
, buf0
[0], 0x7054);
2519 case 3: if ((__byte_perm (buf0
[0], 0, 0x6543)) == p0
) buf0
[0] = __byte_perm (p1
, buf0
[0], 0x0654);
2521 case 4: if ((__byte_perm (buf0
[1], 0, 0x6540)) == p0
) buf0
[1] = __byte_perm (p1
, buf0
[1], 0x7650);
2523 case 5: if ((__byte_perm (buf0
[1], 0, 0x6541)) == p0
) buf0
[1] = __byte_perm (p1
, buf0
[1], 0x7604);
2525 case 6: if ((__byte_perm (buf0
[1], 0, 0x6542)) == p0
) buf0
[1] = __byte_perm (p1
, buf0
[1], 0x7054);
2527 case 7: if ((__byte_perm (buf0
[1], 0, 0x6543)) == p0
) buf0
[1] = __byte_perm (p1
, buf0
[1], 0x0654);
2529 case 8: if ((__byte_perm (buf0
[2], 0, 0x6540)) == p0
) buf0
[2] = __byte_perm (p1
, buf0
[2], 0x7650);
2531 case 9: if ((__byte_perm (buf0
[2], 0, 0x6541)) == p0
) buf0
[2] = __byte_perm (p1
, buf0
[2], 0x7604);
2533 case 10: if ((__byte_perm (buf0
[2], 0, 0x6542)) == p0
) buf0
[2] = __byte_perm (p1
, buf0
[2], 0x7054);
2535 case 11: if ((__byte_perm (buf0
[2], 0, 0x6543)) == p0
) buf0
[2] = __byte_perm (p1
, buf0
[2], 0x0654);
2537 case 12: if ((__byte_perm (buf0
[3], 0, 0x6540)) == p0
) buf0
[3] = __byte_perm (p1
, buf0
[3], 0x7650);
2539 case 13: if ((__byte_perm (buf0
[3], 0, 0x6541)) == p0
) buf0
[3] = __byte_perm (p1
, buf0
[3], 0x7604);
2541 case 14: if ((__byte_perm (buf0
[3], 0, 0x6542)) == p0
) buf0
[3] = __byte_perm (p1
, buf0
[3], 0x7054);
2543 case 15: if ((__byte_perm (buf0
[3], 0, 0x6543)) == p0
) buf0
[3] = __byte_perm (p1
, buf0
[3], 0x0654);
2545 case 16: if ((__byte_perm (buf1
[0], 0, 0x6540)) == p0
) buf1
[0] = __byte_perm (p1
, buf1
[0], 0x7650);
2547 case 17: if ((__byte_perm (buf1
[0], 0, 0x6541)) == p0
) buf1
[0] = __byte_perm (p1
, buf1
[0], 0x7604);
2549 case 18: if ((__byte_perm (buf1
[0], 0, 0x6542)) == p0
) buf1
[0] = __byte_perm (p1
, buf1
[0], 0x7054);
2551 case 19: if ((__byte_perm (buf1
[0], 0, 0x6543)) == p0
) buf1
[0] = __byte_perm (p1
, buf1
[0], 0x0654);
2553 case 20: if ((__byte_perm (buf1
[1], 0, 0x6540)) == p0
) buf1
[1] = __byte_perm (p1
, buf1
[1], 0x7650);
2555 case 21: if ((__byte_perm (buf1
[1], 0, 0x6541)) == p0
) buf1
[1] = __byte_perm (p1
, buf1
[1], 0x7604);
2557 case 22: if ((__byte_perm (buf1
[1], 0, 0x6542)) == p0
) buf1
[1] = __byte_perm (p1
, buf1
[1], 0x7054);
2559 case 23: if ((__byte_perm (buf1
[1], 0, 0x6543)) == p0
) buf1
[1] = __byte_perm (p1
, buf1
[1], 0x0654);
2561 case 24: if ((__byte_perm (buf1
[2], 0, 0x6540)) == p0
) buf1
[2] = __byte_perm (p1
, buf1
[2], 0x7650);
2563 case 25: if ((__byte_perm (buf1
[2], 0, 0x6541)) == p0
) buf1
[2] = __byte_perm (p1
, buf1
[2], 0x7604);
2565 case 26: if ((__byte_perm (buf1
[2], 0, 0x6542)) == p0
) buf1
[2] = __byte_perm (p1
, buf1
[2], 0x7054);
2567 case 27: if ((__byte_perm (buf1
[2], 0, 0x6543)) == p0
) buf1
[2] = __byte_perm (p1
, buf1
[2], 0x0654);
2569 case 28: if ((__byte_perm (buf1
[3], 0, 0x6540)) == p0
) buf1
[3] = __byte_perm (p1
, buf1
[3], 0x7650);
2571 case 29: if ((__byte_perm (buf1
[3], 0, 0x6541)) == p0
) buf1
[3] = __byte_perm (p1
, buf1
[3], 0x7604);
2573 case 30: if ((__byte_perm (buf1
[3], 0, 0x6542)) == p0
) buf1
[3] = __byte_perm (p1
, buf1
[3], 0x7054);
2575 case 31: if ((__byte_perm (buf1
[3], 0, 0x6543)) == p0
) buf1
[3] = __byte_perm (p1
, buf1
[3], 0x0654);
2581 #if defined IS_AMD || defined IS_GENERIC
2582 const uchar4 tmp0
= (uchar4
) (p0
);
2583 const uchar4 tmp1
= (uchar4
) (p1
);
2587 tmp
= as_uchar4 (buf0
[0]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf0
[0] = as_uint (tmp
);
2588 tmp
= as_uchar4 (buf0
[1]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf0
[1] = as_uint (tmp
);
2589 tmp
= as_uchar4 (buf0
[2]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf0
[2] = as_uint (tmp
);
2590 tmp
= as_uchar4 (buf0
[3]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf0
[3] = as_uint (tmp
);
2591 tmp
= as_uchar4 (buf1
[0]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf1
[0] = as_uint (tmp
);
2592 tmp
= as_uchar4 (buf1
[1]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf1
[1] = as_uint (tmp
);
2593 tmp
= as_uchar4 (buf1
[2]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf1
[2] = as_uint (tmp
);
2594 tmp
= as_uchar4 (buf1
[3]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf1
[3] = as_uint (tmp
);
2600 static u32
rule_op_mangle_purgechar (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2606 static u32
rule_op_mangle_togglecase_rec (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2612 static u32
rule_op_mangle_dupechar_first (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2614 if ( in_len
== 0) return (in_len
);
2615 if ((in_len
+ p0
) >= 32) return (in_len
);
2617 u32 out_len
= in_len
;
2619 const u32 tmp
= buf0
[0] & 0xFF;
2621 rshift_block_N (buf0
, buf1
, buf0
, buf1
, p0
);
2626 case 1: buf0
[0] |= tmp
;
2628 case 2: buf0
[0] |= __byte_perm (tmp
, 0, 0x5400);
2630 case 3: buf0
[0] |= __byte_perm (tmp
, 0, 0x4000);
2632 case 4: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2634 case 5: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2637 case 6: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2638 buf0
[1] |= __byte_perm (tmp
, 0, 0x5400);
2640 case 7: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2641 buf0
[1] |= __byte_perm (tmp
, 0, 0x4000);
2643 case 8: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2644 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2646 case 9: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2647 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2650 case 10: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2651 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2652 buf0
[2] |= __byte_perm (tmp
, 0, 0x5400);
2654 case 11: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2655 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2656 buf0
[2] |= __byte_perm (tmp
, 0, 0x4000);
2658 case 12: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2659 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2660 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2662 case 13: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2663 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2664 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2667 case 14: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2668 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2669 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2670 buf0
[3] |= __byte_perm (tmp
, 0, 0x5400);
2672 case 15: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2673 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2674 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2675 buf0
[3] |= __byte_perm (tmp
, 0, 0x4000);
2677 case 16: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2678 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2679 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2680 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2682 case 17: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2683 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2684 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2685 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2688 case 18: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2689 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2690 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2691 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2692 buf1
[0] |= __byte_perm (tmp
, 0, 0x5400);
2694 case 19: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2695 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2696 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2697 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2698 buf1
[0] |= __byte_perm (tmp
, 0, 0x4000);
2700 case 20: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2701 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2702 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2703 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2704 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2706 case 21: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2707 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2708 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2709 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2710 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2713 case 22: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2714 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2715 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2716 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2717 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2718 buf1
[1] |= __byte_perm (tmp
, 0, 0x5400);
2720 case 23: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2721 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2722 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2723 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2724 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2725 buf1
[1] |= __byte_perm (tmp
, 0, 0x4000);
2727 case 24: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2728 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2729 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2730 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2731 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2732 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2734 case 25: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2735 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2736 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2737 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2738 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2739 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2742 case 26: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2743 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2744 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2745 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2746 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2747 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2748 buf1
[2] |= __byte_perm (tmp
, 0, 0x5400);
2750 case 27: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2751 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2752 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2753 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2754 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2755 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2756 buf1
[2] |= __byte_perm (tmp
, 0, 0x4000);
2758 case 28: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2759 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2760 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2761 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2762 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2763 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2764 buf1
[2] |= __byte_perm (tmp
, 0, 0x0000);
2766 case 29: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2767 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2768 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2769 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2770 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2771 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2772 buf1
[2] |= __byte_perm (tmp
, 0, 0x0000);
2775 case 30: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2776 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2777 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2778 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2779 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2780 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2781 buf1
[2] |= __byte_perm (tmp
, 0, 0x0000);
2782 buf1
[3] |= __byte_perm (tmp
, 0, 0x5400);
2784 case 31: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2785 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2786 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2787 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2788 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2789 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2790 buf1
[2] |= __byte_perm (tmp
, 0, 0x0000);
2791 buf1
[3] |= __byte_perm (tmp
, 0, 0x4000);
2796 #if defined IS_AMD || defined IS_GENERIC
2799 case 1: buf0
[0] |= tmp
<< 0;
2801 case 2: buf0
[0] |= tmp
<< 0 | tmp
<< 8;
2803 case 3: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2805 case 4: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2807 case 5: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2808 buf0
[1] |= tmp
<< 0;
2810 case 6: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2811 buf0
[1] |= tmp
<< 0 | tmp
<< 8;
2813 case 7: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2814 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2816 case 8: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2817 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2819 case 9: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2820 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2821 buf0
[2] |= tmp
<< 0;
2823 case 10: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2824 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2825 buf0
[2] |= tmp
<< 0 | tmp
<< 8;
2827 case 11: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2828 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2829 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2831 case 12: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2832 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2833 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2835 case 13: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2836 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2837 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2838 buf0
[3] |= tmp
<< 0;
2840 case 14: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2841 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2842 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2843 buf0
[3] |= tmp
<< 0 | tmp
<< 8;
2845 case 15: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2846 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2847 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2848 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2850 case 16: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2851 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2852 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2853 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2855 case 17: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2856 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2857 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2858 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2859 buf1
[0] |= tmp
<< 0;
2861 case 18: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2862 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2863 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2864 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2865 buf1
[0] |= tmp
<< 0 | tmp
<< 8;
2867 case 19: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2868 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2869 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2870 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2871 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2873 case 20: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2874 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2875 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2876 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2877 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2879 case 21: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2880 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2881 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2882 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2883 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2884 buf1
[1] |= tmp
<< 0;
2886 case 22: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2887 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2888 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2889 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2890 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2891 buf1
[1] |= tmp
<< 0 | tmp
<< 8;
2893 case 23: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2894 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2895 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2896 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2897 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2898 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2900 case 24: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2901 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2902 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2903 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2904 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2905 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2907 case 25: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2908 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2909 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2910 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2911 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2912 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2913 buf1
[2] |= tmp
<< 0;
2915 case 26: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2916 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2917 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2918 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2919 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2920 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2921 buf1
[2] |= tmp
<< 0 | tmp
<< 8;
2923 case 27: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2924 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2925 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2926 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2927 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2928 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2929 buf1
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2931 case 28: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2932 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2933 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2934 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2935 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2936 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2937 buf1
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2939 case 29: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2940 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2941 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2942 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2943 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2944 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2945 buf1
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2946 buf1
[3] |= tmp
<< 0;
2948 case 30: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2949 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2950 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2951 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2952 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2953 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2954 buf1
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2955 buf1
[3] |= tmp
<< 0 | tmp
<< 8;
2957 case 31: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2958 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2959 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2960 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2961 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2962 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2963 buf1
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2964 buf1
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2974 static u32
rule_op_mangle_dupechar_last (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2976 if ( in_len
== 0) return (in_len
);
2977 if ((in_len
+ p0
) >= 32) return (in_len
);
2979 const u32 in_len1
= in_len
- 1;
2981 const u32 sh
= (in_len1
& 3) * 8;
2985 switch (in_len1
/ 4)
2987 case 0: tmp
= (buf0
[0] >> sh
) & 0xff; break;
2988 case 1: tmp
= (buf0
[1] >> sh
) & 0xff; break;
2989 case 2: tmp
= (buf0
[2] >> sh
) & 0xff; break;
2990 case 3: tmp
= (buf0
[3] >> sh
) & 0xff; break;
2991 case 4: tmp
= (buf1
[0] >> sh
) & 0xff; break;
2992 case 5: tmp
= (buf1
[1] >> sh
) & 0xff; break;
2993 case 6: tmp
= (buf1
[2] >> sh
) & 0xff; break;
2994 case 7: tmp
= (buf1
[3] >> sh
) & 0xff; break;
2997 u32 out_len
= in_len
;
2999 for (u32 i
= 0; i
< p0
; i
++)
3001 append_block1 (out_len
, buf0
, buf1
, tmp
);
3009 static u32
rule_op_mangle_dupechar_all (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3011 if ( in_len
== 0) return (in_len
);
3012 if ((in_len
+ in_len
) >= 32) return (in_len
);
3014 u32 out_len
= in_len
;
3020 tib40
[0] = __byte_perm (buf0
[0], 0, 0x1100);
3021 tib40
[1] = __byte_perm (buf0
[0], 0, 0x3322);
3022 tib40
[2] = __byte_perm (buf0
[1], 0, 0x1100);
3023 tib40
[3] = __byte_perm (buf0
[1], 0, 0x3322);
3024 tib41
[0] = __byte_perm (buf0
[2], 0, 0x1100);
3025 tib41
[1] = __byte_perm (buf0
[2], 0, 0x3322);
3026 tib41
[2] = __byte_perm (buf0
[3], 0, 0x1100);
3027 tib41
[3] = __byte_perm (buf0
[3], 0, 0x3322);
3039 #if defined IS_AMD || defined IS_GENERIC
3040 tib40
[0] = ((buf0
[0] & 0x000000FF) << 0) | ((buf0
[0] & 0x0000FF00) << 8);
3041 tib40
[1] = ((buf0
[0] & 0x00FF0000) >> 16) | ((buf0
[0] & 0xFF000000) >> 8);
3042 tib40
[2] = ((buf0
[1] & 0x000000FF) << 0) | ((buf0
[1] & 0x0000FF00) << 8);
3043 tib40
[3] = ((buf0
[1] & 0x00FF0000) >> 16) | ((buf0
[1] & 0xFF000000) >> 8);
3044 tib41
[0] = ((buf0
[2] & 0x000000FF) << 0) | ((buf0
[2] & 0x0000FF00) << 8);
3045 tib41
[1] = ((buf0
[2] & 0x00FF0000) >> 16) | ((buf0
[2] & 0xFF000000) >> 8);
3046 tib41
[2] = ((buf0
[3] & 0x000000FF) << 0) | ((buf0
[3] & 0x0000FF00) << 8);
3047 tib41
[3] = ((buf0
[3] & 0x00FF0000) >> 16) | ((buf0
[3] & 0xFF000000) >> 8);
3049 buf0
[0] = tib40
[0] | (tib40
[0] << 8);
3050 buf0
[1] = tib40
[1] | (tib40
[1] << 8);
3051 buf0
[2] = tib40
[2] | (tib40
[2] << 8);
3052 buf0
[3] = tib40
[3] | (tib40
[3] << 8);
3053 buf1
[0] = tib41
[0] | (tib41
[0] << 8);
3054 buf1
[1] = tib41
[1] | (tib41
[1] << 8);
3055 buf1
[2] = tib41
[2] | (tib41
[2] << 8);
3056 buf1
[3] = tib41
[3] | (tib41
[3] << 8);
3059 out_len
= out_len
+ out_len
;
3064 static u32
rule_op_mangle_switch_first (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3066 if (in_len
< 2) return (in_len
);
3069 buf0
[0] = __byte_perm (buf0
[0], 0, 0x3201);
3072 #if defined IS_AMD || defined IS_GENERIC
3073 buf0
[0] = (buf0
[0] & 0xFFFF0000) | ((buf0
[0] << 8) & 0x0000FF00) | ((buf0
[0] >> 8) & 0x000000FF);
3079 static u32
rule_op_mangle_switch_last (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3081 if (in_len
< 2) return (in_len
);
3086 case 2: buf0
[0] = __byte_perm (buf0
[0], 0, 0x5401);
3088 case 3: buf0
[0] = __byte_perm (buf0
[0], 0, 0x4120);
3090 case 4: buf0
[0] = __byte_perm (buf0
[0], 0, 0x2310);
3092 case 5: buf0
[1] = __byte_perm (buf0
[1], buf0
[0], 0x7210);
3093 buf0
[0] = __byte_perm (buf0
[0], buf0
[1], 0x4210);
3094 buf0
[1] = __byte_perm (buf0
[1], 0, 0x6543);
3096 case 6: buf0
[1] = __byte_perm (buf0
[1], 0, 0x5401);
3098 case 7: buf0
[1] = __byte_perm (buf0
[1], 0, 0x4120);
3100 case 8: buf0
[1] = __byte_perm (buf0
[1], 0, 0x2310);
3102 case 9: buf0
[2] = __byte_perm (buf0
[2], buf0
[1], 0x7210);
3103 buf0
[1] = __byte_perm (buf0
[1], buf0
[2], 0x4210);
3104 buf0
[2] = __byte_perm (buf0
[2], 0, 0x6543);
3106 case 10: buf0
[2] = __byte_perm (buf0
[2], 0, 0x5401);
3108 case 11: buf0
[2] = __byte_perm (buf0
[2], 0, 0x4120);
3110 case 12: buf0
[2] = __byte_perm (buf0
[2], 0, 0x2310);
3112 case 13: buf0
[3] = __byte_perm (buf0
[3], buf0
[2], 0x7210);
3113 buf0
[2] = __byte_perm (buf0
[2], buf0
[3], 0x4210);
3114 buf0
[3] = __byte_perm (buf0
[3], 0, 0x6543);
3116 case 14: buf0
[3] = __byte_perm (buf0
[3], 0, 0x5401);
3118 case 15: buf0
[3] = __byte_perm (buf0
[3], 0, 0x4120);
3120 case 16: buf0
[3] = __byte_perm (buf0
[3], 0, 0x2310);
3122 case 17: buf1
[0] = __byte_perm (buf1
[0], buf0
[3], 0x7210);
3123 buf0
[3] = __byte_perm (buf0
[3], buf1
[0], 0x4210);
3124 buf1
[0] = __byte_perm (buf1
[0], 0, 0x6543);
3126 case 18: buf1
[0] = __byte_perm (buf1
[0], 0, 0x5401);
3128 case 19: buf1
[0] = __byte_perm (buf1
[0], 0, 0x4120);
3130 case 20: buf1
[0] = __byte_perm (buf1
[0], 0, 0x2310);
3132 case 21: buf1
[1] = __byte_perm (buf1
[1], buf1
[0], 0x7210);
3133 buf1
[0] = __byte_perm (buf1
[0], buf1
[1], 0x4210);
3134 buf1
[1] = __byte_perm (buf1
[1], 0, 0x6543);
3136 case 22: buf1
[1] = __byte_perm (buf1
[1], 0, 0x5401);
3138 case 23: buf1
[1] = __byte_perm (buf1
[1], 0, 0x4120);
3140 case 24: buf1
[1] = __byte_perm (buf1
[1], 0, 0x2310);
3142 case 25: buf1
[2] = __byte_perm (buf1
[2], buf1
[1], 0x7210);
3143 buf1
[1] = __byte_perm (buf1
[1], buf1
[2], 0x4210);
3144 buf1
[2] = __byte_perm (buf1
[2], 0, 0x6543);
3146 case 26: buf1
[2] = __byte_perm (buf1
[2], 0, 0x5401);
3148 case 27: buf1
[2] = __byte_perm (buf1
[2], 0, 0x4120);
3150 case 28: buf1
[2] = __byte_perm (buf1
[2], 0, 0x2310);
3152 case 29: buf1
[3] = __byte_perm (buf1
[3], buf1
[2], 0x7210);
3153 buf1
[2] = __byte_perm (buf1
[2], buf1
[3], 0x4210);
3154 buf1
[3] = __byte_perm (buf1
[3], 0, 0x6543);
3156 case 30: buf1
[3] = __byte_perm (buf1
[3], 0, 0x5401);
3158 case 31: buf1
[3] = __byte_perm (buf1
[3], 0, 0x4120);
3163 #if defined IS_AMD || defined IS_GENERIC
3166 case 2: buf0
[0] = ((buf0
[0] << 8) & 0x0000FF00) | ((buf0
[0] >> 8) & 0x000000FF);
3168 case 3: buf0
[0] = (buf0
[0] & 0x000000FF) | ((buf0
[0] << 8) & 0x00FF0000) | ((buf0
[0] >> 8) & 0x0000FF00);
3170 case 4: buf0
[0] = (buf0
[0] & 0x0000FFFF) | ((buf0
[0] << 8) & 0xFF000000) | ((buf0
[0] >> 8) & 0x00FF0000);
3172 case 5: buf0
[1] = (buf0
[0] & 0xFF000000) | buf0
[1];
3173 buf0
[0] = (buf0
[0] & 0x00FFFFFF) | (buf0
[1] << 24);
3174 buf0
[1] = (buf0
[1] >> 24);
3176 case 6: buf0
[1] = ((buf0
[1] << 8) & 0x0000FF00) | ((buf0
[1] >> 8) & 0x000000FF);
3178 case 7: buf0
[1] = (buf0
[1] & 0x000000FF) | ((buf0
[1] << 8) & 0x00FF0000) | ((buf0
[1] >> 8) & 0x0000FF00);
3180 case 8: buf0
[1] = (buf0
[1] & 0x0000FFFF) | ((buf0
[1] << 8) & 0xFF000000) | ((buf0
[1] >> 8) & 0x00FF0000);
3182 case 9: buf0
[2] = (buf0
[1] & 0xFF000000) | buf0
[2];
3183 buf0
[1] = (buf0
[1] & 0x00FFFFFF) | (buf0
[2] << 24);
3184 buf0
[2] = (buf0
[2] >> 24);
3186 case 10: buf0
[2] = ((buf0
[2] << 8) & 0x0000FF00) | ((buf0
[2] >> 8) & 0x000000FF);
3188 case 11: buf0
[2] = (buf0
[2] & 0x000000FF) | ((buf0
[2] << 8) & 0x00FF0000) | ((buf0
[2] >> 8) & 0x0000FF00);
3190 case 12: buf0
[2] = (buf0
[2] & 0x0000FFFF) | ((buf0
[2] << 8) & 0xFF000000) | ((buf0
[2] >> 8) & 0x00FF0000);
3192 case 13: buf0
[3] = (buf0
[2] & 0xFF000000) | buf0
[3];
3193 buf0
[2] = (buf0
[2] & 0x00FFFFFF) | (buf0
[3] << 24);
3194 buf0
[3] = (buf0
[3] >> 24);
3196 case 14: buf0
[3] = ((buf0
[3] << 8) & 0x0000FF00) | ((buf0
[3] >> 8) & 0x000000FF);
3198 case 15: buf0
[3] = (buf0
[3] & 0x000000FF) | ((buf0
[3] << 8) & 0x00FF0000) | ((buf0
[3] >> 8) & 0x0000FF00);
3200 case 16: buf0
[3] = (buf0
[3] & 0x0000FFFF) | ((buf0
[3] << 8) & 0xFF000000) | ((buf0
[3] >> 8) & 0x00FF0000);
3202 case 17: buf1
[0] = (buf0
[3] & 0xFF000000) | buf1
[0];
3203 buf0
[3] = (buf0
[3] & 0x00FFFFFF) | (buf1
[0] << 24);
3204 buf1
[0] = (buf1
[0] >> 24);
3206 case 18: buf1
[0] = ((buf1
[0] << 8) & 0x0000FF00) | ((buf1
[0] >> 8) & 0x000000FF);
3208 case 19: buf1
[0] = (buf1
[0] & 0x000000FF) | ((buf1
[0] << 8) & 0x00FF0000) | ((buf1
[0] >> 8) & 0x0000FF00);
3210 case 20: buf1
[0] = (buf1
[0] & 0x0000FFFF) | ((buf1
[0] << 8) & 0xFF000000) | ((buf1
[0] >> 8) & 0x00FF0000);
3212 case 21: buf1
[1] = (buf1
[0] & 0xFF000000) | buf1
[1];
3213 buf1
[0] = (buf1
[0] & 0x00FFFFFF) | (buf1
[1] << 24);
3214 buf1
[1] = (buf1
[1] >> 24);
3216 case 22: buf1
[1] = ((buf1
[1] << 8) & 0x0000FF00) | ((buf1
[1] >> 8) & 0x000000FF);
3218 case 23: buf1
[1] = (buf1
[1] & 0x000000FF) | ((buf1
[1] << 8) & 0x00FF0000) | ((buf1
[1] >> 8) & 0x0000FF00);
3220 case 24: buf1
[1] = (buf1
[1] & 0x0000FFFF) | ((buf1
[1] << 8) & 0xFF000000) | ((buf1
[1] >> 8) & 0x00FF0000);
3222 case 25: buf1
[2] = (buf1
[1] & 0xFF000000) | buf1
[2];
3223 buf1
[1] = (buf1
[1] & 0x00FFFFFF) | (buf1
[2] << 24);
3224 buf1
[2] = (buf1
[2] >> 24);
3226 case 26: buf1
[2] = ((buf1
[2] << 8) & 0x0000FF00) | ((buf1
[2] >> 8) & 0x000000FF);
3228 case 27: buf1
[2] = (buf1
[2] & 0x000000FF) | ((buf1
[2] << 8) & 0x00FF0000) | ((buf1
[2] >> 8) & 0x0000FF00);
3230 case 28: buf1
[2] = (buf1
[2] & 0x0000FFFF) | ((buf1
[2] << 8) & 0xFF000000) | ((buf1
[2] >> 8) & 0x00FF0000);
3232 case 29: buf1
[3] = (buf1
[2] & 0xFF000000) | buf1
[3];
3233 buf1
[2] = (buf1
[2] & 0x00FFFFFF) | (buf1
[3] << 24);
3234 buf1
[3] = (buf1
[3] >> 24);
3236 case 30: buf1
[3] = ((buf1
[3] << 8) & 0x0000FF00) | ((buf1
[3] >> 8) & 0x000000FF);
3238 case 31: buf1
[3] = (buf1
[3] & 0x000000FF) | ((buf1
[3] << 8) & 0x00FF0000) | ((buf1
[3] >> 8) & 0x0000FF00);
3246 static u32
rule_op_mangle_switch_at (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3248 if (p0
>= in_len
) return (in_len
);
3249 if (p1
>= in_len
) return (in_len
);
3257 case 0: tmp0
= __byte_perm (buf0
[0], 0, 0x6540);
3259 case 1: tmp0
= __byte_perm (buf0
[0], 0, 0x6541);
3261 case 2: tmp0
= __byte_perm (buf0
[0], 0, 0x6542);
3263 case 3: tmp0
= __byte_perm (buf0
[0], 0, 0x6543);
3265 case 4: tmp0
= __byte_perm (buf0
[1], 0, 0x6540);
3267 case 5: tmp0
= __byte_perm (buf0
[1], 0, 0x6541);
3269 case 6: tmp0
= __byte_perm (buf0
[1], 0, 0x6542);
3271 case 7: tmp0
= __byte_perm (buf0
[1], 0, 0x6543);
3273 case 8: tmp0
= __byte_perm (buf0
[2], 0, 0x6540);
3275 case 9: tmp0
= __byte_perm (buf0
[2], 0, 0x6541);
3277 case 10: tmp0
= __byte_perm (buf0
[2], 0, 0x6542);
3279 case 11: tmp0
= __byte_perm (buf0
[2], 0, 0x6543);
3281 case 12: tmp0
= __byte_perm (buf0
[3], 0, 0x6540);
3283 case 13: tmp0
= __byte_perm (buf0
[3], 0, 0x6541);
3285 case 14: tmp0
= __byte_perm (buf0
[3], 0, 0x6542);
3287 case 15: tmp0
= __byte_perm (buf0
[3], 0, 0x6543);
3289 case 16: tmp0
= __byte_perm (buf1
[0], 0, 0x6540);
3291 case 17: tmp0
= __byte_perm (buf1
[0], 0, 0x6541);
3293 case 18: tmp0
= __byte_perm (buf1
[0], 0, 0x6542);
3295 case 19: tmp0
= __byte_perm (buf1
[0], 0, 0x6543);
3297 case 20: tmp0
= __byte_perm (buf1
[1], 0, 0x6540);
3299 case 21: tmp0
= __byte_perm (buf1
[1], 0, 0x6541);
3301 case 22: tmp0
= __byte_perm (buf1
[1], 0, 0x6542);
3303 case 23: tmp0
= __byte_perm (buf1
[1], 0, 0x6543);
3305 case 24: tmp0
= __byte_perm (buf1
[2], 0, 0x6540);
3307 case 25: tmp0
= __byte_perm (buf1
[2], 0, 0x6541);
3309 case 26: tmp0
= __byte_perm (buf1
[2], 0, 0x6542);
3311 case 27: tmp0
= __byte_perm (buf1
[2], 0, 0x6543);
3313 case 28: tmp0
= __byte_perm (buf1
[3], 0, 0x6540);
3315 case 29: tmp0
= __byte_perm (buf1
[3], 0, 0x6541);
3317 case 30: tmp0
= __byte_perm (buf1
[3], 0, 0x6542);
3319 case 31: tmp0
= __byte_perm (buf1
[3], 0, 0x6543);
3325 case 0: tmp1
= __byte_perm (buf0
[0], 0, 0x6540);
3326 buf0
[0] = __byte_perm (tmp0
, buf0
[0], 0x7650);
3328 case 1: tmp1
= __byte_perm (buf0
[0], 0, 0x6541);
3329 buf0
[0] = __byte_perm (tmp0
, buf0
[0], 0x7604);
3331 case 2: tmp1
= __byte_perm (buf0
[0], 0, 0x6542);
3332 buf0
[0] = __byte_perm (tmp0
, buf0
[0], 0x7054);
3334 case 3: tmp1
= __byte_perm (buf0
[0], 0, 0x6543);
3335 buf0
[0] = __byte_perm (tmp0
, buf0
[0], 0x0654);
3337 case 4: tmp1
= __byte_perm (buf0
[1], 0, 0x6540);
3338 buf0
[1] = __byte_perm (tmp0
, buf0
[1], 0x7650);
3340 case 5: tmp1
= __byte_perm (buf0
[1], 0, 0x6541);
3341 buf0
[1] = __byte_perm (tmp0
, buf0
[1], 0x7604);
3343 case 6: tmp1
= __byte_perm (buf0
[1], 0, 0x6542);
3344 buf0
[1] = __byte_perm (tmp0
, buf0
[1], 0x7054);
3346 case 7: tmp1
= __byte_perm (buf0
[1], 0, 0x6543);
3347 buf0
[1] = __byte_perm (tmp0
, buf0
[1], 0x0654);
3349 case 8: tmp1
= __byte_perm (buf0
[2], 0, 0x6540);
3350 buf0
[2] = __byte_perm (tmp0
, buf0
[2], 0x7650);
3352 case 9: tmp1
= __byte_perm (buf0
[2], 0, 0x6541);
3353 buf0
[2] = __byte_perm (tmp0
, buf0
[2], 0x7604);
3355 case 10: tmp1
= __byte_perm (buf0
[2], 0, 0x6542);
3356 buf0
[2] = __byte_perm (tmp0
, buf0
[2], 0x7054);
3358 case 11: tmp1
= __byte_perm (buf0
[2], 0, 0x6543);
3359 buf0
[2] = __byte_perm (tmp0
, buf0
[2], 0x0654);
3361 case 12: tmp1
= __byte_perm (buf0
[3], 0, 0x6540);
3362 buf0
[3] = __byte_perm (tmp0
, buf0
[3], 0x7650);
3364 case 13: tmp1
= __byte_perm (buf0
[3], 0, 0x6541);
3365 buf0
[3] = __byte_perm (tmp0
, buf0
[3], 0x7604);
3367 case 14: tmp1
= __byte_perm (buf0
[3], 0, 0x6542);
3368 buf0
[3] = __byte_perm (tmp0
, buf0
[3], 0x7054);
3370 case 15: tmp1
= __byte_perm (buf0
[3], 0, 0x6543);
3371 buf0
[3] = __byte_perm (tmp0
, buf0
[3], 0x0654);
3373 case 16: tmp1
= __byte_perm (buf1
[0], 0, 0x6540);
3374 buf1
[0] = __byte_perm (tmp0
, buf1
[0], 0x7650);
3376 case 17: tmp1
= __byte_perm (buf1
[0], 0, 0x6541);
3377 buf1
[0] = __byte_perm (tmp0
, buf1
[0], 0x7604);
3379 case 18: tmp1
= __byte_perm (buf1
[0], 0, 0x6542);
3380 buf1
[0] = __byte_perm (tmp0
, buf1
[0], 0x7054);
3382 case 19: tmp1
= __byte_perm (buf1
[0], 0, 0x6543);
3383 buf1
[0] = __byte_perm (tmp0
, buf1
[0], 0x0654);
3385 case 20: tmp1
= __byte_perm (buf1
[1], 0, 0x6540);
3386 buf1
[1] = __byte_perm (tmp0
, buf1
[1], 0x7650);
3388 case 21: tmp1
= __byte_perm (buf1
[1], 0, 0x6541);
3389 buf1
[1] = __byte_perm (tmp0
, buf1
[1], 0x7604);
3391 case 22: tmp1
= __byte_perm (buf1
[1], 0, 0x6542);
3392 buf1
[1] = __byte_perm (tmp0
, buf1
[1], 0x7054);
3394 case 23: tmp1
= __byte_perm (buf1
[1], 0, 0x6543);
3395 buf1
[1] = __byte_perm (tmp0
, buf1
[1], 0x0654);
3397 case 24: tmp1
= __byte_perm (buf1
[2], 0, 0x6540);
3398 buf1
[2] = __byte_perm (tmp0
, buf1
[2], 0x7650);
3400 case 25: tmp1
= __byte_perm (buf1
[2], 0, 0x6541);
3401 buf1
[2] = __byte_perm (tmp0
, buf1
[2], 0x7604);
3403 case 26: tmp1
= __byte_perm (buf1
[2], 0, 0x6542);
3404 buf1
[2] = __byte_perm (tmp0
, buf1
[2], 0x7054);
3406 case 27: tmp1
= __byte_perm (buf1
[2], 0, 0x6543);
3407 buf1
[2] = __byte_perm (tmp0
, buf1
[2], 0x0654);
3409 case 28: tmp1
= __byte_perm (buf1
[3], 0, 0x6540);
3410 buf1
[3] = __byte_perm (tmp0
, buf1
[3], 0x7650);
3412 case 29: tmp1
= __byte_perm (buf1
[3], 0, 0x6541);
3413 buf1
[3] = __byte_perm (tmp0
, buf1
[3], 0x7604);
3415 case 30: tmp1
= __byte_perm (buf1
[3], 0, 0x6542);
3416 buf1
[3] = __byte_perm (tmp0
, buf1
[3], 0x7054);
3418 case 31: tmp1
= __byte_perm (buf1
[3], 0, 0x6543);
3419 buf1
[3] = __byte_perm (tmp0
, buf1
[3], 0x0654);
3425 case 0: buf0
[0] = __byte_perm (tmp1
, buf0
[0], 0x7650);
3427 case 1: buf0
[0] = __byte_perm (tmp1
, buf0
[0], 0x7604);
3429 case 2: buf0
[0] = __byte_perm (tmp1
, buf0
[0], 0x7054);
3431 case 3: buf0
[0] = __byte_perm (tmp1
, buf0
[0], 0x0654);
3433 case 4: buf0
[1] = __byte_perm (tmp1
, buf0
[1], 0x7650);
3435 case 5: buf0
[1] = __byte_perm (tmp1
, buf0
[1], 0x7604);
3437 case 6: buf0
[1] = __byte_perm (tmp1
, buf0
[1], 0x7054);
3439 case 7: buf0
[1] = __byte_perm (tmp1
, buf0
[1], 0x0654);
3441 case 8: buf0
[2] = __byte_perm (tmp1
, buf0
[2], 0x7650);
3443 case 9: buf0
[2] = __byte_perm (tmp1
, buf0
[2], 0x7604);
3445 case 10: buf0
[2] = __byte_perm (tmp1
, buf0
[2], 0x7054);
3447 case 11: buf0
[2] = __byte_perm (tmp1
, buf0
[2], 0x0654);
3449 case 12: buf0
[3] = __byte_perm (tmp1
, buf0
[3], 0x7650);
3451 case 13: buf0
[3] = __byte_perm (tmp1
, buf0
[3], 0x7604);
3453 case 14: buf0
[3] = __byte_perm (tmp1
, buf0
[3], 0x7054);
3455 case 15: buf0
[3] = __byte_perm (tmp1
, buf0
[3], 0x0654);
3457 case 16: buf1
[0] = __byte_perm (tmp1
, buf1
[0], 0x7650);
3459 case 17: buf1
[0] = __byte_perm (tmp1
, buf1
[0], 0x7604);
3461 case 18: buf1
[0] = __byte_perm (tmp1
, buf1
[0], 0x7054);
3463 case 19: buf1
[0] = __byte_perm (tmp1
, buf1
[0], 0x0654);
3465 case 20: buf1
[1] = __byte_perm (tmp1
, buf1
[1], 0x7650);
3467 case 21: buf1
[1] = __byte_perm (tmp1
, buf1
[1], 0x7604);
3469 case 22: buf1
[1] = __byte_perm (tmp1
, buf1
[1], 0x7054);
3471 case 23: buf1
[1] = __byte_perm (tmp1
, buf1
[1], 0x0654);
3473 case 24: buf1
[2] = __byte_perm (tmp1
, buf1
[2], 0x7650);
3475 case 25: buf1
[2] = __byte_perm (tmp1
, buf1
[2], 0x7604);
3477 case 26: buf1
[2] = __byte_perm (tmp1
, buf1
[2], 0x7054);
3479 case 27: buf1
[2] = __byte_perm (tmp1
, buf1
[2], 0x0654);
3481 case 28: buf1
[3] = __byte_perm (tmp1
, buf1
[3], 0x7650);
3483 case 29: buf1
[3] = __byte_perm (tmp1
, buf1
[3], 0x7604);
3485 case 30: buf1
[3] = __byte_perm (tmp1
, buf1
[3], 0x7054);
3487 case 31: buf1
[3] = __byte_perm (tmp1
, buf1
[3], 0x0654);
3492 #if defined IS_AMD || defined IS_GENERIC
3495 case 0: tmp0
= (buf0
[0] >> 0) & 0xFF;
3497 case 1: tmp0
= (buf0
[0] >> 8) & 0xFF;
3499 case 2: tmp0
= (buf0
[0] >> 16) & 0xFF;
3501 case 3: tmp0
= (buf0
[0] >> 24) & 0xFF;
3503 case 4: tmp0
= (buf0
[1] >> 0) & 0xFF;
3505 case 5: tmp0
= (buf0
[1] >> 8) & 0xFF;
3507 case 6: tmp0
= (buf0
[1] >> 16) & 0xFF;
3509 case 7: tmp0
= (buf0
[1] >> 24) & 0xFF;
3511 case 8: tmp0
= (buf0
[2] >> 0) & 0xFF;
3513 case 9: tmp0
= (buf0
[2] >> 8) & 0xFF;
3515 case 10: tmp0
= (buf0
[2] >> 16) & 0xFF;
3517 case 11: tmp0
= (buf0
[2] >> 24) & 0xFF;
3519 case 12: tmp0
= (buf0
[3] >> 0) & 0xFF;
3521 case 13: tmp0
= (buf0
[3] >> 8) & 0xFF;
3523 case 14: tmp0
= (buf0
[3] >> 16) & 0xFF;
3525 case 15: tmp0
= (buf0
[3] >> 24) & 0xFF;
3527 case 16: tmp0
= (buf1
[0] >> 0) & 0xFF;
3529 case 17: tmp0
= (buf1
[0] >> 8) & 0xFF;
3531 case 18: tmp0
= (buf1
[0] >> 16) & 0xFF;
3533 case 19: tmp0
= (buf1
[0] >> 24) & 0xFF;
3535 case 20: tmp0
= (buf1
[1] >> 0) & 0xFF;
3537 case 21: tmp0
= (buf1
[1] >> 8) & 0xFF;
3539 case 22: tmp0
= (buf1
[1] >> 16) & 0xFF;
3541 case 23: tmp0
= (buf1
[1] >> 24) & 0xFF;
3543 case 24: tmp0
= (buf1
[2] >> 0) & 0xFF;
3545 case 25: tmp0
= (buf1
[2] >> 8) & 0xFF;
3547 case 26: tmp0
= (buf1
[2] >> 16) & 0xFF;
3549 case 27: tmp0
= (buf1
[2] >> 24) & 0xFF;
3551 case 28: tmp0
= (buf1
[3] >> 0) & 0xFF;
3553 case 29: tmp0
= (buf1
[3] >> 8) & 0xFF;
3555 case 30: tmp0
= (buf1
[3] >> 16) & 0xFF;
3557 case 31: tmp0
= (buf1
[3] >> 24) & 0xFF;
3563 case 0: tmp1
= (buf0
[0] >> 0) & 0xff;
3564 buf0
[0] = (buf0
[0] & 0xffffff00) | tmp0
<< 0;
3566 case 1: tmp1
= (buf0
[0] >> 8) & 0xff;
3567 buf0
[0] = (buf0
[0] & 0xffff00ff) | tmp0
<< 8;
3569 case 2: tmp1
= (buf0
[0] >> 16) & 0xff;
3570 buf0
[0] = (buf0
[0] & 0xff00ffff) | tmp0
<< 16;
3572 case 3: tmp1
= (buf0
[0] >> 24) & 0xff;
3573 buf0
[0] = (buf0
[0] & 0x00ffffff) | tmp0
<< 24;
3575 case 4: tmp1
= (buf0
[1] >> 0) & 0xff;
3576 buf0
[1] = (buf0
[1] & 0xffffff00) | tmp0
<< 0;
3578 case 5: tmp1
= (buf0
[1] >> 8) & 0xff;
3579 buf0
[1] = (buf0
[1] & 0xffff00ff) | tmp0
<< 8;
3581 case 6: tmp1
= (buf0
[1] >> 16) & 0xff;
3582 buf0
[1] = (buf0
[1] & 0xff00ffff) | tmp0
<< 16;
3584 case 7: tmp1
= (buf0
[1] >> 24) & 0xff;
3585 buf0
[1] = (buf0
[1] & 0x00ffffff) | tmp0
<< 24;
3587 case 8: tmp1
= (buf0
[2] >> 0) & 0xff;
3588 buf0
[2] = (buf0
[2] & 0xffffff00) | tmp0
<< 0;
3590 case 9: tmp1
= (buf0
[2] >> 8) & 0xff;
3591 buf0
[2] = (buf0
[2] & 0xffff00ff) | tmp0
<< 8;
3593 case 10: tmp1
= (buf0
[2] >> 16) & 0xff;
3594 buf0
[2] = (buf0
[2] & 0xff00ffff) | tmp0
<< 16;
3596 case 11: tmp1
= (buf0
[2] >> 24) & 0xff;
3597 buf0
[2] = (buf0
[2] & 0x00ffffff) | tmp0
<< 24;
3599 case 12: tmp1
= (buf0
[3] >> 0) & 0xff;
3600 buf0
[3] = (buf0
[3] & 0xffffff00) | tmp0
<< 0;
3602 case 13: tmp1
= (buf0
[3] >> 8) & 0xff;
3603 buf0
[3] = (buf0
[3] & 0xffff00ff) | tmp0
<< 8;
3605 case 14: tmp1
= (buf0
[3] >> 16) & 0xff;
3606 buf0
[3] = (buf0
[3] & 0xff00ffff) | tmp0
<< 16;
3608 case 15: tmp1
= (buf0
[3] >> 24) & 0xff;
3609 buf0
[3] = (buf0
[3] & 0x00ffffff) | tmp0
<< 24;
3611 case 16: tmp1
= (buf1
[0] >> 0) & 0xff;
3612 buf1
[0] = (buf1
[0] & 0xffffff00) | tmp0
<< 0;
3614 case 17: tmp1
= (buf1
[0] >> 8) & 0xff;
3615 buf1
[0] = (buf1
[0] & 0xffff00ff) | tmp0
<< 8;
3617 case 18: tmp1
= (buf1
[0] >> 16) & 0xff;
3618 buf1
[0] = (buf1
[0] & 0xff00ffff) | tmp0
<< 16;
3620 case 19: tmp1
= (buf1
[0] >> 24) & 0xff;
3621 buf1
[0] = (buf1
[0] & 0x00ffffff) | tmp0
<< 24;
3623 case 20: tmp1
= (buf1
[1] >> 0) & 0xff;
3624 buf1
[1] = (buf1
[1] & 0xffffff00) | tmp0
<< 0;
3626 case 21: tmp1
= (buf1
[1] >> 8) & 0xff;
3627 buf1
[1] = (buf1
[1] & 0xffff00ff) | tmp0
<< 8;
3629 case 22: tmp1
= (buf1
[1] >> 16) & 0xff;
3630 buf1
[1] = (buf1
[1] & 0xff00ffff) | tmp0
<< 16;
3632 case 23: tmp1
= (buf1
[1] >> 24) & 0xff;
3633 buf1
[1] = (buf1
[1] & 0x00ffffff) | tmp0
<< 24;
3635 case 24: tmp1
= (buf1
[2] >> 0) & 0xff;
3636 buf1
[2] = (buf1
[2] & 0xffffff00) | tmp0
<< 0;
3638 case 25: tmp1
= (buf1
[2] >> 8) & 0xff;
3639 buf1
[2] = (buf1
[2] & 0xffff00ff) | tmp0
<< 8;
3641 case 26: tmp1
= (buf1
[2] >> 16) & 0xff;
3642 buf1
[2] = (buf1
[2] & 0xff00ffff) | tmp0
<< 16;
3644 case 27: tmp1
= (buf1
[2] >> 24) & 0xff;
3645 buf1
[2] = (buf1
[2] & 0x00ffffff) | tmp0
<< 24;
3647 case 28: tmp1
= (buf1
[3] >> 0) & 0xff;
3648 buf1
[3] = (buf1
[3] & 0xffffff00) | tmp0
<< 0;
3650 case 29: tmp1
= (buf1
[3] >> 8) & 0xff;
3651 buf1
[3] = (buf1
[3] & 0xffff00ff) | tmp0
<< 8;
3653 case 30: tmp1
= (buf1
[3] >> 16) & 0xff;
3654 buf1
[3] = (buf1
[3] & 0xff00ffff) | tmp0
<< 16;
3656 case 31: tmp1
= (buf1
[3] >> 24) & 0xff;
3657 buf1
[3] = (buf1
[3] & 0x00ffffff) | tmp0
<< 24;
3663 case 0: buf0
[0] = (buf0
[0] & 0xffffff00) | tmp1
<< 0;
3665 case 1: buf0
[0] = (buf0
[0] & 0xffff00ff) | tmp1
<< 8;
3667 case 2: buf0
[0] = (buf0
[0] & 0xff00ffff) | tmp1
<< 16;
3669 case 3: buf0
[0] = (buf0
[0] & 0x00ffffff) | tmp1
<< 24;
3671 case 4: buf0
[1] = (buf0
[1] & 0xffffff00) | tmp1
<< 0;
3673 case 5: buf0
[1] = (buf0
[1] & 0xffff00ff) | tmp1
<< 8;
3675 case 6: buf0
[1] = (buf0
[1] & 0xff00ffff) | tmp1
<< 16;
3677 case 7: buf0
[1] = (buf0
[1] & 0x00ffffff) | tmp1
<< 24;
3679 case 8: buf0
[2] = (buf0
[2] & 0xffffff00) | tmp1
<< 0;
3681 case 9: buf0
[2] = (buf0
[2] & 0xffff00ff) | tmp1
<< 8;
3683 case 10: buf0
[2] = (buf0
[2] & 0xff00ffff) | tmp1
<< 16;
3685 case 11: buf0
[2] = (buf0
[2] & 0x00ffffff) | tmp1
<< 24;
3687 case 12: buf0
[3] = (buf0
[3] & 0xffffff00) | tmp1
<< 0;
3689 case 13: buf0
[3] = (buf0
[3] & 0xffff00ff) | tmp1
<< 8;
3691 case 14: buf0
[3] = (buf0
[3] & 0xff00ffff) | tmp1
<< 16;
3693 case 15: buf0
[3] = (buf0
[3] & 0x00ffffff) | tmp1
<< 24;
3695 case 16: buf1
[0] = (buf1
[0] & 0xffffff00) | tmp1
<< 0;
3697 case 17: buf1
[0] = (buf1
[0] & 0xffff00ff) | tmp1
<< 8;
3699 case 18: buf1
[0] = (buf1
[0] & 0xff00ffff) | tmp1
<< 16;
3701 case 19: buf1
[0] = (buf1
[0] & 0x00ffffff) | tmp1
<< 24;
3703 case 20: buf1
[1] = (buf1
[1] & 0xffffff00) | tmp1
<< 0;
3705 case 21: buf1
[1] = (buf1
[1] & 0xffff00ff) | tmp1
<< 8;
3707 case 22: buf1
[1] = (buf1
[1] & 0xff00ffff) | tmp1
<< 16;
3709 case 23: buf1
[1] = (buf1
[1] & 0x00ffffff) | tmp1
<< 24;
3711 case 24: buf1
[2] = (buf1
[2] & 0xffffff00) | tmp1
<< 0;
3713 case 25: buf1
[2] = (buf1
[2] & 0xffff00ff) | tmp1
<< 8;
3715 case 26: buf1
[2] = (buf1
[2] & 0xff00ffff) | tmp1
<< 16;
3717 case 27: buf1
[2] = (buf1
[2] & 0x00ffffff) | tmp1
<< 24;
3719 case 28: buf1
[3] = (buf1
[3] & 0xffffff00) | tmp1
<< 0;
3721 case 29: buf1
[3] = (buf1
[3] & 0xffff00ff) | tmp1
<< 8;
3723 case 30: buf1
[3] = (buf1
[3] & 0xff00ffff) | tmp1
<< 16;
3725 case 31: buf1
[3] = (buf1
[3] & 0x00ffffff) | tmp1
<< 24;
3733 static u32
rule_op_mangle_chr_shiftl (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3735 if (p0
>= in_len
) return (in_len
);
3737 const u32 mr
= 0xff << ((p0
& 3) * 8);
3742 case 0: buf0
[0] = (buf0
[0] & ml
) | (((buf0
[0] & mr
) << 1) & mr
); break;
3743 case 1: buf0
[1] = (buf0
[1] & ml
) | (((buf0
[1] & mr
) << 1) & mr
); break;
3744 case 2: buf0
[2] = (buf0
[2] & ml
) | (((buf0
[2] & mr
) << 1) & mr
); break;
3745 case 3: buf0
[3] = (buf0
[3] & ml
) | (((buf0
[3] & mr
) << 1) & mr
); break;
3746 case 4: buf1
[0] = (buf1
[0] & ml
) | (((buf1
[0] & mr
) << 1) & mr
); break;
3747 case 5: buf1
[1] = (buf1
[1] & ml
) | (((buf1
[1] & mr
) << 1) & mr
); break;
3748 case 6: buf1
[2] = (buf1
[2] & ml
) | (((buf1
[2] & mr
) << 1) & mr
); break;
3749 case 7: buf1
[3] = (buf1
[3] & ml
) | (((buf1
[3] & mr
) << 1) & mr
); break;
3755 static u32
rule_op_mangle_chr_shiftr (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3757 if (p0
>= in_len
) return (in_len
);
3759 const u32 mr
= 0xff << ((p0
& 3) * 8);
3764 case 0: buf0
[0] = (buf0
[0] & ml
) | (((buf0
[0] & mr
) >> 1) & mr
); break;
3765 case 1: buf0
[1] = (buf0
[1] & ml
) | (((buf0
[1] & mr
) >> 1) & mr
); break;
3766 case 2: buf0
[2] = (buf0
[2] & ml
) | (((buf0
[2] & mr
) >> 1) & mr
); break;
3767 case 3: buf0
[3] = (buf0
[3] & ml
) | (((buf0
[3] & mr
) >> 1) & mr
); break;
3768 case 4: buf1
[0] = (buf1
[0] & ml
) | (((buf1
[0] & mr
) >> 1) & mr
); break;
3769 case 5: buf1
[1] = (buf1
[1] & ml
) | (((buf1
[1] & mr
) >> 1) & mr
); break;
3770 case 6: buf1
[2] = (buf1
[2] & ml
) | (((buf1
[2] & mr
) >> 1) & mr
); break;
3771 case 7: buf1
[3] = (buf1
[3] & ml
) | (((buf1
[3] & mr
) >> 1) & mr
); break;
3777 static u32
rule_op_mangle_chr_incr (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3779 if (p0
>= in_len
) return (in_len
);
3781 const u32 mr
= 0xff << ((p0
& 3) * 8);
3784 const u32 n
= 0x01010101 & mr
;
3788 case 0: buf0
[0] = (buf0
[0] & ml
) | (((buf0
[0] & mr
) + n
) & mr
); break;
3789 case 1: buf0
[1] = (buf0
[1] & ml
) | (((buf0
[1] & mr
) + n
) & mr
); break;
3790 case 2: buf0
[2] = (buf0
[2] & ml
) | (((buf0
[2] & mr
) + n
) & mr
); break;
3791 case 3: buf0
[3] = (buf0
[3] & ml
) | (((buf0
[3] & mr
) + n
) & mr
); break;
3792 case 4: buf1
[0] = (buf1
[0] & ml
) | (((buf1
[0] & mr
) + n
) & mr
); break;
3793 case 5: buf1
[1] = (buf1
[1] & ml
) | (((buf1
[1] & mr
) + n
) & mr
); break;
3794 case 6: buf1
[2] = (buf1
[2] & ml
) | (((buf1
[2] & mr
) + n
) & mr
); break;
3795 case 7: buf1
[3] = (buf1
[3] & ml
) | (((buf1
[3] & mr
) + n
) & mr
); break;
3801 static u32
rule_op_mangle_chr_decr (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3803 if (p0
>= in_len
) return (in_len
);
3805 const u32 mr
= 0xff << ((p0
& 3) * 8);
3808 const u32 n
= 0x01010101 & mr
;
3812 case 0: buf0
[0] = (buf0
[0] & ml
) | (((buf0
[0] & mr
) - n
) & mr
); break;
3813 case 1: buf0
[1] = (buf0
[1] & ml
) | (((buf0
[1] & mr
) - n
) & mr
); break;
3814 case 2: buf0
[2] = (buf0
[2] & ml
) | (((buf0
[2] & mr
) - n
) & mr
); break;
3815 case 3: buf0
[3] = (buf0
[3] & ml
) | (((buf0
[3] & mr
) - n
) & mr
); break;
3816 case 4: buf1
[0] = (buf1
[0] & ml
) | (((buf1
[0] & mr
) - n
) & mr
); break;
3817 case 5: buf1
[1] = (buf1
[1] & ml
) | (((buf1
[1] & mr
) - n
) & mr
); break;
3818 case 6: buf1
[2] = (buf1
[2] & ml
) | (((buf1
[2] & mr
) - n
) & mr
); break;
3819 case 7: buf1
[3] = (buf1
[3] & ml
) | (((buf1
[3] & mr
) - n
) & mr
); break;
3825 static u32
rule_op_mangle_replace_np1 (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3827 if ((p0
+ 1) >= in_len
) return (in_len
);
3832 lshift_block (buf0
, buf1
, tib40
, tib41
);
3834 const u32 mr
= 0xff << ((p0
& 3) * 8);
3839 case 0: buf0
[0] = (buf0
[0] & ml
) | (tib40
[0] & mr
); break;
3840 case 1: buf0
[1] = (buf0
[1] & ml
) | (tib40
[1] & mr
); break;
3841 case 2: buf0
[2] = (buf0
[2] & ml
) | (tib40
[2] & mr
); break;
3842 case 3: buf0
[3] = (buf0
[3] & ml
) | (tib40
[3] & mr
); break;
3843 case 4: buf1
[0] = (buf1
[0] & ml
) | (tib41
[0] & mr
); break;
3844 case 5: buf1
[1] = (buf1
[1] & ml
) | (tib41
[1] & mr
); break;
3845 case 6: buf1
[2] = (buf1
[2] & ml
) | (tib41
[2] & mr
); break;
3846 case 7: buf1
[3] = (buf1
[3] & ml
) | (tib41
[3] & mr
); break;
3852 static u32
rule_op_mangle_replace_nm1 (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3854 if (p0
== 0) return (in_len
);
3856 if (p0
>= in_len
) return (in_len
);
3861 rshift_block (buf0
, buf1
, tib40
, tib41
);
3863 const u32 mr
= 0xff << ((p0
& 3) * 8);
3868 case 0: buf0
[0] = (buf0
[0] & ml
) | (tib40
[0] & mr
); break;
3869 case 1: buf0
[1] = (buf0
[1] & ml
) | (tib40
[1] & mr
); break;
3870 case 2: buf0
[2] = (buf0
[2] & ml
) | (tib40
[2] & mr
); break;
3871 case 3: buf0
[3] = (buf0
[3] & ml
) | (tib40
[3] & mr
); break;
3872 case 4: buf1
[0] = (buf1
[0] & ml
) | (tib41
[0] & mr
); break;
3873 case 5: buf1
[1] = (buf1
[1] & ml
) | (tib41
[1] & mr
); break;
3874 case 6: buf1
[2] = (buf1
[2] & ml
) | (tib41
[2] & mr
); break;
3875 case 7: buf1
[3] = (buf1
[3] & ml
) | (tib41
[3] & mr
); break;
3881 static u32
rule_op_mangle_dupeblock_first (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3883 if (p0
> in_len
) return (in_len
);
3885 if ((in_len
+ p0
) >= 32) return (in_len
);
3887 u32 out_len
= in_len
;
3901 truncate_right (tib40
, tib41
, p0
);
3903 rshift_block_N (buf0
, buf1
, buf0
, buf1
, p0
);
3905 buf0
[0] |= tib40
[0];
3906 buf0
[1] |= tib40
[1];
3907 buf0
[2] |= tib40
[2];
3908 buf0
[3] |= tib40
[3];
3909 buf1
[0] |= tib41
[0];
3910 buf1
[1] |= tib41
[1];
3911 buf1
[2] |= tib41
[2];
3912 buf1
[3] |= tib41
[3];
3919 static u32
rule_op_mangle_dupeblock_last (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3921 if (p0
> in_len
) return (in_len
);
3923 if ((in_len
+ p0
) >= 32) return (in_len
);
3925 u32 out_len
= in_len
;
3930 rshift_block_N (buf0
, buf1
, tib40
, tib41
, p0
);
3932 truncate_left (tib40
, tib41
, out_len
);
3934 buf0
[0] |= tib40
[0];
3935 buf0
[1] |= tib40
[1];
3936 buf0
[2] |= tib40
[2];
3937 buf0
[3] |= tib40
[3];
3938 buf1
[0] |= tib41
[0];
3939 buf1
[1] |= tib41
[1];
3940 buf1
[2] |= tib41
[2];
3941 buf1
[3] |= tib41
[3];
3948 static u32
rule_op_mangle_title (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3950 buf0
[0] |= (generate_cmask (buf0
[0]));
3951 buf0
[1] |= (generate_cmask (buf0
[1]));
3952 buf0
[2] |= (generate_cmask (buf0
[2]));
3953 buf0
[3] |= (generate_cmask (buf0
[3]));
3954 buf1
[0] |= (generate_cmask (buf1
[0]));
3955 buf1
[1] |= (generate_cmask (buf1
[1]));
3956 buf1
[2] |= (generate_cmask (buf1
[2]));
3957 buf1
[3] |= (generate_cmask (buf1
[3]));
3960 buf0
[0] &= ~(0x00000020 & generate_cmask (buf0
[0]));
3962 for (u32 i
= 0; i
< in_len
; i
++)
3969 case 0: tmp0
= __byte_perm (buf0
[0], 0, 0x6540);
3970 tmp1
= ~(0x00002000 & generate_cmask (buf0
[0])); break;
3971 case 1: tmp0
= __byte_perm (buf0
[0], 0, 0x6541);
3972 tmp1
= ~(0x00200000 & generate_cmask (buf0
[0])); break;
3973 case 2: tmp0
= __byte_perm (buf0
[0], 0, 0x6542);
3974 tmp1
= ~(0x20000000 & generate_cmask (buf0
[0])); break;
3975 case 3: tmp0
= __byte_perm (buf0
[0], 0, 0x6543);
3976 tmp1
= ~(0x00000020 & generate_cmask (buf0
[1])); break;
3977 case 4: tmp0
= __byte_perm (buf0
[1], 0, 0x6540);
3978 tmp1
= ~(0x00002000 & generate_cmask (buf0
[1])); break;
3979 case 5: tmp0
= __byte_perm (buf0
[1], 0, 0x6541);
3980 tmp1
= ~(0x00200000 & generate_cmask (buf0
[1])); break;
3981 case 6: tmp0
= __byte_perm (buf0
[1], 0, 0x6542);
3982 tmp1
= ~(0x20000000 & generate_cmask (buf0
[1])); break;
3983 case 7: tmp0
= __byte_perm (buf0
[1], 0, 0x6543);
3984 tmp1
= ~(0x00000020 & generate_cmask (buf0
[2])); break;
3985 case 8: tmp0
= __byte_perm (buf0
[2], 0, 0x6540);
3986 tmp1
= ~(0x00002000 & generate_cmask (buf0
[2])); break;
3987 case 9: tmp0
= __byte_perm (buf0
[2], 0, 0x6541);
3988 tmp1
= ~(0x00200000 & generate_cmask (buf0
[2])); break;
3989 case 10: tmp0
= __byte_perm (buf0
[2], 0, 0x6542);
3990 tmp1
= ~(0x20000000 & generate_cmask (buf0
[2])); break;
3991 case 11: tmp0
= __byte_perm (buf0
[2], 0, 0x6543);
3992 tmp1
= ~(0x00000020 & generate_cmask (buf0
[3])); break;
3993 case 12: tmp0
= __byte_perm (buf0
[3], 0, 0x6540);
3994 tmp1
= ~(0x00002000 & generate_cmask (buf0
[3])); break;
3995 case 13: tmp0
= __byte_perm (buf0
[3], 0, 0x6541);
3996 tmp1
= ~(0x00200000 & generate_cmask (buf0
[3])); break;
3997 case 14: tmp0
= __byte_perm (buf0
[3], 0, 0x6542);
3998 tmp1
= ~(0x20000000 & generate_cmask (buf0
[3])); break;
3999 case 15: tmp0
= __byte_perm (buf0
[3], 0, 0x6543);
4000 tmp1
= ~(0x00000020 & generate_cmask (buf1
[0])); break;
4001 case 16: tmp0
= __byte_perm (buf1
[0], 0, 0x6540);
4002 tmp1
= ~(0x00002000 & generate_cmask (buf1
[0])); break;
4003 case 17: tmp0
= __byte_perm (buf1
[0], 0, 0x6541);
4004 tmp1
= ~(0x00200000 & generate_cmask (buf1
[0])); break;
4005 case 18: tmp0
= __byte_perm (buf1
[0], 0, 0x6542);
4006 tmp1
= ~(0x20000000 & generate_cmask (buf1
[0])); break;
4007 case 19: tmp0
= __byte_perm (buf1
[0], 0, 0x6543);
4008 tmp1
= ~(0x00000020 & generate_cmask (buf1
[1])); break;
4009 case 20: tmp0
= __byte_perm (buf1
[1], 0, 0x6540);
4010 tmp1
= ~(0x00002000 & generate_cmask (buf1
[1])); break;
4011 case 21: tmp0
= __byte_perm (buf1
[1], 0, 0x6541);
4012 tmp1
= ~(0x00200000 & generate_cmask (buf1
[1])); break;
4013 case 22: tmp0
= __byte_perm (buf1
[1], 0, 0x6542);
4014 tmp1
= ~(0x20000000 & generate_cmask (buf1
[1])); break;
4015 case 23: tmp0
= __byte_perm (buf1
[1], 0, 0x6543);
4016 tmp1
= ~(0x00000020 & generate_cmask (buf1
[2])); break;
4017 case 24: tmp0
= __byte_perm (buf1
[2], 0, 0x6540);
4018 tmp1
= ~(0x00002000 & generate_cmask (buf1
[2])); break;
4019 case 25: tmp0
= __byte_perm (buf1
[2], 0, 0x6541);
4020 tmp1
= ~(0x00200000 & generate_cmask (buf1
[2])); break;
4021 case 26: tmp0
= __byte_perm (buf1
[2], 0, 0x6542);
4022 tmp1
= ~(0x20000000 & generate_cmask (buf1
[2])); break;
4023 case 27: tmp0
= __byte_perm (buf1
[2], 0, 0x6543);
4024 tmp1
= ~(0x00000020 & generate_cmask (buf1
[3])); break;
4025 case 28: tmp0
= __byte_perm (buf1
[3], 0, 0x6540);
4026 tmp1
= ~(0x00002000 & generate_cmask (buf1
[3])); break;
4027 case 29: tmp0
= __byte_perm (buf1
[3], 0, 0x6541);
4028 tmp1
= ~(0x00200000 & generate_cmask (buf1
[3])); break;
4029 case 30: tmp0
= __byte_perm (buf1
[3], 0, 0x6542);
4030 tmp1
= ~(0x20000000 & generate_cmask (buf1
[3])); break;
4035 if (tmp0
== ' ') buf0
[0] &= tmp1
;
4039 if (tmp0
== ' ') buf0
[1] &= tmp1
;
4043 if (tmp0
== ' ') buf0
[2] &= tmp1
;
4047 if (tmp0
== ' ') buf0
[3] &= tmp1
;
4051 if (tmp0
== ' ') buf1
[0] &= tmp1
;
4055 if (tmp0
== ' ') buf1
[1] &= tmp1
;
4059 if (tmp0
== ' ') buf1
[2] &= tmp1
;
4063 if (tmp0
== ' ') buf1
[3] &= tmp1
;
4068 #if defined IS_AMD || defined IS_GENERIC
4072 const uchar4 tmp0
= (uchar4
) (' ');
4073 const uchar4 tmp1
= (uchar4
) (0x00);
4074 const uchar4 tmp2
= (uchar4
) (0xff);
4078 tmp
= as_uchar4 (buf0
[0]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib40
[0] = as_uint (tmp
);
4079 tmp
= as_uchar4 (buf0
[1]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib40
[1] = as_uint (tmp
);
4080 tmp
= as_uchar4 (buf0
[2]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib40
[2] = as_uint (tmp
);
4081 tmp
= as_uchar4 (buf0
[3]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib40
[3] = as_uint (tmp
);
4082 tmp
= as_uchar4 (buf1
[0]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib41
[0] = as_uint (tmp
);
4083 tmp
= as_uchar4 (buf1
[1]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib41
[1] = as_uint (tmp
);
4084 tmp
= as_uchar4 (buf1
[2]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib41
[2] = as_uint (tmp
);
4085 tmp
= as_uchar4 (buf1
[3]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib41
[3] = as_uint (tmp
);
4087 rshift_block (tib40
, tib41
, tib40
, tib41
); tib40
[0] |= 0xff;
4089 buf0
[0] &= ~(generate_cmask (buf0
[0]) & tib40
[0]);
4090 buf0
[1] &= ~(generate_cmask (buf0
[1]) & tib40
[1]);
4091 buf0
[2] &= ~(generate_cmask (buf0
[2]) & tib40
[2]);
4092 buf0
[3] &= ~(generate_cmask (buf0
[3]) & tib40
[3]);
4093 buf1
[0] &= ~(generate_cmask (buf1
[0]) & tib41
[0]);
4094 buf1
[1] &= ~(generate_cmask (buf1
[1]) & tib41
[1]);
4095 buf1
[2] &= ~(generate_cmask (buf1
[2]) & tib41
[2]);
4096 buf1
[3] &= ~(generate_cmask (buf1
[3]) & tib41
[3]);
4102 u32
apply_rule (const u32 name
, const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
4104 u32 out_len
= in_len
;
4108 case RULE_OP_MANGLE_LREST
: out_len
= rule_op_mangle_lrest (p0
, p1
, buf0
, buf1
, out_len
); break;
4109 case RULE_OP_MANGLE_UREST
: out_len
= rule_op_mangle_urest (p0
, p1
, buf0
, buf1
, out_len
); break;
4110 case RULE_OP_MANGLE_LREST_UFIRST
: out_len
= rule_op_mangle_lrest_ufirst (p0
, p1
, buf0
, buf1
, out_len
); break;
4111 case RULE_OP_MANGLE_UREST_LFIRST
: out_len
= rule_op_mangle_urest_lfirst (p0
, p1
, buf0
, buf1
, out_len
); break;
4112 case RULE_OP_MANGLE_TREST
: out_len
= rule_op_mangle_trest (p0
, p1
, buf0
, buf1
, out_len
); break;
4113 case RULE_OP_MANGLE_TOGGLE_AT
: out_len
= rule_op_mangle_toggle_at (p0
, p1
, buf0
, buf1
, out_len
); break;
4114 case RULE_OP_MANGLE_REVERSE
: out_len
= rule_op_mangle_reverse (p0
, p1
, buf0
, buf1
, out_len
); break;
4115 case RULE_OP_MANGLE_DUPEWORD
: out_len
= rule_op_mangle_dupeword (p0
, p1
, buf0
, buf1
, out_len
); break;
4116 case RULE_OP_MANGLE_DUPEWORD_TIMES
: out_len
= rule_op_mangle_dupeword_times (p0
, p1
, buf0
, buf1
, out_len
); break;
4117 case RULE_OP_MANGLE_REFLECT
: out_len
= rule_op_mangle_reflect (p0
, p1
, buf0
, buf1
, out_len
); break;
4118 case RULE_OP_MANGLE_APPEND
: out_len
= rule_op_mangle_append (p0
, p1
, buf0
, buf1
, out_len
); break;
4119 case RULE_OP_MANGLE_PREPEND
: out_len
= rule_op_mangle_prepend (p0
, p1
, buf0
, buf1
, out_len
); break;
4120 case RULE_OP_MANGLE_ROTATE_LEFT
: out_len
= rule_op_mangle_rotate_left (p0
, p1
, buf0
, buf1
, out_len
); break;
4121 case RULE_OP_MANGLE_ROTATE_RIGHT
: out_len
= rule_op_mangle_rotate_right (p0
, p1
, buf0
, buf1
, out_len
); break;
4122 case RULE_OP_MANGLE_DELETE_FIRST
: out_len
= rule_op_mangle_delete_first (p0
, p1
, buf0
, buf1
, out_len
); break;
4123 case RULE_OP_MANGLE_DELETE_LAST
: out_len
= rule_op_mangle_delete_last (p0
, p1
, buf0
, buf1
, out_len
); break;
4124 case RULE_OP_MANGLE_DELETE_AT
: out_len
= rule_op_mangle_delete_at (p0
, p1
, buf0
, buf1
, out_len
); break;
4125 case RULE_OP_MANGLE_EXTRACT
: out_len
= rule_op_mangle_extract (p0
, p1
, buf0
, buf1
, out_len
); break;
4126 case RULE_OP_MANGLE_OMIT
: out_len
= rule_op_mangle_omit (p0
, p1
, buf0
, buf1
, out_len
); break;
4127 case RULE_OP_MANGLE_INSERT
: out_len
= rule_op_mangle_insert (p0
, p1
, buf0
, buf1
, out_len
); break;
4128 case RULE_OP_MANGLE_OVERSTRIKE
: out_len
= rule_op_mangle_overstrike (p0
, p1
, buf0
, buf1
, out_len
); break;
4129 case RULE_OP_MANGLE_TRUNCATE_AT
: out_len
= rule_op_mangle_truncate_at (p0
, p1
, buf0
, buf1
, out_len
); break;
4130 case RULE_OP_MANGLE_REPLACE
: out_len
= rule_op_mangle_replace (p0
, p1
, buf0
, buf1
, out_len
); break;
4131 //case RULE_OP_MANGLE_PURGECHAR: out_len = rule_op_mangle_purgechar (p0, p1, buf0, buf1, out_len); break;
4132 //case RULE_OP_MANGLE_TOGGLECASE_REC: out_len = rule_op_mangle_togglecase_rec (p0, p1, buf0, buf1, out_len); break;
4133 case RULE_OP_MANGLE_DUPECHAR_FIRST
: out_len
= rule_op_mangle_dupechar_first (p0
, p1
, buf0
, buf1
, out_len
); break;
4134 case RULE_OP_MANGLE_DUPECHAR_LAST
: out_len
= rule_op_mangle_dupechar_last (p0
, p1
, buf0
, buf1
, out_len
); break;
4135 case RULE_OP_MANGLE_DUPECHAR_ALL
: out_len
= rule_op_mangle_dupechar_all (p0
, p1
, buf0
, buf1
, out_len
); break;
4136 case RULE_OP_MANGLE_SWITCH_FIRST
: out_len
= rule_op_mangle_switch_first (p0
, p1
, buf0
, buf1
, out_len
); break;
4137 case RULE_OP_MANGLE_SWITCH_LAST
: out_len
= rule_op_mangle_switch_last (p0
, p1
, buf0
, buf1
, out_len
); break;
4138 case RULE_OP_MANGLE_SWITCH_AT
: out_len
= rule_op_mangle_switch_at (p0
, p1
, buf0
, buf1
, out_len
); break;
4139 case RULE_OP_MANGLE_CHR_SHIFTL
: out_len
= rule_op_mangle_chr_shiftl (p0
, p1
, buf0
, buf1
, out_len
); break;
4140 case RULE_OP_MANGLE_CHR_SHIFTR
: out_len
= rule_op_mangle_chr_shiftr (p0
, p1
, buf0
, buf1
, out_len
); break;
4141 case RULE_OP_MANGLE_CHR_INCR
: out_len
= rule_op_mangle_chr_incr (p0
, p1
, buf0
, buf1
, out_len
); break;
4142 case RULE_OP_MANGLE_CHR_DECR
: out_len
= rule_op_mangle_chr_decr (p0
, p1
, buf0
, buf1
, out_len
); break;
4143 case RULE_OP_MANGLE_REPLACE_NP1
: out_len
= rule_op_mangle_replace_np1 (p0
, p1
, buf0
, buf1
, out_len
); break;
4144 case RULE_OP_MANGLE_REPLACE_NM1
: out_len
= rule_op_mangle_replace_nm1 (p0
, p1
, buf0
, buf1
, out_len
); break;
4145 case RULE_OP_MANGLE_DUPEBLOCK_FIRST
: out_len
= rule_op_mangle_dupeblock_first (p0
, p1
, buf0
, buf1
, out_len
); break;
4146 case RULE_OP_MANGLE_DUPEBLOCK_LAST
: out_len
= rule_op_mangle_dupeblock_last (p0
, p1
, buf0
, buf1
, out_len
); break;
4147 case RULE_OP_MANGLE_TITLE
: out_len
= rule_op_mangle_title (p0
, p1
, buf0
, buf1
, out_len
); break;
4153 u32
apply_rules (__global u32
*cmds
, u32 buf0
[4], u32 buf1
[4], const u32 len
)
4157 for (u32 i
= 0; cmds
[i
] != 0; i
++)
4159 const u32 cmd
= cmds
[i
];
4161 const u32 name
= (cmd
>> 0) & 0xff;
4162 const u32 p0
= (cmd
>> 8) & 0xff;
4163 const u32 p1
= (cmd
>> 16) & 0xff;
4165 out_len
= apply_rule (name
, p0
, p1
, buf0
, buf1
, out_len
);