[Bug target/38941] CX isn't preserved with shift

hjl dot tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Jan 24 01:32:00 GMT 2009



------- 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



More information about the Gcc-bugs mailing list