2 * This file is part of Libav.
4 * Libav is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * Libav is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with Libav; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "libavutil/x86/asm.h"
25 void ff_vector_clipf_sse(float *dst, const float *src,
26 float min, float max, int len)
28 x86_reg i = (len - 16) * 4;
30 "movss %3, %%xmm4 \n\t"
31 "movss %4, %%xmm5 \n\t"
32 "shufps $0, %%xmm4, %%xmm4 \n\t"
33 "shufps $0, %%xmm5, %%xmm5 \n\t"
35 "movaps (%2, %0), %%xmm0 \n\t" // 3/1 on intel
36 "movaps 16(%2, %0), %%xmm1 \n\t"
37 "movaps 32(%2, %0), %%xmm2 \n\t"
38 "movaps 48(%2, %0), %%xmm3 \n\t"
39 "maxps %%xmm4, %%xmm0 \n\t"
40 "maxps %%xmm4, %%xmm1 \n\t"
41 "maxps %%xmm4, %%xmm2 \n\t"
42 "maxps %%xmm4, %%xmm3 \n\t"
43 "minps %%xmm5, %%xmm0 \n\t"
44 "minps %%xmm5, %%xmm1 \n\t"
45 "minps %%xmm5, %%xmm2 \n\t"
46 "minps %%xmm5, %%xmm3 \n\t"
47 "movaps %%xmm0, (%1, %0) \n\t"
48 "movaps %%xmm1, 16(%1, %0) \n\t"
49 "movaps %%xmm2, 32(%1, %0) \n\t"
50 "movaps %%xmm3, 48(%1, %0) \n\t"
54 : "r" (dst), "r" (src), "m" (min), "m" (max)
58 #endif /* HAVE_INLINE_ASM */