I am having difficulty understanding why the jump in my bge statement jumps over to the label and then ends while the other two execute the label and return. I am somewhat new to this, and hopefully, there is a link or another post with a similar question that I couldn't find. I have left comments on how it looks to me and the result of the code at the end of nop, and I might be wrong, and if I am hopefully, I can be guided on how it should work.
.globl main
.data
.text
main:
li $t5, 8
li $t6, 9
blt $t6,$t5, L1 // if (9 < 8) goto L1
addi $t1, $t1, 2 // $t1 = 2
L1:
addi $t1, $t1, 1 // $t1 = 3
nop // $t1 = 3
li $t7, 2
li $t3, 2
bne $t7,$t3, L2 // if ( 2 == 2) goto L2
addi $t3, $t3, 2 // $t3 = 9
L2:
addi $t3, $t3, 5 // $t3 = 7
nop // $t3 = 9
li $t6, 4
li $t5, 1
bge $t6,$t5, L3 // if (4 >= 1) goto L3
add $t6, $t6, $t5
addi $t6, $t6, 3
L3:
addi $t6, $t6, 5 // $t6 = 9
nop // $t6 = 9
Aucun commentaire:
Enregistrer un commentaire