Commit c10336bf authored by Niels Möller's avatar Niels Möller

nettle-benchmark: Add volatile to inline asm.

parent 09def119
2019-01-09 Niels Möller <nisse@lysator.liu.se>
* examples/nettle-benchmark.c (GET_CYCLE_COUNTER): Add volatile to
inline asm.
2019-01-08 Niels Möller <nisse@lysator.liu.se> 2019-01-08 Niels Möller <nisse@lysator.liu.se>
* sha512-compress.c: Add missing include of sha2-internal.h. * sha512-compress.c: Add missing include of sha2-internal.h.
......
...@@ -92,24 +92,24 @@ static double frequency = 0.0; ...@@ -92,24 +92,24 @@ static double frequency = 0.0;
#if WITH_CYCLE_COUNTER #if WITH_CYCLE_COUNTER
# if defined(__i386__) # if defined(__i386__)
#define GET_CYCLE_COUNTER(hi, lo) \ #define GET_CYCLE_COUNTER(hi, lo) \
__asm__("xorl %%eax,%%eax\n" \ __asm__ volatile ("xorl %%eax,%%eax\n" \
"movl %%ebx, %%edi\n" \ "movl %%ebx, %%edi\n" \
"cpuid\n" \ "cpuid\n" \
"rdtsc\n" \ "rdtsc\n" \
"movl %%edi, %%ebx\n" \ "movl %%edi, %%ebx\n" \
: "=a" (lo), "=d" (hi) \ : "=a" (lo), "=d" (hi) \
: /* No inputs. */ \ : /* No inputs. */ \
: "%edi", "%ecx", "cc") : "%edi", "%ecx", "cc")
# elif defined(__x86_64__) # elif defined(__x86_64__)
#define GET_CYCLE_COUNTER(hi, lo) \ #define GET_CYCLE_COUNTER(hi, lo) \
__asm__("xorl %%eax,%%eax\n" \ __asm__ volatile ("xorl %%eax,%%eax\n" \
"mov %%rbx, %%r10\n" \ "mov %%rbx, %%r10\n" \
"cpuid\n" \ "cpuid\n" \
"rdtsc\n" \ "rdtsc\n" \
"mov %%r10, %%rbx\n" \ "mov %%r10, %%rbx\n" \
: "=a" (lo), "=d" (hi) \ : "=a" (lo), "=d" (hi) \
: /* No inputs. */ \ : /* No inputs. */ \
: "%r10", "%rcx", "cc") : "%r10", "%rcx", "cc")
# endif # endif
#define BENCH_ITERATIONS 10 #define BENCH_ITERATIONS 10
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment