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: out0
[0] = in0
[0];
187 case 1: out0
[0] = __byte_perm (in0
[0], in0
[1], 0x4321);
188 out0
[1] = __byte_perm (in0
[1], in0
[2], 0x4321);
189 out0
[2] = __byte_perm (in0
[2], in0
[3], 0x4321);
190 out0
[3] = __byte_perm (in0
[3], in1
[0], 0x4321);
191 out1
[0] = __byte_perm (in1
[0], in1
[1], 0x4321);
192 out1
[1] = __byte_perm (in1
[1], in1
[2], 0x4321);
193 out1
[2] = __byte_perm (in1
[2], in1
[3], 0x4321);
194 out1
[3] = __byte_perm (in1
[3], 0, 0x4321);
196 case 2: out0
[0] = __byte_perm (in0
[0], in0
[1], 0x5432);
197 out0
[1] = __byte_perm (in0
[1], in0
[2], 0x5432);
198 out0
[2] = __byte_perm (in0
[2], in0
[3], 0x5432);
199 out0
[3] = __byte_perm (in0
[3], in1
[0], 0x5432);
200 out1
[0] = __byte_perm (in1
[0], in1
[1], 0x5432);
201 out1
[1] = __byte_perm (in1
[1], in1
[2], 0x5432);
202 out1
[2] = __byte_perm (in1
[2], in1
[3], 0x5432);
203 out1
[3] = __byte_perm (in1
[3], 0, 0x5432);
205 case 3: out0
[0] = __byte_perm (in0
[0], in0
[1], 0x6543);
206 out0
[1] = __byte_perm (in0
[1], in0
[2], 0x6543);
207 out0
[2] = __byte_perm (in0
[2], in0
[3], 0x6543);
208 out0
[3] = __byte_perm (in0
[3], in1
[0], 0x6543);
209 out1
[0] = __byte_perm (in1
[0], in1
[1], 0x6543);
210 out1
[1] = __byte_perm (in1
[1], in1
[2], 0x6543);
211 out1
[2] = __byte_perm (in1
[2], in1
[3], 0x6543);
212 out1
[3] = __byte_perm (in1
[3], 0, 0x6543);
214 case 4: out0
[0] = in0
[1];
223 case 5: out0
[0] = __byte_perm (in0
[1], in0
[2], 0x4321);
224 out0
[1] = __byte_perm (in0
[2], in0
[3], 0x4321);
225 out0
[2] = __byte_perm (in0
[3], in1
[0], 0x4321);
226 out0
[3] = __byte_perm (in1
[0], in1
[1], 0x4321);
227 out1
[0] = __byte_perm (in1
[1], in1
[2], 0x4321);
228 out1
[1] = __byte_perm (in1
[2], in1
[3], 0x4321);
229 out1
[2] = __byte_perm (in1
[3], 0, 0x4321);
232 case 6: out0
[0] = __byte_perm (in0
[1], in0
[2], 0x5432);
233 out0
[1] = __byte_perm (in0
[2], in0
[3], 0x5432);
234 out0
[2] = __byte_perm (in0
[3], in1
[0], 0x5432);
235 out0
[3] = __byte_perm (in1
[0], in1
[1], 0x5432);
236 out1
[0] = __byte_perm (in1
[1], in1
[2], 0x5432);
237 out1
[1] = __byte_perm (in1
[2], in1
[3], 0x5432);
238 out1
[2] = __byte_perm (in1
[3], 0, 0x5432);
241 case 7: out0
[0] = __byte_perm (in0
[1], in0
[2], 0x6543);
242 out0
[1] = __byte_perm (in0
[2], in0
[3], 0x6543);
243 out0
[2] = __byte_perm (in0
[3], in1
[0], 0x6543);
244 out0
[3] = __byte_perm (in1
[0], in1
[1], 0x6543);
245 out1
[0] = __byte_perm (in1
[1], in1
[2], 0x6543);
246 out1
[1] = __byte_perm (in1
[2], in1
[3], 0x6543);
247 out1
[2] = __byte_perm (in1
[3], 0, 0x6543);
250 case 8: out0
[0] = in0
[2];
259 case 9: out0
[0] = __byte_perm (in0
[2], in0
[3], 0x4321);
260 out0
[1] = __byte_perm (in0
[3], in1
[0], 0x4321);
261 out0
[2] = __byte_perm (in1
[0], in1
[1], 0x4321);
262 out0
[3] = __byte_perm (in1
[1], in1
[2], 0x4321);
263 out1
[0] = __byte_perm (in1
[2], in1
[3], 0x4321);
264 out1
[1] = __byte_perm (in1
[3], 0, 0x4321);
268 case 10: out0
[0] = __byte_perm (in0
[2], in0
[3], 0x5432);
269 out0
[1] = __byte_perm (in0
[3], in1
[0], 0x5432);
270 out0
[2] = __byte_perm (in1
[0], in1
[1], 0x5432);
271 out0
[3] = __byte_perm (in1
[1], in1
[2], 0x5432);
272 out1
[0] = __byte_perm (in1
[2], in1
[3], 0x5432);
273 out1
[1] = __byte_perm (in1
[3], 0, 0x5432);
277 case 11: out0
[0] = __byte_perm (in0
[2], in0
[3], 0x6543);
278 out0
[1] = __byte_perm (in0
[3], in1
[0], 0x6543);
279 out0
[2] = __byte_perm (in1
[0], in1
[1], 0x6543);
280 out0
[3] = __byte_perm (in1
[1], in1
[2], 0x6543);
281 out1
[0] = __byte_perm (in1
[2], in1
[3], 0x6543);
282 out1
[1] = __byte_perm (in1
[3], 0, 0x6543);
286 case 12: out0
[0] = in0
[3];
296 out0
[0] = __byte_perm (in0
[3], in1
[0], 0x4321);
297 out0
[1] = __byte_perm (in1
[0], in1
[1], 0x4321);
298 out0
[2] = __byte_perm (in1
[1], in1
[2], 0x4321);
299 out0
[3] = __byte_perm (in1
[2], in1
[3], 0x4321);
300 out1
[0] = __byte_perm (in1
[3], 0, 0x4321);
305 case 14: out0
[0] = __byte_perm (in0
[3], in1
[0], 0x5432);
306 out0
[1] = __byte_perm (in1
[0], in1
[1], 0x5432);
307 out0
[2] = __byte_perm (in1
[1], in1
[2], 0x5432);
308 out0
[3] = __byte_perm (in1
[2], in1
[3], 0x5432);
309 out1
[0] = __byte_perm (in1
[3], 0, 0x5432);
314 case 15: out0
[0] = __byte_perm (in0
[3], in1
[0], 0x6543);
315 out0
[1] = __byte_perm (in1
[0], in1
[1], 0x6543);
316 out0
[2] = __byte_perm (in1
[1], in1
[2], 0x6543);
317 out0
[3] = __byte_perm (in1
[2], in1
[3], 0x6543);
318 out1
[0] = __byte_perm (in1
[3], 0, 0x6543);
323 case 16: out0
[0] = in1
[0];
332 case 17: out0
[0] = __byte_perm (in1
[0], in1
[1], 0x4321);
333 out0
[1] = __byte_perm (in1
[1], in1
[2], 0x4321);
334 out0
[2] = __byte_perm (in1
[2], in1
[3], 0x4321);
335 out0
[3] = __byte_perm (in1
[3], 0, 0x4321);
341 case 18: out0
[0] = __byte_perm (in1
[0], in1
[1], 0x5432);
342 out0
[1] = __byte_perm (in1
[1], in1
[2], 0x5432);
343 out0
[2] = __byte_perm (in1
[2], in1
[3], 0x5432);
344 out0
[3] = __byte_perm (in1
[3], 0, 0x5432);
350 case 19: out0
[0] = __byte_perm (in1
[0], in1
[1], 0x6543);
351 out0
[1] = __byte_perm (in1
[1], in1
[2], 0x6543);
352 out0
[2] = __byte_perm (in1
[2], in1
[3], 0x6543);
353 out0
[3] = __byte_perm (in1
[3], 0, 0x6543);
359 case 20: out0
[0] = in1
[1];
368 case 21: out0
[0] = __byte_perm (in1
[1], in1
[2], 0x4321);
369 out0
[1] = __byte_perm (in1
[2], in1
[3], 0x4321);
370 out0
[2] = __byte_perm (in1
[3], 0, 0x4321);
377 case 22: out0
[0] = __byte_perm (in1
[1], in1
[2], 0x5432);
378 out0
[1] = __byte_perm (in1
[2], in1
[3], 0x5432);
379 out0
[2] = __byte_perm (in1
[3], 0, 0x5432);
386 case 23: out0
[0] = __byte_perm (in1
[1], in1
[2], 0x6543);
387 out0
[1] = __byte_perm (in1
[2], in1
[3], 0x6543);
388 out0
[2] = __byte_perm (in1
[3], 0, 0x6543);
395 case 24: out0
[0] = in1
[2];
404 case 25: out0
[0] = __byte_perm (in1
[2], in1
[3], 0x4321);
405 out0
[1] = __byte_perm (in1
[3], 0, 0x4321);
413 case 26: out0
[0] = __byte_perm (in1
[2], in1
[3], 0x5432);
414 out0
[1] = __byte_perm (in1
[3], 0, 0x5432);
422 case 27: out0
[0] = __byte_perm (in1
[2], in1
[3], 0x6543);
423 out0
[1] = __byte_perm (in1
[3], 0, 0x6543);
431 case 28: out0
[0] = in1
[3];
440 case 29: out0
[0] = __byte_perm (in1
[3], 0, 0x4321);
449 case 30: out0
[0] = __byte_perm (in1
[3], 0, 0x5432);
458 case 31: out0
[0] = __byte_perm (in1
[3], 0, 0x6543);
470 #if defined IS_AMD || defined IS_GENERIC
473 case 0: out0
[0] = in0
[0];
482 case 1: out0
[0] = amd_bytealign (in0
[1], in0
[0], 1);
483 out0
[1] = amd_bytealign (in0
[2], in0
[1], 1);
484 out0
[2] = amd_bytealign (in0
[3], in0
[2], 1);
485 out0
[3] = amd_bytealign (in1
[0], in0
[3], 1);
486 out1
[0] = amd_bytealign (in1
[1], in1
[0], 1);
487 out1
[1] = amd_bytealign (in1
[2], in1
[1], 1);
488 out1
[2] = amd_bytealign (in1
[3], in1
[2], 1);
489 out1
[3] = amd_bytealign ( 0, in1
[3], 1);
491 case 2: out0
[0] = amd_bytealign (in0
[1], in0
[0], 2);
492 out0
[1] = amd_bytealign (in0
[2], in0
[1], 2);
493 out0
[2] = amd_bytealign (in0
[3], in0
[2], 2);
494 out0
[3] = amd_bytealign (in1
[0], in0
[3], 2);
495 out1
[0] = amd_bytealign (in1
[1], in1
[0], 2);
496 out1
[1] = amd_bytealign (in1
[2], in1
[1], 2);
497 out1
[2] = amd_bytealign (in1
[3], in1
[2], 2);
498 out1
[3] = amd_bytealign ( 0, in1
[3], 2);
500 case 3: out0
[0] = amd_bytealign (in0
[1], in0
[0], 3);
501 out0
[1] = amd_bytealign (in0
[2], in0
[1], 3);
502 out0
[2] = amd_bytealign (in0
[3], in0
[2], 3);
503 out0
[3] = amd_bytealign (in1
[0], in0
[3], 3);
504 out1
[0] = amd_bytealign (in1
[1], in1
[0], 3);
505 out1
[1] = amd_bytealign (in1
[2], in1
[1], 3);
506 out1
[2] = amd_bytealign (in1
[3], in1
[2], 3);
507 out1
[3] = amd_bytealign ( 0, in1
[3], 3);
509 case 4: out0
[0] = in0
[1];
518 case 5: out0
[0] = amd_bytealign (in0
[2], in0
[1], 1);
519 out0
[1] = amd_bytealign (in0
[3], in0
[2], 1);
520 out0
[2] = amd_bytealign (in1
[0], in0
[3], 1);
521 out0
[3] = amd_bytealign (in1
[1], in1
[0], 1);
522 out1
[0] = amd_bytealign (in1
[2], in1
[1], 1);
523 out1
[1] = amd_bytealign (in1
[3], in1
[2], 1);
524 out1
[2] = amd_bytealign ( 0, in1
[3], 1);
527 case 6: out0
[0] = amd_bytealign (in0
[2], in0
[1], 2);
528 out0
[1] = amd_bytealign (in0
[3], in0
[2], 2);
529 out0
[2] = amd_bytealign (in1
[0], in0
[3], 2);
530 out0
[3] = amd_bytealign (in1
[1], in1
[0], 2);
531 out1
[0] = amd_bytealign (in1
[2], in1
[1], 2);
532 out1
[1] = amd_bytealign (in1
[3], in1
[2], 2);
533 out1
[2] = amd_bytealign ( 0, in1
[3], 2);
536 case 7: out0
[0] = amd_bytealign (in0
[2], in0
[1], 3);
537 out0
[1] = amd_bytealign (in0
[3], in0
[2], 3);
538 out0
[2] = amd_bytealign (in1
[0], in0
[3], 3);
539 out0
[3] = amd_bytealign (in1
[1], in1
[0], 3);
540 out1
[0] = amd_bytealign (in1
[2], in1
[1], 3);
541 out1
[1] = amd_bytealign (in1
[3], in1
[2], 3);
542 out1
[2] = amd_bytealign ( 0, in1
[3], 3);
545 case 8: out0
[0] = in0
[2];
554 case 9: out0
[0] = amd_bytealign (in0
[3], in0
[2], 1);
555 out0
[1] = amd_bytealign (in1
[0], in0
[3], 1);
556 out0
[2] = amd_bytealign (in1
[1], in1
[0], 1);
557 out0
[3] = amd_bytealign (in1
[2], in1
[1], 1);
558 out1
[0] = amd_bytealign (in1
[3], in1
[2], 1);
559 out1
[1] = amd_bytealign ( 0, in1
[3], 1);
563 case 10: out0
[0] = amd_bytealign (in0
[3], in0
[2], 2);
564 out0
[1] = amd_bytealign (in1
[0], in0
[3], 2);
565 out0
[2] = amd_bytealign (in1
[1], in1
[0], 2);
566 out0
[3] = amd_bytealign (in1
[2], in1
[1], 2);
567 out1
[0] = amd_bytealign (in1
[3], in1
[2], 2);
568 out1
[1] = amd_bytealign ( 0, in1
[3], 2);
572 case 11: out0
[0] = amd_bytealign (in0
[3], in0
[2], 3);
573 out0
[1] = amd_bytealign (in1
[0], in0
[3], 3);
574 out0
[2] = amd_bytealign (in1
[1], in1
[0], 3);
575 out0
[3] = amd_bytealign (in1
[2], in1
[1], 3);
576 out1
[0] = amd_bytealign (in1
[3], in1
[2], 3);
577 out1
[1] = amd_bytealign ( 0, in1
[3], 3);
581 case 12: out0
[0] = in0
[3];
590 case 13: out0
[0] = amd_bytealign (in1
[0], in0
[3], 1);
591 out0
[1] = amd_bytealign (in1
[1], in1
[0], 1);
592 out0
[2] = amd_bytealign (in1
[2], in1
[1], 1);
593 out0
[3] = amd_bytealign (in1
[3], in1
[2], 1);
594 out1
[0] = amd_bytealign ( 0, in1
[3], 1);
599 case 14: out0
[0] = amd_bytealign (in1
[0], in0
[3], 2);
600 out0
[1] = amd_bytealign (in1
[1], in1
[0], 2);
601 out0
[2] = amd_bytealign (in1
[2], in1
[1], 2);
602 out0
[3] = amd_bytealign (in1
[3], in1
[2], 2);
603 out1
[0] = amd_bytealign ( 0, in1
[3], 2);
608 case 15: out0
[0] = amd_bytealign (in1
[0], in0
[3], 3);
609 out0
[1] = amd_bytealign (in1
[1], in1
[0], 3);
610 out0
[2] = amd_bytealign (in1
[2], in1
[1], 3);
611 out0
[3] = amd_bytealign (in1
[3], in1
[2], 3);
612 out1
[0] = amd_bytealign ( 0, in1
[3], 3);
617 case 16: out0
[0] = in1
[0];
626 case 17: out0
[0] = amd_bytealign (in1
[1], in1
[0], 1);
627 out0
[1] = amd_bytealign (in1
[2], in1
[1], 1);
628 out0
[2] = amd_bytealign (in1
[3], in1
[2], 1);
629 out0
[3] = amd_bytealign ( 0, in1
[3], 1);
635 case 18: out0
[0] = amd_bytealign (in1
[1], in1
[0], 2);
636 out0
[1] = amd_bytealign (in1
[2], in1
[1], 2);
637 out0
[2] = amd_bytealign (in1
[3], in1
[2], 2);
638 out0
[3] = amd_bytealign ( 0, in1
[3], 2);
644 case 19: out0
[0] = amd_bytealign (in1
[1], in1
[0], 3);
645 out0
[1] = amd_bytealign (in1
[2], in1
[1], 3);
646 out0
[2] = amd_bytealign (in1
[3], in1
[2], 3);
647 out0
[3] = amd_bytealign ( 0, in1
[3], 3);
653 case 20: out0
[0] = in1
[1];
662 case 21: out0
[0] = amd_bytealign (in1
[2], in1
[1], 1);
663 out0
[1] = amd_bytealign (in1
[3], in1
[2], 1);
664 out0
[2] = amd_bytealign ( 0, in1
[3], 1);
671 case 22: out0
[0] = amd_bytealign (in1
[2], in1
[1], 2);
672 out0
[1] = amd_bytealign (in1
[3], in1
[2], 2);
673 out0
[2] = amd_bytealign ( 0, in1
[3], 2);
680 case 23: out0
[0] = amd_bytealign (in1
[2], in1
[1], 3);
681 out0
[1] = amd_bytealign (in1
[3], in1
[2], 3);
682 out0
[2] = amd_bytealign ( 0, in1
[3], 3);
689 case 24: out0
[0] = in1
[2];
698 case 25: out0
[0] = amd_bytealign (in1
[3], in1
[2], 1);
699 out0
[1] = amd_bytealign ( 0, in1
[3], 1);
707 case 26: out0
[0] = amd_bytealign (in1
[3], in1
[2], 2);
708 out0
[1] = amd_bytealign ( 0, in1
[3], 2);
716 case 27: out0
[0] = amd_bytealign (in1
[3], in1
[2], 3);
717 out0
[1] = amd_bytealign ( 0, in1
[3], 3);
725 case 28: out0
[0] = in1
[3];
734 case 29: out0
[0] = amd_bytealign ( 0, in1
[3], 1);
743 case 30: out0
[0] = amd_bytealign ( 0, in1
[3], 2);
752 case 31: out0
[0] = amd_bytealign ( 0, in1
[3], 3);
765 static void rshift_block_N (const u32 in0
[4], const u32 in1
[4], u32 out0
[4], u32 out1
[4], const u32 num
)
770 case 0: out1
[3] = in1
[3];
779 case 1: out1
[3] = __byte_perm (in1
[2], in1
[3], 0x6543);
780 out1
[2] = __byte_perm (in1
[1], in1
[2], 0x6543);
781 out1
[1] = __byte_perm (in1
[0], in1
[1], 0x6543);
782 out1
[0] = __byte_perm (in0
[3], in1
[0], 0x6543);
783 out0
[3] = __byte_perm (in0
[2], in0
[3], 0x6543);
784 out0
[2] = __byte_perm (in0
[1], in0
[2], 0x6543);
785 out0
[1] = __byte_perm (in0
[0], in0
[1], 0x6543);
786 out0
[0] = __byte_perm ( 0, in0
[0], 0x6543);
788 case 2: out1
[3] = __byte_perm (in1
[2], in1
[3], 0x5432);
789 out1
[2] = __byte_perm (in1
[1], in1
[2], 0x5432);
790 out1
[1] = __byte_perm (in1
[0], in1
[1], 0x5432);
791 out1
[0] = __byte_perm (in0
[3], in1
[0], 0x5432);
792 out0
[3] = __byte_perm (in0
[2], in0
[3], 0x5432);
793 out0
[2] = __byte_perm (in0
[1], in0
[2], 0x5432);
794 out0
[1] = __byte_perm (in0
[0], in0
[1], 0x5432);
795 out0
[0] = __byte_perm ( 0, in0
[0], 0x5432);
797 case 3: out1
[3] = __byte_perm (in1
[2], in1
[3], 0x4321);
798 out1
[2] = __byte_perm (in1
[1], in1
[2], 0x4321);
799 out1
[1] = __byte_perm (in1
[0], in1
[1], 0x4321);
800 out1
[0] = __byte_perm (in0
[3], in1
[0], 0x4321);
801 out0
[3] = __byte_perm (in0
[2], in0
[3], 0x4321);
802 out0
[2] = __byte_perm (in0
[1], in0
[2], 0x4321);
803 out0
[1] = __byte_perm (in0
[0], in0
[1], 0x4321);
804 out0
[0] = __byte_perm ( 0, in0
[0], 0x4321);
806 case 4: out1
[3] = in1
[2];
815 case 5: out1
[3] = __byte_perm (in1
[1], in1
[2], 0x6543);
816 out1
[2] = __byte_perm (in1
[0], in1
[1], 0x6543);
817 out1
[1] = __byte_perm (in0
[3], in1
[0], 0x6543);
818 out1
[0] = __byte_perm (in0
[2], in0
[3], 0x6543);
819 out0
[3] = __byte_perm (in0
[1], in0
[2], 0x6543);
820 out0
[2] = __byte_perm (in0
[0], in0
[1], 0x6543);
821 out0
[1] = __byte_perm ( 0, in0
[0], 0x6543);
824 case 6: out1
[3] = __byte_perm (in1
[1], in1
[2], 0x5432);
825 out1
[2] = __byte_perm (in1
[0], in1
[1], 0x5432);
826 out1
[1] = __byte_perm (in0
[3], in1
[0], 0x5432);
827 out1
[0] = __byte_perm (in0
[2], in0
[3], 0x5432);
828 out0
[3] = __byte_perm (in0
[1], in0
[2], 0x5432);
829 out0
[2] = __byte_perm (in0
[0], in0
[1], 0x5432);
830 out0
[1] = __byte_perm ( 0, in0
[0], 0x5432);
833 case 7: out1
[3] = __byte_perm (in1
[1], in1
[2], 0x4321);
834 out1
[2] = __byte_perm (in1
[0], in1
[1], 0x4321);
835 out1
[1] = __byte_perm (in0
[3], in1
[0], 0x4321);
836 out1
[0] = __byte_perm (in0
[2], in0
[3], 0x4321);
837 out0
[3] = __byte_perm (in0
[1], in0
[2], 0x4321);
838 out0
[2] = __byte_perm (in0
[0], in0
[1], 0x4321);
839 out0
[1] = __byte_perm ( 0, in0
[0], 0x4321);
842 case 8: out1
[3] = in1
[1];
851 case 9: out1
[3] = __byte_perm (in1
[0], in1
[1], 0x6543);
852 out1
[2] = __byte_perm (in0
[3], in1
[0], 0x6543);
853 out1
[1] = __byte_perm (in0
[2], in0
[3], 0x6543);
854 out1
[0] = __byte_perm (in0
[1], in0
[2], 0x6543);
855 out0
[3] = __byte_perm (in0
[0], in0
[1], 0x6543);
856 out0
[2] = __byte_perm ( 0, in0
[0], 0x6543);
860 case 10: out1
[3] = __byte_perm (in1
[0], in1
[1], 0x5432);
861 out1
[2] = __byte_perm (in0
[3], in1
[0], 0x5432);
862 out1
[1] = __byte_perm (in0
[2], in0
[3], 0x5432);
863 out1
[0] = __byte_perm (in0
[1], in0
[2], 0x5432);
864 out0
[3] = __byte_perm (in0
[0], in0
[1], 0x5432);
865 out0
[2] = __byte_perm ( 0, in0
[0], 0x5432);
869 case 11: out1
[3] = __byte_perm (in1
[0], in1
[1], 0x4321);
870 out1
[2] = __byte_perm (in0
[3], in1
[0], 0x4321);
871 out1
[1] = __byte_perm (in0
[2], in0
[3], 0x4321);
872 out1
[0] = __byte_perm (in0
[1], in0
[2], 0x4321);
873 out0
[3] = __byte_perm (in0
[0], in0
[1], 0x4321);
874 out0
[2] = __byte_perm ( 0, in0
[0], 0x4321);
878 case 12: out1
[3] = in1
[0];
887 case 13: out1
[3] = __byte_perm (in0
[3], in1
[0], 0x6543);
888 out1
[2] = __byte_perm (in0
[2], in0
[3], 0x6543);
889 out1
[1] = __byte_perm (in0
[1], in0
[2], 0x6543);
890 out1
[0] = __byte_perm (in0
[0], in0
[1], 0x6543);
891 out0
[3] = __byte_perm ( 0, in0
[0], 0x6543);
896 case 14: out1
[3] = __byte_perm (in0
[3], in1
[0], 0x5432);
897 out1
[2] = __byte_perm (in0
[2], in0
[3], 0x5432);
898 out1
[1] = __byte_perm (in0
[1], in0
[2], 0x5432);
899 out1
[0] = __byte_perm (in0
[0], in0
[1], 0x5432);
900 out0
[3] = __byte_perm ( 0, in0
[0], 0x5432);
905 case 15: out1
[3] = __byte_perm (in0
[3], in1
[0], 0x4321);
906 out1
[2] = __byte_perm (in0
[2], in0
[3], 0x4321);
907 out1
[1] = __byte_perm (in0
[1], in0
[2], 0x4321);
908 out1
[0] = __byte_perm (in0
[0], in0
[1], 0x4321);
909 out0
[3] = __byte_perm ( 0, in0
[0], 0x4321);
914 case 16: out1
[3] = in0
[3];
923 case 17: out1
[3] = __byte_perm (in0
[2], in0
[3], 0x6543);
924 out1
[2] = __byte_perm (in0
[1], in0
[2], 0x6543);
925 out1
[1] = __byte_perm (in0
[0], in0
[1], 0x6543);
926 out1
[0] = __byte_perm ( 0, in0
[0], 0x6543);
932 case 18: out1
[3] = __byte_perm (in0
[2], in0
[3], 0x5432);
933 out1
[2] = __byte_perm (in0
[1], in0
[2], 0x5432);
934 out1
[1] = __byte_perm (in0
[0], in0
[1], 0x5432);
935 out1
[0] = __byte_perm ( 0, in0
[0], 0x5432);
941 case 19: out1
[3] = __byte_perm (in0
[2], in0
[3], 0x4321);
942 out1
[2] = __byte_perm (in0
[1], in0
[2], 0x4321);
943 out1
[1] = __byte_perm (in0
[0], in0
[1], 0x4321);
944 out1
[0] = __byte_perm ( 0, in0
[0], 0x4321);
950 case 20: out1
[3] = in0
[2];
959 case 21: out1
[3] = __byte_perm (in0
[1], in0
[2], 0x6543);
960 out1
[2] = __byte_perm (in0
[0], in0
[1], 0x6543);
961 out1
[1] = __byte_perm ( 0, in0
[0], 0x6543);
968 case 22: out1
[3] = __byte_perm (in0
[1], in0
[2], 0x5432);
969 out1
[2] = __byte_perm (in0
[0], in0
[1], 0x5432);
970 out1
[1] = __byte_perm ( 0, in0
[0], 0x5432);
977 case 23: out1
[3] = __byte_perm (in0
[1], in0
[2], 0x4321);
978 out1
[2] = __byte_perm (in0
[0], in0
[1], 0x4321);
979 out1
[1] = __byte_perm ( 0, in0
[0], 0x4321);
986 case 24: out1
[3] = in0
[1];
995 case 25: out1
[3] = __byte_perm (in0
[0], in0
[1], 0x6543);
996 out1
[2] = __byte_perm ( 0, in0
[0], 0x6543);
1004 case 26: out1
[3] = __byte_perm (in0
[0], in0
[1], 0x5432);
1005 out1
[2] = __byte_perm ( 0, in0
[0], 0x5432);
1013 case 27: out1
[3] = __byte_perm (in0
[0], in0
[1], 0x4321);
1014 out1
[2] = __byte_perm ( 0, in0
[0], 0x4321);
1022 case 28: out1
[3] = in0
[0];
1031 case 29: out1
[3] = __byte_perm ( 0, in0
[0], 0x6543);
1040 case 30: out1
[3] = __byte_perm ( 0, in0
[0], 0x5432);
1049 case 31: out1
[3] = __byte_perm ( 0, in0
[0], 0x4321);
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 dst1
[3] = src_l1
[3] | src_r0
[0] << 24;
1658 dst1
[3] = src_l1
[3] | src_r0
[0] << 16;
1661 dst1
[3] = src_l1
[3] | src_r0
[0] << 8;
1664 dst1
[3] = src_r0
[0];
1667 dst1
[3] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1668 dst1
[2] = src_l1
[2] | src_r0
[0] << 24;
1671 dst1
[3] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1672 dst1
[2] = src_l1
[2] | src_r0
[0] << 16;
1675 dst1
[3] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1676 dst1
[2] = src_l1
[2] | src_r0
[0] << 8;
1679 dst1
[3] = src_r0
[1];
1680 dst1
[2] = src_r0
[0];
1683 dst1
[3] = amd_bytealign (src_r0
[2], src_r0
[1], 1);
1684 dst1
[2] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1685 dst1
[1] = src_l1
[1] | src_r0
[0] << 24;
1688 dst1
[3] = amd_bytealign (src_r0
[2], src_r0
[1], 2);
1689 dst1
[2] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1690 dst1
[1] = src_l1
[1] | src_r0
[0] << 16;
1693 dst1
[3] = amd_bytealign (src_r0
[2], src_r0
[1], 3);
1694 dst1
[2] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1695 dst1
[1] = src_l1
[1] | src_r0
[0] << 8;
1698 dst1
[3] = src_r0
[2];
1699 dst1
[2] = src_r0
[1];
1700 dst1
[1] = src_r0
[0];
1703 dst1
[3] = amd_bytealign (src_r0
[3], src_r0
[2], 1);
1704 dst1
[2] = amd_bytealign (src_r0
[2], src_r0
[1], 1);
1705 dst1
[1] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1706 dst1
[0] = src_l1
[0] | src_r0
[0] << 24;
1709 dst1
[3] = amd_bytealign (src_r0
[3], src_r0
[2], 2);
1710 dst1
[2] = amd_bytealign (src_r0
[2], src_r0
[1], 2);
1711 dst1
[1] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1712 dst1
[0] = src_l1
[0] | src_r0
[0] << 16;
1715 dst1
[3] = amd_bytealign (src_r0
[3], src_r0
[2], 3);
1716 dst1
[2] = amd_bytealign (src_r0
[2], src_r0
[1], 3);
1717 dst1
[1] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1718 dst1
[0] = src_l1
[0] | src_r0
[0] << 8;
1721 dst1
[3] = src_r0
[3];
1722 dst1
[2] = src_r0
[2];
1723 dst1
[1] = src_r0
[1];
1724 dst1
[0] = src_r0
[0];
1727 dst1
[3] = amd_bytealign (src_r1
[0], src_r0
[3], 1);
1728 dst1
[2] = amd_bytealign (src_r0
[3], src_r0
[2], 1);
1729 dst1
[1] = amd_bytealign (src_r0
[2], src_r0
[1], 1);
1730 dst1
[0] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1731 dst0
[3] = src_l0
[3] | src_r0
[0] << 24;
1734 dst1
[3] = amd_bytealign (src_r1
[0], src_r0
[3], 2);
1735 dst1
[2] = amd_bytealign (src_r0
[3], src_r0
[2], 2);
1736 dst1
[1] = amd_bytealign (src_r0
[2], src_r0
[1], 2);
1737 dst1
[0] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1738 dst0
[3] = src_l0
[3] | src_r0
[0] << 16;
1741 dst1
[3] = amd_bytealign (src_r1
[0], src_r0
[3], 3);
1742 dst1
[2] = amd_bytealign (src_r0
[3], src_r0
[2], 3);
1743 dst1
[1] = amd_bytealign (src_r0
[2], src_r0
[1], 3);
1744 dst1
[0] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1745 dst0
[3] = src_l0
[3] | src_r0
[0] << 8;
1748 dst1
[3] = src_r1
[0];
1749 dst1
[2] = src_r0
[3];
1750 dst1
[1] = src_r0
[2];
1751 dst1
[0] = src_r0
[1];
1752 dst0
[3] = src_r0
[0];
1755 dst1
[3] = amd_bytealign (src_r1
[1], src_r1
[0], 1);
1756 dst1
[2] = amd_bytealign (src_r1
[0], src_r0
[3], 1);
1757 dst1
[1] = amd_bytealign (src_r0
[3], src_r0
[2], 1);
1758 dst1
[0] = amd_bytealign (src_r0
[2], src_r0
[1], 1);
1759 dst0
[3] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1760 dst0
[2] = src_l0
[2] | src_r0
[0] << 24;
1763 dst1
[3] = amd_bytealign (src_r1
[1], src_r1
[0], 2);
1764 dst1
[2] = amd_bytealign (src_r1
[0], src_r0
[3], 2);
1765 dst1
[1] = amd_bytealign (src_r0
[3], src_r0
[2], 2);
1766 dst1
[0] = amd_bytealign (src_r0
[2], src_r0
[1], 2);
1767 dst0
[3] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1768 dst0
[2] = src_l0
[2] | src_r0
[0] << 16;
1771 dst1
[3] = amd_bytealign (src_r1
[1], src_r1
[0], 3);
1772 dst1
[2] = amd_bytealign (src_r1
[0], src_r0
[3], 3);
1773 dst1
[1] = amd_bytealign (src_r0
[3], src_r0
[2], 3);
1774 dst1
[0] = amd_bytealign (src_r0
[2], src_r0
[1], 3);
1775 dst0
[3] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1776 dst0
[2] = src_l0
[2] | src_r0
[0] << 8;
1779 dst1
[3] = src_r1
[1];
1780 dst1
[2] = src_r1
[0];
1781 dst1
[1] = src_r0
[3];
1782 dst1
[0] = src_r0
[2];
1783 dst0
[3] = src_r0
[1];
1784 dst0
[2] = src_r0
[0];
1787 dst1
[3] = amd_bytealign (src_r1
[2], src_r1
[1], 1);
1788 dst1
[2] = amd_bytealign (src_r1
[1], src_r1
[0], 1);
1789 dst1
[1] = amd_bytealign (src_r1
[0], src_r0
[3], 1);
1790 dst1
[0] = amd_bytealign (src_r0
[3], src_r0
[2], 1);
1791 dst0
[3] = amd_bytealign (src_r0
[2], src_r0
[1], 1);
1792 dst0
[2] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1793 dst0
[1] = src_l0
[1] | src_r0
[0] << 24;
1796 dst1
[3] = amd_bytealign (src_r1
[2], src_r1
[1], 2);
1797 dst1
[2] = amd_bytealign (src_r1
[1], src_r1
[0], 2);
1798 dst1
[1] = amd_bytealign (src_r1
[0], src_r0
[3], 2);
1799 dst1
[0] = amd_bytealign (src_r0
[3], src_r0
[2], 2);
1800 dst0
[3] = amd_bytealign (src_r0
[2], src_r0
[1], 2);
1801 dst0
[2] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1802 dst0
[1] = src_l0
[1] | src_r0
[0] << 16;
1805 dst1
[3] = amd_bytealign (src_r1
[2], src_r1
[1], 3);
1806 dst1
[2] = amd_bytealign (src_r1
[1], src_r1
[0], 3);
1807 dst1
[1] = amd_bytealign (src_r1
[0], src_r0
[3], 3);
1808 dst1
[0] = amd_bytealign (src_r0
[3], src_r0
[2], 3);
1809 dst0
[3] = amd_bytealign (src_r0
[2], src_r0
[1], 3);
1810 dst0
[2] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1811 dst0
[1] = src_l0
[1] | src_r0
[0] << 8;
1814 dst1
[3] = src_r1
[2];
1815 dst1
[2] = src_r1
[1];
1816 dst1
[1] = src_r1
[0];
1817 dst1
[0] = src_r0
[3];
1818 dst0
[3] = src_r0
[2];
1819 dst0
[2] = src_r0
[1];
1820 dst0
[1] = src_r0
[0];
1823 dst1
[3] = amd_bytealign (src_r1
[3], src_r1
[2], 1);
1824 dst1
[2] = amd_bytealign (src_r1
[2], src_r1
[1], 1);
1825 dst1
[1] = amd_bytealign (src_r1
[1], src_r1
[0], 1);
1826 dst1
[0] = amd_bytealign (src_r1
[0], src_r0
[3], 1);
1827 dst0
[3] = amd_bytealign (src_r0
[3], src_r0
[2], 1);
1828 dst0
[2] = amd_bytealign (src_r0
[2], src_r0
[1], 1);
1829 dst0
[1] = amd_bytealign (src_r0
[1], src_r0
[0], 1);
1830 dst0
[0] = src_l0
[0] | src_r0
[0] << 24;
1833 dst1
[3] = amd_bytealign (src_r1
[3], src_r1
[2], 2);
1834 dst1
[2] = amd_bytealign (src_r1
[2], src_r1
[1], 2);
1835 dst1
[1] = amd_bytealign (src_r1
[1], src_r1
[0], 2);
1836 dst1
[0] = amd_bytealign (src_r1
[0], src_r0
[3], 2);
1837 dst0
[3] = amd_bytealign (src_r0
[3], src_r0
[2], 2);
1838 dst0
[2] = amd_bytealign (src_r0
[2], src_r0
[1], 2);
1839 dst0
[1] = amd_bytealign (src_r0
[1], src_r0
[0], 2);
1840 dst0
[0] = src_l0
[0] | src_r0
[0] << 16;
1843 dst1
[3] = amd_bytealign (src_r1
[3], src_r1
[2], 3);
1844 dst1
[2] = amd_bytealign (src_r1
[2], src_r1
[1], 3);
1845 dst1
[1] = amd_bytealign (src_r1
[1], src_r1
[0], 3);
1846 dst1
[0] = amd_bytealign (src_r1
[0], src_r0
[3], 3);
1847 dst0
[3] = amd_bytealign (src_r0
[3], src_r0
[2], 3);
1848 dst0
[2] = amd_bytealign (src_r0
[2], src_r0
[1], 3);
1849 dst0
[1] = amd_bytealign (src_r0
[1], src_r0
[0], 3);
1850 dst0
[0] = src_l0
[0] | src_r0
[0] << 8;
1853 dst1
[3] = src_r1
[3];
1854 dst1
[2] = src_r1
[2];
1855 dst1
[1] = src_r1
[1];
1856 dst1
[0] = src_r1
[0];
1857 dst0
[3] = src_r0
[3];
1858 dst0
[2] = src_r0
[2];
1859 dst0
[1] = src_r0
[1];
1860 dst0
[0] = src_r0
[0];
1866 static void reverse_block (u32 in0
[4], u32 in1
[4], u32 out0
[4], u32 out1
[4], const u32 len
)
1868 rshift_block_N (in0
, in1
, out0
, out1
, 32 - len
);
1882 out0
[0] = swap32 (tib40
[0]);
1883 out0
[1] = swap32 (tib40
[1]);
1884 out0
[2] = swap32 (tib40
[2]);
1885 out0
[3] = swap32 (tib40
[3]);
1886 out1
[0] = swap32 (tib41
[0]);
1887 out1
[1] = swap32 (tib41
[1]);
1888 out1
[2] = swap32 (tib41
[2]);
1889 out1
[3] = swap32 (tib41
[3]);
1892 static u32
rule_op_mangle_lrest (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1894 buf0
[0] |= (generate_cmask (buf0
[0]));
1895 buf0
[1] |= (generate_cmask (buf0
[1]));
1896 buf0
[2] |= (generate_cmask (buf0
[2]));
1897 buf0
[3] |= (generate_cmask (buf0
[3]));
1898 buf1
[0] |= (generate_cmask (buf1
[0]));
1899 buf1
[1] |= (generate_cmask (buf1
[1]));
1900 buf1
[2] |= (generate_cmask (buf1
[2]));
1901 buf1
[3] |= (generate_cmask (buf1
[3]));
1906 static u32
rule_op_mangle_urest (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1908 buf0
[0] &= ~(generate_cmask (buf0
[0]));
1909 buf0
[1] &= ~(generate_cmask (buf0
[1]));
1910 buf0
[2] &= ~(generate_cmask (buf0
[2]));
1911 buf0
[3] &= ~(generate_cmask (buf0
[3]));
1912 buf1
[0] &= ~(generate_cmask (buf1
[0]));
1913 buf1
[1] &= ~(generate_cmask (buf1
[1]));
1914 buf1
[2] &= ~(generate_cmask (buf1
[2]));
1915 buf1
[3] &= ~(generate_cmask (buf1
[3]));
1920 static u32
rule_op_mangle_lrest_ufirst (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1922 rule_op_mangle_lrest (p0
, p1
, buf0
, buf1
, in_len
);
1924 buf0
[0] &= ~(0x00000020 & generate_cmask (buf0
[0]));
1929 static u32
rule_op_mangle_urest_lfirst (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1931 rule_op_mangle_urest (p0
, p1
, buf0
, buf1
, in_len
);
1933 buf0
[0] |= (0x00000020 & generate_cmask (buf0
[0]));
1938 static u32
rule_op_mangle_trest (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1940 buf0
[0] ^= (generate_cmask (buf0
[0]));
1941 buf0
[1] ^= (generate_cmask (buf0
[1]));
1942 buf0
[2] ^= (generate_cmask (buf0
[2]));
1943 buf0
[3] ^= (generate_cmask (buf0
[3]));
1944 buf1
[0] ^= (generate_cmask (buf1
[0]));
1945 buf1
[1] ^= (generate_cmask (buf1
[1]));
1946 buf1
[2] ^= (generate_cmask (buf1
[2]));
1947 buf1
[3] ^= (generate_cmask (buf1
[3]));
1952 static u32
rule_op_mangle_toggle_at (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1954 if (p0
>= in_len
) return (in_len
);
1956 const u32 tmp
= 0x20u
<< ((p0
& 3) * 8);
1960 case 0: buf0
[0] ^= (tmp
& generate_cmask (buf0
[0])); break;
1961 case 1: buf0
[1] ^= (tmp
& generate_cmask (buf0
[1])); break;
1962 case 2: buf0
[2] ^= (tmp
& generate_cmask (buf0
[2])); break;
1963 case 3: buf0
[3] ^= (tmp
& generate_cmask (buf0
[3])); break;
1964 case 4: buf1
[0] ^= (tmp
& generate_cmask (buf1
[0])); break;
1965 case 5: buf1
[1] ^= (tmp
& generate_cmask (buf1
[1])); break;
1966 case 6: buf1
[2] ^= (tmp
& generate_cmask (buf1
[2])); break;
1967 case 7: buf1
[3] ^= (tmp
& generate_cmask (buf1
[3])); break;
1973 static u32
rule_op_mangle_reverse (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1975 reverse_block (buf0
, buf1
, buf0
, buf1
, in_len
);
1980 static u32
rule_op_mangle_dupeword (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1982 if ((in_len
+ in_len
) >= 32) return (in_len
);
1984 u32 out_len
= in_len
;
1986 append_block8 (out_len
, buf0
, buf1
, buf0
, buf1
, buf0
, buf1
);
1993 static u32
rule_op_mangle_dupeword_times (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
1995 if (((in_len
* p0
) + in_len
) >= 32) return (in_len
);
1997 u32 out_len
= in_len
;
2011 for (u32 i
= 0; i
< p0
; i
++)
2013 append_block8 (out_len
, buf0
, buf1
, buf0
, buf1
, tib40
, tib41
);
2021 static u32
rule_op_mangle_reflect (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2023 if ((in_len
+ in_len
) >= 32) return (in_len
);
2025 u32 out_len
= in_len
;
2030 reverse_block (buf0
, buf1
, tib40
, tib41
, out_len
);
2032 append_block8 (out_len
, buf0
, buf1
, buf0
, buf1
, tib40
, tib41
);
2039 static u32
rule_op_mangle_append (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2041 if ((in_len
+ 1) >= 32) return (in_len
);
2043 u32 out_len
= in_len
;
2045 append_block1 (out_len
, buf0
, buf1
, p0
);
2052 static u32
rule_op_mangle_prepend (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2054 if ((in_len
+ 1) >= 32) return (in_len
);
2056 u32 out_len
= in_len
;
2058 rshift_block (buf0
, buf1
, buf0
, buf1
);
2060 buf0
[0] = buf0
[0] | p0
;
2067 static u32
rule_op_mangle_rotate_left (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2069 if (in_len
== 0) return (in_len
);
2071 const u32 in_len1
= in_len
- 1;
2073 const u32 sh
= (in_len1
& 3) * 8;
2075 const u32 tmp
= (buf0
[0] & 0xff) << sh
;
2077 lshift_block (buf0
, buf1
, buf0
, buf1
);
2079 switch (in_len1
/ 4)
2081 case 0: buf0
[0] |= tmp
; break;
2082 case 1: buf0
[1] |= tmp
; break;
2083 case 2: buf0
[2] |= tmp
; break;
2084 case 3: buf0
[3] |= tmp
; break;
2085 case 4: buf1
[0] |= tmp
; break;
2086 case 5: buf1
[1] |= tmp
; break;
2087 case 6: buf1
[2] |= tmp
; break;
2088 case 7: buf1
[3] |= tmp
; break;
2094 static u32
rule_op_mangle_rotate_right (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2096 if (in_len
== 0) return (in_len
);
2098 const u32 in_len1
= in_len
- 1;
2100 const u32 sh
= (in_len1
& 3) * 8;
2104 switch (in_len1
/ 4)
2106 case 0: tmp
= (buf0
[0] >> sh
) & 0xff; break;
2107 case 1: tmp
= (buf0
[1] >> sh
) & 0xff; break;
2108 case 2: tmp
= (buf0
[2] >> sh
) & 0xff; break;
2109 case 3: tmp
= (buf0
[3] >> sh
) & 0xff; break;
2110 case 4: tmp
= (buf1
[0] >> sh
) & 0xff; break;
2111 case 5: tmp
= (buf1
[1] >> sh
) & 0xff; break;
2112 case 6: tmp
= (buf1
[2] >> sh
) & 0xff; break;
2113 case 7: tmp
= (buf1
[3] >> sh
) & 0xff; break;
2116 rshift_block (buf0
, buf1
, buf0
, buf1
);
2120 truncate_right (buf0
, buf1
, in_len
);
2125 static u32
rule_op_mangle_delete_first (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2127 if (in_len
== 0) return (in_len
);
2129 const u32 in_len1
= in_len
- 1;
2131 lshift_block (buf0
, buf1
, buf0
, buf1
);
2136 static u32
rule_op_mangle_delete_last (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2138 if (in_len
== 0) return (in_len
);
2140 const u32 in_len1
= in_len
- 1;
2142 const u32 tmp
= (1 << ((in_len1
& 3) * 8)) - 1;
2144 switch (in_len1
/ 4)
2146 case 0: buf0
[0] &= tmp
; break;
2147 case 1: buf0
[1] &= tmp
; break;
2148 case 2: buf0
[2] &= tmp
; break;
2149 case 3: buf0
[3] &= tmp
; break;
2150 case 4: buf1
[0] &= tmp
; break;
2151 case 5: buf1
[1] &= tmp
; break;
2152 case 6: buf1
[2] &= tmp
; break;
2153 case 7: buf1
[3] &= tmp
; break;
2159 static u32
rule_op_mangle_delete_at (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2161 if (p0
>= in_len
) return (in_len
);
2163 u32 out_len
= in_len
;
2168 lshift_block (buf0
, buf1
, tib40
, tib41
);
2170 const u32 ml
= (1 << ((p0
& 3) * 8)) - 1;
2175 case 0: buf0
[0] = (buf0
[0] & ml
)
2185 case 1: buf0
[1] = (buf0
[1] & ml
)
2194 case 2: buf0
[2] = (buf0
[2] & ml
)
2202 case 3: buf0
[3] = (buf0
[3] & ml
)
2209 case 4: buf1
[0] = (buf1
[0] & ml
)
2215 case 5: buf1
[1] = (buf1
[1] & ml
)
2220 case 6: buf1
[2] = (buf1
[2] & ml
)
2224 case 7: buf1
[3] = (buf1
[3] & ml
)
2234 static u32
rule_op_mangle_extract (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2236 if (p0
>= in_len
) return (in_len
);
2238 if ((p0
+ p1
) > in_len
) return (in_len
);
2242 lshift_block_N (buf0
, buf1
, buf0
, buf1
, p0
);
2244 truncate_right (buf0
, buf1
, out_len
);
2249 static u32
rule_op_mangle_omit (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2251 if (p0
>= in_len
) return (in_len
);
2253 if ((p0
+ p1
) > in_len
) return (in_len
);
2255 u32 out_len
= in_len
;
2269 lshift_block_N (buf0
, buf1
, tib40
, tib41
, p1
);
2271 const u32 ml
= (1 << ((p0
& 3) * 8)) - 1;
2276 case 0: buf0
[0] = (buf0
[0] & ml
)
2286 case 1: buf0
[1] = (buf0
[1] & ml
)
2295 case 2: buf0
[2] = (buf0
[2] & ml
)
2303 case 3: buf0
[3] = (buf0
[3] & ml
)
2310 case 4: buf1
[0] = (buf1
[0] & ml
)
2316 case 5: buf1
[1] = (buf1
[1] & ml
)
2321 case 6: buf1
[2] = (buf1
[2] & ml
)
2325 case 7: buf1
[3] = (buf1
[3] & ml
)
2335 static u32
rule_op_mangle_insert (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2337 if (p0
> in_len
) return (in_len
);
2339 if ((in_len
+ 1) >= 32) return (in_len
);
2341 u32 out_len
= in_len
;
2346 rshift_block (buf0
, buf1
, tib40
, tib41
);
2348 const u32 p1n
= p1
<< ((p0
& 3) * 8);
2350 const u32 ml
= (1 << ((p0
& 3) * 8)) - 1;
2352 const u32 mr
= 0xffffff00 << ((p0
& 3) * 8);
2356 case 0: buf0
[0] = (buf0
[0] & ml
) | p1n
| (tib40
[0] & mr
);
2365 case 1: buf0
[1] = (buf0
[1] & ml
) | p1n
| (tib40
[1] & mr
);
2373 case 2: buf0
[2] = (buf0
[2] & ml
) | p1n
| (tib40
[2] & mr
);
2380 case 3: buf0
[3] = (buf0
[3] & ml
) | p1n
| (tib40
[3] & mr
);
2386 case 4: buf1
[0] = (buf1
[0] & ml
) | p1n
| (tib41
[0] & mr
);
2391 case 5: buf1
[1] = (buf1
[1] & ml
) | p1n
| (tib41
[1] & mr
);
2395 case 6: buf1
[2] = (buf1
[2] & ml
) | p1n
| (tib41
[2] & mr
);
2398 case 7: buf1
[3] = (buf1
[3] & ml
) | p1n
| (tib41
[3] & mr
);
2407 static u32
rule_op_mangle_overstrike (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2409 if (p0
>= in_len
) return (in_len
);
2411 const u32 p1n
= p1
<< ((p0
& 3) * 8);
2413 const u32 m
= ~(0xffu
<< ((p0
& 3) * 8));
2417 case 0: buf0
[0] = (buf0
[0] & m
) | p1n
; break;
2418 case 1: buf0
[1] = (buf0
[1] & m
) | p1n
; break;
2419 case 2: buf0
[2] = (buf0
[2] & m
) | p1n
; break;
2420 case 3: buf0
[3] = (buf0
[3] & m
) | p1n
; break;
2421 case 4: buf1
[0] = (buf1
[0] & m
) | p1n
; break;
2422 case 5: buf1
[1] = (buf1
[1] & m
) | p1n
; break;
2423 case 6: buf1
[2] = (buf1
[2] & m
) | p1n
; break;
2424 case 7: buf1
[3] = (buf1
[3] & m
) | p1n
; break;
2430 static u32
rule_op_mangle_truncate_at (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2432 if (p0
>= in_len
) return (in_len
);
2434 truncate_right (buf0
, buf1
, p0
);
2439 static u32
rule_op_mangle_replace (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2442 for (u32 i
= 0; i
< in_len
; i
++)
2446 case 0: if ((__byte_perm (buf0
[0], 0, 0x6540)) == p0
) buf0
[0] = __byte_perm (p1
, buf0
[0], 0x7650);
2448 case 1: if ((__byte_perm (buf0
[0], 0, 0x6541)) == p0
) buf0
[0] = __byte_perm (p1
, buf0
[0], 0x7604);
2450 case 2: if ((__byte_perm (buf0
[0], 0, 0x6542)) == p0
) buf0
[0] = __byte_perm (p1
, buf0
[0], 0x7054);
2452 case 3: if ((__byte_perm (buf0
[0], 0, 0x6543)) == p0
) buf0
[0] = __byte_perm (p1
, buf0
[0], 0x0654);
2454 case 4: if ((__byte_perm (buf0
[1], 0, 0x6540)) == p0
) buf0
[1] = __byte_perm (p1
, buf0
[1], 0x7650);
2456 case 5: if ((__byte_perm (buf0
[1], 0, 0x6541)) == p0
) buf0
[1] = __byte_perm (p1
, buf0
[1], 0x7604);
2458 case 6: if ((__byte_perm (buf0
[1], 0, 0x6542)) == p0
) buf0
[1] = __byte_perm (p1
, buf0
[1], 0x7054);
2460 case 7: if ((__byte_perm (buf0
[1], 0, 0x6543)) == p0
) buf0
[1] = __byte_perm (p1
, buf0
[1], 0x0654);
2462 case 8: if ((__byte_perm (buf0
[2], 0, 0x6540)) == p0
) buf0
[2] = __byte_perm (p1
, buf0
[2], 0x7650);
2464 case 9: if ((__byte_perm (buf0
[2], 0, 0x6541)) == p0
) buf0
[2] = __byte_perm (p1
, buf0
[2], 0x7604);
2466 case 10: if ((__byte_perm (buf0
[2], 0, 0x6542)) == p0
) buf0
[2] = __byte_perm (p1
, buf0
[2], 0x7054);
2468 case 11: if ((__byte_perm (buf0
[2], 0, 0x6543)) == p0
) buf0
[2] = __byte_perm (p1
, buf0
[2], 0x0654);
2470 case 12: if ((__byte_perm (buf0
[3], 0, 0x6540)) == p0
) buf0
[3] = __byte_perm (p1
, buf0
[3], 0x7650);
2472 case 13: if ((__byte_perm (buf0
[3], 0, 0x6541)) == p0
) buf0
[3] = __byte_perm (p1
, buf0
[3], 0x7604);
2474 case 14: if ((__byte_perm (buf0
[3], 0, 0x6542)) == p0
) buf0
[3] = __byte_perm (p1
, buf0
[3], 0x7054);
2476 case 15: if ((__byte_perm (buf0
[3], 0, 0x6543)) == p0
) buf0
[3] = __byte_perm (p1
, buf0
[3], 0x0654);
2478 case 16: if ((__byte_perm (buf1
[0], 0, 0x6540)) == p0
) buf1
[0] = __byte_perm (p1
, buf1
[0], 0x7650);
2480 case 17: if ((__byte_perm (buf1
[0], 0, 0x6541)) == p0
) buf1
[0] = __byte_perm (p1
, buf1
[0], 0x7604);
2482 case 18: if ((__byte_perm (buf1
[0], 0, 0x6542)) == p0
) buf1
[0] = __byte_perm (p1
, buf1
[0], 0x7054);
2484 case 19: if ((__byte_perm (buf1
[0], 0, 0x6543)) == p0
) buf1
[0] = __byte_perm (p1
, buf1
[0], 0x0654);
2486 case 20: if ((__byte_perm (buf1
[1], 0, 0x6540)) == p0
) buf1
[1] = __byte_perm (p1
, buf1
[1], 0x7650);
2488 case 21: if ((__byte_perm (buf1
[1], 0, 0x6541)) == p0
) buf1
[1] = __byte_perm (p1
, buf1
[1], 0x7604);
2490 case 22: if ((__byte_perm (buf1
[1], 0, 0x6542)) == p0
) buf1
[1] = __byte_perm (p1
, buf1
[1], 0x7054);
2492 case 23: if ((__byte_perm (buf1
[1], 0, 0x6543)) == p0
) buf1
[1] = __byte_perm (p1
, buf1
[1], 0x0654);
2494 case 24: if ((__byte_perm (buf1
[2], 0, 0x6540)) == p0
) buf1
[2] = __byte_perm (p1
, buf1
[2], 0x7650);
2496 case 25: if ((__byte_perm (buf1
[2], 0, 0x6541)) == p0
) buf1
[2] = __byte_perm (p1
, buf1
[2], 0x7604);
2498 case 26: if ((__byte_perm (buf1
[2], 0, 0x6542)) == p0
) buf1
[2] = __byte_perm (p1
, buf1
[2], 0x7054);
2500 case 27: if ((__byte_perm (buf1
[2], 0, 0x6543)) == p0
) buf1
[2] = __byte_perm (p1
, buf1
[2], 0x0654);
2502 case 28: if ((__byte_perm (buf1
[3], 0, 0x6540)) == p0
) buf1
[3] = __byte_perm (p1
, buf1
[3], 0x7650);
2504 case 29: if ((__byte_perm (buf1
[3], 0, 0x6541)) == p0
) buf1
[3] = __byte_perm (p1
, buf1
[3], 0x7604);
2506 case 30: if ((__byte_perm (buf1
[3], 0, 0x6542)) == p0
) buf1
[3] = __byte_perm (p1
, buf1
[3], 0x7054);
2508 case 31: if ((__byte_perm (buf1
[3], 0, 0x6543)) == p0
) buf1
[3] = __byte_perm (p1
, buf1
[3], 0x0654);
2514 #if defined IS_AMD || defined IS_GENERIC
2515 const uchar4 tmp0
= (uchar4
) (p0
);
2516 const uchar4 tmp1
= (uchar4
) (p1
);
2520 tmp
= as_uchar4 (buf0
[0]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf0
[0] = as_uint (tmp
);
2521 tmp
= as_uchar4 (buf0
[1]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf0
[1] = as_uint (tmp
);
2522 tmp
= as_uchar4 (buf0
[2]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf0
[2] = as_uint (tmp
);
2523 tmp
= as_uchar4 (buf0
[3]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf0
[3] = as_uint (tmp
);
2524 tmp
= as_uchar4 (buf1
[0]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf1
[0] = as_uint (tmp
);
2525 tmp
= as_uchar4 (buf1
[1]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf1
[1] = as_uint (tmp
);
2526 tmp
= as_uchar4 (buf1
[2]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf1
[2] = as_uint (tmp
);
2527 tmp
= as_uchar4 (buf1
[3]); tmp
= select (tmp
, tmp1
, tmp
== tmp0
); buf1
[3] = as_uint (tmp
);
2533 static u32
rule_op_mangle_purgechar (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2539 static u32
rule_op_mangle_togglecase_rec (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2545 static u32
rule_op_mangle_dupechar_first (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2547 if ( in_len
== 0) return (in_len
);
2548 if ((in_len
+ p0
) >= 32) return (in_len
);
2550 u32 out_len
= in_len
;
2552 const u32 tmp
= buf0
[0] & 0xFF;
2554 rshift_block_N (buf0
, buf1
, buf0
, buf1
, p0
);
2559 case 1: buf0
[0] |= tmp
;
2561 case 2: buf0
[0] |= __byte_perm (tmp
, 0, 0x5400);
2563 case 3: buf0
[0] |= __byte_perm (tmp
, 0, 0x4000);
2565 case 4: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2567 case 5: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2570 case 6: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2571 buf0
[1] |= __byte_perm (tmp
, 0, 0x5400);
2573 case 7: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2574 buf0
[1] |= __byte_perm (tmp
, 0, 0x4000);
2576 case 8: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2577 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2579 case 9: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2580 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2583 case 10: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2584 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2585 buf0
[2] |= __byte_perm (tmp
, 0, 0x5400);
2587 case 11: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2588 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2589 buf0
[2] |= __byte_perm (tmp
, 0, 0x4000);
2591 case 12: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2592 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2593 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2595 case 13: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2596 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2597 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2600 case 14: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2601 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2602 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2603 buf0
[3] |= __byte_perm (tmp
, 0, 0x5400);
2605 case 15: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2606 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2607 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2608 buf0
[3] |= __byte_perm (tmp
, 0, 0x4000);
2610 case 16: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2611 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2612 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2613 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2615 case 17: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2616 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2617 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2618 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2621 case 18: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2622 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2623 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2624 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2625 buf1
[0] |= __byte_perm (tmp
, 0, 0x5400);
2627 case 19: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2628 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2629 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2630 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2631 buf1
[0] |= __byte_perm (tmp
, 0, 0x4000);
2633 case 20: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2634 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2635 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2636 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2637 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2639 case 21: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2640 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2641 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2642 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2643 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2646 case 22: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2647 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2648 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2649 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2650 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2651 buf1
[1] |= __byte_perm (tmp
, 0, 0x5400);
2653 case 23: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2654 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2655 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2656 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2657 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2658 buf1
[1] |= __byte_perm (tmp
, 0, 0x4000);
2660 case 24: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2661 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2662 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2663 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2664 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2665 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2667 case 25: 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, 0x0000);
2671 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2672 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2675 case 26: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2676 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2677 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2678 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2679 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2680 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2681 buf1
[2] |= __byte_perm (tmp
, 0, 0x5400);
2683 case 27: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2684 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2685 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2686 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2687 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2688 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2689 buf1
[2] |= __byte_perm (tmp
, 0, 0x4000);
2691 case 28: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2692 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2693 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2694 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2695 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2696 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2697 buf1
[2] |= __byte_perm (tmp
, 0, 0x0000);
2699 case 29: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2700 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2701 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2702 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2703 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2704 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2705 buf1
[2] |= __byte_perm (tmp
, 0, 0x0000);
2708 case 30: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2709 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2710 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2711 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2712 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2713 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2714 buf1
[2] |= __byte_perm (tmp
, 0, 0x0000);
2715 buf1
[3] |= __byte_perm (tmp
, 0, 0x5400);
2717 case 31: buf0
[0] |= __byte_perm (tmp
, 0, 0x0000);
2718 buf0
[1] |= __byte_perm (tmp
, 0, 0x0000);
2719 buf0
[2] |= __byte_perm (tmp
, 0, 0x0000);
2720 buf0
[3] |= __byte_perm (tmp
, 0, 0x0000);
2721 buf1
[0] |= __byte_perm (tmp
, 0, 0x0000);
2722 buf1
[1] |= __byte_perm (tmp
, 0, 0x0000);
2723 buf1
[2] |= __byte_perm (tmp
, 0, 0x0000);
2724 buf1
[3] |= __byte_perm (tmp
, 0, 0x4000);
2729 #if defined IS_AMD || defined IS_GENERIC
2732 case 1: buf0
[0] |= tmp
<< 0;
2734 case 2: buf0
[0] |= tmp
<< 0 | tmp
<< 8;
2736 case 3: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2738 case 4: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2740 case 5: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2741 buf0
[1] |= tmp
<< 0;
2743 case 6: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2744 buf0
[1] |= tmp
<< 0 | tmp
<< 8;
2746 case 7: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2747 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2749 case 8: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2750 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2752 case 9: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2753 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2754 buf0
[2] |= tmp
<< 0;
2756 case 10: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2757 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2758 buf0
[2] |= tmp
<< 0 | tmp
<< 8;
2760 case 11: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2761 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2762 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2764 case 12: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2765 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2766 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2768 case 13: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2769 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2770 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2771 buf0
[3] |= tmp
<< 0;
2773 case 14: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2774 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2775 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2776 buf0
[3] |= tmp
<< 0 | tmp
<< 8;
2778 case 15: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2779 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2780 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2781 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2783 case 16: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2784 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2785 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2786 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2788 case 17: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2789 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2790 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2791 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2792 buf1
[0] |= tmp
<< 0;
2794 case 18: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2795 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2796 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2797 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2798 buf1
[0] |= tmp
<< 0 | tmp
<< 8;
2800 case 19: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2801 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2802 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2803 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2804 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2806 case 20: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2807 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2808 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2809 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2810 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2812 case 21: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2813 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2814 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2815 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2816 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2817 buf1
[1] |= tmp
<< 0;
2819 case 22: 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 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2822 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2823 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2824 buf1
[1] |= tmp
<< 0 | tmp
<< 8;
2826 case 23: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2827 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2828 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2829 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2830 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2831 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2833 case 24: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2834 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2835 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2836 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2837 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2838 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2840 case 25: 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 | tmp
<< 16 | tmp
<< 24;
2844 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2845 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2846 buf1
[2] |= tmp
<< 0;
2848 case 26: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2849 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2850 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2851 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2852 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2853 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2854 buf1
[2] |= tmp
<< 0 | tmp
<< 8;
2856 case 27: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2857 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2858 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2859 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2860 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2861 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2862 buf1
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2864 case 28: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2865 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2866 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2867 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2868 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2869 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2870 buf1
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2872 case 29: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2873 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2874 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2875 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2876 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2877 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2878 buf1
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2879 buf1
[3] |= tmp
<< 0;
2881 case 30: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2882 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2883 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2884 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2885 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2886 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2887 buf1
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2888 buf1
[3] |= tmp
<< 0 | tmp
<< 8;
2890 case 31: buf0
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2891 buf0
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2892 buf0
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2893 buf0
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2894 buf1
[0] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2895 buf1
[1] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2896 buf1
[2] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16 | tmp
<< 24;
2897 buf1
[3] |= tmp
<< 0 | tmp
<< 8 | tmp
<< 16;
2907 static u32
rule_op_mangle_dupechar_last (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2909 if ( in_len
== 0) return (in_len
);
2910 if ((in_len
+ p0
) >= 32) return (in_len
);
2912 const u32 in_len1
= in_len
- 1;
2914 const u32 sh
= (in_len1
& 3) * 8;
2918 switch (in_len1
/ 4)
2920 case 0: tmp
= (buf0
[0] >> sh
) & 0xff; break;
2921 case 1: tmp
= (buf0
[1] >> sh
) & 0xff; break;
2922 case 2: tmp
= (buf0
[2] >> sh
) & 0xff; break;
2923 case 3: tmp
= (buf0
[3] >> sh
) & 0xff; break;
2924 case 4: tmp
= (buf1
[0] >> sh
) & 0xff; break;
2925 case 5: tmp
= (buf1
[1] >> sh
) & 0xff; break;
2926 case 6: tmp
= (buf1
[2] >> sh
) & 0xff; break;
2927 case 7: tmp
= (buf1
[3] >> sh
) & 0xff; break;
2930 u32 out_len
= in_len
;
2932 for (u32 i
= 0; i
< p0
; i
++)
2934 append_block1 (out_len
, buf0
, buf1
, tmp
);
2942 static u32
rule_op_mangle_dupechar_all (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2944 if ( in_len
== 0) return (in_len
);
2945 if ((in_len
+ in_len
) >= 32) return (in_len
);
2947 u32 out_len
= in_len
;
2953 tib40
[0] = __byte_perm (buf0
[0], 0, 0x1100);
2954 tib40
[1] = __byte_perm (buf0
[0], 0, 0x3322);
2955 tib40
[2] = __byte_perm (buf0
[1], 0, 0x1100);
2956 tib40
[3] = __byte_perm (buf0
[1], 0, 0x3322);
2957 tib41
[0] = __byte_perm (buf0
[2], 0, 0x1100);
2958 tib41
[1] = __byte_perm (buf0
[2], 0, 0x3322);
2959 tib41
[2] = __byte_perm (buf0
[3], 0, 0x1100);
2960 tib41
[3] = __byte_perm (buf0
[3], 0, 0x3322);
2972 #if defined IS_AMD || defined IS_GENERIC
2973 tib40
[0] = ((buf0
[0] & 0x000000FF) << 0) | ((buf0
[0] & 0x0000FF00) << 8);
2974 tib40
[1] = ((buf0
[0] & 0x00FF0000) >> 16) | ((buf0
[0] & 0xFF000000) >> 8);
2975 tib40
[2] = ((buf0
[1] & 0x000000FF) << 0) | ((buf0
[1] & 0x0000FF00) << 8);
2976 tib40
[3] = ((buf0
[1] & 0x00FF0000) >> 16) | ((buf0
[1] & 0xFF000000) >> 8);
2977 tib41
[0] = ((buf0
[2] & 0x000000FF) << 0) | ((buf0
[2] & 0x0000FF00) << 8);
2978 tib41
[1] = ((buf0
[2] & 0x00FF0000) >> 16) | ((buf0
[2] & 0xFF000000) >> 8);
2979 tib41
[2] = ((buf0
[3] & 0x000000FF) << 0) | ((buf0
[3] & 0x0000FF00) << 8);
2980 tib41
[3] = ((buf0
[3] & 0x00FF0000) >> 16) | ((buf0
[3] & 0xFF000000) >> 8);
2982 buf0
[0] = tib40
[0] | (tib40
[0] << 8);
2983 buf0
[1] = tib40
[1] | (tib40
[1] << 8);
2984 buf0
[2] = tib40
[2] | (tib40
[2] << 8);
2985 buf0
[3] = tib40
[3] | (tib40
[3] << 8);
2986 buf1
[0] = tib41
[0] | (tib41
[0] << 8);
2987 buf1
[1] = tib41
[1] | (tib41
[1] << 8);
2988 buf1
[2] = tib41
[2] | (tib41
[2] << 8);
2989 buf1
[3] = tib41
[3] | (tib41
[3] << 8);
2992 out_len
= out_len
+ out_len
;
2997 static u32
rule_op_mangle_switch_first (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
2999 if (in_len
< 2) return (in_len
);
3002 buf0
[0] = __byte_perm (buf0
[0], 0, 0x3201);
3005 #if defined IS_AMD || defined IS_GENERIC
3006 buf0
[0] = (buf0
[0] & 0xFFFF0000) | ((buf0
[0] << 8) & 0x0000FF00) | ((buf0
[0] >> 8) & 0x000000FF);
3012 static u32
rule_op_mangle_switch_last (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3014 if (in_len
< 2) return (in_len
);
3019 case 2: buf0
[0] = __byte_perm (buf0
[0], 0, 0x5401);
3021 case 3: buf0
[0] = __byte_perm (buf0
[0], 0, 0x4120);
3023 case 4: buf0
[0] = __byte_perm (buf0
[0], 0, 0x2310);
3025 case 5: buf0
[1] = __byte_perm (buf0
[1], buf0
[0], 0x7210);
3026 buf0
[0] = __byte_perm (buf0
[0], buf0
[1], 0x4210);
3027 buf0
[1] = __byte_perm (buf0
[1], 0, 0x6543);
3029 case 6: buf0
[1] = __byte_perm (buf0
[1], 0, 0x5401);
3031 case 7: buf0
[1] = __byte_perm (buf0
[1], 0, 0x4120);
3033 case 8: buf0
[1] = __byte_perm (buf0
[1], 0, 0x2310);
3035 case 9: buf0
[2] = __byte_perm (buf0
[2], buf0
[1], 0x7210);
3036 buf0
[1] = __byte_perm (buf0
[1], buf0
[2], 0x4210);
3037 buf0
[2] = __byte_perm (buf0
[2], 0, 0x6543);
3039 case 10: buf0
[2] = __byte_perm (buf0
[2], 0, 0x5401);
3041 case 11: buf0
[2] = __byte_perm (buf0
[2], 0, 0x4120);
3043 case 12: buf0
[2] = __byte_perm (buf0
[2], 0, 0x2310);
3045 case 13: buf0
[3] = __byte_perm (buf0
[3], buf0
[2], 0x7210);
3046 buf0
[2] = __byte_perm (buf0
[2], buf0
[3], 0x4210);
3047 buf0
[3] = __byte_perm (buf0
[3], 0, 0x6543);
3049 case 14: buf0
[3] = __byte_perm (buf0
[3], 0, 0x5401);
3051 case 15: buf0
[3] = __byte_perm (buf0
[3], 0, 0x4120);
3053 case 16: buf0
[3] = __byte_perm (buf0
[3], 0, 0x2310);
3055 case 17: buf1
[0] = __byte_perm (buf1
[0], buf0
[3], 0x7210);
3056 buf0
[3] = __byte_perm (buf0
[3], buf1
[0], 0x4210);
3057 buf1
[0] = __byte_perm (buf1
[0], 0, 0x6543);
3059 case 18: buf1
[0] = __byte_perm (buf1
[0], 0, 0x5401);
3061 case 19: buf1
[0] = __byte_perm (buf1
[0], 0, 0x4120);
3063 case 20: buf1
[0] = __byte_perm (buf1
[0], 0, 0x2310);
3065 case 21: buf1
[1] = __byte_perm (buf1
[1], buf1
[0], 0x7210);
3066 buf1
[0] = __byte_perm (buf1
[0], buf1
[1], 0x4210);
3067 buf1
[1] = __byte_perm (buf1
[1], 0, 0x6543);
3069 case 22: buf1
[1] = __byte_perm (buf1
[1], 0, 0x5401);
3071 case 23: buf1
[1] = __byte_perm (buf1
[1], 0, 0x4120);
3073 case 24: buf1
[1] = __byte_perm (buf1
[1], 0, 0x2310);
3075 case 25: buf1
[2] = __byte_perm (buf1
[2], buf1
[1], 0x7210);
3076 buf1
[1] = __byte_perm (buf1
[1], buf1
[2], 0x4210);
3077 buf1
[2] = __byte_perm (buf1
[2], 0, 0x6543);
3079 case 26: buf1
[2] = __byte_perm (buf1
[2], 0, 0x5401);
3081 case 27: buf1
[2] = __byte_perm (buf1
[2], 0, 0x4120);
3083 case 28: buf1
[2] = __byte_perm (buf1
[2], 0, 0x2310);
3085 case 29: buf1
[3] = __byte_perm (buf1
[3], buf1
[2], 0x7210);
3086 buf1
[2] = __byte_perm (buf1
[2], buf1
[3], 0x4210);
3087 buf1
[3] = __byte_perm (buf1
[3], 0, 0x6543);
3089 case 30: buf1
[3] = __byte_perm (buf1
[3], 0, 0x5401);
3091 case 31: buf1
[3] = __byte_perm (buf1
[3], 0, 0x4120);
3096 #if defined IS_AMD || defined IS_GENERIC
3099 case 2: buf0
[0] = ((buf0
[0] << 8) & 0x0000FF00) | ((buf0
[0] >> 8) & 0x000000FF);
3101 case 3: buf0
[0] = (buf0
[0] & 0x000000FF) | ((buf0
[0] << 8) & 0x00FF0000) | ((buf0
[0] >> 8) & 0x0000FF00);
3103 case 4: buf0
[0] = (buf0
[0] & 0x0000FFFF) | ((buf0
[0] << 8) & 0xFF000000) | ((buf0
[0] >> 8) & 0x00FF0000);
3105 case 5: buf0
[1] = (buf0
[0] & 0xFF000000) | buf0
[1];
3106 buf0
[0] = (buf0
[0] & 0x00FFFFFF) | (buf0
[1] << 24);
3107 buf0
[1] = (buf0
[1] >> 24);
3109 case 6: buf0
[1] = ((buf0
[1] << 8) & 0x0000FF00) | ((buf0
[1] >> 8) & 0x000000FF);
3111 case 7: buf0
[1] = (buf0
[1] & 0x000000FF) | ((buf0
[1] << 8) & 0x00FF0000) | ((buf0
[1] >> 8) & 0x0000FF00);
3113 case 8: buf0
[1] = (buf0
[1] & 0x0000FFFF) | ((buf0
[1] << 8) & 0xFF000000) | ((buf0
[1] >> 8) & 0x00FF0000);
3115 case 9: buf0
[2] = (buf0
[1] & 0xFF000000) | buf0
[2];
3116 buf0
[1] = (buf0
[1] & 0x00FFFFFF) | (buf0
[2] << 24);
3117 buf0
[2] = (buf0
[2] >> 24);
3119 case 10: buf0
[2] = ((buf0
[2] << 8) & 0x0000FF00) | ((buf0
[2] >> 8) & 0x000000FF);
3121 case 11: buf0
[2] = (buf0
[2] & 0x000000FF) | ((buf0
[2] << 8) & 0x00FF0000) | ((buf0
[2] >> 8) & 0x0000FF00);
3123 case 12: buf0
[2] = (buf0
[2] & 0x0000FFFF) | ((buf0
[2] << 8) & 0xFF000000) | ((buf0
[2] >> 8) & 0x00FF0000);
3125 case 13: buf0
[3] = (buf0
[2] & 0xFF000000) | buf0
[3];
3126 buf0
[2] = (buf0
[2] & 0x00FFFFFF) | (buf0
[3] << 24);
3127 buf0
[3] = (buf0
[3] >> 24);
3129 case 14: buf0
[3] = ((buf0
[3] << 8) & 0x0000FF00) | ((buf0
[3] >> 8) & 0x000000FF);
3131 case 15: buf0
[3] = (buf0
[3] & 0x000000FF) | ((buf0
[3] << 8) & 0x00FF0000) | ((buf0
[3] >> 8) & 0x0000FF00);
3133 case 16: buf0
[3] = (buf0
[3] & 0x0000FFFF) | ((buf0
[3] << 8) & 0xFF000000) | ((buf0
[3] >> 8) & 0x00FF0000);
3135 case 17: buf1
[0] = (buf0
[3] & 0xFF000000) | buf1
[0];
3136 buf0
[3] = (buf0
[3] & 0x00FFFFFF) | (buf1
[0] << 24);
3137 buf1
[0] = (buf1
[0] >> 24);
3139 case 18: buf1
[0] = ((buf1
[0] << 8) & 0x0000FF00) | ((buf1
[0] >> 8) & 0x000000FF);
3141 case 19: buf1
[0] = (buf1
[0] & 0x000000FF) | ((buf1
[0] << 8) & 0x00FF0000) | ((buf1
[0] >> 8) & 0x0000FF00);
3143 case 20: buf1
[0] = (buf1
[0] & 0x0000FFFF) | ((buf1
[0] << 8) & 0xFF000000) | ((buf1
[0] >> 8) & 0x00FF0000);
3145 case 21: buf1
[1] = (buf1
[0] & 0xFF000000) | buf1
[1];
3146 buf1
[0] = (buf1
[0] & 0x00FFFFFF) | (buf1
[1] << 24);
3147 buf1
[1] = (buf1
[1] >> 24);
3149 case 22: buf1
[1] = ((buf1
[1] << 8) & 0x0000FF00) | ((buf1
[1] >> 8) & 0x000000FF);
3151 case 23: buf1
[1] = (buf1
[1] & 0x000000FF) | ((buf1
[1] << 8) & 0x00FF0000) | ((buf1
[1] >> 8) & 0x0000FF00);
3153 case 24: buf1
[1] = (buf1
[1] & 0x0000FFFF) | ((buf1
[1] << 8) & 0xFF000000) | ((buf1
[1] >> 8) & 0x00FF0000);
3155 case 25: buf1
[2] = (buf1
[1] & 0xFF000000) | buf1
[2];
3156 buf1
[1] = (buf1
[1] & 0x00FFFFFF) | (buf1
[2] << 24);
3157 buf1
[2] = (buf1
[2] >> 24);
3159 case 26: buf1
[2] = ((buf1
[2] << 8) & 0x0000FF00) | ((buf1
[2] >> 8) & 0x000000FF);
3161 case 27: buf1
[2] = (buf1
[2] & 0x000000FF) | ((buf1
[2] << 8) & 0x00FF0000) | ((buf1
[2] >> 8) & 0x0000FF00);
3163 case 28: buf1
[2] = (buf1
[2] & 0x0000FFFF) | ((buf1
[2] << 8) & 0xFF000000) | ((buf1
[2] >> 8) & 0x00FF0000);
3165 case 29: buf1
[3] = (buf1
[2] & 0xFF000000) | buf1
[3];
3166 buf1
[2] = (buf1
[2] & 0x00FFFFFF) | (buf1
[3] << 24);
3167 buf1
[3] = (buf1
[3] >> 24);
3169 case 30: buf1
[3] = ((buf1
[3] << 8) & 0x0000FF00) | ((buf1
[3] >> 8) & 0x000000FF);
3171 case 31: buf1
[3] = (buf1
[3] & 0x000000FF) | ((buf1
[3] << 8) & 0x00FF0000) | ((buf1
[3] >> 8) & 0x0000FF00);
3179 static u32
rule_op_mangle_switch_at (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3181 if (p0
>= in_len
) return (in_len
);
3182 if (p1
>= in_len
) return (in_len
);
3190 case 0: tmp0
= __byte_perm (buf0
[0], 0, 0x6540);
3192 case 1: tmp0
= __byte_perm (buf0
[0], 0, 0x6541);
3194 case 2: tmp0
= __byte_perm (buf0
[0], 0, 0x6542);
3196 case 3: tmp0
= __byte_perm (buf0
[0], 0, 0x6543);
3198 case 4: tmp0
= __byte_perm (buf0
[1], 0, 0x6540);
3200 case 5: tmp0
= __byte_perm (buf0
[1], 0, 0x6541);
3202 case 6: tmp0
= __byte_perm (buf0
[1], 0, 0x6542);
3204 case 7: tmp0
= __byte_perm (buf0
[1], 0, 0x6543);
3206 case 8: tmp0
= __byte_perm (buf0
[2], 0, 0x6540);
3208 case 9: tmp0
= __byte_perm (buf0
[2], 0, 0x6541);
3210 case 10: tmp0
= __byte_perm (buf0
[2], 0, 0x6542);
3212 case 11: tmp0
= __byte_perm (buf0
[2], 0, 0x6543);
3214 case 12: tmp0
= __byte_perm (buf0
[3], 0, 0x6540);
3216 case 13: tmp0
= __byte_perm (buf0
[3], 0, 0x6541);
3218 case 14: tmp0
= __byte_perm (buf0
[3], 0, 0x6542);
3220 case 15: tmp0
= __byte_perm (buf0
[3], 0, 0x6543);
3222 case 16: tmp0
= __byte_perm (buf1
[0], 0, 0x6540);
3224 case 17: tmp0
= __byte_perm (buf1
[0], 0, 0x6541);
3226 case 18: tmp0
= __byte_perm (buf1
[0], 0, 0x6542);
3228 case 19: tmp0
= __byte_perm (buf1
[0], 0, 0x6543);
3230 case 20: tmp0
= __byte_perm (buf1
[1], 0, 0x6540);
3232 case 21: tmp0
= __byte_perm (buf1
[1], 0, 0x6541);
3234 case 22: tmp0
= __byte_perm (buf1
[1], 0, 0x6542);
3236 case 23: tmp0
= __byte_perm (buf1
[1], 0, 0x6543);
3238 case 24: tmp0
= __byte_perm (buf1
[2], 0, 0x6540);
3240 case 25: tmp0
= __byte_perm (buf1
[2], 0, 0x6541);
3242 case 26: tmp0
= __byte_perm (buf1
[2], 0, 0x6542);
3244 case 27: tmp0
= __byte_perm (buf1
[2], 0, 0x6543);
3246 case 28: tmp0
= __byte_perm (buf1
[3], 0, 0x6540);
3248 case 29: tmp0
= __byte_perm (buf1
[3], 0, 0x6541);
3250 case 30: tmp0
= __byte_perm (buf1
[3], 0, 0x6542);
3252 case 31: tmp0
= __byte_perm (buf1
[3], 0, 0x6543);
3258 case 0: tmp1
= __byte_perm (buf0
[0], 0, 0x6540);
3259 buf0
[0] = __byte_perm (tmp0
, buf0
[0], 0x7650);
3261 case 1: tmp1
= __byte_perm (buf0
[0], 0, 0x6541);
3262 buf0
[0] = __byte_perm (tmp0
, buf0
[0], 0x7604);
3264 case 2: tmp1
= __byte_perm (buf0
[0], 0, 0x6542);
3265 buf0
[0] = __byte_perm (tmp0
, buf0
[0], 0x7054);
3267 case 3: tmp1
= __byte_perm (buf0
[0], 0, 0x6543);
3268 buf0
[0] = __byte_perm (tmp0
, buf0
[0], 0x0654);
3270 case 4: tmp1
= __byte_perm (buf0
[1], 0, 0x6540);
3271 buf0
[1] = __byte_perm (tmp0
, buf0
[1], 0x7650);
3273 case 5: tmp1
= __byte_perm (buf0
[1], 0, 0x6541);
3274 buf0
[1] = __byte_perm (tmp0
, buf0
[1], 0x7604);
3276 case 6: tmp1
= __byte_perm (buf0
[1], 0, 0x6542);
3277 buf0
[1] = __byte_perm (tmp0
, buf0
[1], 0x7054);
3279 case 7: tmp1
= __byte_perm (buf0
[1], 0, 0x6543);
3280 buf0
[1] = __byte_perm (tmp0
, buf0
[1], 0x0654);
3282 case 8: tmp1
= __byte_perm (buf0
[2], 0, 0x6540);
3283 buf0
[2] = __byte_perm (tmp0
, buf0
[2], 0x7650);
3285 case 9: tmp1
= __byte_perm (buf0
[2], 0, 0x6541);
3286 buf0
[2] = __byte_perm (tmp0
, buf0
[2], 0x7604);
3288 case 10: tmp1
= __byte_perm (buf0
[2], 0, 0x6542);
3289 buf0
[2] = __byte_perm (tmp0
, buf0
[2], 0x7054);
3291 case 11: tmp1
= __byte_perm (buf0
[2], 0, 0x6543);
3292 buf0
[2] = __byte_perm (tmp0
, buf0
[2], 0x0654);
3294 case 12: tmp1
= __byte_perm (buf0
[3], 0, 0x6540);
3295 buf0
[3] = __byte_perm (tmp0
, buf0
[3], 0x7650);
3297 case 13: tmp1
= __byte_perm (buf0
[3], 0, 0x6541);
3298 buf0
[3] = __byte_perm (tmp0
, buf0
[3], 0x7604);
3300 case 14: tmp1
= __byte_perm (buf0
[3], 0, 0x6542);
3301 buf0
[3] = __byte_perm (tmp0
, buf0
[3], 0x7054);
3303 case 15: tmp1
= __byte_perm (buf0
[3], 0, 0x6543);
3304 buf0
[3] = __byte_perm (tmp0
, buf0
[3], 0x0654);
3306 case 16: tmp1
= __byte_perm (buf1
[0], 0, 0x6540);
3307 buf1
[0] = __byte_perm (tmp0
, buf1
[0], 0x7650);
3309 case 17: tmp1
= __byte_perm (buf1
[0], 0, 0x6541);
3310 buf1
[0] = __byte_perm (tmp0
, buf1
[0], 0x7604);
3312 case 18: tmp1
= __byte_perm (buf1
[0], 0, 0x6542);
3313 buf1
[0] = __byte_perm (tmp0
, buf1
[0], 0x7054);
3315 case 19: tmp1
= __byte_perm (buf1
[0], 0, 0x6543);
3316 buf1
[0] = __byte_perm (tmp0
, buf1
[0], 0x0654);
3318 case 20: tmp1
= __byte_perm (buf1
[1], 0, 0x6540);
3319 buf1
[1] = __byte_perm (tmp0
, buf1
[1], 0x7650);
3321 case 21: tmp1
= __byte_perm (buf1
[1], 0, 0x6541);
3322 buf1
[1] = __byte_perm (tmp0
, buf1
[1], 0x7604);
3324 case 22: tmp1
= __byte_perm (buf1
[1], 0, 0x6542);
3325 buf1
[1] = __byte_perm (tmp0
, buf1
[1], 0x7054);
3327 case 23: tmp1
= __byte_perm (buf1
[1], 0, 0x6543);
3328 buf1
[1] = __byte_perm (tmp0
, buf1
[1], 0x0654);
3330 case 24: tmp1
= __byte_perm (buf1
[2], 0, 0x6540);
3331 buf1
[2] = __byte_perm (tmp0
, buf1
[2], 0x7650);
3333 case 25: tmp1
= __byte_perm (buf1
[2], 0, 0x6541);
3334 buf1
[2] = __byte_perm (tmp0
, buf1
[2], 0x7604);
3336 case 26: tmp1
= __byte_perm (buf1
[2], 0, 0x6542);
3337 buf1
[2] = __byte_perm (tmp0
, buf1
[2], 0x7054);
3339 case 27: tmp1
= __byte_perm (buf1
[2], 0, 0x6543);
3340 buf1
[2] = __byte_perm (tmp0
, buf1
[2], 0x0654);
3342 case 28: tmp1
= __byte_perm (buf1
[3], 0, 0x6540);
3343 buf1
[3] = __byte_perm (tmp0
, buf1
[3], 0x7650);
3345 case 29: tmp1
= __byte_perm (buf1
[3], 0, 0x6541);
3346 buf1
[3] = __byte_perm (tmp0
, buf1
[3], 0x7604);
3348 case 30: tmp1
= __byte_perm (buf1
[3], 0, 0x6542);
3349 buf1
[3] = __byte_perm (tmp0
, buf1
[3], 0x7054);
3351 case 31: tmp1
= __byte_perm (buf1
[3], 0, 0x6543);
3352 buf1
[3] = __byte_perm (tmp0
, buf1
[3], 0x0654);
3358 case 0: buf0
[0] = __byte_perm (tmp1
, buf0
[0], 0x7650);
3360 case 1: buf0
[0] = __byte_perm (tmp1
, buf0
[0], 0x7604);
3362 case 2: buf0
[0] = __byte_perm (tmp1
, buf0
[0], 0x7054);
3364 case 3: buf0
[0] = __byte_perm (tmp1
, buf0
[0], 0x0654);
3366 case 4: buf0
[1] = __byte_perm (tmp1
, buf0
[1], 0x7650);
3368 case 5: buf0
[1] = __byte_perm (tmp1
, buf0
[1], 0x7604);
3370 case 6: buf0
[1] = __byte_perm (tmp1
, buf0
[1], 0x7054);
3372 case 7: buf0
[1] = __byte_perm (tmp1
, buf0
[1], 0x0654);
3374 case 8: buf0
[2] = __byte_perm (tmp1
, buf0
[2], 0x7650);
3376 case 9: buf0
[2] = __byte_perm (tmp1
, buf0
[2], 0x7604);
3378 case 10: buf0
[2] = __byte_perm (tmp1
, buf0
[2], 0x7054);
3380 case 11: buf0
[2] = __byte_perm (tmp1
, buf0
[2], 0x0654);
3382 case 12: buf0
[3] = __byte_perm (tmp1
, buf0
[3], 0x7650);
3384 case 13: buf0
[3] = __byte_perm (tmp1
, buf0
[3], 0x7604);
3386 case 14: buf0
[3] = __byte_perm (tmp1
, buf0
[3], 0x7054);
3388 case 15: buf0
[3] = __byte_perm (tmp1
, buf0
[3], 0x0654);
3390 case 16: buf1
[0] = __byte_perm (tmp1
, buf1
[0], 0x7650);
3392 case 17: buf1
[0] = __byte_perm (tmp1
, buf1
[0], 0x7604);
3394 case 18: buf1
[0] = __byte_perm (tmp1
, buf1
[0], 0x7054);
3396 case 19: buf1
[0] = __byte_perm (tmp1
, buf1
[0], 0x0654);
3398 case 20: buf1
[1] = __byte_perm (tmp1
, buf1
[1], 0x7650);
3400 case 21: buf1
[1] = __byte_perm (tmp1
, buf1
[1], 0x7604);
3402 case 22: buf1
[1] = __byte_perm (tmp1
, buf1
[1], 0x7054);
3404 case 23: buf1
[1] = __byte_perm (tmp1
, buf1
[1], 0x0654);
3406 case 24: buf1
[2] = __byte_perm (tmp1
, buf1
[2], 0x7650);
3408 case 25: buf1
[2] = __byte_perm (tmp1
, buf1
[2], 0x7604);
3410 case 26: buf1
[2] = __byte_perm (tmp1
, buf1
[2], 0x7054);
3412 case 27: buf1
[2] = __byte_perm (tmp1
, buf1
[2], 0x0654);
3414 case 28: buf1
[3] = __byte_perm (tmp1
, buf1
[3], 0x7650);
3416 case 29: buf1
[3] = __byte_perm (tmp1
, buf1
[3], 0x7604);
3418 case 30: buf1
[3] = __byte_perm (tmp1
, buf1
[3], 0x7054);
3420 case 31: buf1
[3] = __byte_perm (tmp1
, buf1
[3], 0x0654);
3425 #if defined IS_AMD || defined IS_GENERIC
3428 case 0: tmp0
= (buf0
[0] >> 0) & 0xFF;
3430 case 1: tmp0
= (buf0
[0] >> 8) & 0xFF;
3432 case 2: tmp0
= (buf0
[0] >> 16) & 0xFF;
3434 case 3: tmp0
= (buf0
[0] >> 24) & 0xFF;
3436 case 4: tmp0
= (buf0
[1] >> 0) & 0xFF;
3438 case 5: tmp0
= (buf0
[1] >> 8) & 0xFF;
3440 case 6: tmp0
= (buf0
[1] >> 16) & 0xFF;
3442 case 7: tmp0
= (buf0
[1] >> 24) & 0xFF;
3444 case 8: tmp0
= (buf0
[2] >> 0) & 0xFF;
3446 case 9: tmp0
= (buf0
[2] >> 8) & 0xFF;
3448 case 10: tmp0
= (buf0
[2] >> 16) & 0xFF;
3450 case 11: tmp0
= (buf0
[2] >> 24) & 0xFF;
3452 case 12: tmp0
= (buf0
[3] >> 0) & 0xFF;
3454 case 13: tmp0
= (buf0
[3] >> 8) & 0xFF;
3456 case 14: tmp0
= (buf0
[3] >> 16) & 0xFF;
3458 case 15: tmp0
= (buf0
[3] >> 24) & 0xFF;
3460 case 16: tmp0
= (buf1
[0] >> 0) & 0xFF;
3462 case 17: tmp0
= (buf1
[0] >> 8) & 0xFF;
3464 case 18: tmp0
= (buf1
[0] >> 16) & 0xFF;
3466 case 19: tmp0
= (buf1
[0] >> 24) & 0xFF;
3468 case 20: tmp0
= (buf1
[1] >> 0) & 0xFF;
3470 case 21: tmp0
= (buf1
[1] >> 8) & 0xFF;
3472 case 22: tmp0
= (buf1
[1] >> 16) & 0xFF;
3474 case 23: tmp0
= (buf1
[1] >> 24) & 0xFF;
3476 case 24: tmp0
= (buf1
[2] >> 0) & 0xFF;
3478 case 25: tmp0
= (buf1
[2] >> 8) & 0xFF;
3480 case 26: tmp0
= (buf1
[2] >> 16) & 0xFF;
3482 case 27: tmp0
= (buf1
[2] >> 24) & 0xFF;
3484 case 28: tmp0
= (buf1
[3] >> 0) & 0xFF;
3486 case 29: tmp0
= (buf1
[3] >> 8) & 0xFF;
3488 case 30: tmp0
= (buf1
[3] >> 16) & 0xFF;
3490 case 31: tmp0
= (buf1
[3] >> 24) & 0xFF;
3496 case 0: tmp1
= (buf0
[0] >> 0) & 0xff;
3497 buf0
[0] = (buf0
[0] & 0xffffff00) | tmp0
<< 0;
3499 case 1: tmp1
= (buf0
[0] >> 8) & 0xff;
3500 buf0
[0] = (buf0
[0] & 0xffff00ff) | tmp0
<< 8;
3502 case 2: tmp1
= (buf0
[0] >> 16) & 0xff;
3503 buf0
[0] = (buf0
[0] & 0xff00ffff) | tmp0
<< 16;
3505 case 3: tmp1
= (buf0
[0] >> 24) & 0xff;
3506 buf0
[0] = (buf0
[0] & 0x00ffffff) | tmp0
<< 24;
3508 case 4: tmp1
= (buf0
[1] >> 0) & 0xff;
3509 buf0
[1] = (buf0
[1] & 0xffffff00) | tmp0
<< 0;
3511 case 5: tmp1
= (buf0
[1] >> 8) & 0xff;
3512 buf0
[1] = (buf0
[1] & 0xffff00ff) | tmp0
<< 8;
3514 case 6: tmp1
= (buf0
[1] >> 16) & 0xff;
3515 buf0
[1] = (buf0
[1] & 0xff00ffff) | tmp0
<< 16;
3517 case 7: tmp1
= (buf0
[1] >> 24) & 0xff;
3518 buf0
[1] = (buf0
[1] & 0x00ffffff) | tmp0
<< 24;
3520 case 8: tmp1
= (buf0
[2] >> 0) & 0xff;
3521 buf0
[2] = (buf0
[2] & 0xffffff00) | tmp0
<< 0;
3523 case 9: tmp1
= (buf0
[2] >> 8) & 0xff;
3524 buf0
[2] = (buf0
[2] & 0xffff00ff) | tmp0
<< 8;
3526 case 10: tmp1
= (buf0
[2] >> 16) & 0xff;
3527 buf0
[2] = (buf0
[2] & 0xff00ffff) | tmp0
<< 16;
3529 case 11: tmp1
= (buf0
[2] >> 24) & 0xff;
3530 buf0
[2] = (buf0
[2] & 0x00ffffff) | tmp0
<< 24;
3532 case 12: tmp1
= (buf0
[3] >> 0) & 0xff;
3533 buf0
[3] = (buf0
[3] & 0xffffff00) | tmp0
<< 0;
3535 case 13: tmp1
= (buf0
[3] >> 8) & 0xff;
3536 buf0
[3] = (buf0
[3] & 0xffff00ff) | tmp0
<< 8;
3538 case 14: tmp1
= (buf0
[3] >> 16) & 0xff;
3539 buf0
[3] = (buf0
[3] & 0xff00ffff) | tmp0
<< 16;
3541 case 15: tmp1
= (buf0
[3] >> 24) & 0xff;
3542 buf0
[3] = (buf0
[3] & 0x00ffffff) | tmp0
<< 24;
3544 case 16: tmp1
= (buf1
[0] >> 0) & 0xff;
3545 buf1
[0] = (buf1
[0] & 0xffffff00) | tmp0
<< 0;
3547 case 17: tmp1
= (buf1
[0] >> 8) & 0xff;
3548 buf1
[0] = (buf1
[0] & 0xffff00ff) | tmp0
<< 8;
3550 case 18: tmp1
= (buf1
[0] >> 16) & 0xff;
3551 buf1
[0] = (buf1
[0] & 0xff00ffff) | tmp0
<< 16;
3553 case 19: tmp1
= (buf1
[0] >> 24) & 0xff;
3554 buf1
[0] = (buf1
[0] & 0x00ffffff) | tmp0
<< 24;
3556 case 20: tmp1
= (buf1
[1] >> 0) & 0xff;
3557 buf1
[1] = (buf1
[1] & 0xffffff00) | tmp0
<< 0;
3559 case 21: tmp1
= (buf1
[1] >> 8) & 0xff;
3560 buf1
[1] = (buf1
[1] & 0xffff00ff) | tmp0
<< 8;
3562 case 22: tmp1
= (buf1
[1] >> 16) & 0xff;
3563 buf1
[1] = (buf1
[1] & 0xff00ffff) | tmp0
<< 16;
3565 case 23: tmp1
= (buf1
[1] >> 24) & 0xff;
3566 buf1
[1] = (buf1
[1] & 0x00ffffff) | tmp0
<< 24;
3568 case 24: tmp1
= (buf1
[2] >> 0) & 0xff;
3569 buf1
[2] = (buf1
[2] & 0xffffff00) | tmp0
<< 0;
3571 case 25: tmp1
= (buf1
[2] >> 8) & 0xff;
3572 buf1
[2] = (buf1
[2] & 0xffff00ff) | tmp0
<< 8;
3574 case 26: tmp1
= (buf1
[2] >> 16) & 0xff;
3575 buf1
[2] = (buf1
[2] & 0xff00ffff) | tmp0
<< 16;
3577 case 27: tmp1
= (buf1
[2] >> 24) & 0xff;
3578 buf1
[2] = (buf1
[2] & 0x00ffffff) | tmp0
<< 24;
3580 case 28: tmp1
= (buf1
[3] >> 0) & 0xff;
3581 buf1
[3] = (buf1
[3] & 0xffffff00) | tmp0
<< 0;
3583 case 29: tmp1
= (buf1
[3] >> 8) & 0xff;
3584 buf1
[3] = (buf1
[3] & 0xffff00ff) | tmp0
<< 8;
3586 case 30: tmp1
= (buf1
[3] >> 16) & 0xff;
3587 buf1
[3] = (buf1
[3] & 0xff00ffff) | tmp0
<< 16;
3589 case 31: tmp1
= (buf1
[3] >> 24) & 0xff;
3590 buf1
[3] = (buf1
[3] & 0x00ffffff) | tmp0
<< 24;
3596 case 0: buf0
[0] = (buf0
[0] & 0xffffff00) | tmp1
<< 0;
3598 case 1: buf0
[0] = (buf0
[0] & 0xffff00ff) | tmp1
<< 8;
3600 case 2: buf0
[0] = (buf0
[0] & 0xff00ffff) | tmp1
<< 16;
3602 case 3: buf0
[0] = (buf0
[0] & 0x00ffffff) | tmp1
<< 24;
3604 case 4: buf0
[1] = (buf0
[1] & 0xffffff00) | tmp1
<< 0;
3606 case 5: buf0
[1] = (buf0
[1] & 0xffff00ff) | tmp1
<< 8;
3608 case 6: buf0
[1] = (buf0
[1] & 0xff00ffff) | tmp1
<< 16;
3610 case 7: buf0
[1] = (buf0
[1] & 0x00ffffff) | tmp1
<< 24;
3612 case 8: buf0
[2] = (buf0
[2] & 0xffffff00) | tmp1
<< 0;
3614 case 9: buf0
[2] = (buf0
[2] & 0xffff00ff) | tmp1
<< 8;
3616 case 10: buf0
[2] = (buf0
[2] & 0xff00ffff) | tmp1
<< 16;
3618 case 11: buf0
[2] = (buf0
[2] & 0x00ffffff) | tmp1
<< 24;
3620 case 12: buf0
[3] = (buf0
[3] & 0xffffff00) | tmp1
<< 0;
3622 case 13: buf0
[3] = (buf0
[3] & 0xffff00ff) | tmp1
<< 8;
3624 case 14: buf0
[3] = (buf0
[3] & 0xff00ffff) | tmp1
<< 16;
3626 case 15: buf0
[3] = (buf0
[3] & 0x00ffffff) | tmp1
<< 24;
3628 case 16: buf1
[0] = (buf1
[0] & 0xffffff00) | tmp1
<< 0;
3630 case 17: buf1
[0] = (buf1
[0] & 0xffff00ff) | tmp1
<< 8;
3632 case 18: buf1
[0] = (buf1
[0] & 0xff00ffff) | tmp1
<< 16;
3634 case 19: buf1
[0] = (buf1
[0] & 0x00ffffff) | tmp1
<< 24;
3636 case 20: buf1
[1] = (buf1
[1] & 0xffffff00) | tmp1
<< 0;
3638 case 21: buf1
[1] = (buf1
[1] & 0xffff00ff) | tmp1
<< 8;
3640 case 22: buf1
[1] = (buf1
[1] & 0xff00ffff) | tmp1
<< 16;
3642 case 23: buf1
[1] = (buf1
[1] & 0x00ffffff) | tmp1
<< 24;
3644 case 24: buf1
[2] = (buf1
[2] & 0xffffff00) | tmp1
<< 0;
3646 case 25: buf1
[2] = (buf1
[2] & 0xffff00ff) | tmp1
<< 8;
3648 case 26: buf1
[2] = (buf1
[2] & 0xff00ffff) | tmp1
<< 16;
3650 case 27: buf1
[2] = (buf1
[2] & 0x00ffffff) | tmp1
<< 24;
3652 case 28: buf1
[3] = (buf1
[3] & 0xffffff00) | tmp1
<< 0;
3654 case 29: buf1
[3] = (buf1
[3] & 0xffff00ff) | tmp1
<< 8;
3656 case 30: buf1
[3] = (buf1
[3] & 0xff00ffff) | tmp1
<< 16;
3658 case 31: buf1
[3] = (buf1
[3] & 0x00ffffff) | tmp1
<< 24;
3666 static u32
rule_op_mangle_chr_shiftl (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3668 if (p0
>= in_len
) return (in_len
);
3670 const u32 mr
= 0xffu
<< ((p0
& 3) * 8);
3675 case 0: buf0
[0] = (buf0
[0] & ml
) | (((buf0
[0] & mr
) << 1) & mr
); break;
3676 case 1: buf0
[1] = (buf0
[1] & ml
) | (((buf0
[1] & mr
) << 1) & mr
); break;
3677 case 2: buf0
[2] = (buf0
[2] & ml
) | (((buf0
[2] & mr
) << 1) & mr
); break;
3678 case 3: buf0
[3] = (buf0
[3] & ml
) | (((buf0
[3] & mr
) << 1) & mr
); break;
3679 case 4: buf1
[0] = (buf1
[0] & ml
) | (((buf1
[0] & mr
) << 1) & mr
); break;
3680 case 5: buf1
[1] = (buf1
[1] & ml
) | (((buf1
[1] & mr
) << 1) & mr
); break;
3681 case 6: buf1
[2] = (buf1
[2] & ml
) | (((buf1
[2] & mr
) << 1) & mr
); break;
3682 case 7: buf1
[3] = (buf1
[3] & ml
) | (((buf1
[3] & mr
) << 1) & mr
); break;
3688 static u32
rule_op_mangle_chr_shiftr (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3690 if (p0
>= in_len
) return (in_len
);
3692 const u32 mr
= 0xffu
<< ((p0
& 3) * 8);
3697 case 0: buf0
[0] = (buf0
[0] & ml
) | (((buf0
[0] & mr
) >> 1) & mr
); break;
3698 case 1: buf0
[1] = (buf0
[1] & ml
) | (((buf0
[1] & mr
) >> 1) & mr
); break;
3699 case 2: buf0
[2] = (buf0
[2] & ml
) | (((buf0
[2] & mr
) >> 1) & mr
); break;
3700 case 3: buf0
[3] = (buf0
[3] & ml
) | (((buf0
[3] & mr
) >> 1) & mr
); break;
3701 case 4: buf1
[0] = (buf1
[0] & ml
) | (((buf1
[0] & mr
) >> 1) & mr
); break;
3702 case 5: buf1
[1] = (buf1
[1] & ml
) | (((buf1
[1] & mr
) >> 1) & mr
); break;
3703 case 6: buf1
[2] = (buf1
[2] & ml
) | (((buf1
[2] & mr
) >> 1) & mr
); break;
3704 case 7: buf1
[3] = (buf1
[3] & ml
) | (((buf1
[3] & mr
) >> 1) & mr
); break;
3710 static u32
rule_op_mangle_chr_incr (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3712 if (p0
>= in_len
) return (in_len
);
3714 const u32 mr
= 0xffu
<< ((p0
& 3) * 8);
3717 const u32 n
= 0x01010101 & mr
;
3721 case 0: buf0
[0] = (buf0
[0] & ml
) | (((buf0
[0] & mr
) + n
) & mr
); break;
3722 case 1: buf0
[1] = (buf0
[1] & ml
) | (((buf0
[1] & mr
) + n
) & mr
); break;
3723 case 2: buf0
[2] = (buf0
[2] & ml
) | (((buf0
[2] & mr
) + n
) & mr
); break;
3724 case 3: buf0
[3] = (buf0
[3] & ml
) | (((buf0
[3] & mr
) + n
) & mr
); break;
3725 case 4: buf1
[0] = (buf1
[0] & ml
) | (((buf1
[0] & mr
) + n
) & mr
); break;
3726 case 5: buf1
[1] = (buf1
[1] & ml
) | (((buf1
[1] & mr
) + n
) & mr
); break;
3727 case 6: buf1
[2] = (buf1
[2] & ml
) | (((buf1
[2] & mr
) + n
) & mr
); break;
3728 case 7: buf1
[3] = (buf1
[3] & ml
) | (((buf1
[3] & mr
) + n
) & mr
); break;
3734 static u32
rule_op_mangle_chr_decr (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3736 if (p0
>= in_len
) return (in_len
);
3738 const u32 mr
= 0xffu
<< ((p0
& 3) * 8);
3741 const u32 n
= 0x01010101 & mr
;
3745 case 0: buf0
[0] = (buf0
[0] & ml
) | (((buf0
[0] & mr
) - n
) & mr
); break;
3746 case 1: buf0
[1] = (buf0
[1] & ml
) | (((buf0
[1] & mr
) - n
) & mr
); break;
3747 case 2: buf0
[2] = (buf0
[2] & ml
) | (((buf0
[2] & mr
) - n
) & mr
); break;
3748 case 3: buf0
[3] = (buf0
[3] & ml
) | (((buf0
[3] & mr
) - n
) & mr
); break;
3749 case 4: buf1
[0] = (buf1
[0] & ml
) | (((buf1
[0] & mr
) - n
) & mr
); break;
3750 case 5: buf1
[1] = (buf1
[1] & ml
) | (((buf1
[1] & mr
) - n
) & mr
); break;
3751 case 6: buf1
[2] = (buf1
[2] & ml
) | (((buf1
[2] & mr
) - n
) & mr
); break;
3752 case 7: buf1
[3] = (buf1
[3] & ml
) | (((buf1
[3] & mr
) - n
) & mr
); break;
3758 static u32
rule_op_mangle_replace_np1 (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3760 if ((p0
+ 1) >= in_len
) return (in_len
);
3765 lshift_block (buf0
, buf1
, tib40
, tib41
);
3767 const u32 mr
= 0xffu
<< ((p0
& 3) * 8);
3772 case 0: buf0
[0] = (buf0
[0] & ml
) | (tib40
[0] & mr
); break;
3773 case 1: buf0
[1] = (buf0
[1] & ml
) | (tib40
[1] & mr
); break;
3774 case 2: buf0
[2] = (buf0
[2] & ml
) | (tib40
[2] & mr
); break;
3775 case 3: buf0
[3] = (buf0
[3] & ml
) | (tib40
[3] & mr
); break;
3776 case 4: buf1
[0] = (buf1
[0] & ml
) | (tib41
[0] & mr
); break;
3777 case 5: buf1
[1] = (buf1
[1] & ml
) | (tib41
[1] & mr
); break;
3778 case 6: buf1
[2] = (buf1
[2] & ml
) | (tib41
[2] & mr
); break;
3779 case 7: buf1
[3] = (buf1
[3] & ml
) | (tib41
[3] & mr
); break;
3785 static u32
rule_op_mangle_replace_nm1 (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3787 if (p0
== 0) return (in_len
);
3789 if (p0
>= in_len
) return (in_len
);
3794 rshift_block (buf0
, buf1
, tib40
, tib41
);
3796 const u32 mr
= 0xffu
<< ((p0
& 3) * 8);
3801 case 0: buf0
[0] = (buf0
[0] & ml
) | (tib40
[0] & mr
); break;
3802 case 1: buf0
[1] = (buf0
[1] & ml
) | (tib40
[1] & mr
); break;
3803 case 2: buf0
[2] = (buf0
[2] & ml
) | (tib40
[2] & mr
); break;
3804 case 3: buf0
[3] = (buf0
[3] & ml
) | (tib40
[3] & mr
); break;
3805 case 4: buf1
[0] = (buf1
[0] & ml
) | (tib41
[0] & mr
); break;
3806 case 5: buf1
[1] = (buf1
[1] & ml
) | (tib41
[1] & mr
); break;
3807 case 6: buf1
[2] = (buf1
[2] & ml
) | (tib41
[2] & mr
); break;
3808 case 7: buf1
[3] = (buf1
[3] & ml
) | (tib41
[3] & mr
); break;
3814 static u32
rule_op_mangle_dupeblock_first (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3816 if (p0
> in_len
) return (in_len
);
3818 if ((in_len
+ p0
) >= 32) return (in_len
);
3820 u32 out_len
= in_len
;
3834 truncate_right (tib40
, tib41
, p0
);
3836 rshift_block_N (buf0
, buf1
, buf0
, buf1
, p0
);
3838 buf0
[0] |= tib40
[0];
3839 buf0
[1] |= tib40
[1];
3840 buf0
[2] |= tib40
[2];
3841 buf0
[3] |= tib40
[3];
3842 buf1
[0] |= tib41
[0];
3843 buf1
[1] |= tib41
[1];
3844 buf1
[2] |= tib41
[2];
3845 buf1
[3] |= tib41
[3];
3852 static u32
rule_op_mangle_dupeblock_last (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3854 if (p0
> in_len
) return (in_len
);
3856 if ((in_len
+ p0
) >= 32) return (in_len
);
3858 u32 out_len
= in_len
;
3863 rshift_block_N (buf0
, buf1
, tib40
, tib41
, p0
);
3865 truncate_left (tib40
, tib41
, out_len
);
3867 buf0
[0] |= tib40
[0];
3868 buf0
[1] |= tib40
[1];
3869 buf0
[2] |= tib40
[2];
3870 buf0
[3] |= tib40
[3];
3871 buf1
[0] |= tib41
[0];
3872 buf1
[1] |= tib41
[1];
3873 buf1
[2] |= tib41
[2];
3874 buf1
[3] |= tib41
[3];
3881 static u32
rule_op_mangle_title (const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
3883 buf0
[0] |= (generate_cmask (buf0
[0]));
3884 buf0
[1] |= (generate_cmask (buf0
[1]));
3885 buf0
[2] |= (generate_cmask (buf0
[2]));
3886 buf0
[3] |= (generate_cmask (buf0
[3]));
3887 buf1
[0] |= (generate_cmask (buf1
[0]));
3888 buf1
[1] |= (generate_cmask (buf1
[1]));
3889 buf1
[2] |= (generate_cmask (buf1
[2]));
3890 buf1
[3] |= (generate_cmask (buf1
[3]));
3893 buf0
[0] &= ~(0x00000020 & generate_cmask (buf0
[0]));
3895 for (u32 i
= 0; i
< in_len
; i
++)
3902 case 0: tmp0
= __byte_perm (buf0
[0], 0, 0x6540);
3903 tmp1
= ~(0x00002000 & generate_cmask (buf0
[0])); break;
3904 case 1: tmp0
= __byte_perm (buf0
[0], 0, 0x6541);
3905 tmp1
= ~(0x00200000 & generate_cmask (buf0
[0])); break;
3906 case 2: tmp0
= __byte_perm (buf0
[0], 0, 0x6542);
3907 tmp1
= ~(0x20000000 & generate_cmask (buf0
[0])); break;
3908 case 3: tmp0
= __byte_perm (buf0
[0], 0, 0x6543);
3909 tmp1
= ~(0x00000020 & generate_cmask (buf0
[1])); break;
3910 case 4: tmp0
= __byte_perm (buf0
[1], 0, 0x6540);
3911 tmp1
= ~(0x00002000 & generate_cmask (buf0
[1])); break;
3912 case 5: tmp0
= __byte_perm (buf0
[1], 0, 0x6541);
3913 tmp1
= ~(0x00200000 & generate_cmask (buf0
[1])); break;
3914 case 6: tmp0
= __byte_perm (buf0
[1], 0, 0x6542);
3915 tmp1
= ~(0x20000000 & generate_cmask (buf0
[1])); break;
3916 case 7: tmp0
= __byte_perm (buf0
[1], 0, 0x6543);
3917 tmp1
= ~(0x00000020 & generate_cmask (buf0
[2])); break;
3918 case 8: tmp0
= __byte_perm (buf0
[2], 0, 0x6540);
3919 tmp1
= ~(0x00002000 & generate_cmask (buf0
[2])); break;
3920 case 9: tmp0
= __byte_perm (buf0
[2], 0, 0x6541);
3921 tmp1
= ~(0x00200000 & generate_cmask (buf0
[2])); break;
3922 case 10: tmp0
= __byte_perm (buf0
[2], 0, 0x6542);
3923 tmp1
= ~(0x20000000 & generate_cmask (buf0
[2])); break;
3924 case 11: tmp0
= __byte_perm (buf0
[2], 0, 0x6543);
3925 tmp1
= ~(0x00000020 & generate_cmask (buf0
[3])); break;
3926 case 12: tmp0
= __byte_perm (buf0
[3], 0, 0x6540);
3927 tmp1
= ~(0x00002000 & generate_cmask (buf0
[3])); break;
3928 case 13: tmp0
= __byte_perm (buf0
[3], 0, 0x6541);
3929 tmp1
= ~(0x00200000 & generate_cmask (buf0
[3])); break;
3930 case 14: tmp0
= __byte_perm (buf0
[3], 0, 0x6542);
3931 tmp1
= ~(0x20000000 & generate_cmask (buf0
[3])); break;
3932 case 15: tmp0
= __byte_perm (buf0
[3], 0, 0x6543);
3933 tmp1
= ~(0x00000020 & generate_cmask (buf1
[0])); break;
3934 case 16: tmp0
= __byte_perm (buf1
[0], 0, 0x6540);
3935 tmp1
= ~(0x00002000 & generate_cmask (buf1
[0])); break;
3936 case 17: tmp0
= __byte_perm (buf1
[0], 0, 0x6541);
3937 tmp1
= ~(0x00200000 & generate_cmask (buf1
[0])); break;
3938 case 18: tmp0
= __byte_perm (buf1
[0], 0, 0x6542);
3939 tmp1
= ~(0x20000000 & generate_cmask (buf1
[0])); break;
3940 case 19: tmp0
= __byte_perm (buf1
[0], 0, 0x6543);
3941 tmp1
= ~(0x00000020 & generate_cmask (buf1
[1])); break;
3942 case 20: tmp0
= __byte_perm (buf1
[1], 0, 0x6540);
3943 tmp1
= ~(0x00002000 & generate_cmask (buf1
[1])); break;
3944 case 21: tmp0
= __byte_perm (buf1
[1], 0, 0x6541);
3945 tmp1
= ~(0x00200000 & generate_cmask (buf1
[1])); break;
3946 case 22: tmp0
= __byte_perm (buf1
[1], 0, 0x6542);
3947 tmp1
= ~(0x20000000 & generate_cmask (buf1
[1])); break;
3948 case 23: tmp0
= __byte_perm (buf1
[1], 0, 0x6543);
3949 tmp1
= ~(0x00000020 & generate_cmask (buf1
[2])); break;
3950 case 24: tmp0
= __byte_perm (buf1
[2], 0, 0x6540);
3951 tmp1
= ~(0x00002000 & generate_cmask (buf1
[2])); break;
3952 case 25: tmp0
= __byte_perm (buf1
[2], 0, 0x6541);
3953 tmp1
= ~(0x00200000 & generate_cmask (buf1
[2])); break;
3954 case 26: tmp0
= __byte_perm (buf1
[2], 0, 0x6542);
3955 tmp1
= ~(0x20000000 & generate_cmask (buf1
[2])); break;
3956 case 27: tmp0
= __byte_perm (buf1
[2], 0, 0x6543);
3957 tmp1
= ~(0x00000020 & generate_cmask (buf1
[3])); break;
3958 case 28: tmp0
= __byte_perm (buf1
[3], 0, 0x6540);
3959 tmp1
= ~(0x00002000 & generate_cmask (buf1
[3])); break;
3960 case 29: tmp0
= __byte_perm (buf1
[3], 0, 0x6541);
3961 tmp1
= ~(0x00200000 & generate_cmask (buf1
[3])); break;
3962 case 30: tmp0
= __byte_perm (buf1
[3], 0, 0x6542);
3963 tmp1
= ~(0x20000000 & generate_cmask (buf1
[3])); break;
3968 if (tmp0
== ' ') buf0
[0] &= tmp1
;
3972 if (tmp0
== ' ') buf0
[1] &= tmp1
;
3976 if (tmp0
== ' ') buf0
[2] &= tmp1
;
3980 if (tmp0
== ' ') buf0
[3] &= tmp1
;
3984 if (tmp0
== ' ') buf1
[0] &= tmp1
;
3988 if (tmp0
== ' ') buf1
[1] &= tmp1
;
3992 if (tmp0
== ' ') buf1
[2] &= tmp1
;
3996 if (tmp0
== ' ') buf1
[3] &= tmp1
;
4001 #if defined IS_AMD || defined IS_GENERIC
4005 const uchar4 tmp0
= (uchar4
) (' ');
4006 const uchar4 tmp1
= (uchar4
) (0x00);
4007 const uchar4 tmp2
= (uchar4
) (0xff);
4011 tmp
= as_uchar4 (buf0
[0]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib40
[0] = as_uint (tmp
);
4012 tmp
= as_uchar4 (buf0
[1]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib40
[1] = as_uint (tmp
);
4013 tmp
= as_uchar4 (buf0
[2]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib40
[2] = as_uint (tmp
);
4014 tmp
= as_uchar4 (buf0
[3]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib40
[3] = as_uint (tmp
);
4015 tmp
= as_uchar4 (buf1
[0]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib41
[0] = as_uint (tmp
);
4016 tmp
= as_uchar4 (buf1
[1]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib41
[1] = as_uint (tmp
);
4017 tmp
= as_uchar4 (buf1
[2]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib41
[2] = as_uint (tmp
);
4018 tmp
= as_uchar4 (buf1
[3]); tmp
= select (tmp1
, tmp2
, tmp
== tmp0
); tib41
[3] = as_uint (tmp
);
4020 rshift_block (tib40
, tib41
, tib40
, tib41
); tib40
[0] |= 0xff;
4022 buf0
[0] &= ~(generate_cmask (buf0
[0]) & tib40
[0]);
4023 buf0
[1] &= ~(generate_cmask (buf0
[1]) & tib40
[1]);
4024 buf0
[2] &= ~(generate_cmask (buf0
[2]) & tib40
[2]);
4025 buf0
[3] &= ~(generate_cmask (buf0
[3]) & tib40
[3]);
4026 buf1
[0] &= ~(generate_cmask (buf1
[0]) & tib41
[0]);
4027 buf1
[1] &= ~(generate_cmask (buf1
[1]) & tib41
[1]);
4028 buf1
[2] &= ~(generate_cmask (buf1
[2]) & tib41
[2]);
4029 buf1
[3] &= ~(generate_cmask (buf1
[3]) & tib41
[3]);
4035 u32
apply_rule (const u32 name
, const u32 p0
, const u32 p1
, u32 buf0
[4], u32 buf1
[4], const u32 in_len
)
4037 u32 out_len
= in_len
;
4041 case RULE_OP_MANGLE_LREST
: out_len
= rule_op_mangle_lrest (p0
, p1
, buf0
, buf1
, out_len
); break;
4042 case RULE_OP_MANGLE_UREST
: out_len
= rule_op_mangle_urest (p0
, p1
, buf0
, buf1
, out_len
); break;
4043 case RULE_OP_MANGLE_LREST_UFIRST
: out_len
= rule_op_mangle_lrest_ufirst (p0
, p1
, buf0
, buf1
, out_len
); break;
4044 case RULE_OP_MANGLE_UREST_LFIRST
: out_len
= rule_op_mangle_urest_lfirst (p0
, p1
, buf0
, buf1
, out_len
); break;
4045 case RULE_OP_MANGLE_TREST
: out_len
= rule_op_mangle_trest (p0
, p1
, buf0
, buf1
, out_len
); break;
4046 case RULE_OP_MANGLE_TOGGLE_AT
: out_len
= rule_op_mangle_toggle_at (p0
, p1
, buf0
, buf1
, out_len
); break;
4047 case RULE_OP_MANGLE_REVERSE
: out_len
= rule_op_mangle_reverse (p0
, p1
, buf0
, buf1
, out_len
); break;
4048 case RULE_OP_MANGLE_DUPEWORD
: out_len
= rule_op_mangle_dupeword (p0
, p1
, buf0
, buf1
, out_len
); break;
4049 case RULE_OP_MANGLE_DUPEWORD_TIMES
: out_len
= rule_op_mangle_dupeword_times (p0
, p1
, buf0
, buf1
, out_len
); break;
4050 case RULE_OP_MANGLE_REFLECT
: out_len
= rule_op_mangle_reflect (p0
, p1
, buf0
, buf1
, out_len
); break;
4051 case RULE_OP_MANGLE_APPEND
: out_len
= rule_op_mangle_append (p0
, p1
, buf0
, buf1
, out_len
); break;
4052 case RULE_OP_MANGLE_PREPEND
: out_len
= rule_op_mangle_prepend (p0
, p1
, buf0
, buf1
, out_len
); break;
4053 case RULE_OP_MANGLE_ROTATE_LEFT
: out_len
= rule_op_mangle_rotate_left (p0
, p1
, buf0
, buf1
, out_len
); break;
4054 case RULE_OP_MANGLE_ROTATE_RIGHT
: out_len
= rule_op_mangle_rotate_right (p0
, p1
, buf0
, buf1
, out_len
); break;
4055 case RULE_OP_MANGLE_DELETE_FIRST
: out_len
= rule_op_mangle_delete_first (p0
, p1
, buf0
, buf1
, out_len
); break;
4056 case RULE_OP_MANGLE_DELETE_LAST
: out_len
= rule_op_mangle_delete_last (p0
, p1
, buf0
, buf1
, out_len
); break;
4057 case RULE_OP_MANGLE_DELETE_AT
: out_len
= rule_op_mangle_delete_at (p0
, p1
, buf0
, buf1
, out_len
); break;
4058 case RULE_OP_MANGLE_EXTRACT
: out_len
= rule_op_mangle_extract (p0
, p1
, buf0
, buf1
, out_len
); break;
4059 case RULE_OP_MANGLE_OMIT
: out_len
= rule_op_mangle_omit (p0
, p1
, buf0
, buf1
, out_len
); break;
4060 case RULE_OP_MANGLE_INSERT
: out_len
= rule_op_mangle_insert (p0
, p1
, buf0
, buf1
, out_len
); break;
4061 case RULE_OP_MANGLE_OVERSTRIKE
: out_len
= rule_op_mangle_overstrike (p0
, p1
, buf0
, buf1
, out_len
); break;
4062 case RULE_OP_MANGLE_TRUNCATE_AT
: out_len
= rule_op_mangle_truncate_at (p0
, p1
, buf0
, buf1
, out_len
); break;
4063 case RULE_OP_MANGLE_REPLACE
: out_len
= rule_op_mangle_replace (p0
, p1
, buf0
, buf1
, out_len
); break;
4064 //case RULE_OP_MANGLE_PURGECHAR: out_len = rule_op_mangle_purgechar (p0, p1, buf0, buf1, out_len); break;
4065 //case RULE_OP_MANGLE_TOGGLECASE_REC: out_len = rule_op_mangle_togglecase_rec (p0, p1, buf0, buf1, out_len); break;
4066 case RULE_OP_MANGLE_DUPECHAR_FIRST
: out_len
= rule_op_mangle_dupechar_first (p0
, p1
, buf0
, buf1
, out_len
); break;
4067 case RULE_OP_MANGLE_DUPECHAR_LAST
: out_len
= rule_op_mangle_dupechar_last (p0
, p1
, buf0
, buf1
, out_len
); break;
4068 case RULE_OP_MANGLE_DUPECHAR_ALL
: out_len
= rule_op_mangle_dupechar_all (p0
, p1
, buf0
, buf1
, out_len
); break;
4069 case RULE_OP_MANGLE_SWITCH_FIRST
: out_len
= rule_op_mangle_switch_first (p0
, p1
, buf0
, buf1
, out_len
); break;
4070 case RULE_OP_MANGLE_SWITCH_LAST
: out_len
= rule_op_mangle_switch_last (p0
, p1
, buf0
, buf1
, out_len
); break;
4071 case RULE_OP_MANGLE_SWITCH_AT
: out_len
= rule_op_mangle_switch_at (p0
, p1
, buf0
, buf1
, out_len
); break;
4072 case RULE_OP_MANGLE_CHR_SHIFTL
: out_len
= rule_op_mangle_chr_shiftl (p0
, p1
, buf0
, buf1
, out_len
); break;
4073 case RULE_OP_MANGLE_CHR_SHIFTR
: out_len
= rule_op_mangle_chr_shiftr (p0
, p1
, buf0
, buf1
, out_len
); break;
4074 case RULE_OP_MANGLE_CHR_INCR
: out_len
= rule_op_mangle_chr_incr (p0
, p1
, buf0
, buf1
, out_len
); break;
4075 case RULE_OP_MANGLE_CHR_DECR
: out_len
= rule_op_mangle_chr_decr (p0
, p1
, buf0
, buf1
, out_len
); break;
4076 case RULE_OP_MANGLE_REPLACE_NP1
: out_len
= rule_op_mangle_replace_np1 (p0
, p1
, buf0
, buf1
, out_len
); break;
4077 case RULE_OP_MANGLE_REPLACE_NM1
: out_len
= rule_op_mangle_replace_nm1 (p0
, p1
, buf0
, buf1
, out_len
); break;
4078 case RULE_OP_MANGLE_DUPEBLOCK_FIRST
: out_len
= rule_op_mangle_dupeblock_first (p0
, p1
, buf0
, buf1
, out_len
); break;
4079 case RULE_OP_MANGLE_DUPEBLOCK_LAST
: out_len
= rule_op_mangle_dupeblock_last (p0
, p1
, buf0
, buf1
, out_len
); break;
4080 case RULE_OP_MANGLE_TITLE
: out_len
= rule_op_mangle_title (p0
, p1
, buf0
, buf1
, out_len
); break;
4086 u32
apply_rules (__global u32
*cmds
, u32 buf0
[4], u32 buf1
[4], const u32 len
)
4090 for (u32 i
= 0; cmds
[i
] != 0; i
++)
4092 const u32 cmd
= cmds
[i
];
4094 const u32 name
= (cmd
>> 0) & 0xff;
4095 const u32 p0
= (cmd
>> 8) & 0xff;
4096 const u32 p1
= (cmd
>> 16) & 0xff;
4098 out_len
= apply_rule (name
, p0
, p1
, buf0
, buf1
, out_len
);