diff options
Diffstat (limited to 'lib/libc/arch/m68k/gen')
-rw-r--r-- | lib/libc/arch/m68k/gen/Makefile.inc | 3 | ||||
-rw-r--r-- | lib/libc/arch/m68k/gen/fpclassifyl.c | 44 | ||||
-rw-r--r-- | lib/libc/arch/m68k/gen/isfinitel.c | 27 | ||||
-rw-r--r-- | lib/libc/arch/m68k/gen/isinfl.c | 30 | ||||
-rw-r--r-- | lib/libc/arch/m68k/gen/isnanl.c | 30 | ||||
-rw-r--r-- | lib/libc/arch/m68k/gen/isnormall.c | 27 |
6 files changed, 160 insertions, 1 deletions
diff --git a/lib/libc/arch/m68k/gen/Makefile.inc b/lib/libc/arch/m68k/gen/Makefile.inc index 698f4debf45..ae4b21ae368 100644 --- a/lib/libc/arch/m68k/gen/Makefile.inc +++ b/lib/libc/arch/m68k/gen/Makefile.inc @@ -1,9 +1,10 @@ -# $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:07 martynas Exp $ SRCS+= _setjmp.S fabs.S infinity.c ldexp.S \ modf.S nan.c setjmp.S sigsetjmp.S SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \ fpsetround.S fpsetsticky.S +SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c isnormall.c SRCS+= adddf3.S addsf3.S ashlsi3.S ashrsi3.S cmpdf2.S cmpsf2.S divdf3.S \ divsf3.S divsi3.S extendsfdf2.S fixdfsi.S fixunsdfsi.S \ floatsidf.S lshlsi3.S lshrsi3.S modsi3.S muldf3.S mulsf3.S mulsi3.S \ diff --git a/lib/libc/arch/m68k/gen/fpclassifyl.c b/lib/libc/arch/m68k/gen/fpclassifyl.c new file mode 100644 index 00000000000..19940cdd53d --- /dev/null +++ b/lib/libc/arch/m68k/gen/fpclassifyl.c @@ -0,0 +1,44 @@ +/* $OpenBSD: fpclassifyl.c,v 1.1 2008/09/07 20:36:07 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_fracl == 0) + return FP_ZERO; + else + return FP_SUBNORMAL; + } + + p->ext_frach &= ~0x80000000; /* clear normalization bit */ + + if (p->ext_exp == EXT_EXP_INFNAN) { + if (p->ext_frach == 0 && p->ext_fracl == 0) + return FP_INFINITE; + else + return FP_NAN; + } + + return FP_NORMAL; +} diff --git a/lib/libc/arch/m68k/gen/isfinitel.c b/lib/libc/arch/m68k/gen/isfinitel.c new file mode 100644 index 00000000000..c86b9309da4 --- /dev/null +++ b/lib/libc/arch/m68k/gen/isfinitel.c @@ -0,0 +1,27 @@ +/* $OpenBSD: isfinitel.c,v 1.1 2008/09/07 20:36:07 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/m68k/gen/isinfl.c b/lib/libc/arch/m68k/gen/isinfl.c new file mode 100644 index 00000000000..862c82f97e7 --- /dev/null +++ b/lib/libc/arch/m68k/gen/isinfl.c @@ -0,0 +1,30 @@ +/* $OpenBSD: isinfl.c,v 1.1 2008/09/07 20:36:07 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; + + p->ext_frach &= ~0x80000000; /* clear normalization bit */ + + return (p->ext_exp == EXT_EXP_INFNAN && + p->ext_frach == 0 && p->ext_fracl == 0); +} diff --git a/lib/libc/arch/m68k/gen/isnanl.c b/lib/libc/arch/m68k/gen/isnanl.c new file mode 100644 index 00000000000..4db08d62be6 --- /dev/null +++ b/lib/libc/arch/m68k/gen/isnanl.c @@ -0,0 +1,30 @@ +/* $OpenBSD: isnanl.c,v 1.1 2008/09/07 20:36:07 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; + + p->ext_frach &= ~0x80000000; /* clear normalization bit */ + + return (p->ext_exp == EXT_EXP_INFNAN && + (p->ext_frach != 0 || p->ext_fracl != 0)); +} diff --git a/lib/libc/arch/m68k/gen/isnormall.c b/lib/libc/arch/m68k/gen/isnormall.c new file mode 100644 index 00000000000..a8b4314afc9 --- /dev/null +++ b/lib/libc/arch/m68k/gen/isnormall.c @@ -0,0 +1,27 @@ +/* $OpenBSD: isnormall.c,v 1.1 2008/09/07 20:36:07 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); +} |