13.07.2015 Views

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

AMD64 Technology 24594 Rev. 3.10 February 2005SALSHLShift LeftShifts the bits of a register or memory location (first oper<strong>and</strong>) to the left through theCF bit by the number of bit positions in an unsigned immediate value or the CLregister (second oper<strong>and</strong>). The instruction discards bits shifted out of the CF flag. Foreach bit shift, the SAL instruction clears the least-significant bit to 0. At the end of theshift operation, the CF flag contains the last bit shifted out of the first oper<strong>and</strong>.The processor masks the upper three bits of the count oper<strong>and</strong>, thus restricting thecount to a number between 0 <strong>and</strong> 31. When the destination is 64 bits wide, theprocessor masks the upper two bits of the count, providing a count in the range of 0 to63.The effect of this instruction is multiplication by powers of two.For 1-bit shifts, the instruction sets the OF flag to the exclusive OR of the CF bit (afterthe shift) <strong>and</strong> the most significant bit of the result. When the shift count is greaterthan 1, the OF flag is undefined.If the shift count is 0, no flags are modified.SHL is an alias to the SAL instruction.Mnemonic Opcode DescriptionSAL reg/mem8, 1 D0 /4 Shift an 8-bit register or memory location left 1 bit.SAL reg/mem8, CL D2 /4SAL reg/mem8, imm8C0 /4 ibShift an 8-bit register or memory location left the number of bitsspecified in the CL register.Shift an 8-bit register or memory location left the number of bitsspecified by an 8-bit immediate value.SAL reg/mem16, 1 D1 /4 Shift a 16-bit register or memory location left 1 bit.SAL reg/mem16, CL D3 /4SAL reg/mem16, imm8C1 /4 ibShift a 16-bit register or memory location left the number of bitsspecified in the CL register.Shift a 16-bit register or memory location left the number of bitsspecified by an 8-bit immediate value.SAL reg/mem32, 1 D1 /4 Shift a 32-bit register or memory location left 1 bit.SAL reg/mem32, CL D3 /4Shift a 32-bit register or memory location left the number of bitsspecified in the CL register.256 SAL, SHL

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!