[FFmpeg-cvslog] r14239 - trunk/libavutil/bswap.h

Måns Rullgård mans
Tue Jul 15 23:18:39 CEST 2008


matthieu castet <castet.matthieu at free.fr> writes:

> Hi,
>
> mru wrote:
>> ==============================================================================
>> --- trunk/libavutil/bswap.h	(original)
>> +++ trunk/libavutil/bswap.h	Tue Jul 15 21:05:49 2008
>> @@ -40,6 +40,8 @@ static av_always_inline av_const uint16_
>>      asm("rorw $8, %0" : "+r"(x));
>>  #elif defined(ARCH_SH4)
>>      asm("swap.b %0,%0" : "=r"(x) : "0"(x));
>> +#elif defined(HAVE_ARMV6)
>> +    asm("rev16 %0, %0" : "+r"(x));
>>  #else
>>      x= (x>>8) | (x<<8);
> BTW did you see that gcc transform this into [1]
>      rev16 r0, r0
>      mov r0, r0, asl #16
>      mov r0, r0, lsr #16
>
> Gcc asm inline seem to assume we are unable to output real 16 bits 
> value, and do 2 extras operations to do the 32 to 16 bits cast...
>
> [1] At least with CodeSourcery 2007q3

Did you give a -mcpu=something flag?  With -mcpu=cortex-a8, it adds a
useless uxth instruction, but at least that's only one.  The only way
to stop it is by making argument and return value to a 32-bit type,
and I don't know what implications that might have elsewhere.  Still,
it's better than the C code.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-cvslog mailing list