Skip to content

XCHG

Operation

Exchanges selected-width operand values, committing both destinations together.

Assembler Syntax

XCHG.{L|Q}(z) Rn(s), Rn(d)

XCHG.{B|W|L|Q}(z) Rn(s), <ea>(e)

XCHG.{B|W|L|Q}(z) <ea>(e), Rn(d)

Privilege

Unprivileged

Repeat eligibility

REP eligible

Exchanges the two selected-width operand values as one instruction. A memory form performs an ordinary selected-width load followed by an ordinary selected-width store, with both architectural destinations committed by the instruction.

2.75in

Encodings

XCHG.{L|Q}(z) Rn(s), Rn(d)

Format: Instruction format for XCHG.{L|Q}(z) Rn(s), Rn(d)

Format: Instruction format for XCHG.{L|Q}(z) Rn(s), Rn(d)

lhs, rhssame_value

2.75in XCHG.{B|W|L|Q}(z) Rn(s), <ea>(e)

Format: Instruction format for XCHG.{B|W|L|Q}(z) Rn(s), <ea>(e)

Format: Instruction format for XCHG.{B|W|L|Q}(z) Rn(s), <ea>(e)

rhsexcluded: immediate [invalid_destination]

2.75in XCHG.{B|W|L|Q}(z) <ea>(e), Rn(d)

Format: Instruction format for XCHG.{B|W|L|Q}(z) <ea>(e), Rn(d)

Format: Instruction format for XCHG.{B|W|L|Q}(z) <ea>(e), Rn(d)

lhsexcluded: immediate [invalid_destination]