aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/mppa_k1c/i64_sdiv.c
blob: 18a2c46c0d03a5f987faf15e354b8e32175d6f22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <mppa_bare_runtime/k1c/registers.h>

/* DM FIXME this is for floating point */
int fetestexcept(int excepts) {
  int mask = (K1_SFR_CS_IO_MASK | K1_SFR_CS_DZ_MASK | K1_SFR_CS_OV_MASK | K1_SFR_CS_UN_MASK | K1_SFR_CS_IN_MASK) & excepts;
  unsigned long long cs = __builtin_k1_get(K1_SFR_CS);
  return cs & mask;
}

int feclearexcept(int excepts) {
  int mask = (K1_SFR_CS_IO_MASK | K1_SFR_CS_DZ_MASK | K1_SFR_CS_OV_MASK | K1_SFR_CS_UN_MASK | K1_SFR_CS_IN_MASK) & excepts;
  __builtin_k1_wfxl(K1_SFR_CS, mask);
  return 0;
}