25112 Rev. 3.06 September 2005

Software Optimization Guide for AMD64 Processors

Examples

Listing 22.

/* Prototype for _controlfp function */ #include <float.h>

unsigned int orig_cw;

/* Get current FPU control word and save it. */ orig_cw = _controlfp(0, 0);

/* Set precision control in FPU control word to single precision. This reduces the latency of divide and square-root operations. */ _controlfp(_PC_24, MCW_PC);

/* Restore original FPU control word. */ _controlfp(orig_cw, 0xfffff);

Chapter 2

C and C++ Source-Level Optimizations

51

Page 67
Image 67
AMD 250 manual Examples