On Sun, Apr 24, 2011 at 9:18 AM, Clément Bœsch <[email protected]> wrote:
> On Sun, Apr 24, 2011 at 09:06:16AM +0300, Uoti Urpala wrote:
>> The current generic C implementation, which is always used when the
>> public header is included from other programs (either directly or
>> through intreadwrite.h) compiles to a mess like this (gcc-4.6 on AMD64):
>>         movq    %rdi, %rdx
>>         shrq    $32, %rdx
>>         movl    %edx, %eax
>>         sall    $8, %edx
>>         shrl    $8, %eax
>>         andl    $-16711936, %edx
>>         andl    $16711935, %eax
>>         orl     %edx, %eax
>>         movl    %edi, %edx
>>         sall    $8, %edi
>>         shrl    $8, %edx
>>         andl    $-16711936, %edi
>>         roll    $16, %eax
>>         andl    $16711935, %edx
>>         orl     %edi, %edx
>>         roll    $16, %edx
>>         salq    $32, %rdx
>>         orq     %rdx, %rax
>>         ret
>
> Is this av_bswap64? av_bswap32, on gcc46 and amd64, compiled in -O2 generates
> something simpler here. Also, a naive implementation of the swap seems to be
> detected as a bswap:

It's av_bswap64. The swap in av_bswap32 is better than the naive one
on most architectures, I believe. I never bothered filing a gcc bug
about it not being detected, since it's not a problem in real
programs.

clang seems to have trouble generating rolw/rorw if you replace
av_bswap16 with (x>>8|x<<8), but that's not a huge problem since they
can fix it.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to