Re: How to inline a huge m68k code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> This is wrong.  It should be:
> 
> #define umul_ppmm(xh, xl, a, b) \
>   __asm__ ("| Inlined umul_ppmm\n"					\
> 	   "	move%.l	%2,%/d0\n"					\
> 	   "	move%.l	%3,%/d1\n"					\
> 	   "	move%.l	%/d0,%/d2\n"					\
> 	   "	swap	%/d0\n"						\
> 	   "	move%.l	%/d1,%/d3\n"					\
> 	   "	swap	%/d1\n"						\
> 	   "	move%.w	%/d2,%/d4\n"					\
> 	   "	mulu	%/d3,%/d4\n"					\
> 	   "	mulu	%/d1,%/d2\n"					\
> 	   "	mulu	%/d0,%/d3\n"					\
> 	   "	mulu	%/d0,%/d1\n"					\
> 	   "	move%.l	%/d4,%/d0\n"					\
> 	   "	eor%.w	%/d0,%/d0\n"					\
> 	   "	swap	%/d0\n"						\
> 	   "	add%.l	%/d0,%/d2\n"					\
> 	   "	add%.l	%/d3,%/d2\n"					\
> 	   "	jcc	1f\n"						\
> 	   "	add%.l	%#65536,%/d1\n"					\
> 	   "1:	swap	%/d2\n"						\
> 	   "	moveq	%#0,%/d0\n"					\
> 	   "	move%.w	%/d2,%/d0\n"					\
> 	   "	move%.w	%/d4,%/d2\n"					\
> 	   "	move%.l	%/d2,%1\n"					\
> 	   "	add%.l	%/d1,%/d0\n"					\
> 	   "	move%.l	%/d0,%0"					\
> 	   : "=g" ((uint32_t) (xh)),					\
> 	     "=g" ((uint32_t) (xl))					\
> 	   : "g" ((uint32_t) (a)),					\
> 	     "g" ((uint32_t) (b))					\
> 	   : "d0", "d1", "d2", "d3", "d4")
> 
> inline int xxMULH(int a, int b)
> {
>   uint32_t au = a;
>   uint32_t bu = b;
> 
>   uint32_t resh, resl;
> 
>   umul_ppmm(resh, resl, au, bu);
> 
>   if (a < 0)
>     resh -= bu;
>   if (b < 0)
>     resh -= au;
> 
>   return (int)resh;
> }

Maybe it's also possible to use this asm inline also for these functions?

#ifndef MULL
#   define MULL(a,b,s) (((int64_t)(a) * (int64_t)(b)) >> (s))
#endif

#ifndef MUL64
#   define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
#endif

#ifndef MAC64
#   define MAC64(d, a, b) ((d) += MUL64(a, b))
#endif

#ifndef MLS64
#   define MLS64(d, a, b) ((d) -= MUL64(a, b))
#endif

All functions used by FFmpeg's mp3 decoder.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux