-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Renamed __popcount_use_table to __popcount_table. * [PPC] Added PowerPC support from ppc32 to Power10.
- Loading branch information
Showing
5 changed files
with
127 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
define HELP_STRING_PPC | ||
To build Stockfish, run the following command: | ||
|
||
make <build-target> [ARCH=<preset>] | ||
|
||
Build presets for PowerPC architecture: | ||
|
||
ppc-power10 > Power10 | ||
ppc-power9 > Power9 | ||
ppc-power8 > Power8 | ||
ppc-power7 > Power7 | ||
ppc-64 > PowerPC 64-bit | ||
ppc-32 > PowerPC 32-bit | ||
|
||
endef | ||
export HELP_STRING_PPC | ||
|
||
ifneq ($(filter $(COMP),gcc clang icx),) | ||
|
||
ifeq ($(ARCH),ppc-power10) | ||
SF_CXXFLAGS += -mcpu=power10 | ||
else ifeq ($(ARCH),ppc-power9) | ||
SF_CXXFLAGS += -mcpu=power9 | ||
else ifeq ($(ARCH),ppc-power8) | ||
SF_CXXFLAGS += -mcpu=power8 | ||
else ifeq ($(ARCH),ppc-power7) | ||
SF_CXXFLAGS += -mcpu=power7 | ||
else ifeq ($(ARCH),ppc-64) | ||
SF_CXXFLAGS += -mcpu=powerpc64 | ||
else ifeq ($(ARCH),ppc-32) | ||
SF_CXXFLAGS += -mcpu=powerpc | ||
endif | ||
|
||
endif # gcc clang icx | ||
|
||
.PHONY: help-arch config-sanity-arch | ||
|
||
help-arch: | ||
@echo "$${HELP_STRING_PPC}" | ||
|
||
config-sanity-arch: | ||
@[ "$(ARCH)" = "ppc-power10" -o \ | ||
"$(ARCH)" = "ppc-power9" -o \ | ||
"$(ARCH)" = "ppc-power8" -o \ | ||
"$(ARCH)" = "ppc-power7" -o \ | ||
"$(ARCH)" = "ppc-64" -o \ | ||
"$(ARCH)" = "ppc-32" \ | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
Stockfish, a UCI chess playing engine derived from Glaurung 2.1 | ||
Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file) | ||
Stockfish is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Stockfish is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef PPC_ARCH_H_INCLUDED | ||
#define PPC_ARCH_H_INCLUDED | ||
|
||
#if !defined(__PPC__) | ||
#error "Not supported in the current architecture." | ||
#endif | ||
|
||
#include <cassert> | ||
#include <cstdint> | ||
#include <type_traits> | ||
|
||
#include "common.h" | ||
|
||
#if STOCKFISH_COMPILER == STOCKFISH_COMPILER_GCC | ||
#include <ppu_intrinsics.h> | ||
#endif | ||
|
||
namespace Stockfish { | ||
|
||
#ifdef __PPC64__ | ||
inline constexpr bool ArchImpl::Is64Bit = true; | ||
#else | ||
inline constexpr bool ArchImpl::Is64Bit = false; | ||
#endif | ||
|
||
inline constexpr bool ArchImpl::UsePEXT = false; | ||
|
||
template<int Hint> | ||
inline void ArchImpl::prefetch(const void* m) { | ||
__dcbt(m); | ||
} | ||
|
||
template<typename T> | ||
inline unsigned int ArchImpl::popcount(T n) { | ||
static_assert(std::is_integral_v<T> && sizeof(T) <= 8); | ||
|
||
// This will generate POPCNTD instruction on PWR7 and later. | ||
return __popcount_value(n); | ||
} | ||
|
||
template<typename T> | ||
inline T ArchImpl::pext([[maybe_unused]] T n, [[maybe_unused]] T mask) { | ||
return 0; | ||
} | ||
|
||
} // namespace Stockfish | ||
|
||
#endif // I386_ARCH_H_INCLUDED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters