or

Bitwise OR

Sets $t1 to $t2 OR $t3, or an immediate, so each result bit is 1 where either input is 1.

Used in

Forms

  • or , ,

Pseudo-instructions

The assembler turns these into one or more real instructions.

  • Set $t1 to ($t2 bitwise-OR 16-bit unsigned immediate)

  • Set $t1 to ($t1 bitwise-OR 16-bit unsigned immediate)

Operands

$t1
Any general-purpose register, $0 to $31, using its numeric or named spelling, such as $8 or $t0 ($zero is $0; $ra is $31).
$t2
A general-purpose register. It may be the same register as $t1.
$t3
A general-purpose register. It may be the same register as $t1.
uimm16
An unsigned 16-bit immediate, 0 to 65535.

Each bit of $t1 is 1 if the corresponding bit is 1 in either $t2 or $t3 (or both). Commonly used to set specific bits in a value.

# Initialize both inputs, then execute or with initialized inputs. Inspect $t2: 7.
li $t0, 7
li $t1, 3
or $t2, $t0, $t1