-
Notifications
You must be signed in to change notification settings - Fork 1
/
shuffle.inc
40 lines (35 loc) · 1004 Bytes
/
shuffle.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
.macro unpack r0,r1,r2,r3
vpunpcklwd %ymm\r1,%ymm\r0,%ymm\r2
vpunpckhwd %ymm\r1,%ymm\r0,%ymm\r3
.endm
.macro pack r0,r1,r2,r3
vpshufb %ymm14,%ymm\r0,%ymm\r0
vpshufb %ymm14,%ymm\r1,%ymm\r1
vpunpcklqdq %ymm\r1,%ymm\r0,%ymm\r2
vpunpckhqdq %ymm\r1,%ymm\r0,%ymm\r3
.endm
.macro shuffle8 r0,r1,r2,r3
vperm2i128 $0x20,%ymm\r1,%ymm\r0,%ymm\r2
vperm2i128 $0x31,%ymm\r1,%ymm\r0,%ymm\r3
.endm
.macro shuffle4 r0,r1,r2,r3
vpunpcklqdq %ymm\r1,%ymm\r0,%ymm\r2
vpunpckhqdq %ymm\r1,%ymm\r0,%ymm\r3
#vshufpd $0x05,%ymm\r1,%ymm\r0,%ymm\r2
#vpblendd $0xCC,%ymm\r1,%ymm\r2,%ymm\r3
#vpblendd $0xCC,%ymm\r2,%ymm\r0,%ymm\r2
.endm
.macro shuffle2 r0,r1,r2,r3
#vpsllq $32,%ymm\r1,%ymm\r2
vmovsldup %ymm\r1,%ymm\r2
vpblendd $0xAA,%ymm\r2,%ymm\r0,%ymm\r2
vpsrlq $32,%ymm\r0,%ymm\r0
#vmovshdup %ymm\r0,%ymm\r0
vpblendd $0xAA,%ymm\r1,%ymm\r0,%ymm\r3
.endm
.macro shuffle1 r0,r1,r2,r3
vpslld $16,%ymm\r1,%ymm\r2
vpblendw $0xAA,%ymm\r2,%ymm\r0,%ymm\r2
vpsrld $16,%ymm\r0,%ymm\r0
vpblendw $0xAA,%ymm\r1,%ymm\r0,%ymm\r3
.endm