http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46598
--- Comment #16 from H.J. Lu <hjl.tools at gmail dot com> 2010-11-23 15:44:35 UTC --- (In reply to comment #14) > (In reply to comment #13) > > They can use the new rdtsc builtin. > > In which GCC version will it appear ? will be cool if you can share a little > example as well. GCC 4.5 supports it: [...@gnu-6 tmp]$ cat x.c #include <x86intrin.h> unsigned long long foo () { return __rdtsc (); } [...@gnu-6 tmp]$ gcc -O2 x.c -S [...@gnu-6 tmp]$ cat x.s .file "x.c" .text .p2align 4,,15 .globl foo .type foo, @function foo: .LFB535: .cfi_startproc rdtsc salq $32, %rdx orq %rdx, %rax ret .cfi_endproc .LFE535: .size foo, .-foo .ident "GCC: (GNU) 4.5.1 20100924 (Red Hat 4.5.1-4)" .section .note.GNU-stack,"",@progbits [...@gnu-6 tmp]$ gcc -O2 x.c -S -m32 [...@gnu-6 tmp]$ cat x.s .file "x.c" .text .p2align 4,,15 .globl foo .type foo, @function foo: pushl %ebp movl %esp, %ebp rdtsc popl %ebp ret .size foo, .-foo .ident "GCC: (GNU) 4.5.1 20100924 (Red Hat 4.5.1-4)" .section .note.GNU-stack,"",@progbits [...@gnu-6 tmp]$