add -cpuid to test_util

This commit is contained in:
MITSUNARI Shigeo 2022-05-26 18:09:03 +09:00
parent cf7cb744c8
commit 66d62968d4

View file

@ -13,7 +13,7 @@ struct PopCountTest : public Xbyak::CodeGenerator {
}
};
void putCPUinfo()
void putCPUinfo(bool onlyCpuidFeature)
{
using namespace Xbyak::util;
Cpu cpu;
@ -94,6 +94,7 @@ void putCPUinfo()
if (cpu.has(tbl[i].type)) printf(" %s", tbl[i].str);
}
printf("\n");
if (onlyCpuidFeature) return;
if (cpu.has(Cpu::tPOPCNT)) {
const int n = 0x12345678; // bitcount = 13
const int ok = 13;
@ -127,12 +128,15 @@ void putCPUinfo()
printf("CoreLevel=%u\n", cpu.getNumCores(Xbyak::util::CoreLevel));
}
int main()
int main(int argc, char *argv[])
{
bool onlyCpuidFeature = argc == 2 && strcmp(argv[1], "-cpuid") == 0;
if (!onlyCpuidFeature) {
#ifdef XBYAK32
puts("32bit");
#else
puts("64bit");
#endif
putCPUinfo();
}
putCPUinfo(onlyCpuidFeature);
}