[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Sun Jun 21 01:59:26 UTC 2020


The branch, master has been updated
       via  c5d502dc When fetching gen files, make sure aclocal.m4 is older than configure files.
       via  1629b803 More asm improvements
       via  29c7a455 Include more SIMD test code to weed out older compilers.
       via  b7dc2ca2 Decouple the MD5 asm code from the simd enabling.
       via  f525f2c8 Remove asm type & size.
       via  1b5819ef Use AC_RUN_IFELSE() to make sure we can run the cpp test program.
       via  a56a0bc7 Mention how to turn off simd near the cpp compile.
       via  bd7bd5ff Simplify some escaping.
      from  f9aece89 Change SIMD test to use a compile check.

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c5d502dc5f463828d0cb4e28e1a72332124aebd1
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 20 18:46:16 2020 -0700

    When fetching gen files, make sure aclocal.m4 is older than configure files.

commit 1629b803cbc705814268fa07a0fa1737ba8deec5
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 20 18:21:27 2020 -0700

    More asm improvements
    
    - Only use the asm code if we're on x86_64.
    - More changes to decouple asm from simd.
    - Check if the -Wa,--noexecstack option works.
    - Support --disable-asm configure option.

commit 29c7a4558a55a5f018b92794b6b689471d2172cf
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 20 17:36:13 2020 -0700

    Include more SIMD test code to weed out older compilers.

commit b7dc2ca25c60119a7b0b15dde822c48627c629f8
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 20 17:01:25 2020 -0700

    Decouple the MD5 asm code from the simd enabling.

commit f525f2c818fe49f62ec92f6e87b27615cf88ac8d
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 20 16:54:24 2020 -0700

    Remove asm type & size.

commit 1b5819efbd59abc9e18973080f6c829441470017
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 20 14:40:56 2020 -0700

    Use AC_RUN_IFELSE() to make sure we can run the cpp test program.

commit a56a0bc7d6f1e2f559e389801a6bed4dcc22bb4d
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 20 11:53:22 2020 -0700

    Mention how to turn off simd near the cpp compile.

commit bd7bd5ff0c5cdaa3923d1a741c68242817f5cb44
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 20 11:35:56 2020 -0700

    Simplify some escaping.

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in          |  8 ++++---
 configure.ac         | 61 ++++++++++++++++++++++++++++++++++++++++++++++------
 lib/md5-asm-x86_64.S | 12 -----------
 lib/md5.c            |  4 ++--
 prepare-source       | 10 +++++----
 5 files changed, 68 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 235b01dc..f52976e9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -32,7 +32,8 @@ VERSION=@RSYNC_VERSION@
 .SUFFIXES:
 .SUFFIXES: .c .o
 
-SIMD_x86_64=simd-checksum-x86_64.o lib/md5-asm-x86_64.o
+SIMD_x86_64=simd-checksum-x86_64.o
+ASM_x86_64=lib/md5-asm-x86_64.o
 
 GENFILES=configure.sh aclocal.m4 config.h.in proto.h proto.h-tstamp rsync.1 rsync.1.html \
 	 rsync-ssl.1 rsync-ssl.1.html rsyncd.conf.5 rsyncd.conf.5.html
@@ -46,7 +47,7 @@ OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
 	util.o util2.o main.o checksum.o match.o syscall.o log.o backup.o delete.o
 OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
 	fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
-OBJS3=progress.o pipe.o
+OBJS3=progress.o pipe.o @ASM@
 DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
 popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
 	popt/popthelp.o popt/poptparse.o
@@ -132,10 +133,11 @@ rounding.h: rounding.c rsync.h proto.h
 	@rm -f rounding.out
 
 simd-checksum-x86_64.o: simd-checksum-x86_64.cpp
+	@echo "If this fails to compile and you can't fix it, re-run $(srcdir)/configure with --disable-simd."
 	$(CXX) -I. $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $(srcdir)/simd-checksum-x86_64.cpp
 
 lib/md5-asm-x86_64.o: lib/md5-asm-x86_64.S config.h lib/md-defines.h
-	$(CC) -I. -Wa,--noexecstack -c -o $@ $(srcdir)/lib/md5-asm-x86_64.S
+	$(CC) -I. @NOEXECSTACK@ -c -o $@ $(srcdir)/lib/md5-asm-x86_64.S
 
 tls$(EXEEXT): $(TLS_OBJ)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
diff --git a/configure.ac b/configure.ac
index ea360e96..c99fe076 100644
--- a/configure.ac
+++ b/configure.ac
@@ -204,12 +204,26 @@ if test x"$enable_simd" != x"no"; then
     # For x86-64 SIMD, g++ >=5 or clang++ >=7 is required
     if test x"$build_cpu" = x"x86_64"; then
 	AC_LANG(C++)
-	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
+	AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
 #include <immintrin.h>
-__attribute__ ((target("default"))) static int testing(int x) { return x; }
-__attribute__ ((target("sse3"))) static int testing(int x) { return x; }
-__attribute__ ((target("sse2"))) static int testing(int x) { return x; }
-]], [[if (testing(42)) printf("HERE\n");]])],[CXX_OK=yes],[CXX_OK=no])
+__attribute__ ((target("default"))) int test_ssse3(int x) { return x; }
+__attribute__ ((target("default"))) int test_sse2(int x) { return x; }
+__attribute__ ((target("default"))) int test_avx2(int x) { return x; }
+__attribute__ ((target("ssse3"))) int test_ssse3(int x) { return x; }
+__attribute__ ((target("sse2"))) int test_sse2(int x) { return x; }
+__attribute__ ((target("avx2"))) int test_avx2(int x) { return x; }
+typedef long long __m128i_u __attribute__((__vector_size__(16), __may_alias__, __aligned__(1)));
+typedef long long __m256i_u __attribute__((__vector_size__(32), __may_alias__, __aligned__(1)));
+inline void more_testing(char* buf, int len)
+{
+    int i;
+    for (i = 0; i < (len-32); i+=32) {
+	__m128i in8_1, in8_2;
+	in8_1 = _mm_lddqu_si128((__m128i_u*)&buf[i]);
+	in8_2 = _mm_lddqu_si128((__m128i_u*)&buf[i + 16]);
+    }
+}
+]], [[if (test_ssse3(42) != 42 || test_sse2(42) != 42 || test_avx2(42) != 42) exit(1);]])],[CXX_OK=yes],[CXX_OK=no])
 	AC_LANG(C)
 	if test x"$CXX_OK" = x"yes"; then
 	    # AC_MSG_RESULT() is called below.
