// probably pick worse values.
double div32()
{
+#if defined(__i386__) || defined(__x86_64__)
int count = 1000000;
uint64_t start = Cycles::rdtsc();
// NB: Expect an x86 processor exception is there's overflow.
}
uint64_t stop = Cycles::rdtsc();
return Cycles::to_seconds(stop - start)/count;
+#else
+ return -1;
+#endif
}
// Measure the cost of a 64-bit divide. Divides don't take a constant
#endif
}
+#if defined(__i386__) || defined(__x86_64__)
/**
* This function is used to seralize machine instructions so that no
* instructions that appear after it in the current thread can run before any
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
: "a" (1U));
}
+#endif
// Measure the cost of cpuid
double perf_serialize() {
+#if defined(__i386__) || defined(__x86_64__)
int count = 1000000;
uint64_t start = Cycles::rdtsc();
for (int i = 0; i < count; i++) {
}
uint64_t stop = Cycles::rdtsc();
return Cycles::to_seconds(stop - start)/count;
+#else
+ return -1;
+#endif
}
// Measure the cost of an lfence instruction.