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

1

9

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).

Costard answered 1/5, 2012 at 15:28 Comment(3)
Your second guess is correct. It's accessing the value at -8 bytes offset from address rbp.Xenogamy
Hey Mysticial, can you point to a reference that explains this easily?Costard
Confusing AT&T syntax strikes again.Central
X
9

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.

Xenogamy answered 1/5, 2012 at 15:35 Comment(2)
Can you point to a reference that explains this easily? Most of the assembly language tutorials and references are hopelessly obfuscated (or so I feel. maybe it's just me)Costard
I'm trying to find one right now. But the relative addressing thing might be a bit on the basic side.Xenogamy

© 2022 - 2024 — McMap. All rights reserved.