1/*-
2 * Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 9 unchanged lines hidden (view full) ---
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/lib/msun/arm/fenv.h 226218 2011-10-10 15:43:09Z das $
27 */
28
29#ifndef _FENV_H_
30#define _FENV_H_
31
32#include <sys/_types.h>
33
34#ifndef __fenv_static
--- 24 unchanged lines hidden (view full) ---
59/* Default floating-point environment */
60extern const fenv_t __fe_dfl_env;
61#define FE_DFL_ENV (&__fe_dfl_env)
62
63/* We need to be able to map status flag positions to mask flag positions */
64#define _FPUSW_SHIFT 16
65#define _ENABLE_MASK (FE_ALL_EXCEPT << _FPUSW_SHIFT)
66
67#ifdef ARM_HARD_FLOAT
68#define __rfs(__fpsr) __asm __volatile("rfs %0" : "=r" (*(__fpsr)))
69#define __wfs(__fpsr) __asm __volatile("wfs %0" : : "r" (__fpsr))
70#else
71#define __rfs(__fpsr)
72#define __wfs(__fpsr)
73#endif
74
75__fenv_static inline int
76feclearexcept(int __excepts)
77{
78 fexcept_t __fpsr;
79
80 __rfs(&__fpsr);
81 __fpsr &= ~__excepts;
--- 131 unchanged lines hidden (view full) ---
213 fenv_t __fpsr;
214
215 __rfs(&__fpsr);
216 return ((__fpsr & _ENABLE_MASK) >> _FPUSW_SHIFT);
217}
218
219#endif /* __BSD_VISIBLE */
220
221__END_DECLS
222
223#endif /* !_FENV_H_ */
2 * Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 9 unchanged lines hidden (view full) ---
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/lib/msun/arm/fenv.h 226218 2011-10-10 15:43:09Z das $
27 */
28
29#ifndef _FENV_H_
30#define _FENV_H_
31
32#include <sys/_types.h>
33
34#ifndef __fenv_static
--- 24 unchanged lines hidden (view full) ---
59/* Default floating-point environment */
60extern const fenv_t __fe_dfl_env;
61#define FE_DFL_ENV (&__fe_dfl_env)
62
63/* We need to be able to map status flag positions to mask flag positions */
64#define _FPUSW_SHIFT 16
65#define _ENABLE_MASK (FE_ALL_EXCEPT << _FPUSW_SHIFT)
66
67#ifdef ARM_HARD_FLOAT
68#define __rfs(__fpsr) __asm __volatile("rfs %0" : "=r" (*(__fpsr)))
69#define __wfs(__fpsr) __asm __volatile("wfs %0" : : "r" (__fpsr))
70#else
71#define __rfs(__fpsr)
72#define __wfs(__fpsr)
73#endif
74
75__fenv_static inline int
76feclearexcept(int __excepts)
77{
78 fexcept_t __fpsr;
79
80 __rfs(&__fpsr);
81 __fpsr &= ~__excepts;
--- 131 unchanged lines hidden (view full) ---
213 fenv_t __fpsr;
214
215 __rfs(&__fpsr);
216 return ((__fpsr & _ENABLE_MASK) >> _FPUSW_SHIFT);
217}
218
219#endif /* __BSD_VISIBLE */
220
221__END_DECLS
222
223#endif /* !_FENV_H_ */