sar

Shift Arithmetic Right

SAR r/m, imm8

Shifts bits right, preserving sign bit.

Details

The Shift Arithmetic Right instruction shifts bits right, preserving sign bit.

Pseudocode Operation

DEST <- DEST >> count  // arithmetic right shift (sign extend)

Example

SAR rbx, 3

Encoding

Binary Layout
C1
+0
ModRM
+1
 
Format Legacy
Opcode C1 /7
Extension Base

Operands

  • dest
    Register or memory operand
  • src
    8-bit signed immediate