From: Janne Grunau Date: Thu, 6 Nov 2014 08:20:17 +0000 (+0100) Subject: checkasm: add cycle counter read for aarch64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6ec424939a4d3a59e4ec1e3999cb37e4314408e;p=libx264 checkasm: add cycle counter read for aarch64 Needs kernel support since user space access to the cycle counter is not allowed on all available AArch64 systems (Android 5 and iOS). --- diff --git a/tools/checkasm.c b/tools/checkasm.c index a348aa18..c90c0cfc 100644 --- a/tools/checkasm.c +++ b/tools/checkasm.c @@ -97,6 +97,10 @@ static inline uint32_t read_time(void) asm volatile( "mftb %0" : "=r"(a) :: "memory" ); #elif ARCH_ARM // ARMv7 only asm volatile( "mrc p15, 0, %0, c9, c13, 0" : "=r"(a) :: "memory" ); +#elif ARCH_AARCH64 + uint64_t b = 0; + asm volatile( "mrs %0, pmccntr_el0" : "=r"(b) :: "memory" ); + a = b; #endif return a; } @@ -2764,7 +2768,7 @@ int main(int argc, char *argv[]) if( argc > 1 && !strncmp( argv[1], "--bench", 7 ) ) { -#if !ARCH_X86 && !ARCH_X86_64 && !ARCH_PPC && !ARCH_ARM +#if !ARCH_X86 && !ARCH_X86_64 && !ARCH_PPC && !ARCH_ARM && !ARCH_AARCH64 fprintf( stderr, "no --bench for your cpu until you port rdtsc\n" ); return 1; #endif