summaryrefslogtreecommitdiff
path: root/libm/kvx/fegetround.c
diff options
context:
space:
mode:
Diffstat (limited to 'libm/kvx/fegetround.c')
-rw-r--r--libm/kvx/fegetround.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libm/kvx/fegetround.c b/libm/kvx/fegetround.c
new file mode 100644
index 000000000..05e872506
--- /dev/null
+++ b/libm/kvx/fegetround.c
@@ -0,0 +1,16 @@
+/*
+ (C) Copyright 2019 Kalray S.A.
+ This file provides fegetround for the Coolidge processor.
+*/
+
+#include <fenv.h>
+
+int fegetround(void)
+{
+ /* Get all $cs flags (exception flags and rounding mode) */
+ fenv_t rm;
+ rm = __builtin_kvx_get(KVX_SFR_CS);
+
+ /* Return the rounding mode */
+ return rm & FE_RND_MASK;
+}