Deleted Added
full compact
fenv.c (203441) fenv.c (226218)
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 *
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/i387/fenv.c 203441 2010-02-03 20:23:47Z kib $
26 * $FreeBSD: head/lib/msun/i387/fenv.c 226218 2011-10-10 15:43:09Z das $
27 */
28
29#include <sys/cdefs.h>
30#include <sys/types.h>
31#include <machine/npx.h>
27 */
28
29#include <sys/cdefs.h>
30#include <sys/types.h>
31#include <machine/npx.h>
32#include "fenv.h"
33
32
33#define __fenv_static
34#include <fenv.h>
35
36#ifdef __GNUC_GNU_INLINE__
37#error "This file must be compiled with C99 'inline' semantics"
38#endif
39
34const fenv_t __fe_dfl_env = {
35 __INITIAL_NPXCW__,
36 0x0000,
37 0x0000,
38 0x1f80,
39 0xffffffff,
40 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }

--- 36 unchanged lines hidden (view full) ---

78 __has_sse = __SSE_YES;
79 return (1);
80 }
81 }
82 __has_sse = __SSE_NO;
83 return (0);
84}
85
40const fenv_t __fe_dfl_env = {
41 __INITIAL_NPXCW__,
42 0x0000,
43 0x0000,
44 0x1f80,
45 0xffffffff,
46 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
47 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }

--- 36 unchanged lines hidden (view full) ---

84 __has_sse = __SSE_YES;
85 return (1);
86 }
87 }
88 __has_sse = __SSE_NO;
89 return (0);
90}
91
92extern inline int feclearexcept(int __excepts);
93extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts);
94
86int
87fesetexceptflag(const fexcept_t *flagp, int excepts)
88{
89 fenv_t env;
90 __uint32_t mxcsr;
91
92 __fnstenv(&env);
93 env.__status &= ~excepts;

--- 15 unchanged lines hidden (view full) ---

109{
110 fexcept_t ex = excepts;
111
112 fesetexceptflag(&ex, excepts);
113 __fwait();
114 return (0);
115}
116
95int
96fesetexceptflag(const fexcept_t *flagp, int excepts)
97{
98 fenv_t env;
99 __uint32_t mxcsr;
100
101 __fnstenv(&env);
102 env.__status &= ~excepts;

--- 15 unchanged lines hidden (view full) ---

118{
119 fexcept_t ex = excepts;
120
121 fesetexceptflag(&ex, excepts);
122 __fwait();
123 return (0);
124}
125
126extern inline int fetestexcept(int __excepts);
127extern inline int fegetround(void);
128extern inline int fesetround(int __round);
129
117int
118fegetenv(fenv_t *envp)
119{
120 __uint32_t mxcsr;
121
122 __fnstenv(envp);
123 /*
124 * fnstenv masks all exceptions, so we need to restore

--- 19 unchanged lines hidden (view full) ---

144 __set_mxcsr(*envp, mxcsr);
145 mxcsr &= ~FE_ALL_EXCEPT;
146 mxcsr |= FE_ALL_EXCEPT << _SSE_EMASK_SHIFT;
147 __ldmxcsr(mxcsr);
148 }
149 return (0);
150}
151
130int
131fegetenv(fenv_t *envp)
132{
133 __uint32_t mxcsr;
134
135 __fnstenv(envp);
136 /*
137 * fnstenv masks all exceptions, so we need to restore

--- 19 unchanged lines hidden (view full) ---

157 __set_mxcsr(*envp, mxcsr);
158 mxcsr &= ~FE_ALL_EXCEPT;
159 mxcsr |= FE_ALL_EXCEPT << _SSE_EMASK_SHIFT;
160 __ldmxcsr(mxcsr);
161 }
162 return (0);
163}
164
165extern inline int fesetenv(const fenv_t *__envp);
166
152int
153feupdateenv(const fenv_t *envp)
154{
155 __uint32_t mxcsr;
156 __uint16_t status;
157
158 __fnstsw(&status);
159 if (__HAS_SSE())

--- 43 unchanged lines hidden (view full) ---

203 control |= mask;
204 __fldcw(control);
205 if (__HAS_SSE()) {
206 mxcsr |= mask << _SSE_EMASK_SHIFT;
207 __ldmxcsr(mxcsr);
208 }
209 return (~omask);
210}
167int
168feupdateenv(const fenv_t *envp)
169{
170 __uint32_t mxcsr;
171 __uint16_t status;
172
173 __fnstsw(&status);
174 if (__HAS_SSE())

--- 43 unchanged lines hidden (view full) ---

218 control |= mask;
219 __fldcw(control);
220 if (__HAS_SSE()) {
221 mxcsr |= mask << _SSE_EMASK_SHIFT;
222 __ldmxcsr(mxcsr);
223 }
224 return (~omask);
225}
211
212__weak_reference(__feenableexcept, feenableexcept);
213__weak_reference(__fedisableexcept, fedisableexcept);