xori

XOR Immediate

xori RA, RS, UI

Performs a bitwise XOR with a 16-bit unsigned immediate.

Encoding

Binary Layout
26
0:5
RS
6:10
RA
11:15
UI
16:31
 
Format D-form
Opcode 0x68000000
Extension Base

Operands

  • RA
    Target Register
  • RS
    Source Register
  • UI
    Unsigned 16-bit Immediate

Example

xori r3, r4, 0x1

// Toggle bit 0.

Related

More in Base

Reference

Description

XOR Immediate performs a bitwise XOR between the contents of GPR RS and a 16-bit zero-extended unsigned immediate, storing the result in GPR RA. This is a Base category instruction that does not affect condition registers or status fields.

Operation

RA ← RS XOR (0x0000 || UI)

Programming Note

The xori instruction is commonly used for setting or clearing specific bits in a register by XORing with a mask. Be cautious of overflow as this operation does not affect the carry flag. The immediate value is zero-extended to 64 bits before the XOR operation, so ensure that the upper bits are not inadvertently set if only lower bits are intended to be modified.