Are there small registers in ARM assembly? -
i started playing arm assembly , notice seem move 32 bit values registers if wanted move 8 or 16 bits registers in x86 assembly. i.e.
arm eor r0, r0 mov r0, #128 x86 xor eax, eax mov al, 0x80
r0 contains 0x80 32 bit register contain 0x00000080
if x86 use al (8 bit register) manipulate last byte instead of eax (32 bit register).
tl;dr there small registers in arm assembly?
no. arm registers 32-bit1.
however, assuming you're on recent enough architecture version (armv6t2 or later) can use bfi
, ubfx
instructions insert/extract arbitrary slice of register from/to bottom of without affecting other bits. doing same immediate operand little trickier since mov
zero-extends immediates2 (i.e. eor r0,r0
in example entirely redundant) - you'd either have use and
, orr
mentioned, or use intermediate register mov
followed bfi
.
[1] well, "fixed-size" more appropriate once consider aarch64 state - there have 32-bit , 64-bit views of same registers, writes 32-bit view implicitly 0 upper 32 bits, same principle still applies (i.e. doesn't allow pretend have twice many half-sized registers 8086).
[2] exception movt
, loads immediate upper 16 bits of register without touching lower half (to allow loading full 32-bit immediate movw
/movt
pair)
Comments
Post a Comment