Initial revision
This commit is contained in:
parent
12840d1abc
commit
1608c2cc6d
1
sysdeps/alpha/Dist
Normal file
1
sysdeps/alpha/Dist
Normal file
@ -0,0 +1 @@
|
||||
setjmp_aux.c
|
3
sysdeps/alpha/Makefile
Normal file
3
sysdeps/alpha/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
ifeq ($(subdir),setjmp)
|
||||
sysdep_routines := $(sysdep_routines) setjmp_aux
|
||||
endif
|
28
sysdeps/alpha/__math.h
Normal file
28
sysdeps/alpha/__math.h
Normal file
@ -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
|
27
sysdeps/alpha/copysign.c
Normal file
27
sysdeps/alpha/copysign.c
Normal file
@ -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;
|
||||
}
|
26
sysdeps/alpha/fabs.c
Normal file
26
sysdeps/alpha/fabs.c
Normal file
@ -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;
|
||||
}
|
65
sysdeps/alpha/memchr.c
Normal file
65
sysdeps/alpha/memchr.c
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
28
sysdeps/alpha/setjmp.S
Normal file
28
sysdeps/alpha/setjmp.S
Normal file
@ -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. */
|
57
sysdeps/alpha/strlen.c
Normal file
57
sysdeps/alpha/strlen.c
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user