38 lines
1.0 KiB
Diff
38 lines
1.0 KiB
Diff
From 2c87d0fb35dc83c446665c80c78629bb9114e2b4 Mon Sep 17 00:00:00 2001
|
|
From: houfangdong <houfangdong@loongson.cn>
|
|
Date: Thu, 18 Nov 2021 09:03:23 +0800
|
|
Subject: [PATCH 3/3] mv2_clock support loongarch64.
|
|
|
|
---
|
|
src/mpid/ch3/channels/common/include/mv2_clock.h | 14 ++++++++++++++
|
|
1 file changed, 14 insertions(+)
|
|
|
|
diff --git a/src/mpid/ch3/channels/common/include/mv2_clock.h b/src/mpid/ch3/channels/common/include/mv2_clock.h
|
|
index 98f05df..45f3316 100644
|
|
--- a/src/mpid/ch3/channels/common/include/mv2_clock.h
|
|
+++ b/src/mpid/ch3/channels/common/include/mv2_clock.h
|
|
@@ -92,6 +92,20 @@ static inline cycles_t get_cycles()
|
|
|
|
return ret;
|
|
}
|
|
+#elif defined(__loongarch64)
|
|
+typedef unsigned long cycles_t;
|
|
+static inline cycles_t get_cycles()
|
|
+{
|
|
+ int rID = 0;
|
|
+ cycles_t val = 0;
|
|
+
|
|
+ __asm__ __volatile__(
|
|
+ "rdtime.d %0, %1 \n\t"
|
|
+ : "=r"(val), "=r"(rID)
|
|
+ :
|
|
+ );
|
|
+ return val;
|
|
+}
|
|
|
|
#else
|
|
#warning get_cycles not implemented for this architecture: attempt asm/timex.h
|
|
--
|
|
2.27.0
|
|
|