next up previous
Next: Comparison Instructions Up: Description of the Machine Previous: Constant-Manipulating Instructions

Arithmetic and Logical Instructions

In all instructions below, Src2 can either be a register or an immediate value (integer). The immediate forms of the instructions are only included for reference. The assembler will translate the more general form of an instruction (e.g., add) into the immediate form (e.g., addi) if the second argument is constant.

abs Rdest, RsourceValue tex2html_wrap_inline1671
Put the absolute value of the integer from register Rsource in register Rdest.

add Rdest, Rsrc1, Src2(with overflow)
addi Rdest, Rsrc1, ImmImmediate (with overflow)
addu Rdest, Rsrc1, Src2(without overflow)
addiu Rdest, Rsrc1, ImmImmediate (without overflow)
Put the sum of the integers from register Rsrc1 and Src2 (or Imm) into register Rdest.

and Rdest, Rsrc1, Src2
andi Rdest, Rsrc1, ImmImmediate
Put the logical AND of the integers from register Rsrc1 and Src2 (or Imm) into register Rdest.

div Rsrc1, RSrc2(with overflow)
divu Rsrc1, RSrc2(without overflow)
Divide the contents of the two registers. Leave the quotient in register LO and the remainder in register HI. Note that if an operand is negative, the remainder is unspecified by the MIPS architecture and depends on the conventions of the machine on which SPIM is run.

div Rdest, Rsrc1, Src2(with overflow) tex2html_wrap_inline1671
divu Rdest, Rsrc1, Src2(without overflow) tex2html_wrap_inline1671
Put the quotient of the integers from register Rsrc1 and Src2 into register Rdest.

mul Rdest, Rsrc1, Src2(without overflow) tex2html_wrap_inline1671

mulo Rdest, Rsrc1, Src2(with overflow) tex2html_wrap_inline1671
mulou Rdest, Rsrc1, Src2Multiply (with overflow) tex2html_wrap_inline1671
Put the product of the integers from register Rsrc1 and Src2 into register Rdest.

mult Rsrc1, RSrc2
multu Rsrc1, RSrc2Multiply
Multiply the contents of the two registers. Leave the low-order word of the product in register LO and the high-word in register HI.

neg Rdest, RsourceValue (with overflow) tex2html_wrap_inline1671
negu Rdest, RsourceValue (without overflow) tex2html_wrap_inline1671
Put the negative of the integer from register Rsource into register Rdest.

nor Rdest, Rsrc1, Src2
Put the logical NOR of the integers from register Rsrc1 and Src2 into register Rdest.

not Rdest, Rsource tex2html_wrap_inline1671
Put the logical negation of the integer from register Rsource into register Rdest.

or Rdest, Rsrc1, Src2
ori Rdest, Rsrc1, ImmImmediate
Put the logical OR of the integers from register Rsrc1 and Src2 (or Imm) into register Rdest.

rem Rdest, Rsrc1, Src2 tex2html_wrap_inline1671
remu Rdest, Rsrc1, Src2Remainder tex2html_wrap_inline1671
Put the remainder from dividing the integer in register Rsrc1 by the integer in Src2 into register Rdest. Note that if an operand is negative, the remainder is unspecified by the MIPS architecture and depends on the conventions of the machine on which SPIM is run.

rol Rdest, Rsrc1, Src2Left tex2html_wrap_inline1671
ror Rdest, Rsrc1, Src2Right tex2html_wrap_inline1671
Rotate the contents of register Rsrc1 left (right) by the distance indicated by Src2 and put the result in register Rdest.

sll Rdest, Rsrc1, Src2Left Logical
sllv Rdest, Rsrc1, Rsrc2Left Logical Variable
sra Rdest, Rsrc1, Src2Right Arithmetic
srav Rdest, Rsrc1, Rsrc2Right Arithmetic Variable
srl Rdest, Rsrc1, Src2Right Logical
srlv Rdest, Rsrc1, Rsrc2Right Logical Variable
Shift the contents of register Rsrc1 left (right) by the distance indicated by Src2 (Rsrc2) and put the result in register Rdest.

sub Rdest, Rsrc1, Src2(with overflow)
subu Rdest, Rsrc1, Src2(without overflow)
Put the difference of the integers from register Rsrc1 and Src2 into register Rdest.

xor Rdest, Rsrc1, Src2
xori Rdest, Rsrc1, ImmImmediate
Put the logical XOR of the integers from register Rsrc1 and Src2 (or Imm) into register Rdest.


next up previous
Next: Comparison Instructions Up: Description of the Machine Previous: Constant-Manipulating Instructions

Mitch Roth
Fri Sep 6 23:25:26 ADT 1996