问题描述
这是什么意思:我只有12立即数位,这样我就可以重新present立即数只能从0到2 ^ 12 = 4096?操作数2,如果它是一个寄存器,可以有32位,但为什么只有12位的立即数?来自哪儿呢这个数字?
what does it mean : I have only 12 bits for immediate constants, so can I represent immediate constants only from 0 to 2^12 = 4096 ? Operand 2 , if it's a register, can have 32 bits, but why only 12 bits for immediate constants? Where does this number come from?
推荐答案
它由指令集定义。例如。在 MOV
指令EN codeD为
It defined by the instruction set. E.g. the MOV
instruction is encoded as
31 28 | 27 26 | 25 | 24 23 22 21 20 | 19 16 | 15 12 | 11 0 |
cond | 0 0 | I | 1 1 0 1 S | SBZ | Rd | shifter operand |
(see "ARM Architecture Reference Manual, 4.1.29 "MOV")
立即常数恩在移位操作,它只有12位codeD。其他指令也有类似的定义有时是其它宽度。
"Immediate" constants are encoded in the "shifter operand" which is 12 bits only. Other instructions have similar definitions are sometimes other widths.
此限制,是因为 - 不同于x86 - 基于ARM指令通常是32位或16,有时使用位时的Thumb(2)。为了支持这不可能是由一个12位的二进制数直接pssed前$ P $值,移位器操作数允许不同的寻址方式(例如左移,右移,旋转)。
This limitation exists because -- unlike on x86 -- instructions on ARM are always 32 bit or sometimes 16 bit when using Thumb(2). To support values which can not be expressed directly by a 12 bit binary digit, the shifter operand allows different addressing modes (e.g. left-shift, right-shift, rotating).
这篇关于ARM:为什么只对立即数12位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!