This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR target/38941: CX isn't preserved with shift
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 26 Jan 2009 15:49:38 -0800
- Subject: PATCH: PR target/38941: CX isn't preserved with shift
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
People may not be aware that gcc may clobber a register when
generating some operations, like variable shift, memory copy or memory
move on x86. This path mentions this possibility. OK for trunk?
Thanks.
H.J.
----
2009-01-26 H.J. Lu <hongjiu.lu@intel.com>
PR target/38941
* doc/extend.texi: Improve local variable with asm reg.
--- gcc/doc/extend.texi.foo 2009-01-26 09:50:17.000000000 -0800
+++ gcc/doc/extend.texi 2009-01-26 15:43:54.000000000 -0800
@@ -4852,6 +4852,8 @@ asm ("sysint" : "=r" (result) : "0" (p1)
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.
+Also a register may be clobbered when generating some operations,
+like variable shift, memory copy or memory move on x86.
Assuming it is a call-clobbered register, this may happen to @code{r0}
above by the assignment to @code{p2}. If you have to use such a
register, use temporary variables for expressions between the register