[FFmpeg-devel] m68k code for bswap

ami_stuff ami_stuff
Sun Jul 5 05:07:08 CEST 2009


Under 68060 at 50MHz there is also no different (bswap_32 c/asm) in the speed with ape test file.

Maybe this routine needs to be executed more times to see any different?

Here is code I used:

static av_always_inline av_const uint32_t bswap_32(uint32_t x)
{
__asm__(
"rol.w #8,%0;"
"swap %0;"
"rol.w #8,%0;"
: "=d"(x)
: "0"(x)
: "cc"
);
return x;
}

Output asm from original C version:

#NO_APP
	.text
	.even
	.globl	_bswap_32
_bswap_32:
	move.l 4(sp),d0
	move.l d0,d1
	lsl.l #8,d1
	and.l #-16711936,d1
	lsr.l #8,d0
	and.l #16711935,d0
	or.l d1,d0
	swap d0
	rts


Output asm from asm-optimized version:

#NO_APP
	.text
	.even
	.globl	_bswap_32
_bswap_32:
	move.l 4(sp),d0
#APP
	rol.w #8,d0;swap d0;rol.w #8,d0;
#NO_APP
	rts


I think it would be nice to have a simple benchmark which can execute bswap_16/bswap_32/bswap_64
rountines as many times as user want and maybe this benchmark can be included in "test" dir with FFmpeg.




More information about the ffmpeg-devel mailing list