ARM base instruction -- cls

Count Leading Sign bits counts the number of leading bits of the source register that have the same value as the most significant bit of the register, and writes the result to the destination register. This count does not include the most significant bit of the source register.

计数前导符号位对源寄存器中与寄存器最高有效位具有相同值的前导位数进行计数,并将结果写入目标寄存器。此计数不包括源寄存器的最高有效位。

32-bit variant

Applies when sf == 0.

CLS <Wd>, <Wn>

64-bit variant

Applies when sf == 1.

CLS <Xd>, <Xn>

Decode for all variants of this encoding

integer d = UInt(Rd);

integer n = UInt(Rn);

integer datasize = if sf == '1' then 64 else 32;

Operation

integer result;

bits(datasize) operand1 = Xn;

result = CountLeadingSignBits(operand1);

Xd = result<datasize-1:0>;

integer CountLeadingSignBits(bits(N) x)

return CountLeadingZeroBits(x<N-1:1> EOR x<N-2:0>);

integer CountLeadingZeroBits(bits(N) x)

return N - (HighestSetBit(x) + 1);

integer HighestSetBit(bits(N) x)

for i = N-1 downto 0

if x<i> == '1' then return i;

return -1;

相关推荐
AI科技星14 小时前
《全域数学/数术工坊》体系总览
c语言·开发语言·汇编·electron·概率论
H Journey17 小时前
用汇编语言写一个hello world,并进行汇编和编译
汇编·assembly·寄存器
逆境不可逃18 小时前
一篇速成 汇编程序语言设计之 8086 汇编核心指令
汇编
疯狂打码的少年2 天前
【程序语言与编译】程序设计语言分类(机器/汇编/高级)
汇编·笔记
JAMSAN09302 天前
16.0% 高增长!全球异构计算架构服务市场扩容态势
汇编·人工智能·架构
iCxhust3 天前
8086汇编 word ptr
汇编·单片机·嵌入式硬件·微机原理·8088单板机
大阳1234 天前
ARM.9(RGBLCD,PWM)
c语言·开发语言·汇编·单片机·嵌入式硬件·pwm·rgblcd
2301_789015625 天前
Linux基础开发工具一:软件包管理器、vim编辑器
linux·服务器·c语言·汇编·c++·编辑器·vim
是星辰吖~6 天前
X86反汇编_深度学习_基础二叉树
汇编
iCxhust6 天前
汇编返回指令ret iret retf区别
汇编·微机原理·8088单板机