changeset 567:e7c7a386a0c0

16-byte align fix for SSE
author arpi_esp
date Sat, 21 Apr 2001 21:49:28 +0000
parents 0375ced94bd7
children edba7a89de99
files libvo/fastmemcpy.h
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/fastmemcpy.h	Sat Apr 21 21:06:37 2001 +0000
+++ b/libvo/fastmemcpy.h	Sat Apr 21 21:49:28 2001 +0000
@@ -29,6 +29,25 @@
 	void *p;
 	int i;
 
+        
+#ifdef HAVE_SSE /* Only P3 (may be Cyrix3) */
+//        printf("fastmemcpy_pre(0x%X,0x%X,0x%X)\n",to,from,len);
+        // Align dest to 16-byte boundary:
+        if((unsigned int)to&15){
+          int len2=16-((unsigned int)to&15);
+          if(len>len2){
+            len-=len2;
+            __asm__ __volatile__(
+	    "rep ; movsb\n"
+	    :"=D" (to), "=S" (from)
+            : "D" (to), "S" (from),"c" (len2)
+	    : "memory");
+          }
+        }
+//        printf("fastmemcpy(0x%X,0x%X,0x%X)\n",to,from,len);
+#endif
+    
+
         if(len >= 0x200) /* 512-byte blocks */
 	{
   	  p = to;