mirror of git://sourceware.org/git/glibc.git
* sysdeps/x86_64/fpu/fesetenv.c (fesetenv): Fix setting of default
mode. * sysdeps/x86_64/fpu/fsetexcptflg.c (fesetexceptflag): Do not clear whole mxcsr but only exceptions.
This commit is contained in:
parent
59fed0e26d
commit
2e58582091
|
@ -1,5 +1,5 @@
|
||||||
/* Install given floating-point environment.
|
/* Install given floating-point environment.
|
||||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -45,10 +45,9 @@ fesetenv (const fenv_t *envp)
|
||||||
temp.__data_selector = 0;
|
temp.__data_selector = 0;
|
||||||
/* Set mask for SSE MXCSR. */
|
/* Set mask for SSE MXCSR. */
|
||||||
temp.__mxcsr |= (FE_ALL_EXCEPT << 7);
|
temp.__mxcsr |= (FE_ALL_EXCEPT << 7);
|
||||||
/* Set rounding to FE_TOWARDZERO. */
|
/* Set rounding to FE_TONEAREST. */
|
||||||
temp.__mxcsr &= ~(FE_TOWARDZERO << 3);
|
temp.__mxcsr &= ~ 0x6000;
|
||||||
/* Disable exceptions. */
|
temp.__mxcsr |= (FE_TONEAREST << 3);
|
||||||
temp.__mxcsr &= ~FE_ALL_EXCEPT;
|
|
||||||
}
|
}
|
||||||
else if (envp == FE_NOMASK_ENV)
|
else if (envp == FE_NOMASK_ENV)
|
||||||
{
|
{
|
||||||
|
@ -60,11 +59,11 @@ fesetenv (const fenv_t *envp)
|
||||||
temp.__data_offset = 0;
|
temp.__data_offset = 0;
|
||||||
temp.__data_selector = 0;
|
temp.__data_selector = 0;
|
||||||
/* Set mask for SSE MXCSR. */
|
/* Set mask for SSE MXCSR. */
|
||||||
|
/* Set rounding to FE_TONEAREST. */
|
||||||
|
temp.__mxcsr &= ~ 0x6000;
|
||||||
|
temp.__mxcsr |= (FE_TONEAREST << 3);
|
||||||
|
/* Do not mask exceptions. */
|
||||||
temp.__mxcsr &= ~(FE_ALL_EXCEPT << 7);
|
temp.__mxcsr &= ~(FE_ALL_EXCEPT << 7);
|
||||||
/* Set rounding to FE_TOWARDZERO. */
|
|
||||||
temp.__mxcsr &= ~(FE_TOWARDZERO << 3);
|
|
||||||
/* Disable exceptions. */
|
|
||||||
temp.__mxcsr &= ~FE_ALL_EXCEPT;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Set floating-point environment exception handling.
|
/* Set floating-point environment exception handling.
|
||||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
Copyright (C) 2001, 2003 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -44,7 +44,7 @@ fesetexceptflag (const fexcept_t *flagp, int excepts)
|
||||||
/* And now the same for SSE. */
|
/* And now the same for SSE. */
|
||||||
__asm__ ("stmxcsr %0" : "=m" (*&mxcsr));
|
__asm__ ("stmxcsr %0" : "=m" (*&mxcsr));
|
||||||
|
|
||||||
mxcsr &= (excepts & FE_ALL_EXCEPT);
|
mxcsr &= ~(excepts & FE_ALL_EXCEPT);
|
||||||
mxcsr |= *flagp & excepts & FE_ALL_EXCEPT;
|
mxcsr |= *flagp & excepts & FE_ALL_EXCEPT;
|
||||||
|
|
||||||
__asm__ ("ldmxcsr %0" : : "m" (*&mxcsr));
|
__asm__ ("ldmxcsr %0" : : "m" (*&mxcsr));
|
||||||
|
|
Loading…
Reference in New Issue