是否可以使用条件跳转以 mip 为单位跳转到 $ra?

Is it possible use a conditional jump to jump to $ra in mips?

例如在一个 while 循环中:

whileloop1:
       sll $t3, $t1, 2        # i * 4
       move $t4, $a1          # temp = base address of a
       add $t4, $t4, $t3      # move the address of a[i]
       lw $t5, ($t4)          # store a[i] in temp
       bge $t5, $t0, $ra      # if a[i] >= p return 
       addi $t1, $t1, 1       # add 1 to i
       j whileloop1           #restart loop

它将link返回到这样的函数:

differentlabel:
                #some code
                jal whileloop1
                #use results 

是否可以通过某种方式跳回$ra?

有点。 mips中的分支指令使用相对寻址,这意味着你必须使用立即数据(通常是标签),而不是像$ra.[=11=这样的寄存器的内容。 ]

话虽如此,您可以使用标签,然后 return 从那里开始。

如果我想创建一个有条件的jr,我会结合一个分支和一个jr

例如如果 $s0 等于 $s1

则分支
bne $s0 $s1 dontJump
jr  $ra
dontJump: