about summary refs log tree commit diff
path: root/sysdeps/alpha
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-02-18 01:27:10 +0000
committerRoland McGrath <roland@gnu.org>1995-02-18 01:27:10 +0000
commit28f540f45bbacd939bfd07f213bcad2bf730b1bf (patch)
tree15f07c4c43d635959c6afee96bde71fb1b3614ee /sysdeps/alpha
downloadglibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.gz
glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.xz
glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.zip
initial import
Diffstat (limited to 'sysdeps/alpha')
-rw-r--r--sysdeps/alpha/DEFS.h27
-rw-r--r--sysdeps/alpha/Dist4
-rw-r--r--sysdeps/alpha/Implies2
-rw-r--r--sysdeps/alpha/Makefile94
-rw-r--r--sysdeps/alpha/__longjmp.c91
-rw-r--r--sysdeps/alpha/__math.h35
-rw-r--r--sysdeps/alpha/bsd-_setjmp.S30
-rw-r--r--sysdeps/alpha/bsd-setjmp.S30
-rw-r--r--sysdeps/alpha/bytesex.h3
-rw-r--r--sysdeps/alpha/copysign.c31
-rw-r--r--sysdeps/alpha/divl.S54
-rw-r--r--sysdeps/alpha/divlu.S54
-rw-r--r--sysdeps/alpha/divq.S51
-rw-r--r--sysdeps/alpha/divqu.S57
-rw-r--r--sysdeps/alpha/divrem.m448
-rw-r--r--sysdeps/alpha/fabs.c28
-rw-r--r--sysdeps/alpha/gmp-mparam.h26
-rw-r--r--sysdeps/alpha/jmp_buf.h46
-rw-r--r--sysdeps/alpha/macros.m434
-rw-r--r--sysdeps/alpha/memchr.c86
-rw-r--r--sysdeps/alpha/reml.S57
-rw-r--r--sysdeps/alpha/remlu.S57
-rw-r--r--sysdeps/alpha/remq.S54
-rw-r--r--sysdeps/alpha/remqu.S60
-rw-r--r--sysdeps/alpha/setjmp.S29
-rw-r--r--sysdeps/alpha/setjmp_aux.c74
-rw-r--r--sysdeps/alpha/strchr.c84
-rw-r--r--sysdeps/alpha/strlen.c54
-rw-r--r--sysdeps/alpha/udiv_qrnnd.S152
29 files changed, 1452 insertions, 0 deletions
diff --git a/sysdeps/alpha/DEFS.h b/sysdeps/alpha/DEFS.h
new file mode 100644
index 0000000000..c2a4fc88ae
--- /dev/null
+++ b/sysdeps/alpha/DEFS.h
@@ -0,0 +1,27 @@
+#ifdef __STDC__
+#define FUNC__(name)		\
+	.align 3;		\
+        .globl __##name;	\
+        .ent __##name;		\
+        __##name:		\
+	lda sp, -16(sp);	\
+	.frame sp, 16, t9, 0;	\
+	.prologue 0
+#else
+#define FUNC__(name)		\
+	.align 3;		\
+        .globl __/**/name;	\
+        .ent __/**/name,0;	\
+        __/**/name:		\
+	lda sp, -16(sp);	\
+	.frame sp, 16, t9, 0;	\
+	.prologue 0
+#endif
+
+#ifdef __STDC__
+#define NAME__(name)	\
+	__##name
+#else
+#define NAME__(name)	\
+	__/**/name
+#endif
diff --git a/sysdeps/alpha/Dist b/sysdeps/alpha/Dist
new file mode 100644
index 0000000000..c4ea856629
--- /dev/null
+++ b/sysdeps/alpha/Dist
@@ -0,0 +1,4 @@
+setjmp_aux.c
+DEFS.h
+divrem.m4 macros.m4
+divl.S divlu.S divq.S divqu.S reml.S remlu.S remq.S remqu.S
diff --git a/sysdeps/alpha/Implies b/sysdeps/alpha/Implies
new file mode 100644
index 0000000000..93234096f0
--- /dev/null
+++ b/sysdeps/alpha/Implies
@@ -0,0 +1,2 @@
+# Alpha uses IEEE 754 floating point.
+ieee754
diff --git a/sysdeps/alpha/Makefile b/sysdeps/alpha/Makefile
new file mode 100644
index 0000000000..06621b824d
--- /dev/null
+++ b/sysdeps/alpha/Makefile
@@ -0,0 +1,94 @@
+# Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+# Contributed by Brendan Kehoe (brendan@zen.org).
+
+# 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.
+
+ifeq ($(subdir),setjmp)
+sysdep_routines := $(sysdep_routines) setjmp_aux
+endif
+
+ifeq ($(subdir),gnulib)
+routines = $(divrem) 
+endif	# gnulib
+
+# We distribute these files, even though they are generated,
+# so as to avoid the need for a functioning m4 to build the library.
+divrem := divl divlu divq divqu reml remlu remq remqu
+
++divrem-NAME-divl := divl
++divrem-NAME-divlu := divlu
++divrem-NAME-divq := divq
++divrem-NAME-divqu := divqu
++divrem-NAME-reml := reml
++divrem-NAME-remlu := remlu
++divrem-NAME-remq := remq
++divrem-NAME-remqu := remqu
++divrem-NAME = $(+divrem-NAME-$(basename $(notdir $@)))
+
++divrem-OP-divl := divl
++divrem-OP-divlu := divlu
++divrem-OP-divq := divq
++divrem-OP-divqu := divqu
++divrem-OP-reml := reml
++divrem-OP-remlu := remlu
++divrem-OP-remq := remq
++divrem-OP-remqu := remqu
++divrem-BASEOP-divl := div
++divrem-BASEOP-divlu := div
++divrem-BASEOP-divq := div
++divrem-BASEOP-divqu := div
++divrem-BASEOP-reml := rem
++divrem-BASEOP-remlu := rem
++divrem-BASEOP-remq := rem
++divrem-BASEOP-remqu := rem
++divrem-S-divl := true
++divrem-S-divlu := false
++divrem-S-divq := true
++divrem-S-divqu := false
++divrem-S-reml := true
++divrem-S-remlu := false
++divrem-S-remq := true
++divrem-S-remqu := false
++divrem-SIZE-divl := l
++divrem-SIZE-divlu := l
++divrem-SIZE-divq := q
++divrem-SIZE-divqu := q
++divrem-SIZE-reml := l
++divrem-SIZE-remlu := l
++divrem-SIZE-remq := q
++divrem-SIZE-remqu := q
++divrem-MODE-divl := l
++divrem-MODE-divlu := lu
++divrem-MODE-divq := q
++divrem-MODE-divqu := qu
++divrem-MODE-reml := l
++divrem-MODE-remlu := lu
++divrem-MODE-remq := q
++divrem-MODE-remqu := qu
+
+$(divrem:%=$(sysdep_dir)/alpha/%.S): $(sysdep_dir)/alpha/divrem.m4 $(sysdep_dir)/alpha/DEFS.h $(sysdep_dir)/alpha/macros.m4
+	(echo "define(OP,\`$(+divrem-NAME)')\
+	       define(BASEOP,\`$(+divrem-BASEOP-$(+divrem-NAME))')\
+	       define(MODE,\`$(+divrem-MODE-$(+divrem-NAME))')\
+	       define(SIZE,\`$(+divrem-SIZE-$(+divrem-NAME))')\
+	       define(SIGNED,\`$(+divrem-S-$(+divrem-NAME))')\
+	       define(SYSDEP_DIR, \`$(sysdep_dir)/alpha')\
+	       /* This file is generated from divrem.m4; DO NOT EDIT! */"; \
+	 cat $<) | $(M4) > $@-tmp
+# Make it unwritable so noone will edit it by mistake.
+	-chmod a-w $@-tmp
+	mv -f $@-tmp $@
+	test -d CVS && cvs commit -m'Regenerated from $<' $@
diff --git a/sysdeps/alpha/__longjmp.c b/sysdeps/alpha/__longjmp.c
new file mode 100644
index 0000000000..19a2e26696
--- /dev/null
+++ b/sysdeps/alpha/__longjmp.c
@@ -0,0 +1,91 @@
+/* Copyright (C) 1992, 1994 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.  */
+
+/* Global register vars must come before any function defn.  */
+
+register long int
+  r9 asm ("$9"), r10 asm ("$10"), r11 asm ("$11"), r12 asm ("$12"),
+  r13 asm ("$13"), r14 asm ("$14");
+
+register long int *fp asm ("$15"), *sp asm ("$30"), *retpc asm ("$26");
+
+#if 1				/* XXX */
+register double
+  f2 asm ("$f2"), f3 asm ("$f3"), f4 asm ("$f4"), f5 asm ("$f5"),
+  f6 asm ("$f6"), f7 asm ("$f7"), f8 asm ("$f8"), f9 asm ("$f9");
+#endif
+
+#include <setjmp.h>
+
+
+/* Jump to the position specified by ENV, causing the
+   setjmp call there to return VAL, or 1 if VAL is 0.  */
+__NORETURN 
+void
+__longjmp (const __jmp_buf env, int val)
+{
+  /* Restore the integer registers.  */
+  r9 = env[0].__9;
+  r10 = env[0].__10;
+  r11 = env[0].__11;
+  r12 = env[0].__12;
+  r13 = env[0].__13;
+  r14 = env[0].__14;
+
+#if 1				/* XXX */
+  /* Restore the floating point registers.  */
+  f2 = env[0].__f2;
+  f3 = env[0].__f3;
+  f4 = env[0].__f4;
+  f5 = env[0].__f5;
+  f6 = env[0].__f6;
+  f7 = env[0].__f7;
+  f8 = env[0].__f8;
+  f9 = env[0].__f9;
+#endif
+
+  /* Set the return PC to that of setjmp's caller.  */
+  retpc = env[0].__pc;
+
+  /* Restore the FP and SP of setjmp's caller.  */
+  fp = env[0].__fp;
+  sp = env[0].__sp;
+
+  /* Return VAL (or 1 if VAL is zero) to setjmp's caller.
+
+     We use an asm here rather than a normal C return statement
+     just in case the compiler wanted to do some stack frobnication
+     in the function epilogue.  Since we have already restored
+     precisely the FP and SP the desired environment needs,
+     we must avoid the compiler doing anything with the stack.  */
+
+  while (1)
+    {
+      /* The loop is just to avoid `volatile function does return' warnings.
+	 The instruction will only be executed once.  */
+
+      register long int retval asm ("$0");
+
+      asm volatile
+	("cmoveq %1, 1, %0\n\t"	/* $0 = val ?: 1; */
+	 "ret $31, (%2), 1"	/* return $0 */
+	 : "=r" (retval)
+	 /* The "0" constraint should force VAL into $0.  */
+	 : "0" (val), "r" (retpc));
+    }
+}
diff --git a/sysdeps/alpha/__math.h b/sysdeps/alpha/__math.h
new file mode 100644
index 0000000000..b06f716c50
--- /dev/null
+++ b/sysdeps/alpha/__math.h
@@ -0,0 +1,35 @@
+/* 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 __CONSTVALUE double
+__copysign (double __x, double __y)
+{
+  __asm ("cpys %1, %2, %0" : "=f" (__x) : "f" (__y), "f" (__x));
+  return __x;
+}
+
+extern __inline double
+fabs (double __x)
+{
+  __asm ("cpys $f31, %1, %0" : "=f" (__x) : "f" (__x));
+  return __x;
+}
+
+#endif
diff --git a/sysdeps/alpha/bsd-_setjmp.S b/sysdeps/alpha/bsd-_setjmp.S
new file mode 100644
index 0000000000..9947d8f45a
--- /dev/null
+++ b/sysdeps/alpha/bsd-_setjmp.S
@@ -0,0 +1,30 @@
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  Alpha version.
+Copyright (C) 1994 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.  */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
+   We cannot do it in C because it must be a tail-call, so frame-unwinding
+   in setjmp doesn't clobber the state restored by longjmp.  */
+
+#include <sysdep.h>
+
+ENTRY (setjmp)
+	lda $27, __sigsetjmp	/* Load address to jump to.  */
+	bis $31, $31, $17	/* Pass a second argument of zero.  */
+	jmp $31, ($27), __sigsetjmp /* Call __sigsetjmp.  */
+	.end setjmp
diff --git a/sysdeps/alpha/bsd-setjmp.S b/sysdeps/alpha/bsd-setjmp.S
new file mode 100644
index 0000000000..470f7bc47d
--- /dev/null
+++ b/sysdeps/alpha/bsd-setjmp.S
@@ -0,0 +1,30 @@
+/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  Alpha version.
+Copyright (C) 1994 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.  */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
+   We cannot do it in C because it must be a tail-call, so frame-unwinding
+   in setjmp doesn't clobber the state restored by longjmp.  */
+
+#include <sysdep.h>
+
+ENTRY (setjmp)
+	lda $27, __sigsetjmp	/* Load address to jump to.  */
+	bis $31, 1, $17		/* Pass a second argument of one.  */
+	jmp $31, ($27), __sigsetjmp /* Call __sigsetjmp.  */
+	.end setjmp
diff --git a/sysdeps/alpha/bytesex.h b/sysdeps/alpha/bytesex.h
new file mode 100644
index 0000000000..e873d2123c
--- /dev/null
+++ b/sysdeps/alpha/bytesex.h
@@ -0,0 +1,3 @@
+/* Alpha is little-endian.  */
+
+#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/sysdeps/alpha/copysign.c b/sysdeps/alpha/copysign.c
new file mode 100644
index 0000000000..69544b01fb
--- /dev/null
+++ b/sysdeps/alpha/copysign.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1992, 1993, 1995 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.  */
+
+#define __NO_MATH_INLINES
+
+#include <math.h>
+
+/* Return X with its sign changed to Y's.  */
+__inline double
+__copysign (double __x, double __y)
+{
+  __asm ("cpys %1, %2, %0" : "=f" (__x) : "f" (__y), "f" (__x));
+  return __x;
+}
+
+weak_alias (__copysign, copysign)
diff --git a/sysdeps/alpha/divl.S b/sysdeps/alpha/divl.S
new file mode 100644
index 0000000000..7ae3e0cc13
--- /dev/null
+++ b/sysdeps/alpha/divl.S
@@ -0,0 +1,54 @@
+      /* This file is generated from divrem.m4; DO NOT EDIT! */
+/* For each N divided by D, we do:
+      result = (double) N / (double) D
+   Then, for each N mod D, we do:
+      result = N - (D * divMODE (N, D))
+
+   FIXME:
+   The q and qu versions won't deal with operands > 50 bits.  We also
+   don't check for divide by zero.  */
+
+#include "DEFS.h"
+#if 0
+/* We do not handle div by zero yet.  */
+#include <machine/pal.h>
+#endif
+#include <sysdep.h>
+
+
+
+
+
+
+FUNC__(divl)
+	/* First set up the dividend.  */
+		sextl t10, t10
+
+	stq t10,0(sp)
+	ldt $f10,0(sp)
+	cvtqt $f10,$f10
+	
+
+	/* Then set up the divisor.  */
+		sextl t11, t11
+
+	stq t11,0(sp)
+	ldt $f1,0(sp)
+	cvtqt $f1,$f1
+	
+
+	/* Do the division.  */
+	divt $f10,$f1,$f10
+	cvttqc $f10,$f10
+
+	/* Put the result in t12.  */
+	stt $f10,0(sp)
+	ldq t12,0(sp)
+		sextl t12, t12
+
+
+	
+
+	lda sp,16(sp)
+	ret zero,(t9),1
+	.end NAME__(divl)
diff --git a/sysdeps/alpha/divlu.S b/sysdeps/alpha/divlu.S
new file mode 100644
index 0000000000..9ae5950c53
--- /dev/null
+++ b/sysdeps/alpha/divlu.S
@@ -0,0 +1,54 @@
+      /* This file is generated from divrem.m4; DO NOT EDIT! */
+/* For each N divided by D, we do:
+      result = (double) N / (double) D
+   Then, for each N mod D, we do:
+      result = N - (D * divMODE (N, D))
+
+   FIXME:
+   The q and qu versions won't deal with operands > 50 bits.  We also
+   don't check for divide by zero.  */
+
+#include "DEFS.h"
+#if 0
+/* We do not handle div by zero yet.  */
+#include <machine/pal.h>
+#endif
+#include <sysdep.h>
+
+
+
+
+
+
+FUNC__(divlu)
+	/* First set up the dividend.  */
+		zapnot t10, 0xf, t10
+
+	stq t10,0(sp)
+	ldt $f10,0(sp)
+	cvtqt $f10,$f10
+	
+
+	/* Then set up the divisor.  */
+		zapnot t11, 0xf, t11
+
+	stq t11,0(sp)
+	ldt $f1,0(sp)
+	cvtqt $f1,$f1
+	
+
+	/* Do the division.  */
+	divt $f10,$f1,$f10
+	cvttqc $f10,$f10
+
+	/* Put the result in t12.  */
+	stt $f10,0(sp)
+	ldq t12,0(sp)
+		sextl t12, t12
+
+
+	
+
+	lda sp,16(sp)
+	ret zero,(t9),1
+	.end NAME__(divlu)
diff --git a/sysdeps/alpha/divq.S b/sysdeps/alpha/divq.S
new file mode 100644
index 0000000000..79ff6ca7c5
--- /dev/null
+++ b/sysdeps/alpha/divq.S
@@ -0,0 +1,51 @@
+      /* This file is generated from divrem.m4; DO NOT EDIT! */
+/* For each N divided by D, we do:
+      result = (double) N / (double) D
+   Then, for each N mod D, we do:
+      result = N - (D * divMODE (N, D))
+
+   FIXME:
+   The q and qu versions won't deal with operands > 50 bits.  We also
+   don't check for divide by zero.  */
+
+#include "DEFS.h"
+#if 0
+/* We do not handle div by zero yet.  */
+#include <machine/pal.h>
+#endif
+#include <sysdep.h>
+
+
+
+
+
+
+FUNC__(divq)
+	/* First set up the dividend.  */
+	
+	stq t10,0(sp)
+	ldt $f10,0(sp)
+	cvtqt $f10,$f10
+	
+
+	/* Then set up the divisor.  */
+	
+	stq t11,0(sp)
+	ldt $f1,0(sp)
+	cvtqt $f1,$f1
+	
+
+	/* Do the division.  */
+	divt $f10,$f1,$f10
+	cvttqc $f10,$f10
+
+	/* Put the result in t12.  */
+	stt $f10,0(sp)
+	ldq t12,0(sp)
+	
+
+	
+
+	lda sp,16(sp)
+	ret zero,(t9),1
+	.end NAME__(divq)
diff --git a/sysdeps/alpha/divqu.S b/sysdeps/alpha/divqu.S
new file mode 100644
index 0000000000..7908b9f77d
--- /dev/null
+++ b/sysdeps/alpha/divqu.S
@@ -0,0 +1,57 @@
+      /* This file is generated from divrem.m4; DO NOT EDIT! */
+/* For each N divided by D, we do:
+      result = (double) N / (double) D
+   Then, for each N mod D, we do:
+      result = N - (D * divMODE (N, D))
+
+   FIXME:
+   The q and qu versions won't deal with operands > 50 bits.  We also
+   don't check for divide by zero.  */
+
+#include "DEFS.h"
+#if 0
+/* We do not handle div by zero yet.  */
+#include <machine/pal.h>
+#endif
+#include <sysdep.h>
+
+
+
+
+
+
+FUNC__(divqu)
+	/* First set up the dividend.  */
+	
+	stq t10,0(sp)
+	ldt $f10,0(sp)
+	cvtqt $f10,$f10
+		ldit	$f26, 18446744073709551616.0
+	addt	$f26, $f10, $f26
+	fcmovlt	$f10, $f26, $f10
+
+
+	/* Then set up the divisor.  */
+	
+	stq t11,0(sp)
+	ldt $f1,0(sp)
+	cvtqt $f1,$f1
+		ldit	$f26, 18446744073709551616.0
+	addt	$f26, $f1, $f26
+	fcmovlt	$f1, $f26, $f1
+
+
+	/* Do the division.  */
+	divt $f10,$f1,$f10
+	cvttqc $f10,$f10
+
+	/* Put the result in t12.  */
+	stt $f10,0(sp)
+	ldq t12,0(sp)
+	
+
+	
+
+	lda sp,16(sp)
+	ret zero,(t9),1
+	.end NAME__(divqu)
diff --git a/sysdeps/alpha/divrem.m4 b/sysdeps/alpha/divrem.m4
new file mode 100644
index 0000000000..5942cf447f
--- /dev/null
+++ b/sysdeps/alpha/divrem.m4
@@ -0,0 +1,48 @@
+/* For each N divided by D, we do:
+      result = (double) N / (double) D
+   Then, for each N mod D, we do:
+      result = N - (D * divMODE (N, D))
+
+   FIXME:
+   The q and qu versions won't deal with operands > 50 bits.  We also
+   don't check for divide by zero.  */
+
+#include "DEFS.h"
+#if 0
+/* We do not handle div by zero yet.  */
+#include <machine/pal.h>
+#endif
+#include <sysdep.h>
+
+define(path, `SYSDEP_DIR/macros.m4')dnl
+include(path)
+
+FUNC__(OP)
+	/* First set up the dividend.  */
+	EXTEND(t10)
+	stq t10,0(sp)
+	ldt $f10,0(sp)
+	cvtqt $f10,$f10
+	ADJQU($f10)
+
+	/* Then set up the divisor.  */
+	EXTEND(t11)
+	stq t11,0(sp)
+	ldt $f1,0(sp)
+	cvtqt $f1,$f1
+	ADJQU($f1)
+
+	/* Do the division.  */
+	divt $f10,$f1,$f10
+	cvttqc $f10,$f10
+
+	/* Put the result in t12.  */
+	stt $f10,0(sp)
+	ldq t12,0(sp)
+	FULLEXTEND(t12)
+
+	DOREM
+
+	lda sp,16(sp)
+	ret zero,(t9),1
+	.end NAME__(OP)
diff --git a/sysdeps/alpha/fabs.c b/sysdeps/alpha/fabs.c
new file mode 100644
index 0000000000..321df0d1e1
--- /dev/null
+++ b/sysdeps/alpha/fabs.c
@@ -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.  */
+
+#define __NO_MATH_INLINES
+
+#include <math.h>
+
+__inline double
+fabs (double __x)
+{
+  __asm ("cpys $f31, %1, %0" : "=f" (__x) : "f" (__x));
+  return __x;
+}
diff --git a/sysdeps/alpha/gmp-mparam.h b/sysdeps/alpha/gmp-mparam.h
new file mode 100644
index 0000000000..05c893f790
--- /dev/null
+++ b/sysdeps/alpha/gmp-mparam.h
@@ -0,0 +1,26 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
+#define BITS_PER_LONGINT 64
+#define BITS_PER_INT 32
+#define BITS_PER_SHORTINT 16
+#define BITS_PER_CHAR 8
diff --git a/sysdeps/alpha/jmp_buf.h b/sysdeps/alpha/jmp_buf.h
new file mode 100644
index 0000000000..6e6f6b4727
--- /dev/null
+++ b/sysdeps/alpha/jmp_buf.h
@@ -0,0 +1,46 @@
+/* Define the machine-dependent type `jmp_buf'.  Alpha version.
+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.  */
+
+typedef struct
+  {
+    /* Integer registers:
+           $0 is the return value;
+	   $1-$8, $22-$25, $28 are call-used;
+	   $9-$14 we save here;
+	   $15 is the FP and we save it here;
+	   $16-$21 are input arguments (call-used);
+	   $26 is the return PC and we save it here;
+	   $27 is the procedure value (i.e., the address of __setjmp);
+	   $29 is the global pointer, which the caller will reconstruct
+	   from the return address restored in $26;
+	   $30 is the stack pointer and we save it here;
+	   $31 is always zero.  */
+    long int __9, __10, __11, __12, __13, __14;
+    long int *__pc, *__fp, *__sp;
+
+#if 1				/* XXX need predefine for TARGET_FPREGS */
+    /* Floating-point registers:
+           $f0 is the floating return value;
+	   $f1, $f10-$f15, $f22-$f30 are call-used;
+	   $f2-$f9 we save here;
+	   $f16-$21 are input args (call-used);
+	   $f31 is always zero.  */
+    double __f2, __f3, __f4, __f5, __f6, __f7, __f8, __f9;
+#endif	/* Have FP regs.  */
+  } __jmp_buf[1];
diff --git a/sysdeps/alpha/macros.m4 b/sysdeps/alpha/macros.m4
new file mode 100644
index 0000000000..f8c1fe9662
--- /dev/null
+++ b/sysdeps/alpha/macros.m4
@@ -0,0 +1,34 @@
+dnl NOTE: The $1 below is the argument to EXTEND, not register $1.
+define(EXTEND,
+`ifelse(SIZE, `l',
+`ifelse(SIGNED, `true',
+`	sextl $1, $1
+',dnl
+`	zapnot $1, 0xf, $1
+')')')dnl
+
+dnl FULLEXTEND -- extend the register named in the first argument
+define(FULLEXTEND,
+`ifelse(SIZE, `l',
+`	sextl $1, $1
+')')dnl
+
+dnl This is used by divqu.
+define(ADJQU,
+`ifelse(MODE, `qu',
+`	ldit	$f26, 18446744073709551616.0
+	addt	$f26, $1, $f26
+	fcmovlt	$1, $f26, $1
+')')dnl
+
+define(DOREM,
+`ifelse(BASEOP, `rem',
+`	/* Compute the remainder.  */
+ifelse(SIZE, `l',
+`	mull t11, t12, t11
+	subl t10, t11, t12
+',dnl Note mulq/subq were only really used in remq, but we will find out
+dnl   if assuming they apply to remqu as well is wrong or not.
+`	mulq t11, t12, t11
+	subq t10, t11, t12
+')')')dnl
diff --git a/sysdeps/alpha/memchr.c b/sysdeps/alpha/memchr.c
new file mode 100644
index 0000000000..11ff542f25
--- /dev/null
+++ b/sysdeps/alpha/memchr.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 1992, 1993, 1994 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;
+  size_t x;
+
+  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 (void *) char_ptr;
+
+  if (n == (size_t)0)
+    return NULL;
+
+  x = n;
+
+  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 (;;)
+    {
+      const unsigned long int longword = *longword_ptr++;
+      int ge, le;
+
+      if (x < 4)
+	x = (size_t) 0;
+      else
+	x -= 4;
+
+      /* Set bits in GE if bytes in CHARMASK are >= bytes in LONGWORD.  */
+      asm ("cmpbge %1, %2, %0" : "=r" (ge) : "r" (charmask), "r" (longword));
+
+      /* Set bits in LE if bytes in CHARMASK are <= bytes in LONGWORD.  */
+      asm ("cmpbge %2, %1, %0" : "=r" (le) : "r" (charmask), "r" (longword));
+
+      /* Bytes that are both <= and >= are == to C.  */
+      if (ge & le)
+	{
+	  /* Which of the bytes was the C?  */
+
+	  unsigned char *cp = (unsigned char *) (longword_ptr - 1);
+	  int i;
+
+	  for (i = 0; i < 6; i++)
+	    if (cp[i] == c)
+	      return &cp[i];
+	  return &cp[7];
+	}
+
+      if (x == (size_t)0)
+	break;
+    }
+
+  return NULL;
+}
diff --git a/sysdeps/alpha/reml.S b/sysdeps/alpha/reml.S
new file mode 100644
index 0000000000..2ece297f09
--- /dev/null
+++ b/sysdeps/alpha/reml.S
@@ -0,0 +1,57 @@
+      /* This file is generated from divrem.m4; DO NOT EDIT! */
+/* For each N divided by D, we do:
+      result = (double) N / (double) D
+   Then, for each N mod D, we do:
+      result = N - (D * divMODE (N, D))
+
+   FIXME:
+   The q and qu versions won't deal with operands > 50 bits.  We also
+   don't check for divide by zero.  */
+
+#include "DEFS.h"
+#if 0
+/* We do not handle div by zero yet.  */
+#include <machine/pal.h>
+#endif
+#include <sysdep.h>
+
+
+
+
+
+
+FUNC__(reml)
+	/* First set up the dividend.  */
+		sextl t10, t10
+
+	stq t10,0(sp)
+	ldt $f10,0(sp)
+	cvtqt $f10,$f10
+	
+
+	/* Then set up the divisor.  */
+		sextl t11, t11
+
+	stq t11,0(sp)
+	ldt $f1,0(sp)
+	cvtqt $f1,$f1
+	
+
+	/* Do the division.  */
+	divt $f10,$f1,$f10
+	cvttqc $f10,$f10
+
+	/* Put the result in t12.  */
+	stt $f10,0(sp)
+	ldq t12,0(sp)
+		sextl t12, t12
+
+
+		/* Compute the remainder.  */
+	mull t11, t12, t11
+	subl t10, t11, t12
+
+
+	lda sp,16(sp)
+	ret zero,(t9),1
+	.end NAME__(reml)
diff --git a/sysdeps/alpha/remlu.S b/sysdeps/alpha/remlu.S
new file mode 100644
index 0000000000..d7700e6595
--- /dev/null
+++ b/sysdeps/alpha/remlu.S
@@ -0,0 +1,57 @@
+      /* This file is generated from divrem.m4; DO NOT EDIT! */
+/* For each N divided by D, we do:
+      result = (double) N / (double) D
+   Then, for each N mod D, we do:
+      result = N - (D * divMODE (N, D))
+
+   FIXME:
+   The q and qu versions won't deal with operands > 50 bits.  We also
+   don't check for divide by zero.  */
+
+#include "DEFS.h"
+#if 0
+/* We do not handle div by zero yet.  */
+#include <machine/pal.h>
+#endif
+#include <sysdep.h>
+
+
+
+
+
+
+FUNC__(remlu)
+	/* First set up the dividend.  */
+		zapnot t10, 0xf, t10
+
+	stq t10,0(sp)
+	ldt $f10,0(sp)
+	cvtqt $f10,$f10
+	
+
+	/* Then set up the divisor.  */
+		zapnot t11, 0xf, t11
+
+	stq t11,0(sp)
+	ldt $f1,0(sp)
+	cvtqt $f1,$f1
+	
+
+	/* Do the division.  */
+	divt $f10,$f1,$f10
+	cvttqc $f10,$f10
+
+	/* Put the result in t12.  */
+	stt $f10,0(sp)
+	ldq t12,0(sp)
+		sextl t12, t12
+
+
+		/* Compute the remainder.  */
+	mull t11, t12, t11
+	subl t10, t11, t12
+
+
+	lda sp,16(sp)
+	ret zero,(t9),1
+	.end NAME__(remlu)
diff --git a/sysdeps/alpha/remq.S b/sysdeps/alpha/remq.S
new file mode 100644
index 0000000000..47510cbc8e
--- /dev/null
+++ b/sysdeps/alpha/remq.S
@@ -0,0 +1,54 @@
+      /* This file is generated from divrem.m4; DO NOT EDIT! */
+/* For each N divided by D, we do:
+      result = (double) N / (double) D
+   Then, for each N mod D, we do:
+      result = N - (D * divMODE (N, D))
+
+   FIXME:
+   The q and qu versions won't deal with operands > 50 bits.  We also
+   don't check for divide by zero.  */
+
+#include "DEFS.h"
+#if 0
+/* We do not handle div by zero yet.  */
+#include <machine/pal.h>
+#endif
+#include <sysdep.h>
+
+
+
+
+
+
+FUNC__(remq)
+	/* First set up the dividend.  */
+	
+	stq t10,0(sp)
+	ldt $f10,0(sp)
+	cvtqt $f10,$f10
+	
+
+	/* Then set up the divisor.  */
+	
+	stq t11,0(sp)
+	ldt $f1,0(sp)
+	cvtqt $f1,$f1
+	
+
+	/* Do the division.  */
+	divt $f10,$f1,$f10
+	cvttqc $f10,$f10
+
+	/* Put the result in t12.  */
+	stt $f10,0(sp)
+	ldq t12,0(sp)
+	
+
+		/* Compute the remainder.  */
+	mulq t11, t12, t11
+	subq t10, t11, t12
+
+
+	lda sp,16(sp)
+	ret zero,(t9),1
+	.end NAME__(remq)
diff --git a/sysdeps/alpha/remqu.S b/sysdeps/alpha/remqu.S
new file mode 100644
index 0000000000..ec9572dd62
--- /dev/null
+++ b/sysdeps/alpha/remqu.S
@@ -0,0 +1,60 @@
+      /* This file is generated from divrem.m4; DO NOT EDIT! */
+/* For each N divided by D, we do:
+      result = (double) N / (double) D
+   Then, for each N mod D, we do:
+      result = N - (D * divMODE (N, D))
+
+   FIXME:
+   The q and qu versions won't deal with operands > 50 bits.  We also
+   don't check for divide by zero.  */
+
+#include "DEFS.h"
+#if 0
+/* We do not handle div by zero yet.  */
+#include <machine/pal.h>
+#endif
+#include <sysdep.h>
+
+
+
+
+
+
+FUNC__(remqu)
+	/* First set up the dividend.  */
+	
+	stq t10,0(sp)
+	ldt $f10,0(sp)
+	cvtqt $f10,$f10
+		ldit	$f26, 18446744073709551616.0
+	addt	$f26, $f10, $f26
+	fcmovlt	$f10, $f26, $f10
+
+
+	/* Then set up the divisor.  */
+	
+	stq t11,0(sp)
+	ldt $f1,0(sp)
+	cvtqt $f1,$f1
+		ldit	$f26, 18446744073709551616.0
+	addt	$f26, $f1, $f26
+	fcmovlt	$f1, $f26, $f1
+
+
+	/* Do the division.  */
+	divt $f10,$f1,$f10
+	cvttqc $f10,$f10
+
+	/* Put the result in t12.  */
+	stt $f10,0(sp)
+	ldq t12,0(sp)
+	
+
+		/* Compute the remainder.  */
+	mulq t11, t12, t11
+	subq t10, t11, t12
+
+
+	lda sp,16(sp)
+	ret zero,(t9),1
+	.end NAME__(remqu)
diff --git a/sysdeps/alpha/setjmp.S b/sysdeps/alpha/setjmp.S
new file mode 100644
index 0000000000..08932ccd1a
--- /dev/null
+++ b/sysdeps/alpha/setjmp.S
@@ -0,0 +1,29 @@
+/* Copyright (C) 1992, 1994 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 __sigsetjmp_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 (__sigsetjmp)
+	lda $27, __sigsetjmp_aux/* Load address to jump to.  */
+	bis $15, $15, $18	/* Pass FP as 3rd arg.  */
+	bis $30, $30, $19	/* Pass SP as 4th arg.  */
+	jmp $31, ($27), __sigsetjmp_aux /* Call __sigsetjmp_aux.  */
+	.end __sigsetjmp
diff --git a/sysdeps/alpha/setjmp_aux.c b/sysdeps/alpha/setjmp_aux.c
new file mode 100644
index 0000000000..f92517be92
--- /dev/null
+++ b/sysdeps/alpha/setjmp_aux.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 1992, 1994 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.  */
+
+/* Global register decls must come before any function defn.  */
+
+register long int
+  r9 asm ("$9"), r10 asm ("$10"), r11 asm ("$11"), r12 asm ("$12"),
+  r13 asm ("$13"), r14 asm ("$14");
+
+register long int *fp asm ("$15"), *sp asm ("$30"), *retpc asm ("$26");
+
+#if 1				/* XXX */
+register double
+  f2 asm ("$f2"), f3 asm ("$f3"), f4 asm ("$f4"), f5 asm ("$f5"),
+  f6 asm ("$f6"), f7 asm ("$f7"), f8 asm ("$f8"), f9 asm ("$f9");
+#endif
+
+
+#include <setjmp.h>
+
+
+/* Save the current program position in ENV and return 0.  */
+int
+__sigsetjmp_aux (sigjmp_buf env, int savemask, long int *sp, long int *fp)
+{
+  /* Save the integer registers.  */
+  env[0].__jmpbuf[0].__9 = r9;
+  env[0].__jmpbuf[0].__10 = r10;
+  env[0].__jmpbuf[0].__11 = r11;
+  env[0].__jmpbuf[0].__12 = r12;
+  env[0].__jmpbuf[0].__13 = r13;
+  env[0].__jmpbuf[0].__14 = r14;
+
+#if 1				/* XXX */
+  /* Save the floating point registers.  */
+  env[0].__jmpbuf[0].__f2 = f2;
+  env[0].__jmpbuf[0].__f3 = f3;
+  env[0].__jmpbuf[0].__f4 = f4;
+  env[0].__jmpbuf[0].__f5 = f5;
+  env[0].__jmpbuf[0].__f6 = f6;
+  env[0].__jmpbuf[0].__f7 = f7;
+  env[0].__jmpbuf[0].__f8 = f8;
+  env[0].__jmpbuf[0].__f9 = f9;
+#endif
+
+  /* Save the return address of our caller, where longjmp will jump to.  */
+  env[0].__jmpbuf[0].__pc = retpc;
+
+  /* Save the FP and SP of our caller.  The __sigsetjmp entry point
+     simply puts these in the argument registers for us to fetch.  */
+  env[0].__jmpbuf[0].__fp = fp;
+  env[0].__jmpbuf[0].__sp = sp;
+
+  /* Save the signal mask if requested.  */
+  __sigjmp_save (env, savemask);
+
+  /* Return to the original caller of __sigsetjmp.  */
+  return 0;
+}
diff --git a/sysdeps/alpha/strchr.c b/sysdeps/alpha/strchr.c
new file mode 100644
index 0000000000..69afa4b87f
--- /dev/null
+++ b/sysdeps/alpha/strchr.c
@@ -0,0 +1,84 @@
+/* Copyright (C) 1992, 1993, 1994, 1995 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.  */
+
+char *
+strchr (const char *str, int c)
+{
+  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 = str; ((unsigned long int) char_ptr & 7) != 0; ++char_ptr)
+    if (*char_ptr == c)
+      return (char *) char_ptr;
+    else if (*char_ptr == '\0')
+      return NULL;
+
+  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 (;;)
+    {
+      const unsigned long int longword = *longword_ptr++;
+      int ge, le, zero;
+
+      /* Set bits in ZERO if bytes in LONGWORD are zero.  */
+      asm ("cmpbge $31, %1, %0" : "=r" (zero) : "r" (longword));
+
+      /* Set bits in GE if bytes in CHARMASK are >= bytes in LONGWORD.  */
+      asm ("cmpbge %1, %2, %0" : "=r" (ge) : "r" (charmask), "r" (longword));
+
+      /* Set bits in LE if bytes in CHARMASK are <= bytes in LONGWORD.  */
+      asm ("cmpbge %2, %1, %0" : "=r" (le) : "r" (charmask), "r" (longword));
+
+      /* Bytes that are both <= and >= are == to C.  */
+      if (zero || (ge & le))
+	{
+	  /* Which of the bytes was the C?  */
+
+	  char *cp = (char *) (longword_ptr - 1);
+	  int i;
+
+	  for (i = 0; i < 8; i++)
+	    {
+	      if (cp[i] == c)
+		return &cp[i];
+	      if (cp[i] == 0)
+		return NULL;
+	    }
+	  return NULL;
+	}
+    }
+}
+
+#ifdef weak_alias
+#undef index
+weak_alias (strchr, index)
+#endif
diff --git a/sysdeps/alpha/strlen.c b/sysdeps/alpha/strlen.c
new file mode 100644
index 0000000000..d7744476ad
--- /dev/null
+++ b/sysdeps/alpha/strlen.c
@@ -0,0 +1,54 @@
+/* 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;
+
+  /* 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);
+	  int i;
+
+	  for (i = 0; i < 6; i++)
+	    if (cp[i] == 0)
+	      return cp - str + i;
+	  return cp - str + 7;
+	}
+    }
+}
diff --git a/sysdeps/alpha/udiv_qrnnd.S b/sysdeps/alpha/udiv_qrnnd.S
new file mode 100644
index 0000000000..942d7a884b
--- /dev/null
+++ b/sysdeps/alpha/udiv_qrnnd.S
@@ -0,0 +1,152 @@
+ # Alpha 21064 __udiv_qrnnd
+
+ # Copyright (C) 1992, 1994 Free Software Foundation, Inc.
+
+ # This file is part of the GNU MP Library.
+
+ # The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
+ # the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+        .set noreorder
+        .set noat
+
+.text
+        .align 3
+        .globl __udiv_qrnnd
+        .ent __udiv_qrnnd 0
+__udiv_qrnnd:
+__udiv_qrnnd..ng:
+        .frame $30,0,$26,0
+        .prologue 0
+#define cnt	$2
+#define tmp	$3
+#define rem_ptr	$16
+#define n1	$17
+#define n0	$18
+#define d	$19
+#define qb	$20
+
+	ldiq	cnt,16
+	blt	d,Largedivisor
+
+Loop1:	cmplt	n0,0,tmp
+	addq	n1,n1,n1
+	bis	n1,tmp,n1
+	addq	n0,n0,n0
+	cmpule	d,n1,qb
+	subq	n1,d,tmp
+	cmovne	qb,tmp,n1
+	bis	n0,qb,n0
+	cmplt	n0,0,tmp
+	addq	n1,n1,n1
+	bis	n1,tmp,n1
+	addq	n0,n0,n0
+	cmpule	d,n1,qb
+	subq	n1,d,tmp
+	cmovne	qb,tmp,n1
+	bis	n0,qb,n0
+	cmplt	n0,0,tmp
+	addq	n1,n1,n1
+	bis	n1,tmp,n1
+	addq	n0,n0,n0
+	cmpule	d,n1,qb
+	subq	n1,d,tmp
+	cmovne	qb,tmp,n1
+	bis	n0,qb,n0
+	cmplt	n0,0,tmp
+	addq	n1,n1,n1
+	bis	n1,tmp,n1
+	addq	n0,n0,n0
+	cmpule	d,n1,qb
+	subq	n1,d,tmp
+	cmovne	qb,tmp,n1
+	bis	n0,qb,n0
+	subq	cnt,1,cnt
+	bgt	cnt,Loop1
+	stq	n1,0(rem_ptr)
+	bis	$31,n0,$0
+	ret	$31,($26),1
+
+Largedivisor:
+	and	n0,1,$4
+
+	srl	n0,1,n0
+	sll	n1,63,tmp
+	or	tmp,n0,n0
+	srl	n1,1,n1
+
+	and	d,1,$6
+	srl	d,1,$5
+	addq	$5,$6,$5
+
+Loop2:	cmplt	n0,0,tmp
+	addq	n1,n1,n1
+	bis	n1,tmp,n1
+	addq	n0,n0,n0
+	cmpule	$5,n1,qb
+	subq	n1,$5,tmp
+	cmovne	qb,tmp,n1
+	bis	n0,qb,n0
+	cmplt	n0,0,tmp
+	addq	n1,n1,n1
+	bis	n1,tmp,n1
+	addq	n0,n0,n0
+	cmpule	$5,n1,qb
+	subq	n1,$5,tmp
+	cmovne	qb,tmp,n1
+	bis	n0,qb,n0
+	cmplt	n0,0,tmp
+	addq	n1,n1,n1
+	bis	n1,tmp,n1
+	addq	n0,n0,n0
+	cmpule	$5,n1,qb
+	subq	n1,$5,tmp
+	cmovne	qb,tmp,n1
+	bis	n0,qb,n0
+	cmplt	n0,0,tmp
+	addq	n1,n1,n1
+	bis	n1,tmp,n1
+	addq	n0,n0,n0
+	cmpule	$5,n1,qb
+	subq	n1,$5,tmp
+	cmovne	qb,tmp,n1
+	bis	n0,qb,n0
+	subq	cnt,1,cnt
+	bgt	cnt,Loop2
+
+	addq	n1,n1,n1
+	addq	$4,n1,n1
+	bne	$6,Odd
+	stq	n1,0(rem_ptr)
+	bis	$31,n0,$0
+	ret	$31,($26),1
+
+Odd:
+	/* q' in n0.  r' in n1.  */
+	addq	n1,n0,n1
+	cmpult	n1,n0,tmp	# tmp := carry from addq
+	beq	tmp,LLp6
+	addq	n0,1,n0
+	subq	n1,d,n1
+LLp6:	cmpult	n1,d,tmp
+	bne	tmp,LLp7
+	addq	n0,1,n0
+	subq	n1,d,n1
+LLp7:
+	stq	n1,0(rem_ptr)
+	bis	$31,n0,$0
+	ret	$31,($26),1
+
+	.end	__udiv_qrnnd