[FFmpeg-devel] [PATCH] avutil: disable arch specific intmath routines if optimizations are disabled

Xiaolei Yu dreifachstein at gmail.com
Wed Feb 17 13:14:26 CET 2016


On 02/17/2016 03:19 AM, Hendrik Leppkes wrote:
> On Tue, Feb 16, 2016 at 4:00 PM, Yu Xiaolei <dreifachstein at gmail.com> wrote:
>> On Tue, Feb 16, 2016 at 9:01 PM, Michael Niedermayer <michael at niedermayer.cc
>>> wrote:
>>
>>> On Tue, Feb 16, 2016 at 02:40:10PM +0800, Xiaolei Yu wrote:
>>>> Current intmath routines for arm require inter-procedure constant
>>> propagation
>>>> and fail to compile when optimizations are disabled.
>>>> ---
>>>>  configure           | 1 +
>>>>  libavutil/intmath.h | 2 ++
>>>>  2 files changed, 3 insertions(+)
>>>
>>> on arm without opts and this patch i get
>>> src/libavcodec/arm/aac.h: In function ‘VMUL4S’:
>>> src/libavcodec/arm/aac.h:102:5: error: can't find a register in class
>>> ‘LO_REGS’ while reloading ‘asm’
>>> src/libavcodec/arm/aac.h:102:5: error: ‘asm’ operand has impossible
>>> constraints
>>> make: *** [libavcodec/aacdec.o] Error 1
>>>
>>>
>> This error seems unrelated to the patch, but I am not sure as I am only
>> building some selected codecs.
>> Can you build again without the patch?
>>
>> Without the patch I get:
>> In file included from src/libavutil/intmath.h:30:0,
>>                  from src/libavutil/common.h:106,
>>                  from src/libavutil/avutil.h:288,
>>                  from src/libavutil/samplefmt.h:24,
>>                  from src/libavcodec/avcodec.h:31,
>>                  from src/libavcodec/internal.h:33,
>>                  from src/libavcodec/h264_direct.c:28:
>> src/libavutil/arm/intmath.h: In function 'get_scale_factor':
>> src/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably doesn't
>> match constraints
>>      __asm__ ("ssat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p+1));
>>      ^
>> src/libavutil/arm/intmath.h:69:5: error: impossible constraint in 'asm'
>>
>> on x86 build passes with and without the patch here
>>> with what compiler is this needed ?
>>>
>>>
>> Yes, x86 builds fine without this patch. But the underlying problem is not
>> arch specific and may be encountered in other inline asm. I think current
>> patch is more consistent if we consider these routines as manual
>> optimizations.
>>
> 
> --disable-optimization is just meant to disable compiler optimizations
> so that debugging is easier, its not meant to disable any kind of
> hand-written ASM, this may even be a target of the debugging in some
> cases.
> If one wanted to get rid of all ASM, there are other options for that.
> 

Point taken. I will post a new patch that only disables these two functions.


More information about the ffmpeg-devel mailing list