Hey, how to perform an arithmetic right sh开发者_开发问答ift in MIPS instruction set?
SLL and SLLV perform left shifts, but the question was about right shifts. SRA and SRAV perform arithmetic right shifts (with sign bit duplication). SRL and SRLV perform logical right shifts.
There are two instructions that do this: SLL and SLLV.
SLL takes a constant value (encoded in the instruction) and shifts a register by that amount.
SLLV shifts a register by the value stored in another register.
精彩评论