[FFmpeg-devel] [PATCH] SH4 mpegaudio decoder optimizations

Reimar Döffinger Reimar.Doeffinger
Mon Dec 13 21:02:34 CET 2010


On Mon, Dec 13, 2010 at 06:40:31PM +0100, Guennadi Liakhovetski wrote:
> +#define SET_MAC(ll)                                  \
> +do {                                                 \
> +    union {int64_t x; int32_t u32[2];} u =           \
> +                    {.x = (ll),};                    \
> +    __asm__ volatile(                                \
> +    "    lds %0, mach\n"                             \
> +    "    lds %1, macl"                               \
> +    :: "r" (u.u32[1]), "r" (u.u32[0])                \
> +    : "mach", "macl");                               \
> +} while (0)
> +
> +#define GET_MAC()                                    \
> +({                                                   \
> +    union {int64_t x; int32_t u32[2];} u;            \
> +    __asm__ volatile(                                \
> +    "    sts MACH, %0\n"                             \
> +    "    sts MACL, %1"                               \
> +    : "=r" (u.u32[1]), "=r" (u.u32[0]):);            \
> +    u.x;                                             \
> +})
> +
> +#define MACS_DO(a, b)                                \
> +    __asm__ volatile(                                \
> +    "    mac.l @%0+, @%1+"                           \
> +    : "+r" (a), "+r" (b) :: "memory")

What's up with the inconsistent casing of the register names?
Anyway you can't split asm like that, it is likely to break as
soon as the compiler is "fixed" to make use of those
registers/instructions on its own, you need to write it
all in a single asm block.



More information about the ffmpeg-devel mailing list