Skip to content

Instantly share code, notes, and snippets.

@justinruggles
Created July 21, 2012 18:46
Show Gist options
  • Save justinruggles/3156719 to your computer and use it in GitHub Desktop.
Save justinruggles/3156719 to your computer and use it in GitHub Desktop.
pb_perm_unpackw_0: db 0, 1, 2, 3, 16, 17, 18, 19, 8, 9, 10, 11, 24, 25, 26, 27
pb_perm_unpackw_1: db 8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31
[...]
punpcklwd m0, m1 ; m0 = 0, 1, 6, 7, 12, 13, 18, 19
punpcklwd m2, m3 ; m2 = 4, 5, 10, 11, 16, 17, 22, 23
punpcklwd m4, m5 ; m4 = 2, 3, 8, 9, 14, 15, 20, 21
%if cpuflag(xop)
vpperm m1, m0, m4, [pb_perm_unpackw_0] ; m1 = 0, 1, 2, 3, 12, 13, 14, 15
vpperm m4, m4, m2, [pb_perm_unpackw_1] ; m4 = 8, 9, 10, 11, 20, 21, 22, 23
blendpd m2, m0, 1010b ; m2 = 4, 5, 6, 7, 16, 17, 18, 19
SWAP 0,4,2
%else
; blend dwords
shufps m1, m0, m2, q2020 ; m1 = 0, 1, 12, 13, 2, 3, 14, 15
shufps m0, m4, q2031 ; m0 = 6, 7, 18, 19, 4, 5, 16, 17
shufps m2, m4, q3131 ; m2 = 8, 9, 20, 21, 10, 11, 22, 23
; shuffle dwords
pshufd m0, m0, q1302 ; m0 = 4, 5, 6, 7, 16, 17, 18, 19
pshufd m1, m1, q3120 ; m1 = 0, 1, 2, 3, 12, 13, 14, 15
pshufd m2, m2, q3120 ; m2 = 8, 9, 10, 11, 20, 21, 22, 23
%endif
@justinruggles
Copy link
Author

conv_s16p_to_s16_6ch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment