xori

Bitwise XOR immediate

Sets $t1 to $t2 XOR an immediate, with the immediate zero-extended instead of sign-extended.

Used in

Forms

  • xori , ,

Pseudo-instructions

The assembler turns these into one or more real instructions.

  • Set $t1 to ($t2 bitwise-exclusive-OR 32-bit 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.
uimm16
An unsigned 16-bit immediate, 0 to 65535.
imm32
A 32-bit immediate, -2147483648 to 4294967295. Pseudoinstruction expansion may overwrite $at, losing its previous value.
imm
An immediate value: an unsigned 16-bit value (0 to 65535) or a 32-bit value (-2147483648 to 4294967295). The assembler chooses a supported encoding for the value and other operands; a pseudoinstruction may expand into several instructions.

The 16-bit immediate is zero-extended before the XOR. Useful for toggling specific bits.

# Toggle the low bit. Inspect $t2: 4.
li $t0, 5
xori $t2, $t0, 1