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;

相关推荐
rechol5 天前
汇编与底层编程笔记
汇编·arm开发·笔记
CHANG_THE_WORLD5 天前
switch语句在汇编层面的几种优化方式 ,为什么能进行优化
汇编·算法·switch·汇编分析·switch case·switch case 汇编·switch case 语句
SundayBear6 天前
嵌入式进阶:C语言内联汇编
c语言·开发语言·汇编
CC-NX8 天前
32位汇编:实验5算数运算类指令使用
汇编·win32·算数运算
伐尘8 天前
【汇编】RAX,eax,ax,ah,al 关系
汇编
CHANG_THE_WORLD8 天前
c语言位运算 汇编代码分析
c语言·开发语言·汇编
CHANG_THE_WORLD8 天前
if条件语句 三目运算符 汇编分析
汇编·算法·条件语句·if 语句·汇编分析·条件语句汇编分析
CHANG_THE_WORLD9 天前
有符号数和无符号数的 汇编视角 区别
汇编
南飞测绘视界10 天前
【编号220】中国国内生产总值历史数据汇编1952-2021合订本(PDF扫描版)
汇编·pdf·年鉴
Ayanami_Reii12 天前
汇编和C语言结构
c语言·汇编·笔记