]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Initial revision
authorRoland McGrath <roland@gnu.org>
Wed, 25 Nov 1992 03:28:54 +0000 (03:28 +0000)
committerRoland McGrath <roland@gnu.org>
Wed, 25 Nov 1992 03:28:54 +0000 (03:28 +0000)
sysdeps/alpha/Dist [new file with mode: 0644]
sysdeps/alpha/Makefile [new file with mode: 0644]
sysdeps/alpha/__math.h [new file with mode: 0644]
sysdeps/alpha/copysign.c [new file with mode: 0644]
sysdeps/alpha/fabs.c [new file with mode: 0644]
sysdeps/alpha/memchr.c [new file with mode: 0644]
sysdeps/alpha/setjmp.S [new file with mode: 0644]
sysdeps/alpha/strlen.c [new file with mode: 0644]

diff --git a/sysdeps/alpha/Dist b/sysdeps/alpha/Dist
new file mode 100644 (file)
index 0000000..ad6ea03
--- /dev/null
@@ -0,0 +1 @@
+setjmp_aux.c
diff --git a/sysdeps/alpha/Makefile b/sysdeps/alpha/Makefile
new file mode 100644 (file)
index 0000000..7364141
--- /dev/null
@@ -0,0 +1,3 @@
+ifeq ($(subdir),setjmp)
+sysdep_routines := $(sysdep_routines) setjmp_aux
+endif
diff --git a/sysdeps/alpha/__math.h b/sysdeps/alpha/__math.h
new file mode 100644 (file)
index 0000000..e9893f5
--- /dev/null
@@ -0,0 +1,28 @@
+/* Copyright (C) 1992 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 Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#if defined (__GNUC__) && !defined (__NO_MATH_INLINES)
+
+extern __inline
+__copysign (double __x, double __y)
+{
+  __asm ("cpys %1, %2, %0" : "=f" (__x) : "f" (__y), "f" (__x));
+  return __x;
+}
+
+#endif
diff --git a/sysdeps/alpha/copysign.c b/sysdeps/alpha/copysign.c
new file mode 100644 (file)
index 0000000..ad74994
--- /dev/null
@@ -0,0 +1,27 @@
+/* Copyright (C) 1992 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 Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <math.h>
+
+/* Return X with its signed changed to Y's.  */
+double
+__copysign (double x, double y)
+{
+  asm ("cpys %1, %2, %0" : "=f" (x) : "f" (y), "f" (x));
+  return x;
+}
diff --git a/sysdeps/alpha/fabs.c b/sysdeps/alpha/fabs.c
new file mode 100644 (file)
index 0000000..9362027
--- /dev/null
@@ -0,0 +1,26 @@
+/* Copyright (C) 1992 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 Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <math.h>
+
+double
+fabs (double x)
+{
+  asm ("cpys $f31, %1, %0" : "=f" (x) : "f" (x));
+  return x;
+}
diff --git a/sysdeps/alpha/memchr.c b/sysdeps/alpha/memchr.c
new file mode 100644 (file)
index 0000000..01a8c3e
--- /dev/null
@@ -0,0 +1,65 @@
+/* Copyright (C) 1992 Free Software Foundation, Inc.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <string.h>
+
+/* Search no more than N bytes of S for C.  */
+
+void *
+memchr (const void *s, int c, size_t n)
+{
+  const char *char_ptr;
+  const unsigned long int *longword_ptr;
+  unsigned long int charmask;
+
+  c = (unsigned char) c;
+
+  /* Handle the first few characters by reading one character at a time.
+     Do this until STR is aligned on a 8-byte border.  */
+  for (char_ptr = s; n > 0 && ((unsigned long int) char_ptr & 7) != 0;
+       --n, ++char_ptr)
+    if (*char_ptr == c)
+      return char_ptr;
+
+  longword_ptr = (unsigned long int *) char_ptr;
+
+  /* Set up a longword, each of whose bytes is C.  */
+  charmask = c | (c << 8);
+  charmask |= charmask << 16;
+  charmask |= charmask << 32;
+
+  for (;;)
+    {
+      int mask;
+      asm ("cmpbge %1, %2, %0"
+          : "=r" (mask) : "r" (charmask), "r" (*longword_ptr++));
+      if (mask)
+       {
+         /* Which of the bytes was the C?  */
+
+         const char *cp = (const char *) (longword_ptr - 1);
+
+         if (cp[0] == c)
+           return cp - str;
+         if (cp[1] == c)
+           return cp - str + 1;
+         if (cp[2] == c)
+           return cp - str + 2;
+         return cp - str + 3;
+       }
+    }
+}
diff --git a/sysdeps/alpha/setjmp.S b/sysdeps/alpha/setjmp.S
new file mode 100644 (file)
index 0000000..a5de80c
--- /dev/null
@@ -0,0 +1,28 @@
+/* Copyright (C) 1992 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 Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <sysdep.h>
+
+/* The function __setjmp_aux saves all the registers, but it can't
+   reliably access the stack or frame pointers, so we pass them in as
+   extra arguments.  */
+ENTRY (__setjmp)
+       lda $27, __setjmp_aux   /* Load address to jump to.  */
+       bis $15, $15, $17       /* Pass FP as 2nd arg.  */
+       bis $30, $30, $18       /* Pass SP as 3nd arg.  */
+       jmp $31, ($27), __setjmp_aux /* Call __setjmp_aux.  */
diff --git a/sysdeps/alpha/strlen.c b/sysdeps/alpha/strlen.c
new file mode 100644 (file)
index 0000000..0c10853
--- /dev/null
@@ -0,0 +1,57 @@
+/* Copyright (C) 1992 Free Software Foundation, Inc.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <string.h>
+
+/* Return the length of the null-terminated string STR.  Scan for
+   the null terminator quickly by testing eight bytes at a time.  */
+
+size_t
+strlen (const char *str)
+{
+  const char *char_ptr;
+  const unsigned long int *longword_ptr;
+  unsigned long int longword;
+
+  /* Handle the first few characters by reading one character at a time.
+     Do this until STR is aligned on a 8-byte border.  */
+  for (char_ptr = str; ((unsigned long int) char_ptr & 7) != 0; ++char_ptr)
+    if (*char_ptr == '\0')
+      return char_ptr - str;
+
+  longword_ptr = (unsigned long int *) char_ptr;
+
+  for (;;)
+    {
+      int mask;
+      asm ("cmpbge %1, %2, %0" : "=r" (mask) : "r" (0), "r" (*longword_ptr++));
+      if (mask)
+       {
+         /* Which of the bytes was the zero?  */
+
+         const char *cp = (const char *) (longword_ptr - 1);
+
+         if (cp[0] == 0)
+           return cp - str;
+         if (cp[1] == 0)
+           return cp - str + 1;
+         if (cp[2] == 0)
+           return cp - str + 2;
+         return cp - str + 3;
+       }
+    }
+}