Enable RDSEED and SHA for AMD processors
AMD donated a AMD Ryzen 7 1700X to the GCC Compile Farm. We were able to verify compatibility and correctness. Many thanks to AMD for the donationpull/242/merge
parent
5fd202077c
commit
2f58912fdd
11
cpu.cpp
11
cpu.cpp
|
|
@ -267,10 +267,21 @@ void DetectX86Features()
|
||||||
else if (IsAMD(cpuid1))
|
else if (IsAMD(cpuid1))
|
||||||
{
|
{
|
||||||
static const unsigned int RDRAND_FLAG = (1 << 30);
|
static const unsigned int RDRAND_FLAG = (1 << 30);
|
||||||
|
static const unsigned int RDSEED_FLAG = (1 << 18);
|
||||||
|
static const unsigned int SHA_FLAG = (1 << 29);
|
||||||
|
|
||||||
CpuId(0x01, cpuid1);
|
CpuId(0x01, cpuid1);
|
||||||
g_hasRDRAND = !!(cpuid1[2] /*ECX*/ & RDRAND_FLAG);
|
g_hasRDRAND = !!(cpuid1[2] /*ECX*/ & RDRAND_FLAG);
|
||||||
|
|
||||||
|
if (cpuid1[0] /*EAX*/ >= 7)
|
||||||
|
{
|
||||||
|
if (CpuId(7, cpuid3))
|
||||||
|
{
|
||||||
|
g_hasRDSEED = !!(cpuid3[1] /*EBX*/ & RDSEED_FLAG);
|
||||||
|
g_hasSHA = !!(cpuid3[1] /*EBX*/ & SHA_FLAG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CpuId(0x80000005, cpuid1);
|
CpuId(0x80000005, cpuid1);
|
||||||
g_cacheLineSize = GETBYTE(cpuid1[2], 0);
|
g_cacheLineSize = GETBYTE(cpuid1[2], 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue