Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the following assembly instruction do addsd -8(%rbp), %xmm0?

I'm trying to figure out what the assembly instruction actually does

addsd   -8(%rbp), %xmm0

I know that it's a floating point addition on an x86-64 machine with SSE2. Also, I know that %xmm0 is a register. However, what I'm not sure of is what -8(%rbp) means. The manuals are a bit confusing on that.

Basically, the question is, does -8(%rbp) mean that it's taking a value from a register (maybe the last 8 bytes of rbp) or is it taking a value from memory (floating point value at an offset of -8 from the address contained in rbp).

like image 856
owagh Avatar asked May 01 '12 15:05

owagh


1 Answers

Your second guess is correct. It's accessing the value at -8 bytes offset from address rbp.

Assuming AT&T syntax, this instruction loads an 8-byte double from address rbp - 8 and adds it to the value in the lower half of xmm0.

like image 143
Mysticial Avatar answered Oct 17 '22 01:10

Mysticial