MIPS 指令

来源:互联网 发布:手机淘宝官方客服电话 编辑:程序博客网 时间:2024/05/21 08:42
MIPS汇编指令
============

Arithmetic Instructions

abs    des, src1        # des gets the absolute value of src1.
add(u) des, src1, src2  # des gets src1 + src2.
addi   $t2,$t3,5        # $t2 = $t3 + 5 加16位立即数
addiu  $t2,$t3,5        # $t2 = $t3 + 5 加16位无符号立即数
sub(u) des, src1, src2  # des gets src1 - src2.
div(u) src1, reg2       # Divide src1 by reg2, leaving the quotient in register
                        # lo and the remainder in register hi.
div(u) des, src1, src2  # des gets src1 / src2.
mul    des, src1, src2  # des gets src1 * src2.
mulo   des, src1, src2  # des gets src1 * src2, with overflow.
mult(u) src1, reg2      # Multiply src1 and reg2, leaving the low-order word
                        # in register lo and the high-order word in register hi.
rem(u) des, src1, src2  # des gets the remainder of dividing src1 by src2.
neg(u) des, src1        # des gets the negative of src1.
and    des, src1, src2  # des gets the bitwise and of src1 and src2.
nor    des, src1, src2  # des gets the bitwise logical nor of src1 and src2.
not    des, src1        # des gets the bitwise logical negation of src1.
or     des, src1, src2  # des gets the bitwise logical or of src1 and src2.
xor    des, src1, src2  # des gets the bitwise exclusive or of src1 and src2.

rol    des, src1, src2  # des gets the result of rotating left the contents of src1 by src2 bits.
ror    des, src1, src2  # des gets the result of rotating right the contents of src1 by src2 bits.
sll    des, src1, src2  # des gets src1 shifted left by src2 bits.
sra    des, src1, src2  # Right shift arithmetic.
srl    des, src1, src2  # Right shift logical.
sllv   des, src1, src2  # $t0 = $t1 << $t3,shift left logical
srlv   des, src1, src2  # $t0 = $t1 >> $t3,shift right logical
srav   des, src1, src2  # $t0 = $t1 >> $t3,shift right arithm.


Comparison Instructions

seq    des, src1, src2  # des 1 if src1 = src2, 0 otherwise.
sne    des, src1, src2  # des 1 if src1 != src2, 0 otherwise.
sge(u) des, src1, src2  # des 1 if src1 >= src2, 0 otherwise.
sgt(u) des, src1, src2  # des 1 if src1 > src2, 0 otherwise.
sle(u) des, src1, src2  # des 1 if src1 <= src2, 0 otherwise.
slt(u) des, src1, src2  # des 1 if src1 < src2, 0 otherwise.
slti   $t1,$t2,10       # 与立即数比较


Branch and Jump Instructions

b      lab              # Unconditional branch to lab.
beq    src1, src2, lab  # Branch to lab if src1 = src2 .
bne    src1, src2, lab  # Branch to lab if src1 != src2 .
bge(u) src1, src2, lab  # Branch to lab if src1 >= src2 .
bgt(u) src1, src2, lab  # Branch to lab if src1 > src2 .
ble(u) src1, src2, lab  # Branch to lab if src1 <= src2 .
blt(u) src1, src2, lab  # Branch to lab if src1 < src2 .
beqz   src1, lab        # Branch to lab if src1 = 0.
bnez   src1, lab        # Branch to lab if src1 != 0.
bgez   src1, lab        # Branch to lab if src1 >= 0.
bgtz   src1, lab        # Branch to lab if src1 > 0.
blez   src1, lab        # Branch to lab if src1 <= 0.
bltz   src1, lab        # Branch to lab if src1 < 0.
bgezal src1, lab        # If src1 >= 0, then put the address of the next instruction
                        # into $ra and branch to lab.
bgtzal src1, lab        # If src1 > 0, then put the address of the next instruction
                        # into $ra and branch to lab.
