aboutsummaryrefslogtreecommitdiff
path: root/plugins/dfsound/arm_utils.s
blob: a278174d29d514c60c3dfce95e5f028ab8f6f4a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 * (C) Gražvydas "notaz" Ignotas, 2011
 *
 * This work is licensed under the terms of any of these licenses
 * (at your option):
 *  - GNU GPL, version 2 or later.
 *  - GNU LGPL, version 2.1 or later.
 * See the COPYING file in the top-level directory.
 */


.text
.align 2


.global mix_chan @ (int start, int count, int lv, int rv)
mix_chan:
    vmov.32     d14[0], r2
    vmov.32     d14[1], r3             @ multipliers
    mov         r12, r0
    movw        r0, #:lower16:ChanBuf
    movw        r2, #:lower16:SSumLR
    movt        r0, #:upper16:ChanBuf
    movt        r2, #:upper16:SSumLR
    add         r0, r12, lsl #2
    add         r2, r12, lsl #3
0:
    vldmia      r0!, {d0-d1}
    vldmia      r2, {d2-d5}
    vmul.s32    d10, d14, d0[0]
    vmul.s32    d11, d14, d0[1]
    vmul.s32    d12, d14, d1[0]
    vmul.s32    d13, d14, d1[1]
    vsra.s32    q1, q5, #14
    vsra.s32    q2, q6, #14
    subs        r1, #4
    blt         mc_finish
    vstmia      r2!, {d2-d5}
    bgt         0b
    nop
    bxeq        lr

mc_finish:
    vstmia      r2!, {d2}
    cmp         r1, #2
    vstmiage    r2!, {d3}
    cmp         r1, #3
    vstmiage    r2!, {d4}
    bx          lr


.global mix_chan_rvb @ (int start, int count, int lv, int rv)
mix_chan_rvb:
    vmov.32     d14[0], r2
    vmov.32     d14[1], r3             @ multipliers
    mov         r12, r0
    movw        r0, #:lower16:ChanBuf
    movw        r3, #:lower16:sRVBStart
    movw        r2, #:lower16:SSumLR
    movt        r0, #:upper16:ChanBuf
    movt        r3, #:upper16:sRVBStart
    movt        r2, #:upper16:SSumLR
    ldr         r3, [r3]
    add         r0, r12, lsl #2
    add         r2, r12, lsl #3
    add         r3, r12, lsl #3
0:
    vldmia      r0!, {d0-d1}
    vldmia      r2, {d2-d5}
    vldmia      r3, {d6-d9}
    vmul.s32    d10, d14, d0[0]
    vmul.s32    d11, d14, d0[1]
    vmul.s32    d12, d14, d1[0]
    vmul.s32    d13, d14, d1[1]
    vsra.s32    q1, q5, #14
    vsra.s32    q2, q6, #14
    vsra.s32    q3, q5, #14
    vsra.s32    q4, q6, #14
    subs        r1, #4
    blt         mcr_finish
    vstmia      r2!, {d2-d5}
    vstmia      r3!, {d6-d9}
    bgt         0b
    nop
    bxeq        lr

mcr_finish:
    vstmia      r2!, {d2}
    vstmia      r3!, {d6}
    cmp         r1, #2
    vstmiage    r2!, {d3}
    vstmiage    r3!, {d7}
    cmp         r1, #3
    vstmiage    r2!, {d4}
    vstmiage    r3!, {d8}
    bx          lr

@ vim:filetype=armasm