Reputation:
In assembly I am trying to add 32 bits from memory to 64 registers, this will load 64 bits:
add arr(,%rax,4), %rbx
So I tried:
add arr(,%rax,4), %rbx
which didn't work.
How can I solve this?
Upvotes: 1
Views: 338
Reputation: 6234
You cannot perform the operation directly, but in two steps: First you need to zero extend your value into an additional register, and then you can use it for the addition.
Something like this should do the work:
movl arr(,%rax,4), %edx
add %rdx, %rbx
Upvotes: 2