benchmark: Fix cpuid clobbering

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2016-01-01 13:17:37 +01:00
parent db94df5f9c
commit d192d8c017
1 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ static inline cycles_t get_cycles()
struct timespec ts;
#if defined (__x86_64__) || defined(__i386__)
asm volatile ("cpuid"); /* flush pipeline */
asm volatile ("cpuid" : : : "eax", "ebx", "ecx", "edx" ); /* flush pipeline */
#endif
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
return ts.tv_nsec;
@ -68,7 +68,7 @@ static inline cycles_t get_cycles()
{
unsigned low, high;
unsigned long long val;
asm volatile ("cpuid"); /* flush pipeline */
asm volatile ("cpuid" : : : "eax", "ebx", "ecx", "edx" ); /* flush pipeline */
asm volatile ("rdtsc" : "=a" (low), "=d" (high));
val = high;
val = (val << 32) | low;