@@ -230,7 +244,7 @@ if test x"$SIMD" != x""; then
     SIMD=`echo "$SIMD" | sed 's/^ *//'`
     AC_MSG_RESULT([yes ($SIMD)])
     AC_DEFINE(HAVE_SIMD, 1, [Define to 1 to enable SIMD optimizations])
-    SIMD=`echo "\\\$(SIMD_$SIMD)" | sed 's/ /) $(SIMD_/g'`
+    SIMD=`echo '$(SIMD_'"$SIMD)" | sed 's/ /) $(SIMD_/g'`
     # We only use c++ for its target attribute dispatching, disable unneeded bulky features
     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-rtti"
 else
@@ -239,6 +253,41 @@ fi
 
 AC_SUBST(SIMD)
 
+AC_MSG_CHECKING([if assembler accepts noexecstack])
+OLD_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wa,--noexecstack"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[return 0;]])],
+[ NOEXECSTACK='-Wa,--noexecstack' ; AC_MSG_RESULT(yes) ],
+[ NOEXECSTACK='' ; AC_MSG_RESULT(no) ])
+CFLAGS="$OLD_CFLAGS"
+AC_SUBST(NOEXECSTACK)
+
+ASM=
+
+AC_MSG_CHECKING([whether to enable ASM optimizations])
+AC_ARG_ENABLE(asm,
+    AS_HELP_STRING([--disable-asm],[disable ASM optimizations]))
+
+if test x"$enable_asm" != x"no"; then
+    if test x"$build_cpu" = x"x86_64"; then
+	ASM="$build_cpu"
+    elif test x"$enable_asm" = x"yes"; then
+        AC_MSG_RESULT(unavailable)
+        AC_MSG_ERROR(The ASM optimizations are currently x86_64 only.
+Omit --enable-asm to continue without it.)
+    fi
+fi
+
+if test x"$ASM" != x""; then
+    AC_MSG_RESULT([yes ($ASM)])
+    AC_DEFINE(HAVE_ASM, 1, [Define to 1 to enable ASM optimizations])
+    ASM='$(ASM_'"$ASM)"
+else
+    AC_MSG_RESULT(no)
+fi
+
+AC_SUBST(ASM)
+
 # arrgh. libc in some old debian version screwed up the largefile
 # stuff, getting byte range locking wrong
 AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[
diff --git a/lib/md5-asm-x86_64.S b/lib/md5-asm-x86_64.S
index 4eb884ed..814aac59 100644
--- a/lib/md5-asm-x86_64.S
+++ b/lib/md5-asm-x86_64.S
@@ -32,14 +32,8 @@
 .text
 .align 16
 
-#ifndef __apple_build_version__
 .globl md5_process_asm
-.type md5_process_asm, at function
 md5_process_asm:
-#else
-.globl _md5_process_asm
-_md5_process_asm:
-#endif
 	push	%rbp
 	push	%rbx
 	push	%r12
@@ -699,11 +693,5 @@ _md5_process_asm:
 	pop	%rbx
 	pop	%rbp
 	ret
-#ifndef __apple_build_version__
-.L_md5_process_asm_end:
-.size md5_process_asm,.L_md5_process_asm_end-md5_process_asm
-#else
-L_md5_process_asm_end:
-#endif
 
 #endif /* !USE_OPENSSL ... */
diff --git a/lib/md5.c b/lib/md5.c
index a2eebdb0..41f158b8 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -148,7 +148,7 @@ static void md5_process(md_context *ctx, const uchar data[CSUM_CHUNK])
 	ctx->D += D;
 }
 
