I’m trying to set a register to 12000. Since MOV can’t put a value larger than 255 in I figure 12000/2^8=375. But 375 is still too big and not divisible by 2. Is the only thing left to store 12000 in memory? Is it that much less efficient?
Out of curiosity why is it 255 and not 256 since it’s unsigned?
What ARM arch are you targeting? On ARMv7, there is a very nice solution — the
movwinstruction, which takes a 16-bit immediate:Prior to ARMv7, you need to use two steps:
Note that expressible immediates aren’t only eight bits wide; they are eight bits rotated by any even offset. Alternatively, you can simply load the value from memory instead of using an immediate.