1 /*
2 (C) Copyright 2019 Kalray S.A.
3 This file provides feraiseexcept for the Coolidge processor.
4 */
5
6 #include <fenv.h>
7
feraiseexcept(int excepts)8 int feraiseexcept(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 set mask. */
14 __builtin_kvx_wfxl(KVX_SFR_CS, (long long)excepts << 32);
15
16 /* C99 requirements are met. The flags are raised at the same time
17 so order is preserved. FE_INEXACT is not raised if one of the
18 exceptions is FE_OVERFLOW or FE_UNDERFLOW. */
19
20 /* The above insn cannot fail (while the OS allows access to the
21 floating-point exception flags of the $cs register). Return
22 success. */
23 return 0;
24 }
25