4aa6f838dd988af2698cdedfff7f45277a24d6b4
[ffmpeg.git] / libavutil / arm / float_dsp_neon.S
1 /*
2  * ARM NEON optimised Float DSP functions
3  * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21
22 #include "config.h"
23 #include "asm.S"
24
25 function ff_vector_fmul_neon, export=1
26         subs            r3,  r3,  #8
27         vld1.32         {d0-d3},  [r1,:128]!
28         vld1.32         {d4-d7},  [r2,:128]!
29         vmul.f32        q8,  q0,  q2
30         vmul.f32        q9,  q1,  q3
31         beq             3f
32         bics            ip,  r3,  #15
33         beq             2f
34 1:      subs            ip,  ip,  #16
35         vld1.32         {d0-d1},  [r1,:128]!
36         vld1.32         {d4-d5},  [r2,:128]!
37         vmul.f32        q10, q0,  q2
38         vld1.32         {d2-d3},  [r1,:128]!
39         vld1.32         {d6-d7},  [r2,:128]!
40         vmul.f32        q11, q1,  q3
41         vst1.32         {d16-d19},[r0,:128]!
42         vld1.32         {d0-d1},  [r1,:128]!
43         vld1.32         {d4-d5},  [r2,:128]!
44         vmul.f32        q8,  q0,  q2
45         vld1.32         {d2-d3},  [r1,:128]!
46         vld1.32         {d6-d7},  [r2,:128]!
47         vmul.f32        q9,  q1,  q3
48         vst1.32         {d20-d23},[r0,:128]!
49         bne             1b
50         ands            r3,  r3,  #15
51         beq             3f
52 2:      vld1.32         {d0-d1},  [r1,:128]!
53         vld1.32         {d4-d5},  [r2,:128]!
54         vst1.32         {d16-d17},[r0,:128]!
55         vmul.f32        q8,  q0,  q2
56         vld1.32         {d2-d3},  [r1,:128]!
57         vld1.32         {d6-d7},  [r2,:128]!
58         vst1.32         {d18-d19},[r0,:128]!
59         vmul.f32        q9,  q1,  q3
60 3:      vst1.32         {d16-d19},[r0,:128]!
61         bx              lr
62 endfunc
63
64 function ff_vector_fmac_scalar_neon, export=1
65 VFP     len .req r2
66 VFP     acc .req r3
67 NOVFP   len .req r3
68 NOVFP   acc .req r2
69 VFP     vdup.32         q15, d0[0]
70 NOVFP   vdup.32         q15, r2
71         bics            r12, len, #15
72         mov             acc, r0
73         beq             3f
74         vld1.32         {q0},     [r1,:128]!
75         vld1.32         {q8},     [acc,:128]!
76         vld1.32         {q1},     [r1,:128]!
77         vld1.32         {q9},     [acc,:128]!
78 1:      vmla.f32        q8,  q0,  q15
79         vld1.32         {q2},     [r1,:128]!
80         vld1.32         {q10},    [acc,:128]!
81         vmla.f32        q9,  q1,  q15
82         vld1.32         {q3},     [r1,:128]!
83         vld1.32         {q11},    [acc,:128]!
84         vmla.f32        q10, q2,  q15
85         vst1.32         {q8},     [r0,:128]!
86         vmla.f32        q11, q3,  q15
87         vst1.32         {q9},     [r0,:128]!
88         subs            r12, r12, #16
89         beq             2f
90         vld1.32         {q0},     [r1,:128]!
91         vld1.32         {q8},     [acc,:128]!
92         vst1.32         {q10},    [r0,:128]!
93         vld1.32         {q1},     [r1,:128]!
94         vld1.32         {q9},     [acc,:128]!
95         vst1.32         {q11},    [r0,:128]!
96         b               1b
97 2:      vst1.32         {q10},    [r0,:128]!
98         vst1.32         {q11},    [r0,:128]!
99         ands            len, len, #15
100         it              eq
101         bxeq            lr
102 3:      vld1.32         {q0},     [r1,:128]!
103         vld1.32         {q8},     [acc,:128]!
104         vmla.f32        q8,  q0,  q15
105         vst1.32         {q8},     [r0,:128]!
106         subs            len, len, #4
107         bgt             3b
108         bx              lr
109         .unreq          len
110 endfunc