diff src/video/SDL_blit_A.c @ 880:9ef41050100c

Date: Tue, 30 Mar 2004 21:26:47 -0600 From: Tyler Montbriand Subject: [SDL] Opteron MMX patches for SDL_blit.c and SDL_blit_A.c The inline MMX assembly in SDL_blit.c and SDL_blit_A.c compiles and runs fine unmodified under AMD Opteron. The inline assembly in SDL_yuv_mmx.c and SDL_blit_N.c unfortunately isn't directly compatible. I've included diffs from SDL_blit.c and SDL_blit_A.c that allow the MMX assembly to be compiled when USE_ASMBLIT, __x86_64__, and __GNUC__ are all defined. All I had to modify was typedefs, the inline assembly itself wasn't touched.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 11 Apr 2004 19:47:28 +0000
parents b8d311d90021
children ffaaf7ecf685
line wrap: on
line diff
--- a/src/video/SDL_blit_A.c	Thu Apr 08 21:13:14 2004 +0000
+++ b/src/video/SDL_blit_A.c	Sun Apr 11 19:47:28 2004 +0000
@@ -31,7 +31,11 @@
 #include "SDL_video.h"
 #include "SDL_blit.h"
 
-#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#if (defined(i386) || defined(__x86_64__)) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#define MMX_ASMBLIT
+#endif
+
+#ifdef MMX_ASMBLIT
 /* Function to check the CPU flags */
 #include "SDL_cpuinfo.h"
 #include "mmx.h"
@@ -201,7 +205,7 @@
 	}
 }
 
-#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#ifdef MMX_ASMBLIT
 /* fast RGB888->(A)RGB888 blending with surface alpha=128 special case */
 static void BlitRGBtoRGBSurfaceAlpha128MMX(SDL_BlitInfo *info)
 {
@@ -557,7 +561,7 @@
 	}
 }
 
-#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#ifdef MMX_ASMBLIT
 /* fast (as in MMX with prefetch) ARGB888->(A)RGB888 blending with pixel alpha */
 inline static void BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo *info)
 {
@@ -759,7 +763,7 @@
 	}
 }
 
-#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#ifdef MMX_ASMBLIT
 /* fast RGB565->RGB565 blending with surface alpha */
 static void Blit565to565SurfaceAlphaMMX(SDL_BlitInfo *info)
 {
@@ -1379,7 +1383,7 @@
 		if(surface->map->identity) {
 		    if(df->Gmask == 0x7e0)
 		    {
-#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#ifdef MMX_ASMBLIT
 		if(SDL_HasMMX())
 			return Blit565to565SurfaceAlphaMMX;
 		else
@@ -1388,7 +1392,7 @@
 		    }
 		    else if(df->Gmask == 0x3e0)
 		    {
-#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#ifdef MMX_ASMBLIT
 		if(SDL_HasMMX())
 			return Blit555to555SurfaceAlphaMMX;
 		else
@@ -1405,7 +1409,7 @@
 		   && (sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff
 		   && sf->BytesPerPixel == 4)
 		{
-#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#ifdef MMX_ASMBLIT
 		if(SDL_HasMMX())
 		    return BlitRGBtoRGBSurfaceAlphaMMX;
 		else
@@ -1445,7 +1449,7 @@
 	       && sf->Bmask == df->Bmask
 	       && sf->BytesPerPixel == 4)
 	    {
-#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
+#ifdef MMX_ASMBLIT
 		if(SDL_Has3DNow())
 		    return BlitRGBtoRGBPixelAlphaMMX3DNOW;
 		else