Today I will show you how to use the MMX instructions.
SSE stands for Streaming SIMD Extensions and uses 128-bit registers:
XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7
The capabilities of the XMM registers are:

  • 2 64-bit floating points (double precision)
  • 2 64-bit integers
  • 4 32-bit floating points (single-precision)
  • 4 32-bit integers
  • 8 16-bit integers
  • 16 8-bit characters (bytes)

I will use two operations with these registers:
DIVSD — Divide Scalar Double-Precision Floating-Point Value
Divides the low double-precision floating-point value in the first source operand by the low double-precision floating-point value in the second source operand, and stores the double-precision floating-point result in the destination operand. The second source operand can be an XMM register or a 64-bit memory location. The first source and destination are XMM registers.
MULSD — Multiply Scalar Double-Precision Floating-Point Value
Multiplies the low double-precision floating-point value in the second source operand by the low double-precision floating-point value in the first source operand, and stores the double-precision floating-point result in the destination operand. The second source operand can be an XMM register or a 64-bit memory location. The first source operand and the destination operands are XMM registers.
First source code for DIVSD:

First source code for MULSD:

The examples start with some base code in order to show the result.
First is the align the stack.
You can see I load registers r14 and r13 with these numbers 11 and 5.
I put the values from registers r14 and r13 into xmm0 and xmm8.
I process the operations divsd and mulsd.
Because I used xmm8 to get the result needs to use movq operation, else the result is the first number load into xmm0.
In the last part from mov rdi,formt is used to show the result.
Use fasm tool like this:

The result is this:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.