This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/38941] CX isn't preserved with shift
- From: "hjl dot tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jan 2009 01:32:38 -0000
- Subject: [Bug target/38941] CX isn't preserved with shift
- References: <bug-38941-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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