[vlc-devel] [PATCH 2/3] Remove vlc_memcpy

Rafaël Carré funman at videolan.org
Mon Jul 2 23:00:20 CEST 2012


---
 configure.ac               |    2 -
 include/vlc_common.h       |    3 -
 include/vlc_cpu.h          |    4 -
 modules/3dnow/.gitignore   |    1 -
 modules/3dnow/Modules.am   |   10 --
 modules/3dnow/memcpy.c     |   54 ------
 modules/Makefile.am        |    8 -
 modules/altivec/Modules.am |    6 -
 modules/altivec/memcpy.c   |  226 -------------------------
 modules/misc/Modules.am    |    3 -
 modules/misc/memcpy.c      |   52 ------
 modules/mmx/Modules.am     |    9 -
 modules/mmx/fastmemcpy.h   |  394 --------------------------------------------
 modules/mmx/memcpy.c       |   54 ------
 modules/mmxext/.gitignore  |    1 -
 modules/mmxext/Modules.am  |   10 --
 modules/mmxext/memcpy.c    |   54 ------
 po/POTFILES.in             |    5 -
 po/vlc.pot                 |   22 +--
 src/libvlccore.sym         |    2 -
 src/misc/cpu.c             |   17 --
 21 files changed, 1 insertion(+), 936 deletions(-)
 delete mode 100644 modules/3dnow/.gitignore
 delete mode 100644 modules/3dnow/Modules.am
 delete mode 100644 modules/3dnow/memcpy.c
 delete mode 100644 modules/altivec/memcpy.c
 delete mode 100644 modules/misc/memcpy.c
 delete mode 100644 modules/mmx/fastmemcpy.h
 delete mode 100644 modules/mmx/memcpy.c
 delete mode 100644 modules/mmxext/.gitignore
 delete mode 100644 modules/mmxext/Modules.am
 delete mode 100644 modules/mmxext/memcpy.c

