changeset 2520:b58c43aab619

3dnow prefetch & sfence
author michael
date Sun, 28 Oct 2001 19:41:50 +0000
parents 6f3fa9bc3b27
children b70a77066611
files postproc/swscale.c postproc/swscale_template.c
diffstat 2 files changed, 22 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/postproc/swscale.c	Sun Oct 28 18:30:59 2001 +0000
+++ b/postproc/swscale.c	Sun Oct 28 19:41:50 2001 +0000
@@ -9,6 +9,7 @@
 #include <string.h>
 #include "../config.h"
 #include "swscale.h"
+#include "../mmx_defs.h"
 
 //#undef HAVE_MMX2
 //#undef HAVE_MMX
@@ -929,20 +930,15 @@
 			"xorl %%ecx, %%ecx		\n\t"
 			"xorl %%ebx, %%ebx		\n\t"
 			"movw %4, %%bx			\n\t" // (xInc*4)&0xFFFF
-#ifdef HAVE_MMX2
+
 #define FUNNY_Y_CODE \
-			"prefetchnta 1024(%%esi)	\n\t"\
-			"prefetchnta 1056(%%esi)	\n\t"\
-			"prefetchnta 1088(%%esi)	\n\t"\
+			PREFETCH" 1024(%%esi)		\n\t"\
+			PREFETCH" 1056(%%esi)		\n\t"\
+			PREFETCH" 1088(%%esi)		\n\t"\
 			"call funnyYCode		\n\t"\
 			"movq temp0, %%mm2		\n\t"\
 			"xorl %%ecx, %%ecx		\n\t"
-#else
-#define FUNNY_Y_CODE \
-			"call funnyYCode		\n\t"\
-			"movq temp0, %%mm2		\n\t"\
-			"xorl %%ecx, %%ecx		\n\t"
-#endif
+
 FUNNY_Y_CODE
 FUNNY_Y_CODE
 FUNNY_Y_CODE
@@ -1046,20 +1042,13 @@
 		"xorl %%ebx, %%ebx		\n\t"
 		"movw %4, %%bx			\n\t" // (xInc*4)&0xFFFF
 
-#ifdef HAVE_MMX2
 #define FUNNYUVCODE \
-			"prefetchnta 1024(%%esi)	\n\t"\
-			"prefetchnta 1056(%%esi)	\n\t"\
-			"prefetchnta 1088(%%esi)	\n\t"\
+			PREFETCH" 1024(%%esi)		\n\t"\
+			PREFETCH" 1056(%%esi)		\n\t"\
+			PREFETCH" 1088(%%esi)		\n\t"\
 			"call funnyUVCode		\n\t"\
 			"movq temp0, %%mm2		\n\t"\
 			"xorl %%ecx, %%ecx		\n\t"
-#else
-#define FUNNYUVCODE \
-			"call funnyUVCode		\n\t"\
-			"movq temp0, %%mm2		\n\t"\
-			"xorl %%ecx, %%ecx		\n\t"
-#endif
 
 FUNNYUVCODE
 FUNNYUVCODE
@@ -1439,12 +1428,8 @@
 	g16Dither2= g16Dither;
 #endif
   }
-
-#ifdef HAVE_3DNOW
-	asm volatile("femms");
-#elif defined (HAVE_MMX)
-	asm volatile("emms");
-#endif
+__asm __volatile(SFENCE:::"memory");
+__asm __volatile(EMMS:::"memory");
 }
 
 
--- a/postproc/swscale_template.c	Sun Oct 28 18:30:59 2001 +0000
+++ b/postproc/swscale_template.c	Sun Oct 28 19:41:50 2001 +0000
@@ -9,6 +9,7 @@
 #include <string.h>
 #include "../config.h"
 #include "swscale.h"
+#include "../mmx_defs.h"
 
 //#undef HAVE_MMX2
 //#undef HAVE_MMX
@@ -929,20 +930,15 @@
 			"xorl %%ecx, %%ecx		\n\t"
 			"xorl %%ebx, %%ebx		\n\t"
 			"movw %4, %%bx			\n\t" // (xInc*4)&0xFFFF
-#ifdef HAVE_MMX2
+
 #define FUNNY_Y_CODE \
-			"prefetchnta 1024(%%esi)	\n\t"\
-			"prefetchnta 1056(%%esi)	\n\t"\
-			"prefetchnta 1088(%%esi)	\n\t"\
+			PREFETCH" 1024(%%esi)		\n\t"\
+			PREFETCH" 1056(%%esi)		\n\t"\
+			PREFETCH" 1088(%%esi)		\n\t"\
 			"call funnyYCode		\n\t"\
 			"movq temp0, %%mm2		\n\t"\
 			"xorl %%ecx, %%ecx		\n\t"
-#else
-#define FUNNY_Y_CODE \
-			"call funnyYCode		\n\t"\
-			"movq temp0, %%mm2		\n\t"\
-			"xorl %%ecx, %%ecx		\n\t"
-#endif
+
 FUNNY_Y_CODE
 FUNNY_Y_CODE
 FUNNY_Y_CODE
@@ -1046,20 +1042,13 @@
 		"xorl %%ebx, %%ebx		\n\t"
 		"movw %4, %%bx			\n\t" // (xInc*4)&0xFFFF
 
-#ifdef HAVE_MMX2
 #define FUNNYUVCODE \
-			"prefetchnta 1024(%%esi)	\n\t"\
-			"prefetchnta 1056(%%esi)	\n\t"\
-			"prefetchnta 1088(%%esi)	\n\t"\
+			PREFETCH" 1024(%%esi)		\n\t"\
+			PREFETCH" 1056(%%esi)		\n\t"\
+			PREFETCH" 1088(%%esi)		\n\t"\
 			"call funnyUVCode		\n\t"\
 			"movq temp0, %%mm2		\n\t"\
 			"xorl %%ecx, %%ecx		\n\t"
-#else
-#define FUNNYUVCODE \
-			"call funnyUVCode		\n\t"\
-			"movq temp0, %%mm2		\n\t"\
-			"xorl %%ecx, %%ecx		\n\t"
-#endif
 
 FUNNYUVCODE
 FUNNYUVCODE
@@ -1439,12 +1428,8 @@
 	g16Dither2= g16Dither;
 #endif
   }
-
-#ifdef HAVE_3DNOW
-	asm volatile("femms");
-#elif defined (HAVE_MMX)
-	asm volatile("emms");
-#endif
+__asm __volatile(SFENCE:::"memory");
+__asm __volatile(EMMS:::"memory");
 }