Skip to content

SAR

Operation

Arithmetic-right-shifts the destination by the count modulo its selected width without changing FLAGS.

Assembler Syntax

SAR.{L|Q}(z) Rn(s), Rn(d)

SAR.{B|W|L|Q}(z) Rn(s), <ea>(e)

SAR.{B|W|L|Q}(z) imm6(i), <ea>(e)

Privilege

Unprivileged

Repeat eligibility

REP eligible; REPcc observes dst

Shifts the selected-width destination value right by the effective count, sign-fills the vacated high bits, and writes the result to the destination. The effective count is the count operand modulo the selected operand width: B uses mod 8, W uses mod 16, L uses mod 32, and Q uses mod 64. If the effective count is zero, the selected-width result equals the original selected-width value; an Rn destination is still written and a sub-Q result is sign-extended to 64 bits, while a memory destination rewrites the same selected bytes. FLAGS are unchanged for all counts.

2.75in

Encodings

SAR.{L|Q}(z) Rn(s), Rn(d)

Format: Instruction format for SAR.{L|Q}(z) Rn(s), Rn(d)

Format: Instruction format for SAR.{L|Q}(z) Rn(s), Rn(d)

2.75in SAR.{B|W|L|Q}(z) Rn(s), <ea>(e)

Format: Instruction format for SAR.{B|W|L|Q}(z) Rn(s), <ea>(e)

Format: Instruction format for SAR.{B|W|L|Q}(z) Rn(s), <ea>(e)

dstexcluded: immediate [invalid_destination]

2.75in SAR.{B|W|L|Q}(z) imm6(i), <ea>(e)

Format: Instruction format for SAR.{B|W|L|Q}(z) imm6(i), <ea>(e)

Format: Instruction format for SAR.{B|W|L|Q}(z) imm6(i), <ea>(e)

dstexcluded: immediate [invalid_destination]