I don't understand a lot of ASM. I recently ran across inline gcc asm which reads:
("rdtsc;movl %%eax,%0":"=m"(x)::"ax","dx")
It looks to me as though that puts the lower 32 bits of the counter in x
, a 32-bit unsigned integer. What I don't understand is why would you clobber ax
and dx
. Is that for synchronization, or for some other reason? I've seen a lot of rdtsc
examples but never any that clobber ax
and dx
.
Also, regarding rdtsc
, I read here if you clobber memory
then gcc won't reorder the instruction. Is that good advice and do you have any suggestions from preventing reordering of rdtsc
instructions?
Thanks