xori
XOR Immediate
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
// Toggle bit 0.
Encoding
Operands
-
RA
Target Register -
RS
Source Register -
UI
Unsigned 16-bit Immediate