diff options
author | James Almer <jamrial@gmail.com> | 2014-03-17 16:40:28 -0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-03-17 21:04:15 +0100 |
commit | aa1f38015cb0d04a5c50a8957dd7aba79f0d8882 (patch) | |
tree | a3506bf44e1ebf6339d9366abdab77bff5e2d901 | |
parent | e10ab43614c1cccdeb656bf9d5431285a2f2d52f (diff) | |
download | ffmpeg-aa1f38015cb0d04a5c50a8957dd7aba79f0d8882.tar.gz |
x86/synth_filter: improve FMA version
Replace mulps+subps with fnmaddps, resulting in two less instructions inside the
inner loops.
About 1% faster FMA3 performance.
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/x86/dcadsp.asm | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/libavcodec/x86/dcadsp.asm b/libavcodec/x86/dcadsp.asm index 4746784795..c5a1e77bc2 100644 --- a/libavcodec/x86/dcadsp.asm +++ b/libavcodec/x86/dcadsp.asm @@ -230,14 +230,27 @@ DCA_LFE_FIR 1 SHUF m11, ptr2 + j + (15 - 3) * 4 - mmsize, m12 mova m12, [ptr1 + j + mmsize] %endif - FMULADD_PS m2, m6, [win + %1 + j + 16 * 4], m2, m6 +%if cpuflag(fma3) + fmaddps m2, m6, [win + %1 + j + 16 * 4], m2 + fnmaddps m1, m5, [win + %1 + j], m1 +%if ARCH_X86_64 + fmaddps m8, m12, [win + %1 + j + mmsize + 16 * 4], m8 + fnmaddps m7, m11, [win + %1 + j + mmsize], m7 +%endif +%else ; non-FMA + mulps m6, m6, [win + %1 + j + 16 * 4] mulps m5, m5, [win + %1 + j] - subps m1, m1, m5 %if ARCH_X86_64 - FMULADD_PS m8, m12, [win + %1 + j + mmsize + 16 * 4], m8, m12 + mulps m12, m12, [win + %1 + j + mmsize + 16 * 4] mulps m11, m11, [win + %1 + j + mmsize] +%endif + addps m2, m2, m6 + subps m1, m1, m5 +%if ARCH_X86_64 + addps m8, m8, m12 subps m7, m7, m11 %endif +%endif ; cpuflag(fma3) ;~ c += window[i + j + 32] * (synth_buf[16 + i + j]) ;~ d += window[i + j + 48] * (synth_buf[31 - i + j]) SHUF m6, ptr2 + j + (31 - 3) * 4, m5 @@ -246,12 +259,27 @@ DCA_LFE_FIR 1 SHUF m12, ptr2 + j + (31 - 3) * 4 - mmsize, m11 mova m11, [ptr1 + j + mmsize + 16 * 4] %endif - FMULADD_PS m3, m5, [win + %1 + j + 32 * 4], m3, m5 - FMULADD_PS m4, m6, [win + %1 + j + 48 * 4], m4, m6 +%if cpuflag(fma3) + fmaddps m3, m5, [win + %1 + j + 32 * 4], m3 + fmaddps m4, m6, [win + %1 + j + 48 * 4], m4 +%if ARCH_X86_64 + fmaddps m9, m11, [win + %1 + j + mmsize + 32 * 4], m9 + fmaddps m10, m12, [win + %1 + j + mmsize + 48 * 4], m10 +%endif +%else ; non-FMA + mulps m5, m5, [win + %1 + j + 32 * 4] + mulps m6, m6, [win + %1 + j + 48 * 4] +%if ARCH_X86_64 + mulps m11, m11, [win + %1 + j + mmsize + 32 * 4] + mulps m12, m12, [win + %1 + j + mmsize + 48 * 4] +%endif + addps m3, m3, m5 + addps m4, m4, m6 %if ARCH_X86_64 - FMULADD_PS m9, m11, [win + %1 + j + mmsize + 32 * 4], m9, m11 - FMULADD_PS m10, m12, [win + %1 + j + mmsize + 48 * 4], m10, m12 + addps m9, m9, m11 + addps m10, m10, m12 %endif +%endif ; cpuflag(fma3) sub j, 64 * 4 %endmacro |