From 6deb52812d61dffcc8e60dd355ca2d763ddbe55e Mon Sep 17 00:00:00 2001 From: gxw Date: Fri, 30 Jun 2023 14:11:01 +0800 Subject: [PATCH] LoongArch64: Add WhereAmI() --- common_loongarch64.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common_loongarch64.h b/common_loongarch64.h index e15539b5f..ce1fcf091 100644 --- a/common_loongarch64.h +++ b/common_loongarch64.h @@ -83,6 +83,19 @@ static inline int blas_quickdivide(blasint x, blasint y){ return x / y; } +#ifndef NO_AFFINITY +static inline int WhereAmI(void){ + int ret = 0, counter = 0; + __asm__ volatile ( + "rdtimel.w %[counter], %[id]" + : [id]"=r"(ret), [counter]"=r"(counter) + : + : "memory" + ); + return ret; +} +#endif + #ifdef DOUBLE #define GET_IMAGE(res) __asm__ __volatile__("fmov.d %0, $f2" : "=f"(res) : : "memory") #else