[FFmpeg-devel] [RFC] use ff_avc_find_startcode in ff_find_start_code

Reimar Döffinger Reimar.Doeffinger
Tue Feb 19 19:04:43 CET 2008

On Tue, Feb 19, 2008 at 06:15:42PM +0100, Michael Niedermayer wrote:
> Could you post the asm code gcc generates for you for this function?
> mine generates:
> .L670:
>         movzbl  -1(%ebx), %eax
>         cmpb    $1, %al
>         jbe     .L651
>         addl    $3, %ebx
>         cmpl    %ebx, %ebp
>         ja      .L670

Ignoring that it completely unrolls the first loop and just this part:
        addq    $3, %rsi
        cmpq    %rsi, %rcx
        .p2align 4,,5
        jbe     .L832
        movzbl  -1(%rsi), %eax
        cmpb    $1, %al
        .p2align 4,,3
        ja      .L837
        cmpb    $0, -2(%rsi)
        je      .L828
        addq    $2, %rsi
        cmpq    %rsi, %rcx
        ja      .L835

Maybe it is time to make use of the unlikely() macro we already have?
And disable that stupid alignment of general jump targets...

new code:
        movq    %rax, %rdi
        movl    (%rdi), %ecx
        leal    -65537(%rcx), %eax
        movl    %ecx, %edx
        notl    %edx
        andl    $8388736, %eax
        testl   %eax, %edx
        jne     .L48
        leaq    4(%rdi), %rax
        cmpq    %rsi, %rax
        jb      .L49

> Also what cpu and gcc version do you have?

gcc (GCC) 4.1.2 20070214 (  (gdc 0.24, using dmd 1.020)) (Gentoo 4.1.2 p1.0.2)
AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
64 bit code.

Reimar D?ffinger

More information about the ffmpeg-devel mailing list