This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc using clobbered register as input with inline assembly
On Mon, Mar 26, 2001 at 12:38:39PM -0600, Timur Tabi wrote:
> > inline void
> > BeginCpuTick(u64 *const pTime)
> > {
> > register u64 xtime;
> > asm volatile ("rdtsc" : "=A" (xtime));
> > *pTime = xtime;
> > }
>
> Could I replace the above with:
>
> inline void
> BeginCpuTick(u64 *const pTime)
> {
> register u64 xtime;
> asm volatile ("rdtsc" : "=A" (*ptime));
> }
It seems to work fine. (You can take out the 'register u64 xtime'
even.) I was a bit surprised, "=A" is a register constraint and
*ptime is a memory location, but it's clever enough to push the values
from eax:edx out to memory...
zw