Using Math Libraries with IA-32 Systems

Library libm_chk.a

About half of the functions in the optimized math libraries are written in assembly language and optimized for program execution speed on an IA-32 processor. For a list of optimized primitives, see Optimized Math Library Primitives below.

The library libm_chk.a contains support routines for a floating-point division software patch for certain steppings of the PentiumŪ processors. For more information on the libm_chk.a library, see the Enable Floating-point Division Check, -fdiv_check (IA-32 Only) section. The libmmt.a or libmmtck.a library is used if the -mt multi-thread option is specified. The libmmd.a or libmmdck.a library is used if the -md option is specified.

To use your own version of the standard math functions without unresolved external errors, you must disable the automatic inline expansion by compiling your program with the
-nolib_inline
option, as described in Inline Expansion of Library Functions.

Optimized Math Library Primitives

The optimized math libraries contain a package of functions, called primitives. The Intel Fortran Compiler calls these functions to implement numerous floating-point intrinsics and exponentiation. Although both the libm.a and libmmt.a libraries and libmmd.a library contain the same functions, about half of the functions in the library from Intel are written in assembly language and optimized for program execution speed on an IA-32 architecture processor.

Note
The library primitives are not Fortran intrinsics. They are standard library calls used by the compiler to implement Intel Fortran language features.

Following is a list of math library primitives that have been optimized.

acos

cos

log10

sinh

asin

cosh

pow

sqrt

atan

exp

powf

tan

atan2

log

sin

tanh

The math library also provides the following non-optimized primitives.

acosh

copysign

fmod

gamma

asinh

erf

fmodf

remainder

atanh

fabs

hypot

rint

cbrt

fabsf

j0

y0

ceil

floor

j1

y1

ceilf

floorf

jn

y2

Programming with Math Library Primitives

Primitives adhere to standard calling conventions, thus you can call them with other high-level languages as well as with assembly language. For Intel Fortran Compiler programs, specify the appropriate Fortran intrinsic name for arguments of type REAL and DOUBLE PRECISION. The compiler calls the appropriate single- or double-precision primitive based on the type of the argument you specify.

To use these functions, you have to write an INTERFACE block that specifies the ALIAS name of the function. The routine names in the math library are lower case and use C linkage.

Itanium(TM)-based applications:

When programming in assembly language, you can derive register usage from the high-level language syntax given. All parameter passing conforms to the Itanium(TM) Assembly Language Reference Guide.

Enable Floating-point Division Check

The -fdiv_check option enables a software patch for the floating-point division flaw which exists on some steppings of the PentiumŪ processor. This patch ensures that the precision of your floating-point division calculations are correct. This option is enabled by default or if you specify the -tpp5 option.

When the -fdiv_check option is enabled, the compiler uses libm_chk.a (or libmmtck.a, if -mt is also specified; and libmmdck.a if -md is also specified), which are special versions of the library to link your programs. These files are linked automatically. The libm_chk.a (or libmmtck.a or libmmdck.a) libraries contain the support routines for the floating-point division software patch and checked versions of the affected math library functions.

The -fdiv_check option disables the software patch for the floating-point division flaw regardless of whatever other options are specified. When you specify -fdiv_check, the compiler uses simple hardware instructions for floating-point division and affected intrinsics. If you specify the -fdiv_check option, the compiler does not need a special version of optimized math library to link your programs. Similarly, if you choose not to use the optimized math library, you must specify -fdiv_check. This option is the default if you specify the -tpp6 option.