Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A reference for AT&T syntax assembly floating point arithmetic

I've been trying for the past week to find a decent resource on floating point arithmetic for x86 assembly using AT&T syntax. Ideally, a list of the opcodes, what they do, and where the floats are stored. I am familiar with IEEE 754 representation. I am not familiar with the floating point stack, and any assembly referring to floating point arithmetic.

It's strange how difficult this is to find.

EDIT: I've been looking at gcc -S output for the past month learning the assembly. That's how I figured out everything except floating point arithmetic. Even after going through dozens of small programs compiled without optimizations, I still can't figure out much about the floating point opcodes and the stack. I've only found trivial examples online.

like image 508
Kizaru Avatar asked Oct 10 '10 22:10

Kizaru


People also ask

How do you mention someone in an email reference?

Use @ in the body of a message or meeting invite You can delete a portion of the mention, for example, everything other than the person's first name. The mentioned contact is also added to the To line of the email or the meeting invite.


1 Answers

Okay. Start with Intel syntax first, because most x86 assembly coders use it. Intel's manuals are a great resource for learning about how the x86 handles floating-point stuff.

After you learn x86 assembly in general, AT&T syntax isn't so hard to learn. The main things to note are:

  • registers are prefixed by %; numeric constants are prefixed by $
  • register order is swapped for most two-operand instructions (i.e., source first, target last)
  • instruction names specify the size; so instead of mov dword ptr [ebx], 1337, you'd say movl $1337, (%ebx).
like image 169
Chris Jester-Young Avatar answered Sep 23 '22 22:09

Chris Jester-Young