summaryrefslogtreecommitdiff
path: root/Source/Core/Common/ArmCPUDetect.cpp
diff options
context:
space:
mode:
authorSkyler Saleh <skylersaleh@gmail.com>2021-01-13 06:23:57 -0800
committerSkyler Saleh <skylersaleh@gmail.com>2021-05-22 15:25:17 -0700
commit4ecb3084b70b5581115703b517b9005f608ffb18 (patch)
treeb4a2f2d90c29a7e047bc6660f92ef8bae6ac366e /Source/Core/Common/ArmCPUDetect.cpp
parentf9b0225b69ab566287e08346741ce37b14d5cf38 (diff)
Apple M1 Support for MacOS
This commit adds support for compiling Dolphin for ARM on MacOS so that it can run natively on the M1 processors without running through Rosseta2 emulation providing a 30-50% performance speedup and less hitches from Rosseta2. It consists of several key changes: - Adding support for W^X allocation(MAP_JIT) for the ARM JIT - Adding the machine context and config info to identify the M1 processor - Additions to the build system and docs to support building universal binaries - Adding code signing entitlements to access the MAP_JIT functionality - Updating the MoltenVK libvulkan.dylib to a newer version with M1 support
Diffstat (limited to 'Source/Core/Common/ArmCPUDetect.cpp')
-rw-r--r--Source/Core/Common/ArmCPUDetect.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/Core/Common/ArmCPUDetect.cpp b/Source/Core/Common/ArmCPUDetect.cpp
index a603ff03fd..1cee6ad77b 100644
--- a/Source/Core/Common/ArmCPUDetect.cpp
+++ b/Source/Core/Common/ArmCPUDetect.cpp
@@ -8,6 +8,7 @@
#include <string>
#include <thread>
+#ifndef __APPLE__
#ifndef _WIN32
#ifndef __FreeBSD__
#include <asm/hwcap.h>
@@ -15,6 +16,7 @@
#include <sys/auxv.h>
#include <unistd.h>
#endif
+#endif
#include <fmt/format.h>
@@ -71,7 +73,17 @@ void CPUInfo::Detect()
vendor = CPUVendor::ARM;
bFlushToZero = true;
-#ifdef _WIN32
+#ifdef __APPLE__
+ num_cores = std::thread::hardware_concurrency();
+
+ // M-series CPUs have all of these
+ bFP = true;
+ bASIMD = true;
+ bAES = true;
+ bSHA1 = true;
+ bSHA2 = true;
+ bCRC32 = true;
+#elif defined(_WIN32)
num_cores = std::thread::hardware_concurrency();
// Windows does not provide any mechanism for querying the system registers on ARMv8, unlike Linux