zenilib: zenilib/jni/external/sdl/src/cpuinfo/SDL_cpuinfo.c File Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Macros | Functions | Variables
SDL_cpuinfo.c File Reference
`#include "SDL_config.h"`
`#include "SDL_cpuinfo.h"`

Go to the source code of this file.

## Macros

#define | CPU_HAS_3DNOW 0x00000008
#define | CPU_HAS_ALTIVEC 0x00000002
#define | CPU_HAS_MMX 0x00000004
#define | CPU_HAS_RDTSC 0x00000001
#define | CPU_HAS_SSE 0x00000010
#define | CPU_HAS_SSE2 0x00000020
#define | CPU_HAS_SSE3 0x00000040
#define | CPU_HAS_SSE41 0x00000100
#define | CPU_HAS_SSE42 0x00000200
#define | cpuid(func, a, b, c, d) a = b = c = d = 0

## Functions

static __inline__ int | CPU_getCPUIDFeatures (void)
static __inline__ int | CPU_have3DNow (void)
static __inline__ int | CPU_haveAltiVec (void)
static __inline__ int | CPU_haveCPUID (void)
static __inline__ int | CPU_haveMMX (void)
static __inline__ int | CPU_haveRDTSC (void)
static __inline__ int | CPU_haveSSE (void)
static __inline__ int | CPU_haveSSE2 (void)
static __inline__ int | CPU_haveSSE3 (void)
static __inline__ int | CPU_haveSSE41 (void)
static __inline__ int | CPU_haveSSE42 (void)
int | SDL_GetCPUCacheLineSize (void)
int | SDL_GetCPUCount (void)
static Uint32 | SDL_GetCPUFeatures (void)
static const char * | SDL_GetCPUType (void)
SDL_bool | SDL_Has3DNow (void)
SDL_bool | SDL_HasAltiVec (void)
SDL_bool | SDL_HasMMX (void)
SDL_bool | SDL_HasRDTSC (void)
SDL_bool | SDL_HasSSE (void)
SDL_bool | SDL_HasSSE2 (void)
SDL_bool | SDL_HasSSE3 (void)
SDL_bool | SDL_HasSSE41 (void)
SDL_bool | SDL_HasSSE42 (void)

## Variables

static int | SDL_CPUCount = 0
static Uint32 | SDL_CPUFeatures = 0xFFFFFFFF

## Macro Definition Documentation

#define CPU_HAS_3DNOW 0x00000008

Definition at line 51 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_Has3DNow().

#define CPU_HAS_ALTIVEC 0x00000002

Definition at line 49 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasAltiVec().

#define CPU_HAS_MMX 0x00000004

Definition at line 50 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasMMX().

#define CPU_HAS_RDTSC 0x00000001

Definition at line 48 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasRDTSC().

#define CPU_HAS_SSE 0x00000010

Definition at line 52 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE().

#define CPU_HAS_SSE2 0x00000020

Definition at line 53 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE2().

#define CPU_HAS_SSE3 0x00000040

Definition at line 54 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE3().

#define CPU_HAS_SSE41 0x00000100

Definition at line 55 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE41().

#define CPU_HAS_SSE42 0x00000200

Definition at line 56 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE42().

#define cpuid | ( |  | func,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  | a = b = c = d = 0

Definition at line 190 of file SDL_cpuinfo.c.

Referenced by CPU_getCPUIDFeatures(), CPU_have3DNow(), CPU_haveSSE3(), CPU_haveSSE41(), CPU_haveSSE42(), SDL_GetCPUCacheLineSize(), and SDL_GetCPUType().

## Function Documentation

static __inline__ int CPU_getCPUIDFeatures | ( | void |  | ) |

static

Definition at line 195 of file SDL_cpuinfo.c.

References cpuid, and d.

Referenced by CPU_haveMMX(), CPU_haveRDTSC(), CPU_haveSSE(), and CPU_haveSSE2().

static __inline__ int CPU_have3DNow | ( | void |  | ) |

static

Definition at line 254 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

static __inline__ int CPU_haveAltiVec | ( | void |  | ) |

static

Definition at line 218 of file SDL_cpuinfo.c.

References error, and NULL.

Referenced by SDL_GetCPUFeatures().

static __inline__ int CPU_haveCPUID | ( | void |  | ) |

static

Definition at line 71 of file SDL_cpuinfo.c.

References jz, and pop.

Referenced by CPU_have3DNow(), CPU_haveMMX(), CPU_haveRDTSC(), CPU_haveSSE(), CPU_haveSSE2(), CPU_haveSSE3(), CPU_haveSSE41(), CPU_haveSSE42(), and SDL_GetCPUType().

static __inline__ int CPU_haveMMX | ( | void |  | ) |

static

Definition at line 245 of file SDL_cpuinfo.c.

References CPU_getCPUIDFeatures(), and CPU_haveCPUID().

Referenced by SDL_GetCPUFeatures().

static __inline__ int CPU_haveRDTSC | ( | void |  | ) |

static

Definition at line 209 of file SDL_cpuinfo.c.

References CPU_getCPUIDFeatures(), and CPU_haveCPUID().

Referenced by SDL_GetCPUFeatures().

static __inline__ int CPU_haveSSE | ( | void |  | ) |

