CWDE: Convert Word to Doubleword

For information about interpreting this page, see the help page.
Opcode and MnemonicEncoding16 bit Mode32 bit Mode64 bit ModeDescription
98
CWDE
ZOValidValidValidSign extend AX into EAX.

Encoding

EncodingOperand
ZONone

Description

The CWDE instruction sign extends AX into EAX.

This instruction shares its opcode with CBW (Convert Byte to Word). Which one will be used depends on the operating mode of the processor (CBW in 16 bit mode and CWDE in 32 bit mode). To force the use of the other one (i.e. CBW in 32 bit mode and CWDE in 16 bit mode), prefix this instruction with OPSIZE (0x66).

Operation

This pseudo-code uses C# syntax. A list of the types used is available here.
public void CWDE()
{
  EAX = SignExtend(AX);
}

Flags Affected

CF (carry flag)
Unmodified.
PF (parity flag)
Unmodified.
AF (auxiliary flag)
Unmodified.
ZF (zero flag)
Unmodified.
SF (sign flag)
Unmodified.
OF (overflow flag)
Unmodified.

Exceptions

Protected Mode

#UD
If the LOCK prefix is used.

Real-Address Mode

#UD
If the LOCK prefix is used.

Virtual-8086 Mode

#UD
If the LOCK prefix is used.

Compatibility Mode

#UD
If the LOCK prefix is used.

Long Mode

#UD
If the LOCK prefix is used.