mvapich2/1001-add-sw_64-support-not-upstream-mv2_clock.patch
panchenbo 391f4aa58d add sw_64 and loongarch64 support
(cherry picked from commit ac95e747a9e8439cfe17d83c8ecf11d87af4cf32)
2023-09-21 19:15:54 +08:00

21 lines
642 B
Diff

diff --git a/src/mpid/ch3/channels/common/include/mv2_clock.h b/src/mpid/ch3/channels/common/include/mv2_clock.h
index 135798f..ae32d00 100644
--- a/src/mpid/ch3/channels/common/include/mv2_clock.h
+++ b/src/mpid/ch3/channels/common/include/mv2_clock.h
@@ -106,6 +106,15 @@ static inline cycles_t get_cycles()
);
return val;
}
+#elif defined(__sw_64__)
+typedef unsigned long cycles_t;
+static inline cycles_t get_cycles()
+{
+ cycles_t ret;
+
+ __asm__ __volatile__ ("rtc %0" : "=r"(ret));
+ return ret;
+}
#else
#warning get_cycles not implemented for this architecture: attempt asm/timex.h