LAHF

Load Status Flags Into AH Register

stableVMJITAOTinstruction

Encodings

OpcodeInstructionOp/En64-bitCompat/LegacyDescription
9FLAHFZOinvalid1ValidLoad: AH := EFLAGS(SF:ZF:0:AF:0:PF:1:CF).

Measured cost

Loading measurements from arch-data...

Description

This instruction executes as described above in compatibility mode and legacy mode. It is valid in 64-bit mode only if CPUID.80000001H:ECX.LAHF_SAHF_64[0] = 1.

Operation

IF 64-Bit ModeTHENIF CPUID.80000001H:ECX.LAHF_SAHF_64[0] = 1;THEN AH := RFLAGS(SF:ZF:0:AF:0:PF:1:CF);ELSE #UD; FI;ELSEAH
:= EFLAGS(SF:ZF:0:AF:0:PF:1:CF);FI;

Flags affected

None. The state of the flags in the EFLAGS register is not affected.

Exceptions

Protected mode
#UDIf the LOCK prefix is used.
Real address mode
Same exceptions as in protected mode.
Virtual-8086 mode
Same exceptions as in protected mode.
Compatibility mode
Same exceptions as in protected mode.
64-bit mode
#UDIf CPUID.80000001H:ECX.LAHF_SAHF_64[0] = 0. If the LOCK prefix is used.

Sources