You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.8KB

  1. ;*****************************************************************************
  2. ;* x86-optimized Float DSP functions
  3. ;*
  4. ;* Copyright 2006 Loren Merritt
  5. ;*
  6. ;* This file is part of FFmpeg.
  7. ;*
  8. ;* FFmpeg is free software; you can redistribute it and/or
  9. ;* modify it under the terms of the GNU Lesser General Public
  10. ;* License as published by the Free Software Foundation; either
  11. ;* version 2.1 of the License, or (at your option) any later version.
  12. ;*
  13. ;* FFmpeg is distributed in the hope that it will be useful,
  14. ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. ;* Lesser General Public License for more details.
  17. ;*
  18. ;* You should have received a copy of the GNU Lesser General Public
  19. ;* License along with FFmpeg; if not, write to the Free Software
  20. ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. ;******************************************************************************
  22. %include "x86inc.asm"
  23. %include "x86util.asm"
  24. SECTION .text
  25. ;-----------------------------------------------------------------------------
  26. ; void vector_fmul(float *dst, const float *src0, const float *src1, int len)
  27. ;-----------------------------------------------------------------------------
  28. %macro VECTOR_FMUL 0
  29. cglobal vector_fmul, 4,4,2, dst, src0, src1, len
  30. lea lenq, [lend*4 - 2*mmsize]
  31. ALIGN 16
  32. .loop
  33. mova m0, [src0q + lenq]
  34. mova m1, [src0q + lenq + mmsize]
  35. mulps m0, m0, [src1q + lenq]
  36. mulps m1, m1, [src1q + lenq + mmsize]
  37. mova [dstq + lenq], m0
  38. mova [dstq + lenq + mmsize], m1
  39. sub lenq, 2*mmsize
  40. jge .loop
  41. %if mmsize == 32
  42. vzeroupper
  43. RET
  44. %else
  45. REP_RET
  46. %endif
  47. %endmacro
  48. INIT_XMM sse
  49. VECTOR_FMUL
  50. %if HAVE_AVX
  51. INIT_YMM avx
  52. VECTOR_FMUL
  53. %endif
  54. ;------------------------------------------------------------------------------
  55. ; void ff_vector_fmac_scalar(float *dst, const float *src, float mul, int len)
  56. ;------------------------------------------------------------------------------
  57. %macro VECTOR_FMAC_SCALAR 0
  58. %if UNIX64
  59. cglobal vector_fmac_scalar, 3,3,3, dst, src, len
  60. %else
  61. cglobal vector_fmac_scalar, 4,4,3, dst, src, mul, len
  62. %endif
  63. %if WIN64
  64. SWAP 0, 2
  65. %endif
  66. %if ARCH_X86_32
  67. VBROADCASTSS m0, mulm
  68. %else
  69. shufps xmm0, xmm0, 0
  70. %if cpuflag(avx)
  71. vinsertf128 m0, m0, xmm0, 1
  72. %endif
  73. %endif
  74. lea lenq, [lend*4-2*mmsize]
  75. .loop
  76. mulps m1, m0, [srcq+lenq ]
  77. mulps m2, m0, [srcq+lenq+mmsize]
  78. addps m1, m1, [dstq+lenq ]
  79. addps m2, m2, [dstq+lenq+mmsize]
  80. mova [dstq+lenq ], m1
  81. mova [dstq+lenq+mmsize], m2
  82. sub lenq, 2*mmsize
  83. jge .loop
  84. %if mmsize == 32
  85. vzeroupper
  86. RET
  87. %else
  88. REP_RET
  89. %endif
  90. %endmacro
  91. INIT_XMM sse
  92. VECTOR_FMAC_SCALAR
  93. %if HAVE_AVX
  94. INIT_YMM avx
  95. VECTOR_FMAC_SCALAR
  96. %endif