ciphor
ciphor

Reputation: 8288

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));
}

Upvotes: 0

Views: 3206

Answers (1)

FrankH.
FrankH.

Reputation: 18227

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.

Upvotes: 0

Related Questions