[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r11348 - in /fsf/trunk/libc: ./ posix/ scripts/ sunrpc/ sysdeps/i386/i686/multiarch/ sysdeps/x86_64/multiarch/
- To: commits@xxxxxxxxxx
- Subject: [commits] r11348 - in /fsf/trunk/libc: ./ posix/ scripts/ sunrpc/ sysdeps/i386/i686/multiarch/ sysdeps/x86_64/multiarch/
- From: eglibc@xxxxxxxxxx
- Date: Wed, 25 Aug 2010 07:03:08 -0000
Author: eglibc
Date: Wed Aug 25 00:03:07 2010
New Revision: 11348
Log:
Import glibc-mainline for 2010-08-25
Added:
fsf/trunk/libc/scripts/config-uname.sh (with props)
fsf/trunk/libc/sysdeps/i386/i686/multiarch/varshift.S
fsf/trunk/libc/sysdeps/i386/i686/multiarch/varshift.h
fsf/trunk/libc/sysdeps/x86_64/multiarch/varshift.S
fsf/trunk/libc/sysdeps/x86_64/multiarch/varshift.h
Removed:
fsf/trunk/libc/config-name.in
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/configure
fsf/trunk/libc/configure.in
fsf/trunk/libc/posix/Makefile
fsf/trunk/libc/sunrpc/rpc_parse.h
fsf/trunk/libc/sysdeps/i386/i686/multiarch/Makefile
fsf/trunk/libc/sysdeps/x86_64/multiarch/Makefile
fsf/trunk/libc/sysdeps/x86_64/multiarch/strcspn-c.c
fsf/trunk/libc/sysdeps/x86_64/multiarch/strspn-c.c
fsf/trunk/libc/sysdeps/x86_64/multiarch/strstr.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Aug 25 00:03:07 2010
@@ -1,3 +1,31 @@
+2010-08-24 Roland McGrath <roland@xxxxxxxxxx>
+
+ * configure.in: Remove config-name.h generation.
+ * configure: Regenerated.
+ * config-name.in: File removed.
+ * scripts/config-uname.sh: New file.
+ * posix/Makefile (uname.c): Depend on $(objdir)config-name.h.
+ ($(objdir)config-name.h): New target.
+
+ * sunrpc/rpc_parse.h: Avoid nested comment.
+
+2010-08-24 Richard Henderson <rth@xxxxxxxxxx>
+ Ulrich Drepper <drepper@xxxxxxxxxx>
+ H.J. Lu <hongjiu.lu@xxxxxxxxx>
+
+ * sysdeps/i386/i686/multiarch/Makefile (sysdep_routines): Add varshift.
+ * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Likewise.
+ * sysdeps/x86_64/multiarch/strcspn-c.c: Include "varshift.h".
+ Replace _mm_srli_si128 with __m128i_shift_right. Replace
+ _mm_alignr_epi8 with _mm_loadu_si128.
+ * sysdeps/x86_64/multiarch/strspn-c.c: Likewise.
+ * sysdeps/x86_64/multiarch/strstr.c: Include "varshift.h".
+ (__m128i_shift_right): Removed.
+ * sysdeps/i386/i686/multiarch/varshift.h: New file.
+ * sysdeps/i386/i686/multiarch/varshift.S: New file.
+ * sysdeps/x86_64/multiarch/varshift.h: New file.
+ * sysdeps/x86_64/multiarch/varshift.S: New file.
+
2010-08-21 Mike Frysinger <vapier@xxxxxxxxxx>
* configure.in: Move assembler checks to before sysdep dir checking.
Modified: fsf/trunk/libc/configure
==============================================================================
--- fsf/trunk/libc/configure (original)
+++ fsf/trunk/libc/configure Wed Aug 25 00:03:07 2010
@@ -623,9 +623,6 @@
libc_cv_localedir
libc_cv_slibdir
old_glibc_headers
-uname_version
-uname_release
-uname_sysname
libc_cv_gcc_unwind_find_fde
sizeof_long_double
EGREP
@@ -7746,8 +7743,7 @@
libc_cv_idn=no
# Iterate over all the sysdep directories we will use, running their
-# configure fragments, and looking for a uname implementation.
-uname=
+# configure fragments.
for dir in $sysnames; do
case $dir in
/*) dest=$dir ;;
@@ -7758,15 +7754,6 @@
$as_echo "running configure fragment for $dir" >&6; }
. $dest/configure
fi
-
- if test -z "$uname"; then
- if test -r $dest/uname.c ||
- test -r $dest/uname.S ||
- { test -r $dest/syscalls.list &&
- grep '^uname[ ]' $dest/syscalls.list >/dev/null; }; then
- uname=$dir
- fi
- fi
done
if test x$libc_cv_gcc_unwind_find_fde = xyes; then
@@ -7774,75 +7761,6 @@
fi
-
-# If we will use the generic uname implementation, we must figure out what
-# it will say by examining the system, and write the results in config-name.h.
-if test "$uname" = "sysdeps/generic"; then
-
- uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
- if test $uname_sysname != $config_os; then
- config_release=`echo $config_os | sed s/$uname_sysname//`
- fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking OS release for uname" >&5
-$as_echo_n "checking OS release for uname... " >&6; }
-if test "${libc_cv_uname_release+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- if test -r /vmunix; then
- kernel_id=`strings /vmunix | grep UNIX`
- elif test -r /dynix; then
- kernel_id=`strings /dynix | grep DYNIX`
- else
- kernel_id=
- fi
-
- kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
- if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
- != x$config_release; then
- # The configuration release is a substring of the kernel release.
- libc_cv_uname_release=$kernel_release
- elif test x$config_release != x; then
- libc_cv_uname_release=$config_release
- elif test x$kernel_release != x; then
- libc_cv_uname_release=$kernel_release
- else
- libc_cv_uname_release=unknown
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_uname_release" >&5
-$as_echo "$libc_cv_uname_release" >&6; }
- uname_release="$libc_cv_uname_release"
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking OS version for uname" >&5
-$as_echo_n "checking OS version for uname... " >&6; }
-if test "${libc_cv_uname_version+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- if test -r /vmunix; then
- kernel_id=`strings /vmunix | grep UNIX`
- elif test -r /dynix; then
- kernel_id=`strings /dynix | grep DYNIX`
- else
- kernel_id=
- fi
-
- kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
- if test -n "$kernel_version"; then
- libc_cv_uname_version="$kernel_version"
- else
- libc_cv_uname_version=unknown
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_uname_version" >&5
-$as_echo "$libc_cv_uname_version" >&6; }
- uname_version="$libc_cv_uname_version"
-
- config_uname=config-name.h:config-name.in
-else
- # For non-generic uname, we don't need to create config-name.h at all.
- config_uname=
-fi
$as_echo "#define USE_IN_LIBIO 1" >>confdefs.h
@@ -7938,7 +7856,7 @@
-ac_config_files="$ac_config_files config.make ${config_makefile} ${config_uname}"
+ac_config_files="$ac_config_files config.make ${config_makefile}"
ac_config_commands="$ac_config_commands default"
@@ -8640,7 +8558,6 @@
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"config.make") CONFIG_FILES="$CONFIG_FILES config.make" ;;
"${config_makefile}") CONFIG_FILES="$CONFIG_FILES ${config_makefile}" ;;
- "${config_uname}") CONFIG_FILES="$CONFIG_FILES ${config_uname}" ;;
"default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
Modified: fsf/trunk/libc/configure.in
==============================================================================
--- fsf/trunk/libc/configure.in (original)
+++ fsf/trunk/libc/configure.in Wed Aug 25 00:03:07 2010
@@ -2192,8 +2192,7 @@
libc_cv_idn=no
# Iterate over all the sysdep directories we will use, running their
-# configure fragments, and looking for a uname implementation.
-uname=
+# configure fragments.
for dir in $sysnames; do
case $dir in
/*) dest=$dir ;;
@@ -2203,80 +2202,12 @@
AC_MSG_RESULT(running configure fragment for $dir)
. $dest/configure
fi
-[
- if test -z "$uname"; then
- if test -r $dest/uname.c ||
- test -r $dest/uname.S ||
- { test -r $dest/syscalls.list &&
- grep '^uname[ ]' $dest/syscalls.list >/dev/null; }; then
- uname=$dir
- fi
- fi
-]dnl
done
if test x$libc_cv_gcc_unwind_find_fde = xyes; then
AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
fi
AC_SUBST(libc_cv_gcc_unwind_find_fde)
-
-# If we will use the generic uname implementation, we must figure out what
-# it will say by examining the system, and write the results in config-name.h.
-if test "$uname" = "sysdeps/generic"; then
-
-changequote(,)dnl
- uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
-changequote([,])dnl
- if test $uname_sysname != $config_os; then
- config_release=`echo $config_os | sed s/$uname_sysname//`
- fi
-dnl
-AC_DEFUN(LIBC_KERNEL_ID, [dnl
- if test -r /vmunix; then
- kernel_id=`strings /vmunix | grep UNIX`
- elif test -r /dynix; then
- kernel_id=`strings /dynix | grep DYNIX`
- else
- kernel_id=
- fi
-])dnl
-
- AC_CACHE_CHECK(OS release for uname, libc_cv_uname_release, [dnl
-LIBC_KERNEL_ID
-changequote(,)dnl
- kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
-changequote([,])dnl
- if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
- != x$config_release; then
- # The configuration release is a substring of the kernel release.
- libc_cv_uname_release=$kernel_release
- elif test x$config_release != x; then
- libc_cv_uname_release=$config_release
- elif test x$kernel_release != x; then
- libc_cv_uname_release=$kernel_release
- else
- libc_cv_uname_release=unknown
- fi])
- uname_release="$libc_cv_uname_release"
-
- AC_CACHE_CHECK(OS version for uname, libc_cv_uname_version, [dnl
-LIBC_KERNEL_ID
-changequote(,)dnl
- kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
-changequote([,])dnl
- if test -n "$kernel_version"; then
- libc_cv_uname_version="$kernel_version"
- else
- libc_cv_uname_version=unknown
- fi])
- uname_version="$libc_cv_uname_version"
-
-AC_SUBST(uname_sysname) AC_SUBST(uname_release) AC_SUBST(uname_version)dnl
- config_uname=config-name.h:config-name.in
-else
- # For non-generic uname, we don't need to create config-name.h at all.
- config_uname=
-fi
dnl This is tested by existing code and it's simpler to avoid changing it.
AC_DEFINE(USE_IN_LIBIO)
@@ -2361,7 +2292,7 @@
AC_SUBST(VERSION)
AC_SUBST(RELEASE)
-AC_CONFIG_FILES([config.make ${config_makefile} ${config_uname}])
+AC_CONFIG_FILES([config.make ${config_makefile}])
AC_CONFIG_COMMANDS([default],[[
case $CONFIG_FILES in *config.make*)
echo "$config_vars" >> config.make;;
Modified: fsf/trunk/libc/posix/Makefile
==============================================================================
--- fsf/trunk/libc/posix/Makefile (original)
+++ fsf/trunk/libc/posix/Makefile Wed Aug 25 00:03:07 2010
@@ -138,6 +138,14 @@
$(rtld-installed-name)
endif
endif
+
+# If we will use the generic uname implementation, we must figure out what
+# it will say by examining the system, and write the results in config-name.h.
+uname.c: $(objpfx)config-name.h
+$(objpfx)config-name.h: $(..)scripts/config-uname.sh $(common-objpfx)config.make
+ $< '$(config-os)' '$(config-release)' \
+ '$(config-machine)-$(config-vendor)' > $@.new
+ mv -f $@.new $@
CFLAGS-regex.c = -Wno-strict-prototypes
CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions -DUSE_NSCD
Added: fsf/trunk/libc/scripts/config-uname.sh
==============================================================================
--- fsf/trunk/libc/scripts/config-uname.sh (added)
+++ fsf/trunk/libc/scripts/config-uname.sh Wed Aug 25 00:03:07 2010
@@ -1,0 +1,50 @@
+#!/bin/sh
+
+config_os=$1
+config_release=$2
+uname_machine=$3
+
+uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
+if test $uname_sysname != $config_os; then
+ config_release=`echo $config_os | sed s/$uname_sysname//`
+fi
+
+if test -r /vmunix; then
+ kernel_id=`strings /vmunix | grep UNIX`
+elif test -r /dynix; then
+ kernel_id=`strings /dynix | grep DYNIX`
+else
+ kernel_id=
+fi
+
+kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
+if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
+ != x$config_release; then
+ # The configuration release is a substring of the kernel release.
+ uname_release=$kernel_release
+elif test x$config_release != x; then
+ uname_release=$config_release
+elif test x$kernel_release != x; then
+ uname_release=$kernel_release
+else
+ uname_release=unknown
+fi
+
+kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
+if test -n "$kernel_version"; then
+ uname_version="$kernel_version"
+else
+ uname_version=unknown
+fi
+
+cat <<EOF
+/* This file is generated by $0. DO NOT EDIT.
+
+ This is used only by the generic uname function for systems with no real
+ uname call. If this data is not correct, it does not matter much. */
+
+#define UNAME_SYSNAME "$uname_sysname"
+#define UNAME_RELEASE "$uname_release"
+#define UNAME_VERSION "$uname_version"
+#define UNAME_MACHINE "$uname_machine"
+EOF
Propchange: fsf/trunk/libc/scripts/config-uname.sh
------------------------------------------------------------------------------
svn:executable = *
Modified: fsf/trunk/libc/sunrpc/rpc_parse.h
==============================================================================
--- fsf/trunk/libc/sunrpc/rpc_parse.h (original)
+++ fsf/trunk/libc/sunrpc/rpc_parse.h Wed Aug 25 00:03:07 2010
@@ -1,6 +1,5 @@
/* @(#)rpc_parse.h 1.3 90/08/29
-
-/*
+ *
* Copyright (c) 2010, Oracle America, Inc.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Modified: fsf/trunk/libc/sysdeps/i386/i686/multiarch/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/Makefile (original)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/Makefile Wed Aug 25 00:03:07 2010
@@ -9,7 +9,7 @@
memmove-ssse3-rep bcopy-ssse3 bcopy-ssse3-rep \
memset-sse2-rep bzero-sse2-rep strcmp-ssse3 \
strcmp-sse4 strncmp-c strncmp-ssse3 strncmp-sse4 \
- memcmp-ssse3 memcmp-sse4 strcasestr-nonascii
+ memcmp-ssse3 memcmp-sse4 strcasestr-nonascii varshift
ifeq (yes,$(config-cflags-sse4))
sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c
CFLAGS-strcspn-c.c += -msse4
Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/varshift.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/varshift.S (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/varshift.S Wed Aug 25 00:03:07 2010
@@ -1,0 +1,1 @@
+#include <sysdeps/x86_64/multiarch/varshift.S>
Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/varshift.h
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/varshift.h (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/varshift.h Wed Aug 25 00:03:07 2010
@@ -1,0 +1,1 @@
+#include <sysdeps/x86_64/multiarch/varshift.h>
Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/Makefile (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/Makefile Wed Aug 25 00:03:07 2010
@@ -10,7 +10,7 @@
memmove-ssse3-back strcasestr-nonascii strcasecmp_l-ssse3 \
strncase_l-ssse3
ifeq (yes,$(config-cflags-sse4))
-sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c
+sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c varshift
CFLAGS-strcspn-c.c += -msse4
CFLAGS-strpbrk-c.c += -msse4
CFLAGS-strspn-c.c += -msse4
Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/strcspn-c.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/strcspn-c.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/strcspn-c.c Wed Aug 25 00:03:07 2010
@@ -1,5 +1,5 @@
/* strcspn with SSE4.2 intrinsics
- Copyright (C) 2009 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -20,6 +20,7 @@
#include <nmmintrin.h>
#include <string.h>
+#include "varshift.h"
/* We use 0x2:
_SIDD_SBYTE_OPS
@@ -86,8 +87,6 @@
const char *aligned;
__m128i mask;
- /* Fake initialization. gcc otherwise will warn. */
- asm ("" : "=xm" (mask));
int offset = (int) ((size_t) a & 15);
if (offset != 0)
{
@@ -95,54 +94,7 @@
aligned = (const char *) ((size_t) a & -16L);
__m128i mask0 = _mm_load_si128 ((__m128i *) aligned);
- switch (offset)
- {
- case 1:
- mask = _mm_srli_si128 (mask0, 1);
- break;
- case 2:
- mask = _mm_srli_si128 (mask0, 2);
- break;
- case 3:
- mask = _mm_srli_si128 (mask0, 3);
- break;
- case 4:
- mask = _mm_srli_si128 (mask0, 4);
- break;
- case 5:
- mask = _mm_srli_si128 (mask0, 5);
- break;
- case 6:
- mask = _mm_srli_si128 (mask0, 6);
- break;
- case 7:
- mask = _mm_srli_si128 (mask0, 7);
- break;
- case 8:
- mask = _mm_srli_si128 (mask0, 8);
- break;
- case 9:
- mask = _mm_srli_si128 (mask0, 9);
- break;
- case 10:
- mask = _mm_srli_si128 (mask0, 10);
- break;
- case 11:
- mask = _mm_srli_si128 (mask0, 11);
- break;
- case 12:
- mask = _mm_srli_si128 (mask0, 12);
- break;
- case 13:
- mask = _mm_srli_si128 (mask0, 13);
- break;
- case 14:
- mask = _mm_srli_si128 (mask0, 14);
- break;
- case 15:
- mask = _mm_srli_si128 (mask0, 15);
- break;
- }
+ mask = __m128i_shift_right (mask0, offset);
/* Find where the NULL terminator is. */
int length = _mm_cmpistri (mask, mask, 0x3a);
@@ -159,55 +111,10 @@
if (index != 0)
{
- /* Combine mask0 and mask1. */
- switch (offset)
- {
- case 1:
- mask = _mm_alignr_epi8 (mask1, mask0, 1);
- break;
- case 2:
- mask = _mm_alignr_epi8 (mask1, mask0, 2);
- break;
- case 3:
- mask = _mm_alignr_epi8 (mask1, mask0, 3);
- break;
- case 4:
- mask = _mm_alignr_epi8 (mask1, mask0, 4);
- break;
- case 5:
- mask = _mm_alignr_epi8 (mask1, mask0, 5);
- break;
- case 6:
- mask = _mm_alignr_epi8 (mask1, mask0, 6);
- break;
- case 7:
- mask = _mm_alignr_epi8 (mask1, mask0, 7);
- break;
- case 8:
- mask = _mm_alignr_epi8 (mask1, mask0, 8);
- break;
- case 9:
- mask = _mm_alignr_epi8 (mask1, mask0, 9);
- break;
- case 10:
- mask = _mm_alignr_epi8 (mask1, mask0, 10);
- break;
- case 11:
- mask = _mm_alignr_epi8 (mask1, mask0, 11);
- break;
- case 12:
- mask = _mm_alignr_epi8 (mask1, mask0, 12);
- break;
- case 13:
- mask = _mm_alignr_epi8 (mask1, mask0, 13);
- break;
- case 14:
- mask = _mm_alignr_epi8 (mask1, mask0, 14);
- break;
- case 15:
- mask = _mm_alignr_epi8 (mask1, mask0, 15);
- break;
- }
+ /* Combine mask0 and mask1. We could play games with
+ palignr, but frankly this data should be in L1 now
+ so do the merge via an unaligned load. */
+ mask = _mm_loadu_si128 ((__m128i *) a);
}
}
}
@@ -234,54 +141,7 @@
aligned = (const char *) ((size_t) s & -16L);
__m128i value = _mm_load_si128 ((__m128i *) aligned);
- switch (offset)
- {
- case 1:
- value = _mm_srli_si128 (value, 1);
- break;
- case 2:
- value = _mm_srli_si128 (value, 2);
- break;
- case 3:
- value = _mm_srli_si128 (value, 3);
- break;
- case 4:
- value = _mm_srli_si128 (value, 4);
- break;
- case 5:
- value = _mm_srli_si128 (value, 5);
- break;
- case 6:
- value = _mm_srli_si128 (value, 6);
- break;
- case 7:
- value = _mm_srli_si128 (value, 7);
- break;
- case 8:
- value = _mm_srli_si128 (value, 8);
- break;
- case 9:
- value = _mm_srli_si128 (value, 9);
- break;
- case 10:
- value = _mm_srli_si128 (value, 10);
- break;
- case 11:
- value = _mm_srli_si128 (value, 11);
- break;
- case 12:
- value = _mm_srli_si128 (value, 12);
- break;
- case 13:
- value = _mm_srli_si128 (value, 13);
- break;
- case 14:
- value = _mm_srli_si128 (value, 14);
- break;
- case 15:
- value = _mm_srli_si128 (value, 15);
- break;
- }
+ value = __m128i_shift_right (value, offset);
int length = _mm_cmpistri (mask, value, 0x2);
/* No need to check ZFlag since ZFlag is always 1. */
Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/strspn-c.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/strspn-c.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/strspn-c.c Wed Aug 25 00:03:07 2010
@@ -1,5 +1,5 @@
/* strspn with SSE4.2 intrinsics
- Copyright (C) 2009 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -20,6 +20,7 @@
#include <nmmintrin.h>
#include <string.h>
+#include "varshift.h"
/* We use 0x12:
_SIDD_SBYTE_OPS
@@ -71,54 +72,7 @@
aligned = (const char *) ((size_t) a & -16L);
__m128i mask0 = _mm_load_si128 ((__m128i *) aligned);
- switch (offset)
- {
- case 1:
- mask = _mm_srli_si128 (mask0, 1);
- break;
- case 2:
- mask = _mm_srli_si128 (mask0, 2);
- break;
- case 3:
- mask = _mm_srli_si128 (mask0, 3);
- break;
- case 4:
- mask = _mm_srli_si128 (mask0, 4);
- break;
- case 5:
- mask = _mm_srli_si128 (mask0, 5);
- break;
- case 6:
- mask = _mm_srli_si128 (mask0, 6);
- break;
- case 7:
- mask = _mm_srli_si128 (mask0, 7);
- break;
- case 8:
- mask = _mm_srli_si128 (mask0, 8);
- break;
- case 9:
- mask = _mm_srli_si128 (mask0, 9);
- break;
- case 10:
- mask = _mm_srli_si128 (mask0, 10);
- break;
- case 11:
- mask = _mm_srli_si128 (mask0, 11);
- break;
- case 12:
- mask = _mm_srli_si128 (mask0, 12);
- break;
- case 13:
- mask = _mm_srli_si128 (mask0, 13);
- break;
- case 14:
- mask = _mm_srli_si128 (mask0, 14);
- break;
- case 15:
- mask = _mm_srli_si128 (mask0, 15);
- break;
- }
+ mask = __m128i_shift_right (mask0, offset);
/* Find where the NULL terminator is. */
int length = _mm_cmpistri (mask, mask, 0x3a);
@@ -135,55 +89,10 @@
if (index != 0)
{
- /* Combine mask0 and mask1. */
- switch (offset)
- {
- case 1:
- mask = _mm_alignr_epi8 (mask1, mask0, 1);
- break;
- case 2:
- mask = _mm_alignr_epi8 (mask1, mask0, 2);
- break;
- case 3:
- mask = _mm_alignr_epi8 (mask1, mask0, 3);
- break;
- case 4:
- mask = _mm_alignr_epi8 (mask1, mask0, 4);
- break;
- case 5:
- mask = _mm_alignr_epi8 (mask1, mask0, 5);
- break;
- case 6:
- mask = _mm_alignr_epi8 (mask1, mask0, 6);
- break;
- case 7:
- mask = _mm_alignr_epi8 (mask1, mask0, 7);
- break;
- case 8:
- mask = _mm_alignr_epi8 (mask1, mask0, 8);
- break;
- case 9:
- mask = _mm_alignr_epi8 (mask1, mask0, 9);
- break;
- case 10:
- mask = _mm_alignr_epi8 (mask1, mask0, 10);
- break;
- case 11:
- mask = _mm_alignr_epi8 (mask1, mask0, 11);
- break;
- case 12:
- mask = _mm_alignr_epi8 (mask1, mask0, 12);
- break;
- case 13:
- mask = _mm_alignr_epi8 (mask1, mask0, 13);
- break;
- case 14:
- mask = _mm_alignr_epi8 (mask1, mask0, 14);
- break;
- case 15:
- mask = _mm_alignr_epi8 (mask1, mask0, 15);
- break;
- }
+ /* Combine mask0 and mask1. We could play games with
+ palignr, but frankly this data should be in L1 now
+ so do the merge via an unaligned load. */
+ mask = _mm_loadu_si128 ((__m128i *) a);
}
}
}
@@ -210,54 +119,7 @@
aligned = (const char *) ((size_t) s & -16L);
__m128i value = _mm_load_si128 ((__m128i *) aligned);
- switch (offset)
- {
- case 1:
- value = _mm_srli_si128 (value, 1);
- break;
- case 2:
- value = _mm_srli_si128 (value, 2);
- break;
- case 3:
- value = _mm_srli_si128 (value, 3);
- break;
- case 4:
- value = _mm_srli_si128 (value, 4);
- break;
- case 5:
- value = _mm_srli_si128 (value, 5);
- break;
- case 6:
- value = _mm_srli_si128 (value, 6);
- break;
- case 7:
- value = _mm_srli_si128 (value, 7);
- break;
- case 8:
- value = _mm_srli_si128 (value, 8);
- break;
- case 9:
- value = _mm_srli_si128 (value, 9);
- break;
- case 10:
- value = _mm_srli_si128 (value, 10);
- break;
- case 11:
- value = _mm_srli_si128 (value, 11);
- break;
- case 12:
- value = _mm_srli_si128 (value, 12);
- break;
- case 13:
- value = _mm_srli_si128 (value, 13);
- break;
- case 14:
- value = _mm_srli_si128 (value, 14);
- break;
- case 15:
- value = _mm_srli_si128 (value, 15);
- break;
- }
+ value = __m128i_shift_right (value, offset);
int length = _mm_cmpistri (mask, value, 0x12);
/* No need to check CFlag since it is always 1. */
Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/strstr.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/strstr.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/strstr.c Wed Aug 25 00:03:07 2010
@@ -19,6 +19,7 @@
02111-1307 USA. */
#include <nmmintrin.h>
+#include "varshift.h"
#ifndef STRSTR_SSE42
# define STRSTR_SSE42 __strstr_sse42
@@ -81,67 +82,6 @@
scanning
5. failed string compare, go back to scanning
*/
-
-/* Fix-up of removal of unneeded data due to 16B aligned load
- parameters:
- value: 16B data loaded from 16B aligned address.
- offset: Offset of target data address relative to 16B aligned load
- address.
- */
-
-static __inline__ __m128i
-__m128i_shift_right (__m128i value, int offset)
-{
- switch (offset)
- {
- case 1:
- value = _mm_srli_si128 (value, 1);
- break;
- case 2:
- value = _mm_srli_si128 (value, 2);
- break;
- case 3:
- value = _mm_srli_si128 (value, 3);
- break;
- case 4:
- value = _mm_srli_si128 (value, 4);
- break;
- case 5:
- value = _mm_srli_si128 (value, 5);
- break;
- case 6:
- value = _mm_srli_si128 (value, 6);
- break;
- case 7:
- value = _mm_srli_si128 (value, 7);
- break;
- case 8:
- value = _mm_srli_si128 (value, 8);
- break;
- case 9:
- value = _mm_srli_si128 (value, 9);
- break;
- case 10:
- value = _mm_srli_si128 (value, 10);
- break;
- case 11:
- value = _mm_srli_si128 (value, 11);
- break;
- case 12:
- value = _mm_srli_si128 (value, 12);
- break;
- case 13:
- value = _mm_srli_si128 (value, 13);
- break;
- case 14:
- value = _mm_srli_si128 (value, 14);
- break;
- case 15:
- value = _mm_srli_si128 (value, 15);
- break;
- }
- return value;
-}
/* Simple replacement of movdqu to address 4KB boundary cross issue.
If EOS occurs within less than 16B before 4KB boundary, we don't
Added: fsf/trunk/libc/sysdeps/x86_64/multiarch/varshift.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/varshift.S (added)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/varshift.S Wed Aug 25 00:03:07 2010
@@ -1,0 +1,30 @@
+/* Helper for variable shifts of SSE registers.
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+
+ .section .rodata
+ .hidden ___m128i_shift_right
+ .globl ___m128i_shift_right
+ .size ___m128i_shift_right, 31
+
+___m128i_shift_right:
+ .byte 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
+ .byte -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
Added: fsf/trunk/libc/sysdeps/x86_64/multiarch/varshift.h
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/varshift.h (added)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/varshift.h Wed Aug 25 00:03:07 2010
@@ -1,0 +1,27 @@
+/* Helper for variable shifts of SSE registers.
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+extern char ___m128i_shift_right[31] __attribute__ ((visibility ("hidden")));
+
+static __inline__ __m128i
+__m128i_shift_right (__m128i value, unsigned long offset)
+{
+ return _mm_shuffle_epi8 (value, _mm_loadu_si128 ((__m128 *) (___m128i_shift_right + offset)));
+}