1 ;******************************************************************************
2 ;* Copyright (c) 2008 Loren Merritt
4 ;* This file is part of FFmpeg.
6 ;* FFmpeg 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.
11 ;* FFmpeg 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.
16 ;* You should have received a copy of the GNU Lesser General Public
17 ;* License along with FFmpeg; if not, write to the Free Software
18 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 ;******************************************************************************
21 %include "libavutil/x86/x86util.asm"
25 %macro SCALARPRODUCT 0
26 ; int ff_scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3,
28 cglobal scalarproduct_and_madd_int16, 4,4,8, v1, v2, v3, order, mul
31 jnz scalarproduct_and_madd_int16_fallback
33 scalarproduct_and_madd_int16_fallback
49 movu m0, [v2q + orderq]
50 movu m1, [v2q + orderq + mmsize]
51 mova m4, [v1q + orderq]
52 mova m5, [v1q + orderq + mmsize]
53 movu m2, [v3q + orderq]
54 movu m3, [v3q + orderq + mmsize]
63 mova [v1q + orderq], m2
64 mova [v1q + orderq + mmsize], m3
77 %macro SCALARPRODUCT_LOOP 1
83 mova m4, [v2q + orderq]
84 mova m0, [v2q + orderq + mmsize]
88 mova m5, [v3q + orderq]
89 mova m2, [v3q + orderq + mmsize]
93 mova m0, [v2q + orderq]
94 mova m1, [v2q + orderq + mmsize]
95 mova m2, [v3q + orderq]
96 mova m3, [v3q + orderq + mmsize]
98 %define t0 [v1q + orderq]
99 %define t1 [v1q + orderq + mmsize]
114 mova [v1q + orderq], m2
115 mova [v1q + orderq + mmsize], m3
122 ; int ff_scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3,
123 ; int order, int mul)
125 cglobal scalarproduct_and_madd_int16, 4,5,10, v1, v2, v3, order, mul
127 jnz scalarproduct_and_madd_int16_fallback
137 mova m4, [v2q + orderq]
138 mova m5, [v3q + orderq]
139 ; linear is faster than branch tree or jump table, because the branches taken are cyclic (i.e. predictable)
154 SCALARPRODUCT_LOOP 14
155 SCALARPRODUCT_LOOP 12
156 SCALARPRODUCT_LOOP 10