Przeglądaj źródła

Replace mul instruction with a loop for rv32i

Vadim Kaushan 5 lat temu
rodzic
commit
579f68ddf7
1 zmienionych plików z 11 dodań i 0 usunięć
  1. 11 0
      riscv-rt/asm.S

+ 11 - 0
riscv-rt/asm.S

@@ -84,7 +84,18 @@ _abs_start:
     la sp, _stack_start
     lui t0, %hi(_hart_stack_size)
     add t0, t0, %lo(_hart_stack_size)
+#ifdef __riscv_mul
     mul t0, a2, t0
+#else
+    beqz a2, 2f  // Jump if single-hart
+    mv t1, a2
+    mv t2, t0
+1:
+    add t0, t0, t2
+    addi t1, t1, -1
+    bnez t1, 1b
+2:
+#endif
     sub sp, sp, t0
 
     // Set frame pointer