I came across a code that looks like this:
asm volatile (
# [...]
\"movl $1200, %%ecx;\"
# [...]
);
I know what movl $120
It depends
if there is a colon :
after the string, then it is an extended asm, and %%
escapes the percent which could have especial meanings as mentioned by Carl. Example:
uint32_t in = 1;
uint32_t out = 0;
asm volatile (
"movl %1, %%eax;"
"inc %%eax;"
"movl %%eax, %0"
: "=m" (out) /* Outputs. '=' means written to. */
: "m" (in) /* Inputs. No '='. */
: "%eax"
);
assert(out == in + 1);
otherwise, it will be a compile time error, because without colon it is a basic asm which does not support variable constraints and does not need or support escaping %1
. E.g.:
asm volatile ("movl $1200, %ecx;");
works just fine.
Extended asm is more often used since it is much more powerful.