aboutsummaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2016-07-07 19:28:47 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2016-07-07 19:28:47 -0700
commitaff36b0963e6eee63906b3d8622be5a98ba27a43 (patch)
tree44f1e0a6c53c0b83e46bbc661f62f149ed470379 /benchmarks
parentd05da334979f92f10054a21fb5f98cac87484271 (diff)
downloadriscv-tests-aff36b0963e6eee63906b3d8622be5a98ba27a43.zip
riscv-tests-aff36b0963e6eee63906b3d8622be5a98ba27a43.tar.gz
riscv-tests-aff36b0963e6eee63906b3d8622be5a98ba27a43.tar.bz2
Don't use FPU in benchmarks that don't need to use the FPU
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/common/crt.S27
-rw-r--r--benchmarks/common/syscalls.c3
-rw-r--r--benchmarks/common/util.h2
-rw-r--r--benchmarks/dhrystone/dhrystone.h2
4 files changed, 13 insertions, 21 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[])
diff --git a/benchmarks/dhrystone/dhrystone.h b/benchmarks/dhrystone/dhrystone.h
index 89616af..e350c17 100644
--- a/benchmarks/dhrystone/dhrystone.h
+++ b/benchmarks/dhrystone/dhrystone.h
@@ -412,7 +412,7 @@ struct tms time_info;
#endif /* TIME */
-#define Mic_secs_Per_Second 1000000.0
+#define Mic_secs_Per_Second 1000000
#define NUMBER_OF_RUNS 500 /* Default number of runs */
#ifdef NOSTRUCTASSIGN