assemblyx86x86-16bit-shiftinstruction-set

Difference between SHL and SAL in 80x86


MOV X, 0AAH
SAL X, 4

MOV X, 0AAH
SHL X, 4

When should we use SHL, and when should we use SAL?
What is the difference between them, if anything?


Solution

  • According to this, they are the same:

    The shift arithmetic left (SAL) and shift logical left (SHL) instructions perform the same operation; they shift the bits in the destination operand to the left (toward more significant bit locations). For each shift count, the most significant bit of the destination operand is shifted into the CF flag, and the least significant bit is cleared (see Figure 7-7 in the Intel®64 and IA-32 Architectures Software Developer'sManual, Volume 1).

    Both were probably included just for completeness since there is a distinction for right-shifts.