
上QQ阅读APP看本书,新人免费读10天
设备和账号都新为新人
5.2 数据处理指令
数据处理是ARM处理器的看家本领,Cortex-M3提供了丰富多彩的数据处理指令,每种指令的用法也是多种多样的。
5.2.1 算术四则运算指令
数据处理指令中常见的是算术四则运算指令,如表5-5所示。
表5-5 常见的算术四则运算指令

Cortex-M3 还片载了硬件乘法器,支持乘加/乘减指令,并且能产生64 位的积,如表5-6所示。
表5-6 64位乘法指令

5.2.2 逻辑及移位操作指令
Cortex-M3逻辑运算及移位运算也是基本的数据操作,如表5-7所示。
表5-7 常用逻辑操作指令

Cortex-M3还支持为数众多的移位运算。移位运算既可以与其他指令组合使用,也可以独立使用,如表5-8所示。
表5-8 移位和循环指令

Cortex-M3还包括带符号扩展指令,如表5-9所示。
表5-9 常用的带符号扩展指令

5.2.3 数据序转及位操作指令
我们知道,32位整数可以被认为是由4个字节拼接成的,也可以被认为是2个半字拼接成的。有时,需要把这些子元素颠来倒去。此时便用到数据序转指令,如表5-10所示。
表5-10 常用的数据序转指令

Cortex-M3也支持位操作指令。位操作在单片机程序中,以及在系统软件中应用得比较多,而且在这里面有大量的使用技巧。常用的位操作指令如表5-11所示。
表5-11 常用的位操作指令
