xori

XOR Immediate

xori RA, RS, UI

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

Details

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.

Pseudocode 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.

Example

xori r3, r4, 0x1

// Toggle bit 0.

Encoding

Binary Layout
26
0
RS
6
RA
11
UI
16
 
Format D-form
Opcode 0x68000000
Extension Base

Operands

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