This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc using clobbered register as input with inline assembly


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]