This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc using clobbered register as input with inline assembly
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc using clobbered register as input with inline assembly
- From: Timur Tabi <ttabi at interactivesi dot com>
- Date: Mon, 26 Mar 2001 11:41:13 -0600
egcs-2.91.66 on Red Hat Linux 6.2 (2.2.14 kernel)
I have this inline assembly code:
_inline void
BeginCpuTick(
u64 * const pTime
){
ASSERT(pTime);
__asm__ __volatile__ (
"rdtsc \n\t"
"mov %%eax, (%1) \n\t"
"mov %%edx, 4(%1) \n\t"
: "=m" (*pTime)
: "r" (pTime)
: "eax", "edx"
);
}
According to the documentation, because I specified eax and edx as
clobbered registers, gcc should not be using them as inputs or outputs.
But that's exactly what's happening in my case. Here's the assembly
listing:
leal -8(%ebp),%eax
movl %eax,-12(%ebp)
.stabn 68,0,70,.LM5-CompressIntoCCache
.LM5:
#APP
rdtsc
mov %eax, (%eax)
mov %edx, 4(%eax)
#NO_APP
Is this a bug, or am I doing something wrong?
--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com
When replying to a mailing-list message, please direct the reply to the mailing
list only. Don't send another copy to me.
--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com
When replying to a mailing-list message, please direct the reply to the mailing list only. Don't send another copy to me.