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 = X[n];

result = CountLeadingSignBits(operand1);

X[d] = 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;

相关推荐
要记得喝水2 天前
汇编中常用寄存器介绍
开发语言·汇编·windows·c#·.net
技术领导力4 天前
华为开源CANN,再次释放“昇腾转向”信号
汇编
DONG9138 天前
Python 中的可迭代、迭代器与生成器——从协议到实现再到最佳实践
开发语言·汇编·数据结构·python·算法·青少年编程·排序算法
embrace9911 天前
【C语言学习】scanf函数
c语言·开发语言·汇编·学习·青少年编程·c#·编辑器
麦兜*11 天前
【算法】十大排序算法超深度解析,从数学原理到汇编级优化,涵盖 15个核心维度
java·汇编·jvm·算法·spring cloud·ai·排序算法
会掉头发12 天前
x86_64汇编
汇编
CHANG_THE_WORLD12 天前
NEG指令说明
汇编·逆向·neg
南玖yy16 天前
Linux 桌面市场份额突破 5%:开源生态的里程碑与未来启示
linux·运维·服务器·汇编·科技·开源·gradle
GeekMax17 天前
(笔记)U-boot 2012.10 armv7启动汇编解析
汇编
南玖yy19 天前
Linux权限管理:从“Permission denied“到系统安全大师
linux·运维·汇编·后端·架构·系统安全·策略模式