[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r11600 - in /fsf/trunk/ports: ./ sysdeps/alpha/ sysdeps/alpha/alphaev6/ sysdeps/unix/sysv/linux/alpha/



Author: eglibc
Date: Fri Sep 24 00:04:37 2010
New Revision: 11600

Log:
Import glibc-ports-mainline for 2010-09-24

Added:
    fsf/trunk/ports/sysdeps/alpha/memchr.c
    fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/fstatfs64.c
    fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/fstatvfs.c
    fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/fstatvfs64.c
    fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/internal_statvfs64.c
    fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/statfs64.c
    fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/statvfs.c
    fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/statvfs64.c
Removed:
    fsf/trunk/ports/sysdeps/alpha/alphaev6/memchr.S
    fsf/trunk/ports/sysdeps/alpha/memchr.S
Modified:
    fsf/trunk/ports/ChangeLog.alpha
    fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/syscalls.list

Modified: fsf/trunk/ports/ChangeLog.alpha
==============================================================================
--- fsf/trunk/ports/ChangeLog.alpha (original)
+++ fsf/trunk/ports/ChangeLog.alpha Fri Sep 24 00:04:37 2010
@@ -1,3 +1,23 @@
+2010-09-23  Richard Henderson  <rth@xxxxxxxxxx>
+
+	[BZ #12019]
+	* sysdeps/alpha/alphaev6/memchr.S: Remove.
+	* sysdeps/alpha/memchr.S: Remove.
+	* sysdeps/alpha/memchr.c: New.
+
+2010-09-23  Richard Henderson  <rth@xxxxxxxxxx>
+
+	[BZ #1864]
+	* sysdeps/unix/sysv/linux/alpha/fstatfs64.c: New.
+	* sysdeps/unix/sysv/linux/alpha/fstatvfs.c: New.
+	* sysdeps/unix/sysv/linux/alpha/fstatvfs64.c: New.
+	* sysdeps/unix/sysv/linux/alpha/internal_statvfs64.c: New.
+	* sysdeps/unix/sysv/linux/alpha/statfs64.c: New.
+	* sysdeps/unix/sysv/linux/alpha/statvfs.c: New.
+	* sysdeps/unix/sysv/linux/alpha/statvfs64.c: New.
+	* sysdeps/unix/sysv/linux/alpha/syscalls.list (fstatfs, statfs):
+	Define without 64-bit aliases.
+
 2010-05-03  Aurelien Jarno  <aurelien@xxxxxxxxxxx>
  
 	* sysdeps/alpha/memchr.S: Use prefetch load.

Added: fsf/trunk/ports/sysdeps/alpha/memchr.c
==============================================================================
--- fsf/trunk/ports/sysdeps/alpha/memchr.c (added)
+++ fsf/trunk/ports/sysdeps/alpha/memchr.c Fri Sep 24 00:04:37 2010
@@ -1,0 +1,175 @@
+/* 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 <string.h>
+
+typedef unsigned long word;
+
+static inline word
+ldq_u(const void *s)
+{
+  return *(const word *)((word)s & -8);
+}
+
+#define unlikely(X)	__builtin_expect ((X), 0)
+#define prefetch(X)	__builtin_prefetch ((void *)(X), 0)
+
+#define cmpbeq0(X)	__builtin_alpha_cmpbge(0, (X))
+#define find(X, Y)	cmpbeq0 ((X) ^ (Y))
+
+/* Search no more than N bytes of S for C.  */
+
+void *
+__memchr (const void *s, int xc, size_t n)
+{
+  const word *s_align;
+  word t, current, found, mask, offset;
+
+  if (unlikely (n == 0))
+    return 0;
+
+  current = ldq_u (s);
+
+  /* Replicate low byte of XC into all bytes of C.  */
+  t = xc & 0xff;			/* 0000000c */
+  t = (t << 8) | t;			/* 000000cc */
+  t = (t << 16) | t;			/* 0000cccc */
+  const word c = (t << 32) | t;		/* cccccccc */
+
+  /* Align the source, and decrement the count by the number
+     of bytes searched in the first word.  */
+  s_align = (const word *)(s & -8);
+  n += (s & 7);
+
+  /* Deal with misalignment in the first word for the comparison.  */
+  mask = (1ul << (s & 7)) - 1;
+
+  /* If the entire string fits within one word, we may need masking
+     at both the front and the back of the string.  */
+  if (unlikely (n <= 8))
+    {
+      mask |= -1ul << n;
+      goto last_quad;
+    }
+
+  found = find (current, c) & ~mask;
+  if (unlikely (found))
+    goto found_it;
+
+  s_align++;
+  n -= 8;
+
+  /* If the block is sufficiently large, align to cacheline and prefetch.  */
+  if (unlikely (n >= 256))
+    {
+      /* Prefetch 3 cache lines beyond the one we're working on.  */
+      prefetch (s_align + 8);
+      prefetch (s_align + 16);
+      prefetch (s_align + 24);
+
+      while ((word)s_align & 63)
+	{
+	  current = *s_align;
+	  found = find (current, c);
+	  if (found)
+	    goto found_it;
+	  s_align++;
+	  n -= 8;
+	}
+
+	/* Within each cacheline, advance the load for the next word
+	   before the test for the previous word is complete.  This
+	   allows us to hide the 3 cycle L1 cache load latency.  We
+	   only perform this advance load within a cacheline to prevent
+	   reading across page boundary.  */
+#define CACHELINE_LOOP				\
+	do {					\
+	  word i, next = s_align[0];		\
+	  for (i = 0; i < 7; ++i)		\
+	    {					\
+	      current = next;			\
+	      next = s_align[1];		\
+	      found = find (current, c);	\
+	      if (unlikely (found))		\
+		goto found_it;			\
+	      s_align++;			\
+	    }					\
+	  current = next;			\
+	  found = find (current, c);		\
+	  if (unlikely (found))			\
+	    goto found_it;			\
+	  s_align++;				\
+	  n -= 64;				\
+	} while (0)
+      
+      /* While there's still lots more data to potentially be read,
+	 continue issuing prefetches for the 4th cacheline out.  */
+      while (n >= 256)
+	{
+	  prefetch (s_align + 24);
+	  CACHELINE_LOOP;
+	}
+
+      /* Up to 3 cache lines remaining.  Continue issuing advanced
+	 loads, but stop prefetching.  */
+      while (n >= 64)
+	CACHELINE_LOOP;
+
+      /* We may have exhausted the buffer.  */
+      if (n == 0)
+	return NULL;
+    }
+
+  /* Quadword aligned loop.  */
+  current = *s_align;
+  while (n > 8)
+    {
+      found = find (current, c);
+      if (unlikely (found))
+	goto found_it;
+      current = *++s_align;
+      n -= 8;
+    }
+
+  /* The last word may need masking at the tail of the compare.  */
+  mask = -1ul << n;
+ last_quad:
+  found = find (current, c) & ~mask;
+  if (found == 0)
+    return NULL;
+
+ found_it:
+#ifdef __alpha_cix__
+  offset = __builtin_alpha_cttz (found);
+#else
+  /* Extract LSB.  */
+  found &= -found;
+
+  /* Binary search for the LSB.  */
+  offset  = (found & 0x0f ? 0 : 4);
+  offset += (found & 0x33 ? 0 : 2);
+  offset += (found & 0x55 ? 0 : 1);
+#endif
+
+  return (void *)((word)s_align + offset);
+}
+
+#ifdef weak_alias
+weak_alias (__memchr, BP_SYM (memchr))
+#endif
+libc_hidden_builtin_def (memchr)

Added: fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/fstatfs64.c
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/fstatfs64.c (added)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/fstatfs64.c Fri Sep 24 00:04:37 2010
@@ -1,0 +1,1 @@
+#include <sysdeps/unix/sysv/linux/fstatfs64.c>

Added: fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/fstatvfs.c
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/fstatvfs.c (added)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/fstatvfs.c Fri Sep 24 00:04:37 2010
@@ -1,0 +1,1 @@
+#include <sysdeps/unix/sysv/linux/fstatvfs.c>

Added: fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/fstatvfs64.c
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/fstatvfs64.c (added)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/fstatvfs64.c Fri Sep 24 00:04:37 2010
@@ -1,0 +1,1 @@
+#include <sysdeps/unix/sysv/linux/fstatvfs64.c>

Added: fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/internal_statvfs64.c
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/internal_statvfs64.c (added)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/internal_statvfs64.c Fri Sep 24 00:04:37 2010
@@ -1,0 +1,1 @@
+#include <sysdeps/unix/sysv/linux/internal_statvfs64.c>

Added: fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/statfs64.c
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/statfs64.c (added)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/statfs64.c Fri Sep 24 00:04:37 2010
@@ -1,0 +1,1 @@
+#include <sysdeps/unix/sysv/linux/statfs64.c>

Added: fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/statvfs.c
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/statvfs.c (added)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/statvfs.c Fri Sep 24 00:04:37 2010
@@ -1,0 +1,1 @@
+#include <sysdeps/unix/sysv/linux/statvfs.c>

Added: fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/statvfs64.c
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/statvfs64.c (added)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/statvfs64.c Fri Sep 24 00:04:37 2010
@@ -1,0 +1,1 @@
+#include <sysdeps/unix/sysv/linux/statvfs64.c>

Modified: fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/syscalls.list
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/syscalls.list (original)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/alpha/syscalls.list Fri Sep 24 00:04:37 2010
@@ -53,3 +53,8 @@
 osf_utimes	-	osf_utimes	2	__utimes_tv32  utimes@xxxxxxxxx
 osf_getrusage	-	osf_getrusage	2	__getrusage_tv32  getrusage@xxxxxxxxx
 osf_wait4	-	osf_wait4	2	__wait4_tv32  wait4@xxxxxxxxx
+
+# avoid 64-bit aliases on 32-bit statfs syscalls
+fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs
+statfs		-	statfs		i:sp	__statfs	statfs
+