1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00

Print info about use of 64bit functions and hardware POPCNT

With this patch at the applications startup a line is printed
with info about use of optimized 64 bit routines and hardware
POPCNT.

Also allow the possibility to disable POPCNT support during
PGO compiles to exercise the fallback software only path.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-05-23 11:42:43 +01:00
parent 628f844c11
commit ce5d9eb19d
3 changed files with 29 additions and 7 deletions

View file

@ -22,6 +22,12 @@
#if !defined(BITCOUNT_H_INCLUDED)
#define BITCOUNT_H_INCLUDED
// To disable POPCNT support uncomment following line. You should do it only
// in PGO compiling to exercise the default fallback path. Don't forget to
// re-comment the line for the final optimized compile though ;-)
//#define DISABLE_POPCNT_SUPPORT
#include "bitboard.h"
@ -160,8 +166,21 @@ inline int count_1s_max_15(Bitboard b) {
// Global variable initialized at startup that is set to true if
// CPU on which application runs support POPCNT intrinsic.
// CPU on which application runs supports POPCNT intrinsic. Unless
// DISABLE_POPCNT_SUPPORT is defined.
#if defined(DISABLE_POPCNT_SUPPORT)
const bool CpuHasPOPCNT = false;
#else
const bool CpuHasPOPCNT = cpu_has_popcnt();
#endif
// Global variable used to print info about the use of 64 optimized
// functions to verify that a 64bit compile has been correctly built.
#if defined(BITCOUNT_SWAR_64)
const bool CpuHas64BitPath = true;
#else
const bool CpuHas64BitPath = false;
#endif
#endif // !defined(BITCOUNT_H_INCLUDED)

View file

@ -75,11 +75,11 @@ int main(int argc, char *argv[]) {
}
// Print copyright notice
cout << engine_name() << ". Copyright (C) "
cout << engine_name() << ". Copyright (C) "
<< "2004-2009 Tord Romstad, Marco Costalba. " << endl;
// FIXME ONLY FOR DEBUG, REMOVE BEFORE RELEASE
cout << "Support for POPCNT is " << CpuHasPOPCNT << endl;
if (CpuHasPOPCNT)
cout << "Good! CPU has hardware POPCNT. We will use it." << endl;
// Enter UCI mode
uci_main_loop();

View file

@ -65,6 +65,7 @@ static int gettimeofday(struct timeval* tp, struct timezone*)
#include <iostream>
#include <sstream>
#include "bitcount.h"
#include "misc.h"
using namespace std;
@ -162,8 +163,10 @@ void dbg_print_mean(ofstream& logFile) {
const string engine_name() {
const string cpu64(CpuHas64BitPath ? " 64bit" : "");
if (!EngineVersion.empty())
return "Stockfish " + EngineVersion;
return AppName+ " " + EngineVersion + cpu64;
string date(__DATE__); // From compiler, format is "Sep 21 2008"
string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
@ -176,7 +179,7 @@ const string engine_name() {
string name = AppName + " " + AppTag + " ";
s << name << date.substr(date.length() - 2) << setfill('0')
<< setw(2) << mon << setw(2) << day;
<< setw(2) << mon << setw(2) << day << cpu64;
return s.str();
}