immediate-operand

Why can't I move #1001 into r5 on arm?

可紊 提交于 2021-01-28 01:17:10
问题 I have an RPi4 and I'm trying to write some code in assembly to loop 1000 times. The code works fine when I set a lower number of loops, but when I try to set it 1001, gcc says: loop.s: Assembler messages: loop.s:15: Error: invalid constant (3e9) after fixup Here's the code: .data ms3: .asciz "%d\n" .text .global main .extern printf main: push {ip, lr} mov r1, #0 mov r5, #1001 loop1000: push {r1} ldr r0, =ms3 bl printf pop {r1} add r1, #1 cmp r1, r5 bne loop1000 pop {ip, pc} 回答1: Assembly

why we can't move a 64-bit immediate value to memory?

泪湿孤枕 提交于 2020-07-09 05:15:53
问题 First I am a little bit confused with the differences between movq and movabsq , my text book says: The regular movq instruction can only have immediate source operands that can be represented as 32-bit two’s-complement numbers. This value is then sign extended to produce the 64-bit value for the destination. The movabsq instruction can have an arbitrary 64-bit immediate value as its source operand and can only have a register as a destination. I have two questions to this. Question 1 The