ARM指令解析之LSL

在手册的C3.3.9章节里面介绍。

LSL Logical shift left LSL (immediate) on page C6-995
打开配套链接=>C6.2.166 LSL (immediate)

提示该指令类似于一个助记符,实际指令是UBFM
LSL <Wd>, <Wn>, #<shift>
is equivalent to
UBFM <Wd>, <Wn>, #(-<shift> MOD 32), #(31-<shift>)
and is the preferred disassembly when imms + 1 == immr.

那么我们再继续研究 UBFM指令=>C6.2.310 UBFM
该指令实际是无符号数的位域移动指令。

看懂了UBFM之后,我们采用特殊值法分析LSL。
我们假设shift == 26

那么 r = (-<shift> MOD 32) = ((-26 + 32) MOD 32) = 6
s = (31-<shift>) = (31 - 26) = 5
指令退化成 UBFM <Wd>, <Wn>, #6, #5

由于 s <= r, 所以如下规则生效:
If <imms> is less than <immr>, this copies a bitfield of (<imms>+1) bits from the least significant bits of the source register to bit position (regsize-<immr>) of the destination register, where regsize is the destination register size of 32 or 64 bits.

也就是 拷贝 Wn的[5:0]位域到Wd的[26:31]
其中, 5是由 imms + 1 == 6共6个位域得来; 26是由32 - 6 == 26得来

参考文档《armv8-芯片手册_arm_v8.4.pdf》

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值