Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Opus codec developments

Re: Opus codec developments

From: Nils Wallménius <nils.wallmenius_at_gmail.com>
Date: Wed, 2 Jan 2013 11:43:34 +0100

Hi again

>> Gcc doesn't handle the coldfire EMAC at all so you can only use the
>> special regs in asm, not bind them to c vars. Take a look at how this
>> is done in other functions, there are lots of them, an example is
>> MULT16_32_Q15 in the fixed_generic.h file you were editing.
> I've seen that function. The problem with the
> Multiply-And-Accumulate-Function (MAC16_16 it's called iirc), is that it
> takes three arguments, the accumulation variable c and the two
> multiplication operands a and b. The syntax for the ASM mnemonic is (±
> characters):
>
> mac.l %dX, %dY, %RaccX
>
> %RaccX is required to be an accumulation register. So the only way to
> handle this is to move the variable c into the %RaccX, run the
> mac-instruction, and copy it out again. This sounds horribily
> inefficient and I doubt that there's still any benefit over just adding
> and multiplying (I wish I had the PDF with the instruction timings at hand).

Yes, this is how the EMAC is used, the accumulator registers can only
be used for accumulation so the result must be copied into an a or d
reg before it can be used for anything else, which is also what
MULT16_32_Q15 does with movclr. This is still much faster than the c
code in this case since it uses a series of 16*16 multipications and
likely better than the same coded with regular mul.l, this might of
course not be true for the 16*16 multiplication you are looking at,
the only way to know is to bench it.

Sections 3.7 and 3.8 in [1] have the instruction timings worth noting
is that there's a stall when using movclr after mac on the same
accumulator

[1] cache.freescale.com/files/32bit/doc/ref_manual/MCF5249UM.pdf

Nils
Received on 2013-01-02

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy