Start cleaning up libm.

We have two copies of fenv.h for every architecture, one of which
isn't used. We also have unused makefiles and files for architectures
we don't support.

This patch removes all the obviously useless files.

Bug: http://code.google.com/p/android/issues/detail?id=38196
Change-Id: I1919b6621ba513aa24aa947a34815bc51191487c
diff --git a/libm/include/alpha/fenv.h b/libm/include/alpha/fenv.h
deleted file mode 100644
index dc7bcb7..0000000
--- a/libm/include/alpha/fenv.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*-
- * Copyright (c) 2004-2005 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.
- *
- * $FreeBSD: src/lib/msun/alpha/fenv.h,v 1.3 2005/03/16 19:03:44 das Exp $
- */
-
-#ifndef	_FENV_H_
-#define	_FENV_H_
-
-#include <sys/_types.h>
-
-typedef	__uint64_t	fenv_t;
-typedef	__uint16_t	fexcept_t;
-
-/* Exception flags */
-#define	FE_INVALID	0x02
-#define	FE_DIVBYZERO	0x04
-#define	FE_OVERFLOW	0x08
-#define	FE_UNDERFLOW	0x10
-#define	FE_INEXACT	0x20
-#define	FE_INTOVF	0x40	/* not maskable */
-#define	FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_INEXACT | FE_INTOVF | \
-			 FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
-
-/* Rounding modes */
-#define	FE_TOWARDZERO	0x00
-#define	FE_DOWNWARD	0x01
-#define	FE_TONEAREST	0x02
-#define	FE_UPWARD	0x03
-#define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \
-			 FE_UPWARD | FE_TOWARDZERO)
-#define	_ROUND_SHIFT	58
-
-#define	_FPUSW_SHIFT	51
-
-#define	__excb()	__asm __volatile("excb")
-#define	__mf_fpcr(__cw)	__asm __volatile("mf_fpcr %0" : "=f" (*(__cw)))
-#define	__mt_fpcr(__cw)	__asm __volatile("mt_fpcr %0" : : "f" (__cw))
-
-union __fpcr {
-	double __d;
-	fenv_t __bits;
-};
-
-__BEGIN_DECLS
-
-/* Default floating-point environment */
-extern const fenv_t	__fe_dfl_env;
-#define	FE_DFL_ENV	(&__fe_dfl_env)
-
-static __inline int
-feclearexcept(int __excepts)
-{
-	union __fpcr __r;
-
-	__excb();
-	__mf_fpcr(&__r.__d);
-	__r.__bits &= ~((fenv_t)__excepts << _FPUSW_SHIFT);
-	__mt_fpcr(__r.__d);
-	__excb();
-	return (0);
-}
-
-static __inline int
-fegetexceptflag(fexcept_t *__flagp, int __excepts)
-{
-	union __fpcr __r;
-
-	__excb();
-	__mf_fpcr(&__r.__d);
-	__excb();
-	*__flagp = (__r.__bits >> _FPUSW_SHIFT) & __excepts;
-	return (0);
-}
-
-static __inline int
-fesetexceptflag(const fexcept_t *__flagp, int __excepts)
-{
-	union __fpcr __r;
-	fenv_t __xflag, __xexcepts;
-
-	__xflag = (fenv_t)*__flagp << _FPUSW_SHIFT;
-	__xexcepts = (fenv_t)__excepts << _FPUSW_SHIFT;
-	__excb();
-	__mf_fpcr(&__r.__d);
-	__r.__bits &= ~__xexcepts;
-	__r.__bits |= __xflag & __xexcepts;
-	__mt_fpcr(__r.__d);
-	__excb();
-	return (0);
-}
-
-static __inline int
-feraiseexcept(int __excepts)
-{
-
-	/*
-	 * XXX Generating exceptions this way does not actually invoke
-	 * a userland trap handler when enabled, but neither do
-	 * arithmetic operations as far as I can tell.  Perhaps there
-	 * are more bugs in the kernel trap handler.
-	 */
-	fexcept_t __ex = __excepts;
-	fesetexceptflag(&__ex, __excepts);
-	return (0);
-}
-
-static __inline int
-fetestexcept(int __excepts)
-{
-	union __fpcr __r;
-
-	__excb();
-	__mf_fpcr(&__r.__d);
-	__excb();
-	return ((__r.__bits >> _FPUSW_SHIFT) & __excepts);
-}
-
-static __inline int
-fegetround(void)
-{
-	union __fpcr __r;
-
-	/*
-	 * No exception barriers should be required here if we assume
-	 * that only fesetround() can change the rounding mode.
-	 */
-	__mf_fpcr(&__r.__d);
-	return ((int)(__r.__bits >> _ROUND_SHIFT) & _ROUND_MASK);
-}
-
-static __inline int
-fesetround(int __round)
-{
-	union __fpcr __r;
-
-	if (__round & ~_ROUND_MASK)
-		return (-1);
-	__excb();
-	__mf_fpcr(&__r.__d);
-	__r.__bits &= ~((fenv_t)_ROUND_MASK << _ROUND_SHIFT);
-	__r.__bits |= (fenv_t)__round << _ROUND_SHIFT;
-	__mt_fpcr(__r.__d);
-	__excb();
-	return (0);
-}
-
-int	fegetenv(fenv_t *__envp);
-int	feholdexcept(fenv_t *__envp);
-int	fesetenv(const fenv_t *__envp);
-int	feupdateenv(const fenv_t *__envp);
-
-#if __BSD_VISIBLE
-
-int	feenableexcept(int __mask);
-int	fedisableexcept(int __mask);
-int	fegetexcept(void);
-
-#endif /* __BSD_VISIBLE */
-
-__END_DECLS
-
-#endif	/* !_FENV_H_ */
diff --git a/libm/include/amd64/fenv.h b/libm/include/amd64/fenv.h
deleted file mode 100644
index c4f9432..0000000
--- a/libm/include/amd64/fenv.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*-
- * Copyright (c) 2004-2005 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.
- *
- * $FreeBSD: src/lib/msun/amd64/fenv.h,v 1.5 2005/03/16 22:34:14 das Exp $
- */
-
-#ifndef	_FENV_H_
-#define	_FENV_H_
-
-#include <sys/cdefs.h>
-#include <sys/_types.h>
-
-typedef struct {
-	struct {
-		__uint32_t	__control;
-		__uint32_t	__status;
-		__uint32_t	__tag;
-		char		__other[16];
-	} __x87;
-	__uint32_t		__mxcsr;
-} fenv_t;
-
-typedef	__uint16_t	fexcept_t;
-
-/* Exception flags */
-#define	FE_INVALID	0x01
-#define	FE_DENORMAL	0x02
-#define	FE_DIVBYZERO	0x04
-#define	FE_OVERFLOW	0x08
-#define	FE_UNDERFLOW	0x10
-#define	FE_INEXACT	0x20
-#define	FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \
-			 FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
-
-/* Rounding modes */
-#define	FE_TONEAREST	0x0000
-#define	FE_DOWNWARD	0x0400
-#define	FE_UPWARD	0x0800
-#define	FE_TOWARDZERO	0x0c00
-#define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \
-			 FE_UPWARD | FE_TOWARDZERO)
-
-/*
- * As compared to the x87 control word, the SSE unit's control word
- * has the rounding control bits offset by 3 and the exception mask
- * bits offset by 7.
- */
-#define	_SSE_ROUND_SHIFT	3
-#define	_SSE_EMASK_SHIFT	7
-
-__BEGIN_DECLS
-
-/* Default floating-point environment */
-extern const fenv_t	__fe_dfl_env;
-#define	FE_DFL_ENV	(&__fe_dfl_env)
-
-#define	__fldcw(__cw)		__asm __volatile("fldcw %0" : : "m" (__cw))
-#define	__fldenv(__env)		__asm __volatile("fldenv %0" : : "m" (__env))
-#define	__fnclex()		__asm __volatile("fnclex")
-#define	__fnstenv(__env)	__asm __volatile("fnstenv %0" : "=m" (*(__env)))
-#define	__fnstcw(__cw)		__asm __volatile("fnstcw %0" : "=m" (*(__cw)))
-#define	__fnstsw(__sw)		__asm __volatile("fnstsw %0" : "=am" (*(__sw)))
-#define	__fwait()		__asm __volatile("fwait")
-#define	__ldmxcsr(__csr)	__asm __volatile("ldmxcsr %0" : : "m" (__csr))
-#define	__stmxcsr(__csr)	__asm __volatile("stmxcsr %0" : "=m" (*(__csr)))
-
-static __inline int
-feclearexcept(int __excepts)
-{
-	fenv_t __env;
-
-	if (__excepts == FE_ALL_EXCEPT) {
-		__fnclex();
-	} else {
-		__fnstenv(&__env.__x87);
-		__env.__x87.__status &= ~__excepts;
-		__fldenv(__env.__x87);
-	}
-	__stmxcsr(&__env.__mxcsr);
-	__env.__mxcsr &= ~__excepts;
-	__ldmxcsr(__env.__mxcsr);
-	return (0);
-}
-
-static __inline int
-fegetexceptflag(fexcept_t *__flagp, int __excepts)
-{
-	int __mxcsr, __status;
-
-	__stmxcsr(&__mxcsr);
-	__fnstsw(&__status);
-	*__flagp = (__mxcsr | __status) & __excepts;
-	return (0);
-}
-
-int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
-int feraiseexcept(int __excepts);
-
-static __inline int
-fetestexcept(int __excepts)
-{
-	int __mxcsr, __status;
-
-	__stmxcsr(&__mxcsr);
-	__fnstsw(&__status);
-	return ((__status | __mxcsr) & __excepts);
-}
-
-static __inline int
-fegetround(void)
-{
-	int __control;
-
-	/*
-	 * We assume that the x87 and the SSE unit agree on the
-	 * rounding mode.  Reading the control word on the x87 turns
-	 * out to be about 5 times faster than reading it on the SSE
-	 * unit on an Opteron 244.
-	 */
-	__fnstcw(&__control);
-	return (__control & _ROUND_MASK);
-}
-
-static __inline int
-fesetround(int __round)
-{
-	int __mxcsr, __control;
-
-	if (__round & ~_ROUND_MASK)
-		return (-1);
-
-	__fnstcw(&__control);
-	__control &= ~_ROUND_MASK;
-	__control |= __round;
-	__fldcw(__control);
-
-	__stmxcsr(&__mxcsr);
-	__mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT);
-	__mxcsr |= __round << _SSE_ROUND_SHIFT;
-	__ldmxcsr(__mxcsr);
-
-	return (0);
-}
-
-int fegetenv(fenv_t *__envp);
-int feholdexcept(fenv_t *__envp);
-
-static __inline int
-fesetenv(const fenv_t *__envp)
-{
-
-	__fldenv(__envp->__x87);
-	__ldmxcsr(__envp->__mxcsr);
-	return (0);
-}
-
-int feupdateenv(const fenv_t *__envp);
-
-#if __BSD_VISIBLE
-
-int feenableexcept(int __mask);
-int fedisableexcept(int __mask);
-
-static __inline int
-fegetexcept(void)
-{
-	int __control;
-
-	/*
-	 * We assume that the masks for the x87 and the SSE unit are
-	 * the same.
-	 */
-	__fnstcw(&__control);
-	return (~__control & FE_ALL_EXCEPT);
-}
-
-#endif /* __BSD_VISIBLE */
-
-__END_DECLS
-
-#endif	/* !_FENV_H_ */
diff --git a/libm/include/arm/fenv.h b/libm/include/arm/fenv.h
index e7a8860..da7e696 100644
--- a/libm/include/arm/fenv.h
+++ b/libm/include/arm/fenv.h
@@ -29,7 +29,9 @@
 #ifndef	_FENV_H_
 #define	_FENV_H_
 
-#include <sys/_types.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
 
 typedef	__uint32_t	fenv_t;
 typedef	__uint32_t	fexcept_t;
@@ -50,7 +52,6 @@
 #define	FE_DOWNWARD	0x0003
 #define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \
 			 FE_UPWARD | FE_TOWARDZERO)
-__BEGIN_DECLS
 
 /* Default floating-point environment */
 extern const fenv_t	__fe_dfl_env;
diff --git a/libm/include/i387/fenv.h b/libm/include/i387/fenv.h
index 4e322b7..c0421c0 100644
--- a/libm/include/i387/fenv.h
+++ b/libm/include/i387/fenv.h
@@ -29,8 +29,7 @@
 #ifndef	_FENV_H_
 #define	_FENV_H_
 
-#include <sys/cdefs.h>
-#include <sys/_types.h>
+#include <sys/types.h>
 
 __BEGIN_DECLS
 
diff --git a/libm/include/ia64/fenv.h b/libm/include/ia64/fenv.h
deleted file mode 100644
index 8c6b65b..0000000
--- a/libm/include/ia64/fenv.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/*-
- * Copyright (c) 2004-2005 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.
- *
- * $FreeBSD: src/lib/msun/ia64/fenv.h,v 1.4 2005/03/16 19:03:45 das Exp $
- */
-
-#ifndef	_FENV_H_
-#define	_FENV_H_
-
-#include <sys/_types.h>
-
-typedef	__uint64_t	fenv_t;
-typedef	__uint16_t	fexcept_t;
-
-/* Exception flags */
-#define	FE_INVALID	0x01
-#define	FE_DENORMAL	0x02
-#define	FE_DIVBYZERO	0x04
-#define	FE_OVERFLOW	0x08
-#define	FE_UNDERFLOW	0x10
-#define	FE_INEXACT	0x20
-#define	FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \
-			 FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
-
-/* Rounding modes */
-#define	FE_TONEAREST	0x0000
-#define	FE_DOWNWARD	0x0400
-#define	FE_UPWARD	0x0800
-#define	FE_TOWARDZERO	0x0c00
-#define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \
-			 FE_UPWARD | FE_TOWARDZERO)
-
-__BEGIN_DECLS
-
-/* Default floating-point environment */
-extern const fenv_t	__fe_dfl_env;
-#define	FE_DFL_ENV	(&__fe_dfl_env)
-
-#define	_FPUSW_SHIFT	13
-
-#define	__stfpsr(__r)	__asm __volatile("mov %0=ar.fpsr" : "=r" (*(__r)))
-#define	__ldfpsr(__r)	__asm __volatile("mov ar.fpsr=%0;;" : : "r" (__r))
-
-static __inline int
-feclearexcept(int __excepts)
-{
-	fenv_t __fpsr;
-
-	__stfpsr(&__fpsr);
-	__fpsr &= ~((fenv_t)__excepts << _FPUSW_SHIFT);
-	__ldfpsr(__fpsr);
-	return (0);
-}
-
-static __inline int
-fegetexceptflag(fexcept_t *__flagp, int __excepts)
-{
-	fenv_t __fpsr;
-
-	__stfpsr(&__fpsr);
-	*__flagp = (fexcept_t)(__fpsr >> _FPUSW_SHIFT) & __excepts;
-	return (0);
-}
-
-static __inline int
-fesetexceptflag(const fexcept_t *__flagp, int __excepts)
-{
-	fenv_t __fpsr;
-
-	__stfpsr(&__fpsr);
-	__fpsr &= ~((fenv_t)__excepts << _FPUSW_SHIFT);
-	__fpsr |= (fenv_t)(__excepts & *__flagp) << _FPUSW_SHIFT;
-	__ldfpsr(__fpsr);
-	return (0);
-}
-
-/*
- * It is worthwhile to use the inline version of this function iff it
- * is called with arguments that are compile-time constants (due to
- * dead code elimination).  Unfortunately, gcc isn't smart enough to
- * figure this out automatically, and there's no way to tell it.
- * We assume that constant arguments will be the common case.
- */
-static __inline int
-feraiseexcept(int __excepts)
-{
-	volatile double d;
-
-	/*
-	 * With a compiler that supports the FENV_ACCESS pragma
-	 * properly, simple expressions like '0.0 / 0.0' should
-	 * be sufficient to generate traps.  Unfortunately, we
-	 * need to bring a volatile variable into the equation
-	 * to prevent incorrect optimizations.
-	 */
-	if (__excepts & FE_INVALID) {
-		d = 0.0;
-		d = 0.0 / d;
-	}
-	if (__excepts & FE_DIVBYZERO) {
-		d = 0.0;
-		d = 1.0 / d;
-	}
-	if (__excepts & FE_OVERFLOW) {
-		d = 0x1.ffp1023;
-		d *= 2.0;
-	}
-	if (__excepts & FE_UNDERFLOW) {
-		d = 0x1p-1022;
-		d /= 0x1p1023;
-	}
-	if (__excepts & FE_INEXACT) {
-		d = 0x1p-1022;
-		d += 1.0;
-	}
-	return (0);
-}
-
-static __inline int
-fetestexcept(int __excepts)
-{
-	fenv_t __fpsr;
-
-	__stfpsr(&__fpsr);
-	return ((__fpsr >> _FPUSW_SHIFT) & __excepts);
-}
-
-
-static __inline int
-fegetround(void)
-{
-	fenv_t __fpsr;
-
-	__stfpsr(&__fpsr);
-	return (__fpsr & _ROUND_MASK);
-}
-
-static __inline int
-fesetround(int __round)
-{
-	fenv_t __fpsr;
-
-	if (__round & ~_ROUND_MASK)
-		return (-1);
-	__stfpsr(&__fpsr);
-	__fpsr &= ~_ROUND_MASK;
-	__fpsr |= __round;
-	__ldfpsr(__fpsr);
-	return (0);
-}
-
-static __inline int
-fegetenv(fenv_t *__envp)
-{
-
-	__stfpsr(__envp);
-	return (0);
-}
-
-static __inline int
-feholdexcept(fenv_t *__envp)
-{
-	fenv_t __fpsr;
-
-	__stfpsr(&__fpsr);
-	*__envp = __fpsr;
-	__fpsr &= ~((fenv_t)FE_ALL_EXCEPT << _FPUSW_SHIFT);
-	__fpsr |= FE_ALL_EXCEPT;
-	__ldfpsr(__fpsr);
-	return (0);
-}
-
-static __inline int
-fesetenv(const fenv_t *__envp)
-{
-
-	__ldfpsr(*__envp);
-	return (0);
-}
-
-int feupdateenv(const fenv_t *__envp);
-
-#if __BSD_VISIBLE
-
-static __inline int
-feenableexcept(int __mask)
-{
-	fenv_t __newfpsr, __oldfpsr;
-
-	__stfpsr(&__oldfpsr);
-	__newfpsr = __oldfpsr & ~(__mask & FE_ALL_EXCEPT);
-	__ldfpsr(__newfpsr);
-	return (~__oldfpsr & FE_ALL_EXCEPT);
-}
-
-static __inline int
-fedisableexcept(int __mask)
-{
-	fenv_t __newfpsr, __oldfpsr;
-
-	__stfpsr(&__oldfpsr);
-	__newfpsr = __oldfpsr | (__mask & FE_ALL_EXCEPT);
-	__ldfpsr(__newfpsr);
-	return (~__oldfpsr & FE_ALL_EXCEPT);
-}
-
-static __inline int
-fegetexcept(void)
-{
-	fenv_t __fpsr;
-
-	__stfpsr(&__fpsr);
-	return (~__fpsr & FE_ALL_EXCEPT);
-}
-
-#endif /* __BSD_VISIBLE */
-
-__END_DECLS
-
-#endif	/* !_FENV_H_ */
diff --git a/libm/include/mips/fenv.h b/libm/include/mips/fenv.h
index e7a8860..da7e696 100644
--- a/libm/include/mips/fenv.h
+++ b/libm/include/mips/fenv.h
@@ -29,7 +29,9 @@
 #ifndef	_FENV_H_
 #define	_FENV_H_
 
-#include <sys/_types.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
 
 typedef	__uint32_t	fenv_t;
 typedef	__uint32_t	fexcept_t;
@@ -50,7 +52,6 @@
 #define	FE_DOWNWARD	0x0003
 #define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \
 			 FE_UPWARD | FE_TOWARDZERO)
-__BEGIN_DECLS
 
 /* Default floating-point environment */
 extern const fenv_t	__fe_dfl_env;
diff --git a/libm/include/powerpc/fenv.h b/libm/include/powerpc/fenv.h
deleted file mode 100644
index 3fd2389..0000000
--- a/libm/include/powerpc/fenv.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/*-
- * Copyright (c) 2004-2005 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.
- *
- * $FreeBSD: src/lib/msun/powerpc/fenv.h,v 1.3 2005/03/16 19:03:45 das Exp $
- */
-
-#ifndef	_FENV_H_
-#define	_FENV_H_
-
-#include <sys/_types.h>
-
-typedef	__uint32_t	fenv_t;
-typedef	__uint32_t	fexcept_t;
-
-/* Exception flags */
-#define	FE_INEXACT	0x02000000
-#define	FE_DIVBYZERO	0x04000000
-#define	FE_UNDERFLOW	0x08000000
-#define	FE_OVERFLOW	0x10000000
-#define	FE_INVALID	0x20000000	/* all types of invalid FP ops */
-
-/*
- * The PowerPC architecture has extra invalid flags that indicate the
- * specific type of invalid operation occurred.  These flags may be
- * tested, set, and cleared---but not masked---separately.  All of
- * these bits are cleared when FE_INVALID is cleared, but only
- * FE_VXSOFT is set when FE_INVALID is explicitly set in software.
- */
-#define	FE_VXCVI	0x00000100	/* invalid integer convert */
-#define	FE_VXSQRT	0x00000200	/* square root of a negative */
-#define	FE_VXSOFT	0x00000400	/* software-requested exception */
-#define	FE_VXVC		0x00080000	/* ordered comparison involving NaN */
-#define	FE_VXIMZ	0x00100000	/* inf * 0 */
-#define	FE_VXZDZ	0x00200000	/* 0 / 0 */
-#define	FE_VXIDI	0x00400000	/* inf / inf */
-#define	FE_VXISI	0x00800000	/* inf - inf */
-#define	FE_VXSNAN	0x01000000	/* operation on a signalling NaN */
-#define	FE_ALL_INVALID	(FE_VXCVI | FE_VXSQRT | FE_VXSOFT | FE_VXVC | \
-			 FE_VXIMZ | FE_VXZDZ | FE_VXIDI | FE_VXISI | \
-			 FE_VXSNAN | FE_INVALID)
-#define	FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_INEXACT | \
-			 FE_ALL_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
-
-/* Rounding modes */
-#define	FE_TONEAREST	0x0000
-#define	FE_TOWARDZERO	0x0001
-#define	FE_UPWARD	0x0002
-#define	FE_DOWNWARD	0x0003
-#define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \
-			 FE_UPWARD | FE_TOWARDZERO)
-
-__BEGIN_DECLS
-
-/* Default floating-point environment */
-extern const fenv_t	__fe_dfl_env;
-#define	FE_DFL_ENV	(&__fe_dfl_env)
-
-/* We need to be able to map status flag positions to mask flag positions */
-#define	_FPUSW_SHIFT	22
-#define	_ENABLE_MASK	((FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \
-			 FE_OVERFLOW | FE_UNDERFLOW) >> _FPUSW_SHIFT)
-
-#define	__mffs(__env)	__asm __volatile("mffs %0" : "=f" (*(__env)))
-#define	__mtfsf(__env)	__asm __volatile("mtfsf 255,%0" : : "f" (__env))
-
-union __fpscr {
-	double __d;
-	struct {
-		__uint32_t __junk;
-		fenv_t __reg;
-	} __bits;
-};
-
-static __inline int
-feclearexcept(int __excepts)
-{
-	union __fpscr __r;
-
-	if (__excepts & FE_INVALID)
-		__excepts |= FE_ALL_INVALID;
-	__mffs(&__r.__d);
-	__r.__bits.__reg &= ~__excepts;
-	__mtfsf(__r.__d);
-	return (0);
-}
-
-static __inline int
-fegetexceptflag(fexcept_t *__flagp, int __excepts)
-{
-	union __fpscr __r;
-
-	__mffs(&__r.__d);
-	*__flagp = __r.__bits.__reg & __excepts;
-	return (0);
-}
-
-static __inline int
-fesetexceptflag(const fexcept_t *__flagp, int __excepts)
-{
-	union __fpscr __r;
-
-	if (__excepts & FE_INVALID)
-		__excepts |= FE_ALL_EXCEPT;
-	__mffs(&__r.__d);
-	__r.__bits.__reg &= ~__excepts;
-	__r.__bits.__reg |= *__flagp & __excepts;
-	__mtfsf(__r.__d);
-	return (0);
-}
-
-static __inline int
-feraiseexcept(int __excepts)
-{
-	union __fpscr __r;
-
-	if (__excepts & FE_INVALID)
-		__excepts |= FE_VXSOFT;
-	__mffs(&__r.__d);
-	__r.__bits.__reg |= __excepts;
-	__mtfsf(__r.__d);
-	return (0);
-}
-
-static __inline int
-fetestexcept(int __excepts)
-{
-	union __fpscr __r;
-
-	__mffs(&__r.__d);
-	return (__r.__bits.__reg & __excepts);
-}
-
-static __inline int
-fegetround(void)
-{
-	union __fpscr __r;
-
-	__mffs(&__r.__d);
-	return (__r.__bits.__reg & _ROUND_MASK);
-}
-
-static __inline int
-fesetround(int __round)
-{
-	union __fpscr __r;
-
-	if (__round & ~_ROUND_MASK)
-		return (-1);
-	__mffs(&__r.__d);
-	__r.__bits.__reg &= ~_ROUND_MASK;
-	__r.__bits.__reg |= __round;
-	__mtfsf(__r.__d);
-	return (0);
-}
-
-static __inline int
-fegetenv(fenv_t *__envp)
-{
-	union __fpscr __r;
-
-	__mffs(&__r.__d);
-	*__envp = __r.__bits.__reg;
-	return (0);
-}
-
-static __inline int
-feholdexcept(fenv_t *__envp)
-{
-	union __fpscr __r;
-
-	__mffs(&__r.__d);
-	*__envp = __r.__d;
-	__r.__bits.__reg &= ~(FE_ALL_EXCEPT | _ENABLE_MASK);
-	__mtfsf(__r.__d);
-	return (0);
-}
-
-static __inline int
-fesetenv(const fenv_t *__envp)
-{
-	union __fpscr __r;
-
-	__r.__bits.__reg = *__envp;
-	__mtfsf(__r.__d);
-	return (0);
-}
-
-static __inline int
-feupdateenv(const fenv_t *__envp)
-{
-	union __fpscr __r;
-
-	__mffs(&__r.__d);
-	__r.__bits.__reg &= FE_ALL_EXCEPT;
-	__r.__bits.__reg |= *__envp;
-	__mtfsf(__r.__d);
-	return (0);
-}
-
-#if __BSD_VISIBLE
-
-static __inline int
-feenableexcept(int __mask)
-{
-	union __fpscr __r;
-	fenv_t __oldmask;
-
-	__mffs(&__r.__d);
-	__oldmask = __r.__bits.__reg;
-	__r.__bits.__reg |= (__mask & FE_ALL_EXCEPT) >> _FPUSW_SHIFT;
-	__mtfsf(__r.__d);
-	return ((__oldmask & _ENABLE_MASK) << _FPUSW_SHIFT);
-}
-
-static __inline int
-fedisableexcept(int __mask)
-{
-	union __fpscr __r;
-	fenv_t __oldmask;
-
-	__mffs(&__r.__d);
-	__oldmask = __r.__bits.__reg;
-	__r.__bits.__reg &= ~((__mask & FE_ALL_EXCEPT) >> _FPUSW_SHIFT);
-	__mtfsf(__r.__d);
-	return ((__oldmask & _ENABLE_MASK) << _FPUSW_SHIFT);
-}
-
-static __inline int
-fegetexcept(void)
-{
-	union __fpscr __r;
-
-	__mffs(&__r.__d);
-	return ((__r.__bits.__reg & _ENABLE_MASK) << _FPUSW_SHIFT);
-}
-
-#endif /* __BSD_VISIBLE */
-
-__END_DECLS
-
-#endif	/* !_FENV_H_ */
diff --git a/libm/include/sparc64/fenv.h b/libm/include/sparc64/fenv.h
deleted file mode 100644
index 684c4a2..0000000
--- a/libm/include/sparc64/fenv.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/*-
- * Copyright (c) 2004-2005 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.
- *
- * $FreeBSD: src/lib/msun/sparc64/fenv.h,v 1.3 2005/03/16 19:03:46 das Exp $
- */
-
-#ifndef	_FENV_H_
-#define	_FENV_H_
-
-#include <sys/_types.h>
-
-typedef	__uint64_t	fenv_t;
-typedef	__uint64_t	fexcept_t;
-
-/* Exception flags */
-#define	FE_INVALID	0x00000200
-#define	FE_DIVBYZERO	0x00000040
-#define	FE_OVERFLOW	0x00000100
-#define	FE_UNDERFLOW	0x00000080
-#define	FE_INEXACT	0x00000020
-#define	FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_INEXACT | \
-			 FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
-
-/*
- * Rounding modes
- *
- * We can't just use the hardware bit values here, because that would
- * make FE_UPWARD and FE_DOWNWARD negative, which is not allowed.
- */
-#define	FE_TONEAREST	0x0
-#define	FE_TOWARDZERO	0x1
-#define	FE_UPWARD	0x2
-#define	FE_DOWNWARD	0x3
-#define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \
-			 FE_UPWARD | FE_TOWARDZERO)
-#define	_ROUND_SHIFT	30
-
-__BEGIN_DECLS
-
-/* Default floating-point environment */
-extern const fenv_t	__fe_dfl_env;
-#define	FE_DFL_ENV	(&__fe_dfl_env)
-
-/* We need to be able to map status flag positions to mask flag positions */
-#define _FPUSW_SHIFT	18
-#define	_ENABLE_MASK	(FE_ALL_EXCEPT << _FPUSW_SHIFT)
-
-#define	__ldxfsr(__r)	__asm __volatile("ldx %0, %%fsr" : : "m" (__r))
-#define	__stxfsr(__r)	__asm __volatile("stx %%fsr, %0" : "=m" (*(__r)))
-
-static __inline int
-feclearexcept(int __excepts)
-{
-	fexcept_t __r;
-
-	__stxfsr(&__r);
-	__r &= ~__excepts;
-	__ldxfsr(__r);
-	return (0);
-}
-
-static __inline int
-fegetexceptflag(fexcept_t *__flagp, int __excepts)
-{
-	fexcept_t __r;
-
-	__stxfsr(&__r);
-	*__flagp = __r & __excepts;
-	return (0);
-}
-
-static __inline int
-fesetexceptflag(const fexcept_t *__flagp, int __excepts)
-{
-	fexcept_t __r;
-
-	__stxfsr(&__r);
-	__r &= ~__excepts;
-	__r |= *__flagp & __excepts;
-	__ldxfsr(__r);
-	return (0);
-}
-
-/*
- * In contrast with the ia64 platform, it seems to be worthwhile to
- * inline this function on sparc64 even when the arguments are not
- * compile-time constants.  Perhaps this depends on the register window.
- */
-static __inline int
-feraiseexcept(int __excepts)
-{
-	volatile double d;
-
-	/*
-	 * With a compiler that supports the FENV_ACCESS pragma
-	 * properly, simple expressions like '0.0 / 0.0' should
-	 * be sufficient to generate traps.  Unfortunately, we
-	 * need to bring a volatile variable into the equation
-	 * to prevent incorrect optimizations.
-	 */
-	if (__excepts & FE_INVALID) {
-		d = 0.0;
-		d = 0.0 / d;
-	}
-	if (__excepts & FE_DIVBYZERO) {
-		d = 0.0;
-		d = 1.0 / d;
-	}
-	if (__excepts & FE_OVERFLOW) {
-		d = 0x1.ffp1023;
-		d *= 2.0;
-	}
-	if (__excepts & FE_UNDERFLOW) {
-		d = 0x1p-1022;
-		d /= 0x1p1023;
-	}
-	if (__excepts & FE_INEXACT) {
-		d = 0x1p-1022;
-		d += 1.0;
-	}
-	return (0);
-}
-
-static __inline int
-fetestexcept(int __excepts)
-{
-	fexcept_t __r;
-
-	__stxfsr(&__r);
-	return (__r & __excepts);
-}
-
-static __inline int
-fegetround(void)
-{
-	fenv_t __r;
-
-	__stxfsr(&__r);
-	return ((__r >> _ROUND_SHIFT) & _ROUND_MASK);
-}
-
-static __inline int
-fesetround(int __round)
-{
-	fenv_t __r;
-
-	if (__round & ~_ROUND_MASK)
-		return (-1);
-	__stxfsr(&__r);
-	__r &= ~(_ROUND_MASK << _ROUND_SHIFT);
-	__r |= __round << _ROUND_SHIFT;
-	__ldxfsr(__r);
-	return (0);
-}
-
-static __inline int
-fegetenv(fenv_t *__envp)
-{
-
-	__stxfsr(__envp);
-	return (0);
-}
-
-static __inline int
-feholdexcept(fenv_t *__envp)
-{
-	fenv_t __r;
-
-	__stxfsr(&__r);
-	*__envp = __r;
-	__r &= ~(FE_ALL_EXCEPT | _ENABLE_MASK);
-	__ldxfsr(__r);
-	return (0);
-}
-
-static __inline int
-fesetenv(const fenv_t *__envp)
-{
-
-	__ldxfsr(*__envp);
-	return (0);
-}
-
-static __inline int
-feupdateenv(const fenv_t *__envp)
-{
-	fexcept_t __r;
-
-	__stxfsr(&__r);
-	__ldxfsr(*__envp);
-	feraiseexcept(__r & FE_ALL_EXCEPT);
-	return (0);
-}
-
-#if __BSD_VISIBLE
-
-static __inline int
-feenableexcept(int __mask)
-{
-	fenv_t __old_r, __new_r;
-
-	__stxfsr(&__old_r);
-	__new_r = __old_r | ((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT);
-	__ldxfsr(__new_r);
-	return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
-}
-
-static __inline int
-fedisableexcept(int __mask)
-{
-	fenv_t __old_r, __new_r;
-
-	__stxfsr(&__old_r);
-	__new_r = __old_r & ~((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT);
-	__ldxfsr(__new_r);
-	return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
-}
-
-static __inline int
-fegetexcept(void)
-{
-	fenv_t __r;
-
-	__stxfsr(&__r);
-	return ((__r & _ENABLE_MASK) >> _FPUSW_SHIFT);
-}
-
-#endif /* __BSD_VISIBLE */
-
-__END_DECLS
-
-#endif	/* !_FENV_H_ */