This is simplified from a larger example.
In the C source, I have:
uint32_t xx = oxdeadbeef ;
I compiled with gcc -O or clang -O
Looking at 'objdump -d a.out' on the RPi 4, I see
9ac: 5297dde8 mov w8, #0xbeef // #48879
9b0: 72bbd5a8 movk w8, #0xdead, lsl #16
This produces the correct result, but, these are 16-bit values. How do I force gcc or clang to use 32-bits in this case?
mov w8, #0xdeadbeef
Or, do I want to?
uint32_t xx = oxdeadbeef ;
I am 100 % sure you do not have it.mov wn, #imm32
in a single instruction. So instead the architecture designers limited it to 16 bits and providedmovk
to make it reasonably convenient to construct a larger value with multiple instructions. We've definitely had other questions about this issue, but I can't find one that's really "canonical" to link as a dupe. Maybe I'll write one at some point.mov
is not a real instruction.