FreeRDP
TestCPUFeatures.c
1 
2 #include <winpr/crt.h>
3 #include <winpr/sysinfo.h>
4 #include <winpr/platform.h>
5 
6 #define TEST_FEATURE(feature) \
7  printf("\t" #feature ": %s\n", IsProcessorFeaturePresent(feature) ? "yes" : "no")
8 #define TEST_FEATURE_EX(feature) \
9  printf("\t" #feature ": %s\n", IsProcessorFeaturePresentEx(feature) ? "yes" : "no")
10 int TestCPUFeatures(int argc, char* argv[])
11 {
12 
13  WINPR_UNUSED(argc);
14  WINPR_UNUSED(argv);
15 
16  printf("Base CPU Flags:\n");
17 #ifdef _M_IX86_AMD64
18  TEST_FEATURE(PF_MMX_INSTRUCTIONS_AVAILABLE);
19  TEST_FEATURE(PF_XMMI_INSTRUCTIONS_AVAILABLE);
20  TEST_FEATURE(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
21  TEST_FEATURE(PF_3DNOW_INSTRUCTIONS_AVAILABLE);
22  TEST_FEATURE(PF_SSE3_INSTRUCTIONS_AVAILABLE);
23  printf("\n");
24  printf("Extended CPU Flags (not found in windows API):\n");
25  TEST_FEATURE_EX(PF_EX_3DNOW_PREFETCH);
26  TEST_FEATURE_EX(PF_EX_SSSE3);
27  TEST_FEATURE_EX(PF_EX_SSE41);
28  TEST_FEATURE_EX(PF_EX_SSE42);
29  TEST_FEATURE_EX(PF_EX_AVX);
30  TEST_FEATURE_EX(PF_EX_FMA);
31  TEST_FEATURE_EX(PF_EX_AVX_AES);
32  TEST_FEATURE_EX(PF_EX_AVX_PCLMULQDQ);
33 #elif defined(_M_ARM) || defined(_M_ARM64)
34  TEST_FEATURE(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE);
35  TEST_FEATURE(PF_ARM_THUMB);
36  TEST_FEATURE(PF_ARM_VFP_32_REGISTERS_AVAILABLE);
37  TEST_FEATURE(PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE);
38  TEST_FEATURE(PF_ARM_VFP3);
39  TEST_FEATURE(PF_ARM_THUMB);
40  TEST_FEATURE(PF_ARM_JAZELLE);
41  TEST_FEATURE(PF_ARM_DSP);
42  TEST_FEATURE(PF_ARM_THUMB2);
43  TEST_FEATURE(PF_ARM_T2EE);
44  TEST_FEATURE(PF_ARM_INTEL_WMMX);
45  printf("Extended CPU Flags (not found in windows API):\n");
46  TEST_FEATURE_EX(PF_EX_ARM_VFP1);
47  TEST_FEATURE_EX(PF_EX_ARM_VFP3D16);
48  TEST_FEATURE_EX(PF_EX_ARM_VFP4);
49  TEST_FEATURE_EX(PF_EX_ARM_IDIVA);
50  TEST_FEATURE_EX(PF_EX_ARM_IDIVT);
51 #elif defined(_M_E2K)
52  TEST_FEATURE(PF_MMX_INSTRUCTIONS_AVAILABLE);
53  TEST_FEATURE(PF_3DNOW_INSTRUCTIONS_AVAILABLE);
54  TEST_FEATURE(PF_SSE3_INSTRUCTIONS_AVAILABLE);
55  printf("\n");
56  printf("Extended CPU Flags (not found in windows API):\n");
57  TEST_FEATURE_EX(PF_EX_SSSE3);
58  TEST_FEATURE_EX(PF_EX_SSE41);
59  TEST_FEATURE_EX(PF_EX_SSE42);
60  TEST_FEATURE_EX(PF_EX_AVX);
61  TEST_FEATURE_EX(PF_EX_FMA);
62 #endif
63  printf("\n");
64  return 0;
65 }