1
1
mirror of https://github.com/foxsen/archbase.git synced 2026-04-24 10:33:54 +08:00

revise do-while assembly to make it clearer

Thanks to @3p1phany, solves #33
This commit is contained in:
zhangfuxin
2022-11-20 08:03:46 +00:00
parent 11298b65f4
commit 8a979b5e5c

View File

@@ -23,16 +23,15 @@ test_while:
addi.w $t0,$t0,1 addi.w $t0,$t0,1
b .L2 b .L2
test_dowhile: test_dowhile:
or $t0,$r0,$r0 // a : $a0
or $t3,$r0,$r0 // sum : $t0
.L2: // i : $t1
add.w $t1,$t3,$t0 or $t0,$r0,$r0
addi.w $t2,$t0,1 or $t1,$r0,$r0
or $t3,$t1,$r0 .L1:
or $t0,$t2,$r0 add.w $t0,$t0,$t1
blt $t2,$a0,.L2 addi.w $t1,$t1,1
or $a0,$t1,$r0 blt $t1,$a0,.L1
jr $ra or $a0,$t1,$r0
jr $ra