diff options
| author | Roland McGrath <roland@gnu.org> | 1995-02-18 01:27:10 +0000 |
|---|---|---|
| committer | Roland McGrath <roland@gnu.org> | 1995-02-18 01:27:10 +0000 |
| commit | 28f540f45bbacd939bfd07f213bcad2bf730b1bf (patch) | |
| tree | 15f07c4c43d635959c6afee96bde71fb1b3614ee /sysdeps/alpha | |
| download | glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.xz glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.zip | |
initial import
Diffstat (limited to 'sysdeps/alpha')
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/ |
