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;

相关推荐
ThornArmor3 天前
【工具篇·番外】跨语言生态的主权回收:基于 ISA 说明书的 4-bit 双向汇编系统全线封顶
c语言·开发语言·汇编·c++·重构·架构
是星辰吖~3 天前
WIN32_线程(下)
汇编
是星辰吖~4 天前
WIN32_线程(上)
汇编
AI科技星4 天前
数术工坊 · 第四卷 橡皮泥江湖(拓扑学)【完整定稿】
c语言·开发语言·汇编·electron·概率论·拓扑学
iCxhust5 天前
C# 生成命令行程序 将hex格式烧录程序转换成bin烧录格式
开发语言·汇编·单片机·嵌入式硬件·c#·微机原理
iCxhust5 天前
C#进程管理程序
开发语言·汇编·stm32·单片机·c#·微机原理
hhcgchpspk5 天前
汇编语言传递数据和地址的误区
汇编·笔记·nasm·masm
iCxhust6 天前
MTK8088单板机制作(一)时钟电路
汇编·单片机·嵌入式硬件·微机原理·8088单板机
iCxhust6 天前
8086 汇编位测试使用方法
汇编·单片机·嵌入式硬件·微机原理·8088单板机
iCxhust6 天前
用汇编在8088单板机上创建一个进程
汇编·微机原理