[FFmpeg-devel] [PATCH v4 2/4] libavutils: Add parse_r helper for MIPS

jiaxun.yang at flygoat.com jiaxun.yang at flygoat.com
Tue Jun 9 08:59:00 EEST 2020



于 2020年6月9日 GMT+08:00 下午1:43:58, Shiyou Yin <yinshiyou-hf at loongson.cn> 写到:
>>-----Original Message-----
>>From: jiaxun.yang at flygoat.com [mailto:jiaxun.yang at flygoat.com]
>>Sent: Tuesday, June 9, 2020 2:03 AM
>>To: FFmpeg development discussions and patches; Shiyou Yin; 'FFmpeg development discussions and
>>patches'
>>Subject: Re: [FFmpeg-devel] [PATCH v4 2/4] libavutils: Add parse_r helper for MIPS
>>
>>
>>
>>于 2020年6月8日 GMT+08:00 下午4:38:58, Shiyou Yin <yinshiyou-hf at loongson.cn> 写到:
>>>>-----Original Message-----
>>>>From: ffmpeg-devel-bounces at ffmpeg.org [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of
>>>>Jiaxun Yang
>>>>Sent: Monday, June 8, 2020 11:30 AM
>>>>To: ffmpeg-devel at ffmpeg.org
>>>>Cc: yinshiyou at loongson.cn; Jiaxun Yang
>>>>Subject: [FFmpeg-devel] [PATCH v4 2/4] libavutils: Add parse_r helper for MIPS
>>>>
>>
>>[...]
>>
>>>In inline assembler, we can add asmSymbolicName in Input/ Output Operands, format:
>>>[ [asmSymbolicName] ] constraint (cExpression)
>>>[ [asmSymbolicName] ] constraint (cVariableName)
>>
>>Could you expand it?
>>I'm not really sure how that related to our case.
>>
>>I'm trying to use raw opcode in inline assembly and I need
>>this helper to deal with oprands in raw opcode.
>>
>>Thanks!
>>
>
>For the raw opcode case, another proposal for your reference.
>static uint32_t read_cpucfg_2(uint32_t reg)
>{
>    register uint32_t input __asm__ ("t0") = reg;
>    register uint32_t __res __asm__ ("t1") = 0;
>    __asm__ volatile(
>        ".insn                     \n\t"
>        ".word (0xc9084918)         \n\t"
>    );
>    return __res;

Actually this is not always safe.
t0 and t1 might be clobbered by compiler optimization.

>}

I need this helper to ensure the register usage is guarded by
compiler's allocation system.

>

-- 
Jiaxun Yang


More information about the ffmpeg-devel mailing list