Back to index

glibc  2.9
Functions
feenablxcpt.c File Reference
#include <fenv.h>
#include <unistd.h>
#include <ldsodefs.h>
#include <dl-procinfo.h>

Go to the source code of this file.

Functions

int feenableexcept (int excepts)

Function Documentation

int feenableexcept ( int  excepts)

Definition at line 27 of file feenablxcpt.c.

{
  unsigned short int new_exc;
  unsigned short int old_exc;

  /* Get the current control word.  */
  __asm__ ("fstcw %0" : "=m" (*&new_exc));

  excepts &= FE_ALL_EXCEPT;
  old_exc = (~new_exc) & FE_ALL_EXCEPT;

  new_exc &= ~excepts;
  __asm__ ("fldcw %0" : : "m" (*&new_exc));

  /* If the CPU supports SSE we set the MXCSR as well.  */
  if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
    {
      unsigned int xnew_exc;

      /* Get the current control word.  */
      __asm__ ("stmxcsr %0" : "=m" (*&xnew_exc));

      xnew_exc &= ~(excepts << 7);

      __asm__ ("ldmxcsr %0" : : "m" (*&xnew_exc));
    }

  return old_exc;
}

Here is the call graph for this function: