2
0

iwalsh_sse2.asm 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. ;
  2. ; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
  3. ;
  4. ; Use of this source code is governed by a BSD-style license
  5. ; that can be found in the LICENSE file in the root of the source
  6. ; tree. An additional intellectual property rights grant can be found
  7. ; in the file PATENTS. All contributing project authors may
  8. ; be found in the AUTHORS file in the root of the source tree.
  9. ;
  10. %include "vpx_ports/x86_abi_support.asm"
  11. ;void vp8_short_inv_walsh4x4_sse2(short *input, short *output)
  12. global sym(vp8_short_inv_walsh4x4_sse2) PRIVATE
  13. sym(vp8_short_inv_walsh4x4_sse2):
  14. push rbp
  15. mov rbp, rsp
  16. SHADOW_ARGS_TO_STACK 2
  17. ; end prolog
  18. mov rcx, arg(0)
  19. mov rdx, arg(1)
  20. mov rax, 30003h
  21. movdqa xmm0, [rcx + 0] ;ip[4] ip[0]
  22. movdqa xmm1, [rcx + 16] ;ip[12] ip[8]
  23. pshufd xmm2, xmm1, 4eh ;ip[8] ip[12]
  24. movdqa xmm3, xmm0 ;ip[4] ip[0]
  25. paddw xmm0, xmm2 ;ip[4]+ip[8] ip[0]+ip[12] aka b1 a1
  26. psubw xmm3, xmm2 ;ip[4]-ip[8] ip[0]-ip[12] aka c1 d1
  27. movdqa xmm4, xmm0
  28. punpcklqdq xmm0, xmm3 ;d1 a1
  29. punpckhqdq xmm4, xmm3 ;c1 b1
  30. movdqa xmm1, xmm4 ;c1 b1
  31. paddw xmm4, xmm0 ;dl+cl a1+b1 aka op[4] op[0]
  32. psubw xmm0, xmm1 ;d1-c1 a1-b1 aka op[12] op[8]
  33. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. ; 13 12 11 10 03 02 01 00
  35. ;
  36. ; 33 32 31 30 23 22 21 20
  37. ;
  38. movdqa xmm3, xmm4 ; 13 12 11 10 03 02 01 00
  39. punpcklwd xmm4, xmm0 ; 23 03 22 02 21 01 20 00
  40. punpckhwd xmm3, xmm0 ; 33 13 32 12 31 11 30 10
  41. movdqa xmm1, xmm4 ; 23 03 22 02 21 01 20 00
  42. punpcklwd xmm4, xmm3 ; 31 21 11 01 30 20 10 00
  43. punpckhwd xmm1, xmm3 ; 33 23 13 03 32 22 12 02
  44. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  45. movd xmm0, eax
  46. pshufd xmm2, xmm1, 4eh ;ip[8] ip[12]
  47. movdqa xmm3, xmm4 ;ip[4] ip[0]
  48. pshufd xmm0, xmm0, 0 ;03 03 03 03 03 03 03 03
  49. paddw xmm4, xmm2 ;ip[4]+ip[8] ip[0]+ip[12] aka b1 a1
  50. psubw xmm3, xmm2 ;ip[4]-ip[8] ip[0]-ip[12] aka c1 d1
  51. movdqa xmm5, xmm4
  52. punpcklqdq xmm4, xmm3 ;d1 a1
  53. punpckhqdq xmm5, xmm3 ;c1 b1
  54. movdqa xmm1, xmm5 ;c1 b1
  55. paddw xmm5, xmm4 ;dl+cl a1+b1 aka op[4] op[0]
  56. psubw xmm4, xmm1 ;d1-c1 a1-b1 aka op[12] op[8]
  57. paddw xmm5, xmm0
  58. paddw xmm4, xmm0
  59. psraw xmm5, 3
  60. psraw xmm4, 3
  61. movd eax, xmm5
  62. movd ecx, xmm4
  63. psrldq xmm5, 4
  64. psrldq xmm4, 4
  65. mov word ptr[rdx+32*0], ax
  66. mov word ptr[rdx+32*2], cx
  67. shr eax, 16
  68. shr ecx, 16
  69. mov word ptr[rdx+32*4], ax
  70. mov word ptr[rdx+32*6], cx
  71. movd eax, xmm5
  72. movd ecx, xmm4
  73. psrldq xmm5, 4
  74. psrldq xmm4, 4
  75. mov word ptr[rdx+32*8], ax
  76. mov word ptr[rdx+32*10], cx
  77. shr eax, 16
  78. shr ecx, 16
  79. mov word ptr[rdx+32*12], ax
  80. mov word ptr[rdx+32*14], cx
  81. movd eax, xmm5
  82. movd ecx, xmm4
  83. psrldq xmm5, 4
  84. psrldq xmm4, 4
  85. mov word ptr[rdx+32*1], ax
  86. mov word ptr[rdx+32*3], cx
  87. shr eax, 16
  88. shr ecx, 16
  89. mov word ptr[rdx+32*5], ax
  90. mov word ptr[rdx+32*7], cx
  91. movd eax, xmm5
  92. movd ecx, xmm4
  93. mov word ptr[rdx+32*9], ax
  94. mov word ptr[rdx+32*11], cx
  95. shr eax, 16
  96. shr ecx, 16
  97. mov word ptr[rdx+32*13], ax
  98. mov word ptr[rdx+32*15], cx
  99. ; begin epilog
  100. UNSHADOW_ARGS
  101. pop rbp
  102. ret