This preview shows page 1. Sign up to view the full content.
Unformatted text preview: nd) 2. Looks for, reports on, and handles post-computation exception conditions (numeric overflow, numeric underflow, and inexact result) If both pre- and post-computational exceptions are unmasked, it is possible for the processor to generate a SIMD floating-point exception (#XF) twice during the execution of an SSE, SSE2 or SSE3 instruction: once when it detects and handles a precomputational exception and when it detects a post-computational exception. 18.104.22.168 Handling Masked Exceptions If all exceptions are masked, the processor handles the exceptions it detects by placing the masked result (or results for packed operands) in a destination operand Vol. 1 11-23 PROGRAMMING WITH STREAMING SIMD EXTENSIONS 2 (SSE2) and continuing program execution. The masked result may be a rounded normalized value, signed infinity, a denormal finite number, zero, a QNaN floating-point indefinite, or a QNaN depending on the exception condition detected. In most cases, the corresponding exception flag bit in MXCSR is also set. The one situation where an exception flag is not set is when an underflow condition is detected and it is not accompanied by an inexact result. When operating on packed floating-point operands, the processor returns a masked result for each of the sub-operand computations and sets a separate set of internal exception flags for each computation. It then performs a logical-OR on the internal exception flag settings and sets the exception flags in the MXCSR register according to the results of OR operations. For example, Figure 11-9 shows the results of an MULPS instruction. In the example, all SIMD floating-point exceptions are masked. Assume that a denormal exception condition is detected prior to the multiplication of sub-operands X0 and Y0, no exception condition is detected for the multiplication of X1 and Y1, a numeric overflow exception condition is detected for the multiplication of X2 and Y2, and another denormal exception is detected prior to the multiplication of sub-operands X3 and Y3. Because denormal exceptions are masked, the processor uses the denormal source values in the multiplications of (X0 and Y0) and of (X3 and Y3) passing the results of the multiplications through to the destination operand. With the denormal operand, the result of the X0 and Y0 computation is a normalized finite value, with no exceptions detected. However, the X3 and Y3 computation produces a tiny and inexact result. This causes the corresponding internal numeric underflow and inexact-result exception flags to be set. X3 X2 X1 X0 (Denormal) Y3 (Denormal) Y2 Y1 Y0 MULPS MULPS MULPS MULPS Tiny, Inexact, Finite Normalized Finite Normalized Finite Figure 11-9. Example Masked Response for Packed Operations
For the multiplication of X2 and Y2, the processor stores the floating-point in the destination operand, and sets the corresponding internal sub-operand numeric overflow flag. The result of the X1 and Y1 multiplication is passed through to the destination opera...
View Full Document
- Winter '11