fetestexcept.c 556 B

123456789101112131415161718192021
  1. /*
  2. (C) Copyright 2019 Kalray S.A.
  3. This file provides fesetexcept for the Coolidge processor.
  4. */
  5. #include <fenv.h>
  6. int fetestexcept(int excepts)
  7. {
  8. /* Mask excepts to be sure only supported flag bits are set */
  9. excepts &= FE_ALL_EXCEPT;
  10. /* Get the current exception flags of the $cs register. */
  11. fexcept_t flags;
  12. flags = __builtin_kvx_get(KVX_SFR_CS);
  13. /* Return the floating-point exception macros that are both included
  14. in excepts and correspond to the floating-point exceptions
  15. currently set. */
  16. return (flags & excepts);
  17. }