简体   繁体   中英

GNU assembler compiling error 'invalid operand in inline asm'

I'm trying to compile some assembly code using GNU assembler, with target as ARM platform. But some errors appear. I'm not familiar with the assembly grammar.

Anyone can tell me how to work around this error?

error: invalid operand in inline asm: 'str  ${2:Q}, $0  
str  ${2:R}, $1

The inline asm code which caused this compiling error is here:

static av_always_inline void AV_WN64(void *p, uint64_t v)
{
    __asm__ ("str  %Q2, %0  \n\t"
         "str  %R2, %1  \n\t"
         : "=m"(*(uint32_t*)p), "=m"(*((uint32_t*)p+1))
         : "r"(v));
}

Try:

__asm__ ("strd [%0], %1\n\t" : : "r"(p), "r"(v) : "memory");

The compiler should recognize that v as 64bit quantity requires a register pair.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM