Answer the question
In order to leave comments, you need to log in
Why doesn't asm("rdtsc\n":"=a"(start.t32.th), "=d"(start.t32.tl)) work?
Hello! :)
There is such a line of code (I'm trying to measure the clock frequency).
asm("rdtsc\n":"=a"(start.t32.th), "=d"(start.t32.tl));
Answer the question
In order to leave comments, you need to log in
Studio and GCC don't like the colon.
$ cat rdtsc.c
void f(unsigned long *low, unsigned long *high)
{
asm("rdtsc\n":"=a"(*low), "=d"(*high));
}
$ gcc -O2 -S -W -Wall rdtsc.c
$ cat rdtsc.s
.file "rdtsc.c"
.text
.p2align 4,,15
.globl f
.type f, @function
f:
.LFB0:
.cfi_startproc
#APP
# 3 "rdtsc.c" 1
rdtsc
# 0 "" 2
#NO_APP
movq %rax, (%rdi)
movq %rdx, (%rsi)
ret
.cfi_endproc
.LFE0:
.size f, .-f
.ident "GCC: (GNU) 4.7.2 20121109 (Red Hat 4.7.2-8)"
.section .note.GNU-stack,"",@progbits
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question