Skip to content

Commit 6deb528

Browse files
committed
LoongArch64: Add WhereAmI()
1 parent 2183dbc commit 6deb528

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

common_loongarch64.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ static inline int blas_quickdivide(blasint x, blasint y){
8383
return x / y;
8484
}
8585

86+
#ifndef NO_AFFINITY
87+
static inline int WhereAmI(void){
88+
int ret = 0, counter = 0;
89+
__asm__ volatile (
90+
"rdtimel.w %[counter], %[id]"
91+
: [id]"=r"(ret), [counter]"=r"(counter)
92+
:
93+
: "memory"
94+
);
95+
return ret;
96+
}
97+
#endif
98+
8699
#ifdef DOUBLE
87100
#define GET_IMAGE(res) __asm__ __volatile__("fmov.d %0, $f2" : "=f"(res) : : "memory")
88101
#else

0 commit comments

Comments
 (0)