2010.10 and ffmpeg: thumb conditional instruction should be in IT block -- `movgt r4,r3

Bug #666183 reported by Leonid Moiseichuk
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
FFmpeg
Confirmed
Undecided
Unassigned
Linaro GCC
Invalid
Undecided
Unassigned

Bug Description

ffmpeg is an excellent testing case. Another finding with -mthumb option enabled using 2010.10/Cortex-A8.

The ffmpeg configured with CFLAGS set to "-O0 -mthumb" or "-O2 -mthumb", the rest options is
./configure --enable-gpl --enable-nonfree --disable-ffserver --disable-ffplay --enable-ffmpeg --disable-shared --enable-static --disable-neon --disable-debug

It leads to the following issue:
gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I. -I"/home/ldm/misc/tc/suite/cases/ffmpeg/ffmpeg" -O0 -mthumb -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -fomit-frame-pointer -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -c -o libavcodec/dsputil.o libavcodec/dsputil.c
/tmp/cc3oo5Yt.s: Assembler messages:
/tmp/cc3oo5Yt.s:838: Error: thumb conditional instruction should be in IT block -- `movgt r4,r3'
/tmp/cc3oo5Yt.s:839: Error: thumb conditional instruction should be in IT block -- `movgt r3,r2'
/tmp/cc3oo5Yt.s:841: Error: thumb conditional instruction should be in IT block -- `movle r3,r1'
/tmp/cc3oo5Yt.s:843: Error: thumb conditional instruction should be in IT block -- `movgt r4,r3'
make: *** [libavcodec/dsputil.o] Error 1
=> see test-O0-thumb, preprocessed libavcodec_dsputil-O0.c and resulting libavcodec_dsputil-O2.s

With -O2 the produced numeber of assembler errors is a bit higher
gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I. -I"/home/ldm/misc/tc/suite/cases/ffmpeg/ffmpeg" -O2 -mthumb -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -fomit-frame-pointer -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -c -o libavcodec/dsputil.o libavcodec/dsputil.c
/tmp/ccGoZ2zz.s: Assembler messages:
/tmp/ccGoZ2zz.s:19251: Error: thumb conditional instruction should be in IT block -- `movgt fp,r9'
/tmp/ccGoZ2zz.s:19252: Error: thumb conditional instruction should be in IT block -- `movgt r9,r8'
/tmp/ccGoZ2zz.s:19254: Error: thumb conditional instruction should be in IT block -- `movle r9,r7'
/tmp/ccGoZ2zz.s:19256: Error: thumb conditional instruction should be in IT block -- `movgt fp,r9'
/tmp/ccGoZ2zz.s:19307: Error: thumb conditional instruction should be in IT block -- `movgt r9,r8'
/tmp/ccGoZ2zz.s:19308: Error: thumb conditional instruction should be in IT block -- `movgt r8,ip'
/tmp/ccGoZ2zz.s:19310: Error: thumb conditional instruction should be in IT block -- `movle r8,r6'
/tmp/ccGoZ2zz.s:19312: Error: thumb conditional instruction should be in IT block -- `movgt r9,r8'
=> see test-O2-thumb, preprocessed libavcodec_dsputil-O2.c and resulting libavcodec_dsputil-O2.s

Due to I am not sure about similar findings in gcc-linaro I created this one.

The rest of data and test case collected in attachment.

Revision history for this message
Leonid Moiseichuk (leonid-moiseichuk) wrote :
Revision history for this message
Michael Hope (michaelh1) wrote :

Confirmed using:
 ~/toolchains/gcc-linaro-4.5-2010.09-1-armv7l-maverick-cbuild4-pavo4/bin/gcc -specs=gcc.spec -std=gnu99 -c libavcodec_dsputil.c

Revision history for this message
Michael Hope (michaelh1) wrote :

Confirmed in latest using:
 ~/toolchains/gcc-linaro-4.5-2010.11-0-armv7l-maverick-cbuild14-pavo3/bin/gcc -specs=gcc.spec -std=gnu99 -c libavcodec_dsputil.c

Revision history for this message
Michael Hope (michaelh1) wrote :

This is a bug in the upstream inline assembler. libavcodec/arm/mathops.h contains the function:

static inline av_const int mid_pred(int a, int b, int c)
{
    int m;
    __asm__ volatile (
        "mov %0, %2 \n\t"
        "cmp %1, %2 \n\t"
        "movgt %0, %1 \n\t"
        "movgt %1, %2 \n\t"
        "cmp %1, %3 \n\t"
        "movle %1, %3 \n\t"
        "cmp %0, %1 \n\t"
        "movgt %0, %1 \n\t"
        : "=&r"(m), "+r"(a)
        : "r"(b), "r"(c));
    return m;
}

which is missing an IT instruction before the movgt/movle and similar.

Changed in ffmpeg:
status: New → Confirmed
Changed in gcc-linaro:
status: New → Invalid
Revision history for this message
Michael Hope (michaelh1) wrote :

Note that Ubuntu has more information in LP: #488267

Revision history for this message
Leonid Moiseichuk (leonid-moiseichuk) wrote :

Thanks. Confirmed. The similar issue is exist in libavutils/internal.h

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.