diff --git a/configure.ac b/configure.ac
index 3fecbaf..1e8fd9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4233,8 +4233,6 @@ AC_CONFIG_FILES([
   modules/visualization/Makefile
   modules/visualization/visual/Makefile
   modules/mmx/Makefile
-  modules/mmxext/Makefile
-  modules/3dnow/Makefile
   modules/sse2/Makefile
   modules/altivec/Makefile
   modules/arm_neon/Makefile
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 1998d9c..908e953 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -881,9 +881,6 @@ static inline void *vlc_memalign(size_t align, size_t size)
 
 VLC_API void vlc_tdestroy( void *, void (*)(void *) );
 
-/* Fast large memory copy */
-VLC_API void * vlc_memcpy( void *, const void *, size_t );
-
 /*****************************************************************************
  * I18n stuff
  *****************************************************************************/
diff --git a/include/vlc_cpu.h b/include/vlc_cpu.h
index 36f8da5..03b0a36 100644
--- a/include/vlc_cpu.h
+++ b/include/vlc_cpu.h
@@ -105,9 +105,5 @@ VLC_API unsigned vlc_CPU( void );
 
 # endif
 
-typedef void *(*vlc_memcpy_t) (void *tgt, const void *src, size_t n);
-
-VLC_API void vlc_fastmem_register(vlc_memcpy_t cpy);
-
 #endif /* !VLC_CPU_H */
 
diff --git a/modules/3dnow/.gitignore b/modules/3dnow/.gitignore
deleted file mode 100644
index 08a6d72..0000000
--- a/modules/3dnow/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile.am
diff --git a/modules/3dnow/Modules.am b/modules/3dnow/Modules.am
deleted file mode 100644
index 5c69f3e..0000000
--- a/modules/3dnow/Modules.am
+++ /dev/null
@@ -1,10 +0,0 @@
-libmemcpy3dn_plugin_la_SOURCES = memcpy.c ../mmx/fastmemcpy.h
-libmemcpy3dn_plugin_la_CFLAGS = $(AM_CFLAGS)
-libmemcpy3dn_plugin_la_LIBADD = $(AM_LIBADD)
-libmemcpy3dn_plugin_la_DEPENDENCIES =
-
-if HAVE_WIN32
-libvlc_LTLIBRARIES += \
-	libmemcpy3dn_plugin.la \
-	$(NULL)
-endif
diff --git a/modules/3dnow/memcpy.c b/modules/3dnow/memcpy.c
deleted file mode 100644
index 9034d6f..0000000
--- a/modules/3dnow/memcpy.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*****************************************************************************
- * memcpy.c : classic memcpy module
- *****************************************************************************
- * Copyright (C) 2001 the VideoLAN team
- * $Id$
- *
- * Authors: Samuel Hocevar <sam at zoy.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc_common.h>
-#include <vlc_plugin.h>
-#include <vlc_cpu.h>
-
-#define HAVE_3DNOW
-#include "../mmx/fastmemcpy.h"
-
-static int Activate( vlc_object_t *p_this )
-{
-    if( !(vlc_CPU() & CPU_CAPABILITY_3DNOW) )
-        return VLC_EGENERIC;
-
-    VLC_UNUSED(p_this);
-    vlc_fastmem_register( fast_memcpy );
-
-    return VLC_SUCCESS;
-}
-
-vlc_module_begin ()
-    set_category( CAT_ADVANCED )
-    set_subcategory( SUBCAT_ADVANCED_MISC )
-    set_description( N_("3D Now! memcpy") )
-    add_shortcut( "3dn", "3dnow", "memcpy3dn", "memcpy3dnow" )
-    set_capability( "memcpy", 100 )
-    set_callbacks( Activate, NULL )
-vlc_module_end ()
-
diff --git a/modules/Makefile.am b/modules/Makefile.am
index 68df599..8052324 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -25,9 +25,7 @@ EXTRA_SUBDIRS = \
 	mux \
 	stream_out \
 	mmx \
-	mmxext \
 	sse2 \
-	3dnow \
 	altivec \
 	arm_neon \
 	lua \
@@ -41,15 +39,9 @@ endif
 if HAVE_MMX
 SUBDIRS += mmx
 endif
-if HAVE_MMXEXT
-SUBDIRS += mmxext
-endif
 if HAVE_SSE2
 SUBDIRS += sse2
 endif
-if HAVE_3DNOW
-SUBDIRS += 3dnow
-endif
 if HAVE_ALTIVEC
 SUBDIRS += altivec
 endif
diff --git a/modules/altivec/Modules.am b/modules/altivec/Modules.am
index 41e6267..752dc8e 100644
--- a/modules/altivec/Modules.am
+++ b/modules/altivec/Modules.am
@@ -1,8 +1,3 @@
-libmemcpyaltivec_plugin_la_SOURCES = memcpy.c
-libmemcpyaltivec_plugin_la_CFLAGS = $(AM_CFLAGS) $(CFLAGS_memcpyaltivec)
-libmemcpyaltivec_plugin_la_LIBADD = $(AM_LIBADD) $(LIBS_memcpyaltivec)
-libmemcpyaltivec_plugin_la_DEPENDENCIES =
-
 libi420_yuy2_altivec_plugin_la_SOURCES = \
         ../video_chroma/i420_yuy2.c \
 	../video_chroma/i420_yuy2.h
@@ -11,6 +6,5 @@ libi420_yuy2_altivec_plugin_la_LIBADD = $(AM_LIBADD) $(LIBS_i420_yuy2_altivec)
 libi420_yuy2_altivec_plugin_la_DEPENDENCIES =
 
 libvlc_LTLIBRARIES += \
-	libmemcpyaltivec_plugin.la \
 	libi420_yuy2_altivec_plugin.la \
 	$(NULL)
diff --git a/modules/altivec/memcpy.c b/modules/altivec/memcpy.c
deleted file mode 100644
index 071e91e..0000000
--- a/modules/altivec/memcpy.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*****************************************************************************
- * memcpy.c : AltiVec memcpy module
- *****************************************************************************
- * Copyright (C) 2001 the VideoLAN team
- * $Id$
- *
- * Author: Christophe Massiot <massiot at via.ecp.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef __BUILD_ALTIVEC_ASM__
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc_common.h>
-#include <vlc_plugin.h>
-#include <vlc_cpu.h>
-
-#ifdef HAVE_ALTIVEC_H
-#   include <altivec.h>
-#endif
-
-/*****************************************************************************
- * Local prototypes.
- *****************************************************************************/
-static void * fast_memcpy ( void * to, const void * from, size_t len );
-
-/*****************************************************************************
- * Module initializer.
- *****************************************************************************/
-static int Activate ( vlc_object_t *p_this )
-{
-    if( !(vlc_CPU() & CPU_CAPABILITY_ALTIVEC) )
-        return VLC_EGENERIC;
-
-    VLC_UNUSED(p_this);
-    vlc_fastmem_register( fast_memcpy );
-    return VLC_SUCCESS;
-}
-
-/*****************************************************************************
- * Module descriptor.
- *****************************************************************************/
-vlc_module_begin ()
-    set_description( N_("AltiVec memcpy") )
-    set_category( CAT_ADVANCED )
-    set_subcategory( SUBCAT_ADVANCED_MISC )
-    set_capability( "memcpy", 100 )
-    set_callbacks( Activate, NULL )
-    add_shortcut( "altivec" )
-vlc_module_end ()
-
-#else
-typedef unsigned long size_t;
-#endif /* __BUILD_ALTIVEC_ASM__ */
-
-#if defined(CAN_COMPILE_C_ALTIVEC) || defined( __BUILD_ALTIVEC_ASM__ )
-
-#define vector_s16_t vector signed short
-#define vector_u16_t vector unsigned short
-#define vector_s8_t vector signed char
-#define vector_u8_t vector unsigned char
-#define vector_s32_t vector signed int
-#define vector_u32_t vector unsigned int
-#define MMREG_SIZE 16
-
-#define SMALL_MEMCPY(to, from, len)                                         \
-{                                                                           \
-    unsigned char * end = to + len;                                         \
-    while( to < end )                                                       \
-    {                                                                       \
-        *to++ = *from++;                                                    \
-    }                                                                       \
-}
-
-static void * fast_memcpy( void * _to, const void * _from, size_t len )
-{
-    void * retval = _to;
-    unsigned char * to = (unsigned char *)_to;
-    unsigned char * from = (unsigned char *)_from;
-
-    if( len > 16 )
-    {
-        /* Align destination to MMREG_SIZE -boundary */
-        register unsigned long int delta;
-
-        delta = ((unsigned long)to)&(MMREG_SIZE-1);
-        if( delta )
-        {
-            delta = MMREG_SIZE - delta;
-            len -= delta;
-            SMALL_MEMCPY(to, from, delta);
-        }
-
-        if( len & ~(MMREG_SIZE-1) )
-        {
-            vector_u8_t perm, ref0, ref1, tmp;
-
-            perm = vec_lvsl( 0, from );
-            ref0 = vec_ld( 0, from );
-            ref1 = vec_ld( 15, from );
-            from += 16;
-            len -= 16;
-            tmp = vec_perm( ref0, ref1, perm );
-            while( len & ~(MMREG_SIZE-1) )
-            {
-                ref0 = vec_ld( 0, from );
-                ref1 = vec_ld( 15, from );
-                from += 16;
-                len -= 16;
-                vec_st( tmp, 0, to );
-                tmp = vec_perm( ref0, ref1, perm );
-                to += 16;
-            }
-            vec_st( tmp, 0, to );
-            to += 16;
-        }
-    }
-
-    if( len )
-    {
-        SMALL_MEMCPY( to, from, len );
-    }
-
-    return retval;
-}
-
-#endif
-
-#if !defined(CAN_COMPILE_C_ALTIVEC) && !defined(__BUILD_ALTIVEC_ASM__)
-
-/*
- * The asm code is generated with:
- *
- * gcc-2.95 -fvec -D__BUILD_ALTIVEC_ASM__ -O9 -fomit-frame-pointer -mregnames -S *      memcpyaltivec.c
- *
- * sed 's/.L/._L/g' memcpyaltivec.s |
- * awk '{args=""; len=split ($2, arg, ",");
- *      for (i=1; i<=len; i++) { a=arg[i]; if (i<len) a=a",";
- *                               args = args sprintf ("%-6s", a) }
- *      printf ("\t\"\t%-16s%-24s\\n\"\n", $1, args) }' |
- * unexpand -a
- */
-
-static void * fast_memcpy( void * _to, const void * _from, size_t len )
-{
-    asm ("                                              \n"
-    "    cmplwi        %cr0, %r5,  16        \n"
-    "    mr        %r9,  %r3        \n"
-    "    bc        4,    1,    ._L3    \n"
-    "    andi.        %r0,  %r3,  15        \n"
-    "    bc        12,   2,    ._L4    \n"
-    "    subfic        %r0,  %r0,  16        \n"
-    "    add        %r11, %r3,  %r0        \n"
-    "    cmplw        %cr0, %r3,  %r11    \n"
-    "    subf        %r5,  %r0,  %r5        \n"
-    "    bc        4,    0,    ._L4    \n"
-    "    ._L7:                    \n"
-    "    lbz        %r0,  0(%r4)        \n"
-    "    stb        %r0,  0(%r9)        \n"
-    "    addi        %r9,  %r9,  1        \n"
-    "    cmplw        %cr0, %r9,  %r11    \n"
-    "    addi        %r4,  %r4,  1        \n"
-    "    bc        12,   0,    ._L7    \n"
-    "    ._L4:                    \n"
-    "    rlwinm.        %r0,  %r5,  0,      0,    27    \n"
-    "    bc        12,   2,    ._L3    \n"
-    "    addi        %r5,  %r5,  -16        \n"
-    "    li        %r11, 15        \n"
-    "    lvsl        %v12, 0,    %r4        \n"
-    "    lvx        %v1,  0,    %r4        \n"
-    "    lvx        %v0,  %r11, %r4        \n"
-    "    rlwinm.        %r0,  %r5,  0,      0,    27    \n"
-    "    vperm        %v13, %v1,  %v0,  %v12    \n"
-    "    addi        %r4,  %r4,  16        \n"
-    "    bc        12,   2,    ._L11    \n"
-    "    ._L12:                    \n"
-    "    addi        %r5,  %r5,  -16        \n"
-    "    li        %r11, 15        \n"
-    "    lvx        %v1,  0,    %r4        \n"
-    "    lvx        %v0,  %r11, %r4        \n"
-    "    rlwinm.        %r0,  %r5,  0,      0,    27    \n"
-    "    stvx        %v13, 0,    %r9        \n"
-    "    vperm        %v13, %v1,  %v0,  %v12    \n"
-    "    addi        %r4,  %r4,  16        \n"
-    "    addi        %r9,  %r9,  16        \n"
-    "    bc        4,    2,    ._L12    \n"
-    "    ._L11:                    \n"
-    "    stvx        %v13, 0,    %r9        \n"
-    "    addi        %r9,  %r9,  16        \n"
-    "    ._L3:                    \n"
-    "    cmpwi        %cr0, %r5,  0        \n"
-    "    bclr        12,   2            \n"
-    "    add        %r5,  %r9,  %r5        \n"
-    "    cmplw        %cr0, %r9,  %r5        \n"
-    "    bclr        4,    0            \n"
-    "    ._L17:                    \n"
-    "    lbz        %r0,  0(%r4)        \n"
-    "    stb        %r0,  0(%r9)        \n"
-    "    addi        %r9,  %r9,  1        \n"
-    "    cmplw        %cr0, %r9,  %r5        \n"
-    "    addi        %r4,  %r4,  1        \n"
-    "    bc        12,   0,    ._L17    \n"
-        );
-}
-
-#endif
diff --git a/modules/misc/Modules.am b/modules/misc/Modules.am
index 5376979..67feba6 100644
--- a/modules/misc/Modules.am
+++ b/modules/misc/Modules.am
@@ -9,9 +9,6 @@ SOURCES_inhibit = inhibit.c
 SOURCES_sqlite = sqlite.c
 SOURCES_xml = xml/libxml.c
 
-SOURCES_memcpy = memcpy.c
-libvlc_LTLIBRARIES += libmemcpy_plugin.la
-
 libgnutls_plugin_la_SOURCES = gnutls.c dhparams.h
 libgnutls_plugin_la_CFLAGS = $(AM_CFLAGS) $(GNUTLS_CFLAGS) $(GCRYPT_CFLAGS)
 libgnutls_plugin_la_LIBADD = $(AM_LIBADD) $(GNUTLS_LIBS) $(GCRYPT_LIBS)
diff --git a/modules/misc/memcpy.c b/modules/misc/memcpy.c
deleted file mode 100644
index 6bb9b6a..0000000
--- a/modules/misc/memcpy.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*****************************************************************************
- * memcpy.c : default memcpy plugin for vlc
- *****************************************************************************
- * Copyright (C) 2000, 2001 the VideoLAN team
- * $Id$
- *
- * Authors: Samuel Hocevar <sam at zoy.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc_common.h>
-#include <vlc_plugin.h>
-
-static int OpenDummy(vlc_object_t *);
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin ()
-    set_shortname( N_("Dummy") )
-    set_description( N_("libc memcpy") )
-    set_capability( "memcpy", 50 )
-    set_callbacks( OpenDummy, NULL )
-    add_shortcut( "c", "libc" )
-vlc_module_end ()
-
-static int OpenDummy( vlc_object_t *obj )
-{
-    (void) obj;
-    return VLC_SUCCESS;
-}
diff --git a/modules/mmx/Modules.am b/modules/mmx/Modules.am
index b22ec00..4ff1cdc 100644
--- a/modules/mmx/Modules.am
+++ b/modules/mmx/Modules.am
@@ -1,8 +1,3 @@
-libmemcpymmx_plugin_la_SOURCES = memcpy.c fastmemcpy.h
-libmemcpymmx_plugin_la_CFLAGS = $(AM_CFLAGS)
-libmemcpymmx_plugin_la_LIBADD = $(AM_LIBADD)
-libmemcpymmx_plugin_la_DEPENDENCIES =
-
 libi420_rgb_mmx_plugin_la_SOURCES = \
         ../video_chroma/i420_rgb.c \
 	../video_chroma/i420_rgb.h \
@@ -31,7 +26,3 @@ libvlc_LTLIBRARIES += \
 	libi420_yuy2_mmx_plugin.la \
 	libi422_yuy2_mmx_plugin.la \
 	$(NULL)
-
-if HAVE_WIN32
-libvlc_LTLIBRARIES += libmemcpymmx_plugin.la
-endif
diff --git a/modules/mmx/fastmemcpy.h b/modules/mmx/fastmemcpy.h
deleted file mode 100644
index 7077a1f..0000000
--- a/modules/mmx/fastmemcpy.h
+++ /dev/null
@@ -1,394 +0,0 @@
-/*****************************************************************************
- * fastmemcpy.h : fast memcpy routines
- *****************************************************************************
- * $Id$
- *
- * Authors: various Linux kernel hackers
- *          various MPlayer hackers
- *          Nick Kurshev <nickols_k at mail.ru>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*
-  aclib - advanced C library ;)
-  This file contains functions which improve and expand standard C-library
-*/
-
-#define BLOCK_SIZE 4096
-#define CONFUSION_FACTOR 0
-/*Feel free to fine-tune the above 2, it might be possible to get some speedup with them :)*/
-
-/*#define STATISTICS*/
-
-#ifndef HAVE_SSE2
-/*
-   P3 processor has only one SSE decoder so can execute only 1 sse insn per
-   cpu clock, but it has 3 mmx decoders (include load/store unit)
-   and executes 3 mmx insns per cpu clock.
-   P4 processor has some chances, but after reading:
-   http://www.emulators.com/pentium4.htm
-   I have doubts. Anyway SSE2 version of this code can be written better.
-*/
-#undef HAVE_SSE
-#endif
-
-
-/*
- This part of code was taken by me from Linux-2.4.3 and slightly modified
-for MMX, MMX2, SSE instruction set. I have done it since linux uses page aligned
-blocks but mplayer uses weakly ordered data and original sources can not
-speedup them. Only using PREFETCHNTA and MOVNTQ together have effect!
-
->From IA-32 Intel Architecture Software Developer's Manual Volume 1,
-
-Order Number 245470:
-"10.4.6. Cacheability Control, Prefetch, and Memory Ordering Instructions"
-
-Data referenced by a program can be temporal (data will be used again) or
-non-temporal (data will be referenced once and not reused in the immediate
-future). To make efficient use of the processor's caches, it is generally
-desirable to cache temporal data and not cache non-temporal data. Overloading
-the processor's caches with non-temporal data is sometimes referred to as
-"polluting the caches".
-The non-temporal data is written to memory with Write-Combining semantics.
-
-The PREFETCHh instructions permits a program to load data into the processor
-at a suggested cache level, so that it is closer to the processors load and
-store unit when it is needed. If the data is already present in a level of
-the cache hierarchy that is closer to the processor, the PREFETCHh instruction
-will not result in any data movement.
-But we should you PREFETCHNTA: Non-temporal data fetch data into location
-close to the processor, minimizing cache pollution.
-
-The MOVNTQ (store quadword using non-temporal hint) instruction stores
-packed integer data from an MMX register to memory, using a non-temporal hint.
-The MOVNTPS (store packed single-precision floating-point values using
-non-temporal hint) instruction stores packed floating-point data from an
-XMM register to memory, using a non-temporal hint.
-
-The SFENCE (Store Fence) instruction controls write ordering by creating a
-fence for memory store operations. This instruction guarantees that the results
-of every store instruction that precedes the store fence in program order is
-globally visible before any store instruction that follows the fence. The
-SFENCE instruction provides an efficient way of ensuring ordering between
-procedures that produce weakly-ordered data and procedures that consume that
-data.
-
-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 ) || defined( HAVE_MMX )
-
-#undef HAVE_MMX1
-#if defined(HAVE_MMX) && !defined(HAVE_MMX2) && !defined(HAVE_3DNOW) && !defined(HAVE_SSE)
-/*  means: mmx v.1. Note: Since we added alignment of destinition it speedups
-    of memory copying on PentMMX, Celeron-1 and P2 up to 12% versus
-    standard (non MMX-optimized) version.
-    Note: on K6-2+ it speedups memory copying up to 25% and
-          on K7 and P3 about 500% (5 times). */
-#define HAVE_MMX1
-#endif
-
-
-#undef HAVE_K6_2PLUS
-#if !defined( HAVE_MMX2) && defined( HAVE_3DNOW)
-#define HAVE_K6_2PLUS
-#endif
-
-/* for small memory blocks (<256 bytes) this version is faster */
-#define small_memcpy(to,from,n)\
-{\
-register unsigned long int dummy;\
-__asm__ __volatile__(\
-    "rep; movsb"\
-    :"=&D"(to), "=&S"(from), "=&c"(dummy)\
-/* It's most portable way to notify compiler */\
-/* that edi, esi and ecx are clobbered in asm block. */\
-/* Thanks to A'rpi for hint!!! */\
-        :"0" (to), "1" (from),"2" (n)\
-    : "memory");\
-}
-
-#ifdef HAVE_SSE
-#define MMREG_SIZE 16
-#else
-#define MMREG_SIZE 64 /*8*/
-#endif
-
-/* Small defines (for readability only) ;) */
-#ifdef HAVE_K6_2PLUS
-#define PREFETCH "prefetch"
-/* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */
-#define EMMS     "femms"
-#else
-#define PREFETCH "prefetchnta"
-#define EMMS     "emms"
-#endif
-
-#ifdef HAVE_MMX2
-#define MOVNTQ "movntq"
-#else
-#define MOVNTQ "movq"
-#endif
-
-#ifdef HAVE_MMX1
-#define MIN_LEN 0x800  /* 2K blocks */
-#else
-#define MIN_LEN 0x40  /* 64-byte blocks */
-#endif
-
-#ifdef HAVE_SSE
-VLC_SSE
-#else
-VLC_MMX
-#endif
-static void * fast_memcpy(void * to, const void * from, size_t len)
-{
-    void *retval;
-    size_t i;
-    retval = to;
-#ifdef STATISTICS
-    {
-        static int freq[33];
-        static int t=0;
-        int i;
-        for(i=0; len>(1<<i); i++);
-        freq[i]++;
-        t++;
-        if(1024*1024*1024 % t == 0)
-            for(i=0; i<32; i++)
-                printf("freq < %8d %4d\n", 1<<i, freq[i]);
-    }
-#endif
-#ifndef HAVE_MMX1
-        /* PREFETCH has effect even for MOVSB instruction ;) */
-    __asm__ __volatile__ (
-            PREFETCH" (%0)\n"
-            PREFETCH" 64(%0)\n"
-            PREFETCH" 128(%0)\n"
-            PREFETCH" 192(%0)\n"
-            PREFETCH" 256(%0)\n"
-        : : "r" (from) );
-#endif
-        if(len >= MIN_LEN)
-    {
-      register unsigned long int delta;
-          /* Align destinition to MMREG_SIZE -boundary */
-          delta = ((unsigned long int)to)&(MMREG_SIZE-1);
-          if(delta)
-      {
-        delta=MMREG_SIZE-delta;
-        len -= delta;
-        small_memcpy(to, from, delta);
-      }
-      i = len >> 6; /* len/64 */
-      len&=63;
-        /*
-           This algorithm is top effective when the code consequently
-           reads and writes blocks which have size of cache line.
-           Size of cache line is processor-dependent.
-           It will, however, be a minimum of 32 bytes on any processors.
-           It would be better to have a number of instructions which
-           perform reading and writing to be multiple to a number of
-           processor's decoders, but it's not always possible.
-        */
-#ifdef HAVE_SSE /* Only P3 (may be Cyrix3) */
-    if(((unsigned long)from) & 15)
-    /* if SRC is misaligned */
-    for(; i>0; i--)
-    {
-        __asm__ __volatile__ (
-        PREFETCH" 320(%0)\n"
-        "movups (%0), %%xmm0\n"
-        "movups 16(%0), %%xmm1\n"
-        "movups 32(%0), %%xmm2\n"
-        "movups 48(%0), %%xmm3\n"
-        "movntps %%xmm0, (%1)\n"
-        "movntps %%xmm1, 16(%1)\n"
-        "movntps %%xmm2, 32(%1)\n"
-        "movntps %%xmm3, 48(%1)\n"
-        :: "r" (from), "r" (to) : "memory", "xmm0", "xmm1", "xmm2", "xmm3");
-        ((const unsigned char *)from)+=64;
-        ((unsigned char *)to)+=64;
-    }
-    else
-    /*
-       Only if SRC is aligned on 16-byte boundary.
-       It allows using movaps instead of movups, which required data
-       to be aligned or a general-protection exception (#GP) is generated.
-    */
-    for(; i>0; i--)
-    {
-        __asm__ __volatile__ (
-        PREFETCH" 320(%0)\n"
-        "movaps (%0), %%xmm0\n"
-        "movaps 16(%0), %%xmm1\n"
-        "movaps 32(%0), %%xmm2\n"
-        "movaps 48(%0), %%xmm3\n"
-        "movntps %%xmm0, (%1)\n"
-        "movntps %%xmm1, 16(%1)\n"
-        "movntps %%xmm2, 32(%1)\n"
-        "movntps %%xmm3, 48(%1)\n"
-        :: "r" (from), "r" (to) : "memory", "xmm0", "xmm1", "xmm2", "xmm3");
-        ((const unsigned char *)from)+=64;
-        ((unsigned char *)to)+=64;
-    }
-#else
-    /* Align destination at BLOCK_SIZE boundary */
-    for(; ((uintptr_t)to & (BLOCK_SIZE-1)) && i>0; i--)
-    {
-        __asm__ __volatile__ (
-#ifndef HAVE_MMX1
-            PREFETCH" 320(%0)\n"
-#endif
-        "movq (%0), %%mm0\n"
-        "movq 8(%0), %%mm1\n"
-        "movq 16(%0), %%mm2\n"
-        "movq 24(%0), %%mm3\n"
-        "movq 32(%0), %%mm4\n"
-        "movq 40(%0), %%mm5\n"
-        "movq 48(%0), %%mm6\n"
-        "movq 56(%0), %%mm7\n"
-        MOVNTQ" %%mm0, (%1)\n"
-        MOVNTQ" %%mm1, 8(%1)\n"
-        MOVNTQ" %%mm2, 16(%1)\n"
-        MOVNTQ" %%mm3, 24(%1)\n"
-        MOVNTQ" %%mm4, 32(%1)\n"
-        MOVNTQ" %%mm5, 40(%1)\n"
-        MOVNTQ" %%mm6, 48(%1)\n"
-        MOVNTQ" %%mm7, 56(%1)\n"
-        :: "r" (from), "r" (to) : "memory", "mm0", "mm1", "mm2", "mm3",
-                                            "mm4", "mm5", "mm6", "mm7");
-                from = (const void *) (((const unsigned char *)from)+64);
-        to = (void *) (((unsigned char *)to)+64);
-    }
-
-/*    printf(" %p %p\n", (uintptr_t)from&1023, (uintptr_t)to&1023); */
-    /* Pure Assembly cuz gcc is a bit unpredictable ;) */
-# if 0
-    if(i>=BLOCK_SIZE/64)
-        asm volatile(
-            "xorl %%eax, %%eax    \n\t"
-            ".balign 16        \n\t"
-            "1:            \n\t"
-                "movl (%0, %%eax), %%ebx     \n\t"
-                "movl 32(%0, %%eax), %%ebx     \n\t"
-                "movl 64(%0, %%eax), %%ebx     \n\t"
-                "movl 96(%0, %%eax), %%ebx     \n\t"
-                "addl $128, %%eax        \n\t"
-                "cmpl %3, %%eax            \n\t"
-                " jb 1b                \n\t"
-
-            "xorl %%eax, %%eax    \n\t"
-
-                ".balign 16        \n\t"
-                "2:            \n\t"
-                "movq (%0, %%eax), %%mm0\n"
-                "movq 8(%0, %%eax), %%mm1\n"
-                "movq 16(%0, %%eax), %%mm2\n"
-                "movq 24(%0, %%eax), %%mm3\n"
-                "movq 32(%0, %%eax), %%mm4\n"
-                "movq 40(%0, %%eax), %%mm5\n"
-                "movq 48(%0, %%eax), %%mm6\n"
-                "movq 56(%0, %%eax), %%mm7\n"
-                MOVNTQ" %%mm0, (%1, %%eax)\n"
-                MOVNTQ" %%mm1, 8(%1, %%eax)\n"
-                MOVNTQ" %%mm2, 16(%1, %%eax)\n"
-                MOVNTQ" %%mm3, 24(%1, %%eax)\n"
-                MOVNTQ" %%mm4, 32(%1, %%eax)\n"
-                MOVNTQ" %%mm5, 40(%1, %%eax)\n"
-                MOVNTQ" %%mm6, 48(%1, %%eax)\n"
-                MOVNTQ" %%mm7, 56(%1, %%eax)\n"
-                "addl $64, %%eax        \n\t"
-                "cmpl %3, %%eax        \n\t"
-                "jb 2b                \n\t"
-
-#if CONFUSION_FACTOR > 0
-    /* a few percent speedup on out of order executing CPUs */
-            "movl %5, %%eax        \n\t"
-                "2:            \n\t"
-                "movl (%0), %%ebx    \n\t"
-                "movl (%0), %%ebx    \n\t"
-                "movl (%0), %%ebx    \n\t"
-                "movl (%0), %%ebx    \n\t"
-                "decl %%eax        \n\t"
-                " jnz 2b        \n\t"
-#endif
-
-            "xorl %%eax, %%eax    \n\t"
-            "addl %3, %0        \n\t"
-            "addl %3, %1        \n\t"
-            "subl %4, %2        \n\t"
-            "cmpl %4, %2        \n\t"
-            " jae 1b        \n\t"
-                : "+r" (from), "+r" (to), "+r" (i)
-                : "r" (BLOCK_SIZE), "i" (BLOCK_SIZE/64), "i" (CONFUSION_FACTOR)
-                : "%eax", "%ebx", "mm0", "mm1", "mm2", "mm3",
-                                  "mm4", "mm5", "mm6", "mm7"
-        );
-#endif
-
-    for(; i>0; i--)
-    {
-        __asm__ __volatile__ (
-#ifndef HAVE_MMX1
-            PREFETCH" 320(%0)\n"
-#endif
-        "movq (%0), %%mm0\n"
-        "movq 8(%0), %%mm1\n"
-        "movq 16(%0), %%mm2\n"
-        "movq 24(%0), %%mm3\n"
-        "movq 32(%0), %%mm4\n"
-        "movq 40(%0), %%mm5\n"
-        "movq 48(%0), %%mm6\n"
-        "movq 56(%0), %%mm7\n"
-        MOVNTQ" %%mm0, (%1)\n"
-        MOVNTQ" %%mm1, 8(%1)\n"
-        MOVNTQ" %%mm2, 16(%1)\n"
-        MOVNTQ" %%mm3, 24(%1)\n"
-        MOVNTQ" %%mm4, 32(%1)\n"
-        MOVNTQ" %%mm5, 40(%1)\n"
-        MOVNTQ" %%mm6, 48(%1)\n"
-        MOVNTQ" %%mm7, 56(%1)\n"
-        :: "r" (from), "r" (to) : "memory", "mm0", "mm1", "mm2", "mm3",
-                                            "mm4", "mm5", "mm6", "mm7");
-        from = (const void *) (((const unsigned char *)from)+64);
-        to = (void *) (((unsigned char *)to)+64);
-    }
-
-#endif /* Have SSE */
-#ifdef HAVE_MMX2
-                /* since movntq is weakly-ordered, a "sfence"
-         * is needed to become ordered again. */
-        __asm__ __volatile__ ("sfence":::"memory");
-#endif
-#ifndef HAVE_SSE
-        /* enables to use FPU */
-        __asm__ __volatile__ (EMMS:::"memory");
-#endif
-    }
-    /*
-     *    Now do the tail of the block
-     */
-    if(len) small_memcpy(to, from, len);
-    return retval;
-}
-
-
-#endif /* #if defined( HAVE_MMX2 ) || defined( HAVE_3DNOW ) || defined( HAVE_MMX ) */
diff --git a/modules/mmx/memcpy.c b/modules/mmx/memcpy.c
deleted file mode 100644
index d507968..0000000
--- a/modules/mmx/memcpy.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*****************************************************************************
- * memcpy.c : classic memcpy module
- *****************************************************************************
- * Copyright (C) 2001 the VideoLAN team
- * $Id$
- *
- * Authors: Samuel Hocevar <sam at zoy.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc_common.h>
-#include <vlc_plugin.h>
-#include <vlc_cpu.h>
-
-#define HAVE_MMX
-#include "../mmx/fastmemcpy.h"
-
-static int Activate( vlc_object_t *p_this )
-{
-    if( !(vlc_CPU() & CPU_CAPABILITY_MMX) )
-        return VLC_EGENERIC;
-
-    VLC_UNUSED(p_this);
-    vlc_fastmem_register( fast_memcpy );
-
-    return VLC_SUCCESS;
-}
-
-vlc_module_begin ()
-    set_category( CAT_ADVANCED )
-    set_subcategory( SUBCAT_ADVANCED_MISC )
-    set_description( N_("MMX memcpy") )
-    add_shortcut( "mmx", "memcpymmx" )
-    set_capability( "memcpy", 100 )
-    set_callbacks( Activate, NULL )
-vlc_module_end ()
-
diff --git a/modules/mmxext/.gitignore b/modules/mmxext/.gitignore
deleted file mode 100644
index 08a6d72..0000000
--- a/modules/mmxext/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile.am
diff --git a/modules/mmxext/Modules.am b/modules/mmxext/Modules.am
deleted file mode 100644
index a17fad8..0000000
--- a/modules/mmxext/Modules.am
+++ /dev/null
@@ -1,10 +0,0 @@
-libmemcpymmxext_plugin_la_SOURCES = memcpy.c ../mmx/fastmemcpy.h
-libmemcpymmxext_plugin_la_CFLAGS = $(AM_CFLAGS)
-libmemcpymmxext_plugin_la_LIBADD = $(AM_LIBADD)
-libmemcpymmxext_plugin_la_DEPENDENCIES =
-
-if HAVE_WIN32
-libvlc_LTLIBRARIES += \
-	libmemcpymmxext_plugin.la \
-	$(NULL)
-endif
diff --git a/modules/mmxext/memcpy.c b/modules/mmxext/memcpy.c
deleted file mode 100644
index 5ddca2e..0000000
--- a/modules/mmxext/memcpy.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*****************************************************************************
- * memcpy.c : classic memcpy module
- *****************************************************************************
- * Copyright (C) 2001 the VideoLAN team
- * $Id$
- *
- * Authors: Samuel Hocevar <sam at zoy.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc_common.h>
-#include <vlc_plugin.h>
-#include <vlc_cpu.h>
-
-#define HAVE_MMX2
-#include "../mmx/fastmemcpy.h"
-
-static int Activate( vlc_object_t *p_this )
-{
-    if( !(vlc_CPU() & CPU_CAPABILITY_MMXEXT) )
-        return VLC_EGENERIC;
-
-    VLC_UNUSED(p_this);
-    vlc_fastmem_register( fast_memcpy );
-
-    return VLC_SUCCESS;
-}
-
-vlc_module_begin ()
-    set_category( CAT_ADVANCED )
-    set_subcategory( SUBCAT_ADVANCED_MISC )
-    set_description( N_("MMX EXT memcpy") )
-    add_shortcut( "mmxext", "memcpymmxext" )
-    set_capability( "memcpy", 200 )
-    set_callbacks( Activate, NULL )
-vlc_module_end ()
-
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4afa0d2..e13115f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -184,7 +184,6 @@ lib/video.c
 lib/vlm.c
 
 # modules
-modules/3dnow/memcpy.c
 modules/access/alsa.c
 modules/access/attachment.c
 modules/access/avio.h
@@ -282,7 +281,6 @@ modules/access/vcdx/vcdplayer.c
 modules/access/vcdx/vcdplayer.h
 modules/access/vdr.c
 modules/access/zip/zipstream.c
-modules/altivec/memcpy.c
 modules/arm_neon/audio_format.c
 modules/arm_neon/chroma_yuv.c
 modules/audio_filter/audiobargraph_a.c
@@ -923,7 +921,6 @@ modules/misc/inhibit/mce.c
 modules/misc/inhibit/xdg.c
 modules/misc/inhibit/xscreensaver.c
 modules/misc/logger.c
-modules/misc/memcpy.c
 modules/misc/osd/osd_menu.c
 modules/misc/osd/osd_menu.h
 modules/misc/osd/parser.c
@@ -941,8 +938,6 @@ modules/misc/stats/encoder.c
 modules/misc/stats/stats.c
 modules/misc/stats/stats.h
 modules/misc/xml/libxml.c
-modules/mmxext/memcpy.c
-modules/mmx/memcpy.c
 modules/mux/asf.c
 modules/mux/avi.c
 modules/mux/dummy.c
diff --git a/po/vlc.pot b/po/vlc.pot
index 2a3ebe5..e5e7f05 100644
--- a/po/vlc.pot
+++ b/po/vlc.pot
@@ -5095,10 +5095,6 @@ msgstr ""
 msgid "Scale factor"
 msgstr ""
 
-#: modules/3dnow/memcpy.c:49
-msgid "3D Now! memcpy"
-msgstr ""
-
 #: modules/access/alsa.c:71 modules/access/oss.c:66
 msgid "Capture the audio stream in stereo."
 msgstr ""
@@ -6435,7 +6431,7 @@ msgstr ""
 #: modules/access/idummy.c:42 modules/access_output/dummy.c:46
 #: modules/audio_output/adummy.c:40 modules/codec/ddummy.c:46
 #: modules/codec/edummy.c:39 modules/control/dummy.c:48
-#: modules/misc/memcpy.c:41 modules/text_renderer/tdummy.c:35
+#: modules/text_renderer/tdummy.c:35
 #: modules/video_output/vdummy.c:47
 msgid "Dummy"
 msgstr ""
@@ -8250,10 +8246,6 @@ msgstr ""
 msgid "Zip access"
 msgstr ""
 
-#: modules/altivec/memcpy.c:64
-msgid "AltiVec memcpy"
-msgstr ""
-
 #: modules/arm_neon/audio_format.c:36
 msgid "ARM NEON audio format conversions"
 msgstr ""
@@ -19636,10 +19628,6 @@ msgstr ""
 msgid "Specify the log filename."
 msgstr ""
 
-#: modules/misc/memcpy.c:42
-msgid "libc memcpy"
-msgstr ""
-
 #: modules/misc/osd/parser.c:51
 msgid "OSD configuration importer"
 msgstr ""
@@ -19730,14 +19718,6 @@ msgstr ""
 msgid "XML Parser (using libxml2)"
 msgstr ""
 
-#: modules/mmxext/memcpy.c:49
-msgid "MMX EXT memcpy"
-msgstr ""
-
-#: modules/mmx/memcpy.c:49
-msgid "MMX memcpy"
-msgstr ""
-
 #: modules/mux/asf.c:57
 msgid "Title to put in ASF comments."
 msgstr ""
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 931d923..7076472 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -510,7 +510,6 @@ vlc_event_manager_fini
 vlc_event_manager_init
 vlc_event_manager_register_event_type
 vlc_event_send
-vlc_fastmem_register
 vlc_fourcc_GetCodec
 vlc_fourcc_GetCodecAudio
 vlc_fourcc_GetCodecFromString
@@ -531,7 +530,6 @@ vlc_iconv_open
 vlc_join
 vlc_list_children
 vlc_list_release
-vlc_memcpy
 vlc_meta_AddExtra
 vlc_meta_CopyExtraNames
 vlc_meta_Delete
diff --git a/src/misc/cpu.c b/src/misc/cpu.c
index e0a7a60..2442d80 100644
--- a/src/misc/cpu.c
+++ b/src/misc/cpu.c
@@ -372,20 +372,3 @@ void vlc_CPU_dump (vlc_object_t *obj)
     if (p > buf)
         msg_Dbg (obj, "CPU has capabilities %s", buf);
 }
-
-
-static vlc_memcpy_t pf_vlc_memcpy = memcpy;
-
-void vlc_fastmem_register (vlc_memcpy_t cpy)
-{
-    assert (cpy != NULL);
-    pf_vlc_memcpy = cpy;
-}
-
-/**
- * vlc_memcpy: fast CPU-dependent memcpy
- */
-void *vlc_memcpy (void *tgt, const void *src, size_t n)
-{
-    return pf_vlc_memcpy (tgt, src, n);
-}
-- 
1.7.9.5



More information about the vlc-devel mailing list