首页 > 代码库 > meaning of "%U0%X0" in PowerPC in the GCC inline asm

meaning of "%U0%X0" in PowerPC in the GCC inline asm

There are idiosyncrasies in the GCC inline assembly syntax.in the line,

__asm__ __volatile__("stw%U0%X0 %1,%0" : "=m"(v->counter) : "r"(i));

the stw assembly instruction takes 2 arguments and the %U0%X0 are constraints on the arguments. These constraints are to force GCC to analyze the arguments and make sure you dont do something stupid. As it turns out, ‘U‘ is powerpc-specific. The full list of constraints can be found in :

http://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints

https://gcc.gnu.org/onlinedocs/gcc/Simple-Constraints.html#Simple-Constraints