本文介绍了PowerPC和clrlslwi -or-rlwinm指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在这里阅读了其他文章,但是仍然对PPC和rlwinm有疑问.

I've read the other posts here, but still have a question about PPC and rlwinm.

我正在查看的示例是:

li  r0, 0x100
clrlslwi  r9, r0, 27,5 (which afaik is the same as rlwinm r9, r0,5,22,26)

首先我加载r0 = 0x100然后将r0左移5,因此r0 = 0x2000(无溢出,因此无需旋转)

First I load r0 = 0x100 Then Left Shift r0 by 5 so r0 = 0x2000 (No overflow, so no rotate needed)

使用第22到26位设为0x3e0设置掩码

Make a Mask with bits 22 to 26 set = 0x3e0

使用掩码= 0x2000和0x3E0 = 0的AND r0

AND r0 with the Mask = 0x2000 AND 0x3E0 = 0

我一定做错了...这将始终为0我想念什么?

I must be doing something wrong...this would always net 0What am I missing?

推荐答案

是的(清除左单词并立即左移单词)

yes that's true (Clear left and shift left word immediate)

clrlslwi rA,rS,b,n (n ≤ b ≤ 31) = rlwinm rA,rS,n,b – n,31 – n

所以clrlslwi r9, r0, 27,5 = rlwinm r9, r0, 5, 22(27-5), 26(31-5)

这篇关于PowerPC和clrlslwi -or-rlwinm指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 09:32