ID 683836
Date 10/22/2020
Public

## 3.9.2. Arithmetic and Logical Instructions

Logical instructions support and, or, xor, and nor operations. Arithmetic instructions support addition, subtraction, multiplication, and division operations.
Table 46.  Arithmetic and Logical Instructions
Instruction Description
and
or
xor
nor
These are the standard 32-bit logical operations. These operations take two register values and combine them bit-wise to form a result for a third register.
andi
ori
xori
These operations are immediate versions of the and, or, and xor instructions. The 16-bit immediate value is zero-extended to 32 bits, and then combined with a register value to form the result.
andhi
orhi
xorhi
In these versions of and, or, and xor, the 16-bit immediate value is shifted logically left by 16 bits to form a 32-bit operand. Zeroes are shifted in from the right.
add
sub
mul
div
divu
These are the standard 32-bit arithmetic operations. These operations take two registers as input and store the result in a third register.
addi
subi
muli
These instructions are immediate versions of the add, sub, and mul instructions. The instruction word includes a 16-bit signed value.
mulxss
mulxuu
These instructions provide access to the upper 32 bits of a 32x32 multiplication operation. Choose the appropriate instruction depending on whether the operands should be treated as signed or unsigned values. It is not necessary to precede these instructions with a mul.
mulxsu
This instruction is used in computing a 128-bit result of a 64x64 signed multiplication.

Did you find the information on this page useful?

Characters remaining:

Feedback Message