Skip to content

Commit a731a9b

Browse files
authored
Merge pull request #2467 from AGSaidi/rpcc
Make rpcc() on arm64 get closer to what x86 returns
2 parents 1aa5907 + 19f3a40 commit a731a9b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

common_arm64.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ static void __inline blas_lock(volatile BLASULONG *address){
8181
#if !defined(OS_DARWIN) && !defined (OS_ANDROID)
8282
static __inline BLASULONG rpcc(void){
8383
BLASULONG ret = 0;
84+
blasint shift;
8485

8586
__asm__ __volatile__ ("isb; mrs %0,cntvct_el0":"=r"(ret));
87+
__asm__ __volatile__ ("mrs %0,cntfrq_el0; clz %w0, %w0":"=&r"(shift));
8688

87-
return ret;
89+
return ret << shift;
8890
}
8991

9092
#define RPCC_DEFINED

0 commit comments

Comments
 (0)