------- Comment #9 from hjl dot tools at gmail dot com 2009-01-24 01:32 ------- >From gcc doc:
--- Sometimes you need to make an `asm' operand be a specific register, but there's no matching constraint letter for that register _by itself_. To force the operand into that register, use a local variable for the operand and specify the register in the variable declaration. *Note Explicit Reg Vars::. Then for the `asm' operand, use any register constraint letter that matches the register: register int *p1 asm ("r0") = ...; register int *p2 asm ("r1") = ...; register int *result asm ("r0"); asm ("sysint" : "=r" (result) : "0" (p1), "r" (p2)); In the above example, beware that a register that is call-clobbered by the target ABI will be overwritten by any function call in the assignment, including library calls for arithmetic operators. --- So the current gcc behaviour is reasonable. Maybe we need to extend document to cover cases where some registers may be clobbered by some operations. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38941