Remove 4way SSE2 scanhash implementation.

This commit is contained in:
Jeff Garzik
2011-04-03 14:21:52 -04:00
committed by Jeff Garzik
parent 454bc86479
commit b26141e2c5
3 changed files with 6 additions and 560 deletions

View File

@@ -3151,71 +3151,6 @@ void ThreadBitcoinMiner(void* parg)
printf("ThreadBitcoinMiner exiting, %d threads remaining\n", vnThreadsRunning[3]);
}
#if defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE)
void CallCPUID(int in, int& aret, int& cret)
{
int a, c;
asm (
"mov %2, %%eax; " // in into eax
"cpuid;"
"mov %%eax, %0;" // eax into a
"mov %%ecx, %1;" // ecx into c
:"=r"(a),"=r"(c) /* output */
:"r"(in) /* input */
:"%eax","%ebx","%ecx","%edx" /* clobbered register */
);
aret = a;
cret = c;
}
bool Detect128BitSSE2()
{
int a, c, nBrand;
CallCPUID(0, a, nBrand);
bool fIntel = (nBrand == 0x6c65746e); // ntel
bool fAMD = (nBrand == 0x444d4163); // cAMD
struct
{
unsigned int nStepping : 4;
unsigned int nModel : 4;
unsigned int nFamily : 4;
unsigned int nProcessorType : 2;
unsigned int nUnused : 2;
unsigned int nExtendedModel : 4;
unsigned int nExtendedFamily : 8;
}
cpu;
CallCPUID(1, a, c);
memcpy(&cpu, &a, sizeof(cpu));
int nFamily = cpu.nExtendedFamily + cpu.nFamily;
int nModel = cpu.nExtendedModel*16 + cpu.nModel;
// We need Intel Nehalem or AMD K10 or better for 128bit SSE2
// Nehalem = i3/i5/i7 and some Xeon
// K10 = Opterons with 4 or more cores, Phenom, Phenom II, Athlon II
// Intel Core i5 family 6, model 26 or 30
// Intel Core i7 family 6, model 26 or 30
// Intel Core i3 family 6, model 37
// AMD Phenom family 16, model 10
bool fUseSSE2 = ((fIntel && nFamily * 10000 + nModel >= 60026) ||
(fAMD && nFamily * 10000 + nModel >= 160010));
// AMD reports a lower model number in 64-bit mode
if (fAMD && sizeof(void*) > 4 && nFamily * 10000 + nModel >= 160000)
fUseSSE2 = true;
static bool fPrinted;
if (!fPrinted)
{
fPrinted = true;
printf("CPUID %08x family %d, model %d, stepping %d, fUseSSE2=%d\n", nBrand, nFamily, nModel, cpu.nStepping, fUseSSE2);
}
return fUseSSE2;
}
#else
bool Detect128BitSSE2() { return false; }
#endif
int FormatHashBlocks(void* pbuffer, unsigned int len)
{
@@ -3276,9 +3211,6 @@ unsigned int ScanHash_CryptoPP(char* pmidstate, char* pdata, char* phash1, char*
}
}
extern unsigned int ScanHash_4WaySSE2(char* pmidstate, char* pblock, char* phash1, char* phash, unsigned int& nHashesDone);
class COrphan
{
@@ -3552,9 +3484,6 @@ void BitcoinMiner()
{
printf("BitcoinMiner started\n");
SetThreadPriority(THREAD_PRIORITY_LOWEST);
bool f4WaySSE2 = Detect128BitSSE2();
if (mapArgs.count("-4way"))
f4WaySSE2 = GetBoolArg("-4way");
// Each thread has its own key and counter
CReserveKey reservekey;
@@ -3616,14 +3545,9 @@ void BitcoinMiner()
unsigned int nHashesDone = 0;
unsigned int nNonceFound;
#ifdef FOURWAYSSE2
if (f4WaySSE2)
// tcatm's 4-way 128-bit SSE2 SHA-256
nNonceFound = ScanHash_4WaySSE2(pmidstate, pdata + 64, phash1, (char*)&hash, nHashesDone);
else
#endif
// Crypto++ SHA-256
nNonceFound = ScanHash_CryptoPP(pmidstate, pdata + 64, phash1, (char*)&hash, nHashesDone);
// Crypto++ SHA-256
nNonceFound = ScanHash_CryptoPP(pmidstate, pdata + 64, phash1,
(char*)&hash, nHashesDone);
// Check if something found
if (nNonceFound != -1)