diff --git a/.gitignore b/.gitignore index 5633a9b27..a01d58d23 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ logfile*.log trace.out output/ +.DS_Store diff --git a/common/clisync.h b/common/clisync.h index 8c3c85158..3cff04c52 100644 --- a/common/clisync.h +++ b/common/clisync.h @@ -182,7 +182,8 @@ return 1; } -#elif (CLIENT_CPU == CPU_X86) || (CLIENT_CPU == CPU_AMD64) || (CLIENT_CPU == CPU_CUDA) || (CLIENT_CPU == CPU_ATI_STREAM) || (CLIENT_CPU == CPU_OPENCL) || ((CLIENT_CPU == CPU_ARM) && !defined(__GNUC__)) +#elif (CLIENT_CPU == CPU_X86) || (CLIENT_CPU == CPU_AMD64) || (CLIENT_CPU == CPU_CUDA) || (CLIENT_CPU == CPU_ATI_STREAM) || ((CLIENT_CPU == CPU_OPENCL) && !defined(__arm64__)) || \ + ((CLIENT_CPU == CPU_ARM) && !defined(__GNUC__)) || ((CLIENT_CPU == CPU_ARM64) && !defined(__GNUC__)) typedef volatile long fastlock_t; diff --git a/common/core_r72.cpp b/common/core_r72.cpp index b85b89edc..bbbf09710 100644 --- a/common/core_r72.cpp +++ b/common/core_r72.cpp @@ -207,11 +207,15 @@ const char **corenames_for_contest_rc572() "KKS 2-pipe", "AnBe 1-pipe", "AnBe 2-pipe", - #elif (CLIENT_CPU == CPU_ARM64) + #elif (CLIENT_CPU == CPU_ARM64 && (CLIENT_OS != OS_MACOSX)) "ANSI 4-pipe", "ANSI 2-pipe", "ANSI 1-pipe", "KS-ScalarFusion", + #elif (CLIENT_CPU == CPU_ARM64 && (CLIENT_OS == OS_MACOSX)) + "ANSI 4-pipe", + "ANSI 2-pipe", + "ANSI 1-pipe", #elif (CLIENT_CPU == CPU_MIPS) "ANSI 4-pipe", "ANSI 2-pipe", @@ -1084,7 +1088,7 @@ int selcoreSelectCore_rc572(Client *client, unsigned int threadindex, break; #endif - #if (CLIENT_CPU == CPU_ARM64) + #if (CLIENT_CPU == CPU_ARM64 && (CLIENT_OS != OS_MACOSX)) case 3: unit_func.gen_72 = rc5_72_unit_func_scalarfusion; pipeline_count = 1; diff --git a/common/cputypes.h b/common/cputypes.h index 8839f24ec..0b3e94044 100644 --- a/common/cputypes.h +++ b/common/cputypes.h @@ -438,24 +438,23 @@ #define HAVE_POSIX_THREADS #endif #elif defined(__APPLE__) - #if defined(__arm64__) - #define CLIENT_OS_NAME "iOS" - #define CLIENT_OS OS_IOS - #define CLIENT_CPU CPU_ARM64 - #elif defined(__arm__) || defined(ARM) + #if defined (IOS) #define CLIENT_OS_NAME "iOS" #define CLIENT_OS OS_IOS - #define CLIENT_CPU CPU_ARM + #else + #define CLIENT_OS OS_MACOSX + #if defined(__arm64__) + #define CLIENT_OS_NAME "Mac OS X" // Added this incase we want to identify this as macOS 11 in the future. #else #define CLIENT_OS_NAME "Mac OS X" - #define CLIENT_OS OS_MACOSX - #endif +#endif +#endif #ifndef __unix__ #define __unix__ #endif #if defined(CUDA) && (defined(__i386__) || defined(__x86_64__)) #define CLIENT_CPU CPU_CUDA - #elif defined(OPENCL) && (defined(__i386__) || defined(__x86_64__)) + #elif defined(OPENCL) && (defined(__i386__) || defined(__x86_64__) || defined(__arm64__)) #define CLIENT_CPU CPU_OPENCL #elif defined(__ppc__) || defined(__ppc64__) #define CLIENT_CPU CPU_POWERPC @@ -463,6 +462,10 @@ #define CLIENT_CPU CPU_X86 #elif defined(ASM_AMD64) || defined(__x86_64__) || defined(__amd64__) #define CLIENT_CPU CPU_AMD64 + #elif defined(__arm64__) + #define CLIENT_CPU CPU_ARM64 + #elif defined(__arm__) + #define CLIENT_CPU CPU_ARM #endif #elif defined(__BEOS__) || defined(__be_os) #ifndef __unix__ /* 4.4bsd compatible or not? */ diff --git a/configure b/configure index 639165625..ca6264a17 100755 --- a/configure +++ b/configure @@ -530,9 +530,11 @@ add_sources() # $1=os, $2=arch, $3=custom elif [ "$2" = "arm64" ]; then if [ "$HAVE_RC5_72" = "1" ]; then DEFAULT_RC5_72="1" - TARGET_ADDASMS="$TARGET_ADDASMS rc5-72/arm64/r72-ks-scalarfusion.S" - TARGET_ADDSRCS="$TARGET_ADDSRCS $OGR_GENERAL_SRCS rc5-72/arm64/r72-ks-scalarfusion.cpp" - fi # HAVE_RC5_72 + if ["$1" -ne "macosx"]; then + TARGET_ADDASMS="$TARGET_ADDASMS rc5-72/arm64/r72-ks-scalarfusion.S" + TARGET_ADDSRCS="$TARGET_ADDSRCS $OGR_GENERAL_SRCS rc5-72/arm64/r72-ks-scalarfusion.cpp" + fi #if OSX + fi # HAVE_RC5_7 if [ "$HAVE_OGR" = "1" ]; then DEFAULT_OGRNG="0" # don't add the 32-bit ansi core @@ -1763,8 +1765,9 @@ case "$1" in *ios-arm64) # [zebe] iOS 7+, 64-bit (Xcode >= 6 recommended) TARGET_plat="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -miphoneos-version-min=7.1 -DIPHONEOS_DEPLOYMENT_TARGET=7.1 -DTARGETED_DEVICE_FAMILY=\"1,2\" -arch arm64" - TARGET_CCFLAGS="$OPTS_CLANGCC -Os -DHAVE_POSIX_THREADS $TARGET_plat" + TARGET_CCFLAGS="$OPTS_CLANGCC -Os -DIOS -DHAVE_POSIX_THREADS $TARGET_plat" TARGET_LIBS="-framework CoreFoundation" + TARGET_AS="gcc -c $TARGET_CCFLAGS" TARGET_LDFLAGS="$TARGET_plat" TARGET_IS_CROSSCOMPILE=1 TARGET_DOCFILES="docs/readme._ix" #platform specific docfile @@ -1774,7 +1777,7 @@ case "$1" in *ios-arm) # [zebe] iOS 5+, 32-bit (Xcode >= 5 recommended) TARGET_plat="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -miphoneos-version-min=5.1 -DIPHONEOS_DEPLOYMENT_TARGET=5.1 -DTARGETED_DEVICE_FAMILY=\"1,2\" -arch armv7" - TARGET_CCFLAGS="$OPTS_CLANGCC -Os -DHAVE_POSIX_THREADS $TARGET_plat" + TARGET_CCFLAGS="$OPTS_CLANGCC -Os -DIOS -DHAVE_POSIX_THREADS $TARGET_plat" TARGET_LIBS="-framework CoreFoundation" TARGET_LDFLAGS="$TARGET_plat" TARGET_IS_CROSSCOMPILE=1 @@ -1783,6 +1786,17 @@ case "$1" in add_sources "ios" "generic" ;; + *macosx-arm64) + TARGET_plat="-mmacosx-version-min=11.0 -DMACOSX_DEPLOYMENT_TARGET=11.0 -arch arm64" + TARGET_CCFLAGS="$OPTS_CLANGCC -DHAVE_POSIX_THREADS $TARGET_plat" + TARGET_AS="gcc -c $TARGET_CCFLAGS" + TARGET_LIBS="-framework CoreFoundation -framework IOKit" + TARGET_LDFLAGS="$TARGET_plat" + TARGET_TARBALL="macosx-arm64" + TARGET_DOCFILES="docs/readme._ix" + add_sources "macosx" "arm64" + ;; + # IA64 ***************************************************************** *linux-ia64) @@ -3491,6 +3505,16 @@ case "$1" in add_sources "macosx" "opencl" ;; + *macosx-arm64-opencl) # macOS 11 64-bit, Darwin + TARGET_plat="-mmacosx-version-min=11.0 -DMACOSX_DEPLOYMENT_TARGET=11.0 -arch arm64" + TARGET_CCFLAGS="$OPTS_CLANGCC -DOPENCL -DDYN_TIMESLICE $TARGET_plat" + TARGET_LIBS="-framework IOKit -framework CoreFoundation -framework OpenCL" + TARGET_LDFLAGS="$TARGET_plat" + TARGET_DOCFILES="docs/readme._ix docs/readme.opencl" #platform specific docfile + TARGET_TARBALL="macosx-arm64-opencl" + add_sources "macosx" "opencl" + ;; + ###### Unknown *list) egrep "^[ ]*\*" $0 | grep -v internal | more diff --git a/plat/macosx/temperature.cpp b/plat/macosx/temperature.cpp index 6db8f8590..0b025ba01 100644 --- a/plat/macosx/temperature.cpp +++ b/plat/macosx/temperature.cpp @@ -246,7 +246,7 @@ static UInt32 _SMCread(UInt32 key, io_connect_t connection) smc_input.key = key; smc_input.cmd = SMC_READ_KEYINFO; -#if defined(__x86_64__) +#if defined(__x86_64__) || defined(__arm64__) if (kIOReturnSuccess == IOConnectCallStructMethod(connection, 2, &smc_input, input_size, &smc_output, &output_size)) { #else @@ -260,7 +260,7 @@ static UInt32 _SMCread(UInt32 key, io_connect_t connection) if (smc_input.size == 0) return 0; // Unknown key. -#if defined(__x86_64__) +#if defined(__x86_64__) || defined(__arm64__) if (kIOReturnSuccess == IOConnectCallStructMethod(connection, 2, &smc_input, input_size, &smc_output, &output_size)) { #else diff --git a/rc5-72/arm64/r72-ks-scalarfusion.S b/rc5-72/arm64/r72-ks-scalarfusion.S index 35fef4691..1812dcbf1 100644 --- a/rc5-72/arm64/r72-ks-scalarfusion.S +++ b/rc5-72/arm64/r72-ks-scalarfusion.S @@ -3,8 +3,13 @@ // Returns completed A and B, needs C++ support file for final checks .text +#if defined(__APPLE__) +.globl _scalarFusionEntry +_scalarFusionEntry: +#else .globl scalarFusionEntry scalarFusionEntry: +#endif // push fp and lr stp x29, x30, [sp, #-16]!