sra

Operands

$reg, $reg, imm

Shift right arithmetic : Sets $t1 = $t2 >> immediate (0-31 bits). Vacated bits on the left are filled with copies of the sign bit, preserving the sign of negative numbers. Shifting right by n is equivalent to signed division by 2^n rounding toward negative infinity.

Variants

  • Shift right arithmetic : Sets $t1 = $t2 >> immediate (0-31 bits). Vacated bits on the left are filled with copies of the sign bit, preserving the sign of negative numbers. Shifting right by n is equivalent to signed division by 2^n rounding toward negative infinity. sra $t1,$t2,10
# Shift or rotate an initialized word; inspect $t2: 0xFFFFFFFC.
li $t0, -8
sra $t2, $t0, 1