How to inline a huge m68k code?
Andrew Haley
aph@redhat.com
Tue Jul 14 14:35:00 GMT 2009
ami_stuff wrote:
>> Yes, but you must be careful. These macros will be interpreted differently
>> depending on whether their arguments are signed or unsigned, so you must
>> ensure their assembly replacements are appropriate.
>
> Sorry to bother you again, but maybe you can try to create repleacements for C
> functions with use of umul_ppmm code? I'm afraid I'm not so skilled and only one
> mistake - you get noise or no sound in the output file. :P
> It looks for me that mp3 decoder uses only signed arguments.
>
> I will re-done the benchmark on the 68060 with all functions asm optimized.
>
> BTW. I compared the output wav files from original version and inlined of FFmpeg
> and everything is ok - files are identical.
My guess:
inline int64_t MUL64(int a, int b)
{
uint32_t au = a;
uint32_t bu = b;
uint32_t resh, resl;
uint64_t res;
umul_ppmm(resh, resl, au, bu);
if (a < 0)
resh -= bu;
if (b < 0)
resh -= au;
res = ((uint64_t)resh << 32) | resl;
return res;
}
#define MULL(a,b,s) \
(MUL64(a, b) >> s)
#ifndef MAC64
# define MAC64(d, a, b) ((d) += MUL64(a, b))
#endif
#ifndef MLS64
# define MLS64(d, a, b) ((d) -= MUL64(a, b))
#endif
More information about the Gcc-help
mailing list