--- a/build/premake/premake5.lua +++ b/build/premake/premake5.lua @@ -85,6 +85,8 @@ else arch = "arm" elseif string.find(machine, "aarch64") == 1 then arch = "aarch64" + elseif string.find(machine, "ppc64") == 1 or string.find(machine, "powerpc64") == 1 then + arch = "ppc64" elseif string.find(machine, "e2k") == 1 then arch = "e2k" else @@ -863,6 +865,8 @@ function setup_all_libs () table.insert(source_dirs, "lib/sysdep/arch/arm"); elseif arch == "aarch64" then table.insert(source_dirs, "lib/sysdep/arch/aarch64"); + elseif arch == "ppc64" then + table.insert(source_dirs, "lib/sysdep/arch/ppc64"); elseif arch == "e2k" then table.insert(source_dirs, "lib/sysdep/arch/e2k"); end --- /dev/null +++ b/source/lib/sysdep/arch/ppc64/ppc64.cpp @@ -0,0 +1,50 @@ +/* Copyright (C) 2012 Wildfire Games + * Copyright (C) 2018 Raptor Engineering, LLC + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * routines specific to POWER + */ + +#include "precompiled.h" + +#include "lib/sysdep/cpu.h" + +intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment) +{ + return __sync_fetch_and_add(location, increment); +} + +bool cpu_CAS(volatile intptr_t* location, intptr_t expected, intptr_t newValue) +{ + return __sync_bool_compare_and_swap(location, expected, newValue); +} + +bool cpu_CAS64(volatile i64* location, i64 expected, i64 newValue) +{ + return __sync_bool_compare_and_swap(location, expected, newValue); +} + +const char* cpu_IdentifierString() +{ + return "IBM POWER"; // TODO +} --- a/source/lib/byte_order.h 2021-02-28 16:59:34.041933978 +0100 +++ b/source/lib/byte_order.h 2021-02-28 16:59:59.311582587 +0100 @@ -33,7 +33,7 @@ #ifndef BYTE_ORDER # define LITTLE_ENDIAN 0x4321 # define BIG_ENDIAN 0x1234 -# if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || ARCH_AARCH64 || ARCH_MIPS || ARCH_E2K || defined(__LITTLE_ENDIAN__) +# if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || ARCH_AARCH64 || ARCH_MIPS || ARCH_E2K || ARCH_PPC64 || defined(__LITTLE_ENDIAN__) # define BYTE_ORDER LITTLE_ENDIAN # else # define BYTE_ORDER BIG_ENDIAN --- a/source/ps/GameSetup/HWDetect.cpp 2021-02-28 18:09:30.331118437 +0100 +++ b/source/ps/GameSetup/HWDetect.cpp 2021-02-28 18:09:52.209822367 +0100 @@ -124,6 +124,7 @@ scriptInterface.SetProperty(settings, "arch_arm", ARCH_ARM); scriptInterface.SetProperty(settings, "arch_aarch64", ARCH_AARCH64); scriptInterface.SetProperty(settings, "arch_e2k", ARCH_E2K); + scriptInterface.SetProperty(settings, "arch_ppc64", ARCH_PPC64); #ifdef NDEBUG scriptInterface.SetProperty(settings, "build_debug", 0); --- a/source/lib/sysdep/arch.h 2021-02-28 18:45:28.761727174 +0100 +++ b/source/lib/sysdep/arch.h 2021-02-28 18:46:03.270251202 +0100 @@ -76,9 +76,15 @@ #else # define ARCH_E2K 0 #endif +// .. PowerPC64 (PPC64) +#if defined(__PPC64__) +# define ARCH_PPC64 1 +#else +# define ARCH_PPC64 0 +#endif // ensure exactly one architecture has been detected -#if (ARCH_IA32+ARCH_IA64+ARCH_AMD64+ARCH_ALPHA+ARCH_ARM+ARCH_AARCH64+ARCH_MIPS+ARCH_E2K) != 1 +#if (ARCH_IA32+ARCH_IA64+ARCH_AMD64+ARCH_ALPHA+ARCH_ARM+ARCH_AARCH64+ARCH_MIPS+ARCH_E2K+ARCH_PPC64) != 1 # error "architecture not correctly detected (either none or multiple ARCH_* defined)" #endif --- a/libraries/source/nvtt/src/src/nvmath/SimdVector_VE.h +++ b/libraries/source/nvtt/src/src/nvmath/SimdVector_VE.h @@ -27,10 +27,7 @@ #ifndef NV_SIMD_VECTOR_VE_H #define NV_SIMD_VECTOR_VE_H -#ifndef __APPLE_ALTIVEC__ #include -#undef bool -#endif namespace nv { diff --git a/source/nvtt/src/src/nvtt/squish/simd_ve.h b/source/nvtt/src/src/nvtt/squish/simd_ve.h index 5a11858..e256c54 100644 --- a/libraries/source/nvtt/src/src/nvtt/squish/simd_ve.h +++ b/libraries/source/nvtt/src/src/nvtt/squish/simd_ve.h @@ -27,10 +27,7 @@ #ifndef SQUISH_SIMD_VE_H #define SQUISH_SIMD_VE_H -#ifndef __APPLE_ALTIVEC__ #include -#undef bool -#endif namespace nvsquish {