Rockbox mail archiveSubject: Re: H300 assembly introducing artifacts
Re: H300 assembly introducing artifacts
From: Kaggen <kaggen_at_gmail.com>
Date: Wed, 21 Dec 2005 01:42:58 +0100
Is acc0 cleared before this asm code is executed?
Brandon Low wrote:
>Well there's a faster way to do it, and it doesn't cause stupidity, so
>I'll go with that.
>On Tue, 12/20/05 at 16:05:21 -0600, Brandon Low wrote:
>>I'm working on optimizing Tremor and have run into a quandry. The
>>following set of code snippets should do exactly the same thing, but I'm
>>getting bad artifacts when I use the assembly version, and not when I
>>use the plain-old-C version. Any thoughts are welcome.
>>#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
>> asm ("mac.l %[y0],%[x0],%%acc0\
>> \n\tmsac.l %[y0],%[x],%%acc0\
>> \n\tmac.l %[y1],%[x],%%acc0\
>> \n\tmsac.l %[y1],%[x0],%%acc0\
>> \n\tmovclr.l %%acc0,%[x]\
>> \n\tsub.l %[x0],%[x1]\
>> \n\tdivs.l %[x1],%[x]\
>> \n\nadd.l %[y0],%[x]"
>> : [x] "+d" (x), [x1] "+d" (x1)
>> : [x0] "r" (x0), [y0] "r" (y0), [y1] "r" (y1)
>> : "cc" );
>> return x;
>> return y0+((y1-y0)*(x-x0))/(x1-x0);
Received on 2005-12-21