1 /*
2   (C) Copyright 2019 Kalray S.A.
3   This file provides feclearexcept for the Coolidge processor.
4 */
5 
6 #include <fenv.h>
7 
feclearexcept(int excepts)8 int feclearexcept(int excepts)
9 {
10   /* Mask excepts to be sure only supported flag bits are set */
11   excepts &= FE_ALL_EXCEPT;
12 
13   /* Set $cs with 'excepts' as a clear mask. */
14   __builtin_kvx_wfxl(KVX_SFR_CS, excepts);
15 
16   /* The above insn cannot fail (while the OS allows access to the
17      floating-point exception flags of the $cs register). Return
18      success. */
19   return 0;
20 }
21