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>
#if !defined(BITCOUNT_H_INCLUDED)
#define BITCOUNT_H_INCLUDED
#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
+
+
// Global variable initialized at startup that is set to true if
// 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();
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)
#endif // !defined(BITCOUNT_H_INCLUDED)
}
// Print copyright notice
}
// Print copyright notice
- cout << engine_name() << ". Copyright (C) "
+ cout << engine_name() << ". Copyright (C) "
<< "2004-2009 Tord Romstad, Marco Costalba. " << endl;
<< "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();
// Enter UCI mode
uci_main_loop();
#include <iostream>
#include <sstream>
#include <iostream>
#include <sstream>
#include "misc.h"
using namespace std;
#include "misc.h"
using namespace std;
const string engine_name() {
const string engine_name() {
+ const string cpu64(CpuHas64BitPath ? " 64bit" : "");
+
if (!EngineVersion.empty())
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");
string date(__DATE__); // From compiler, format is "Sep 21 2008"
string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
string name = AppName + " " + AppTag + " ";
s << name << date.substr(date.length() - 2) << setfill('0')
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;