add detection of VEX-encoded GRP instructions(group1, group2, lzcnt)

This commit is contained in:
MITSUNARI Shigeo 2013-05-30 17:03:40 +09:00
parent 9099a8aa6f
commit 362d379b3d
2 changed files with 11 additions and 2 deletions

View file

@ -43,6 +43,9 @@ void putCPUinfo()
{ Cpu::tAVX, "avx" },
{ Cpu::tFMA, "fma" },
{ Cpu::tAVX2, "avx2" },
{ Cpu::tGPR1, "gpr-group1" },
{ Cpu::tGPR2, "gpr-group2" },
{ Cpu::tLZCNT, "lzcnt" },
};
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
if (cpu.has(tbl[i].type)) printf(" %s", tbl[i].str);

View file

@ -148,6 +148,9 @@ public:
tSSE4a = 1 << 18,
tRDTSCP = 1 << 19,
tAVX2 = 1 << 20,
tGPR1 = 1 << 21, // andn, bextr, blsi, blsmk, blsr, tzcnt
tGPR2 = 1 << 22, // bzhi, mulx, pdep, pext, rorx, sarx, shlx, shrx
tLZCNT = 1 << 23,
tINTEL = 1 << 24,
tAMD = 1 << 25
@ -172,6 +175,7 @@ public:
type_ |= tINTEL;
getCpuid(0x80000001, data);
if (data[3] & (1U << 27)) type_ |= tRDTSCP;
if (data[2] & (1U << 5)) type_ |= tLZCNT;
}
getCpuid(1, data);
if (data[2] & (1U << 0)) type_ |= tSSE3;
@ -194,10 +198,12 @@ public:
if ((bv & 6) == 6) {
if (data[2] & (1U << 28)) type_ |= tAVX;
if (data[2] & (1U << 12)) type_ |= tFMA;
getCpuidEx(7, 0, data);
if (data[1] & 0x20) type_ |= tAVX2;
}
}
getCpuidEx(7, 0, data);
if (type_ & tAVX && data[1] & 0x20) type_ |= tAVX2;
if (data[1] & (1U << 3)) type_ |= tGPR1;
if (data[1] & (1U << 8)) type_ |= tGPR2;
setFamily();
}
void putFamily()