소스 검색

Replace mul instruction with a loop for rv32i

Vadim Kaushan 5 년 전
부모
커밋
579f68ddf7
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  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