So far my current understanding is something along the lines of:
movq %rdi, %rax
will move the value from the register %rdi
to the register %rax
and movq (%rdi), %rax
will move the value from memory at (%rdi)
to the register %rax
However, I'm having trouble understanding what this actually means functionally. In what instance will these two assembly lines end with a different result?
It will yield a different result every time the memory at adress (%rdi) does not contain its own adress. In other words, almost always. And when not, it's just a coincidence or a consequence of very unusual code.
Some C to demonstrate the equivalent question "When will the two printf statements print the same result?"
#include <stdio.h>
int main()
{
int a,*p;
int b=5;
p=&b;
a=*p;
printf("%d\n", a);
a=(int)p;
printf("%d\n", a);
}
And, yes, this yields the warning cast from pointer to integer of different size
but that's beside the point.