Like tests, pass the benchmarks if XLEN disagrees
[riscv-tests.git] / benchmarks / common / crt.S
index ea07099af31e393e44bfceabef4ac30311c9c829..be03ebbdb3e6b9a54ea835225d8e89963b3bb1d7 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "encoding.h"
 
-#ifdef __riscv64
+#if __riscv_xlen == 64
 # define LREG ld
 # define SREG sd
 # define REGBYTES 8
@@ -12,7 +12,7 @@
 # define REGBYTES 4
 #endif
 
-  .text
+  .section ".text.init"
   .globl _start
 _start:
   la t0, trap_entry
@@ -55,17 +55,18 @@ _start:
   csrs mstatus, t0
 
   # make sure XLEN agrees with compilation choice
-  csrr t0, misa
-#ifdef __riscv64
-  bltz t0, 1f
-#else
+  li t0, 1
+  slli t0, t0, 31
+#if __riscv_xlen == 64
   bgez t0, 1f
+#else
+  bltz t0, 1f
 #endif
-  li a0, 1234
-  j tohost_exit
+  li a0, 1
+  sw a0, tohost, t0
 1:
 
-#ifdef __riscv_hard_float
+#ifdef __riscv_flen
   # initialize FPU if we have one
   andi t0, t0, 1 << ('f' - 'a')
   beqz t0, 1f