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;

相关推荐
水饺编程8 小时前
第2章:Linux 基础,在 root 中创建用户账号
linux·c语言·汇编·1024程序员节
一个风轻云淡11 小时前
从 int $0x80 到 iret:用 gdb 把 getpid 走一遍
linux·c语言·开发语言·汇编
水饺编程1 天前
第2章:Linux 基础,切换到超级用户
linux·c语言·汇编
水饺编程2 天前
第2章:Linux 基础,重启命令
linux·c语言·汇编
en.en..4 天前
volatile 完整深度教程(C 代码 + 带注释 ARM 汇编 + 硬件中断原理 + 分步运行时序)
c语言·汇编·arm开发
水饺编程5 天前
第2章:Linux 基础,rm 命令
linux·c语言·汇编
水饺编程5 天前
第2章:Linux 基础,关机命令
linux·c语言·汇编
en.en..6 天前
汇编与 C 语言 互调用
汇编
wuminyu7 天前
Continuation::freeze与thaw的x86_64汇编Stack Chunk拆解源码分析
java·linux·c语言·汇编·jvm·c++
en.en..7 天前
ARM 汇编 B / BL 核心区别
汇编·arm开发