mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 04:31:09 +00:00
Issue 'yield' in main loop to give CPU time to cool down.
This is functional equvalent to the 'pause' instruction on x86.
This commit is contained in:
parent
3107c1a617
commit
558ee70b3e
3 changed files with 21 additions and 1 deletions
|
@ -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
|
||||
)
|
||||
|
|
10
Makefile
10
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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue