Re-added the 3DNow! and AltiVec instruction support.

This commit is contained in:
Sam Lantinga
2011-02-22 21:44:36 -08:00
parent a971987a27
commit 7fa84f6a78
15 changed files with 2412 additions and 58 deletions

View File

@@ -34,7 +34,7 @@
/* Make sure that this isn't included by Visual C++ */
#ifdef _MSC_VER
#error You should copy include/SDL_config.h.default to include/SDL_config.h
#error You should run hg revert SDL_config.h
#endif
/* C language features */
@@ -82,6 +82,7 @@
#undef HAVE_MATH_H
#undef HAVE_ICONV_H
#undef HAVE_SIGNAL_H
#undef HAVE_ALTIVEC_H
/* C library functions */
#undef HAVE_MALLOC
@@ -302,5 +303,6 @@
/* Enable assembly routines */
#undef SDL_ASSEMBLY_ROUTINES
#undef SDL_ALTIVEC_BLITTERS
#endif /* _SDL_config_h */

View File

@@ -168,5 +168,8 @@
/* Enable assembly routines */
#define SDL_ASSEMBLY_ROUTINES 1
#ifdef __ppc__
#define SDL_ALTIVEC_BLITTERS 1
#endif
#endif /* _SDL_config_macosx_h */

View File

@@ -31,6 +31,34 @@
#include "SDL_stdinc.h"
/* Need to do this here because intrin.h has C++ code in it */
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && !defined(_WIN32_WCE)
#include <intrin.h>
#define __MMX__
#define __3dNOW__
#define __SSE__
#define __SSE2__
#elif defined(__MINGW64_VERSION_MAJOR)
#include <intrin.h>
#else
#ifdef __MMX__
#include <mmintrin.h>
#endif
#ifdef __3dNOW__
#include <mm3dnow.h>
#endif
#ifdef __SSE__
#include <xmmintrin.h>
#endif
#ifdef __SSE2__
#include <emmintrin.h>
#endif
#ifdef HAVE_ALTIVEC_H
#include <altivec.h>
#endif
#endif
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
@@ -64,11 +92,21 @@ extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
/**
* This function returns true if the CPU has AltiVec features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
/**
* This function returns true if the CPU has MMX features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
/**
* This function returns true if the CPU has 3DNow! features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
/**
* This function returns true if the CPU has SSE features.
*/