-#if defined(HAVE_SIMD) && (CSUM_CHUNK == 64)
+#if defined HAVE_ASM && CSUM_CHUNK == 64
 extern void md5_process_asm(md_context *ctx, const void *data, size_t num);
 #endif
 
@@ -176,7 +176,7 @@ void md5_update(md_context *ctx, const uchar *input, uint32 length)
 		left = 0;
 	}
 
-#if defined(HAVE_SIMD) && (CSUM_CHUNK == 64)
+#if defined HAVE_ASM && CSUM_CHUNK == 64
 	if (length >= CSUM_CHUNK) {
 		uint32 chunks = length / CSUM_CHUNK;
 		md5_process_asm(ctx, input, chunks);
diff --git a/prepare-source b/prepare-source
index 3e4f9edf..14ec1b69 100755
--- a/prepare-source
+++ b/prepare-source
@@ -25,15 +25,17 @@ for action in "${@}"; do
     build|make)
 	(cd $dir && make -f prepare-source.mak)
 	;;
-    fetch)
+    fetch|fetchgen)
 	$dir/rsync-ssl -iip --no-motd rsync://download.samba.org/rsyncftp/generated-files/'[ca]*' $dir
-	if ! perl --version >/dev/null 2>/dev/null; then
+	if test "$action" = fetchgen; then
+	    $dir/rsync-ssl -iip --no-motd rsync://download.samba.org/rsyncftp/generated-files/'[^ca]*' .
+	elif ! perl --version >/dev/null 2>/dev/null; then
 	    $dir/rsync-ssl -iip --no-motd rsync://download.samba.org/rsyncftp/generated-files/'p*' .
 	fi
+	sleep 1 # The following files need to be newer than aclocal.m4
+	touch configure.sh config.h.in
 	;;
     fetchgen)
-	$dir/rsync-ssl -iip --no-motd rsync://download.samba.org/rsyncftp/generated-files/'[ca]*' $dir
-	$dir/rsync-ssl -iip --no-motd rsync://download.samba.org/rsyncftp/generated-files/'[^ca]*' .
 	;;
     fetchSRC)
 	./rsync-ssl -iipr --no-motd --exclude=/.git/ rsync://download.samba.org/ftp/pub/unpacked/rsync/ .


-- 
The rsync repository.



More information about the rsync-cvs mailing list