.1. X86
JNEAKAJNZ: jump if not equal or not zero: ZF=0JNGEjump if not greater or equal (signed): SF≠OFJNGjump if not greater (signed): ZF=1 or SF≠OFJNLEjump if not lesser (signed): ZF=0 and SF=OFJNLjump if not lesser (signed): SF=OFJNOjump if not overflow: OF=0JNSjump if SF flag is clearedJNZAKAJNE: jump if not equal or not zero: ZF=0JOjump if overflow: OF=1JPOjump if PF flag is cleared (Jump Parity Odd)JPAKAJPE: jump if PF flag is setJSjump if SF flag is setJZAKAJE: jump if equal or zero: ZF=1LAHFcopy some flag bits to AH:
7 6 4 2 0
SFZF AF PF CFThis instruction is often used inFPU-related code.LEAVEequivalentoftheMOV ESP, EBPandPOP EBPinstructionpair—inotherwords, thisinstructionsets
thestack pointer(ESP) back and restores theEBPregister to its initial state.
LEA(Load Effective Address) form an address
This instruction was intended not for summing values and multiplication but for forming an address,
e.g., for calculating the address of an array element by adding the array address, element index,
with multiplication of element size^5.So, the difference betweenMOVandLEAis thatMOVforms a memory address and loads a value from
memory or stores it there, butLEAjust forms an address.But nevertheless, it is can be used for any other calculations.LEAis convenient because the computations performed by it does not alterCPUflags. This may be
very important forOOEprocessors (to create less data dependencies).Aside from this, starting at least at Pentium, LEA instruction is executed in 1 cycle.int f(int a, int b)
{
return a*8+b;
};Listing 1: Optimizing MSVC 2010
_a$ = 8 ; size = 4
_b$ = 12 ; size = 4
_f PROC
mov eax, DWORD PTR _b$[esp-4]
mov ecx, DWORD PTR _a$[esp-4]
lea eax, DWORD PTR [eax+ecx*8]
ret 0
_f ENDPIntel C++ uses LEA even more:int f1(int a)
{
return a*13;
};(^5) See also:wikipedia