Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Updated CPU detection code for SSE3 and SSE4 and removed obsolete 3DN…
Browse files Browse the repository at this point in the history
…ow! and Altivec support.
  • Loading branch information
slouken committed Feb 11, 2011
1 parent 366dcee commit 15ecc89
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 2,075 deletions.
103 changes: 0 additions & 103 deletions configure.in
Expand Up @@ -501,33 +501,6 @@ AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
fi
fi

AC_ARG_ENABLE(3dnow,
AC_HELP_STRING([--enable-3dnow], [use MMX assembly routines [[default=yes]]]),
, enable_3dnow=yes)
if test x$enable_3dnow = xyes; then
save_CFLAGS="$CFLAGS"
have_gcc_3dnow=no
AC_MSG_CHECKING(for GCC -m3dnow option)
amd3dnow_CFLAGS="-m3dnow"
CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"

AC_TRY_COMPILE([
#include <mm3dnow.h>
#ifndef __3dNOW__
#error Assembler CPP flag not enabled
#endif
],[
],[
have_gcc_3dnow=yes
])
AC_MSG_RESULT($have_gcc_3dnow)
CFLAGS="$save_CFLAGS"

if test x$have_gcc_3dnow = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
fi
fi

AC_ARG_ENABLE(sse,
AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
, enable_sse=yes)
Expand Down Expand Up @@ -599,82 +572,6 @@ AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
fi
fi

AC_ARG_ENABLE(altivec,
AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
, enable_altivec=yes)
if test x$enable_altivec = xyes; then
save_CFLAGS="$CFLAGS"
have_gcc_altivec=no
have_altivec_h_hdr=no
altivec_CFLAGS="-maltivec"
CFLAGS="$save_CFLAGS $altivec_CFLAGS"

AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
AC_TRY_COMPILE([
#include <altivec.h>
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
have_altivec_h_hdr=yes
])
AC_MSG_RESULT($have_gcc_altivec)

if test x$have_gcc_altivec = xno; then
AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
AC_TRY_COMPILE([
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
])
AC_MSG_RESULT($have_gcc_altivec)
fi

if test x$have_gcc_altivec = xno; then
AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
altivec_CFLAGS="-faltivec"
CFLAGS="$save_CFLAGS $altivec_CFLAGS"
AC_TRY_COMPILE([
#include <altivec.h>
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
have_altivec_h_hdr=yes
])
AC_MSG_RESULT($have_gcc_altivec)
fi

if test x$have_gcc_altivec = xno; then
AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
AC_TRY_COMPILE([
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
])
AC_MSG_RESULT($have_gcc_altivec)
fi
CFLAGS="$save_CFLAGS"

if test x$have_gcc_altivec = xyes; then
AC_DEFINE(SDL_ALTIVEC_BLITTERS)
if test x$have_altivec_h_hdr = xyes; then
AC_DEFINE(HAVE_ALTIVEC_H)
fi
EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
fi
fi
fi

dnl See if the OSS audio interface is supported
Expand Down
2 changes: 0 additions & 2 deletions include/SDL_config.h.in
Expand Up @@ -82,7 +82,6 @@
#undef HAVE_MATH_H
#undef HAVE_ICONV_H
#undef HAVE_SIGNAL_H
#undef HAVE_ALTIVEC_H

/* C library functions */
#undef HAVE_MALLOC
Expand Down Expand Up @@ -303,6 +302,5 @@

/* Enable assembly routines */
#undef SDL_ASSEMBLY_ROUTINES
#undef SDL_ALTIVEC_BLITTERS

#endif /* _SDL_config_h */
3 changes: 0 additions & 3 deletions include/SDL_config_macosx.h
Expand Up @@ -168,8 +168,5 @@

/* Enable assembly routines */
#define SDL_ASSEMBLY_ROUTINES 1
#ifdef __ppc__
#define SDL_ALTIVEC_BLITTERS 1
#endif

#endif /* _SDL_config_macosx_h */
25 changes: 8 additions & 17 deletions include/SDL_cpuinfo.h
Expand Up @@ -69,21 +69,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);

/**
* This function returns true if the CPU has MMX Ext.\ features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(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 3DNow!\ Ext.\ features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void);

/**
* This function returns true if the CPU has SSE features.
*/
Expand All @@ -95,9 +80,15 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);

/**
* This function returns true if the CPU has AltiVec features.
* This function returns true if the CPU has SSE3 features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);

/**
* This function returns true if the CPU has SSE4 features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE4(void);


/* Ends C function definitions when using C++ */
#ifdef __cplusplus
Expand Down

0 comments on commit 15ecc89

Please sign in to comment.