xor

Operands

$reg, [$reg / imm], [$reg / imm]

Bitwise XOR (exclusive OR) : Sets $t1 = $t2 ^ $t3. Each bit of $t1 is 1 if the corresponding bits in $t2 and $t3 differ. Used to toggle specific bits, detect differences, or implement simple encryption/checksums.

Variants

  • Bitwise XOR (exclusive OR) : Sets $t1 = $t2 ^ $t3. Each bit of $t1 is 1 if the corresponding bits in $t2 and $t3 differ. Used to toggle specific bits, detect differences, or implement simple encryption/checksums. xor $t1,$t2,$t3
  • XOR : set $t1 to ($t2 bitwise-exclusive-OR 16-bit unsigned immediate) xor $t1,$t2,100
  • XOR : set $t1 to ($t1 bitwise-exclusive-OR 16-bit unsigned immediate) xor $t1,100
# Initialize both inputs, then execute xor with initialized inputs. Inspect $t2: 4.
li $t0, 7
li $t1, 3
xor $t2, $t0, $t1