C源代码:点击(此处)折叠或打开int con(int x , int y){        int result;        if(x y)                result = y -x;        else                result = x - y;        return result;}gcc -Og con.c -S汇编代码点击(此处)折叠或打开con:    .frame    $sp,0,$31        # vars= 0, regs= 0/0, args= 0, gp= 0    .mask    0x00000000,0    .fmask    0x00000000,0    .set    noreorder    .set    nomacro    slt    $24,$4,$5  # 如果第一个入参小于第二个入参,则置临时变量$24为1    beq    $24,$0,$L2  #如果$24为0,则返回x-y    nop    j    $31    subu    $2,$5,$4  #如果$24为1,则返回y-x$L2:    j    $31    subu    $2,$4,$5mips的跳转指令如下 b target # unconditional branch to program label targetbeq $t0,$t1,target # branch to target if $t0 = $t1blt $t0,$t1,target # branch to target if $t0 $t1ble $t0,$t1,target # branch to target if $t0 $t1bgt $t0,$t1,target # branch to target if $t0 > $t1bge $t0,$t1,target # branch to target if $t0 >= $t1bne $t0,$t1,target # branch to target if $t0 $t1
09-04 22:12
查看更多