summaryrefslogtreecommitdiffstats
path: root/winpr/libwinpr/sysinfo/test/TestCPUFeatures.c
blob: 8a596dd32c3ae2831539d1664e3f3f16077d924b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <winpr/crt.h>
#include <winpr/sysinfo.h>
#include <winpr/platform.h>

#define TEST_FEATURE(feature) \
	printf("\t" #feature ":  %s\n", IsProcessorFeaturePresent(feature) ? "yes" : "no")
#define TEST_FEATURE_EX(feature) \
	printf("\t" #feature ":  %s\n", IsProcessorFeaturePresentEx(feature) ? "yes" : "no")
int TestCPUFeatures(int argc, char* argv[])
{

	WINPR_UNUSED(argc);
	WINPR_UNUSED(argv);

	printf("Base CPU Flags:\n");
#ifdef _M_IX86_AMD64
	TEST_FEATURE(PF_MMX_INSTRUCTIONS_AVAILABLE);
	TEST_FEATURE(PF_XMMI_INSTRUCTIONS_AVAILABLE);
	TEST_FEATURE(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
	TEST_FEATURE(PF_3DNOW_INSTRUCTIONS_AVAILABLE);
	TEST_FEATURE(PF_SSE3_INSTRUCTIONS_AVAILABLE);
	printf("\n");
	printf("Extended CPU Flags (not found in windows API):\n");
	TEST_FEATURE_EX(PF_EX_3DNOW_PREFETCH);
	TEST_FEATURE_EX(PF_EX_SSSE3);
	TEST_FEATURE_EX(PF_EX_SSE41);
	TEST_FEATURE_EX(PF_EX_SSE42);
	TEST_FEATURE_EX(PF_EX_AVX);
	TEST_FEATURE_EX(PF_EX_FMA);
	TEST_FEATURE_EX(PF_EX_AVX_AES);
	TEST_FEATURE_EX(PF_EX_AVX_PCLMULQDQ);
#elif defined(_M_ARM)
	TEST_FEATURE(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE);
	TEST_FEATURE(PF_ARM_THUMB);
	TEST_FEATURE(PF_ARM_VFP_32_REGISTERS_AVAILABLE);
	TEST_FEATURE(PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE);
	TEST_FEATURE(PF_ARM_VFP3);
	TEST_FEATURE(PF_ARM_THUMB);
	TEST_FEATURE(PF_ARM_JAZELLE);
	TEST_FEATURE(PF_ARM_DSP);
	TEST_FEATURE(PF_ARM_THUMB2);
	TEST_FEATURE(PF_ARM_T2EE);
	TEST_FEATURE(PF_ARM_INTEL_WMMX);
	printf("Extended CPU Flags (not found in windows API):\n");
	TEST_FEATURE_EX(PF_EX_ARM_VFP1);
	TEST_FEATURE_EX(PF_EX_ARM_VFP3D16);
	TEST_FEATURE_EX(PF_EX_ARM_VFP4);
	TEST_FEATURE_EX(PF_EX_ARM_IDIVA);
	TEST_FEATURE_EX(PF_EX_ARM_IDIVT);
#elif defined(_M_E2K)
	TEST_FEATURE(PF_MMX_INSTRUCTIONS_AVAILABLE);
	TEST_FEATURE(PF_3DNOW_INSTRUCTIONS_AVAILABLE);
	TEST_FEATURE(PF_SSE3_INSTRUCTIONS_AVAILABLE);
	printf("\n");
	printf("Extended CPU Flags (not found in windows API):\n");
	TEST_FEATURE_EX(PF_EX_SSSE3);
	TEST_FEATURE_EX(PF_EX_SSE41);
	TEST_FEATURE_EX(PF_EX_SSE42);
	TEST_FEATURE_EX(PF_EX_AVX);
	TEST_FEATURE_EX(PF_EX_FMA);
#endif
	printf("\n");
	return 0;
}