6

On modern Intel FPUs, you can set a flag to cause all denormals to be automatically flushed to zero. On some workloads, this improves performance.

I cannot find any mention of that flag in the data sheet for the original 8087. Looks like it was introduced in a later model.

Which model of Intel FPU, first introduced this flag?

  • 6
    No x87 FPU has the ability to flush denormals to zero. Flushing to zero is only supported with SIMD instructions (SSE, AVX, etc.). – Ross Ridge Jun 27 at 22:45
  • 4
    That should be an answer! – another-dave Jun 27 at 23:12
  • 2
    @RossRidge Could you do this as answer? Maybe adding some manual of instruction page link? – Raffzahn Jun 28 at 0:46
17

Full disclosure: I worked on the x87 FPU of a 486-class CPU at a math-coprocessor company in the early 1990s and thereafter worked at AMD, where I was on the 3DNow! design team and the design team for the FPU of the AMD Athlon processor (also known as K7).

The x87 FPU never acquired a flush-to-zero mode. In fact, denormal support was one of the major innovations of the 1985 IEEE-754 standard, which was based on the work of William Kahan. So a re-introduction of flush-to-zero was considered somewhat anathema at the time.

However, denormals were rarely supported at full speed in x87 FPUs, and the resulting performance penalties were considered undesirable for 3D graphics and media processing on x86 processors when these became barely fast enough to make that feasible in the early 1990s. Some of the relevant use cases had soft-realtime characteristics.

This led to ideas about new alternative floating-point architectures using SIMD processing in the mid 1990s, of which AMD's 3DNow! was the first to market (K6-2, May 1998), shortly followed by Intel's SSE (Pentium III, February 1999). In the case of 3DNow!, there was no flush-to-zero mode per se, as that was simply all that was provided!

Stuart Oberman, Greg Favor, and Fred Weber: "AMD 3DNow! Technology: Architecture and Implementations", IEEE Micro, Vol. 19, No. 2, March-April 1999, pp. 37-48

The primary set of target applications for 3DNow! technology is multimedia. Because most multimedia applications operate in real time, the desire for hardware status and exception support is minimal. Thus, 3DNow!, like MMX, does not generate exceptions or set any status flags. Instead, the new instructions support saturating arithmetic such that overflow and underflow situations return reasonable default values. AMD implementations of 3DNow! technology generate properly signed, maximum representable normal numbers in the presence of numeric overflow. Similarly, all inputs and results below the minimum normal number are flushed to zero. Infinities and NaNs are not supported as operands to 3DNow! instructions.

Intel's SSE as the surviving technology, and later on AVX, AVX-2, etc. provides programmers with a choice of denormal-support and flush-to-zero modes. The control is relatively fine-grained by providing separate control bits for input (DAZ = denormals are zero) and output (FTZ = flush to zero).

Shreekant (Ticky) Thakkur and Tom Huff, "Internet Streaming SIMD Extensions," Computer, Vol. 32, No. 12, December 1999, pp. 26-34

We decided to offer two modes of floating-point arithmetic: IEEE compliance for applications that need exact single-precision computation and a flush-to-zero (FTZ) mode for real-time applications. Full IEEE support ensures greater future applicability of the extensions for applications that require full precision and portability. FTZ mode along with fast hardware support for masked exceptions enables the high-performance execution necessary for real-time applications. FTZ mode returns a zero result in an underflow situation if the exceptions are masked. Most real-time 3D applications would use FTZ mode since they are not sensitive to a slight loss in precision, especially if FTZ mode executes faster.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.