static

Definition at line 269 of file SDL_cpuinfo.c.

References CPU_getCPUIDFeatures(), and CPU_haveCPUID().

Referenced by SDL_GetCPUFeatures().

static __inline__ int CPU_haveSSE2 | ( | void |  | ) |

static

Definition at line 278 of file SDL_cpuinfo.c.

References CPU_getCPUIDFeatures(), and CPU_haveCPUID().

Referenced by SDL_GetCPUFeatures().

static __inline__ int CPU_haveSSE3 | ( | void |  | ) |

static

Definition at line 287 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

static __inline__ int CPU_haveSSE41 | ( | void |  | ) |

static

Definition at line 302 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

static __inline__ int CPU_haveSSE42 | ( | void |  | ) |

static

Definition at line 317 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

int SDL_GetCPUCacheLineSize | ( | void |  | ) |

This function returns the L1 cache line size of the CPU

This is useful for determining multi-threaded structure padding or SIMD prefetch sizes.

Definition at line 471 of file SDL_cpuinfo.c.

References cpuid, d, SDL_CACHELINE_SIZE, SDL_GetCPUType(), and SDL_strcmp().

int SDL_GetCPUCount | ( | void |  | ) |

This function returns the number of CPU cores available.

Definition at line 334 of file SDL_cpuinfo.c.

References int, NULL, and SDL_CPUCount.

static Uint32 SDL_GetCPUFeatures | ( | void |  | ) |

static

Definition at line 494 of file SDL_cpuinfo.c.

References CPU_HAS_3DNOW, CPU_HAS_ALTIVEC, CPU_HAS_MMX, CPU_HAS_RDTSC, CPU_HAS_SSE, CPU_HAS_SSE2, CPU_HAS_SSE3, CPU_HAS_SSE41, CPU_HAS_SSE42, CPU_have3DNow(), CPU_haveAltiVec(), CPU_haveMMX(), CPU_haveRDTSC(), CPU_haveSSE(), CPU_haveSSE2(), CPU_haveSSE3(), CPU_haveSSE41(), CPU_haveSSE42(), and SDL_CPUFeatures.

Referenced by SDL_Has3DNow(), SDL_HasAltiVec(), SDL_HasMMX(), SDL_HasRDTSC(), SDL_HasSSE(), SDL_HasSSE2(), SDL_HasSSE3(), SDL_HasSSE41(), and SDL_HasSSE42().

static const char* SDL_GetCPUType | ( | void |  | ) |

static

Definition at line 365 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, d, i, and SDL_strlcpy().

Referenced by SDL_GetCPUCacheLineSize().

SDL_bool SDL_Has3DNow | ( | void |  | ) |

This function returns true if the CPU has 3DNow! features.

Definition at line 557 of file SDL_cpuinfo.c.

References CPU_HAS_3DNOW, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_CalculateBlitA(), and SDL_ChooseBlitFunc().

SDL_bool SDL_HasAltiVec | ( | void |  | ) |

This function returns true if the CPU has AltiVec features.

Definition at line 539 of file SDL_cpuinfo.c.

References CPU_HAS_ALTIVEC, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_CalculateBlitN(), and SDL_ChooseBlitFunc().

SDL_bool SDL_HasMMX | ( | void |  | ) |

This function returns true if the CPU has MMX features.

Definition at line 548 of file SDL_cpuinfo.c.

References CPU_HAS_MMX, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_BlitCopy(), SDL_CalculateBlitA(), SDL_ChooseBlitFunc(), SDL_FillRect(), and SDL_SW_SetupYUVDisplay().

SDL_bool SDL_HasRDTSC | ( | void |  | ) |

This function returns true if the CPU has the RDTSC instruction.

Definition at line 530 of file SDL_cpuinfo.c.

References CPU_HAS_RDTSC, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

SDL_bool SDL_HasSSE | ( | void |  | ) |

This function returns true if the CPU has SSE features.

Definition at line 566 of file SDL_cpuinfo.c.

References CPU_HAS_SSE, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_BlitCopy(), SDL_ChooseBlitFunc(), and SDL_FillRect().

SDL_bool SDL_HasSSE2 | ( | void |  | ) |

This function returns true if the CPU has SSE2 features.

Definition at line 575 of file SDL_cpuinfo.c.

References CPU_HAS_SSE2, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_ChooseBlitFunc().

SDL_bool SDL_HasSSE3 | ( | void |  | ) |

This function returns true if the CPU has SSE3 features.

Definition at line 584 of file SDL_cpuinfo.c.

References CPU_HAS_SSE3, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

SDL_bool SDL_HasSSE41 | ( | void |  | ) |

This function returns true if the CPU has SSE4.1 features.

Definition at line 593 of file SDL_cpuinfo.c.

References CPU_HAS_SSE41, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

SDL_bool SDL_HasSSE42 | ( | void |  | ) |

This function returns true if the CPU has SSE4.2 features.

Definition at line 602 of file SDL_cpuinfo.c.

References CPU_HAS_SSE42, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

## Variable Documentation

int SDL_CPUCount = 0

static

Definition at line 331 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUCount().

Uint32 SDL_CPUFeatures = 0xFFFFFFFF

static

Definition at line 491 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures().