ReactOS 0.4.15-dev-7788-g1ad9096
cpu.h File Reference
#include <string.h>
#include "mem.h"
Include dependency graph for cpu.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ZSTD_cpuid_t
 

Macros

#define X(name, r, bit)
 
#define C(name, bit)   X(name, f1c, bit)
 
#define D(name, bit)   X(name, f1d, bit)
 
#define B(name, bit)   X(name, f7b, bit)
 
#define C(name, bit)   X(name, f7c, bit)
 

Functions

MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid (void)
 
 C (sse3, 0) C(pclmuldq
 
 C (dtes64, 2) C(monitor
 
 C (dscpl, 4) C(vmx
 
 C (smx, 6) C(eist
 
 C (tm2, 8) C(ssse3
 
 C (cnxtid, 10) C(fma
 
 C (cx16, 13) C(xtpr
 
 C (pdcm, 15) C(pcid
 
 C (dca, 18) C(sse41
 
 C (sse42, 20) C(x2apic
 
 C (movbe, 22) C(popcnt
 
 C (tscdeadline, 24) C(aes
 
 C (xsave, 26) C(osxsave
 
 C (avx, 28) C(f16c
 
 C (rdrand, 30) D(fpu
 
 D (vme, 1) D(de
 
 D (pse, 3) D(tsc
 
 D (msr, 5) D(pae
 
 D (mce, 7) D(cx8
 
 D (apic, 9) D(sep
 
 D (mtrr, 12) D(pge
 
 D (mca, 14) D(cmov
 
 D (pat, 16) D(pse36
 
 D (psn, 18) D(clfsh
 
 D (ds, 21) D(acpi
 
 D (mmx, 23) D(fxsr
 
 D (sse, 25) D(sse2
 
 D (ss, 27) D(htt
 
 D (tm, 29) D(pbe
 
 B (bmi1, 3) B(hle
 
 B (avx2, 5) B(smep
 
 B (bmi2, 8) B(erms
 
 B (invpcid, 10) B(rtm
 
 B (mpx, 14) B(avx512f
 
 B (avx512dq, 17) B(rdseed
 
 B (adx, 19) B(smap
 
 B (avx512ifma, 21) B(pcommit
 
 B (clflushopt, 23) B(clwb
 
 B (avx512pf, 26) B(avx512er
 
 B (avx512cd, 28) B(sha
 
 B (avx512bw, 30) B(avx512vl
 
 C (prefetchwt1, 0) C(avx512vbmi
 

Macro Definition Documentation

◆ B

#define B (   name,
  bit 
)    X(name, f7b, bit)

Definition at line 182 of file cpu.h.

◆ C [1/2]

#define C (   name,
  bit 
)    X(name, f1c, bit)

Definition at line 208 of file cpu.h.

◆ C [2/2]

#define C (   name,
  bit 
)    X(name, f7c, bit)

Definition at line 208 of file cpu.h.

◆ D

#define D (   name,
  bit 
)    X(name, f1d, bit)

◆ X

#define X (   name,
  r,
  bit 
)
Value:
MEM_STATIC int ZSTD_cpuid_##name(ZSTD_cpuid_t const cpuid) { \
return ((cpuid.r) & (1U << bit)) != 0; \
}
#define MEM_STATIC
Definition: mem.h:39
Definition: name.c:39

Definition at line 112 of file cpu.h.

Function Documentation

◆ B() [1/12]

B ( adx  ,
19   
)

◆ B() [2/12]

B ( avx2  ,
 
)

◆ B() [3/12]

B ( avx512bw  ,
30   
)

◆ B() [4/12]

B ( avx512cd  ,
28   
)

◆ B() [5/12]

B ( avx512dq  ,
17   
)

◆ B() [6/12]

B ( avx512ifma  ,
21   
)

◆ B() [7/12]

B ( avx512pf  ,
26   
)

◆ B() [8/12]

B ( bmi1  ,
 
)

◆ B() [9/12]

B ( bmi2  ,
 
)

◆ B() [10/12]

B ( clflushopt  ,
23   
)

◆ B() [11/12]

B ( invpcid  ,
10   
)

◆ B() [12/12]

B ( mpx  ,
14   
)

◆ C() [1/16]

C ( avx  ,
28   
)

◆ C() [2/16]

C ( cnxtid  ,
10   
)

◆ C() [3/16]

C ( cx16  ,
13   
)

◆ C() [4/16]

C ( dca  ,
18   
)

◆ C() [5/16]

C ( dscpl  ,
 
)

◆ C() [6/16]

C ( dtes64  ,
 
)

◆ C() [7/16]

C ( movbe  ,
22   
)

◆ C() [8/16]

C ( pdcm  ,
15   
)

◆ C() [9/16]

C ( prefetchwt1  ,
 
)

◆ C() [10/16]

C ( rdrand  ,
30   
)

◆ C() [11/16]

C ( smx  ,
 
)

◆ C() [12/16]

C ( sse3  ,
 
)

◆ C() [13/16]

C ( sse42  ,
20   
)

◆ C() [14/16]

C ( tm2  ,
 
)

◆ C() [15/16]

C ( tscdeadline  ,
24   
)

◆ C() [16/16]

C ( xsave  ,
26   
)

◆ D() [1/14]

D ( apic  ,
 
)

◆ D() [2/14]

D ( ds  ,
21   
)

◆ D() [3/14]

D ( mca  ,
14   
)

◆ D() [4/14]

D ( mce  ,
 
)

◆ D() [5/14]

D ( mmx  ,
23   
)

◆ D() [6/14]

D ( msr  ,
 
)

◆ D() [7/14]

D ( mtrr  ,
12   
)

◆ D() [8/14]

D ( pat  ,
16   
)

◆ D() [9/14]

D ( pse  ,
 
)

◆ D() [10/14]

D ( psn  ,
18   
)

◆ D() [11/14]

D ( ss  ,
27   
)

◆ D() [12/14]

D ( sse  ,
25   
)

◆ D() [13/14]

D ( tm  ,
29   
)

◆ D() [14/14]

D ( vme  ,
 
)

◆ ZSTD_cpuid()

MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid ( void  )

Definition at line 34 of file cpu.h.

34 {
35 U32 f1c = 0;
36 U32 f1d = 0;
37 U32 f7b = 0;
38 U32 f7c = 0;
39#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
40 int reg[4];
41 __cpuid((int*)reg, 0);
42 {
43 int const n = reg[0];
44 if (n >= 1) {
45 __cpuid((int*)reg, 1);
46 f1c = (U32)reg[2];
47 f1d = (U32)reg[3];
48 }
49 if (n >= 7) {
50 __cpuidex((int*)reg, 7, 0);
51 f7b = (U32)reg[1];
52 f7c = (U32)reg[2];
53 }
54 }
55#elif defined(__i386__) && defined(__PIC__) && !defined(__clang__) && defined(__GNUC__)
56 /* The following block like the normal cpuid branch below, but gcc
57 * reserves ebx for use of its pic register so we must specially
58 * handle the save and restore to avoid clobbering the register
59 */
60 U32 n;
61 __asm__(
62 "pushl %%ebx\n\t"
63 "cpuid\n\t"
64 "popl %%ebx\n\t"
65 : "=a"(n)
66 : "a"(0)
67 : "ecx", "edx");
68 if (n >= 1) {
69 U32 f1a;
70 __asm__(
71 "pushl %%ebx\n\t"
72 "cpuid\n\t"
73 "popl %%ebx\n\t"
74 : "=a"(f1a), "=c"(f1c), "=d"(f1d)
75 : "a"(1));
76 }
77 if (n >= 7) {
78 __asm__(
79 "pushl %%ebx\n\t"
80 "cpuid\n\t"
81 "movl %%ebx, %%eax\n\t"
82 "popl %%ebx"
83 : "=a"(f7b), "=c"(f7c)
84 : "a"(7), "c"(0)
85 : "edx");
86 }
87#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__)
88 U32 n;
89 __asm__("cpuid" : "=a"(n) : "a"(0) : "ebx", "ecx", "edx");
90 if (n >= 1) {
91 U32 f1a;
92 __asm__("cpuid" : "=a"(f1a), "=c"(f1c), "=d"(f1d) : "a"(1) : "ebx");
93 }
94 if (n >= 7) {
95 U32 f7a;
96 __asm__("cpuid"
97 : "=a"(f7a), "=b"(f7b), "=c"(f7c)
98 : "a"(7), "c"(0)
99 : "edx");
100 }
101#endif
102 {
103 ZSTD_cpuid_t cpuid;
104 cpuid.f1c = f1c;
105 cpuid.f1d = f1d;
106 cpuid.f7b = f7b;
107 cpuid.f7c = f7c;
108 return cpuid;
109 }
110}
GLdouble n
Definition: glext.h:7729
static int reg
Definition: i386-dis.c:1290
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
Definition: intrin_ppc.h:682
__INTRIN_INLINE void __cpuidex(int CPUInfo[4], int InfoType, int ECXValue)
Definition: intrin_x86.h:1649
int f1c(const S1 &)
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tmov %rdx, %rbp\n" "\tjmp *%rax\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
U32 f1d
Definition: cpu.h:29
U32 f1c
Definition: cpu.h:28
U32 f7c
Definition: cpu.h:31
U32 f7b
Definition: cpu.h:30
unsigned int U32
Definition: xxhash.c:195

Referenced by ZSTD_initCCtx(), ZSTD_initDCtx_internal(), and ZSTD_initStaticCCtx().