diff options
author | MITSUNARI Shigeo <[email protected]> | 2022-05-26 18:09:03 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2022-05-26 18:09:03 +0900 |
commit | 66d62968d4c7b647d15084d58f16beda634005a0 (patch) | |
tree | 05b7052e621b67b1b19b37e50ac01808246fb8c1 | |
parent | cf7cb744c89f929a42ab395819de42d686819007 (diff) | |
download | xbyak-66d62968d4c7b647d15084d58f16beda634005a0.tar.gz xbyak-66d62968d4c7b647d15084d58f16beda634005a0.zip |
add -cpuid to test_util
-rw-r--r-- | sample/test_util.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sample/test_util.cpp b/sample/test_util.cpp index 0e9387e..2488ce1 100644 --- a/sample/test_util.cpp +++ b/sample/test_util.cpp @@ -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"); + puts("32bit"); #else - puts("64bit"); + puts("64bit"); #endif - putCPUinfo(); + } + putCPUinfo(onlyCpuidFeature); } |