Search code examples
gccassemblyarmgnu-assembler

Is the hash required for immediate values in ARM assembly?


I've been working on reading through some different arm assembly code generated by gcc, and I came across something that I haven't been able to find in the spec.

movw    r0, #39784
movt    r0, 1

Obviously the first one is moving the value 39784 into the bottom 16bits or r0, but the movt's operand of '1' is odd because it doesnt have the hash before it, and I was under the impression that immediate values required the hash. Is it somehow optional in certain situations? or am I missing something magical?


Solution

  • The GNU assembler does not require an octothorpe before an immediate operand for ARM assembly code. Your impression is incorrect.