gpt4 book ai didi

assembly - 直接访问 MIPS 协处理器条件标志

转载 作者:行者123 更新时间:2023-12-02 19:09:04 27 4
gpt4 key购买 nike

我希望访问 MIPS 协处理器 1 条件标志的值。

例如

c.eq.s $f4 $f6
move $t0 condflag1 #clearly illegal

我知道以下情况是可能的:

c.eq.s $f4 $f6
bc1f L_CondFalse
li $t0 0
j L_CondEnd
L_CondFalse : li $t0 1
L_CondEnd :

有什么想法吗?

最佳答案

您可以通过使用条件移动指令(自 MIPS32 起可用)来避免分支。

li     $t0, 1          # move 1 into t0
c.eq.s $f4, $f6 # compare f4 and f6; set FCC[0] to the result
movt $t0, $0, $fcc0 # move 0 into t0 if comparison was true

(未测试)

另一种选择是将 FCCR 移至 GPR 并读取位 0。

cfc1   $t0, $25  # load FCCR into t0
andi $t0, 1 # mask the bit 0 only

FCCR 在 MIPS32 之前不可用,因此您可能必须使用 FCSR(31 美元)。

关于assembly - 直接访问 MIPS 协处理器条件标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5812869/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com