了解PowerPC rlwinm指令

了解PowerPC rlwinm指令,第1张

概述所以我终于说服自己尝试学习/使用PowerPC(PPC). 一切进展顺利,大多数信息都是在网上找到的. 但是,在查看一些示例时,我发现了这个: rlwinm r3, r3, 0,1,1 我怎么用C做这个? 我尝试做一些研究,但找不到任何帮助我的东西. 提前致谢! rlwinm代表“立即旋转左字然后使用蒙版aNd,它的正确用法是 rlwinm RA, RS, SH, MB, ME 根据des 所以我终于说服自己尝试学习/使用PowerPC(PPC).
一切进展顺利,大多数信息都是在网上找到的.
但是,在查看一些示例时,我发现了这个:

rlwinm    r3,r3,1,1

我怎么用C做这个?
我尝试做一些研究,但找不到任何帮助我的东西.
提前致谢!

解决方法 rlwinm代表“立即旋转左字然后使用蒙版aNd,它的正确用法是

rlwinm  RA,RS,SH,MB,ME

根据description page:

RA SpecifIEs target general-purpose register where result of operation is stored. RS SpecifIEs source general-purpose register for operation. SH SpecifIEs shift value for operation. MB SpecifIEs begin value of mask for operation. ME SpecifIEs end value of mask for operation. BM SpecifIEs value of 32-bit mask.

If the MB value is less than the ME value + 1,then the mask bits
between and including the starting point and the end point are set to
ones. All other bits are set to zeros. If the MB value is the same as
the ME value + 1,then all 32 mask bits are set to ones. If the MB value is greater than the ME value + 1,then all of the mask bits
between and including the ME value +1 and the MB value -1 are set to
zeros. All other bits are set to ones.

因此在您的示例中,源和目标是相同的.移位量为0,因此没有移位.并且MB = ME = 1,因此第一种情况适用,使得掩码变为全为0,位号1为1,而编号从MSB = 0:0x40000000.

在C中我们可以像写一样简单

a &= 0x40000000;

假设a是32位变量.

总结

以上是内存溢出为你收集整理的了解PowerPC rlwinm指令全部内容,希望文章能够帮你解决了解PowerPC rlwinm指令所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1216789.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-05
下一篇 2022-06-05

发表评论

登录后才能评论

评论列表(0条)

保存