下面的这两条指令,
指令一:LDRSB R2,[R3]!
指令二:LDRSB R2,[R3],R0
汇编成ARM二进制指令之后是完全相同的,都是E09320D0,但是这两条指令在我们理解起来含义是不同的:
LDRSB R2,[R3]! :这条指令包括两个操作步骤,一是将R3所指的内存单元(一个有符号字节)放到寄存器R2中;
二是将R3寄存器的内容送到R3中。
LDRSB R2,[R3],R0 :这条指令也有两个操作步骤,一是将R3所指的内存单元(一个有符号字节)放到寄存器R2中;
二是将R3+R0送到R3中。
显然从“字面”意义上,这两条指令是截然不同,第一条指令应该与"LDRSB R2,[R3,#0]"或者"LDRSB R2,[R3],#0"是相同的。
如果指令一被汇编成“E09320D0”,毫无疑问是按照指令二去执行的。
看另外的一条类似指令:
指令三: LDR R2,[R3]! (注意比较:LDRSB R2,[R3]! )
指令三被汇编成“LDR R2,[R3],#0”
很显然,LDRSB R2,[R3]! 被汇编成“LDRSB R2,[R3],R0 ”是明显值得商榷的。