shl

8086 and later

Logical Shift Left

shl r/m8, 1 | shl r/m16, 1 | shl r/m32, 1 | shl r/m64, 1 | shl r/m8, cl | shl r/m16, cl | shl r/m32, cl | shl r/m64, cl | shl r/m8, imm8 | shl r/m16, imm8 | shl r/m32, imm8 | shl r/m64, imm8 | shl [reg8], r/m8, 1 | shl [reg16], r/m16, 1 | shl [reg32], r/m32, 1 | shl [reg64], r/m64, 1 | shl [reg8], r/m8, cl | shl [reg16], r/m16, cl | shl [reg32], r/m32, cl | shl [reg64], r/m64, cl | shl [reg8], r/m8, imm8 | shl [reg16], r/m16, imm8 | shl [reg32], r/m32, imm8 | shl [reg64], r/m64, imm8 | shl reg32, r/m32, reg32 | shl reg64, r/m64, reg64 | shl kreg8, kreg8, imm8 | shl kreg16, kreg16, imm8 | shl kreg32, kreg32, imm8 | shl kreg64, kreg64, imm8

SHL and SHR perform a logical shift operation on the given source/destination (first) operand. The vacated bits are filled with zero.

A synonym for SHL is SAL (see SAL). NASM will assemble either one to the same code, but NDISASM will always disassemble that code as SHL.

The number of bits to shift by is given by the second operand. Only the bottom five bits of the shift count are considered by processors above the 8086.

You can force the longer (286 and upwards, beginning with a C1 byte) form of SHL foo,1 by using a BYTE prefix: \c{SHL foo,BYTE 1}. Similarly with SHR.

Loading...

Forms

Every form of shl the assembler accepts, from NASM's own instruction table. The second column is the processor that introduced the form; a badge marks a form that needs an extension, that is lockable, or that long mode dropped.

FormSinceNotes
shl r/m8, 18086
shl r/m16, 18086
shl r/m32, 1386
shl r/m64, 1x86-64long
shl r/m8, cl8086
shl r/m16, cl8086
shl r/m32, cl386
shl r/m64, clx86-64long
shl r/m8, imm8186
shl r/m16, imm8186
shl r/m32, imm8386
shl r/m64, imm8x86-64long
shl [reg8], r/m8, 1x86-64apxlong
shl [reg16], r/m16, 1x86-64apxlong
shl [reg32], r/m32, 1x86-64apxlong
shl [reg64], r/m64, 1x86-64apxlong
shl [reg8], r/m8, clx86-64apxlong
shl [reg16], r/m16, clx86-64apxlong
shl [reg32], r/m32, clx86-64apxlong
shl [reg64], r/m64, clx86-64apxlong
shl [reg8], r/m8, imm8x86-64apxlong
shl [reg16], r/m16, imm8x86-64apxlong
shl [reg32], r/m32, imm8x86-64apxlong
shl [reg64], r/m64, imm8x86-64apxlong
shl reg32, r/m32, reg32recentbmi2
shl reg64, r/m64, reg64x86-64bmi2long
shl kreg8, kreg8, imm8recentavx512dq
shl kreg16, kreg16, imm8recentavx512f
shl kreg32, kreg32, imm8recentavx512bw
shl kreg64, kreg64, imm8recentavx512bw