diff --git a/CMakeLists.txt b/CMakeLists.txt index edce2806..30495858 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,6 +165,14 @@ if ("${ARCH}" STREQUAL "x86_64") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse") endif() +if ("${ARCH}" STREQUAL "arm") + if (CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv6k") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8.0-a") + endif() +endif() + set(Backends-Generic-Source ${BACKENDS_SRC_DIR}/generic/misc.c ) diff --git a/Makefile b/Makefile index d34e54bd..a8ada467 100755 --- a/Makefile +++ b/Makefile @@ -186,6 +186,16 @@ ifeq ($(YQ2_ARCH), x86_64) CFLAGS += -mfpmath=sse endif +# In ARM mode it cannot generate yield instruction +# to cool down the CPU in busy mode +ifeq ($(YQ2_ARCH), arm) +CFLAGS += -march=armv6k +endif + +ifeq ($(YQ2_ARCH), aarch64) +CFLAGS += -march=armv8.0-a +endif + # ---------- # Systemwide installation. diff --git a/src/common/frame.c b/src/common/frame.c index f0e9ec46..d5a83f04 100644 --- a/src/common/frame.c +++ b/src/common/frame.c @@ -139,13 +139,15 @@ Qcommon_Mainloop(void) while (1) { -#if defined (__GNUC__) && (__i386 || __x86_64__) /* Give the CPU a hint that this is a very tight spinloop. One PAUSE instruction each loop is enough to reduce power consumption and head dispersion a lot, it's 95°C against 67°C on a Kaby Lake laptop. */ +#if defined (__GNUC__) && (__i386 || __x86_64__) asm("pause"); +#elif defined(__arm__) || defined(__aarch64__) + asm("yield"); #endif if (Sys_Microseconds() - spintime >= FRAMEDELAY)