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 小时前
巧用终端,每天节省2小时
汇编·经验分享·vim
2501_9277730718 小时前
嵌入式——汇编语言1
汇编
山峰哥18 小时前
数据库工程核心:SQL调优让查询效率飙升的实战密码
网络·汇编·数据库·sql·编辑器
秋深枫叶红1 天前
嵌入式第四十七篇——ARM汇编
汇编·arm开发·学习
jh10_1 天前
嵌入式硬件DAY5(ARM汇编)
汇编·arm开发·嵌入式硬件
时空自由民.3 天前
I3C协议介绍
汇编·stm32·单片机
浩浩测试一下4 天前
高阶免杀技术掌握概览
汇编·安全·web安全·网络安全·系统安全·安全架构
听情歌落俗7 天前
ARM架构-硬件架构和汇编指令
汇编·arm开发·硬件架构
云qq7 天前
x86操作系统23——进程相关系统调用
linux·c语言·汇编·ubuntu
新鲜感~10 天前
汇编点灯基于SC32440
linux·汇编