Shifting left in MIPS

北慕城南 提交于 2020-01-21 10:20:27

问题


In my method one, I have the number that I want to shift by stored inside $a0 (e.g. 5 bits), and I want to shift $t9 by 5 bits, but I'm running into a bit of trouble. Does anyone know why?

MethodOne:

sw $a0, ($t8)
sll $t9, $t9, $t8

回答1:


To shift left by a variable amount, use sllv:

sllv $t9, $t9, $a0

sll only takes an immediate shift amount. There is no need for sw or $t8.



来源:https://stackoverflow.com/questions/26051933/shifting-left-in-mips

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!