xor


Exclusive OR.

[Syntax]

-

xor reg1, reg2

-

xor imm, reg2

 

The following can be specified for imm:

-

Absolute expression having a value of up to 32 bits

-

Relative expression

[Function]

-

Syntax "xor reg1, reg2"

Exclusive-ORs the value of the register specified by the first operand with the value of the register specified by the second operand, and stores the result in the register specified by the second operand.

-

Syntax "xor imm, reg2"

Exclusive-ORs the value of the absolute expression or relative expression specified by the first operand with the value of the register specified by the second operand, and stores the result in the register specified by the second operan.

[Description]

-

When this instruction is executed in syntax "xor reg1, reg2", the assembler generates one xor machine instruction.

-

When this instruction is executed in syntax "xor imm, reg2", and the following expression is specified for imm, the assembler executes instruction expansion to generate one or more machine instructionsNote.

(a)

0

xor     0, reg
xor     r0, reg

(b)

Absolute expression having a value in the range of 1 to 65,535

xor     imm16, reg
xori    imm16, reg, reg

(c)

Absolute expression having a value in the range of -16 to -1

xor     imm5, reg
mov     imm5, r1
xor     r1, reg

(d)

Absolute expression having a value in the range of -32,768 to -17

xor     imm16, reg
movea   imm16, r0, r1
xor     r1, reg

(e)

Absolute expression exceeding the above ranges

If all the lower 16 bits of the value of imm are 0

xor     imm, reg
movhi   HIGHW(imm), r0, r1
xor     r1, reg

Else

xor     imm, reg
mov     imm, r1
xor     r1, reg

(f)

Relative expression having !label or %label

xor     !label, reg
xori    !label, reg, reg
xor     %label, reg
xori    %label, reg, reg

(g)

Relative expression having $label for a label having a definition in the sdata/sbss-attribute section

xor     $label, reg
movea   $label, r0, r1
xor     r1, reg

(h)

Relative expression having #label or label, or that having $label for a label having no definition in the sdata/sbss-attribute section

xor     #label, reg
mov     #label, r1
xor     r1, reg
xor     label, reg
mov     label, r1
xor     r1, reg
xor     $label, reg
mov     $label, r1
xor     r1, reg

Note

The xor machine instruction does not take an immediate value as an operand.

[Flag]

CY

---

OV

0

S

1 if the word data MSB of the result is 1, 0 if not

Z

1 if the result is 0, 0 if not

SAT

---