From 928d731dba7ab652442fa138c4aee4b5e4e700b1 Mon Sep 17 00:00:00 2001 From: Christophe Massiot Date: Wed, 3 Apr 2002 22:36:50 +0000 Subject: [PATCH] Fixed altivec memcpy module [OS X port] --- Makefile.opts.in | 2 + configure | 204 +++++++++++++++++---------------- configure.in | 8 +- plugins/memcpy/Makefile | 2 +- plugins/memcpy/fastmemcpy.h | 71 +----------- plugins/memcpy/memcpy.c | 11 +- plugins/memcpy/memcpyaltivec.c | 140 ++++++++++++++++++++++ 7 files changed, 256 insertions(+), 182 deletions(-) create mode 100644 plugins/memcpy/memcpyaltivec.c diff --git a/Makefile.opts.in b/Makefile.opts.in index b321675441..cbb703b551 100644 --- a/Makefile.opts.in +++ b/Makefile.opts.in @@ -95,6 +95,7 @@ LIB_KDE = @LIB_KDE@ LIB_LIRC = @LIB_LIRC@ LIB_MACOSX = @LIB_MACOSX@ LIB_MAD = @LIB_MAD@ +LIB_MEMCPYALTIVEC = @LIB_MEMCPYALTIVEC@ LIB_MOTIONALTIVEC = @LIB_MOTIONALTIVEC@ LIB_MPEG_TS = @LIB_MPEG_TS@ LIB_NCURSES = @LIB_NCURSES@ @@ -126,6 +127,7 @@ CFLAGS_KDE = @CFLAGS_KDE@ CFLAGS_IDCTALTIVEC = @CFLAGS_IDCTALTIVEC@ CFLAGS_MACOSX = @CFLAGS_MACOSX@ CFLAGS_MAD = @CFLAGS_MAD@ +CFLAGS_MEMCPYALTIVEC = @CFLAGS_MEMCPYALTIVEC@ CFLAGS_MOTIONALTIVEC = @CFLAGS_MOTIONALTIVEC@ CFLAGS_QT = @CFLAGS_QT@ CFLAGS_SDL = @CFLAGS_SDL@ diff --git a/configure b/configure index 334577f023..a0f303e0e8 100755 --- a/configure +++ b/configure @@ -5579,7 +5579,7 @@ THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn" if test x$SYS != xmingw32; then SSE_MODULES="imdctsse downmixsse" fi -ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec" +ALTIVEC_MODULES="idctaltivec motionaltivec" echo $ac_n "checking if \$CC groks MMX inline assembly""... $ac_c" 1>&6 echo "configure:5586: checking if \$CC groks MMX inline assembly" >&5 @@ -5831,26 +5831,27 @@ EOF CFLAGS_IDCTALTIVEC="$CFLAGS_IDCTALTIVEC $ac_cv_c_altivec" CFLAGS_MOTIONALTIVEC="$CFLAGS_MOTIONALTIVEC $ac_cv_c_altivec" + CFLAGS_MEMCPYALTIVEC="$CFLAGS_MEMCPYALTIVEC $ac_cv_c_altivec" CFLAGS_VLC="$CFLAGS_VLC $ac_cv_c_altivec" - ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}" + ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES} memcpyaltivec" fi echo $ac_n "checking if linker needs -framework vecLib""... $ac_c" 1>&6 -echo "configure:5840: checking if linker needs -framework vecLib" >&5 +echo "configure:5841: checking if linker needs -framework vecLib" >&5 if eval "test \"`echo '$''{'ac_cv_ld_altivec'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -framework vecLib" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_ld_altivec=yes else @@ -5868,6 +5869,7 @@ echo "$ac_t""$ac_cv_ld_altivec" 1>&6 if test x"$ac_cv_ld_altivec" != x"no"; then LIB_IDCTALTIVEC="${LIB_IDCTALTIVEC} -framework vecLib" LIB_MOTIONALTIVEC="${LIB_MOTIONALTIVEC} -framework vecLib" + LIB_MEMCPYALTIVEC="${LIB_MEMCPYALTIVEC} -framework vecLib" LIB_VLC="${LIB_VLC} -framework vecLib" fi fi # end if mingw32 @@ -5980,17 +5982,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5984: checking for $ac_hdr" >&5 +echo "configure:5986: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5996: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6021,7 +6023,7 @@ done else echo $ac_n "checking for libdvdcss.a in ${with_dvdcss_tree}""... $ac_c" 1>&6 -echo "configure:6025: checking for libdvdcss.a in ${with_dvdcss_tree}" >&5 +echo "configure:6027: checking for libdvdcss.a in ${with_dvdcss_tree}" >&5 real_dvdcss_tree="`cd ${with_dvdcss_tree} 2>/dev/null && pwd`" if test "x$real_dvdcss_tree" = x then @@ -6047,7 +6049,7 @@ echo "configure:6025: checking for libdvdcss.a in ${with_dvdcss_tree}" >&5 ;; *) echo $ac_n "checking for dvdcss headers in ${with_dvdcss}""... $ac_c" 1>&6 -echo "configure:6051: checking for dvdcss headers in ${with_dvdcss}" >&5 +echo "configure:6053: checking for dvdcss headers in ${with_dvdcss}" >&5 if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h then echo "$ac_t""yes" 1>&6 @@ -6082,17 +6084,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6086: checking for $ac_hdr" >&5 +echo "configure:6088: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6096: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6098: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6122,7 +6124,7 @@ done ;; *) echo $ac_n "checking for dvdread headers in ${withval}""... $ac_c" 1>&6 -echo "configure:6126: checking for dvdread headers in ${withval}" >&5 +echo "configure:6128: checking for dvdread headers in ${withval}" >&5 if test -f ${withval}/include/dvdread/dvd_reader.h then echo "$ac_t""yes" 1>&6 @@ -6147,7 +6149,7 @@ fi if test x$enable_vcd != xno then cat > conftest.$ac_ext < EOF @@ -6188,12 +6190,12 @@ fi echo $ac_n "checking for inet_pton""... $ac_c" 1>&6 -echo "configure:6192: checking for inet_pton" >&5 +echo "configure:6194: checking for inet_pton" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_pton'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_inet_pton=yes" else @@ -6272,17 +6274,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6276: checking for $ac_hdr" >&5 +echo "configure:6278: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6286: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6312,7 +6314,7 @@ fi done echo $ac_n "checking for mad_bit_init in -lmad""... $ac_c" 1>&6 -echo "configure:6316: checking for mad_bit_init in -lmad" >&5 +echo "configure:6318: checking for mad_bit_init in -lmad" >&5 ac_lib_var=`echo mad'_'mad_bit_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6320,7 +6322,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmad $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6383,17 +6385,17 @@ if test "x$enableval" != "xno" -a x$SYS != xmingw32 do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6387: checking for $ac_hdr" >&5 +echo "configure:6389: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6397: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6399: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6436,17 +6438,17 @@ then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6440: checking for $ac_hdr" >&5 +echo "configure:6442: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6450: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6452: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6505,17 +6507,17 @@ if test x$enable_x11 != xno && do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6509: checking for $ac_hdr" >&5 +echo "configure:6511: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6519: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6521: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6568,17 +6570,17 @@ if test x$enable_xvideo != xno && do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6572: checking for $ac_hdr" >&5 +echo "configure:6574: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6584: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6602,7 +6604,7 @@ EOF saved_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -L$x_libraries -lX11 -lXext" echo $ac_n "checking for XvSetPortAttribute in -lXv_pic""... $ac_c" 1>&6 -echo "configure:6606: checking for XvSetPortAttribute in -lXv_pic" >&5 +echo "configure:6608: checking for XvSetPortAttribute in -lXv_pic" >&5 ac_lib_var=`echo Xv_pic'_'XvSetPortAttribute | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6610,7 +6612,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXv_pic $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6679,7 +6681,7 @@ fi # Extract the first word of "sdl12-config", so it can be a program name with args. set dummy sdl12-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6683: checking for $ac_word" >&5 +echo "configure:6685: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SDL12_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6719,7 +6721,7 @@ fi # Extract the first word of "sdl11-config", so it can be a program name with args. set dummy sdl11-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6723: checking for $ac_word" >&5 +echo "configure:6725: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SDL11_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6760,7 +6762,7 @@ fi # Extract the first word of "sdl-config", so it can be a program name with args. set dummy sdl-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6764: checking for $ac_word" >&5 +echo "configure:6766: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SDL_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6806,17 +6808,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6810: checking for $ac_hdr" >&5 +echo "configure:6812: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6820: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6822: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6886,17 +6888,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6890: checking for $ac_hdr" >&5 +echo "configure:6892: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6900: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6902: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6925,7 +6927,7 @@ done else echo $ac_n "checking for directX headers in ${withval}""... $ac_c" 1>&6 -echo "configure:6929: checking for directX headers in ${withval}" >&5 +echo "configure:6931: checking for directX headers in ${withval}" >&5 if test -f ${withval}/ddraw.h then PLUGINS="${PLUGINS} directx" @@ -6952,17 +6954,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6956: checking for $ac_hdr" >&5 +echo "configure:6958: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6966: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7057,17 +7059,17 @@ if test x$enable_aa = xyes then ac_safe=`echo "aalib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for aalib.h""... $ac_c" 1>&6 -echo "configure:7061: checking for aalib.h" >&5 +echo "configure:7063: checking for aalib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7071: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7073: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7118,17 +7120,17 @@ then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7122: checking for $ac_hdr" >&5 +echo "configure:7124: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7132: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7134: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7151,7 +7153,7 @@ EOF PLUGINS="${PLUGINS} dsp" echo $ac_n "checking for main in -lossaudio""... $ac_c" 1>&6 -echo "configure:7155: checking for main in -lossaudio" >&5 +echo "configure:7157: checking for main in -lossaudio" >&5 ac_lib_var=`echo ossaudio'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7159,14 +7161,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lossaudio $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7202,7 +7204,7 @@ if test "${enable_esd+set}" = set; then # Extract the first word of "esd-config", so it can be a program name with args. set dummy esd-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7206: checking for $ac_word" >&5 +echo "configure:7208: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ESD_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7253,7 +7255,7 @@ if test "${enable_arts+set}" = set; then # Extract the first word of "artsc-config", so it can be a program name with args. set dummy artsc-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7257: checking for $ac_word" >&5 +echo "configure:7259: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ARTS_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7303,17 +7305,17 @@ if test "${enable_alsa+set}" = set; then then ac_safe=`echo "alsa/asoundlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for alsa/asoundlib.h""... $ac_c" 1>&6 -echo "configure:7307: checking for alsa/asoundlib.h" >&5 +echo "configure:7309: checking for alsa/asoundlib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7319: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7330,7 +7332,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6 -echo "configure:7334: checking for main in -lasound" >&5 +echo "configure:7336: checking for main in -lasound" >&5 ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7338,14 +7340,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lasound $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7351: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7422,7 +7424,7 @@ fi # Extract the first word of "gtk12-config", so it can be a program name with args. set dummy gtk12-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7426: checking for $ac_word" >&5 +echo "configure:7428: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GTK12_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7461,7 +7463,7 @@ fi # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7465: checking for $ac_word" >&5 +echo "configure:7467: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7511,17 +7513,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7515: checking for $ac_hdr" >&5 +echo "configure:7517: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7527: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7567,7 +7569,7 @@ if test "${enable_gnome+set}" = set; then # Extract the first word of "gnome-config", so it can be a program name with args. set dummy gnome-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7571: checking for $ac_word" >&5 +echo "configure:7573: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7612,17 +7614,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7616: checking for $ac_hdr" >&5 +echo "configure:7618: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7626: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7628: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7712,17 +7714,17 @@ else do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7716: checking for $ac_hdr" >&5 +echo "configure:7718: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7767,17 +7769,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7771: checking for $ac_hdr" >&5 +echo "configure:7773: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7781: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7783: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7838,17 +7840,17 @@ if test x$enable_lirc = xyes then ac_safe=`echo "lirc/lirc_client.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for lirc/lirc_client.h""... $ac_c" 1>&6 -echo "configure:7842: checking for lirc/lirc_client.h" >&5 +echo "configure:7844: checking for lirc/lirc_client.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7852: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7865,7 +7867,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for lirc_init in -llirc_client""... $ac_c" 1>&6 -echo "configure:7869: checking for lirc_init in -llirc_client" >&5 +echo "configure:7871: checking for lirc_init in -llirc_client" >&5 ac_lib_var=`echo lirc_client'_'lirc_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7873,7 +7875,7 @@ else ac_save_LIBS="$LIBS" LIBS="-llirc_client $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7941,7 +7943,7 @@ fi ;; *) echo $ac_n "checking whether the byte order is big-endian""... $ac_c" 1>&6 -echo "configure:7945: checking whether the byte order is big-endian" >&5 +echo "configure:7947: checking whether the byte order is big-endian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8026,7 +8028,7 @@ if test "${enable_pth+set}" = set; then enableval="$enable_pth" if test x$enableval = xyes; then echo $ac_n "checking for pth_init in -lpth""... $ac_c" 1>&6 -echo "configure:8030: checking for pth_init in -lpth" >&5 +echo "configure:8032: checking for pth_init in -lpth" >&5 ac_lib_var=`echo pth'_'pth_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8034,7 +8036,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpth $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8073,7 +8075,7 @@ else fi cat > conftest.$ac_ext < EOF @@ -8099,7 +8101,7 @@ if test "${enable_st+set}" = set; then enableval="$enable_st" if test x$enableval = xyes; then echo $ac_n "checking for st_init in -lst""... $ac_c" 1>&6 -echo "configure:8103: checking for st_init in -lst" >&5 +echo "configure:8105: checking for st_init in -lst" >&5 ac_lib_var=`echo st'_'st_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8107,7 +8109,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lst $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8146,7 +8148,7 @@ else fi cat > conftest.$ac_ext < EOF @@ -8300,6 +8302,8 @@ PLUGIN_PATH="${ac_tool_prefix}/share/videolan" + + @@ -8539,6 +8543,7 @@ s%@LIB_KDE@%$LIB_KDE%g s%@LIB_LIRC@%$LIB_LIRC%g s%@LIB_MACOSX@%$LIB_MACOSX%g s%@LIB_MAD@%$LIB_MAD%g +s%@LIB_MEMCPYALTIVEC@%$LIB_MEMCPYALTIVEC%g s%@LIB_MOTIONALTIVEC@%$LIB_MOTIONALTIVEC%g s%@LIB_MPEG_TS@%$LIB_MPEG_TS%g s%@LIB_NCURSES@%$LIB_NCURSES%g @@ -8565,6 +8570,7 @@ s%@CFLAGS_KDE@%$CFLAGS_KDE%g s%@CFLAGS_IDCTALTIVEC@%$CFLAGS_IDCTALTIVEC%g s%@CFLAGS_MACOSX@%$CFLAGS_MACOSX%g s%@CFLAGS_MAD@%$CFLAGS_MAD%g +s%@CFLAGS_MEMCPYALTIVEC@%$CFLAGS_MEMCPYALTIVEC%g s%@CFLAGS_MOTIONALTIVEC@%$CFLAGS_MOTIONALTIVEC%g s%@CFLAGS_OPTIM@%$CFLAGS_OPTIM%g s%@CFLAGS_OPTIM_NODEBUG@%$CFLAGS_OPTIM_NODEBUG%g diff --git a/configure.in b/configure.in index 514313610e..4130a021ef 100644 --- a/configure.in +++ b/configure.in @@ -383,7 +383,7 @@ THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn" if test x$SYS != xmingw32; then SSE_MODULES="imdctsse downmixsse" fi -ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec" +ALTIVEC_MODULES="idctaltivec motionaltivec" AC_CACHE_CHECK([if \$CC groks MMX inline assembly], [ac_cv_mmx_inline], @@ -461,8 +461,9 @@ if test x"$ac_cv_c_altivec" != x"no"; then AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C altivec extensions.) CFLAGS_IDCTALTIVEC="$CFLAGS_IDCTALTIVEC $ac_cv_c_altivec" CFLAGS_MOTIONALTIVEC="$CFLAGS_MOTIONALTIVEC $ac_cv_c_altivec" + CFLAGS_MEMCPYALTIVEC="$CFLAGS_MEMCPYALTIVEC $ac_cv_c_altivec" CFLAGS_VLC="$CFLAGS_VLC $ac_cv_c_altivec" - ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}" + ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES} memcpyaltivec" fi AC_CACHE_CHECK([if linker needs -framework vecLib], @@ -475,6 +476,7 @@ AC_CACHE_CHECK([if linker needs -framework vecLib], if test x"$ac_cv_ld_altivec" != x"no"; then LIB_IDCTALTIVEC="${LIB_IDCTALTIVEC} -framework vecLib" LIB_MOTIONALTIVEC="${LIB_MOTIONALTIVEC} -framework vecLib" + LIB_MEMCPYALTIVEC="${LIB_MEMCPYALTIVEC} -framework vecLib" LIB_VLC="${LIB_VLC} -framework vecLib" fi fi # end if mingw32 @@ -1458,6 +1460,7 @@ AC_SUBST(LIB_KDE) AC_SUBST(LIB_LIRC) AC_SUBST(LIB_MACOSX) AC_SUBST(LIB_MAD) +AC_SUBST(LIB_MEMCPYALTIVEC) AC_SUBST(LIB_MOTIONALTIVEC) AC_SUBST(LIB_MPEG_TS) AC_SUBST(LIB_NCURSES) @@ -1486,6 +1489,7 @@ AC_SUBST(CFLAGS_KDE) AC_SUBST(CFLAGS_IDCTALTIVEC) AC_SUBST(CFLAGS_MACOSX) AC_SUBST(CFLAGS_MAD) +AC_SUBST(CFLAGS_MEMCPYALTIVEC) AC_SUBST(CFLAGS_MOTIONALTIVEC) AC_SUBST(CFLAGS_OPTIM) AC_SUBST(CFLAGS_OPTIM_NODEBUG) diff --git a/plugins/memcpy/Makefile b/plugins/memcpy/Makefile index 4bc33ee191..ed9ee32d80 100644 --- a/plugins/memcpy/Makefile +++ b/plugins/memcpy/Makefile @@ -2,4 +2,4 @@ memcpy_SOURCES = memcpy.c memcpymmx_SOURCES = memcpy.c memcpymmxext_SOURCES = memcpy.c memcpy3dn_SOURCES = memcpy.c -memcpyaltivec_SOURCES = memcpy.c +memcpyaltivec_SOURCES = memcpyaltivec.c diff --git a/plugins/memcpy/fastmemcpy.h b/plugins/memcpy/fastmemcpy.h index 5d491421c0..15e77b80e7 100644 --- a/plugins/memcpy/fastmemcpy.h +++ b/plugins/memcpy/fastmemcpy.h @@ -1,12 +1,11 @@ /***************************************************************************** * fastmemcpy.h : fast memcpy routines ***************************************************************************** - * $Id: fastmemcpy.h,v 1.2 2002/04/02 22:16:07 massiot Exp $ + * $Id: fastmemcpy.h,v 1.3 2002/04/03 22:36:50 massiot Exp $ * * Authors: various Linux kernel hackers * various MPlayer hackers * Nick Kurshev - * Christophe Massiot (Altivec) * * 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 @@ -383,71 +382,3 @@ void * _M( fast_memcpy )(void * to, const void * from, size_t len) #endif /* #if defined( HAVE_MMX2 ) || defined( HAVE_3DNOW ) || defined( HAVE_MMX ) */ - -#ifdef HAVE_ALTIVEC -# 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 -#undef MMREG_SIZE -#define MMREG_SIZE 16 - -void * _M( fast_memcpy )(void * _to, const void * _from, size_t len) -{ - void * retval = _to; - u8 * to = (u8 *)_to; - u8 * from = (u8 *)_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; - memcpy(to, from, delta); - to += delta; - 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 ); - do - { - 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; - } while( len & ~(MMREG_SIZE-1) ); - vec_st( tmp, 0, to ); - } - } - - if( len ) - { - memcpy( to, from, len ); - } - - return retval; -} - -# endif -#endif diff --git a/plugins/memcpy/memcpy.c b/plugins/memcpy/memcpy.c index 84e0aca10c..c2c5290575 100644 --- a/plugins/memcpy/memcpy.c +++ b/plugins/memcpy/memcpy.c @@ -2,7 +2,7 @@ * memcpy.c : classic memcpy module ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: memcpy.c,v 1.6 2002/04/02 22:16:07 massiot Exp $ + * $Id: memcpy.c,v 1.7 2002/04/03 22:36:50 massiot Exp $ * * Authors: Samuel Hocevar * @@ -45,9 +45,6 @@ #elif defined( MODULE_NAME_IS_memcpymmxext ) # define HAVE_MMX2 # include "fastmemcpy.h" -#elif defined( MODULE_NAME_IS_memcpyaltivec ) -# define HAVE_ALTIVEC -# include "fastmemcpy.h" #endif /***************************************************************************** @@ -91,12 +88,6 @@ MODULE_INIT_START ADD_REQUIREMENT( MMXEXT ) ADD_SHORTCUT( "mmxext" ) ADD_SHORTCUT( "memcpymmxext" ) -#elif defined( MODULE_NAME_IS_memcpyaltivec ) - SET_DESCRIPTION( "Altivec memcpy module" ) - ADD_CAPABILITY( MEMCPY, 100 ) - ADD_REQUIREMENT( ALTIVEC ) - ADD_SHORTCUT( "altivec" ) - ADD_SHORTCUT( "memcpyaltivec" ) #endif MODULE_INIT_STOP diff --git a/plugins/memcpy/memcpyaltivec.c b/plugins/memcpy/memcpyaltivec.c new file mode 100644 index 0000000000..5918ad7791 --- /dev/null +++ b/plugins/memcpy/memcpyaltivec.c @@ -0,0 +1,140 @@ +/***************************************************************************** + * memcpy.c : classic memcpy module + ***************************************************************************** + * Copyright (C) 2001 VideoLAN + * $Id: memcpyaltivec.c,v 1.1 2002/04/03 22:36:50 massiot Exp $ + * + * Authors: Christophe Massiot + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +#ifndef __BUILD_ALTIVEC_ASM__ + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include +#include + +#include + +/***************************************************************************** + * Local and extern prototypes. + *****************************************************************************/ +static void memcpy_getfunctions( function_list_t * p_function_list ); +void * _M( fast_memcpy ) ( void * to, const void * from, size_t len ); + +/***************************************************************************** + * Build configuration tree. + *****************************************************************************/ +MODULE_CONFIG_START +MODULE_CONFIG_STOP + +MODULE_INIT_START + SET_DESCRIPTION( "Altivec memcpy module" ) + ADD_CAPABILITY( MEMCPY, 100 ) + ADD_REQUIREMENT( ALTIVEC ) + ADD_SHORTCUT( "altivec" ) + ADD_SHORTCUT( "memcpyaltivec" ) +MODULE_INIT_STOP + +MODULE_ACTIVATE_START + memcpy_getfunctions( &p_module->p_functions->memcpy ); +MODULE_ACTIVATE_STOP + +MODULE_DEACTIVATE_START +MODULE_DEACTIVATE_STOP + +/* Following functions are local */ + +/***************************************************************************** + * Functions exported as capabilities. They are declared as static so that + * we don't pollute the namespace too much. + *****************************************************************************/ +static void memcpy_getfunctions( function_list_t * p_function_list ) +{ + p_function_list->functions.memcpy.pf_memcpy = _M( fast_memcpy ); +} + +#else +# include +# define _M( toto ) toto +#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 + +void * _M( 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; + memcpy(to, from, delta); + to += delta; + 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 ); + do + { + 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; + } while( len & ~(MMREG_SIZE-1) ); + vec_st( tmp, 0, to ); + } + } + + if( len ) + { + memcpy( to, from, len ); + } + + return retval; +} + +#endif -- 2.39.2