1 /* Copyright (C) 2007 Thom Johansen */
4 @brief Long-Term Prediction functions (Coldfire version)
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
11 - Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer.
14 - Redistributions in binary form must reproduce the above copyright
15 notice, this list of conditions and the following disclaimer in the
16 documentation and/or other materials provided with the distribution.
18 - Neither the name of the Xiph.org Foundation nor the names of its
19 contributors may be used to endorse or promote products derived from
20 this software without specific prior written permission.
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
26 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 /* spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len) */
40 movem.l %d2-%d7/%a2, (%sp)
41 movem.l (28+4, %sp), %a0-%a1 | a0 = x, a1 = y
42 move.l (28+12, %sp), %d0 | d0 = len
44 | We assume we're never called with a 'len' of zero
45 btst #2, %d0 | Check if we need to do one round of four
46 jeq 0f | samples before we do runs of eight
47 movem.l (%a0), %d1-%d2 | Fetch four samples from x
48 movem.l (%a1), %d3-%d4 | Fetch four samples from y
49 mac.w %d1u, %d3u, %acc0
50 mac.w %d1l, %d3l, %acc0
51 mac.w %d2u, %d4u, %acc0
52 mac.w %d2l, %d4l, %acc0
59 movem.l (%a0), %d1-%d4 | Fetch eight samples from x
60 movem.l (%a1), %d5-%d7/%a2 | Fetch eight samples from y
61 mac.w %d1u, %d5u, %acc0
62 mac.w %d1l, %d5l, %acc0
63 mac.w %d2u, %d6u, %acc0
64 mac.w %d2l, %d6l, %acc0
65 mac.w %d3u, %d7u, %acc0
66 mac.w %d3l, %d7l, %acc0
67 mac.w %d4u, %a2u, %acc0
68 mac.w %d4l, %a2l, %acc0
75 move.l %accext01, %d1 | Fetch top 8 bits of answer
76 movclr.l %acc0, %d0 | Fetch lower 32 bits
80 or.l %d1, %d0 | Combine (top << 26) | (lower >> 6)
82 movem.l (%sp), %d2-%d7/%a2