shld

386 and later

Integer Double Precision Shift Left

shld r/m16, reg16, imm8 | shld r/m32, reg32, imm8 | shld r/m64, reg64, imm8 | shld r/m16, reg16, cl | shld r/m32, reg32, cl | shld r/m64, reg64, cl | shld [reg16], r/m16, reg16, imm8 | shld [reg32], r/m32, reg32, imm8 | shld [reg64], r/m64, reg64, imm8 | shld [reg16], r/m16, reg16, cl | shld [reg32], r/m32, reg32, cl | shld [reg64], r/m64, reg64, cl | shld kreg32, kreg32, imm8
  • SHLD performs a double-precision left shift. It notionally places its second operand to the right of its first, then shifts the entire bit string thus generated to the left by a number of bits specified in the third operand. It then updates only the first operand according to the result of this. The second operand is not modified.

  • SHRD performs the corresponding right shift: it notionally places the second operand to the left of the first, shifts the whole bit string right, and updates only the first operand.

For example, if EAX holds 0x01234567 and EBX holds 0x89ABCDEF, then the instruction SHLD EAX,EBX,4 would update EAX to hold 0x12345678. Under the same conditions, \c{SHRD EAX,EBX,4} would update EAX to hold 0xF0123456.

The number of bits to shift by is given by the third operand. Only the bottom five bits of the shift count are considered.

Loading...

Forms

Every form of shld 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
shld r/m16, reg16, imm8386
shld r/m32, reg32, imm8386
shld r/m64, reg64, imm8x86-64long
shld r/m16, reg16, cl386
shld r/m32, reg32, cl386
shld r/m64, reg64, clx86-64long
shld [reg16], r/m16, reg16, imm8x86-64apxlong
shld [reg32], r/m32, reg32, imm8x86-64apxlong
shld [reg64], r/m64, reg64, imm8x86-64apxlong
shld [reg16], r/m16, reg16, clx86-64apxlong
shld [reg32], r/m32, reg32, clx86-64apxlong
shld [reg64], r/m64, reg64, clx86-64apxlong
shld kreg32, kreg32, imm8recentavx512bw