XCHG

Exchanging values

XCHG

eXCHanGe


[Syntax]

XCHG src, dest

 

[Operation]

tmp = src;

src = dest;

dest = tmp;

 

[Function]

-

This instruction exchanges the contents of src and dest as listed in the following table.

 

[Instruction Format]

Syntax

Processng Size

src

dest

Code size

(Byte)

XCHG src, dest

L

Rs

Rd

3

L

[Rs].memex

Rd

3 (memex == UB)

4 (memex != UB)

L

dsp:8[Rs].memex

Rd

4 (memex == UB)

5 (memex != UB)

L

dsp:16[Rs].memex

Rd

5 (memex == UB)

6 (memex != UB)

[Flag Change]

-

This instruction does not affect the states of flags.

 

[Description Example]

XCHG R1, R2

XCHG [R1].W, R2