[Mplayer-cvslog] CVS: main/libvo fastmemcpy.h,1.5,1.6
Zoltan Ponekker
pontscho at users.sourceforge.net
Mon Apr 16 22:55:29 CEST 2001
Update of /cvsroot/mplayer/main/libvo
In directory usw-pr-cvs1:/tmp/cvs-serv1003/libvo
Modified Files:
fastmemcpy.h
Log Message:
add 3dnow support
Index: fastmemcpy.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/fastmemcpy.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** fastmemcpy.h 2001/04/14 17:56:44 1.5
--- fastmemcpy.h 2001/04/16 20:55:27 1.6
***************
*** 1,2 ****
--- 1,6 ----
+
+ #ifndef __MPLAYER_MEMCPY
+ #define __MPLAYER_MEMCPY
+
/*
This part of code was taken by from Linux-2.4.3 and slightly modified
***************
*** 6,10 ****
If you have questions please contact with me: Nick Kurshev: nickols_k at mail.ru.
*/
! #ifdef HAVE_MMX2
/* for small memory blocks (<256 bytes) this version is faster */
#define small_memcpy(to,from,n)\
--- 10,19 ----
If you have questions please contact with me: Nick Kurshev: nickols_k at mail.ru.
*/
!
! // 3dnow memcpy support from kernel 2.4.2
! // by Pontscho/fresh!mindworkz
!
! #if defined( HAVE_MMX2 ) || defined( HAVE_3DNOW )
!
/* for small memory blocks (<256 bytes) this version is faster */
#define small_memcpy(to,from,n)\
***************
*** 28,31 ****
--- 37,47 ----
__asm__ __volatile__ (
+ #if defined( HAVE_3DNOW ) && !defined( HAVE_MMX2 )
+ "prefetch (%0)\n"
+ "prefetch 64(%0)\n"
+ "prefetch 128(%0)\n"
+ "prefetch 192(%0)\n"
+ "prefetch 256(%0)\n"
+ #else
"prefetchnta (%0)\n"
"prefetchnta 64(%0)\n"
***************
*** 33,36 ****
--- 49,53 ----
"prefetchnta 192(%0)\n"
"prefetchnta 256(%0)\n"
+ #endif
: : "r" (from) );
/*
***************
*** 46,50 ****
--- 63,71 ----
{
__asm__ __volatile__ (
+ #if defined( HAVE_3DNOW ) && !defined( HAVE_MMX2 )
+ "prefetch 320(%0)\n"
+ #else
"prefetchnta 320(%0)\n"
+ #endif
#ifdef HAVE_SSE /* Only P3 (may be Cyrix3) */
"movups (%0), %%xmm0\n"
***************
*** 57,60 ****
--- 78,99 ----
"movntps %%xmm1, 48(%1)\n"
#else /* Only K7 (may be other) */
+ #if defined( HAVE_3DNOW ) && !defined( HAVE_MMX2 )
+ "movq (%0), %%mm0\n"
+ "movq 8(%0), %%mm1\n"
+ "movq 16(%0), %%mm2\n"
+ "movq 24(%0), %%mm3\n"
+ "movq %%mm0, (%1)\n"
+ "movq %%mm1, 8(%1)\n"
+ "movq %%mm2, 16(%1)\n"
+ "movq %%mm3, 24(%1)\n"
+ "movq 32(%0), %%mm0\n"
+ "movq 40(%0), %%mm1\n"
+ "movq 48(%0), %%mm2\n"
+ "movq 56(%0), %%mm3\n"
+ "movq %%mm0, 32(%1)\n"
+ "movq %%mm1, 40(%1)\n"
+ "movq %%mm2, 48(%1)\n"
+ "movq %%mm3, 56(%1)\n"
+ #else
"movq (%0), %%mm0\n"
"movq 8(%0), %%mm1\n"
***************
*** 74,90 ****
--- 113,150 ----
"movntq %%mm3, 56(%1)\n"
#endif
+ #endif
:: "r" (from), "r" (to) : "memory");
from+=64;
to+=64;
}
+ #if defined( HAVE_3DNOW ) && !defined( HAVE_MMX2 )
+ __asm__ __volatile__ ("femms":::"memory");
+ #else
__asm__ __volatile__ ("emms":::"memory");
+ #endif
}
/*
* Now do the tail of the block
*/
+ #if 0
small_memcpy(to, from, len);
+ #else
+ __asm__ __volatile__ (
+ "shrl $1,%%ecx\n"
+ "jnc 1f\n"
+ "movsb\n"
+ "1:\n"
+ "shrl $1,%%ecx\n"
+ "jnc 2f\n"
+ "movsw\n"
+ "2:\n"
+ "rep ; movsl\n"
+ ::"D" (to), "S" (from),"c" (len)
+ : "memory");
+ #endif
return p;
}
#define memcpy(a,b,c) fast_memcpy(a,b,c)
+
#endif
_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
More information about the MPlayer-cvslog
mailing list