diff options
Diffstat (limited to 'benchmarks/common')
-rw-r--r-- | benchmarks/common/crt.S | 27 | ||||
-rw-r--r-- | benchmarks/common/syscalls.c | 3 | ||||
-rw-r--r-- | benchmarks/common/util.h | 2 |
3 files changed, 12 insertions, 20 deletions
diff --git a/benchmarks/common/crt.S b/benchmarks/common/crt.S index 7c8fc19..2dda05b 100644 --- a/benchmarks/common/crt.S +++ b/benchmarks/common/crt.S @@ -50,29 +50,26 @@ _start: li x30,0 li x31,0 - li t0, MSTATUS_FS; csrs mstatus, t0 # enable FPU - li t0, MSTATUS_XS; csrs mstatus, t0 # enable accelerator + # enable FPU and accelerator if present + li t0, MSTATUS_FS | MSTATUS_XS + csrs mstatus, t0 -#ifdef __riscv64 + # make sure XLEN agrees with compilation choice csrr t0, misa - # make sure processor supports RV64 if this was compiled for RV64 +#ifdef __riscv64 bltz t0, 1f +#else + bgez t0, 1f +#endif li a0, 1234 j tohost_exit 1: -#endif - - csrr t0, mstatus - li t1, MSTATUS_XS - and t1, t0, t1 - sw t1, have_vec, t2 - - ## if that didn't stick, we don't have a FPU, so don't initialize it - li t1, MSTATUS_FS - and t1, t0, t1 - beqz t1, 1f #ifdef __riscv_hard_float + # initialize FPU if we have one + andi t0, t0, 1 << ('f' - 'a') + beqz t0, 1f + fssr x0 fmv.s.x f0, x0 fmv.s.x f1, x0 diff --git a/benchmarks/common/syscalls.c b/benchmarks/common/syscalls.c index 0a43878..316f2fe 100644 --- a/benchmarks/common/syscalls.c +++ b/benchmarks/common/syscalls.c @@ -11,9 +11,6 @@ #define SYS_exit 93 #define SYS_stats 1234 -// initialized in crt.S -int have_vec; - extern volatile uint64_t tohost; extern volatile uint64_t fromhost; diff --git a/benchmarks/common/util.h b/benchmarks/common/util.h index c35bf7c..22f81cf 100644 --- a/benchmarks/common/util.h +++ b/benchmarks/common/util.h @@ -35,8 +35,6 @@ extern void setStats(int enable); #include <stdint.h> -extern int have_vec; - #define static_assert(cond) switch(0) { case 0: case !!(long)(cond): ; } static void printArray(const char name[], int n, const int arr[]) |