sar

8086 and later

Arithmetic Shift Right

sar r/m8, 1 | sar r/m16, 1 | sar r/m32, 1 | sar r/m64, 1 | sar r/m8, cl | sar r/m16, cl | sar r/m32, cl | sar r/m64, cl | sar r/m8, imm8 | sar r/m16, imm8 | sar r/m32, imm8 | sar r/m64, imm8 | sar [reg8], r/m8, 1 | sar [reg16], r/m16, 1 | sar [reg32], r/m32, 1 | sar [reg64], r/m64, 1 | sar [reg8], r/m8, cl | sar [reg16], r/m16, cl | sar [reg32], r/m32, cl | sar [reg64], r/m64, cl | sar [reg8], r/m8, imm8 | sar [reg16], r/m16, imm8 | sar [reg32], r/m32, imm8 | sar [reg64], r/m64, imm8 | sar reg32, r/m32, reg32 | sar reg64, r/m64, reg64

SAL and SAR perform an arithmetic shift operation on the given source/destination (first) operand. The vacated bits are filled with zero for SAL, and with copies of the original high bit of the source operand for SAR.

SAL is a synonym for SHL (see SHL). 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 SAL foo,1 by using a BYTE prefix: \c{SAL foo,BYTE 1}. Similarly with SAR.

Loading...

Forms

Every form of sar 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
sar r/m8, 18086
sar r/m16, 18086
sar r/m32, 1386
sar r/m64, 1x86-64long
sar r/m8, cl8086
sar r/m16, cl8086
sar r/m32, cl386
sar r/m64, clx86-64long
sar r/m8, imm8186
sar r/m16, imm8186
sar r/m32, imm8386
sar r/m64, imm8x86-64long
sar [reg8], r/m8, 1x86-64apxlong
sar [reg16], r/m16, 1x86-64apxlong
sar [reg32], r/m32, 1x86-64apxlong
sar [reg64], r/m64, 1x86-64apxlong
sar [reg8], r/m8, clx86-64apxlong
sar [reg16], r/m16, clx86-64apxlong
sar [reg32], r/m32, clx86-64apxlong
sar [reg64], r/m64, clx86-64apxlong
sar [reg8], r/m8, imm8x86-64apxlong
sar [reg16], r/m16, imm8x86-64apxlong
sar [reg32], r/m32, imm8x86-64apxlong
sar [reg64], r/m64, imm8x86-64apxlong
sar reg32, r/m32, reg32recentbmi2
sar reg64, r/m64, reg64x86-64bmi2long