include/SDL_cpuinfo.h
author Ryan C. Gordon <icculus@icculus.org>
Sat, 15 Sep 2012 10:59:39 -0400
changeset 6430 48d519500f7e
parent 6138 4c64952a58fb
child 6885 700f1b25f77f
child 8320 e9db1532c340
permissions -rw-r--r--
Removed Windows CE support from SDL 2.0.

It's a long-dead platform, and we don't have any way to build for, test, or
maintain it, so there's no sense in doing acrobatics to support it.

If you need Windows CE support, use SDL 1.2. If you need Windows Phone support,
send SDL 2.0 patches for the newer Windows Mobile platform.
slouken@739
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6138
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
slouken@739
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@739
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@739
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@739
    20
*/
slouken@739
    21
slouken@1895
    22
/**
slouken@3407
    23
 *  \file SDL_cpuinfo.h
slouken@3407
    24
 *  
slouken@3407
    25
 *  CPU feature detection for SDL.
slouken@1895
    26
 */
slouken@739
    27
slouken@739
    28
#ifndef _SDL_cpuinfo_h
slouken@739
    29
#define _SDL_cpuinfo_h
slouken@739
    30
slouken@1402
    31
#include "SDL_stdinc.h"
slouken@1402
    32
slouken@5389
    33
/* Need to do this here because intrin.h has C++ code in it */
slouken@5389
    34
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
icculus@6430
    35
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
slouken@5389
    36
#include <intrin.h>
slouken@5450
    37
#ifndef _WIN64
slouken@5389
    38
#define __MMX__
slouken@5389
    39
#define __3dNOW__
slouken@5450
    40
#endif
slouken@5389
    41
#define __SSE__
slouken@5389
    42
#define __SSE2__
slouken@5389
    43
#elif defined(__MINGW64_VERSION_MAJOR)
slouken@5389
    44
#include <intrin.h>
slouken@5389
    45
#else
slouken@5390
    46
#ifdef __ALTIVEC__
slouken@5390
    47
#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__)
slouken@5390
    48
#include <altivec.h>
slouken@5390
    49
#undef pixel
slouken@5390
    50
#endif
slouken@5390
    51
#endif
slouken@5389
    52
#ifdef __MMX__
slouken@5389
    53
#include <mmintrin.h>
slouken@5389
    54
#endif
slouken@5389
    55
#ifdef __3dNOW__
slouken@5389
    56
#include <mm3dnow.h>
slouken@5389
    57
#endif
slouken@5389
    58
#ifdef __SSE__
slouken@5389
    59
#include <xmmintrin.h>
slouken@5389
    60
#endif
slouken@5389
    61
#ifdef __SSE2__
slouken@5389
    62
#include <emmintrin.h>
slouken@5389
    63
#endif
slouken@5389
    64
#endif
slouken@5389
    65
slouken@739
    66
#include "begin_code.h"
slouken@739
    67
/* Set up for C function definitions, even when using C++ */
slouken@739
    68
#ifdef __cplusplus
slouken@1895
    69
/* *INDENT-OFF* */
slouken@739
    70
extern "C" {
slouken@1895
    71
/* *INDENT-ON* */
slouken@739
    72
#endif
slouken@739
    73
slouken@5116
    74
/* This is a guess for the cacheline size used for padding.
slouken@5116
    75
 * Most x86 processors have a 64 byte cache line.
slouken@5116
    76
 * The 64-bit PowerPC processors have a 128 byte cache line.
slouken@5116
    77
 * We'll use the larger value to be generally safe.
slouken@5115
    78
 */
slouken@5116
    79
#define SDL_CACHELINE_SIZE  128
slouken@5115
    80
slouken@3407
    81
/**
slouken@3579
    82
 *  This function returns the number of CPU cores available.
slouken@3579
    83
 */
slouken@3579
    84
extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
slouken@3579
    85
slouken@3579
    86
/**
slouken@5120
    87
 *  This function returns the L1 cache line size of the CPU
slouken@5120
    88
 *
slouken@5120
    89
 *  This is useful for determining multi-threaded structure padding
slouken@5120
    90
 *  or SIMD prefetch sizes.
slouken@5120
    91
 */
slouken@5120
    92
extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
slouken@5120
    93
slouken@5120
    94
/**
slouken@3407
    95
 *  This function returns true if the CPU has the RDTSC instruction.
slouken@745
    96
 */
slouken@1426
    97
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
slouken@745
    98
slouken@3407
    99
/**
slouken@5389
   100
 *  This function returns true if the CPU has AltiVec features.
slouken@5389
   101
 */
slouken@5389
   102
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
slouken@5389
   103
slouken@5389
   104
/**
slouken@3407
   105
 *  This function returns true if the CPU has MMX features.
slouken@739
   106
 */
slouken@1426
   107
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
slouken@739
   108
slouken@3407
   109
/**
slouken@5389
   110
 *  This function returns true if the CPU has 3DNow! features.
slouken@5389
   111
 */
slouken@5389
   112
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
slouken@5389
   113
slouken@5389
   114
/**
slouken@3407
   115
 *  This function returns true if the CPU has SSE features.
slouken@739
   116
 */
slouken@1426
   117
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
slouken@739
   118
slouken@3407
   119
/**
slouken@3407
   120
 *  This function returns true if the CPU has SSE2 features.
slouken@785
   121
 */
slouken@1426
   122
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
slouken@785
   123
slouken@3407
   124
/**
slouken@5259
   125
 *  This function returns true if the CPU has SSE3 features.
slouken@778
   126
 */
slouken@5259
   127
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
slouken@5259
   128
slouken@5259
   129
/**
slouken@5263
   130
 *  This function returns true if the CPU has SSE4.1 features.
slouken@5259
   131
 */
slouken@5263
   132
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
slouken@5263
   133
slouken@5263
   134
/**
slouken@5263
   135
 *  This function returns true if the CPU has SSE4.2 features.
slouken@5263
   136
 */
slouken@5263
   137
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
slouken@5259
   138
slouken@778
   139
slouken@739
   140
/* Ends C function definitions when using C++ */
slouken@739
   141
#ifdef __cplusplus
slouken@1895
   142
/* *INDENT-OFF* */
slouken@739
   143
}
slouken@1895
   144
/* *INDENT-ON* */
slouken@739
   145
#endif
slouken@739
   146
#include "close_code.h"
slouken@739
   147
slouken@739
   148
#endif /* _SDL_cpuinfo_h */
slouken@1895
   149
slouken@1895
   150
/* vi: set ts=4 sw=4 expandtab: */