RetroArch
cpu.h
Go to the documentation of this file.
1 /* libFLAC - Free Lossless Audio Codec library
2  * Copyright (C) 2001-2009 Josh Coalson
3  * Copyright (C) 2011-2016 Xiph.Org Foundation
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * - Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * - Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * - Neither the name of the Xiph.org Foundation nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef FLAC__PRIVATE__CPU_H
34 #define FLAC__PRIVATE__CPU_H
35 
36 #include "../FLAC/ordinals.h"
37 
38 #ifdef HAVE_CONFIG_H
39 #include <config.h>
40 #endif
41 
42 #ifndef FLAC__CPU_X86_64
43 
44 #if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
45 #define FLAC__CPU_X86_64
46 #endif
47 
48 #endif
49 
50 #ifndef FLAC__CPU_IA32
51 
52 #if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)
53 #define FLAC__CPU_IA32
54 #endif
55 
56 #endif
57 
58 
59 #if FLAC__HAS_X86INTRIN
60 /* SSE intrinsics support by ICC/MSVC/GCC */
61 #if defined __INTEL_COMPILER
62  #define FLAC__SSE_TARGET(x)
63  #define FLAC__SSE_SUPPORTED 1
64  #define FLAC__SSE2_SUPPORTED 1
65  #if (__INTEL_COMPILER >= 1000) /* Intel C++ Compiler 10.0 */
66  #define FLAC__SSSE3_SUPPORTED 1
67  #define FLAC__SSE4_1_SUPPORTED 1
68  #endif
69  #if (__INTEL_COMPILER >= 1110) /* Intel C++ Compiler 11.1 */
70  #define FLAC__AVX_SUPPORTED 1
71  #endif
72  #if (__INTEL_COMPILER >= 1300) /* Intel C++ Compiler 13.0 */
73  #define FLAC__AVX2_SUPPORTED 1
74  #define FLAC__FMA_SUPPORTED 1
75  #endif
76 #elif defined _MSC_VER
77  #define FLAC__SSE_TARGET(x)
78  #define FLAC__SSE_SUPPORTED 1
79  #define FLAC__SSE2_SUPPORTED 1
80  #if (_MSC_VER >= 1500) /* MS Visual Studio 2008 */
81  #define FLAC__SSSE3_SUPPORTED 1
82  #define FLAC__SSE4_1_SUPPORTED 1
83  #endif
84  #if (_MSC_FULL_VER >= 160040219) /* MS Visual Studio 2010 SP1 */
85  #define FLAC__AVX_SUPPORTED 1
86  #endif
87  #if (_MSC_VER >= 1700) /* MS Visual Studio 2012 */
88  #define FLAC__AVX2_SUPPORTED 1
89  #define FLAC__FMA_SUPPORTED 1
90  #endif
91 #elif defined __GNUC__
92  #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) /* since GCC 4.9 -msse.. compiler options aren't necessary */
93  #define FLAC__SSE_TARGET(x) __attribute__ ((__target__ (x)))
94  #define FLAC__SSE_SUPPORTED 1
95  #define FLAC__SSE2_SUPPORTED 1
96  #define FLAC__SSSE3_SUPPORTED 1
97  #define FLAC__SSE4_1_SUPPORTED 1
98 #ifdef FLAC__USE_AVX
99  #define FLAC__AVX_SUPPORTED 1
100  #define FLAC__AVX2_SUPPORTED 1
101  #define FLAC__FMA_SUPPORTED 1
102 #endif
103  #else /* for GCC older than 4.9 */
104  #define FLAC__SSE_TARGET(x)
105  #ifdef __SSE__
106  #define FLAC__SSE_SUPPORTED 1
107  #endif
108  #ifdef __SSE2__
109  #define FLAC__SSE2_SUPPORTED 1
110  #endif
111  #ifdef __SSSE3__
112  #define FLAC__SSSE3_SUPPORTED 1
113  #endif
114  #ifdef __SSE4_1__
115  #define FLAC__SSE4_1_SUPPORTED 1
116  #endif
117  #ifdef __AVX__
118  #define FLAC__AVX_SUPPORTED 1
119  #endif
120  #ifdef __AVX2__
121  #define FLAC__AVX2_SUPPORTED 1
122  #endif
123  #ifdef __FMA__
124  #define FLAC__FMA_SUPPORTED 1
125  #endif
126  #endif /* GCC version */
127 #endif /* compiler version */
128 #endif /* intrinsics support */
129 
130 
131 #ifndef FLAC__AVX_SUPPORTED
132 #define FLAC__AVX_SUPPORTED 0
133 #endif
134 
135 typedef enum {
140 
141 typedef struct {
143 
148 
157 
158 typedef struct {
160 
169 
170 
171 typedef struct {
176 } FLAC__CPUInfo;
177 
179 
181 
182 void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx);
183 
185 
186 #endif
FLAC__bool sse41
Definition: cpu.h:163
Definition: cpu.h:136
FLAC__bool ssse3
Definition: cpu.h:162
FLAC__bool mmx
Definition: cpu.h:145
FLAC__bool ssse3
Definition: cpu.h:150
FLAC__bool sse41
Definition: cpu.h:151
FLAC__bool avx
Definition: cpu.h:165
FLAC__bool sse3
Definition: cpu.h:149
FLAC__bool avx2
Definition: cpu.h:166
FLAC__CPUInfo_Type type
Definition: cpu.h:173
FLAC__bool intel
Definition: cpu.h:142
GLint level
Definition: glext.h:6293
FLAC__CPUInfo_IA32 ia32
Definition: cpu.h:174
FLAC__bool use_asm
Definition: cpu.h:172
FLAC__uint32 FLAC__cpu_have_cpuid_asm_ia32(void)
Definition: cpu.h:138
FLAC__CPUInfo_x86 x86
Definition: cpu.h:175
void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx)
Definition: cpu.h:141
FLAC__bool sse
Definition: cpu.h:146
int FLAC__bool
Definition: ordinals.h:70
void FLAC__cpu_info_x86(FLAC__uint32 level, FLAC__uint32 *eax, FLAC__uint32 *ebx, FLAC__uint32 *ecx, FLAC__uint32 *edx)
Configuration options (set of defines)
FLAC__bool sse3
Definition: cpu.h:161
Definition: cpu.h:137
Definition: cpu.h:171
FLAC__bool intel
Definition: cpu.h:159
FLAC__bool cmov
Definition: cpu.h:144
Definition: libretro.h:2275
FLAC__bool sse2
Definition: cpu.h:147
Definition: cpu.h:158
FLAC__bool avx
Definition: cpu.h:153
FLAC__bool avx2
Definition: cpu.h:154
uint32_t FLAC__uint32
Definition: ordinals.h:65
void FLAC__cpu_info(FLAC__CPUInfo *info)
Definition: cpu.c:235
FLAC__bool sse42
Definition: cpu.h:152
FLAC__bool fma
Definition: cpu.h:155
FLAC__bool sse42
Definition: cpu.h:164
FLAC__bool fma
Definition: cpu.h:167
FLAC__CPUInfo_Type
Definition: cpu.h:135