bltzal src1, lab        # If src1 < 0, then put the address of the next instruction
                        # into $ra and branch to lab.

j      label            # Jump to label lab.
jr     src1             # Jump to location src1.
jal    label            # Jump to label lab, and store the address of the next instruction in $ra.
jalr   src1             # Jump to location src1, and store the address of the next instruction in $ra.


Load, Store, and Data Movement

(reg)                   $ Contents of reg.
const                   $ A constant address.
const(reg)              $ const + contents of reg.
symbol                  $ The address of symbol.
symbol+const            $ The address of symbol + const.
symbol+const(reg)       $ The address of symbol + const + contents of reg.

la     des, addr        # Load the address of a label.
lb(u)  des, addr        # Load the byte at addr into des.
lh(u)  des, addr        # Load the halfword at addr into des.
li     des, const       # Load the constant const into des.
lui    des, const       # Load the constant const into the upper halfword of des,
                        # and set the lower halfword of des to 0.
lw     des, addr        # Load the word at addr into des.
lwl    des, addr
lwr    des, addr
ulh(u) des, addr        # Load the halfword starting at the (possibly unaligned) address addr into des.
ulw    des, addr        # Load the word starting at the (possibly unaligned) address addr into des.

sb     src1, addr       # Store the lower byte of register src1 to addr.
sh     src1, addr       # Store the lower halfword of register src1 to addr.
sw     src1, addr       # Store the word in register src1 to addr.
swl    src1, addr       # Store the upper halfword in src to the (possibly unaligned) address addr.
swr    src1, addr       # Store the lower halfword in src to the (possibly unaligned) address addr.
ush    src1, addr       # Store the lower halfword in src to the (possibly unaligned) address addr.
usw    src1, addr       # Store the word in src to the (possibly unaligned) address addr.

move   des, src1        # Copy the contents of src1 to des.
mfhi   des              # Copy the contents of the hi register to des.
mflo   des              # Copy the contents of the lo register to des.
mthi   src1             # Copy the contents of the src1 to hi.
mtlo   src1             # Copy the contents of the src1 to lo.


Exception Handling

rfe                     # Return from exception.
syscall                 # Makes a system call. See 4.6.1 for a list of the SPIM system calls.
break const             # Used by the debugger.
nop                     # An instruction which has no effect (other than taking a cycle to execute).

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 苹果5s触摸屏失灵怎么办 苹果6出现闪屏怎么办 苹果4s没有卡槽怎么办 苹果se触屏失灵怎么办 苹果6s屏幕乱跳怎么办 6s屏幕触摸失灵怎么办 苹果6sp屏幕失灵怎么办 苹果6s屏幕不动怎么办 苹果6s卡住了怎么办 苹果6s经常卡屏怎么办 苹果6s点不动了怎么办 手机屏自己乱点怎么办 苹果手机摔开了怎么办 苹果屏幕摔开了怎么办 苹果手机6开不了机怎么办 苹果6开不开机怎么办 苹果6s开不开机怎么办 苹果6手机开不了机怎么办 苹果6s不能开机怎么办 苹果6p无法开机怎么办 苹果6s开不了机怎么办 苹果7屏幕划不动怎么办 苹果6老是卡机怎么办 苹果手机黑屏开不了机怎么办 苹果6plus掉水里了怎么办 苹果6黑屏开不了机怎么办 苹果手机6死机了怎么办 苹果7手机死机怎么办啊 苹果7突然死机了怎么办 苹果手机5s死机怎么办 苹果六s死机了怎么办 苹果4卡机了怎么办 苹果4锁死了怎么办啊 苹果4手机停机了怎么办 苹果4开不了机怎么办 苹果4开不了机怎么办啊 苹果7手机死机了怎么办 苹果6s老是死机怎么办 苹果8手机死机了怎么办 苹果7手机卡屏了怎么办 苹果5s手机死机怎么办