diff options
Diffstat (limited to 'lib/libc/arch/sparc')
-rw-r--r-- | lib/libc/arch/sparc/gdtoa/Makefile.inc | 3 | ||||
-rw-r--r-- | lib/libc/arch/sparc/gdtoa/arith.h | 3 | ||||
-rw-r--r-- | lib/libc/arch/sparc/gdtoa/gd_qnan.h | 12 | ||||
-rw-r--r-- | lib/libc/arch/sparc/gdtoa/strtold.c | 45 | ||||
-rw-r--r-- | lib/libc/arch/sparc/gen/Makefile.inc | 3 | ||||
-rw-r--r-- | lib/libc/arch/sparc/gen/fpclassifyl.c | 44 | ||||
-rw-r--r-- | lib/libc/arch/sparc/gen/isfinitel.c | 27 | ||||
-rw-r--r-- | lib/libc/arch/sparc/gen/isinfl.c | 29 | ||||
-rw-r--r-- | lib/libc/arch/sparc/gen/isnanl.c | 29 | ||||
-rw-r--r-- | lib/libc/arch/sparc/gen/isnormall.c | 27 |
10 files changed, 221 insertions, 1 deletions
diff --git a/lib/libc/arch/sparc/gdtoa/Makefile.inc b/lib/libc/arch/sparc/gdtoa/Makefile.inc new file mode 100644 index 00000000000..9a21a743db8 --- /dev/null +++ b/lib/libc/arch/sparc/gdtoa/Makefile.inc @@ -0,0 +1,3 @@ +# $OpenBSD: Makefile.inc,v 1.1 2008/09/07 20:36:07 martynas Exp $ + +SRCS+= strtord.c strtorQ.c diff --git a/lib/libc/arch/sparc/gdtoa/arith.h b/lib/libc/arch/sparc/gdtoa/arith.h new file mode 100644 index 00000000000..e1954befb99 --- /dev/null +++ b/lib/libc/arch/sparc/gdtoa/arith.h @@ -0,0 +1,3 @@ +#define IEEE_MC68k +#define Arith_Kind_ASL 2 +#define Double_Align diff --git a/lib/libc/arch/sparc/gdtoa/gd_qnan.h b/lib/libc/arch/sparc/gdtoa/gd_qnan.h new file mode 100644 index 00000000000..b25361613d6 --- /dev/null +++ b/lib/libc/arch/sparc/gdtoa/gd_qnan.h @@ -0,0 +1,12 @@ +#define f_QNAN 0x7fffffff +#define d_QNAN0 0x7fffffff +#define d_QNAN1 0xffffffff +#define ld_QNAN0 0x7fffffff +#define ld_QNAN1 0xffffffff +#define ld_QNAN2 0x0 +#define ld_QNAN3 0x0 +#define ldus_QNAN0 0x7fff +#define ldus_QNAN1 0xffff +#define ldus_QNAN2 0xffff +#define ldus_QNAN3 0xffff +#define ldus_QNAN4 0x0 diff --git a/lib/libc/arch/sparc/gdtoa/strtold.c b/lib/libc/arch/sparc/gdtoa/strtold.c new file mode 100644 index 00000000000..3a5e322f01a --- /dev/null +++ b/lib/libc/arch/sparc/gdtoa/strtold.c @@ -0,0 +1,45 @@ +/* $OpenBSD: strtold.c,v 1.1 2008/09/07 20:36:07 martynas Exp $ */ +/*- + * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Machine-dependent glue to integrate David Gay's gdtoa + * package into libc for architectures where a long double + * uses quad precision, such as sparc64. + */ + +#include <float.h> + +#include "gdtoaimp.h" + +long double +strtold(const char * __restrict s, char ** __restrict sp) +{ + long double result; + + strtorQ(s, sp, FLT_ROUNDS, &result); + return result; +} diff --git a/lib/libc/arch/sparc/gen/Makefile.inc b/lib/libc/arch/sparc/gen/Makefile.inc index 85710859f3b..4d0fcc097c8 100644 --- a/lib/libc/arch/sparc/gen/Makefile.inc +++ b/lib/libc/arch/sparc/gen/Makefile.inc @@ -1,8 +1,9 @@ -# $OpenBSD: Makefile.inc,v 1.6 2008/07/24 09:31:06 martynas Exp $ +# $OpenBSD: Makefile.inc,v 1.7 2008/09/07 20:36:08 martynas Exp $ SRCS+= _setjmp.S fabs.S infinity.c ldexp.c modf.S nan.c SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \ fpsetround.c fpsetsticky.c +SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c isnormall.c SRCS+= fixunsdfsi.S mul.S umul.S saveregs.S setjmp.S sigsetjmp.S SRCS+= alloca.c diff --git a/lib/libc/arch/sparc/gen/fpclassifyl.c b/lib/libc/arch/sparc/gen/fpclassifyl.c new file mode 100644 index 00000000000..d569ef90430 --- /dev/null +++ b/lib/libc/arch/sparc/gen/fpclassifyl.c @@ -0,0 +1,44 @@ +/* $OpenBSD: fpclassifyl.c,v 1.1 2008/09/07 20:36:08 martynas Exp $ */ +/* + * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/types.h> +#include <machine/ieee.h> +#include <math.h> + +int +__fpclassifyl(long double e) +{ + struct ieee_ext *p = (struct ieee_ext *)&e; + + if (p->ext_exp == 0) { + if (p->ext_frach == 0 && p->ext_frachm == 0 && + p->ext_fraclm == 0 && p->ext_fracl == 0) + return FP_ZERO; + else + return FP_SUBNORMAL; + } + + if (p->ext_exp == EXT_EXP_INFNAN) { + if (p->ext_frach == 0 && p->ext_frachm == 0 && + p->ext_fraclm == 0 && p->ext_fracl == 0) + return FP_INFINITE; + else + return FP_NAN; + } + + return FP_NORMAL; +} diff --git a/lib/libc/arch/sparc/gen/isfinitel.c b/lib/libc/arch/sparc/gen/isfinitel.c new file mode 100644 index 00000000000..f60c9f1af85 --- /dev/null +++ b/lib/libc/arch/sparc/gen/isfinitel.c @@ -0,0 +1,27 @@ +/* $OpenBSD: isfinitel.c,v 1.1 2008/09/07 20:36:08 martynas Exp $ */ +/* + * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/types.h> +#include <machine/ieee.h> + +int +__isfinitel(long double e) +{ + struct ieee_ext *p = (struct ieee_ext *)&e; + + return (p->ext_exp != EXT_EXP_INFNAN); +} diff --git a/lib/libc/arch/sparc/gen/isinfl.c b/lib/libc/arch/sparc/gen/isinfl.c new file mode 100644 index 00000000000..8c11b447689 --- /dev/null +++ b/lib/libc/arch/sparc/gen/isinfl.c @@ -0,0 +1,29 @@ +/* $OpenBSD: isinfl.c,v 1.1 2008/09/07 20:36:08 martynas Exp $ */ +/* + * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/types.h> +#include <machine/ieee.h> + +int +__isinfl(long double e) +{ + struct ieee_ext *p = (struct ieee_ext *)&e; + + return (p->ext_exp == EXT_EXP_INFNAN && + p->ext_frach == 0 && p->ext_frachm == 0 && + p->ext_fraclm == 0 && p->ext_fracl == 0); +} diff --git a/lib/libc/arch/sparc/gen/isnanl.c b/lib/libc/arch/sparc/gen/isnanl.c new file mode 100644 index 00000000000..e5cfb5ae788 --- /dev/null +++ b/lib/libc/arch/sparc/gen/isnanl.c @@ -0,0 +1,29 @@ +/* $OpenBSD: isnanl.c,v 1.1 2008/09/07 20:36:08 martynas Exp $ */ +/* + * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/types.h> +#include <machine/ieee.h> + +int +__isnanl(long double e) +{ + struct ieee_ext *p = (struct ieee_ext *)&e; + + return (p->ext_exp == EXT_EXP_INFNAN && + (p->ext_frach != 0 || p->ext_frachm != 0 || + p->ext_fraclm != 0 || p->ext_fracl != 0)); +} diff --git a/lib/libc/arch/sparc/gen/isnormall.c b/lib/libc/arch/sparc/gen/isnormall.c new file mode 100644 index 00000000000..91df6fe51d0 --- /dev/null +++ b/lib/libc/arch/sparc/gen/isnormall.c @@ -0,0 +1,27 @@ +/* $OpenBSD: isnormall.c,v 1.1 2008/09/07 20:36:08 martynas Exp $ */ +/* + * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/types.h> +#include <machine/ieee.h> + +int +__isnormall(long double e) +{ + struct ieee_ext *p = (struct ieee_ext *)&e; + + return (p->ext_exp != 0 && p->ext_exp != EXT_EXP_INFNAN); +} |