Home

mmaddps

mmaddps is an MMX/SSE instruction that performs a multiply-add operation on packed single-precision floating-point values. Given two 128-bit operands containing four 32-bit floats each, it multiplies corresponding elements and adds adjacent products to produce two 32-bit results embedded in the destination.

Formally, for operand vectors a = [a0, a1, a2, a3] and b = [b0, b1, b2, b3], mmaddps computes

mmaddps is part of the MMX instruction set and has an equivalent SSE form called maddps when

Typical use cases include dot-product style computations in graphics, digital signal processing, and physics simulations where

[a0*b0
+
a1*b1,
a2*b2
+
a3*b3]
and
places
the
results
in
the
two
lower
32-bit
lanes
of
the
destination
register.
The
remaining
two
lanes
are
unspecified
by
the
instruction
and
should
be
treated
as
undefined
unless
overwritten
by
subsequent
instructions.
The
operation
uses
4
multiplies
and
2
additions
per
128-bit
vector.
operating
on
XMM
registers.
In
C
intrinsics,
the
corresponding
intrinsic
is
_mm_madd_ps
(or
an
equivalent
for
the
specific
compiler/headers).
The
two
results
produced
effectively
perform
two
parallel
2-element
dot
products
in
a
single
instruction,
contributing
to
performance
in
vectorized
computations.
two
small
2-element
dot
products
are
computed
per
iteration.
Notes
include
IEEE-754
compliance
for
floating-point
operations
and
the
need
to
manage
MMX
state
explicitly
(for
example,
using
EMMS
to
clear
the
MMX
state
before
switching
back
to
SSE).