03.03.2013 Views

Intel® Architecture Instruction Set Extensions Programming Reference

Intel® Architecture Instruction Set Extensions Programming Reference

Intel® Architecture Instruction Set Extensions Programming Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

APPLICATION PROGRAMMING MODEL<br />

Scalar FMA instructions only perform one arithmetic operation on the low order data element. The content of the<br />

rest of the data elements in the lower 128-bits of the destination operand is preserved. the upper 128bits of the<br />

destination operand are filled with zero.<br />

An arithmetic FMA operation of the form, r=(x*y)+z, takes two IEEE-754-2008 single (double) precision values<br />

and multiplies them to form an infinite precision intermediate value. This intermediate value is added to a third<br />

single (double) precision value (also at infinite precision) and rounded to produce a single (double) precision result.<br />

Table 2-2 describes the numerical behavior of the FMA operation, r=(x*y)+z, r=(x*y)-z, r=-(x*y)+z, r=-(x*y)-z<br />

for various input values. The input values can be 0, finite non-zero (F in Table 2-2), infinity of either sign (INF in<br />

Table 2-2), positive infinity (+INF in Table 2-2), negative infinity (-INF in Table 2-2), or NaN (including QNaN or<br />

SNaN). If any one of the input values is a NAN, the result of FMA operation, r, may be a quietized NAN. The result<br />

can be either Q(x), Q(y), or Q(z), see Table 2-2. If x is a NaN, then:<br />

• Q(x) = x if x is QNaN or<br />

• Q(x) = the quietized NaN obtained from x if x is SNaN<br />

The notation for the output value in Table 2-2 are:<br />

• “+INF”: positive infinity, “-INF”: negative infinity. When the result depends on a conditional expression, both<br />

values are listed in the result column and the condition is described in the comment column.<br />

• QNaNIndefinite represents the QNaN which has the sign bit equal to 1, the most significand field equal to 1, and<br />

the remaining significand field bits equal to 0.<br />

• The summation or subtraction of 0s or identical values in FMA operation can lead to the following situations<br />

shown in Table 2-1<br />

• If the FMA computation represents an invalid operation (e.g. when adding two INF with opposite signs)), the<br />

invalid exception is signaled, and the MXCSR.IE flag is set.<br />

Table 2-1. Rounding behavior of Zero Result in FMA Operation<br />

x*y z (x*y) + z (x*y) - z - (x*y) + z - (x*y) - z<br />

(+0) (+0)<br />

(+0) (-0)<br />

(-0) (+0)<br />

(-0) (-0)<br />

F -F<br />

F F<br />

+0 in all rounding modes - 0 when rounding down,<br />

and +0 otherwise<br />

- 0 when rounding down,<br />

and +0 otherwise<br />

- 0 when rounding down,<br />

and +0 otherwise<br />

- 0 in all rounding modes - 0 when rounding down,<br />

and +0 otherwise<br />

- 0 when rounding down,<br />

and +0 otherwise<br />

2*F - 0 when rounding down,<br />

and +0 otherwise<br />

- 0 when rounding down,<br />

and +0 otherwise<br />

- 0 in all rounding modes<br />

+0 in all rounding modes - 0 in all rounding modes - 0 when rounding down,<br />

and +0 otherwise<br />

- 0 in all rounding modes + 0 in all rounding modes - 0 when rounding down,<br />

and +0 otherwise<br />

- 0 when rounding down,<br />

and +0 otherwise<br />

+ 0 in all rounding modes<br />

2*F -2*F - 0 when rounding down,<br />

and +0 otherwise<br />

- 0 when rounding down,<br />

and +0 otherwise<br />

2-6 Ref. # 319433-014<br />

-2*F

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!