From 554c982d85abf4e3161723ee54899d4dc5fca11d Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 25 Jul 2015 00:25:37 +0800 Subject: [PATCH] test/perf_local: disable tests on unsupported archs * maybe we can have div32 tests on aarch64, but i don't think "udiv|sdiv" supports 64bits numerator. probably we can use float divde for the benchmark... * disable cpuid test on non-intel archs. Fixes: #12453 Reported-by: Tom Deneau Signed-off-by: Kefu Chai --- src/test/perf_local.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/perf_local.cc b/src/test/perf_local.cc index ba3bc0fa086de..2d75351efb010 100644 --- a/src/test/perf_local.cc +++ b/src/test/perf_local.cc @@ -381,6 +381,7 @@ double cond_ping_pong() // 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. @@ -397,6 +398,9 @@ double div32() } 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 @@ -659,6 +663,7 @@ double perf_prefetch() #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 @@ -674,9 +679,11 @@ static inline void serialize() { : "=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++) { @@ -684,6 +691,9 @@ double perf_serialize() { } uint64_t stop = Cycles::rdtsc(); return Cycles::to_seconds(stop - start)/count; +#else + return -1; +#endif } // Measure the cost of an lfence instruction. -- 2.39.5