]> git.sesse.net Git - ffmpeg/blob - libavutil/x86/float_dsp.asm
x86: SPLATD: port to cpuflags
[ffmpeg] / libavutil / x86 / float_dsp.asm
1 ;*****************************************************************************
2 ;* x86-optimized Float DSP functions
3 ;*
4 ;* This file is part of Libav.
5 ;*
6 ;* Libav is free software; you can redistribute it and/or
7 ;* modify it under the terms of the GNU Lesser General Public
8 ;* License as published by the Free Software Foundation; either
9 ;* version 2.1 of the License, or (at your option) any later version.
10 ;*
11 ;* Libav is distributed in the hope that it will be useful,
12 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 ;* Lesser General Public License for more details.
15 ;*
16 ;* You should have received a copy of the GNU Lesser General Public
17 ;* License along with Libav; if not, write to the Free Software
18 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 ;******************************************************************************
20
21 %include "x86util.asm"
22
23 SECTION .text
24
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
40     sub       lenq, 2*mmsize
41     jge       .loop
42     REP_RET
43 %endmacro
44
45 INIT_XMM sse
46 VECTOR_FMUL
47 INIT_YMM avx
48 VECTOR_FMUL
49
50 ;------------------------------------------------------------------------------
51 ; void ff_vector_fmac_scalar(float *dst, const float *src, float mul, int len)
52 ;------------------------------------------------------------------------------
53
54 %macro VECTOR_FMAC_SCALAR 0
55 %if UNIX64
56 cglobal vector_fmac_scalar, 3,3,3, dst, src, len
57 %else
58 cglobal vector_fmac_scalar, 4,4,3, dst, src, mul, len
59 %endif
60 %if ARCH_X86_32
61     VBROADCASTSS m0, mulm
62 %else
63 %if WIN64
64     mova       xmm0, xmm2
65 %endif
66     shufps     xmm0, xmm0, 0
67 %if cpuflag(avx)
68     vinsertf128  m0, m0, xmm0, 1
69 %endif
70 %endif
71     lea    lenq, [lend*4-2*mmsize]
72 .loop:
73     mulps    m1, m0, [srcq+lenq       ]
74     mulps    m2, m0, [srcq+lenq+mmsize]
75     addps    m1, m1, [dstq+lenq       ]
76     addps    m2, m2, [dstq+lenq+mmsize]
77     mova  [dstq+lenq       ], m1
78     mova  [dstq+lenq+mmsize], m2
79     sub    lenq, 2*mmsize
80     jge .loop
81     REP_RET
82 %endmacro
83
84 INIT_XMM sse
85 VECTOR_FMAC_SCALAR
86 INIT_YMM avx
87 VECTOR_FMAC_SCALAR