Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Why doesn't this works ???

harrysnot
Beginner
328 Views
Hello all.

The following snippet compiles fine using the MSVC 6 compiler, but doesn't using intel C++ 8 compiler.
I got these errors (both twice, so 4 errors...):

error: too many C symbol replacements in an assembly language instruction mov res.LowPart, eax
^
error: label "mov" was referenced but not defined


And this is the code:

static __inline LARGE_INTEGER _GetTicks( void )
{
LARGE_INTEGER res;
__asm {
RDTSC
mov res.HighPart, edx
mov res.LowPart, eax
}
return res;
}


How can I solve them??

Thanks
0 Kudos
1 Reply
TimP
Honored Contributor III
328 Views
For Intel C++ 8.1 and 9.0, the Microsoft intrinsic
__rdtsc() is implemented. I don't know whether this depends on having the msvc7 library. It's supported in the MS C++ 2003 toolkit. Microsoft has obsoleted application use of asm{} for this purpose. I don't exactly when the corresponding change came into the various Intel 8.x compilers.

There is a small difference in the way this would work on the newer machines. Rather than tieing the counter to the CPU clock, as it used to do, the instruction returns a count of front side bus base clock, multiplied by the intended multiplier corresponding to the full clock speed of the chip. Thus, rdtsc() should continue to run proportional to front side bus speed, regardless of power saving adjustments to CPU speed.
0 Kudos
Reply