在没有MTC1的MIPS中移位浮点位

问题描述 投票:0回答:1

我正在进行一项学校作业,要求我在不使用MIPS附带的mtc1命令的情况下找到单精度浮点数的偏差指数。我想知道如何在输入的结果上使用sllsrl

下面的代码是我想要实现的

li    $v0, 6
sll   $a2, $f0, 1 // Wrong type error here
srl   $a2, $a2, 24

我怎么能做这样的事情?

floating-point mips
1个回答
0
投票

当然你不能在同样的指令中混合使用FPR和GPR,除了MFC *和MTC *

如果数据当前在内存中,您可以使用lw将其直接加载到GPR。如果它在FPR上,那么你需要存储到内存并从内存加载到GPR

swc1  $f0, 0($a3)  # store from FPR to memory
lw    $t1, 0($a3)  # load from memory to GPR
sll   $a2, $t1, 1  # shift like normal
srl   $a2, $a2, 24
© www.soinside.com 2019 - 2024. All rights reserved.