Commit 3f37bb54 authored by Sam Lantinga's avatar Sam Lantinga

Enabled 3DNow! intrinsic support

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402623
parent 4d9ae375
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\include" AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="_DEBUG;_WINDOWS;_WIN32_WINNT=0x0400;__SSE__;__MMX__" PreprocessorDefinitions="_DEBUG;_WINDOWS;_WIN32_WINNT=0x0400;__MMX__;__3dNOW__;__SSE__"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="false" EnableIntrinsicFunctions="false"
AdditionalIncludeDirectories="..\..\include" AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="NDEBUG;_WINDOWS;_WIN32_WINNT=0x0400;__SSE__;__MMX__" PreprocessorDefinitions="NDEBUG;_WINDOWS;_WIN32_WINNT=0x0400;__MMX__;__3dNOW__;__SSE__"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"
......
...@@ -290,6 +290,9 @@ AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]), ...@@ -290,6 +290,9 @@ AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#include <mmintrin.h> #include <mmintrin.h>
#ifndef __MMX__
#error Assembler CPP flag not enabled
#endif
],[ ],[
],[ ],[
have_gcc_mmx=yes have_gcc_mmx=yes
...@@ -301,6 +304,32 @@ AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]), ...@@ -301,6 +304,32 @@ AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
fi fi
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)
if test x$have_gcc_3dnow = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
fi
fi
AC_ARG_ENABLE(sse, AC_ARG_ENABLE(sse,
AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]), AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
, enable_sse=yes) , enable_sse=yes)
...@@ -313,6 +342,9 @@ AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]), ...@@ -313,6 +342,9 @@ AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#include <xmmintrin.h> #include <xmmintrin.h>
#ifndef __SSE__
#error Assembler CPP flag not enabled
#endif
],[ ],[
],[ ],[
have_gcc_sse=yes have_gcc_sse=yes
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
#ifdef __MMX__ #ifdef __MMX__
#include <mmintrin.h> #include <mmintrin.h>
#endif #endif
#ifdef __3dNOW__
#include <mm3dnow.h>
#endif
#ifdef __SSE__ #ifdef __SSE__
#include <xmmintrin.h> #include <xmmintrin.h>
#endif #endif
......
...@@ -1369,7 +1369,7 @@ BlitRGBtoRGBPixelAlpha(SDL_BlitInfo * info) ...@@ -1369,7 +1369,7 @@ BlitRGBtoRGBPixelAlpha(SDL_BlitInfo * info)
} }
} }
#ifdef __MMX__ #ifdef __3dNOW__
/* fast (as in MMX with prefetch) ARGB888->(A)RGB888 blending with pixel alpha */ /* fast (as in MMX with prefetch) ARGB888->(A)RGB888 blending with pixel alpha */
static void static void
BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info) BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info)
...@@ -2250,17 +2250,21 @@ SDL_CalculateAlphaBlit(SDL_Surface * surface, int blit_index) ...@@ -2250,17 +2250,21 @@ SDL_CalculateAlphaBlit(SDL_Surface * surface, int blit_index)
if (sf->Rmask == df->Rmask if (sf->Rmask == df->Rmask
&& sf->Gmask == df->Gmask && sf->Gmask == df->Gmask
&& sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) { && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
#ifdef __MMX__ #if defined(__MMX__) || defined(__3dNOW__)
if (sf->Rshift % 8 == 0 if (sf->Rshift % 8 == 0
&& sf->Gshift % 8 == 0 && sf->Gshift % 8 == 0
&& sf->Bshift % 8 == 0 && sf->Bshift % 8 == 0
&& sf->Ashift % 8 == 0 && sf->Aloss == 0) { && sf->Ashift % 8 == 0 && sf->Aloss == 0) {
#ifdef __3dNOW__
if (SDL_Has3DNow()) if (SDL_Has3DNow())
return BlitRGBtoRGBPixelAlphaMMX3DNOW; return BlitRGBtoRGBPixelAlphaMMX3DNOW;
#endif
#ifdef __MMX__
if (SDL_HasMMX()) if (SDL_HasMMX())
return BlitRGBtoRGBPixelAlphaMMX; return BlitRGBtoRGBPixelAlphaMMX;
}
#endif #endif
}
#endif /* __MMX__ || __3dNOW__ */
if (sf->Amask == 0xff000000) { if (sf->Amask == 0xff000000) {
#if SDL_ALTIVEC_BLITTERS #if SDL_ALTIVEC_BLITTERS
if (SDL_HasAltiVec()) if (SDL_HasAltiVec())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment