[FFmpeg-devel] [PATCH] generic infrastructure to support IWMMXT2

Siarhei Siamashka siarhei.siamashka
Thu May 22 21:55:54 CEST 2008


On Tuesday 20 May 2008, Dmitry Antipov wrote:

> It's just an infrastructure since it doesn't contains actual WMMX/WMMX2
> code.

Not sure if I'm the right person to post comments about this patch, but
anyway.

>  enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
>  enabled armv6   && check_asm armv6   '"sadd16 r0, r0, r0"'
>  enabled armvfp  && check_asm armvfp  '"fadds s0, s0, s0"'
> -enabled iwmmxt  && check_asm iwmmxt  '"wunpckelub wr6, wr4"'
> +enabled iwmmxt  && check_asm iwmmxt  '"wunpckelub wr6, wr4"' -march=iwmmxt
> +enabled iwmmxt2 && check_asm iwmmxt2 '"wavg4 wr0, wr1, wr2"' 
> -march=iwmmxt2 

Build for ARM is a bit different from other platforms and typically uses
crosscompiler. When you are crosscompiling code, configure script does not
know exactly what your target hardware is. So right now you can provide 
"-march"/"-mcpu"/"-mtune" settings with --extra-cflags configure option. And
configure script will automatically select which instructions are supported.
Using --enable-iwmmxt or --disable-iwmmxt options, you can override
autodetection in the case if it does something wrong or you specifically
want to disable some optimizations (for testing/benchmarking purposes for
example).

Your change actually enforces the use of iwmmxt and iwmmxt2 by default for
everyone unless it is explicitly disabled with "--disable-iwmmxt*". It is
different from the logic that has been used so far (I'm not implying that
the current logic is perfect).

> +# be sure we can compile iwmmxt2 code
> +if enabled iwmmxt2; then
> +  check_cc <<EOF
> +void f(void *p, int s) {
> +  asm volatile("wldrd wr0, [%0, %1]!\n\t" : "+r"(p) : "r"(s));
> +}
> +EOF
> +  test $? = 0 || die "Your compiler is too obsolete/buggy to compile
> IWMMXT2 code." +  # iwmmxt2 implies iwmmxt
> +  disabled iwmmxt && enable iwmmxt
> +fi

This part does not make much sense. The problem was that the toolchain
actually silently generated wrong code if the user specified "-march=iwmmxt"
(instead of "-march=iwmmxt2") and this instruction is used somewhere in inline
assembly code (a bug in HAVE_IWMMXT/HAVE_IWMMXT2 ifdef selection in the code
or if the user also enforced --enable-iwmmxt2 for whatever reason and it got
enabled). If the toolchain is old enough and does not support iwmmxt2 at all,
it will fail on the iwmmxt2 support check anyway (the part which checks
for "wavg4" instruction). That is if I understand current situation correctly.

-- 
Best regards,
Siarhei Siamashka




More information about the ffmpeg-devel mailing list