When I compile a simple C program into assembly form on a x86-64 machines, I notice that each function call generally start with such instructions (w/ all optimization turned off)
pushq %rbp
movq %rsp, %rbp
In the first instruction, we decrement the stack pointer by 8 bytes, hence growing the stack to make room for saving the value in frame pointer. In the second instruction, we copy the value in stack pointer to frame pointer, so frame pointer now points to the base address of next stack frame.
Various articles confirms my understanding: when we say movq %rsp, %rbp
we are copying the value from first operand (i.e. source, in this case %rsp) to third operand (i.e. destination, in this case %rbp).
However, when I consult the reference manual of x86-64 (https://www.felixcloutier.com/x86/movq ) I found a conflicting semantics on movq. According to the reference, it seems this instruction is copying the value from second operand to the first operand, in the reversed order.
I'm confused, which one is the correct semantics? Is there any good online authoritative source for x86 instructions?