ARM 体系结构系列——数据处理指令

1. 指令功能

  • ASR provides the signed value of the contents of a register divided by a power of two. It copies the sign bit into vacated bit positions on the left.
  • LSL provides the value of a register multiplied by a power of two. LSR provides the unsigned value of a register divided by a variable power of two. Both instructions insert zeros into the vacated bit positions.
  • ROR provides the value of the contents of a register rotated by a value. The bits that are rotated off the right end are inserted into the vacated bit positions on the left.
  • RRX provides the value of the contents of a register shifted right one bit. The old carry flag is shifted into bit[31]. If the S suffix is present, the old bit[0] is placed in the carry flag.

reffer link

2. 指令举例

● <immediate>

	MOV R0, #0xFC0 ;令R0的数值为0xFC0

● <Rm>

	MOV R0, #1
	MOV R1, R0
	ADD R2, R0, R1

● <Rm>, LSL #<shift_imm>

	MOV		R0, #0xF1
	MOV		R0, R0, ROR #6
	MOV		R1, R0, LSL #1
	;R0 0xc4000003 = "1100 0100 0000 0000 0000 0000 0000 0011"
	;R1 0x88000006 = "1000 1000 0000 0000 0000 0000 0000 0110"

● <Rm>, LSL <Rs>

	MOV		R0, #0xF1
	MOV		R0, R0, ROR #6
	MOV		R1, #2
		
	MOV		R2, R0, LSL R1
	;R0 0xc4000003 = "11000100000000000000000000000011"
	;R1 0x1000000C = "00010000000000000000000000001100"

● <Rm>, LSR #<shift_imm>

	MOV		R0, #0xF1
	MOV		R0, R0, ROR #6
	MOV		R1, R0, LSR #1
	;R0 0xc4000003 = "11000100000000000000000000000011"
	;R1 0x62000001 = "01100010000000000000000000000001"

● <Rm>, LSR <Rs>

	MOV		R0, #0xF1
	MOV		R0, R0, ROR #6
	MOV		R1, #0x2
		
	MOV		R2, R0, LSR R1
	;R0 0xc4000003 = "11000100000000000000000000000011"
	;R2 0x31000000 = "00110001000000000000000000000000"

● <Rm>, ASR #<shift_imm>

	MOV		R0, #0xF1
	MOV		R0, R0, ROR #6

	MOV 	R1, R0, ASR #1
	MOV		R2, R0, ASR #2
	;R0 0xc4000003 = "11000100000000000000000000000011"
	;R1 0xE2000001 = "11100010000000000000000000000001"
	;R2 0xF1000000 = "11110001000000000000000000000000"

● <Rm>, ASR <Rs>

	MOV		R0, #0xF1
	MOV		R0, R0, ROR #6
	MOV		R3, #1
	MOV 	R1, R0, ASR R3
	MOV 	R3, #2
	MOV		R2, R0, ASR R3
	;R0 0xc4000003 = "11000100000000000000000000000011"
	;R1 0xE2000001 = "11100010000000000000000000000001"
	;R2 0xF1000000 = "11110001000000000000000000000000"

● <Rm>, ROR #<shift_imm>

	MOV		R0, #0xF1
	MOV		R0, R0, ROR #6
	;R0 0xc4000003 = "11000100000000000000000000000011"	

● <Rm>, ROR <Rs>

	MOV		R0, #0xF1
	MOV 	R1, #6
	MOV		R0, R0, ROR R1
	;R0 0xc4000003 = "11000100000000000000000000000011"	

● <Rm>, RRX

	MOV		R0, #0xF1
	MOV		R0, R0, ROR #6
		
	MOV 	R1, R0, RRX
	;R0 0xc4000003 = "11000100000000000000000000000011"	
	;R1 0x62000001 = "01100010000000000000000000000001"		
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值