Commit 36e64ee9 authored by David Monniaux's avatar David Monniaux
Browse files

use all same exact include files

parent 8528ade8
......@@ -10,27 +10,19 @@ int i32_sdiv (int a, int b)
return __divdi3 (a, b);
}
#ifdef __K1C_COS__
#include <hal/cos_registers.h>
#define K1_SFR_CS_IO_MASK COS_SFR_CS_IO_MASK
#define K1_SFR_CS_DZ_MASK COS_SFR_CS_DZ_MASK
#define K1_SFR_CS_OV_MASK COS_SFR_CS_OV_MASK
#define K1_SFR_CS_UN_MASK COS_SFR_CS_UN_MASK
#define K1_SFR_CS_IN_MASK COS_SFR_CS_IN_MASK
#define K1_SFR_CS COS_SFR_CS
#else
#include <mppa_bare_runtime/k1c/registers.h>
#endif
#ifdef OUR_OWN_FE_EXCEPT
#include <../../k1-cos/include/hal/cos_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);
int mask = (COS_SFR_CS_IO_MASK | COS_SFR_CS_DZ_MASK | COS_SFR_CS_OV_MASK | COS_SFR_CS_UN_MASK | COS_SFR_CS_IN_MASK) & excepts;
unsigned long long cs = __builtin_k1_get(COS_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);
int mask = (COS_SFR_CS_IO_MASK | COS_SFR_CS_DZ_MASK | COS_SFR_CS_OV_MASK | COS_SFR_CS_UN_MASK | COS_SFR_CS_IN_MASK) & excepts;
__builtin_k1_wfxl(COS_SFR_CS, mask);
return 0;
}
#endif
typedef unsigned long cycle_t;
#ifdef __K1C__
#ifdef __K1C_COS__
#include <hal/cos_registers.h>
#define K1_SFR_PMC COS_SFR_PMC
#define K1_SFR_PM0 COS_SFR_PM0
#else
#include <mppa_bare_runtime/k1c/registers.h>
#endif
#include <../../k1-cos/include/hal/cos_registers.h>
static inline void cycle_count_config(void)
{
/* config pmc for cycle count */
cycle_t pmc_value = __builtin_k1_get(K1_SFR_PMC);
cycle_t pmc_value = __builtin_k1_get(COS_SFR_PMC);
pmc_value &= ~(0xfULL);
__builtin_k1_set(K1_SFR_PMC, pmc_value);
__builtin_k1_set(COS_SFR_PMC, pmc_value);
}
static inline cycle_t get_cycle(void)
{
return __builtin_k1_get(K1_SFR_PM0);
return __builtin_k1_get(COS_SFR_PM0);
}
#else
#else // not K1C
static inline void cycle_count_config(void) { }
#ifdef __x86_64__
#include <x86intrin.h>
static inline cycle_t get_cycle(void) { return __rdtsc(); }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment