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;

相关推荐
星栖与芯7 小时前
LiteOS-M 切换汇编逐行图解(5):HalPendSV 任务切换的现场搬运(五阶段逐行)
汇编·stm32·嵌入式硬件·harmonyos
星栖与芯17 小时前
LiteOS-M 切换汇编逐行图解(4):中断三件套与 HalTaskSchedule 触发
汇编·stm32·单片机·嵌入式硬件·harmonyos
xx~t1 天前
嵌入式——ARM——汇编2
linux·汇编·arm开发·嵌入式硬件·启动代码
祖力551 天前
ARM汇编LED实验
汇编·arm·imx6ull
索端阳2 天前
ARM Day02 学习总结:ARM汇编基础核心知识点梳理
汇编·学习·arm
xx~t2 天前
嵌入式——ARM——汇编1
linux·汇编·arm开发·嵌入式硬件·arm
索端阳3 天前
初识 ARM Cortex-A7,嵌入式底层入门总结
汇编·嵌入式硬件
ThornArmor4 天前
重铸1996|肉体渲染:关节的裂缝:分段模型积木拼装与未成熟的 RSP 矩阵骨骼动画形变
c语言·汇编·c++·python·硬件架构·游戏机
星栖与芯4 天前
LiteOS-M 切换汇编逐行图解(1):汇编是什么·寄存器与栈
汇编·stm32·嵌入式硬件·harmonyos·鸿蒙系统
yume_sibai4 天前
11-Rust 不安全编程(unsafe 关键字 + 裸指针 + FFI + 内联汇编 + 内存安全保证)
汇编·安全·rust