ReactOS 0.4.16-dev-297-gc569aee
getcpuflags.h
Go to the documentation of this file.
1/*
2 getcpucpuflags: get cpuflags for ia32
3
4 copyright ?-2007 by the mpg123 project - free software under the terms of the LGPL 2.1
5 see COPYING and AUTHORS files in distribution or http:#mpg123.org
6 initially written by KIMURA Takuhiro (for 3DNow!)
7 extended for general use by Thomas Orgis
8*/
9
10#ifndef MPG123_H_GETCPUFLAGS
11#define MPG123_H_GETCPUFLAGS
12
13/* standard level flags part 1 (ECX)*/
14#define FLAG_SSE3 0x00000001
15#define FLAG_SSSE3 0x00000200
16#define FLAG_AVX 0x1C000000
17/* standard level flags part 2 (EDX) */
18#define FLAG2_MMX 0x00800000
19#define FLAG2_SSE 0x02000000
20#define FLAG2_SSE2 0x04000000
21#define FLAG2_FPU 0x00000001
22/* cpuid extended level 1 (AMD) */
23#define XFLAG_MMX 0x00800000
24#define XFLAG_3DNOW 0x80000000
25#define XFLAG_3DNOWEXT 0x40000000
26/* eXtended Control Register 0 */
27#define XCR0FLAG_AVX 0x00000006
28
29
31{
32#if defined(OPT_ARM) || defined(OPT_NEON) || defined(OPT_NEON64)
33 unsigned int has_neon;
34#else
35 unsigned int id;
36 unsigned int std;
37 unsigned int std2;
38 unsigned int ext;
39 unsigned int xcr0_lo;
40#endif
41};
42
43unsigned int getcpuflags(struct cpuflags* cf);
44
45/* checks the family */
46#define cpu_i586(s) ( ((s.id & 0xf00)>>8) == 0 || ((s.id & 0xf00)>>8) > 4 )
47/* checking some flags... */
48#define cpu_fpu(s) (FLAG2_FPU & s.std2)
49#define cpu_mmx(s) (FLAG2_MMX & s.std2 || XFLAG_MMX & s.ext)
50#define cpu_3dnow(s) (XFLAG_3DNOW & s.ext)
51#define cpu_3dnowext(s) (XFLAG_3DNOWEXT & s.ext)
52#define cpu_sse(s) (FLAG2_SSE & s.std2)
53#define cpu_sse2(s) (FLAG2_SSE2 & s.std2)
54#define cpu_sse3(s) (FLAG_SSE3 & s.std)
55#define cpu_avx(s) ((FLAG_AVX & s.std) == FLAG_AVX && (XCR0FLAG_AVX & s.xcr0_lo) == XCR0FLAG_AVX)
56#define cpu_fast_sse(s) ((((s.id & 0xf00)>>8) == 6 && FLAG_SSSE3 & s.std) /* for Intel/VIA; family 6 CPUs with SSSE3 */ || \
57 (((s.id & 0xf00)>>8) == 0xf && (((s.id & 0x0ff00000)>>20) > 0 && ((s.id & 0x0ff00000)>>20) != 5))) /* for AMD; family > 0xF CPUs except Bobcat */
58#define cpu_neon(s) (s.has_neon)
59
60#endif
#define getcpuflags
Definition: intsym.h:206
unsigned int std2
Definition: getcpuflags.h:37
unsigned int std
Definition: getcpuflags.h:36
unsigned int xcr0_lo
Definition: getcpuflags.h:39
unsigned int ext
Definition: getcpuflags.h:38
unsigned int id
Definition: getcpuflags.h:35