xor

XOR

xor RA, RS, RB

Performs a bitwise Exclusive OR comparison.

Details

The XOR instruction performs a bitwise exclusive OR operation between two operands. For each bit position, if the corresponding bits of the operands are different, the result is 1; otherwise, it is 0.

Pseudocode Operation

RA <- RS XOR RB

Programming Note

When Rc=1 (dot form), CR0 is updated with the signed comparison of the result against zero (LT, GT, EQ) and the current SO bit from XER.

Example

xor r3, r4, r5

Encoding

Binary Layout
31
0
RS
6
RA
11
RB
16
316
21
Rc
31
 
Format X-form
Opcode 0x7C000278
Extension Base
Registers Altered CR0

Operands

  • RA
    Target Register
  • RS
    Source Register 1
  • RB
    Source Register 2