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 2005SHRShift RightShifts the bits of a register or memory location (first oper<strong>and</strong>) to the right 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. Atthe end of the shift operation, the CF flag contains the last bit shifted out of the firstoper<strong>and</strong>.For each bit shift, the instruction clears the most-significant bit to 0.The effect of this instruction is unsigned division by powers of two.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.For 1-bit shifts, the instruction sets the OF flag to the most-significant bit of theoriginal value. If the count is greater than 1, the OF flag is undefined.If the shift count is 0, no flags are modified.Mnemonic Opcode DescriptionSHR reg/mem8, 1 D0 /5 Shift an 8-bit register or memory oper<strong>and</strong> right 1 bit.SHR reg/mem8, CL D2 /5SHR reg/mem8, imm8C0 /5 ibShift an 8-bit register or memory oper<strong>and</strong> right the number ofbits specified in the CL register.Shift an 8-bit register or memory oper<strong>and</strong> right the number ofbits specified by an 8-bit immediate value.SHR reg/mem16, 1 D1 /5 Shift a 16-bit register or memory oper<strong>and</strong> right 1 bit.SHR reg/mem16, CL D3 /5SHR reg/mem16, imm8C1 /5 ibShift a 16-bit register or memory oper<strong>and</strong> right the number ofbits specified in the CL register.Shift a 16-bit register or memory oper<strong>and</strong> right the number ofbits specified by an 8-bit immediate value.SHR reg/mem32, 1 D1 /5 Shift a 32-bit register or memory oper<strong>and</strong> right 1 bit.SHR reg/mem32, CL D3 /5SHR reg/mem32, imm8C1 /5 ibShift a 32-bit register or memory oper<strong>and</strong> right the number ofbits specified in the CL register.Shift a 32-bit register or memory oper<strong>and</strong> right the number ofbits specified by an 8-bit immediate value.274 SHR

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

Saved successfully!

Ooh no, something went wrong!