User Guide

168 128-Bit Media and Scientific Programming
AMD64 Technology 24592—Rev. 3.15—November 2009
point values in the third and fourth doublewords of the source operand and stores the sum in the fourth
doubleword of the destination operand.
The HADDPD instruction adds the two double-precision floating point values in the quadword halves
of the destination operand and stores the sum in the first quadword of the destination. It adds the values
in the two quadword halves of the source register and stores the sum in the second quadword of the
destination register.
Subtraction
SUBPS—Subtract Packed Single-Precision Floating-Point
SUBPD—Subtract Packed Double-Precision Floating-Point
SUBSS—Subtract Scalar Single-Precision Floating-Point
SUBSD—Subtract Scalar Double-Precision Floating-Point
The SUBPS instruction subtracts each of four single-precision floating-point values in the second
operand from the corresponding single-precision floating-point value in the first operand and writes
the result in the corresponding quadword of the destination. The SUBPD instruction performs an
analogous operation for two double-precision floating-point values.
For vectors of n number of elements, the operations are:
operand1[i] = operand1[i] - operand2[i]
where: i = 0 to n 1
The SUBSS instruction subtracts the single-precision floating-point value in the low-order
doubleword of the second operand from the corresponding single-precision floating-point value in the
low-order doubleword of the first operand and writes the result in the low-order doubleword of the
destination. The three high-order doublewords of the destination are not modified.
The SUBSD instruction subtracts the double-precision floating-point value in the low-order quadword
of the second operand from the corresponding double-precision floating-point value in the low-order
quadword of the first operand and writes the result in the low-order quadword of the destination. The
high-order quadword of the destination is not modified.
Horizontal Subtraction
HSUBPS—Horizontal Subtract Packed Single-Precision Floating-Point
HSUBPD—Horizontal Subtract Packed Double-Precision Floating-Point
The HSUBPS instruction subtracts the packed-singled precision operand in the second doubleword of
the destination register from that in the first doubleword of the destination register and stores the result
in the first doubleword of the destination register. It subtracts the fourth doubleword of the destination
operand from the third doubleword of the destination operand and stores the result in the second
doubleword of the destination. It subtracts the packed-singled precision operand in the second
doubleword of the source register from that in the first doubleword of the source register and stores the
result in the third doubleword of the destination register. It subtracts the fourth doubleword of the