Intel® C++ Compiler
For Intel XScale® Microarchitecture
For Platform Builder for
Microsoft* Windows* CE .NET and Microsoft* eMbedded* Visual C++*
User's Manual
Copyright © 2001-2005 Intel Corporation
All Rights Reserved
Issued in U.S.A.
Document Number: 278580-016


Legal Information

Version | Version Information | Date
-001 | Initial version 1.0 for the Intel® C++ Compiler version 0.01 | September 2002
-002 | Update 1.0 for the Intel® C++ Compiler version 1.00 | November 2002
-003 | Update 1.2 for the Intel® C++ Compiler version 1.1 | February 2003
-004 | Update 1.3 for the Intel® C++ Compiler version 1.2 | August 2003
-005 | Update 1.4 for the Intel® C++ Compiler version 1.2 | August 2003
-006 | Update 1.5 for the Intel® C++ Compiler version 1.2 | May 2004
-010 | Update for the Intel® C++ Compiler version 2.0 | August 2004
-013 | Updated version for the Intel® C++ Compiler version 2.0 | January 2005
-014 | Updated version for the Intel® C++ Compiler version 2.0 | January 2005
-016 | Updated version for the Intel® C++ Compiler version 2.0 | May 2005

The information in this manual is subject to change without notice and Intel Corporation assumes no responsibility or liability for any errors or inaccuracies that may appear in this document or any software that may be provided in association with this document. This document and the software described in it are furnished under license and may only be used or copied in accordance with the terms of the license. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted by this document. The information in this document is provided in connection with Intel products and should not be construed as a commitment by Intel Corporation.
EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. Intel products are not intended for use in medical, life saving, life sustaining, critical control or safety systems, or in nuclear facility applications.
Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them.
The software described in this document may contain software defects which may cause the product to deviate from published specifications. Current characterized software defects are available on request.
Intel, the Intel logo, Intel SpeedStep, Intel NetBurst, Intel NetStructure, MMX, i386, i486, Intel386, Intel486, Intel740, IntelDX2, IntelDX4, IntelSX2,Celeron, Intel Centrino, Intel Xeon, Intel XScale, Itanium, Pentium, Pentium II Xeon, Pentium III Xeon, Pentium M, and VTune are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.
* Other names and brands may be claimed as the property of others.
Copyright © Intel Corporation 2003-2005.
Portions Copyright © 1982-1994 Kinetech, Inc. [or its assignee].
Portions Copyright © 1994-2001 by Dinkumware. ALL RIGHTS RESERVED.


Introduction

The Intel® C++ Compiler processes C and C++ files and converts these files into common object file format (COFF). The Intel® C++ Compiler plugs into the Microsoft* Platform Builder and Microsoft* eMbedded Visual C++* / Visual Studio* 2005 and is intended to be used in these environments to develop applications for Intel XScale® technology written in C/C++ and assembly source code.

The product contains also an Intel® Adaptation Kit Installation Utility to integrate the Intel® C++ Compiler for Windows* CE, Professional, into the Microsoft* Adaptation Kit for Windows Mobile* 2003 Software (PocketPC, Smartphone) and Windows Mobile* 5.0.

The Intel® C++ Compiler for Microsoft Windows* CE .NET includes:

  • Intel® C++ Compiler for 32-bit Intel XScale® technology applications (ARM* mode)
  • Intel® C++ Compiler for 16-bit Intel XScale® technology applications (Thumb* mode)
  • Intel® Assembler for 16/32-bit Intel XScale® technology assembler source files
  • Intel® Run-time Library
  • Intel® Libm Mathematical Library
  • Debugging extensions
  • Documentation set

The Intel® C++ Compiler supports the following features:

  • C and C++ language
  • Command line options to control the compilation process
  • Inline assembler
  • Intel® Wireless MMX(TM) technology and Intel® Wireless MMX(TM) 2 technology intrinsic functions
  • Loop vectorization
  • Structured exception handling
  • Generation of COFF/CodeView* objects
  • Generation of debug information


About this Manual

This is a user's manual explaining how to use the Intel® C++ Compiler on Windows host platforms. It provides information how to start using the Intel® C++ Compiler, how this compiler operates and how it could be used for development of high performance applications. You learn how to use the standard and advanced compiler features to gain maximum performance of your application.

This document assumes that you are familiar with the C and C++ programming languages and with the Intel XScale® technology. You should also be familiar with the host computer's operating system.

The manual contains the following chapters:

  • "Introduction" is this chapter. It also provides an overview of related documents, compiler/operating system's requirements, and the manual's conventions.
  • "General Usage" offers a brief description on how to use the Intel® C++ Compiler. The chapter describes the command line syntax, the makefile command line syntax, input and output files, the usage of the compiler with Microsoft Windows* CE .NET, and the default behavior of the Intel® C++ Compiler.
  • "Compiler Options and Pragmas Quick Reference" provides a quick reference of options and pragmas supported by the Intel® C++ Compiler. The options and pragmas are listed in alphabetical order. For a functional grouping of the options refer to "Compiler Options".
  • "Customizing the Compilation Environment" explains configuration files and response files. It also includes a description of used environment variables and the usage of include files.
  • "Customizing the Compilation Process" describes the compilation process when using the Intel® C++ Compiler. This includes using alternate tools and locations, preprocessing, compiling, linking, and debugging. The chapter contains many examples that underline the explanations.
  • "Compiler Options" describes all supported options in detail. The chapter provides an overview of options sorted with respect to their function. The main part of this chapter describes each option including an example in alphabetical order.
  • "Pragmas" describes all supported pragmas. All the pragmas are Microsoft* compatible. Only syntax, description and a usage example are provided. For detailed information see the Microsoft* documents.
  • "Inline Assembly" describes the inline assembly feature.
  • "Optimizations" contains the description of optimization features of the Intel® C++ Compiler.
  • "Vectorization" contains the description of the vectorizer (i.e. loop optimization).
  • "Language Conformance Options" describes the options controlling the C/C++ language conformance of the Intel® C++ Compiler.
  • "Libraries" contains a description of libraries which could be used to build the applications with the Intel® C++ Compiler. The chapter contains the description of all functions in alphabetical order.
  • "The Intel® Run-time Library" describes the Run-time Library used by the Intel® C++ Compiler.
  • "The Intel® C++ Class Libraries" describes the Intel® C++ Class Libraries used by the Intel® C++ Compiler.
  • "Intrinsic Functions" describes the special coding extensions that allow using the syntax of C function calls and C variables instead of assembler code.
  • "Intel® Wireless MMX™ Technology Intrinsic Support" describes the intrinsic support given for the Intel® Wireless MMX(TM) technology, which includes single instruction multiple data instructions.
  • "Microsoft* Compatibility" describes the compatibility between the Intel® C++ Compiler and the Microsoft* Visual C++* Compiler.
  • "Diagnostics and Messages" describes command line, language diagnostics and all messages that might appear.


Related Documents

This section provides an overview of documents which supplement this manual. These are:

  • Intel® Assembler Reference Manual, order number 278466
  • Intel® Debugging Extensions User's Manual For Platform Builder for Microsoft* Windows* CE .NET, order number 278549
  • Intel® Debugging Extensions User's Manual For Microsoft* eMbedded Visual C++*, order number 278647

Furthermore, Release Notes may be provided. Release Notes contain features or changes of the product that are not documented in the corresponding manual. Release Notes are included in the documentation set of your installation.

There are some other documents which provide related information. These are:

  • ISO/IEC 9989:1990, Programming Languages - C
  • ISO/IEC 14882:1998, Programming Languages - C++
  • The Annotated C++ Reference Manual, 3rd edition, Margaret Ellis, Bjarne Stroustrup. Addison Wesley, 1991
  • The C++ Programming Language, 3rd edition. Addison-Wesley, 1997
  • The C Programming Language, 2nd edition, Brian W. Kernighan, Dennis W. Ritchie. Prentice Hall, 1988
  • C: A Reference Manual, 3rd edition, Samual P. Harbison, Guy L. Steele. Prentice Hall, 1991
  • http://msdn.microsoft.com/library

For environment specifics, see the manuals or on-line help supplied with Microsoft Windows* CE .NET.


System Requirements

To use the Intel® C++ Compiler, the following environment is required:

  • Microsoft Windows* 2000 or Windows* XP as host platform
  • Microsoft Windows* CE 4.x
  • Microsoft* Platform Builder 3.0 or 4.x
  • Microsoft* eMbedded Visual C++* 4.x
  • Intel® C++ Software Development Tool Suite


Compiler Limits

The table below shows the maximum size or number of each item that the Intel® C++ Compiler can process. All capacities shown in the table are tested values; the actual numbers can be greater than the numbers shown.

Table: Compiler Limits
Item | Tested Values
Control structure nesting (block nesting) | 512
Conditional compilation nesting | 512
Declarator modifiers | 512
Parenthesis nesting levels | 512
Significant characters, internal identifier | 2048
External identifier name length | 64K
Number of external identifiers in a single file | 128K
Number of identifiers in a single block | 2048
Number of macros simultaneously defined | 128K
Number of parameters to a function call | 512
Number of parameters per macro | 512
Number of characters in a string | 128K
Bytes in an object | 512K
Include file nesting depth | 512
Case labels in a switch | 32K
Members in one structure or union | 32K
Enumeration constants in one enumeration | 8192
Levels of structure nesting | 320


Notation Conventions

This manual uses several notational and typographical conventions to visually differentiate text. The following table explains these conventions.

Table: Notation Conventions
Convention | Description
Italics | Italics identify variables and introduce new terminology. Titles of manuals are in italic font. Italics are used for emphasis.
Bold | Used to specify something important.
Plain courier | Used to specify written code, options and commands.
Italic courier | Used to specify parameters.
GUI-elements | Elements of the graphical user interface are written in this style.
<> | File names and function names to be defined are delimited by <>.
| | Used to specify an alternative between several items.
,... | Used to specify an item which may be repeated.
[ ] | Used to specify optional items.
{ } | Used to specify an optional item which may be repeated.
"[" "]" "{" "}" "|" | Writing a metacharacter in quotation marks negates the syntactical meaning stated above; the character is taken as a literal. For example, the line "[" X "]" [ Y ] denotes the letter X enclosed in brackets, optionally followed by the letter Y.


General Usage

This chapter contains a description on how to use the Intel® C++ Compiler. The chapter contains the following topics:

  • "Command Line Syntax" describes how the Intel® C++ Compiler is invoked.
  • "Thumb* Mode" describes how to invoke the compiler in Thumb* mode.
  • "Input Files" section provides an overview of input files that are recognized by the Intel® C++ Compiler.
  • "Output Files" summarizes the compiler output files.
  • "Using the Intel® C++ Compiler with the Microsoft Windows Mobile* Adaptation Kit" describes how the Intel® C++ Compiler is used with Microsoft* eMbedded Visual C++* 4.0/Visual Studio* 2005 to develop code for platforms based on Windows Mobile*.
  • "Using the Intel® C++ Compiler with Microsoft Windows* CE .NET" describes how the Intel® C++ Compiler is used with the Microsoft* Platform Builder to develop code for platforms based on for Microsoft Windows* CE .NET.
  • "Default Behavior of the Intel® C++ Compiler" describes all the defaults used by the Intel® C++ Compiler.


Command Line Syntax

The compiler call may contain two types of command line arguments: source file arguments and option arguments. The Intel® C++ Compiler is started using the following command line syntax:

ccxscce {option} sourcefile {sourcefile}

The compiler arguments option and sourcefile must be separated by spaces. The order of the arguments is not mandatory. The following table describes the compiler arguments:

Table: Arguments for the Compiler
Compiler Argument
Description
Example
sourcefile
Indicates an input file to be processed by the compiler.
The following rules apply to input files:
  • You can specify an arbitrary number of input files.
  • If you specify more than one input file, you must separate them with a space.
  • The compiler recognizes input files with the extensions .c, .cc, .cpp, .cxx, .lib, .i, and .s.
For further information on input files refer to the section "Input Files".
ccxscce ..\source\x.c y.cpp z.obj
option
A string of one or more alphanumeric characters preceded by a slash (/).
The following rules apply to compiler options:
  • Options are not required when invoking the compiler. Some options are set by default when you invoke the compiler.
  • You can specify an arbitrary number of options.
  • If you specify more than one option, you must separate each of them using spaces.
  • Option names are case-sensitive.
  • Options specified on the command line apply to all files.
  • Options can take arguments in the form of filenames, strings, letters, or numbers.
  • If a string includes spaces, it must be enclosed in quotation marks.
  • Some compiler options can be turned off when the option is appended with a dash (-).
For further information on compiler options refer to "Option Reference" and "Compiler Options".
ccxscce /c /oout.obj /FAc src.cxx


Thumb* Mode

To invoke the Intel® C++ Compiler in Thumb* mode, use the invocation command ccxsccet instead of ccxscce. In this case, the preprocessor macro __thumb is defined and the default structure alignment is set to 1 byte for Thumb* mode.


Input Files

The Intel® C++ Compiler recognizes files with the extensions listed in the table below:

Table: Input Files
Filename | Description | Action
sourcefile.c | C source file | Processed by the compiler
sourcefile.cc sourcefile.cpp sourcefile.cxx | C++ source file | Processed by the compiler
file.a | object library | Passed to the linker
sourcefile.i | C or C++ source preprocessed and expanded by the C++ preprocessor | Processed by the compiler
sourcefile.asm | assembly file | Passed to the assembler
sourcefile.obj | object file | Passed to the linker

Where only the compilation process takes place, see further information below, then an unrecognized file extension will result in an error message. Should the process go on to call the linking stage then files with unrecognized extensions are passed directly to the linker with no action being taken by the compiler.

See Also

"Options which Interrupt the Compilation Process"


Output Files

During the compilation of the file sourcefile, the Intel® C++ Compiler produces, or indirectly causes the production of, the following output files if the respective options are set:

Table: Output files
Filename | Description | Option
sourcefile.i | Preprocessed C/C++ source file. | /P
sourcefile.obj | COFF object file. The option /c stops the compiling process upon producing the object file and linking is suppressed. The option /Fofilename specifies the alternate name filename for the object file. | /c, /Fofilename
sourcefile.asm | Assembly language output file. The option /S stops the compiling process upon generating the assembly file. | /S
sourcefile.exe | Executable file. The option /Fe[filename] specifies the alternate name filename for the executable file. | /Fe[filename]

See Also


Using the Intel® C++ Compiler with the Microsoft Windows Mobile* Adaptation Kit

This section explains how to use the Intel® C++ Compiler within Microsoft* eMbedded Visual C++* 4.0/Visual Studio* 2005. It tells you how to select the Intel® C++ Compiler, how to change the Intel® C++ Compiler and Intel® Assembler settings and how to switch back to the Microsoft* compiler.


Integrating the Intel® C++ Compiler into the Windows Mobile* 5.0 Adaptation Kit

The Intel® Adaptation Kit Installation Utility performs all modifications required to use the Intel® C++ Compiler with the Windows Mobile* 5.0 Adaptation Kit.

To integrate the Intel® C++ Compiler to the Windows Mobile* 5.0 Adaptation Kit, perform the following steps:

  1. From the Windows* Start menu select

    2. All Programs / Intel(R) Software Development Tools / Intel(R) C++ Compiler Build Support for Adaptation Kit 2.0 / Add Adaptation Kit Integration

  2. Follow the on-screen instructions.

    3. Alternatively, you may execute the program <install-dir>\Pbm50\installcomp.exe, with <install-dir> being the installation directory of the Intel® C++ Compiler.

    The Browse for Folder dialog appears.

  3. Select the root directory of your Windows Mobile* 5.0 Adaptation Kit installation, for example:

    4. c:\wm500

    The Patch Request dialog appears.

  4. Click OK.

    5. The Intel® Adaptation Kit Installation Utility performs the following steps:

  • It copies the Intel® C++ Compiler into the Windows Mobile* 5.0 Adaptation Kit.
  • It modifies the Adaptation Kit and the makefile.def for usage with the Intel® C++ Compiler. The original makefile.def is renamed to makefile.def.old and saved in the directory <AdaptationKitRoot>\public\common\oak\misc.


Using the Intel® C++ Compiler Selection Tool

After integrating the Intel® C++ Compiler into the Windows Mobile* 5.0 Adaptation Kit, it is possible to switch between the Microsoft* and the Intel® C++ Compiler with the Intel® C++ Compiler Selection Tool. Use the Intel® C++ Compiler Selection Tool on the command line as follows:

  1. From the Windows* Start menu select

    2. All Programs / Intel(R) Software Development Tools / Intel(R) C++ Compiler Build Support for Adaptation Kit 2.0 / Select Adaptation Kit compiler.

    The Selection Tool dialog is opened.

  2. Check the box labeled Intel® C++ Compiler in the Compiler Selection frame.

    3. When this box is checked, the Intel® C++ Compiler will be used. Otherwise the Selection Tool defaults to the Microsoft* compiler.

  3. Click the OK button.

    4. The Intel® C++ Compiler is now enabled and can be instantly used.


Selecting the Compiler on the Command Line

You can also select the compiler using the Windows* Command Prompt.

  1. Open a Command Prompt.
  2. Go to the root directory of your Windows Mobile* 5.0 Adaptation Kit installation.
  3. Type the following command line:

    4. selectcomp <option>

    where <option> is one of the following:

    -I
      select the Intel® C++ Compiler
    -M
      deselect the Intel® C++ Compiler, that is, select the Microsoft* Compiler
    -V
      show Copyright and Version of the Compiler Selection Tool

If you call selectcomp without an option, the Selection Tool dialog appears as described in "Using the Intel® C++ Compiler Selection Tool".


Building the Platform with the Intel® C++ Compiler

There is no change in the build procedure. You only need to select the Intel® C++ Compiler with the Intel® C++ Compiler Selection Tool and follow the standard build process using the New Build Window Wizard which creates the build batch scripts.


Changing Code Optimization Options for the Intel® C++ Compiler

To obtain the best performance for a Windows Mobile* platform running on Intel® PCA targets, set the appropriate optimization options of the Intel® C++ Compiler as described below.

The Intel® C++ Compiler and Intel® Assembler options are defined in the file <AdaptationKitRoot>\public\COMMON\oak\misc\Makefile.def
where <AdaptationKitRoot> is the root directory of your Windows Mobile* 5.0 Adaptation Kit installation.

The Intel® C++ Compiler options are set by customizing the CDEBUG_FLAGS variable. Depending on the build mode you have to add or remove the options in the corresponding sections as follows:

  1. Search for the following section:

    2. !IF ("$(WINCEDEBUG_COMPILE)" == "retail")
    ! IFDEF DISABLE_OPTIMIZER

  2. For release builds with optimization switched off, add or remove the compiler options to or from the CDEBUG_FLAGS variable in the following section:

    3. CDEBUG_FLAGS=-Od
    ! ELSE
    CDEBUG_DEFINES=

  3. For release builds with optimization switched on, add or remove the compiler options to or from the CDEBUG_FLAGS variable in the following section:

    4. CDEBUG_FLAGS=-Ox $(OPTIMIZE_FAVOR_FLAG)
    ! ENDIF
    !ELSE
    CDEBUG_DEFINES=-DDEBUG=1
    ! IF "$(_TGTOS)" == "NT" || "$(_TGTOS)" == "NTANSI"
    CDEBUG_DEFINES=$(CDEBUG_DEFINES) -D_DEBUG=1
    ! ENDIF

  4. For debug builds, add or remove the compiler options to or from the CDEBUG_FLAGS variable in the following section:

    5. CDEBUG_FLAGS=-Od
    !ENDIF

Example: CDEBUG_FLAGS
  • Sample setting for a "retail" build with Intel® C++ Compiler options /QTPxsc3 (for Intel® PXA27x applications processor family support) and /O3 (full optimization) set:

    • !IF ("$(WINCEDEBUG_COMPILE)" == "retail")
    ! IFDEF DISABLE_OPTIMIZER
    CDEBUG_FLAGS=/Od
    ! ELSE
    CDEBUG_DEFINES=
    CDEBUG_FLAGS=/O3 /QTPxsc3 $(OPTIMIZE_FAVOR_FLAG)
    ! ENDIF
    !ELSE
    .....

  • Sample setting for a "debug" build with optimizations switched off and Intel® C++ Compiler option /QTPxsc3 (for Intel® PXA27x applications processor family support) set:

    • .......
    CDEBUG_DEFINES=/DDEBUG=1
    ! IF "$(_TGTOS)" == "NT" || "$(_TGTOS)" == "NTANSI"
    CDEBUG_DEFINES=$(CDEBUG_DEFINES) /D_DEBUG=1
    ! ENDIF
    CDEBUG_FLAGS=/Od /QTPxsc3
    !ENDIF

For building assembly sources, set the Intel® Assembler options as follows:

  1. Search for the following line:

    2. ASSEMBLER=asxscce -coff -mcpu 3 -debug

  2. Add or remove Intel® Assembler options as required on this line.

See Table "Optimization, Debugging, and Target CPU Options of the Intel® C++ Compiler" and Table "Various Options of the Intel® Assembler" for available optimization-related compiler and assembler options.

Table: Optimization, Debugging, and Target CPU Options of the Intel® C++ Compiler
Option | Description | Default
/O1 | Optimize for speed, but disable some optimizations that increase code size for small speed benefit. | OFF
/O2 | Optimize for speed. | ON (OFF if /Zi is set)
/O3 | Enable high-level optimization. | OFF
/Od | Disable optimizations. | OFF (ON if /Zi is set)
/QTPxsc1 | Optimization support for the Intel® 80200 processor. | ON
/QTPxsc2 | Optimization support for the Intel® PXA25x/PXA26x processors. | OFF
/QTPxsc3 | Optimization support for the Intel® PXA25x/PXA26x/PXA27x processors including Intel® Wireless MMX™ technology; this option also switches on the vectorizer. | OFF
/Zd | Generate line number information in the object file (for debugging). | OFF
/Zi[-] | Generate symbolic debugging information in the object code for use by source-level debuggers. | OFF

Table: Various Options of the Intel® Assembler
Option | Description | Default
/COFF | Generate COFF object format. | OFF
/debug | Generate COFF/CV4 debug information within the object file. | OFF
/g | Generate COFF/CV4 debug information within the object file. | OFF
/mcpu 1 | Generate code for the Intel® 80200 processors. | ON
/mcpu 2 | Generate code for the Intel® PXA25x/PXA26x processors. | OFF
/mcpu 3 | Generate code for the Intel® PXA25x/PXA26x/PXA27x processors including Intel® Wireless MMX™ technology. | OFF

For more information on the optimization options, refer to the Intel® C++ Compiler Online Help and the Intel® Assembler Online Help.


Using the Intel® C++ Compiler with Microsoft Windows* CE .NET

This section explains how to use the Intel® C++ Compiler within the Platform Builder for Microsoft Windows* CE .NET, eMbedded Visual C++* or Visual Studio*. It tells you how to select the Intel® C++ Compiler, how to change the Intel® C++ Compiler settings and how to switch back to the default compiler. It also explains how to use the Intel® C++ Compiler in makefiles and how to use the Intel® C++ Compiler in batch mode.


Selecting the Intel® C++ Compiler

To use the Intel® C++ Compiler with Microsoft Windows* CE .NET, eMbedded Visual C++* or Visual Studio*, perform the following steps:

  1. Select Tools / Select Compiler in the Platform Builder.

    2. The Selection Tool dialog pops up.

  2. Checkmark the box labeled Intel® C/C++ Compiler in the Intel XScale(R) Technology Compiler Selection frame.

    3. If the box is not checked, the Selection Tool defaults to the Microsoft* compiler.

    Note icon NOTE.
    You can get the Intel® C++ Compiler on-line help by clicking the Help button.

  3. Select a compiler version in the Version pull-down menu.
  4. Click the OK button.

    5. The Intel® C++ Compiler is now enabled. Whenever you build a project, the Platform Builder uses the Intel® C++ Compiler and the Microsoft* linker. All Microsoft* libraries are available. The Intel® Run-time Library is linked automatically to the project.

    Note icon NOTE.
    Your compiler selection is stored in the registry so that the enabled compiler remains enabled in further sessions until you disable it explicitly.

See Also

"Disabling the Intel® C++ Compiler Integration"


Building Your Application with Microsoft Windows* CE .NET

The following build methods are available to the Intel® C++ Compiler in Microsoft Windows* CE .NET:

  • To build an entire project, select Rebuild All from the Build menu.
  • To build only the out-of-date modules of a project, select Build / Build.
  • To compile a single file only, select this file in the File view of the Project Workspace and then select Build / Compile.


Disabling the Intel® C++ Compiler Integration

To disable the Intel® C++ Compiler, perform the following steps:

  1. Select Tools / Select Compiler in the Platform Builder.

    2. The Selection Tool dialog pops up.

  2. Remove the checkmark of the box labeled Intel® C/C++ Compiler in the Intel XScale(R) Technology Compiler Selection field.
  3. Click the OK button.

    4. The Intel® C++ Compiler is now disabled. The default tool is the Microsoft* compiler.

See Also

"Selecting the Intel® C++ Compiler"


Building after Uninstalling the Intel® C++ Compiler

If you uninstall the Intel® C++ Compiler, the Platform Builder switches back to its default compiler automatically. No further action is required from you.

Since the settings of the Intel® C++ Compiler are compatible to the Microsoft* compiler, you can build your application using either compiler. You do not need to change anything in your settings.


Specifying the Intel® C++ Compiler Settings

To specify the settings of the Intel® C++ Compiler, perform the following steps:

  1. Select the menu item Tools / Intel C++ Compiler Options.

    2. The Intel(R) C/C++ Compiler Options dialog pops up.

    This dialog enables you to set the most common options with a few mouse clicks. All other options can be written into the Additional Intel(R) C++ Compiler specific Options field.

  2. Set the options which are appropriate for your project.
    Note icon NOTE.
    To get information on the options, select the Platform Builder menu item Tools / Intel Help.
  3. Click the OK button.

    4. Whenever the Intel® C++ Compiler is called, it will run with the options specified in the Intel(R) C/C++ Compiler Options dialog.

See Also

"Compiler Options"


Selecting the Intel® C++ Compiler Using Makefiles

The Intel® C++ Compiler uses the same command line syntax and makefiles environment as the Microsoft* compiler. Therefore, you just have to change the filename of the compiler executable in the makefiles.


Default Behavior of the Intel® C++ Compiler

This section provides an overview of the default behavior of the Intel® C++ Compiler.


General Default Behavior

If you do not specify any options on the command line when you invoke the Intel® C++ Compiler, the compiler behaves as follows:

  • The compiler invokes default settings of all its options and sets any options specified in any configuration file. See "Configuration Files".
  • The compiler searches for any "include" files.
  • The compiler processes the source file(s) according to the filename extension (see "Input Files").
  • The compiler uses ANSI with extensions (/Ze) for C/C++ source files.
  • The compiler performs standard optimizations using the default /O2 option.
  • The compiler displays error and warning messages.
  • The compiler produces an executable file as output.
    Note icon NOTE.
    If the compiler does not recognize any options, that option is ignored and a warning is displayed. See "Diagnostics and Messages" for detailed descriptions about system messages.


Default Options

For all options set by default, please refer to Table "Option Reference".


Default Libraries and Tools

This section provides an overview of libraries and tools that are used by default.

Table: Default Libraries and Tools
Library or Tool | Default | Provided with the Intel® C++ Compiler?
Assembler | Intel® Assembler. By default, the compiler calls automatically the Intel® Assembler to generate the object file. | Yes
Linker | Microsoft* Linker. The linker produces an executable file from the object files. The linker searches the path specified in the environment variable LIB to find any library files provided with the Intel® C++ Compiler. | No
Run-Time Library | Intel® C Run-Time Library | Yes
C/C++ Library | Microsoft* Libraries | No


Compilation Phases

To produce an executable file, the compiler performs the compile and link phases of compilation. The compiler also determines which compilation phases to perform based on the filename extension of the input file(s) and on the compilation options specified in the command line.

Table: Compilation Phases
Phase | Tool
Preprocessing (optional) | Intel® C++ Compiler
Compiling | Intel® C++ Compiler
Assembling | Intel® Assembler
Linking | Microsoft* Linker

The compiler passes object files and any unrecognized files to the linker. The linker then determines whether the file is an object file (.obj) or a library (.lib). The compiler handles all types of input files correctly; thus it can be used to invoke any phase of compilation.


Application Development Cycle

The compiler processes C and C++ language source files. You decide the input and output by setting options when you run the compiler. Figure "Compilation Process" illustrates how the compiler fits into the application development cycle.

Figure: Compilation Process


Compiler Options and Pragmas Quick Reference

This chapter provides a quick overview of all supported options and pragmas of the Intel® C++ Compiler.

The chapter comprises the following sections:

  • "Option Reference" lists the options in alphabetical order.
  • "Pragma Reference" lists the pragmas in alphabetical order.


Option Reference

This section provides a short reference of the options which are recognized by the Intel® C++ Compiler. All options are sorted in alphabetical order followed by a short description and the default. A detailed description of the most important options is provided in "Compiler Options".

Table: Option Reference
Option
Description
Default
/?
Displays compiler options summary. See also "/?".
OFF
/ARMasm
If the source file is an assembler file, it is interpreted as pure ARM* syntax. See also "ARMasm".
OFF
/Bafilename
Used to specify the directory and filename of an alternative assembler which is to be invoked from the compiler. By default this is set to be the standard assembler within the Intel® C++ Software Development Tool Suite. See also "/Ba".
ON
/Bd
The option /Bd outputs to the standard output "stdout" all the command line calls and options before execution. See also "/Bd".
OFF
/Bl
Used to specify the directory and filename of an alternative linker which is to be invoked from the compiler. By default this is set to be the standard linker within the Intel C++ Software Development Tool Suite. See also "/Bl".
ON
/Bz
Outputs all the command line calls and options including those set within the configuration file, only. Does not continue with the compilation process. See also "/Bz".
OFF
/c
Stops the compilation process after an object file has been generated. See also "/c".
ON
/C
Places comments in preprocessed source output. See also "/C".
OFF
/Dname[=value]
/Dname[#value]
Defines a macro name and, optionally, associates it with the specified value. See also "/D".
n/a
/E
Stops the compilation process after the C or C++ source files have been preprocessed, and writes the results to stdout. See also "/E".
OFF
/EHa
Enable asynchronous C++ exception handling.
See also "/EHa".
OFF
/EHc
Assume external "C" functions do not throw exceptions.
See also "/EHc".
OFF
/EHs
Enable synchronous C++ exception handling.
See also "/EHs".
OFF
/EP
Stops the compilation process after the C or C++ source files have been preprocessed and writes the results to stdout. The #line directives are stripped (that is, not included in the output). Use /EP /P to preprocess to a file, omitting #line directives. See also "/EP".
OFF
/Fa[filename]
Produces an assembly file with the specified name filename. See also "/Fa".
OFF
/FD
Generates file dependencies. See also "/FD".
OFF
/Fe[filename]
Produces an executable output file with the specified filename (or the default name a.out). Use this option to specify a filename other than that of the first source or object file on the command line. See also "/Fe".
OFF
/FI{filenames}
Instructs the preprocessor to include the filenames specified as header files. See also "/FI".
OFF
/Fo[filename]
Specifies the name to be given to the object file. Only valid where a single source file occurs in the command line. See also "/Fo".
ON
/Fp[filename]
Provides an alternate filename for precompiled header files. See also "/Fp".
OFF
/FR[filename]
Produces a browser file with complete symbolic information. See also "/FR".
OFF
/GR[-]
Enables [disables] C++ Run-Time Type Information (RTTI). See also "/GR".
OFF
/GX
Enables C++ exception handling. See also "/GX".
OFF
/Gy
Packages functions to enable linker optimization.
See also "/Gy".
ON
/H
Defines the number of significant characters for public identifiers. See also "/H".
OFF
/HELP
Displays compiler options summary. See also "/HELP".
OFF
/help
Displays compiler options summary. See also "/help".
OFF
/Idirectory
Specifies an additional directory to search for include files. See also "/I".
OFF
/J
Sets the default for char types to unsigned. See also "/J".
OFF
/MX
Generates a file dependency file, including system files.
See also "/MX".
OFF
/MXA
Generates a file dependency file, without system files.
See also "/MXA".
OFF
/noBool
Switch off data type bool. See also "/noBool".
OFF
/nologo
Do not display compiler version information. See also "/nologo".
OFF
/O1
Optimizes for speed, but disables some optimizations that increase code size for small speed benefit. See also "/O".
OFF
/O2
Optimizes for speed. See also "/O".
ON
/O3
Enables high-level optimization. See also "/O".
OFF
/Oa[-]
Assume [not assume] no aliasing. See also "/Oa".
OFF
/Obnum
Controls the compiler's inline expansion. The amount of inline expansion performed varies with the value of num as follows:
0: Disables inlining.
1: Enables inlining of functions declared with the __inline keyword. Also enables inlining according to the C++ language.
2: Enables inlining of any function.
However, the compiler decides which functions to inline. Enables interprocedural optimizations and has the same effect as /Qip. See also "/Ob".
/Ob1
/Od
Disables optimizations. See also "/Od".
OFF
/Og
Enables global optimizations. See also "/Og".
ON
/Oi[-]
Enables [disables] inline expansion of standard library functions. See also "/Oi".
ON
/Op[-]
Enables [disables] conformance to the ANSI C and IEEE 754 standards for floating point arithmetic. See also "/Op".
OFF
/Os
Enables speed optimizations that do not increase code size. See also "/Os".
OFF
/Ot
Enables all speed optimizations. See also "/Ot".
OFF
/Ow[-]
Assumes no cross-function aliasing. See also "/Ow".
OFF
/Ox
Enables maximum speed optimizations. See also "/Ox".
OFF
/P
Stops the compilation process after C or C++ source files have been preprocessed and writes the results to files named according to the compiler's default file-naming conventions. See also "/P".
OFF
/Q_os_[name]
Specifies the operating system. See also "/Q_os_".
OFF
/QA[-]
Enables all predefined macros and assertions. See also "/QA".
ON
/QAname [value]
Defines an assertion with the specified predicate name and value. See also "/QAname".
OFF
/Qansi[-]
Assumes conformance to the ANSI standard for C++. See also "/Qansi".
OFF
/Qexpand_env[text]
Expands environment variables in the given text text and processes the resulting text as command line options or file specifications. See also "/Qexpand_env"
OFF
/QH
Outputs list of include files in the order in which they occur, then stops the compilation process. See also "/QH".
OFF
/Qip
Enables interprocedural optimizations for single file compilation. See also "/Qip".
OFF
/Qip_no_inlining
Disables some inlining that would be assumed using group optimization options such as /Ob2 and /Qip. See also "/Qip_no_inlining".
OFF
/Qipo
Enables multifile interprocedural optimizations over entire program. See also "/Qipo".
OFF
/Qipo_c
Generates a multifile object file from the given source files. See also "/Qipo_c".
OFF
/Qipo_obj
Forces the compiler to create real object files when used with /Qipo. See also "/Qipo_obj".
OFF
/Qipo_S
Generates a multifile assembly file from the given source files. See also "/Qipo_S".
OFF
/Qlocation,tool,path
Specifies alternative directory and filenames for the assembler and linker components to be invoked from the compiler. See also "/Qlocation".
OFF
/QM
Generate lines of Makefile dependency information onto its standard output. See also "/QM".
OFF
/Qnobss_init
Places variables initialized with 0 into DATA section within the assembly code. See also "/Qnobss_init".
OFF
/Qoption,tool,optlist
Passes an option list to another tool in the compilation chain. See also "/Qoption".
OFF
/Qprec
Improves floating point precision. See also "/Qprec_div"
OFF
/Qprec_div
Disables the floating point division-to-multiplication optimization. See also "/Qprec_div".
OFF
/QRinterwork-return
Specifies that mixed ARM* and Thumb* functions are to be used. See also "/QRinterwork-return".
ON
/QRthumb
Specifies that Thumb* instructions are generated.
See also "/QRthumb".
OFF
/QRxscale
Specifies that the application is to be run on the Intel XScale® technology. See also "/QRxscale".
ON
/Qsox
Adds settings of the compiler options and its version number into the executable file. See also "/Qsox".
OFF
/QTP[target]
Specifies the target processor for the compilation. See also "/QTP".
xsc1
/Qunroll[n]
Specifies the maximum number of times to unroll a loop. Use n = 0 to disable unrolling. If n is not specified, the compiler automatically chooses the maximum number of times to unroll a loop. See also "/Qunroll".
ON
/Qvec[-]
Switches on (off) the vectorizer.
See also "/Qvec".
ON
/Qwdnum{,num}
Disables the specified warnings and remarks. See also "/Qwd".
OFF
/Qwenum{,num}
Changes the specified warnings and remarks to errors. See also "/Qwe".
OFF
/Qwnnum
Limits the number of errors displayed prior to aborting compilation. See also "/Qwn".
100
/Qwrnum{,num}
Changes the specified warnings to remarks. See also "/Qwr".
OFF
/Qwwnum{,num}
Changes the specified remarks to warnings. See also "/Qww".
OFF
/S
Generates assembly files with "asm" extension. See also "/S".
OFF
/TC
Compiles all source or unrecognized file types as C source files. See also "/TC".
OFF
/Tcfilename
Treats filename as a C source file. See also "/Tc".
OFF
/TP
Compiles all source or unrecognized file types as C++ source files. See also "/TP".
OFF
/Tpfilename
Treats filename as a C++ source file. See also "/Tp".
OFF
/u
Disables all predefined macros (other than those starting with "__") and assertions. See also "/u".
OFF
/Uname
Suppresses any definition of a macro name. See also "/U".
n/a
/Vstring
Embeds version string in executable. See also "/V".
OFF
/w
Disables all warnings. "/w".
OFF
/W0
Displays only errors. See also "/W".
OFF
/W1,/W2,/W3
Specifies that error and warning messages are to be displayed. See also "/W".
ON
/W4
Specifies that error, warning, and remark messages are to be displayed. See also "/W".
OFF
/WX
Changes all warnings to errors. See also "/WX"
OFF
/X
Removes the standard directories from the list of directories to be searched for include files. See also "/X".
OFF
/Yc[hfile]
Creates a precompiled header file. See also "/Yc".
OFF
/Yu[hfile]
Uses a precompiled header file. See also "/Yu".
OFF
/YX
Enables automatic precompiled header file creation and usage. See also "/YX".
OFF
/Za
Enforces strict conformance to the ANSI standard for C. See also "/Za".
OFF
/Zd
Adds line number information in the object file (for debugging). See also "/Zd".
OFF
/Zg
Instructs the compiler to output the list of function prototypes for all the functions found within the source files to be compiled. See also "/Zg".
OFF
/ZI[-]
Generates symbolic debugging information in the object code for use by source-level debuggers. Identical to option /Zi. See also "/ZI".
OFF
/Zi[-]
Generates symbolic debugging information in the object code for use by source-level debuggers. See also "/Zi".
OFF
/Zp[num]
Specifies alignment of structure members. See also "/Zp".
8
/Zs
Checks the syntax of a program and stops the compilation process after the source files have been parsed. Generates no code and produces no output files. Warnings and messages appear on stderr. See also "/Zs".
OFF

See Also

"Compiler Options"


Pragma Reference

Some options may be passed as pragma directives to the Intel® C++ Compiler. Pragma directives look like C/C++ preprocessor directive lines. They must be contained in the source file or in an include file. Hence, pragmas are very closely connected to the source. They should be used if a correct compilation of the source depends on the pragma.

The following table provides an overview of Microsoft* compatible pragmas that are supported with the Intel® C++ Compiler.

Table: Overview of Microsoft* Compatible Pragmas
Pragma | Description
#pragma alloc_text | Specifies a text section where function definitions are located.
#pragma bss_seg | Specifies a default section for uninitialized data.
#pragma code_seg | Specifies a default code section for functions.
#pragma comment | Puts a comment into an object file or executable file.
#pragma component | Specifies the collecting of browse information.
#pragma const_seg | Specifies a default section for constant data.
#pragma data_seg | Specifies a default section for initialized and uninitialized data.
#pragma function | Generates calls to the functions listed in the argument list.
#pragma hdrstop | Saves the compilation status up to the location of the pragma.
#pragma include_alias | Enabled to use a short filename instead of a long filename.
#pragma intrinsic | Generates calls to functions listed in the argument list.
#pragma message | Sends a literal string to the standard output at compile time.
#pragma optimize | Specifies compiler optimizations.
#pragma pack | Specifies packing alignment for structure and union members.
#pragma warning | Controls the behavior of warning messages.


Customizing the Compilation Environment

The Intel® C++ Compiler allows you customize the environment used during compilation. This chapter includes the following:

  • "Configuration Files" describes the files for storing frequently used option sets.
  • "Environment Variables" describes each environment variable which is used by the compiler.
  • "Response Files" describes how Response files could be used for storing specific options for various projects.
  • "Include Files" describes the path and options to use for Include Files.


Configuration Files

The configuration files contain important settings of the Intel® C++ Compiler. The configuration files are read every time you run the compiler.

Warning icon WARNING.
It is strongly recommend not to modify the supplied configuration files of the Intel® C++ Compiler. If you have varying option requirements for different projects, use response files to store these option settings (see "Response Files").

The configuration files provided with the Intel® C++ Compiler for Microsoft* Windows* CE are as follows:

  • ccxscce.cfg
  • ccxsccet.cfg

These files are located in the directory <installation-directory>\WINCE410\SDK\BIN\I386.


Environment Variables

You can customize your environment by specifying paths where the compiler can search for special files such as libraries, include files, and configuration files. This can be done by setting specific environment variables. Environment variables are variables of the shell/command interpreter from which the Intel® C++ Compiler is called.

The following table provides an overview of the environment variables used by the Intel® C++ Compiler.

Table: Environment Variables
Environment Variable | Description
INCLUDE | Specifies the directory search path for the include files.
LIB | Specifies the directory search path for the libraries.
PATH | Specifies the directory search path for the compiler itself.
TMP | Specifies the directory for temporary file storage. If the directory specified by TMP does not exist, the compiler places the temporary files in the current directory.


Setting Environment Variables in the Command Line

To set environment variables, enter the command set on the command line followed by the variable and the path, for example:

set Path=c:\installation-directory\bin


Setting Environment Variables in Windows* 2000

To set and view environment variables on Windows* 2000, perform the following steps:

  1. Select Settings from the Windows* Start menu.
  2. Select Control Panel.

    3. The Control Panel is opened.

  3. Double-click System.

    4. The System Properties dialog is opened.

  4. Select the Advanced tab.
  5. Click the Environment Variables button.

    6. Now you can view and alter the environment variables.


Setting Environment Variables on Windows* XP

To set and view environment variables on Windows* XP, perform the following steps:

  1. Select Control Panel from the Windows* Start menu.

    2. The Control Panel is opened.

  2. Double-click System.

    3. The System Properties dialog is opened.

  3. Select the Advanced tab.
  4. Click the Environment Variables button.

    5. Now you can view and alter the environment variables.


Response Files

Response files contain often-used command line options. This is useful to decrease the time for entering command line options and to ensure consistency of options.

The following rules apply to response files:

  • You may write any valid command line option into a response file.
  • You may also add comments to the response file. A line preceded by a pound (#) character is recognized as a comment.
  • To use a response file, the compiler option @filename must be specified when invoking the compiler.
  • You may use an unlimited number of response files, each filename of which must be preceded by an @.

When the compiler is run, it first replaces the response files with their contents. Then, the compiler processes the options in the order of appearance on the altered command line.

The following example illustrates the usage of a response file.

Example

The following command lines have the same effect:

ccxscce /Imylibs /Zi hello.c

and one using a response file:

ccxscce @myresponsefile hello.c

where the response file myresponsefile has the following contents:

#Creating debug information
/Zi

#Adding include directory
/Imylibs
See Also

"Option Reference"


Include Files

You can indicate the location of include files in the configuration file.


Specifying an Include Directory

Use the /Idirectory option to specify an additional directory in which to search for include files. For multiple search directories, multiple /Idirectory commands must be used.

For information on how the compiler handles file inclusion, please refer to "Searching for Include Files".


Preventing Search in Default Path

You can use the /X option with the /I option to prevent the compiler from searching the default path for include files and direct it to use an alternate path.

Example

To direct the compiler to search the path \alt\include instead of the default path, do the following:

ccxscce /X /I\alt\include newmain.cpp


Customizing the Compilation Process

This chapter describes how to customize the environment during compilation. The chapter comprises the following sections:

  • "Preprocessing" describes how you can customize the preprocessing phase. You might set up comments in preprocessed files, stop compilation after preprocessing, set specific include paths, or specify macros for preprocessing.
  • "Compiling" describes the Intel® C++ Compiler options that determine the compilation process and its output. The chapter contains examples demonstrating how you control compilation, monitor data settings, specify compilation output, and use the Intel® Assembler for code generation.
  • "Linking" describes how you can customize the linking process. Note that the Microsoft* Linker is used for linking.
  • "Debugging" describes how you can customize your environment for debugging. This includes symbolic debugging as well as symbolic debugging in conjunction with optimization.


Preprocessing

The Intel® C++ Compiler provides several options to customize the preprocessing. You can define:

  • Comments in preprocessed files
  • Stop of compilation process after preprocessing
  • Specific include paths
  • Macros to be used during preprocessing

The table below lists all available options with respect to preprocessing. For a detailed description of each option, refer to "Compiler Options".

Table: Options with Respect to Preprocessing
Option | Description
/C | Preserves the comments in preprocessed source output.
/Dname[=value] | Defines a macro name and associates it, optionally, with the specified value.
/E | Stops the compilation process after the C or C++ source files have been preprocessed, and writes the results to stdout.
/EP | Stops the compilation process after the C or C++ source files have been preprocessed and writes the results to stdout. The #line directives are stripped (that is, not included into the output). Use /EP /P to preprocess to a file, omitting #line directives.
/Idirectory | Specifies an additional directory to search for include files.
/P | Stops the compilation process after C or C++ source files have been preprocessed and writes the results to files named according to the compiler's default file-naming conventions.
/Uname | Suppresses any previous definition of a macro name.
/u | Disables all predefined macros (other than those starting with __ ) and assertions. See also "/u".


Preprocessing only

Both options /E and /P cause the Intel® C++ Compiler to stop after the preprocessing phase. When you specify the /E option, the compiler's preprocessor expands your source module and writes the result to standard output. The preprocessed source contains #line directives, which the compiler uses to determine the source file name and line number during its next pass. For example, to preprocess two source files and write them to stdout, enter the following command:

ccxscce /E prog1.cpp prog2.cpp

When you specify the /P option, the preprocessor expands your source module and stores the result in a file in the current directory. The preprocessor uses the name of each source file with the .i extension (unless the output name is changed by the option /Fo). For example, the following command creates two files named prog1.i and prog2.i, which you can use as input to another compilation:

ccxscce /P prog1.cpp prog2.cpp
Warning icon WARNING.
When you use the /P option, any existing files with the same name and extension are overwritten.

The /EP option can be used in combination with /E or /P. It directs the preprocessor to not include #line directives in the output. Specifying /EP alone is the same as specifying /E /EP.

The option /C preserves comments in the preprocessed source output. This option is useful only in connection with the option /E, /P, or /EP.


Searching for Include Files

Include files can be specified in the source file using the #include preprocessor directive in one of the two following ways:

  • #include "filename"
  • #include <filename>

The compiler searches directories for include files in the following order:

For "filename" (implicit):

  1. The compiler searches for the include files in the source file directory.
  2. The compiler searches the include files in all directories defined with the option /Idirectory. For multiple search directories, multiple /Idirectory commands must be used. Directories will be searched in the order given on the command line.
  3. The compiler searches the include files in the compiler default include directory specified in the configuration file.

For <filename> (explicit):

  1. The compiler searches for the include files in all directories defined with the option /Idirectory. For multiple search directories, multiple /Idirectory commands must be used. Directories will be searched in the order given on the command line.
  2. The compiler searches the include files in the compiler default include directory specified in the configuration file.

If you wish to change the standard directory to be searched for included files to another directory, use the following command line example:

Example
ccxscce /Ic:\incfiles /Ic:\alternative /X src\alpha.cpp

The C++ source file alpha.cpp is being compiled. Any include files specified within the source file are searched in the following order:

  1. The source file directory src
  2. The first directory specified by the /I option c:\incfiles
  3. The second directory specified by the /I option c:\alternative

The default directory which is normally searched last for included files is ignored due to the use of the /X option.


Defining Macros

The Intel® C++ Compiler provides options to define macros as well as to disable previously defined macros. Table "Predefined Macros" lists all available options with respect to macro definition. For a detailed description of each option, refer to "Compiler Options".

Table: Defining Macros
Option | Description
/Dname[=value] | Defines a macro name and associates it with the specified value.
/Uname | Suppresses any definition of a macro name.
/u | Disables all predefined macros (other than those starting with __ ) and assertions.

The /Dname=[value] option defines the assertion and macro names to be used during preprocessing. This option has the same functionality as the #define preprocessor directive at the beginning of the source file. If you do not enter a value, name is set to 1. value should be enclosed in quotes if it contains spaces or special characters. Preprocessing replaces every occurrence of name with the specified value. For example, to define a macro called SIZE with the value 100, use the following command:

ccxscce /DSIZE=100 prog1.c

Suppose the program contains the declaration

float vector(SIZE);

Before the code is sent to the compiler, the value 100 replaces SIZE in this declaration, and in every other occurrence of the name SIZE.

The /Uname option suppresses any macro definition currently in effect for the specified name. The /U option performs the same function as an #undef preprocessor directive. For example, to suppress a macro called SIZE that was defined earlier, use the following command:

ccxscce /DSIZE=100 @optfile /USIZE prog1.c

The macro SIZE is defined to 100 while the response file optfile is being processed, but it is undefined while the source file prog1.c is being processed.

The /u option disables almost all of predefined macros listed in Table "Predefined Macros".

All predefined macros are listed in Table "Predefined Macros". The Default column describes whether the macro is enabled (ON) or disabled (OFF) by default, plus a default value where applicable. The Disable column lists the option which disables the macro.

Table: Predefined Macros
Macro Name | Default | Disable | Description / When Used
_CHAR_UNSIGNED | OFF | /u | Makes the default character type unsigned. This macro is enabled if you specify the /J option.
__cplusplus | ON/OFF |  | Defined when compiling C++ source.
_CPPRTTI | OFF | /u | Enables Run-Time Type Information. This macro is enabled when you specify /GR.
__EDG__ | 1 |  | Defined to have the value of 1.
_MT | OFF | /u | Defined when using the C version of the multithread run-time library.
__INTEL_COMPILER | version |  | Defines the compiler version. Defined as, e.g., 600 for the Intel C/C++ Compiler 6.0. Always defined.
_WCHAR_T_DEFINED | OFF | /u | This macro is defined whenever the wchar_t type is defined. This could be as a result of a definition in the compiled source.


Compiling

This section describes the Intel® C++ Compiler options that control the compilation process and its output. By default, the compiler converts source code to an object file. Appropriate options enable you to control the process and obtain the desired output file produced by the compiler.

Having control of the compilation process means, for example, that you can create an output file at any of the compilation phases with the /c, /E or /S options. Furthermore, you can rename the output file with a command line option or designate a set of options that are passed to the linker. If you specify a phase-limiting option, the compiler produces a separate output file representing the output of the last phase that completes for each primary input file.

The options in this section provide you with the following capabilities:

  • Controlling compilation
  • Specifying compilation output
  • Using the Intel® Assembler for code generation
See Also


Controlling Compilation

When the compiler is called, it reads the configuration file ccxscce.cfg by default. This configuration file is located in the same directory as the compiler's executable file. The configuration file contains important option settings that should not be changed.

Figure "Compilation Process" shows the role of the Intel® C++ Compiler in the compilation process within Microsoft Windows* CE .NET:

Figure: Compilation Process

By default, the command ccxscce automatically calls the Intel® C++ Compiler, the Intel® Assembler and the Microsoft* Linker. First, the Intel® C++ Compiler processes the source file. Next, the Intel® Assembler is called to generate the object file with the extension .obj. The object format of this file is COFF (Common Object File Format). If the object file contains debug information, one or more sections are added to the object file containing the debugging information in CODEVIEW5 format. Then the Microsoft* Linker is called, linking the object file with library files. The Microsoft* Linker produces a PDB 7 file.


Stop Compilation or Link Additional Files

You can control which compilation phases you need to include in the compilation process.

  • The /c option directs the compiler to compile, assemble and generate object file(s), but do not link.

    • ccxscce /c testing.c


Specifying Compilation Output

You can customize the compilation output depending on options you set or you do not set. The following options are available:

Table: Option Reference
Option | Description | Default
/Fe[filename] | Produces an executable output file with the specified filename or the default name a.out if the filename is not specified. Use this option to specify filename other than that of the first source or object file in the command line. See also "/Fe". | OFF
/Fo[filename] | Specifies the name to be given to the object file. Only valid where a single source file occurs in the command line. See also "/Fo". | ON
/TC | Compiles all source file extensions as C source files. See also "/TC". | OFF
/TP | Compiles all source file extensions as C++ source files. See also "/TP". | OFF
/Za | Enforces strict conformance to the ANSI Standard for C. See also "/Za". | OFF
/Zg | Instructs the compiler to put out the list of function prototypes for all the functions found within the source files to be compiled. See also "/Zg". | OFF

See Also


Default Output Files

The default command line does not include any options and has a C or C++ source file as its input argument:

ccxscce x.c

You can compile more than one input file:

ccxscce x.c y.c z.c

The above command will do the following:

  • Compile and link three input source files.
  • Produce three object files and assign the names of the respective source files: x.o, y.o, and z.o.
  • Produce an executable file and assign the name of the first file in the command line to it, x.x.
  • Place all the files in the current directory.


Specifying a Multifile Object

To produce a single relocatable object file from multiple sources and to give a specific name to this object file a specific name, use the following example command:

ccxscce /c /Qipo_c one.cpp two.cpp three.cpp

The produced relocatable multifile is named ipo_out.o, and can be used in the further linking stage by invoking the compiler again, with this example:

ccxscce ipo_out.o

Here the compiler recognizes that the given file is an object file and passes it to the linker.

If several multifiles are required for a single project, the name of the previously generated multifile must be changed. Then they can be simply all linked together.


Using Non-standard Source File Extensions

To mix C/C++ source files having non-standard extension names with C++ source files having standard .cpp extension names, use the following example command:

ccxscce /calpha.px /TCbeta.qy /Tpgamma.cpp /TPdelta.cpp

The /TC option instructs the Intel® C++ Compiler to treat all given source files as C source files. This would include the given source files of gamma.cpp and delta.cpp both of which are actually C++ source file. To ensure that these two are treated as C++ sources and not as C sources the option /Tp is used twice, once for each source file.

The source files alpha.px and beta.qy are treated as if they were alpha.c and beta.c. The option /c interrupts the compilation process after relocatable object files are generated for each source file. This command assigns the base names of the source files to the object files generated followed by the extension .o. The result names will be alpha.o, beta.o, gamma.o and delta.o.

These files can be linked then by the following command line:

ccxscce alpha.o beta.o gamma.o delta.o

This command produces an executable file whose base name is the same as the first source file. The result name of the executable file is alpha.x.

Alternatively the executable could be generated directly with a single command line by leaving out the /c option.

ccxscce /TC alpha.px beta.qy /Tpgamma.cpp /Tpdelta.cpp


Specifying Executable Files

You can use the /Fe[filename] option to specify an alternate name for an executable file. This is especially useful when compiling and linking a set of input files. You can use the /Fe[filename] option to give the resulting file a name other than that formed from the base name of the first input file (source or object) in the command line, with an extension .o. In the example below, the command produces an executable file named outfile.exe as a result of compiling and linking three files: one object file and two C source files.

ccxscce /Feoutfile.exe file1.o file2.c file3.c

Without the /Fefilename option, the command above produces an executable file named file1.x.


Specifying Object Files

By default, the compiler always generates and stores object files in the current directory. You can use the /Fo[filename] option to specify an alternate name for an object file. For example:

ccxscce /Fofile.obj x.c

In the above example, the output object file is named file.obj instead of the default x.o.


Specifying Output Directories

You can use the /Fe[filename] and /Fo[filename] option to specify a directory location for executable and object files.

To distinguish from the filename, the directory name must end in a backslash (\) character, and must name an existing directory. For example, /Femyexes\, /Fomyobjs\, /Famyasms\.

When a directory name is specified, the compiler uses the default convention in naming the executable, assembly, and object files, and creates a corresponding file in the specified directory.

In the example below, the /Fe option causes the compiler to create the executable myprog.exe in the current directory. The /Fo option causes the compiler to create the object files a.obj, b.obj, and c.obj and place them in the directory obj_dir.

ccxscce /Femyprog.exe /Foobj_dir\ a.c b.c c.c
Note icon NOTE.
If you specify both /Fefilename and /Fedirname\ in the same command line, the last /Fe option overrides previous /Fe options.


Using Standard ANSI C Code only

To produce object code from multiple source files which adhere strictly to the ANSI C standards, use the option /Za.

ccxscce /c /Za alpha.c beta.c gamma.c delta.c

The four C source files alpha.c, beta.c, gamma.c and delta.c are each taken in turn and compiled into individual object files. These object files will take the base names of their source files with an extension of .obj, namely, alpha.obj, beta.obj, gamma.obj, and delta.obj.

These object files can then be linked when required using the command line below.

ccxscce alpha.obj beta.obj gamma.obj delta.obj

When a number of source files are to be linked together it is recommended that any strict adherence to the ANSI C standards be consistently applied to all the source files, not just to some of them. This prevents extension structures in one source file from attempting to be serviced by another source file where they are not allowed.


Generating a Function Prototype List

This section explains how to produce a list of function prototypes for all functions within the source file. The option to be used is /Zg. The list is written to the standard output stdout and is useful to verify that the actual arguments and formal parameters of a function are compatible. The list can be saved by redirecting stdout to a file.

ccxscce /Zg alpha.cpp

Function prototypes for all functions within the C++ source file alpha.cpp are generated, but compilation does not take place.


Using the Intel® Assembler to Produce Object Code

By default, the Intel® C++ Compiler automatically calls the Intel® Assembler and the Intel® Linker. The Intel® Assembler is called to generate the object file with the "o" extension. The Intel® Assembler may be also used to assemble other assembler files to be added to your application. For more information on using the Intel® Assembler, refer to the Intel® Assembler Reference Manual.

If you want to stop the compilation after generating the assembly file, use the /S or /Qipo_S option.

See Also

Intel® Assembler Reference Manual


Linking

Please refer to the Microsoft* linker documentation for a description of the supported options.


Debugging

This section describes the basic command line options that you can use to prove your compilation. The options in this section describe:

  • Parsing for syntax only
  • Support for symbolic debugging
  • Debugging and optimizations


Parsing for Syntax only

Use the /Zs option to stop processing source files after they have been parsed according to C/C++ language syntax rules. This option gives you a way to check quickly whether sources are syntactically correct. The compiler creates no output file. In the following example, the compiler checks a file named prog1.c. Any diagnostics appear on stdout.

ccxscce /Zs prog1.c


Support for Symbolic Debugging

Use the /Zi option to direct the compiler to generate code to support symbolic debugging. For example:

ccxscce /Zi prog1.c
Note icon NOTE.
The compiler does not support the generation of debugging information in assembly files. If you specify the /Zi option with /Fa, the resulting object file will contain debugging information, but the assembly file will not. If you specify the /Zi option and later assemble the resulting assembly file, the resulting object file will not contain debugging information.


Symbolic Debugging and Optimizations

The /Zi option implicitly disables optimization, as if /Od was specified. You can overrun this by explicitly setting an optimization option.

Note icon NOTE.
If you specify the /O1 or /O2 option with the /Zi option, some of the generated debug information may be inaccurate as a side-effect of optimization.

.

Table: Effects of Option /Zi Combined with Optimization Options
Option Combination | Result
/Zi | Debugging information produced, /Od and /Oy- set.
/Zi /O2 | Debugging information produced, /O2 optimizations enabled.
/Zi /O2 /Oy | Debugging information produced, /O2 optimizations enabled.
/Zi /Qip | Limited debugging information produced, /Qip option enabled.


Compiler Options

This chapter provides a detailed description of the many compiler options supported by the Intel® C++ Compiler.

The chapter is divided into several parts:

  • "Introduction" gives an introduction to options and where the options are introduced within the command line environment.
  • "Command Line Environment" is used to explain the various locations where options may be found within the command line.
  • "Overview of Options" gives a brief overview of the available options. These are grouped in categories, whose overall purpose is described, and any peculiarities explained. A list of options for each category is also given.
  • "/?" through "/Zs" describe each of the compiler options in detail. The options are listed in alphabetical order.


Introduction

The Intel® C++ Compiler is invoked by a command line whose syntax is explained in "Command Line Syntax" and carries out the compilation process as detailed in "Default Behavior of the Intel® C++ Compiler". The command line includes arguments of source files and options which control the activity of this compilation process. However options may also occur in a number of other places within the command line environment; these are mentioned in "Command Line Environment".

There is a wide range of options available which include those for debugging, language interpretation, preprocessing and pre-compiled headers. As well as the normally expected optimization options there is a number of advanced options, for example, interprocedural optimizations. This powerful set of options allows the programmer to instruct the Intel® C++ Compiler to more exactly create an executable program, tailored to the hardware being used and the application required.


Command Line Environment

The command line environment includes not only the actual command line itself but also the configuration file and any command files placed upon the command line. Options may occur in any one of these.

As well as source files the command line may also include response files, which are used to hold options. By this means overlong command lines with many options may be avoided, and often used options may be placed together in a single file for repeated use. The response file also has the advantage of being able to document what each option included within it is for. See also "Response Files".

There is also a configuration file, detailed in "Configuration Files", which is automatically invoked whenever the Intel® C++ Compiler is called. This file also holds options which are required when processing applications to make them compatible to the Intel® C++ Software Development Tool Suite. The configuration file is provided with the Intel® C++ Compiler.

When stating that an option is in the command line environment the option may occur in any one of the above locations; that is in the command line itself, a response file which is in the command line, or in the configuration file.

The Intel® C++ Compiler sets up its options in the order they appear in the command line environment. Therefore it is possible to turn certain defaults OFF and then ON again. For example the optimization option /O2 turns ON a number of specific optimization options. Should the user require some, but not all, to be set as OFF then the option for no optimization can be selected followed by those specifically required.

The order of evaluation is as follows:

  1. The options setting in the configuration file is evaluated first.
  2. The command line is then read from left to right. Any option file specified in the command line is treated as if its contents are written in the command line at the position of the filename.


Overview of Options

The command line options of the Intel® C++ Compiler alter the behavior of the compilation process. The options can be grouped into a number of categories as shown in the table below:

Table: Categories of Options
Category | Activities carried out by this category | Further Information
Code Generation | Modifies how code is to be generated. | "Code Generation Options"
Debugging | Specifies any debugging information. | "Debugging Options"
Error Handling | Specifies the diagnostic behavior. | "Error Handling Options"
Interprocedural Optimizations | Carries out Interprocedural Optimizations. | "Interprocedural Optimizations"
Language | Specifies how the C/C++ language is to be interpreted. | "Language Options"
Miscellaneous | Miscellaneous options, which don't fit into any other category. | "Miscellaneous Options"
Optimization | Enables any optimizations of the generated code. | "Optimization Options"
Output Files | Directs what output files are to be generated. | "Output File Options"
Precompiled Headers | Generates precompiled header files. | "Precompiled Header Options"
Preprocessor | Directs how to handle the preprocessing stage. | "Preprocessor Options"
Process Interrupt | Interrupts the compilation process after a particular stage. | "Options which Interrupt the Compilation Process"

The following sections describe the main features of each category, together with a list of category options.


Language Options

This category of options is available to specify how the C/C++ source files are to be interpreted. The /Zs option is used to check the syntax of given source files only; it quits the compilation process after the syntax check.

Table: Language Options
Option | Activity | Default
/noBool | Disables the predefined type bool. See also "/noBool". | OFF
/Qansi[-] | Assumes conformance to the ANSI standard for C++. See also "/Qansi". | OFF
/TC | Specifies all source files on command line as C source. See also "/TC". | OFF
/Tcfilename | Specifies a given file to be treated as if it were a C source file. See also "/Tc". | OFF
/TP | Specifies all source files on command line as C++ source. See also "/TP". | OFF
/Tpfilename | Specifies a given file to be treated as if it were a C++ source file. See also "/Tp". | OFF
/Za | Enforces strict conformance to the ANSI standard for C. See also "/Za". | OFF
/Zg | Instructs the compiler to output the list of function prototypes for all the functions found within the source files to be compiled. See also "/Zg". | OFF
/Zs | Checks the syntax of a program and stops the compilation process after the source files have been parsed. Generates no code and produces no output files. Warnings and messages appear on stderr. See also "/Zs". | OFF


Preprocessor Options

The preprocessor options specify how the preprocessor has to work. Options in this category are used to define or disable macro definitions, set up alternative include file directories, and to include header files into the source.

Table: Preprocessor Options
Option | Activity | Default
/C | Comments remain in preprocessed source output. See also "/C". | OFF
/Dname[=value] /Dname#value | Defines named macro, symbol, or constant. See also "/D". | OFF
/E | Stops compilation process after all C/C++ source files have been preprocessed, results are sent to the standard output stdout. See also "/E". | OFF
/EP | Stops compilation process after all C/C++ source files have been preprocessed. Results are sent to the standard output stdout, with #line directives stripped out. See also "/EP". | OFF
/FI [filename] | Instructs preprocessor to treat the given filename as though it were an include file on the first line of every source file in the command line. See also "/FI". | OFF
/I directory | Specifies additional directories to be searched when resolving include statements. See also "/I". | OFF
/P | Stops compilation process after all C/C++ source files have been preprocessed, results are sent to a file. See also "/P". | OFF
/QA[-] | Enables all predefined macros and assertions. See also "/QA". | ON
/QAname [value] | Defines an assertion with the specified predicate name and value. See also "/QAname". | OFF
/u | Disables all macros, symbols, and constants. See also "/u". | OFF
/Uname | Disables named macro, symbol, or constant. See also "/U". | OFF
/X | Removes standard directories from being searched when trying to resolve include statements. See also "/X". | OFF


Precompiled Header Options

These options direct the generation and usage of precompiled header files.

Table: Precompiled Header Options
Option | Activity | Default
/Fp[filename] | Specifies the name of a precompiled header file. See also "/Fp". | OFF
/Yc[filename] | Creates a precompiled header file. See also "/Yc". | OFF
/Yu[filename] | Uses a precompiled header file. See also "/Yu". | OFF
/YX[filename] | Enables automatic precompiled header file creation and usage. See also "/YX". | OFF


Optimization Options

This category has a number of options for directing the Intel® C++ Compiler on optimizing the resultant compiled code. As well as the normally expected optimizations within the code, such as eliminating unused variables, there are a number of others. These include the option /Ob which controls any inline expansion activity, where function calls are replaced with their contents when appropriate.

The option /Onum has several groups of optimization options preset to be ON. For example, /O1 sets a number of optimization options which will minimize generated code-size, and /O2 has a preset number of options set to optimize the speed of the generated code. By default, the option /O2 (optimize for speed) is set, together with several other optimizing options as shown in the table below.

If any optimization option is specifically selected in the command line environment then default optimizations are turned OFF, and if required must be specifically turned ON individually. This is true even if one of the default ON options is specified, all the other default ON options will be assumed OFF unless individually specified as ON.

Optimization can also be turned OFF by selecting the option /Od. Since options are set up in the order in which they are specified in the command line environment it is possible to use option /Od, to turn OFF optimization, and then to specify other individual optimization options as ON. This ensures that the user is setting the exact optimization regime that is required.

The last column of Table "Optimization Options" shows ON if this option is switched on by default, or OFF if the option is switched off by default. However, the default settings of some options can be changed by other options. For example, the optimization option /O, is normally set to /O2 as default. However, should debugging information be required by setting option /Zd or /Zi, the optimization option /Od (no optimization) is taken as the default optimization setting instead.

Table: Optimization Options
Option | Activity | Default
/O1 | Optimizes for speed, but disables some optimizations that increase code size for small speed benefit. See also "/O". | OFF
/O2 | Optimizes for speed. See also "/O". | ON (OFF if /Zi is set)
/O3 | Enables high-level optimization. See also "/O". | OFF
/Oa | Assumes no Aliasing. See also "/Oa". | OFF
/Obnum | Controls the inline expansion. See also "/Ob". | /Ob1
/Od | Disables optimizations. See also "/Od". | OFF (ON if /Zi is set)
/Og | Enables global optimizations. See also "/Og". | ON
/Oi[-] | Enables inline expansion of standard library functions. See also "/Oi". | ON
/Op[-] | Improves floating point consistency. See also "/Op" | OFF
/Os | Enables speed optimizations that do not increase code size. See also "/Os". | OFF
/Ot | Enables speed optimizations that might increase code size. See also "/Ot". | ON
/Ow | Assumes no aliasing within functions. See also "/Ow". | OFF
/Ox | Uses maximum optimization. See also "/Ox". | OFF
/Qprec | Improves floating point precision. See also "/Qprec". | OFF
/Qprec_div | Disables the floating point division-to-multiplication optimization. See also "/Qprec_div" | OFF
/Qunroll[num] | Specifies maximum depth to unroll loops. See also "/Qunroll". | ON
/Qvec[-] | Switches on (off) the vectorizer. See also "/Qvec". | ON


Interprocedural Optimizations

A feature of the Intel® C++ Compiler is its ability to carry out optimizations across several procedures and functions within the program being compiled. This reduces unnecessary code and can create faster code. These options include:

Table: Interprocedural Optimization Options
Option | Description | Default
/Qip | Single file interprocedural optimizations. Procedures within each source file are optimized across functions but only within each individual source file. See also "/Qip". | OFF
/Qipo | Multiple file interprocedural optimizations. Procedures within all source files within the command line environment are optimized across functions. See also "/Qipo". | OFF
/Qipo_obj | Multifile interprocedural optimizations must produce real object files. See also "/Qipo_obj". | OFF

The /Qip and /Qipo options enable interprocedural optimizations (IPO) to analyze your code to determine where you can benefit from the optimizations listed in tables that follow.

Table: Interprocedural Optimizations
Optimization | Affected Aspect of Program
Inline function expansion | Calls, jumps, branches, and loops.
Interprocedural constant propagation | Arguments, global variables, and return values.
Monitoring module-level static variables | Further optimizations, loop invariant code.
Dead code elimination | Code size.
Propagation of function characteristics | Call deletion and call movement.
Passing arguments in registers | Calls, register usage.
Loop-invariant code motion | Further optimizations, loop invariant code.
Multifile optimization | Affects the same aspects as /Qip, but across multiple files.

Inline function expansion is one of the main optimizations performed by the interprocedural optimizer. For function calls that the compiler believes are frequently executed, the compiler might decide to replace the instructions of the call with code for the function itself.

With /Qip, the compiler performs inline function expansion for calls to procedures defined within the current source file. However, when you use /Qipo to specify multifile IPO, the compiler performs inline function expansion for calls to procedures defined in separate files.

Caution icon CAUTION.
The /Qip and /Qipo options can in some cases significantly increase compile time and code size.


Multifile IPO

Multifile IPOs obtain potential optimization information from individual program modules of multifile programs. Using this information, the compiler performs optimizations across modules.

Building a program is divided into two phases: compilation and linkage. Multifile IPO performs different work depending on whether the compilation or linkage is being performed.

  1. Compilation Phase. As each source file is compiled, multifile IPO stores an intermediate representation (IR) of the source code in a mock object file in a special comment section. Each mock object file contains the IR for its corresponding source file, but no real code or data. These mock objects must be linked using the /Qipo option with the compiler.
  2. Linkage Phase. When you specify /Qipo, the compiler looks for the IR information in the mock object files.
Creating a Multifile IPO Executable with Compiler Command

This topic explains how to create a multifile IPO executable as follows in the examples below:

Compile your modules with /Qipo as follows:

  1. Enter

    2. ccxscce /Qipo /c a.c b.c c.c

    The option /c stops the compilation after generating .o files. Each object file has the IR for the corresponding source file. With preceding results, you can now optimize interprocedurally:

  2. Enter

    3. ccxscce /Fenu_ipo_file.exe /Qipo a.o b.o c.o

    The /Fe option stores the executable in nu_ipo_file.exe. Multifile IPO is applied only to modules that have an IR, otherwise the object file passes to the link stage.

For efficiency, combine steps 1 and 2:

ccxscce /Qipo /Fenu_ipo_file.exe a.c b.c c.c

Analyzing the Effects of Multifile IPO

The /Qipo_c and /Qipo_S options are useful for analyzing the effects of multifile IPO, or when experimenting with multifile IPO between modules that do not make up a complete program.

Use the /Qipo_c option to optimize across files and produce an object file. This option performs optimizations as described for /Qipo, but stops prior to the final link stage, leaving an optimized object file. The default name for this file is ipo_out.o. You can use the /Fe option to specify a different name. For example:

ccxscce /Qipo_c /Fefile a.c b.c c.c

Use the /Qipo_S option to optimize across files and produce an assembly file. This option performs optimizations as described for /Qipo, but stops prior to the final link stage, leaving an optimized assembly file. The default name for this file is ipo_out.s. You can use the /Fe option to specify a different name. For example:

ccxscce /Qipo_S /Fefile a.c b.c c.c


Error Handling Options

These options specify how the Intel® C++ Compiler handles errors, warnings, and remarks.

Table: Error Handling Options
Option | Activity | Default
/Qwdnum{,num} | Disables the specified warnings and remarks. See also "/Qwd" | OFF
/Qwenum{,num} | Changes the specified warnings and remarks to errors. See also "/Qwe". | OFF
/Qwnnum | Limits the number of errors displayed prior to aborting compilation. See also "/Qwn". | /Qwn100
/Qwrnum{,num} | Changes the specified warnings to remarks. See also "/Qwr". | OFF
/Qwwnum{,num} | Changes the specified remarks to warnings. See also "/Qww". | OFF
/Wnum | Specifies what levels of warning messages to be generated. See also "/W". | /W1
/w | Turns off all warning messages. See also "/w". | OFF


Code Generation Options

These options direct the Intel® C++ Compiler to modify the generated code.

Table: Code Generation Options
Option | Activity | Default
/EHa | Enable asynchronous C++ exception handling. See also "/EHa". | OFF
/EHc | Assume external "C" functions do not throw exceptions. See also "/EHc". | OFF
/EHs | Enable synchronous C++ exception handling. See also "/EHs". | OFF
/GR[-] | Enables [disables] C/C++ Run-Time Type Information (RTTI). See also "/GR". | OFF
/GX | Enables C/C++ exception handling. See also "/GX". | OFF
/Gy | Reorders functions at link time for efficiency. See also "/Gy". | OFF
/Qnobss_init | Places variables initialized with 0 into DATA section within the assembly code. See also "/Qnobss_init". | OFF
/QRinterwork-return | Specifies mixed ARM* and Thumb* instructions. See also "/QRinterwork-return". | /QRinterwork-return
/QRthumb | Specifies that Thumb* instructions are generated. See also "/QRthumb". | OFF
/QRxscale | Specifies that code for the Intel XScale® technology is to be generated. See also "/QRxscale". | /QRxscale
/Zp[num] | Specifies alignment of structure members. See also "/Zp". | /Zp8


Output File Options

This category has options which manage output files. Some of these options direct output files to be generated, while others specify what output file names are to be used.

The options /Fa, /Fe, /Fo, and /Fp can optionally specify a filename, otherwise a default filename is used. Options /Qipo_c and /Qipo_S only use default filenames.

Option /Fo is unique and is used to specify the output filename, but its contents and default extension depend on how far the compilation process has progressed. For example, if the compilation process completes then the file named is an executable file. If the compilation process is halted after relocatable object code has been generated the file named becomes an object file.

Options /Fa and /Fo relate to a single source file and cannot be used where multiple source files occur on the command line.

Table: Output File Options
Option | Activity | Default
/FD | Generates file dependencies. See also "/FD". | OFF
/FR[filename] | Produces a browser file with complete symbolic information. See also "/FR". | OFF
/Fa[filename] | Produces an assembly language listings file from the given source file. See also "/Fa". | OFF
/Fe[filename] | Specifies the name to be given to the executable file. See also "/Fe". | /Fea.out
/Fo[filename] | Specifies the name to be given to the object file. Only valid where a single source file occurs in the command line. See also "/Fo". | OFF
/Fp[filename] | Specifies the name to be given to a precompiler header. See also "/Fp". | OFF
/MX | Generates a file dependency file, including system files. See also "/MX". | OFF
/MXA | Generates a file dependency file, without system files. See also "/MXA". | OFF
/Qipo_c | Generates a multifile object file from the given source files. See also "/Qipo_c". | OFF
/Qipo_S | Generates a multifile assembly file from the given source files. See also "/Qipo_S". | OFF


Debugging Options

This category of options is available to enable debugging information to be generated by the Intel® C++ Compiler during the compilation process. The debugging information is included within the generated code, or within a special program database, and can be used by a debugger. The option /Zi includes the option /Zd so the two need not be used together. Selecting the option /Zi for complete symbolic debugging information also causes the optimization defaults to be altered.

Table: Debugging Options
Option | Activity | Default
/Zd | Generates line number information in the object file (for debugging). See also "/Zd". | OFF
/ZI[-] | Generates symbolic debugging information in the object code for use by source-level debuggers. Identical to option /Zi. See also "/ZI". | OFF
/Zi[-] | Generates symbolic debugging information in the object code for use by source-level debuggers. See also "/Zi". | OFF


Options which Interrupt the Compilation Process

By default the entire compilation process of Compiling-Assembling-Linking is carried out to produce an executable file. However, there are a number of options which can stop this sequence before it is completed, these are:

Table: Options which Interrupt the Compilation Process
Option | Description | Default
/Bz | Outputs the command line calls and options only, no output file is generated. See also "/Bz". | OFF
/c | Stops compilation after relocatable object code has been generated. See also "/c". | OFF
/E | Stops compilation process after all C/C++ source files have been preprocessed; results are sent to the standard output, stdout, with #line directives added. See also "/E". | OFF
/EP | Stops compilation process after all C/C++ source files have been preprocessed; results are sent to the standard output, stdout. See also "/EP". | OFF
/P | As option /E, but the output is sent to an output file. See also "/P". | OFF
/QH | Outputs list of include file names only, no compilation carried out. See also "/QH". | OFF
/QM | Generates include dependency information only (makefile style), no compilation is carried out. See also "/QM". | OFF
/S | Stops compilation after assembly code has been generated. See also "/S". | OFF
/Zg | Outputs list of function prototypes only, no compilation carried out. See also "/Zg". | OFF
/Zs | Checks syntax of source files only, no compilation carried out. See also "/Zs". | OFF

These options should not be used in combination with each other. However, if /c and /S are used together, the /S overrides /c. Indeterminate results occur with other combinations.


Miscellaneous Options

This category includes a diverse set of options which do not naturally belong to any other category. They include options to specify alternative assemblers and linkers, change the default source extensions and set warning message levels.

Table: Miscellaneous Options
Option | Activity | Default
/? | Outputs a summary of the compiler options. See also "/?". | OFF
/ARMasm | If the source file is an assembler file, it is interpreted as pure ARM* syntax. See also "ARMasm". | OFF
/Bafilename | Specifies directory and filename of the Assembler to be invoked from the compiler. By default this is set to be the standard assembler within the Intel® C++ Software Development Tool Suite. See also "/Ba". | /Bafilename
/Bd | Outputs all the command line calls and options including those set within the configuration file. Carries out the compilation process. See also "/Bd". | OFF
/Blfilename | Specifies which directory and filename of the linker to be invoked from the compiler. By default this is set to be the standard linker within the Intel® C++ Software Development Tool Suite. See also "/Bl". | /Blfilename
/Hnum | Sets maximum number of characters in symbol names. See also "/H". | OFF
/HELP | Outputs a summary of the compiler options. See also "/HELP". | OFF
/help | Outputs a summary of the compiler options. See also "/help". | OFF
/J | Makes default character types unsigned. See also "/J". | OFF
/nologo | Suppresses the display of compiler version information. See also "/nologo". | OFF
/Q_os_[name] | Specifies the operating system. See also "/Q_os_". | OFF
/Qexpand_env[text] | Expands environment variables in the given text text and processes the resulting text as command line options or file specifications. See also "/Qexpand_env". | OFF
/Qlocation,tool,path | Specifies alternative directory and filenames for the assembler and linker components to be invoked from the compiler. See also "/Qlocation". | OFF
/QM | Generates makefile dependency information for each source file. See also "/QM". | OFF
/Qoption,tool, optionlist | Passes an option list to another tool in the compilation chain. See also "/Qoption". | OFF
/Qsox[-] | Adds settings of the compiler options and its version number into the executable file. See also "/Qsox". | OFF
/QTP[target] | Specifies the target processor for the compilation. See also "/QTP". | /QTPxsc1
/S | Stops the compilation process after assembly code has been generated. Does not go on to invoke assembler and linker. See also "/S". | OFF
/Vstring | Sets the version string. See also "/V". | OFF


Description of Options

/?
Syntax
/?
Description

The option /? will generate an extensive list of all the Intel® C++ Compiler options currently available.

Alternative forms of this option are /HELP and /help.

This option is switched OFF by default.

Example

To generate the usage information, use the following command:

ccxscce /?


ARMasm
Syntax
-ARMasm
Description

If the source is an assembler file, this option specifies that the source is to be interpreted as pure ARM* syntax.

If the source is not an assembler file, this option is silently ignored.

Note icon NOTE.
The assembler output of the Intel® C++ Compiler does not necessarily follow the pure ARM* syntax. Do not use this option with files generated by the Intel® C++ Compiler!

Example

The following command line causes the compiler to treat the file ARMsrc.asm as pure ARM* assembler file:

ccxscce /ARMasm armsrc.asm


/Ba
Syntax
/Bafilename
Description

The option /Ba allows an alternative filename filename to be declared to the assembler. The filename can include a directory path.

By default the Intel® C++ Compiler is set up to point to the Intel® C++ Software Development Tool Suite.

Example

To produce a relocatable object file using the alternative assembler of Brooks.exe use a command line of:

ccxscce /c /Bac:\binasms\Brooks.exe testing.c
See Also


/Bd
Syntax
/Bd
Description

The option /Bd outputs to the standard output stdout all the command line calls and options, before execution. These include all options within the default configuration file as well.

This option is switched OFF by default.

Example

To produce an executable file from the group of source files one.c, two.c and three.c, use the following command. Use of option /Bd causes all option settings to be sent out to stdout first, before execution.

ccxscce /Bd one.c two.c three.c
See Also

"/Bz"


/Bl
Syntax
/Blfilename
Description

The option /Bl allows an alternative filename filename to be declared to the linker. The filename can include a directory path.

By default the Intel® C++ Compiler is set up to point to the Intel® C++ Software Development Tool Suite.

Example

To produce an executable file using the alternative linker Linkarbus.exe, use this command line:

ccxscce /Blc:\linkers\Linkarbus.exe testing.c
See Also


/Bz
Syntax
/Bz
Description

The option /Bz outputs to the standard output stdout all the command line calls and options, but does not execute them. These include all options within the default configuration file as well. This allows the user to check exactly what command calls and options are being applied before compiling.

This option is switched OFF by default.

Example

To check what options are set, without actually carrying out the compilation, use the following command. Both the response file and default configuration files also hold option settings. The option settings are sent to stdout.

ccxscce /Bz @commandf.cmd one.c two.cpp
See Also


/C
Syntax
/C
Description

The option /C is used to preserve comment lines within the preprocessed output which is generated by using the /E, /EP or /P options. These options preprocess the original source file and place the result into either the standard output, or an output file. By default the comment lines are removed. If the /C option is set, the comment lines are kept.

This option is useful only in connection with the /E, /EP or /P options.

This option is switched OFF by default.

See Also


/c
Syntax
/c
Description

The option /c stops the compilation process after an object file has been generated for each source file on the command line. This suppresses the implicit call to the linker, which must be called later to produce an executable file. Each generated object file takes on the name of the source file from which it was produced with an extension of .o.

Alternatively, should the Intel® C++ Compiler find a source file with an extension of .s then this is assumed to be an assembly file. In this case the Intel® C++ Compiler will invoke the Intel® Assembler to produce the object file.

The option /S overrides the option /c to generate assembly files only, with extensions of .s, from C/C++ source files only.

The /TC, /Tc, /TP, /Tp options can be used to force acceptance of source files as C/C++ sources with extensions other than .c and .cpp.

The option /c is switched OFF by default.

The following options override the /c option:

/E /EP /Fe /P /QH /QM /S /Zs
Example

This command produces an object file named testing.o from a C source file of the same name:

ccxscce /c testing.c
See Also


/D
Syntax
/Dname
/Dname=value
/Dname#value
Description

The option /D defines a macro name name and optionally associates it with a specified value, value. The value, if specified, is preceded by a `=' or a `#'.

9Multiple use of this option is allowed to define several macro names. The macro definitions on the command line and in the source file are processed in the following order:

  1. All macro definitions on the command line, in the order of appearance
  2. The macro definitions in the source file, as it is being processed
Example

To produce an executable file from a C++ source file of trying.cpp where three macros need to be defined, use a command line of:

ccxscce /Dcircle /Dangle=45 /Dradius#8 trying.cpp

Within the file trying.cpp, the following preprocessor macros are defined:

Macro
Value
circle
    The macro is defined but its value is undefined.
angle
    45
radius
    8

See Also


/E
Syntax
/E
Description

The option /E stops the compilation process after the C/C++ source files have been preprocessed, with the result being written out to the standard output device stdout. The output is identical to the original source, except that all preprocessor directives are carried out, conditional compilation resolved, and macros expanded. In addition, the /E option adds #line directives around those lines removed from the original source file, as being comments or conditionally not required, and around lines added from included files. This ensures that should the preprocessed output be submitted for final compilation any error and other messages will refer to line numbers within the original source.

To stop #line directives from being included, the /EP option can be used instead.

To place the preprocessing output lines within an output file, use the /P option.

All comments are removed from the output, unless option /C is used to preserve them.

This option stops the compilation process before it has completed and should not be used in combination with others which behave similarly such as /c, /QH, /QM and /S.

This option is switched OFF by default.

Example

To preprocess a group of source files, with #line directives included, use the following command. No compilation is carried out.

ccxscce /E one.c two.cpp three.c
See Also


/EHa
Syntax
/EHa
Description

The option /EHa enables asynchronous C++ exception handling.

This option is switched off by default.

See Also


/EHc
Syntax
/EHc
Description

If the option /EHc is set, the Intel® C++ Compiler assumes that external "C" functions do not throw exceptions. This option is switched off by default.

See Also


/EHs
Syntax
/EHs
Description

The option /EHs enables synchronous C++ exception handling.

This option is switched off by default.

See Also


/EP
Syntax
/EP
Description

The option /EP stops the compilation process after the C/C++ source files have been preprocessed, with the result being written out to the standard output device stdout. The output is identical to the original source file except that all preprocessor directives are carried, conditional compilation resolved and macros expanded. Should the precompiled output be required to be resubmitted for final compilation then use /E option instead, which puts #line directives within the file.

To place the preprocessed output lines within an output file, use the /P option.

All comments are removed from the output, unless option /C is used to preserve them.

This option stops the compilation process before it has completed and should not be used in combination with others which behave similarly such as /c, /QH, /QM and /S.

This option is switched OFF by default.

See Also


/Fa
Syntax
/Fa[filename]
Description

The option /Fa is used to specify the filename, and optionally the directory, of the assembly listings file as filename. If an extension is not given, the default of .s is used instead. The filename is optional and may be omitted, in which case the file takes up the default filename of the source file from which it was generated.

This option is not allowed where multiple source files are used on the command line.

If this option is not used and the compilation process is stopped after the compiler stage, the Intel® C++ Compiler will generate an assembly file with the extension of .s from each source file it finds on the command line. These assembly files take up the names of the source files from which they were generated.

This option is switched OFF by default.

You can also use the /Fa[filename]option to specify a directory location for assembly files. In this case, the directory name must end in a backslash (\) character, and must name an existing directory, for example:
/Famylistings\

When a directory name is specified, the compiler uses the default convention for the filename, and creates a corresponding file in the specified directory.

Example

To produce a relocatable object file from the C source file trumpet.c, where an assembly listings file of triangle.lis is also required, use the following command.

ccxscce /c /Fatriangle.lis trumpet.c
See Also


/FD
Syntax
/FD
Description

The option /FD is used to ensure that the most reliable dependency information is used when the executable is built.

This option is switched OFF by default.

See Also


/Fe
Syntax
/Fe[filename]
Description

The option /Fe is used to specify the filename, and optionally the directory, of the output executable file as filename. If filename has no extension, the output file has no extension, too. The filename is optional and may be omitted, in which case the file takes up the default filename a.out.

If this option is not used, the default filename is the name of the first source or object file on the command line, with the extension changed to "exe".

If the compile process does not reach the executable stage, this option has no effect.

This option is switched OFF by default.

You can also use the /Fe[filename]option to specify a directory location for executable files. In this case, the directory name must end in a backslash (\) character, and must name an existing directory, for example:
/Femyexes\

When a directory name is specified, the compiler uses the default convention for the filename, and creates a corresponding file in the specified directory.

Note icon NOTE.
If you specify both /Fefilename and /Fedirname\ in the same command line, the last /Fe option overrides previous /Fe options.

Example

To produce an executable file named warp.exe from several C/C++ source files, use the following command. The extension .exe in the executable filename is optional as this is the default extension.

ccxscce /Fewarp.exe one.c two.cpp three.c
See Also


/FI
Syntax
/FI[filename]
Description

The option /FI is used to instruct the preprocessor of the Intel® C++ Compiler to include the specified file filename as a header file at the top of every C/C++ source file in the command line environment. The filename can include a directory path, and may be used a multiple number of times on the same command line. Where multiple uses occur they are included in the order that they appear within the command line environment

This option is switched OFF by default.

Example

To produce an executable file named triangle.exe from several C source files, where an additional include file is required to be inserted at the top of all of them, use the following command. The header file insert.h is placed at the top of the source files one.c, two.c and three.c.

ccxscce /Fetriangle.exe /FIinsert.h one.c two.c three.c
See Also


/Fo
Syntax
/Fo[filename]
Description

The option /Fo is used to specify the filename, and optionally the directory, of the relocatable object file as filename. If an extension is not given, the default of "o" is used instead. The filename is optional and may be omitted, in which case the file takes up the filename of the source file from which it was generated.

This option is not allowed where multiple source files are used on the command line.

If this option is not used and the compilation process is stopped after the assembler stage, the Intel® C++ Compiler will generate an object file with the extension of "o" from each source file it finds on the command line. These object files take up the names of the source files from which they were generated.

This option is switched on by default.

You can also use the /Fo[filename]option to specify a directory location for executable files. In this case, the directory name must end in a backslash (\) character, and must name an existing directory, for example:
/Fomyobjects\

When a directory name is specified, the compiler uses the default convention for the filename, and creates a corresponding file in the specified directory.

Example

To produce a relocatable object file named triangle.o from a C source file of elipse.c, the following command line will be required.

ccxscce /c /Fotriangle elipse.c
See Also


/Fp
Syntax
/Fp[filename]
Description

The option /Fp is used to specify the filename, and optionally the directory, of a precompiled header file which is created by use of the debug options /YX, /Yc, and /Yu.

If an extension is not specified, the default of "pchi" is used instead. If only a directory is specified, the name of the source file with the extension changed to "pchi" is used.

This option is not allowed if more than one source file is specified on the command line.

This option is switched OFF by default.

Example

To produce a precompiled header file of infdat.pchi in the directory C:\headers from a source file of trumpet.c use the following command:

ccxscce /Zi /Yc /FpC:\headers\infdat.pchi trumpet.c
See Also


/FR
Syntax
/FR[filename]
Description

The option /FR is used to specify the filename, and optionally the directory, of a browser file containing symbolic information. If an extension is not given, the default of "sbr" is used instead. The filename is optional and may be omitted, in which case the file takes up the filename of the source file from which it was generated.

This option is not allowed if more than one source file is specified on the command line.

This option is switched OFF by default.

Example

To produce a file of browser information brows.sbr in the directory C:\output from a source file of trumpet.c, use the following command:

ccxscce /FRC:\output\brows.sbr trumpet.c
See Also


/GR
Syntax
/GR
Description

The option /GR enables Run-Time Type Information (RTTI) to be added to the object code. This information enables data object type checking to be carried out during run-time, and makes implicit use of the RTTI preprocessing macro.

If this option is set, the preprocessor macro _CPPRTTI is defined.

This option is switched OFF by default.

See Also


/GX
Syntax
/GX
Description

The option /GX enables C/C++ exception handling.

If this option is set, the preprocessor macro _CPPUNWIND is defined.

This option is switched OFF by default.

See Also

"/GR"


/Gy
Syntax
/Gy
Description

The option /Gy instructs the compiler to package every function into an individual section. This allows the linker to remove or rearrange the functions in an executable file (.EXE) or dynamic link library (DLL) at link-time. Such packaged functions are referred to as COMDATs.

This option is switched OFF by default.

See Also


/H
Syntax
/Hnum
Description

The option /H sets the number of significant characters for public identifiers to its integer parameter, num. Public (i.e., external) identifiers may be longer than this limit, but only the first num characters are regarded and the rest of the identifier is ignored.

Note icon NOTE.
The compiler may add characters like '@' or '_' to identifiers. These characters are counted as part of the name. C++ name mangling can also increase the name length. The limit num is compared against the name length after these changes took place.

By default, there is no length limit for public identifiers.

Example

To set the limit for public identifiers to 20 characters, use the following command:

ccxscce /H20 sourcefile.cpp


/HELP
Syntax
/HELP
Description

The option /HELP will generate an extensive list of all the Intel® C++ Compiler options currently available.

Alternative forms of this option are /help and /?.

This option is switched OFF by default.

Example

To generate the help information use the following command. Several pages of information are produced.

ccxscce /HELP
See Also

"/nologo"


/help
Syntax
/help
Description

The option /help will generate an extensive list of all the Intel® C++ Compiler options currently available.

Alternative forms of this option are /HELP and /?.

This option is switched OFF by default.

Example

To generate the help information use the following command. Several pages of information are produced.

ccxscce /help
See Also

"/nologo"


/I
Syntax
/Idirectory
Description

The option /I specifies an additional directory directory in which to search for include files. There can be multiple instances of this option in the same command line environment.

When the Intel® C++ Compiler encounters an include reference within one of the source files the order of search is as follows:

  • First search the directory of the source file containing the include.
  • Then search the directories specified by the /I option.
  • Finally search the default directories specified by the INCLUDE environment variable.

This option is switched OFF by default.

Example

The following will first look into directory c:\installation-directory\incand for any include files before searching the default include directory. Note that in this example by default the Intel® C++ Compiler will invoke the linker to produce an executable file.

ccxscce /Ic:\installation-directory\incand test.cpp
See Also


/J
Syntax
/J
Description

The option /J specifies that the Intel® C++ Compiler uses a default character type of unsigned char and not the usual character type of signed char.

Character data which are explicitly declared as signed will not be affected.

If this option is set, the preprocessor macro _CHAR_UNSIGNED is defined.

This option is switched OFF by default.

Example

To produce a relocatable object file named hyper.o from a C++ source file hyper.cpp, where all default characters are to be of unsigned type, use the command line shown below. Note that a listings file is also produced as hyper.lis.

ccxscce /c /Fahyper.lis /J hyper.cpp
See Also

"/Qnobss_init"


/MX
Syntax
/MX
Description

The option /MX causes the compiler to generate a text file containing file dependency information. This information can be used by integrated development environments (IDE) to enable conditional compilation.

A file x is said to depend on a file y if a change of y makes a rebuild of x necessary. For example, the output file x.o generated from the source file x.c is dependent on the header file y.h if the source file x.c includes the header file y.h.

The dependency file has the same name as the source file, with the extension changed to "dp".

This option works also if more than one source file is specified.

Example

To generate the dependency file source.dp for the source file source.c, use the following command line:

ccxscce /MX source.c
See Also

"/MXA"


/MXA
Syntax
/MXA
Description

The option /MXA causes the compiler to generate a text file containing file dependency information, like the /MX option. However, the /MXA option ignores dependencies of system header files and reports only dependencies within the application.

This option works also if more than one source file is specified.

Example

To generate the dependency file source.dp for the source file source.c, use the following command line:

ccxscce /MXA source.c

Even if the source file includes system header files, the dependency file source.dp does not mention them.

See Also

"/MX"


/noBool
Syntax
/noBool
Description

By default, the data type bool is predefined. The option /noBool switches off this predefinition; the type bool can be used only if explicitly defined.

This option is switched OFF by default.

Example

To switch off the predefined type bool, use the following command:

ccxscce /noBool sourcefile.cpp


/nologo
Syntax
/nologo
Description

The option /nologo suppresses the Intel® C++ Compiler declarative information which is normally generated at the start of any output. This information would include compiler version number and date of the compiler.

This option is switched OFF by default.

Example

To produce an executable file from a C source file testing.c, where no logo information is required in the executable file, use a command line of:

ccxscce /nologo testing.c
See Also


/O
Syntax
/Onum
Description

The option /O specifies a predefined set of options which control any optimization of the compilation procedure for speed and size of code. The degree of optimization is controlled by the specified number, num, as follows:

Number
Description
    1
    Optimizes for speed, but disables some optimizations that increase code size for small speed benefits. This setting has the same effect as specifying the options /Og, /Oi, /Os, /Ob1,/Oy, /Gy.
    2
    Optimizes for speed. The Intel® C++ Compiler may re-associate floating point expressions to improve application performance. This setting has the same effect as specifying the options of /Og, /Oi, /Ot, /Ob1, /Gy, /Oy.
    3
    Enables high-level optimization, but this does not guarantee higher performance.

Optimization default condition depends on whether the debugging option /Zi is set:

  • If /Zi is not set, optimization is set by default to be /O2.
  • If /Zi is set, then optimization is turned off by default to be /Od.
    Note icon NOTE.
    If more than one of the options /Od, /O1, /O2, /O3 is set, the compiler issues a warning message.
Example

To produce an executable file from a C source file of trying.c where optimization is required other than default /O2, use a command line of:

ccxscce /O3 trying.c
See Also


/Oa
Syntax
/Oa
Description

The option /Oa switches aliasing off. Aliasing is a technique whereby the compiler looks for variables which are redundant. For example they are not required since they only carry an intermediate temporary value within a set of calculations. Or two or more variables refer to the same value. Aliasing also looks for repeated assignment of variables with the same value within a loop, these would be assigned once outside the loop. Aliasing can slow down the run-time of your program by reducing variables and optimizing loops.

By default aliasing is assumed on, so this option is by default OFF.

Example

To produce an executable file from a C source file where aliasing is to be switched off, use a command line of:

ccxscce /Oa scalding.c
See Also


/Ob
Syntax
/Obnum
Description

The option /Ob specifies the amount, if any, of function inline expansion which the Intel® C++ Compiler will carry out during its compilation procedure. Inline expansion is where the function call is replaced by the contents of the function itself. This saves having to call the function with all its inherent overheads in terms of time and code. The degree, if any, of inline expansion to be carried out is controlled by the specified parameter num as follows:

    0
    Disables inline expansion. No inline expansion is carried out.
    1
    Compiler inlines only those functions declared with the __inline keyword, or as defined according to the C/C++ language. This is the default condition for this option.
    2
    Enables inline expansion of any function, although the Intel® C++ Compiler itself decides which functions to expand. This normally includes any that are specifically marked to be expanded by the __inline keyword.
    This option also enables the interprocedural optimizations and has the same effect as /Qip.

Should the number be omitted then this option is ignored.

The default setting for this option is /Ob1 (carry out inline expansion only on those functions specifically marked).

Example

To produce an executable file named arithmetic.exe from a C++ source file of maths.cpp where inline expansion other than default /Ob1 is required, use a command line of:

ccxscce /Fearithmetic.exe /Ob2 maths.cpp
See Also


/Od
Syntax
/Od
Description

The option /Od specifies that there be no optimization within the compilation procedure.

To set up for a specific optimization regime it is necessary first to disable the default optimization settings before specifying the exact optimization options required. In this case the option /Od can be used followed by those optimization options required.

If the /Od and /O options are not specified, then the default optimization condition depends on whether the debugging option /Zi is set:

  • If /Zi is not set, optimization is set by default to be /O2.
  • If /Zi is set, then optimization is turned off by default to be /Od.
    Note icon NOTE.
    If more than one of the options /Od, /O1, /O2, /O3 is set, the compiler issues a warning message.
Example

To produce an object file from a C++ source file of trying.cpp where no optimization is to be used, use a command line of:

ccxscce /Od trying.cpp
See Also


/Og
Syntax
/Og
Description

The option /Og enables global optimizations.With this option set the Intel® C++ Compiler eliminates multiple copies of common sub-expressions, removes invariant sub-expressions from the body of loops, and stores frequently used variables in registers wherever possible.

This option is switched ON by default.

Example

To produce an executable file from a C++ source file of maths.cpp where only global optimization is required, use the command line below. Note that use of option /Od turns off all optimizations including the option /Og, therefore /Og needs to be reset back ON.

ccxscce /Od /Og maths.cpp
See Also


/Oi
Syntax
/Oi[-]
Description

The option /Oi enables the Intel® C++ Compiler to carry out inline expansion of the standard library functions. Inline expansion is where the function call is replaced by the contents of the function itself. This saves having to call the function with all its inherent overheads in terms of time and code.

Use of the /Op option disables this option, standard library functions being used instead.

This option is switched ON by default.

Example

To produce a relocatable object file from a C source file of mailing.c where only global and inline expansion optimizations are required, use the command line below. Note that use of option /Od turns off all optimizations including the options required, which must therefore be specifically turned back ON.

ccxscce /c /Od /Og /Oi mailing.c
See Also


/Op
Syntax
/Op[-]
Description

The option /Op improves the consistency of floating point tests for equality and inequality by disabling optimizations that could change the precision of floating point calculations.

Using the /Op option forces the compiler to load data from memory before each floating point operation, and if required store data back to memory at its end. Such actions ensure that the extra bits which would be held in an intermediate result are eliminated. This increases the code length of the program and reduces its speed.

Use of the /Op option disables any inline generation of floating point library functions which may have been enabled by the /Oi option. Instead standard library functions are used.

Setting the /Za option (disable language extensions) automatically sets the /Op option ON, however it may be disabled again by using the /Op- option after the /Za option on the command line.

Otherwise this option is switched OFF by default.

Example

To produce a relocatable object file from a C source file selected.c where language extensions are turned off, as are any improved floating point consistency activities, use the command line below.

ccxscce /c /Za /Op- selected.c
See Also


/Os
Syntax
/Os
Description

The option /Os enables the Intel® C++ Compiler to make speed optimizations which favor reduced code size. Some speed optimizations increase the code size, others do not. This option enables only optimizations which do not increase the code size.

Normally default optimization is handled by using the group optimization option /O2 which does not include /Os, so this option is switched OFF by default.

Example

To produce a relocatable object file from a C source file of mailing.c where speed optimizations which favor size of code are required, use the command line below. Note that use of option /Os automatically cancels all other default optimization options, so only the size option is set ON.

ccxscce /c /Os mailing.c
See Also


/Ot
Syntax
/Ot
Description

The option /Ot enables the Intel® C++ Compiler to make optimizations which favor speed of program execution. In general the compiler can make optimizations within its generated code which can favor either program speed or program size. This option allows the programmer to select in favor of program speed.

Normally default optimization is handled by using the group optimization option /O2 which includes /Ot, so this option is switched ON by default.

Example

To produce an executable file from a C++ source file of numbers.cpp where optimizations which favour speed of code are required, use the command line below. Note that use of option /Ot automatically cancels all other default optimization options, so only the speed option is switched on.

ccxscce /Ot numbers.cpp
See Also


/Ow
Syntax
/Ow[-]
Description

The option /Ow instructs the compiler not to assume aliasing across function calls. Aliasing is a technique whereby the compiler looks for variables which are redundant. For example they are not required since they only carry an intermediate temporary value within a set of calculations. Or two or more variables refer to the same value. Aliasing also looks for repeated assignment of variables with the same value within a loop, these would be assigned once outside the loop. Aliasing can reduce the run-time of your program by reducing variables and optimizing loops.

This option can be explicitly switched off by adding the optional '-' sign after it. The /Ow- option assumes no aliasing takes place within functions, but may take place across function calls. Pointer variables must be reloaded from memory after each function call.

This option is switched OFF by default.

Example

To produce an executable file from a C source file of geometry.c where cross function aliasing is required, use a command line of:

ccxscce /Ow- geometry.c
See Also


/Ox
Syntax
/Ox
Description

The option /Ox instructs the Intel® C++ Compiler to use maximum optimizations to produce the fastest possible program.

This option has the same effect as combining the following optimization options:

  • /Ob1 enables inlining of source functions
  • /Og enables global optimizations
  • /Oi enables inlining of library functions
  • /Ot enables all speed optimizations
  • /Oy omits frame pointer

This option is switched OFF by default.

This option is the same as /O2 without /Gy.

Example

To produce an executable from a C source file of selected.c where the fastest possible program is required, use the command line below.

ccxscce /c /Ox selected.c
See Also


/P
Syntax
/P
Description

The option /P stops the compilation process after the C/C++ source files have been preprocessed, with the result being written to an output file. This output file has the same name as the source file from which it is derived, but with an extension .i. All preprocessor directives are carried out, conditional compilation is resolved, and macros are expanded. In addition the /P option adds #line directives around those lines removed from the original source file, as being comments or conditionally not required, and around lines added from included files. This ensures that should the preprocessed output be submitted for final compilation any error and other messages will refer to line numbers within the original source. To stop #line directives from being included within the output, file the /EP option should be added.

All comments are removed from the output, unless option /C is used to preserve them.

This option stops the compilation process before it has completed and should not be used in combination with others which behave similarly such as /c, /QH, /QM and /S.

This option is switched OFF by default.

Example

To preprocess a group of source files, without #line directives included, but with comments restored, use the following command. No compilation is carried out.

ccxscce /P /EP /C one.c two.cpp three.c

The precompiled output is placed within the files one.i, two.i and three.i.

See Also


/Q_os_
Syntax
/Q_os_[name]
Description

The option /Q_os_ specifies the expected target operating system. The optional parameter name can have the following values:

cygsim | specifies a Cygnus* simulator environment.
redboot | specifies a Redboot* monitor on an IQ80310 board.

If name is omitted, the default value cygsim is assumed.

By default, this option is not set.

Note icon NOTE.
Besides setting the operating system environment, this option also has the effect of resetting all the other options. Thus, any options given before the OS option are ignored, and an OS option given on the command line would erase the effect of the default configuration that was read from the configuration file associated with the driver. This lets users to use the existing drivers with their own configuration files without having to create new drivers.

Example

The following command line neutralizes any settings of the original configuration file, specifies that the target is a Redboot* monitor on an IQ80310 board, and applies all settings defined in the configuration file myconfig.cfg:

ccxscce /Q_os_redboot @~/myconfig.cfg myfile.c
See Also

"Configuration Files"


/QA
Syntax
/QA[-]
Description

If the option /QA is set, the predefined preprocessor macros and all assertions are enabled. If the option is switched off explicitly by setting /QA-, the predefined preprocessor macros and all assertions are disabled. Predefined macros starting with "__" (two underscores) are not affected by this option; they are always enabled.

This option is set by default.

Example

To disable the predefined macros during the compilation of the file sourcefile.cpp, use the following command. Note that predefined macros starting with two underscores are still enabled.

ccxscce /QA- sourcefile.cpp
See Also

"Defining Macros"


/QAname
Syntax
/QAname [value]
Description

The option /QA creates an assertion with the name name and the value value. This is equivalent to the assertion

#assert name(value)

in the first line of each source file. In the subsequent source code, the assertion can be evaluated with the #if preprocessor directive.

By default, this option is not set.

Note icon NOTE.
If the parameter value is not specified, the compiler silently ignores the option.

Example

Consider the following source code fragment:

#if #talk(politely)
printf("Please, ");
#endif
printf("enter your password\n");

If you want the program to print "Please, enter your password" rather than just "enter your password", use the following command for compilation:

ccxscce /QAtalk politely getpasswd.c


/Qansi
Syntax
/Qansi[-]
Description

If the option /Qansi is set, the Intel® C++ Compiler assumes the source to be in conformance with the ISO/IEC 9099: 1990(E) standard, also known as ANSI C89 standard. Aberrations of this standard will cause diagnostic messages.

By default, this option is not set.

Example

To test a source file for ANSI conformance, use the following command:

ccxscce /Qansi /Zs sourcefile.cpp
See Also

"Language Conformance Options"


/Qexpand_env
Syntax
/Qexpand_env [text]
Description

The option /Qexpand_env expands all environment variables in the given text, text, and then processes the resulting text as command line options or file specifications.

Environment variable references in the parameter text must be in the form $(varname). As a special case, $() expands to the directory in which the compiler is located. This can be used to locate files or directories relative to the location of the compiler.

By default, this option is switched off.

Example

In the following command line, the option /Ba specifies the path to the alternative assembler altas.exe. The environment variable ALTINSTALL refers to the installation directory of this assembler. The option /Qexpand_env replaces $(ALTINSTALL) by its value so that the option /Ba receives the correct path as parameter.

ccxscce /Qexpand_env,/Ba$(ALTINSTALL)/bin/altas.exe sourcefile.cpp
See Also

"Environment Variables"


/QH
Syntax
/QH
Description

The option /QH causes the Intel® C++ Compiler to output a list of all the include files declared within the source files. The compilation process does not take place. Full path and filename of each included file is output to the standard output stream stdout.

This option stops the compilation process before it has completed and should not be used in combination with others which behave similarly such as /c, /E, /QH, /QM, and /S.

This option is switched OFF by default.

Example

To produce an output list of all included files directly or indirectly referenced by the source files given, use the command line below. No compilation of the four given files takes place, and output is to the standard output stream stdout.

ccxscce /QH one.c two.cpp three.c four.cpp
See Also


/Qip
Syntax
/Qip
Description

The option /Qip enables interprocedural optimizations within the same source file. When this option is selected, the Intel® C++ Compiler attempts to optimize across all the functions within a single source file. Where several source files are specified within a command line environment each file is optimized separately.

This option is switched OFF by default.

Example

To produce an executable file named geometric.exe from a C++ source file trying.cpp where interprocedural optimizations are required within the source file, together with full debugging information, use the command line below.

ccxscce @commandf.cmd trying.cpp

Where the response file commandf.cmd has been used purely for convenience, and for its ability to add comments. This response file has the following contents:

#create full debug information
/Zi
#specify interprocedural optimization within each single file
/Qip
#rename output executable file
/Fegeometric.exe
See Also


/Qip_no_inlining
Syntax
/Qip_no_inlining
Description

The option /Qip_no_inlining disables inlining that would result from the /Qip or /Ob2 interprocedural optimizations, but has no effect on other interprocedural optimizations. This option has no effect on user-directed inlining using option /Ob1. When inlining is enabled the Intel® C++ Compiler is directed to replace the calls of functions with their contents where appropriate. This form of optimization avoids unnecessary function calls with all the inherent overheads associated with such calls.

This option is switched OFF by default.

Example

To produce an executable file named hyper.exe from source files hyper.c and bolic.c, with small code optimizations but no inlining, use the following command line.

ccxscce /O1 /Qip_no_inlining hyper.c bolic.c
See Also


/Qipo
Syntax
/Qipo
Description

The option /Qipo enables interprocedural optimizations across all source files of a program. To accomplish this the Intel® C++ Compiler creates a mock object code file for all source files specified on the command line. These mock files are then used at the linking stage which must be called indirectly through the compiler using the /Qipo option.

This option is switched OFF by default.

Example

To produce an executable file from C++ source files where interprocedural optimizations are required across all functions within all given source files, together with several selected optimization options, use the command line below.

ccxscce @commandf.cmd one.cpp two.cpp three.cpp

Where the response file commandf.cmd has been used so that many optimizations can be selected and comments on their actions added. This response file has the following contents:

#disable all optimization defaults
/Od
#specify inline expansion of all functions
#within the discretion of the compiler
/Ob2
#specify interprocedural optimization across all files
/Qipo
#specify fast code optimizations
/Ot
#specify global optimizations
/Og
See Also


/Qipo_c
Syntax
/Qipo_c
Description

The option /Qipo_c causes the Intel® C++ Compiler to generate a single output object file regardless as to how many input source files were specified within the command line environment. The object code generated from the compilation of all the specified input source files are placed within a single output file which has a pre-defined name of ipo_out.obj. This object file can then be used in further linking steps.

Should the compilation process be halted before any object code is generated (for example by the use of the /S option) then no multifile object file is generated.

This option implicitly sets /Qipo.

Note icon NOTE.
If the command line option /Qip is set, /Qipo_c should be set, too. Otherwise, the compiler sets /Qipo_c implicitly and issues a warning message.

This option is switched OFF by default.

Example

To produce a single relocatable object file from several source files, use the following command line. The output file is named ipo_out.o by default.

ccxscce /Qipo_c one.cpp two.cpp three.cpp
See Also


/Qipo_obj
Syntax
/Qipo_obj
Description

The option /Qipo_obj is used in conjunction with the /Qipo option to produce real object files during the compilation stage when interprocedural optimizations are implemented.

Normally to accomplish interprocedural optimizations across all source files of a program the Intel® C++ Compiler creates mock object files which are later linked in a special linking stage.

Should it be required that the linker be directly called then this /Qipo_obj option should be specified in conjunction with the /Qipo option, to produce real object files.

This option implicitly sets /Qipo.

This option is switched OFF by default.

Example

To produce real object files from C++ source files where multifile interprocedural optimizations are required across all the functions within the given source files, use the command line below.

ccxscce /c /Qipo /Qipo_obj alpha.cpp beta.cpp gamma.cpp
See Also


/Qipo_S
Syntax
/Qipo_S
Description

The option /Qipo_S causes the Intel® C++ Compiler to generate a single output assembly file regardless as to how many input source files were specified within the command line environment. The assembly language code generated from the compilation of all the specified input source files are placed within a single output file which has a pre-defined name of ipo_out.asm. This assembly file can then be used in further linking steps.

Should the compilation process be halted before any object code is generated (for example by the use of the /Zs option) then no multifile assembly file is generated.

This option implicitly sets /Qipo.

This option is switched OFF by default.

Example

To produce a single assembly file from several source files, use the following command line. The output file is named ipo_out.s by default.

ccxscce /Qipo_S one.cpp two.cpp three.cpp
See Also


/Qlocation
Syntax
/Qlocation,tool,path
Description

The option /Qlocation is used to specify alternative tools to be used by the Intel® C++ Compiler, such as the assembler and the linker. By default the Intel® C++ Compiler is set up to use tools from the Intel C++ Software Development Tool Suite, but these may be changed by using this option where tool takes the options of:

Tool | Description
asm | Selects the assembler.
c | Selects the compiler.
cpp | Selects the preprocessor.

The parameter path specifies the directory path and tool filename.

This option is switched OFF by default.

Example

To produce a relocatable object file testing.o from source file testing.c, using the alternative assembler alt_asm.exe, use a command line of:

ccxscce /Qlocation,asm,c:\binasms\alt_asm.exe /c testing.c
See Also


/QM
Syntax
/QM
Description

The option /QM causes the Intel® C++ Compiler to generate lines of Makefile dependency information onto its standard output stdout. These can be redirected into a Makefile file. The information is based on the include statements found within the source files. This allows any Integrated Development Environment to identify what source files need to be recompiled should any of these include files be altered.

This option stops the compilation process before it has completed and should not be used in combination with others which behave similarly such as /c, /E, /QH, and /S.

This option is switched OFF by default.

Example

To produce lines of Makefile dependency information based upon the source files given, use the command line below. No compilation of the four given files takes place, and information is sent to the standard output stream stdout.

ccxscce /QM one.c two.cpp three.c four.cpp
See Also


/Qnobss_init
Syntax
/Qnobss_init
Description

The option /Qnobss_init causes the Intel® C++ Compiler to place variables that are initialized with zero into the DATA section of the assembly code. Normally such variables are placed in the BSS section of the assembly code.

This option is switched OFF by default.

Example

To produce an assembly listing file folder.s from the source file one.cpp, where zero initialized variables are placed into the DATA section, use the following command line.

ccxscce /S /Fafolder /Qnobss_init one.cpp


/Qoption
Syntax
/Qoption,tool,optionlist
Description

The option /Qoption can be used to pass options to a subsequent tool in the compilation process. Depending on the tools used in the compilation process, the parameter tool can be, for example, asm for the assembler. The list of options, optionlist, is passed as command line to the tool. For a description of these options, please refer to the documentation of the specified tool.

Currently, only one value for tool is supported: asm for the assembler.

Note icon NOTE.
If the list of options contains white space, the list must be enclosed in double quotes.

This option is switched OFF by default.

Example

To pass the option "/o outfile" to the assembler asm, use the following command:

ccxscce /Qoption,asm,"/o outfile" sourcefile.cpp


/Qprec
Syntax
/Qprec
Description

The option /Qprec disables the floating point optimization. This optimization would speed up the execution and reduce the floating point precision. Setting the option therefore improves the precision and slows down the execution.

This option is set OFF by default.

Example

To produce an executable file from the C++ source file calculus.cpp, with improved floating point precision, use a command line of:

ccxscce /Qprec calculus.cpp
See Also


/Qprec_div
Syntax
/Qprec_div
Description

The option /Qprec_div disables the floating point division to multiplication optimization. This normally ON optimization replaces any divisions which use a constant with the multiplication of the inverse of that constant. This is normally done because divisions take longer than multiplications.

This option is switched OFF by default which means that the optimization effect is ON.

Example

To produce an executable file from C++ source file algebra.cpp, with selected optimizations including /Qprec_div, use a command line of:

ccxscce @commandf.cmd algebra.cpp

Where the response file commandf.cmd has been used so that many optimizations can be selected and comments on their actions added. This response file has the following contents:

#specify optimization of floating point division to multiplication
/Qprec_div

#specifying any optimization option will disable all optimization
#defaults. Extra optimizations cannot be simply added
#So need to replace the defaulted optimizations
/O2
See Also


/QRinterwork-return
Syntax
/QRinterwork-return
Description

The option /QRinterwork-return specifies that mixed ARM* and Thumb* functions are to be used within the application.

This option is switched ON by default.

Note icon NOTE.
This option cannot be switched off.

See Also


/QRthumb
Syntax
/QRthumb
Description

If the option /QRthumb is set, the Intel® C++ Compiler generates Thumb* code.

Example

The following command line causes the source file to be compiled into Thumb* code.

ccxscce /QRthumb source.c
See Also

"/QRinterwork-return"
Intel® Assembler Reference Manual


/QRxscale
Syntax
/QRxscale
Description

The option /QRxscale specifies that code for the Intel XScale® technology is to be generated.

This option is set ON by default.

Note icon NOTE.
This option cannot be switched off. It is implemented for compatibility reasons only.

See Also

"/QRinterwork-return"


/Qsox
Syntax
/Qsox[-]
Description

The option /Qsox enables the saving of compiler options and version information in the executable file.

This option is switched off by default, so the information is not saved in the executable file. You can use /Qsox- to explicitly switch it off.

Example

To produce an executable file from the C source file testing.c, where the compiler version information is required in the executable file, use a command line of:

ccxscce /Qsox testing.c


/QTP
Syntax
/QTP[target]
Description

The option /QTP specifies the target processor for the compilation. The parameter target can have the following values:

Value
Description
xsc1
    Intel XScale® microarchitecture 80200
xsc2
    Intel® PXA210/250
xsc3
    Intel® PXA27x with Intel® Wireless MMX(TM) technology
xsc4
    Intel® PXA27x with Intel® Wireless MMX™ 2 technology

This option is set to xsc1 by default.


/Qunroll
Syntax
/Qunroll[num]
Description

The option /Qunroll specifies the maximum number of times to unroll a loop. This number is set by the optional number num. If num is omitted then the compiler decides itself on the number, taking into account the complexity and size of the loop. A value of num=0 disables this unroll feature.

Loop unrolling is where the contents of the loop are repeated several times. This gets rid of the loop structure with its jumps and checking code, which is important in RISC pipeline processing. The resulting code runs faster, but the code size increases.

This option is switched ON by default, with number num omitted. So the compiler decides on the maximum number of times to unroll a loop.

Example

To produce an executable file from a C source file with unrolling maximum value of 4, use a command line of:

ccxscce /Qunroll4 alpha.c


/Qvec
Syntax
/Qvec[-]
Description

The option /Qvec switches on the vectorizer. To switch off the vectorizer, use /Qvec-.

If Intel® Wireless MMX(TM) technology is enabled, this option is set by default. Otherwise, the option is switched off by default.

Example

The following command line explicitly switches on the vectorizer:

ccxscce /Qvec source.c
See Also

"Vectorization"


/Qwd
Syntax
/Qwdnum{,num}
Description

The option /Qwd disables the diagnostic messages specified by the parameter (or list of parameters), num, which denotes the message number. If more than one parameter is specified, they must be separated by commas.

Note icon NOTE.
This option works on soft diagnostics (warnings and remarks) only. Hard diagnostics (error messages) cannot be switched off.

This option is switched off by default.

Example

To suppress the warning message 945, "Type qualifier ignored", use the following command:

ccxscce /Qwd945 sourcefile.cpp
See Also


/Qwe
Syntax
/Qwenum{,num}
Description

The option /Qwe promotes the diagnostic messages specified by the parameter (or list of parameters), num, to error messages. If more than one parameter is specified, they must be separated by commas. The number num denotes the message number.

This option is switched off by default.

Example

To change the warning messages 170 and 945 to error messages, use the following command:

ccxscce /Qwe170,945 sourcefile.cpp
See Also


/Qwn
Syntax
/Qwnnum
Description

The option /Qwn limits the number of hard diagnostic (error) messages to the specified value, num. If more error messages are to be issued, the Intel® C++ Compiler stops parsing.

This option is switched on by default, with a limit of 100.

Example

To abort compilation when the third error occurs, use the following command:

ccxscce /Qwn2 sourcefile.cpp
See Also


/Qwr
Syntax
/Qwrnum{,num}
Description

The option /Qwr demotes the warning messages specified by the parameter (or list of parameters), num, to remark messages. If more than one parameter is specified, they must be separated by commas. The number num denotes the message number.

Note icon NOTE.
This option works on warnings only. Hard diagnostics (error messages) cannot be changed.

This option is switched off by default.

Example

To change the warning messages 170 and 945 to remark messages, use the following command:

ccxscce /Qwr170,945 sourcefile.cpp
See Also


/Qww
Syntax
/Qwwnum{,num}
Description

The option /Qww promotes the remark messages specified by the parameter (or list of parameters), num, to warning messages. If more than one parameter is specified, they must be separated by commas. The number num denotes the message number.

Note icon NOTE.
This option works on remarks only. Hard diagnostics (error messages) cannot be changed.

This option is switched off by default.

Example

To change the remark messages 193 and 577 to warning messages, use the following command:

ccxscce /Qww193,577 sourcefile.cpp
See Also


/S
Syntax
/S
Description

The option /S stops the compilation process after an assembly file has been generated for each source file on the command line. This suppresses the implicit call to the Assembler and Linker, which must be called later to produce an executable file. The Intel® C++ Compiler accepts C/C++ source files, usually with default extensions of "c" and "cpp", or pre-processed files with an extension of"i". The generated assembly files take on the name of the source file from which it was produced with an extension of "asm".

This option is switched OFF by default.

Use of the /TC, /Tc, /TP, /Tp options can be used to force acceptance of source files as C/C++ sources with extensions other than .c and .cpp.

The option /S overrides the option /c which is used to generate object files.

The /S option also overrides the following options if they are set:

    /E
    /EP
    /Fe
    (set by default, therefore /S and /Fe should not be used together)
    /P
    /QH
    /QM
    /Zs

Example

To produce an assembly file named testing.asm from a C source file of trying.cpp, use a command line of:

ccxscce /S /Fatesting trying.cpp
See Also


/TC
Syntax
/TC
Description

The option /TC instructs the Intel® C++ Compiler to treat all source files on the command line as though they were C source files, regardless as to their extensions, the only exceptions being files specifically typed by the /Tp option.

Normally only files with .c or .C extensions would be accepted as C source files.

This option is switched OFF by default.

Obviously this option cannot be used in conjunction with the /TP option.

Example

To produce an executable file from a C source file of none standard extension testing.hat, use a command line of:

ccxscce /TC testing.hat
See Also


/Tc
Syntax
/Tcfilename
Description

The option /Tc instructs the Intel® C++ Compiler to treat the given source file filename as a C source file regardless as to its name and extension. Normally only files with .c or .C extensions would be accepted as C source files.

This option can be used in conjunction with the global source options /TC and /TP if required.

There can be multiple occurrences of this option.

This option is switched OFF by default.

Example

To produce an executable file from C source files of none standard extension testing.hat, and standard extension tried.c, use a command line of:

ccxscce /Tctesting.hat tried.c
See Also


/TP
Syntax
/TP
Description

The option /TP instructs the Intel® C++ Compiler to treat all source files on the command line as though they were C++ source files, regardless as to their extensions, the only exceptions being files specifically typed by the /Tc option.

Normally only files with .cpp or .CPP extensions would be accepted as C++ source files.

This option is switched OFF by default.

Obviously this option cannot be used in conjunction with the /TC option.

Example

To produce an executable file from a C++ source file of none standard extension testing.hat, use a command line of:

ccxscce /TP testing.hat
See Also


/Tp
Syntax
/Tpfilename
Description

The option /Tp instructs the Intel® C++ Compiler to treat the given source file filename as a C++ source file regardless as to its name and extension.

This option can be used in conjunction with the global source options /TC and /TP if required. Normally only files with .cpp or .CPP extensions would be accepted as C++ source files.

There can be multiple occurrences of this option.

This option is switched OFF by default.

Example

To produce an executable file from C++ source files of none standard extension testing.hat, and standard extension tried.cpp, use a command line of:

ccxscce /Tptesting.hat tried.cpp
See Also


/U
Syntax
/Uname
Description

The option /U suppresses any previous definition of the given macro name. It is equivalent to the use of the directive #undef.

Multiple use of this option is allowed if several macro names need to be suppressed.

This option is switched OFF by default.

Example

To produce an executable file from a C source file of trying.c where it is necessary to suppress the macro tools, use a command line of:

ccxscce /Utools trying.c
See Also


/u
Syntax
/u
Description

The option /u suppresses all previously defined macro names, other than those starting with __. It is equivalent to a global /U option.

This option is switched OFF by default.

Example

To produce an executable file from the C source file paramb.c, where all macro names are suppressed, use the command line shown below.

ccxscce /u paramb.c
See Also


/V
Syntax
/Vstring
Description

The option /V embeds the text string string within any generated object file. Usually this text string is used to label the object file with a version number or copyright notice.

The text string is normally terminated by the first white space (spaces or tabs). However these can be accommodated by enclosing a multi-word text string in double quotes. Should a double quote be required as part of the string it must be preceded by a backslash (\).

This option is switched OFF by default.

Example

To produce object files with embedded copyright declarations within them use the following command line.

ccxscce /c /V"copyrighted by megalith studios" alpha.cpp beta.cpp gamma.cpp

Compilation stops before linking due to the /c option, to produce the resultant object files of alpha.obj, beta.obj and gamma.obj, each having the copyright declaration within it.

See Also

"/c"


/W
Syntax
/Wnum
Description

The option /W specifies the level, if any, of warning messages to be generated when compiling the source files. This is controlled by the specified number, num, as follows:

Number
Description
0
    No warning messages are generated.
1
    Severe warning messages only are generated. This is the default condition for this option.
2
    Less severe warning messages are generated, as well as those of level /W1.
3
    Generates warnings that are less severe than those at setting /W2 and includes such warnings about making function calls before declaring their prototypes. It also generates warning messages of level /W2. This level is recommended for normal use.
4
    Generates informational warnings, as well as those of level /W3.

Should the number be omitted then this option is treated as if /W0, no warning messages are generated.

The default condition for this option is W1, generate only severe warning messages.

Example

To produce a relocatable object file only from the C source file square.c, where severe warning messages only are to be generated, use the command line shown below.

ccxscce /W1 /c square.c
See Also


/WX
Syntax
/WX
Description

The option /WX promotes all warning messages to error messages.

This option is switched OFF by default.

Example

To change any warning into an error message, use the following command:

ccxscce /WX sourcefile.cpp
See Also


/w
Syntax
/w
Description

The option /w specifies that no warning messages are to be generated when compiling the source files. This is the same as setting option /W0.

The default condition for this option is OFF.

Example

To produce an assembly file only from the C source file square.c, where no warning messages are to be generated, use the command line shown below.

ccxscce /w /S square.c
See Also


/X
Syntax
/X
Description

The option /X is used to stop the Intel® C++ Compiler from searching standard directories for the include files. These standard directories are specified by the environment variables PATH and INCLUDE. Searching can be redirected from the standard directories to non-standard directories by using the /I option in conjunction with this /X option.

This option is switched OFF by default.

Example

To produce an executable file from the C source file square.c, where the standard include directory has been replaced by the directory C:\new_incdir, use the command line shown below. Any include files specified within the source file will be searched for in the current directory and then the new directory only.

ccxscce /X /IC:\new_incdir square.c
See Also


/Yc
Syntax
/Yc[filename]
Description

The option /Yc is used to create a precompiled header file. The name of this file is specified by the filename parameter or, by default, the name of the source file with the extension changed to "pchi".

The precompiled header can subsequently be used through use of the /Yu option. Should both options /Yc[filename] and /Yu[filename] be used on the same command line with the same filenames then /Yc takes precedent. See example for /Yu.

This option is not allowed where multiple source files are used on the command line.

This option is switched OFF by default.

Examples

To create a precompiled header file named head.pchi from a source file alpha.cpp use the following command line.

ccxscce /Ychead.pchi alpha.cpp

The following command line makes the compiler create a precompiled header file named alpha.pchi.

ccxscce /Yc alpha.cpp
See Also


/Yu
Syntax
/Yu[filename]
Description

The option /Yu is used to instruct the compiler to use an existing precompiled header within the current compilation. That precompiled header, having been created by a previous use of the /Yc option on the command line, has the same default name as the option /Yc unless another name is specified by use of the /Fp option. The optional filename refers to a header file name and is explained further below.

Without the optional filename the Intel® C++ Compiler uses the contents of the precompiled file in place of any source code occurring up to the first #pragma hdrstop directive it meets, and continues to compile the source code following. Failure to find such a pragma within the source code will lead to an error message and the compilation being unsuccessful.

With a given header filename the Intel® C++ Compiler uses the contents of the precompiled file in place of any source code occurring up to and including the included header file filename. The remaining source code is then compiled from this location onwards.

Should both options /Yc[filename] and /Yu[filename] be used on the same command line with the same filenames then /Yc takes precedence.

This option is not allowed where multiple source files are used on the command line.

This option is switched OFF by default.

Example

To create an executable file from source file alpha.cpp using a previously created precompiled header file named Head.pchi use the following command line.

ccxscce /Yufuture.h /FpHead.pchi alpha.cpp

Where the contents of the precompiled header file Head.pchi will be used in place of any source code before, and including, the include file future.h. Further compilation of the source will then take place after the location of the include file future.h. This may be at the start of the source file, for example,

#include <stdio.h>
#include <string.h>
#include "future.h"

int main(void)
{ ...
...
...
}

Here the precompiled header file Head.pchi will be used instead of the contents of the three include files stdio, string and future. Compilation of the remaining source will then take place at the start of the main function.

Or the include file "future.h" may be encountered within the source file later on, if so further compilation occurs of any more source code following it.

Once compilation is complete, the process goes on to produce an executable file, via the linker.

See Also


/YX
Syntax
/YX[filename]
Description

The option /YX is used to instruct the compiler to either create or use an existing precompiled header file within the current compilation. Its activities are the same as the /Yc and /Yu options, with the compiler automatically deciding whether to create or use a precompiled header. The name of the precompiled header file used is either the default name of the /Yc option or another that is specified by the /Fp option. The filename associated with the /YX option is optional and refers to the name of a header file, this will be clarified below.

If no precompiled header file exists then one will be created, the Intel® C++ Compiler carrying out the activities of the /Yc option. Should no filename be given then the compiler will precompile the source code until a #pragma hdrstop directive is encountered.

Should a filename be given it will be that of an included header file; in which case precompilation will take place upon the source code until this included header file is reached, the header file being included within the precompiled file. Precompilation then ends.

If a precompiled header file already exists then the Intel® C++ Compiler will include this precompiled header file within the current compilation, following the same rules as the /Yu option. Should no filename be given then the compiler will include the contents of the existing precompiled header file in the current compilation in place of the source code up until the first #pragma hdrstop directive is encountered. Compilation will then continue of the source code following that directive.

Should a filename be given it will be that of an included header file; in which case the compiler will include the contents of the existing precompiled header file in the current compilation in place of the source code up until the inclusion of that header file. Compilation will then continue of the source code following that inclusion.

This option is switched off by default.

Example

To create a precompiled header file Head.pchi from source file alpha.cpp the following command line can be used.

ccxscce /YX /FpHead.pchi alpha.cpp

Where the precompilation will take place through the source file alpha.cpp until a #pragma hdrstop directive is reached.

To use an existing precompiled header file with name alpha.pchi the following command line can be used.

ccxscce /YXfuture.h alpha.cpp

The compiler takes the precompiled information from the precompiled header file in place of source code up to and including the first occurrence of the include file "future.h". For example if the source code was:

#include <stdio.h>
#include <string.h>
#include "future.h"
#include "twice.h"

int main(void)
{ ...
...
...
}

Then compilation would continue from the #include "twice.h" statement.

Or the include file "future.h" may be encountered within the source file later on, if so further compilation occurs only on any more source code following it.

Once compilation is complete, the process goes on to produce an executable file, via the linker.

See Also


/Za
Syntax
/Za
Description

By default the compiler accepts certain extensions to the standard C language. The option /Za directs the Intel® C++ Compiler to adhere strictly to the ANSI standard for C(90) / C++(xxx).

When this option is set, some floating point operations will have their consistency improved by automatically setting option /Op.

If this option is set, the preprocessor macro _MSC_EXTENSIONS is undefined.

This option is switched OFF by default.

Example

To produce an executable file, with full debugging information from a C source file of the name cylinder.c, using only standard C language interpretation the command line shown below.

ccxscce /Zi /Za cylinder.c
See Also

"/Op"


/Zd
Syntax
/Zd
Description

The option /Zd specifies the Intel® C++ Compiler to generate symbol and line number information within the object code for use by the source-level debugger.

This option is a subset of the more powerful /Zi option which is used to produce full debugging information. If the option /Zi is set, there is no need to also set option /Zd.

The option /Zd is switched OFF by default.

Example

To produce an executable file, with symbol and line number information, from a C source file of the name trying.c, use the command line shown below.

ccxscce /Zd trying.c
See Also

"/Zi"


/Zg
Syntax
/Zg
Description

The option /Zg instructs the Intel® C++ Compiler to output the list of function prototypes for all the functions found within the source files to be compiled. This list is sent to the standard output stdout, which may be redirected into a file. Such a list is useful for verification purposes to ensure their functionality is correct. No further action takes place once the list is generated, the source files are not compiled.

This option is switched OFF by default.

Example

To produce an output list of function prototypes for all functions within the program testf.c, use the command line shown below. No compilation of the source file takes place.

ccxscce /Zg testf.c


/ZI
Syntax
/ZI[-]
Description

The option /ZI is identical to the command line option /Zi.

See Also

"/Zi"


/Zi
Syntax
/Zi[-]
Description

The option /Zi causes the Intel® C++ Compiler to generate full symbolic debugging information for use by the source-level debugger. This symbolic debugging information is placed within a special program database file and includes the names and types of variables and functions, as well as source line numbers.

Since line numbers are included in the information, the option /Zd need not be set at the same time.

The option /Zi is switched OFF by default. You can switch it off explicitly by setting /Zi- on the command line.

Example

To produce an executable file from a C source file of the name trying.c, use the command line shown below. Note that in this case, optimization is disabled by default:

ccxscce /Zi trying.c
See Also


/Zp
Syntax
/Zp[num]
Description

The option /Zp defines the default alignment of structure members. The parameter num can have the following values:

Value
Description
    1
    The structure members are packed (no gap between members).
    2
    The structure members are being aligned to even addresses (2-byte boundaries).
    4
    The structure members are being aligned to 4-byte boundaries.
    8
    The structure members are being aligned to 8-byte boundaries.
    16
    The structure members are being aligned to 16-byte boundaries.

By default, structure members are being aligned to 8-byte boundaries.

Example

To align all structure members to 16-byte boundaries, use the following command:

ccxscce /Zp16 sourcefile.cpp


/Zs
Syntax
/Zs
Description

The option /Zs instructs the Intel® C++ Compiler to only check the syntax of all the source files specified within the command line environment, but not to compile them. Any errors are sent to the standard error output stream. This is useful for syntax checking of the source prior to actual compilation.

This option is switched OFF by default.

Example

To run a syntax check on the source file testf.c, use the command line shown below. No compilation of the source file takes place, and any errors are sent to the standard error stream.

ccxscce /Zs testf.c


Pragmas

This chapter provides a detailed description of all pragmas supported by the Intel® C++ Compiler.

The chapter comprises the following sections:

  • "Introduction" covers the usage of Intel® C++ Compiler pragmas.
  • "Microsoft* Compatible Pragmas" describes all pragmas that are supported due to Microsoft* compatibility. The pragmas are listed in alphabetical order.


Introduction

Pragmas are a portable method of passing options within the source file to the compiler.

The syntax of pragmas is as follows:

#pragma pragma_name { tokens }

pragma_name is the name of the pragma that may be specified in upper case or lower case letters. Pragmas that are unknown to the Intel® C++ Compiler are ignored.

The tokens following the keyword #pragma are processed by the C/C++ preprocessor according to the ANSI standard.


Microsoft* Compatible Pragmas

The following section lists Microsoft* pragmas which are supported by the Intel® C++ Compiler. For compatibility, all unsupported Microsoft pragmas can be called without error. However, they have no effect on the compilation process.

This section describes the following pragmas:

"alloc_text"

"bss_seg"

"code_seg"

"comment"

"component"

"const_seg"

"data_seg"

"function"

"hdrstop"

"include_alias"

"intrinsic"

"message"

"optimize"

"pack"

"warning"


alloc_text
Syntax
#pragma alloc_text( "textsection", func1, ... )
Description

The pragma alloc_text specifies a text section textsection where function definitions of functions func1, ... are allocated.

Example: Pragma alloc_text
double funct1(int );
char funct2(int );

#pragma alloc_text("testname",funct1,funct2)

double funct1(int a){
return(a*a);
}

char funct2(int a){
return((char)a);
}

See Also

MSDN Library


bss_seg
Syntax
#pragma bss_seg( ["sectionname"[,"sectionclass"]] )
Description

The pragma bss_seg specifies a section sectionname that is to be used as default section for uninitialized data. The default value for sectionname is .bss.

Note icon NOTE.
The parameter sectionclass is ignored. It is accepted for compatibility reasons.

Example: Pragma bss_seg
#pragma bss_seg("testsection")

int a=0;
char b='\0';

int main(){
return(0);
}
See Also

"data_seg"
MSDN Library


code_seg
Syntax
#pragma code_seg ( ["sectionname"[,"sectionclass"]] )
Description

The pragma code_seg specifies a code section sectionname that is to be used as default section for functions. The default value for sectionname is .text.

Note icon NOTE.
The parameter sectionclass is ignored. It is accepted for compatibility reasons.

Example: Pragma code_seg
#pragma code_seg("Testsection")
int funct1(){
char* a="Testsection";
return(a[0]);
}

int main(){
return(0);
}
See Also

MSDN Library


comment
Syntax
#pragma comment( type [, string] )
Description

The pragma comment puts a comment into an object file or executable file.

Example: Pragma comment
#pragma comment(user,"You will find this text as a comment in the object file")

int main(){
return(0);
}


component
Syntax
#pragma component( browser, { on | off ) [, references [, name]] )
#pragma component( minrebuild, on | off )
Description

The pragma component is used to turn the collecting of browse information on or off. By the argument references, you can specify if references are to be ignored. The parameter name specifies the name of the references to be ignored.
minrebuild prevents the compiler from collecting any class dependency information.

Example: Pragma component
#pragma component(browser,on)
#include<stdio.h>

int main()
{
int i;
int *ri=&i;

int j;
int *rj=&j;

*ri=5;
*rj=25;

printf("Hello world!\n%d%d",i,j);
return(0);
}
See Also

MSDN Library


const_seg
Syntax
#pragma const_seg( ["sectionname"[, "sectionclass"] ] )
Description

The pragma const_seg specifies a section sectionname that is to be used as default section for constant data.The default value for sectionname is ".const".

Note icon NOTE.
The parameter sectionclass is ignored. It is accepted for compatibility reasons.

Example: Pragma const_seg
#pragma const_seg("testsection")
const char a='T';
const int b=12;

int main(){
return(0);
}
See Also

"data_seg"
MSDN Library


data_seg
Syntax
#pragma data_seg( ["sectionname"[, "sectionclass"] ] )
Description

The pragma data_seg specifies a section sectionname that is to be used as default section for initialized and uninitialized data.

Example: Pragma data_seg
#pragma data_seg("testsection")

int a=0;
char b='\0';

int main(){
return(0);
}

See Also

"bss_seg"
"const_seg"
MSDN Library


function
Syntax
#pragma function( func1 [, func2, ...] )
Description

The pragma function generates calls to the functions listed in the argument list.

Example: Pragma function
#include<string.h>
#pragma function(strcpy)
int main(){
char b[6];
strcpy(b,"Hello");
return(0);
}


hdrstop
Syntax
#pragma hdrstop [( "headerfile" )]
Description

If a source code contains the pragma hdrstop, the compilation status up to the pragma location is saved. The compilation status is saved into the precompiled header file headerfile.

The default value for headerfile is the source file name with extension "pchi".

Example: Pragma hdrstop
#pragma hdrstop("c:\myprojects\include\myheader.pchi")

See Also

MSDN Library


include_alias
Syntax
#pragma include_alias( "shortname", "filename" )
#pragma include_alias( <shortname>, <filename> )
Description

The pragma include_alias enables to use the short filename shortname instead of the long filename filename.

Example: Pragma include_alias
#pragma include_alias("myheader.h","include_alias.h")
#pragma include_alias(<mystdio.h>,<stdio.h>)

#include "myheader.h"
#include <mystdio.h>

int funct1(int, char);

int main(){
int a;
a=funct1(90,'D');
printf("%i\n",a);
return(0);
}

int funct1(int a, char b){
return(a-(int)b);
}


intrinsic
Syntax
#pragma intrinsic( func1 [, func2, ...] )
Description

The pragma intrinsic generates calls to functions listed in the argument list. The functions in the argument list are intrinsic functions.

Example: Pragma intrinsic
#include<string.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#pragma intrinsic(_lrotl,_lrotr,_rotl,_rotr,_strset,abs,fabs,labs,memcmp,memcpy,memset,strcat,strcmp,strcpy,strlen,acos,asin,cosh,fmod,pow,sinh,tanh,atan,exp,log10,sqrt,atan2,log,sin,tan,cos)

int main()
{
char varchar1[10]="Hello",varchar2[10]="world";
int varint;
double vardouble;
long varlong;
unsigned int varunin;
unsigned short varunsh;
unsigned long varunlo;

varunlo=_lrotl(0x00acaca,1);
varunlo=_lrotr(0x00acaca,1);

varunin=_rotl(0x00aca,1);
varunin=_rotr(0x00aca,1);

_strset(varchar1,2);

varint=abs(-5);
vardouble=fabs(-5.6);
varlong=labs(-5);

memcpy(varchar1,varchar2,5);
varint=memcmp(varchar1,varchar2,5);
memset(varchar1,'*',5);

strcpy(varchar1,varchar2);
strcat(varchar1,"*");
varint=strcmp(varchar1,varchar2);
varint=strlen(varchar1);
vardouble=acos(3);
vardouble=asin(3);
vardouble=cosh(3);
vardouble=fmod(3,4);
vardouble=pow(3,5);
vardouble=sinh(3);
vardouble=tanh(3);
vardouble=atan(3);
vardouble=exp(3);
vardouble=log10(3);
vardouble=sqrt(3);
vardouble=atan2(3,2);
vardouble=log(3);
vardouble=sin(3);
vardouble=tan(3);
vardouble=cos(3);

return(0);
}


message
Syntax

#pragma message( messagestr )

Description

The pragma message sends a literal string messagestr to the standard output at compile time.

Example: Pragma message
#pragma message("This is a test message")

int main()
{
return(0);
}
See Also

MSDN Library


optimize
Syntax
#pragma optimize ( "[optlist]", {on | off} )
Description

The pragma optimize specifies compiler optimizations. The parameters on or off specify whether options of the optimization list optlist are turned on or off.

Example: Pragma optimize
#pragma optimize("s",on)
#include<stdio.h>

int main()
{
int i = -100;
while( i < 0 )
{
i += 1;
}

return(0);
}

See Also

MSDN Library


pack
Syntax
#pragma pack( [n] )
Description

The pragma pack specifies packing alignment for structure and union members. n is one of 1, 2, 4, 8, or 16.

Example: Pragma pack
#pragma pack(1)

struct structure //Declaration of struct
{
short j;
char a;
int n;
short k;
double x;
}structure;

int main()
{
int c;
char buff1[3];

structure.j=32766;
structure.a='X';
structure.n=147483644;
structure.k=32222;
structure.x=999999999999999;

return(0);
}

See Also

MSDN Library


warning
Syntax
#pragma warning( specifier : numlist {;specifier : numlist} )
#pragma warning( push[ , n ] )
#pragma warning( pop )
Description

The pragma warning controls the behavior of warning messages. The parameter specifier is a warning specifier. The parameter numlist is a list containing warning numbers.

Example: Pragma warning
pragma warning(disable: 810 69; once: 144; error:120)

int main(){
char c0[5]="Hello world!";
char c1[5]="Hello world!";
char c2[5]="Hello world!";
char c3[5]="Hello world!";
char c4[5]="Hello world!";
char c5[5]="Hello world!";

char d0="q";
char d1="w";

return(&d0);
}
See Also

MSDN Library


Inline Assembly

This chapter provides a detailed description of the inline assembly feature supported by the Intel® C++ Compiler.

The chapter comprises the following sections:

  • "Introduction" gives a short explanation of the inline assembly feature.
  • "Syntax of the Inline Assembly Statement" shows an overview of the structure of inline assembly statements.


Introduction

Inline assembly is a way to pass assembler text from the C++ source directly to the assembler. The assembler text will appear in the assembler file at the current position.


Syntax of the Inline Assembly Statement

The inline assembly statement contains either a "Single Instruction" or an "Instruction Block".


Single Instruction

Syntax
__asm assembler_instruction
Description

The text between the __asm keyword and the end of the line is copied into the assembler file. No changes are done to it.

Example: Inline Assembly Single Instruction
__asm mov r0, #0;
__asm mov r1, #1;


Instruction Block

Syntax
__asm {
assembler_instruction_list
};
Description

Each line of the assembler_instruction_list consists of one assembler instruction. The text between the curly braces is copied into the assembler file. C++ comments inside the instruction list are discarded. Other than that, no changes are done to it.

Example: Inline Assembly Instruction Block
__asm {
mov r0, #0
mov r1, #1
};


Optimizations

This chapter describes the optimization features of the Intel® C++ Compiler.

  • "Optimization Levels" provides an overview of optimization levels, options used for optimization, and options to restrict optimization during compilation.
  • "Floating Point Arithmetic Optimizations" summarizes floating point arithmetic precision.
  • "Interprocedural Optimizations" describe interprocedural optimizations (IPOs).
  • "Inline Expansion of Library Functions" describes inline expansion of functions.
  • "High-level Language Optimizations" describes high-level language optimizations


Optimization Levels

Optimization Levels Overview

The table below shows the optimizations that the compiler applies when you invoke the optimization in the "Option" column.

Table: Optimization Options
Option | Optimization | Affected Aspect of Program
/O1, /O2, /O3 | constant propagation | constants and expression evaluation
/O1, /O2, /O3 | copy propagation | mov/fmov instructions
/O1, /O2, /O3 | dead-code elimination | code size
/O1, /O2, /O3 | global register allocation | register use
/O1, /O2, /O3 | instruction scheduling | instruction reordering
/O1, /O2, /O3 | loop unrolling | loop overhead/structure
/O1, /O2, /O3 | loop-invariant code movement | instruction sequencing
/O1, /O2, /O3 | partial redundancy elimination | constants and expression evaluation
/O1, /O2, /O3 | strength reduction/induction variable simplification | instruction selection/sequencing constants and expression evaluation
/O1, /O2, /O3 | variable renaming | register use


Setting Optimization Levels

Table: Optimization Levels
Option | Effect
/O1 | Code size optimization. Enable options /Og, /Oi, /Os, /Oy, /Ob1, and /Gy.
/O2 | Code speed optimization. Enable options /Og, /Oi, /Ot, /Oy, /Ob1, and /Gy.
/Ox | Same as /O2, except that /Ox does not include /Gy.


Restricting Optimization

The options that restrict or preclude the compiler's ability to optimize your program are listed in the table below.

Table: Optimization Restrictions
Option | Description
/Od | Disables optimizations /O1, /O2, and/or /O3.
/Oi- | Suppresses automatic inline expansion of math library functions such as sin.
/Op | Restricts optimizations that cause some minor loss or gain of precision in floating point arithmetic to maintain a declared level of precision and to ensure that floating point arithmetic more nearly conforms to the ANSI and IEEE standards.


Floating Point Arithmetic Optimizations

Floating Point Arithmetic Precision

Table: Optimization Restrictions for Floating Point Arithmetic
Option | Description
/Op | The /Op option restricts optimization to maintain declared precision and to ensure that floating point arithmetic conforms more closely to the ANSI and IEEE standards. See "Restricting Floating Point Arithmetic Precision".
/Qlong_double | Use /Qlong_double to change the size of the long double type to 80 bits. For compatibility with the Microsoft* compiler, the Intel® C++ Compiler's default long double type is 64 bits in size, the same as the double type. This option introduces a number of incompatibilities with other files compiled without this option and with calls to library routines. Therefore, it is recommended that the use of long double variables be local to a single file when you compile with this option.


Restricting Floating Point Arithmetic Precision

The /Op option restricts optimization to maintain declared precision and to ensure that floating point arithmetic conforms more closely to the ANSI and IEEE standards. For most programs, specifying this option adversely affects performance. If you are not sure whether your application needs this option, try compiling and running your program both with and without it to evaluate the effects on performance versus precision. Specifying this option has the following effect on program compilation:

  • Floating point user variables are not assigned to registers.
  • The expressions are evaluated using precision of source operands. The compiler will not use Floating Point Multiply and Add (FMA) to contract multiply and add/subtract operations in a single operation. The contractions can be enabled by using /QIPF_fma option. The compiler will not speculate on floating point operations that may affect the floating point state of the machine.
  • Floating point arithmetic comparisons conform to IEEE 754 except for NaN behavior.
  • The exact operations specified in the code are performed. For example, division is never changed to multiplication by the reciprocal. The compiler performs floating point operations in the order specified without re-associating. The compiler does not perform the constant folding on floating point values. Constant folding also eliminates any multiplication by 1, division by 1, and addition or subtraction of 0. For example, code that adds 0.0 to a number is executed exactly as written. Compile-time floating point arithmetic is not performed to ensure that floating point exceptions are also maintained.
  • Whenever an expression is spilled, it is spilled as 80 bits (EXTENDED PRECISION), not 64 bits (DOUBLE PRECISION).
  • When assignments to type REAL and DOUBLE PRECISION are made, the precision is rounded from 80 bits (EXTENDED) down to 32 bits (REAL) or 64 bits (DOUBLE PRECISION). When you do not specify /Op, the extra bits of precision are not always rounded away before the variable is reused.
  • Even if vectorization and other loop transformations are enabled by the /QxK option, the compiler does not vectorize reduction loops (loops computing the dot product) and loops with mixed precision types. Similarly, the compiler does not enable certain loop transformations. For example, the compiler will not transform reduction loops to perform partial summation or loop interchange.


Interprocedural Optimizations

The /Qip and /Qipo options enable interprocedural optimizations (IPO) to analyze your code to determine where you can benefit from the optimizations listed in tables that follow.

Table: Interprocedural Optimizations
Optimization | Affected Aspect of Program
inline function expansion | eliminates overhead of calls, jumps, branches and loops
interprocedural constant propagation | improves usage of arguments, global variables and return values
monitoring module-level static variables | provides further optimizations, loop invariants elimination
dead code elimination | reduces code size
propagation of function characteristics | eliminates extra overhead of function calls
multifile optimization | affects the same aspects as /Qip, but across multiple files
passing arguments in registers | provides better function calls and better register usage
loop invariant code motion | further optimizations, loop invariant code

Inline function expansion is one of the main optimizations performed by the interprocedural optimizer. For function calls that the compiler believes are frequently executed, the compiler might decide to replace the instructions of the call with code for the function itself.

With /Qip, the compiler performs inline function expansion for calls to procedures defined within the current source file. However, when you use /Qipo to specify multifile IPO, the compiler performs inline function expansion for calls to procedures defined in separate files.

Caution icon CAUTION.
The /Qip and /Qipo options can in some cases significantly increase compile time and code size.


Multifile IPO Overview

Multifile IPOs obtain potential optimization information from individual program modules of multi-file programs. Using this information, the compiler performs optimizations across modules.

The process of program building is divided into two phases: compilation and linkage. Multifile IPO performs different work depending on whether the compilation or linkage is being performed.

  • Compilation Phase - As each source file is compiled, multifile IPO stores an intermediate representation (IR) of the source code in a mock object file in a special comment section. Generation pseudo-object files instead of real object files reduces the time spent in the multifile IPO compilation phase. Each mock object file contains the IR for its corresponding source file, but no real code or data. These mock objects must be linked using the /Qipo option with the compiler. (See Creating a Multifile IPO Executable Using a Project Makefile.)
Note icon NOTE.
Failure to link "mock" objects with /Qipo will result in linkage errors. There are situations where mock object files cannot be used. See the following section, "/Qipo" for more information.
  • Linkage Phase - When you specify /Qipo, the compiler looks for the IR information in the mock object files.
Note icon NOTE.
The compiler does not support multifile IPO for static libraries (.lib files). See the following section, "/Qipo" for more information.


Creating a Multi-file IPO Executable with Compiler Commands

This topic explains how to create a multifile IPO executable as follows in the examples below:

Example

Compile your modules with /Qipo as follows:

  1. Enter

    2. ccxscce /Qipo /c a.c b.c c.c

    on the command prompt.
    Use /c to stop compilation after generating .o files. Each object file has the IR for the corresponding source file. With preceding results, you can now optimize interprocedurally:

  2. Enter

    3. ccxscce /Fo nu_ipo_file /Qipo a.o b.o c.o

    on the command prompt. The /Fo option stores the executable in nu_ipo_file.exe. Multifile IPO is applied only to modules that have an IR, otherwise the object file passes to link stage.

For efficiency, combine steps 1 and 2:

Enter

ccxscce /Qipo /Fo nu_ipo_file a.c b.c c.c

on the command prompt.


Analyzing the Effects of Multifile IPO

The /Qipo_c and /Qipo_S options are useful for analyzing the effects of multifile IPO, or when experimenting with multifile IPO between modules that do not make up a complete program.

Use the /Qipo_c option to optimize across files and produce an object file. This option performs optimizations as described for /Qipo, but stops prior to the final link stage, leaving an optimized object file. The default name for this file is ipo_out.o. You can use the /Fe option to specify a different name. For example:

ccxscce /Qipo_c /Fefile a.c b.c c.c

Use the /Qipo_S option to optimize across files and produce an assembly file. This option performs optimizations as described for /Qipo, but stops prior to the final link stage, leaving an optimized assembly file. The default name for this file is ipo_out.s. You can use the /Fe option to specify a different name. For example:

ccxscce /Qipo_S /Fefile a.c b.c c.c

For more information on inlining and the minimum inlining criteria, see Inline Expansion of Library Functions.


Inline Expansion of Library Functions

By default, the compiler automatically expands (inlines) a number of standard and math library functions at the point of the call to that function, which usually results in faster computation.

However, the inlined library functions do not set the errno variable when being expanded inline. For code that relies upon the setting of the errno variable, you should use the /Oi- option. Also, if one of your functions has the same name as one of the compiler-supplied library functions, then when this function is called, the compiler assumes that the call is to the library function and replaces the call with an inlined version of the library function.

So, if the program defines a function with the same name as one of the known library routines, you must use the /Oi- option to ensure that the user-supplied function is used. The option /Oi- disables inlining of all intrinsics.

Your results can vary slightly using the preceding optimizations.


Controlling Inline Expansion of User Functions

The compiler lets you control the amount of inline function expansion with the options shown in the following summary.

/Ob0
    Disables inline expansion of user-defined functions.
/Ob1
    Disables inlining unless /Qip or /Ob2 is specified (default is ON).
/Ob2
    Enables inlining of any function. However, the compiler decides which functions are inlined. This option enables interprocedural optimizations and has the same effect as specifying the /Qip option.
/Qip_no_inlining
    This option is only useful if /Qip or /Qipo is also specified. In such case, /Qip_no_inlining disables inlining that would result from the /Qip or /Ob2 interprocedural optimizations, but has no effect on other interprocedural optimizations.
/Qip_no_pinlining
    Disables partial inlining; can be used if /ip or /ipo is also specified.
/Qinline_debug_info
    Keeps source information for inlined functions.


Criteria for Inline Function Expansion

For a routine to be considered for inlining, it has to meet certain minimum criteria. There are three main components of a call:

  • Call-site is the site of the call to the function that might be inlined.
  • Caller is the function that contains the call-site.
  • Callee is the function being called that might be inlined.


Minimum Call-site Criteria

  • The number of actual arguments must match the number of formal arguments of the callee.
  • The number of return values must match the number of return values of the callee.
  • The data types of the actual and formal arguments must be compatible.
  • No multi-lingual inlining is valid. Caller and callee must be written in the same source language.


Minimum Criteria for the Caller

  • At most, 2000 intermediate statements will be inlined into the caller from all the call-sites. /
  • The function must be called if it is declared as static. Otherwise, it will be deleted.


Minimum Criteria for the Callee

  • Does not have variable argument list.
  • Is not considered infrequent due to the name. Routines which contain the following substrings in their names are not inlined:
    abort
    fail
    interrupt
    timeout
    alloca
    fatal
    invalid
    trace
    denied
    fault
    quit
    trap
    err
    halt
    rare
    warn
    exit
    init
    stop
  • Is not considered unsafe for other reasons.


Selecting Routines for Inlining

  • Once these criteria are met, the compiler picks the routines whose inline expansions will provide the greatest benefit to program performance. This is done using the following default heuristics:
    • The default heuristic focuses on call-sites in loops or calls to functions containing loops.
    • The compiler will not inline functions with more than 230 intermediate statements. The default inline heuristic will stop inlining when direct recursion is detected.
    • The default heuristic will always inline very small functions that meet the minimum inline criteria. The default is: ip_ninl_min_stats = 7.


High-level Language Optimizations

These optimizations include loop transformations and loop unrolling techniques. The generic option required to turn on the high-level optimizations is /O3.

/O3 Enable /O2 option plus more aggressive optimizations; for example, loop transformation and prefetching.

The option /O3 optimizes for maximum speed, but may not improve performance for some programs.


Loop Unrolling

You can unroll loops and specify the maximum number of times you want the compiler to do so.


How to Enable Loop Unrolling

You can use the /Qunroll[n] option to unroll loops. The n variable you enter determines the maximum number of times for the unrolling operation. This applies only to loops that the compiler determines should be unrolled. Omit n to let the compiler decide whether to perform unrolling or not.

Example
ccxscce /Qunroll4 a.cpp


How to Disable Loop Unrolling

Disable loop unrolling by setting the n variable to 0.

Example
ccxscce /Qunroll0 a.cpp


Effect of the Default

The default for loop unrolling is ON. However, since n is not specified, the compiler automatically chooses the maximum number of times to unroll a loop based on internal optimization algorithms. You can also omit n to allow the compiler to decide whether or not to perform loop unrolling. In these cases there is no limit to the number of times a loop may be unrolled.


Vectorization

This chapter describes the vectorizer of the Intel® C++ Compiler.

The vectorizer is a component of the Intel® C++ Compiler that automatically uses SIMD instructions in the Intel® Wireless MMX(TM) technology instruction set. The vectorizer detects operations in the program that can be done in parallel, and then converts the sequential program to process 2, 4, or 8 elements in one operation, depending on the data type.

This chapter provides guidelines, option descriptions, and examples for the Intel® C++ Compiler vectorization on Intel XScale® technology systems only. The following list summarizes this section's contents.

  • "Vectorizer Quick Reference" provides a quick reference of compiler options to control vectorization.
  • "Vectorization Key Programming Guidelines" provides a list of general guidelines and restrictions.
  • "Data Dependence" describes data dependence relations.
  • "Loop Constructs" provides information on loop constructs, loop exit conditions, types of loops, stripmining and cleanup, and statements in the loop body.
  • "Language Support and Directives" addresses language features that help to vectorize code.
  • "Some Vectorization Examples" provides several examples demonstrating typical vectorization issues and resolutions.


Vectorizer Quick Reference

Table: Vectorization Options
Option | Description
/Qvec | Switch on vectorization.
/Qvec- | Switch off vectorization.


Vectorization Key Programming Guidelines

The goal of vectorizing compilers is to exploit single-instruction multiple data (SIMD) processing automatically. Review these guidelines and restrictions, see code examples in further topics, and check them against your code to eliminate ambiguities that prevent the compiler from achieving optimal vectorization.


Guidelines for loop bodies

  • Use straight-line code (a single basic block)
  • Use vector data only; that is, arrays and invariant expressions on the right hand side of assignments. Array references can appear on the left hand side of assignments.
  • Use only assignment statements.
  • Avoid function calls.
  • Avoid unvectorizable operations.
  • Avoid mixing vectorizable types in the same loop.
  • Avoid data-dependent loop exit conditions.


Preparing Your Code for Vectorization

To make your code vectorizable, you will often need to make some changes to your loops. However, you should make only the changes needed to enable vectorization and no others. In particular, you should obey the following guidelines:

  • Do not unroll your loops, the compiler does this automatically.
  • Do not decompose one loop with several statements in the body into several single-statement loops.


Restrictions

Style

The style in which you write source code can inhibit optimization. For example, a common problem with global pointers is that they often prevent the compiler from being able to prove two memory references at distinct locations. Consequently, this prevents certain reordering transformations.

Many stylistic issues that prevent automatic vectorization by compilers are found in loop structures. The ambiguity arises from the complexity of the keywords, operators, data references, and memory operations within the loop bodies.

However, by understanding these limitations and by knowing how to interpret diagnostic messages, you can modify your program to overcome the known limitations and enable effective vectorizations. The subsequent topic summarize the capabilities and restrictions of the vectorizer with respect to loop structures.


Data Dependence

Data dependence relations represent the required ordering constraints on the operations in serial loops. Because vectorization rearranges the order in which operations are executed, any auto-vectorizer must have at its disposal some form of data dependence analysis. The "Data-dependent Loop" example below shows some code that exhibits data dependence. The value of each element of an array is dependent on itself and its two neighbors.

Example: Data-dependent Loop
int data[N];
int i;
for (i=1; i<N-1; i++)
{
data[i] = data[i-1]*0.25 + data[i]*0.5 + data[i + 1]*0.25;
}

The loop in the example above is not vectorizable, because the write to the current element data[i] is dependent on the use of the preceding element data[i-1], which has already been written to and changed in the previous iteration. To see this, look at the access patterns of the array for the first two iterations as shown in the following example:

Example: Data Dependence Vectorization Patterns
i=1: READ data[0]
READ data[1]
READ data[2]
WRITE data[1]
i=2: READ data[1]
READ data[2]
READ data[3]
WRITE data[2]

In the normal sequential version of the loop shown, the value of data[1] read from during the second iteration was written to in the first iteration. For vectorization, the iterations must be done in parallel, without changing the semantics of the original loop.


Data Dependence Theory

Data dependence analysis involves finding the conditions under which two memory accesses may overlap. Given two references in a program, the conditions are defined by:

  • whether the referenced variables may be aliases for the same (or overlapping) regions in memory,
  • for array references, the relationship between the subscripts.

For array references, the Intel® C++ Compiler's data dependence analyzer is organized as a series of tests that progressively increase in power as well as time and space costs. First, a number of simple tests are performed in a dimension-by-dimension manner, since independence in any dimension will exclude any dependence relationship. Multi-dimensional arrays references that may cross their declared dimension boundaries can be converted to their linearized form before the tests are applied. Some of the simple tests used are the fast GCD test, proving independence if the greatest common divisor of the coefficients of loop indices cannot evenly divide the constant term, and the extended bounds test, which tests potential overlap for the extreme values of subscript expressions.

If all simple tests fail to prove independence, the compiler will eventually resort to a powerful hierarchical dependence solver that uses Fourier-Motzkin elimination to solve the data dependence problem in all dimensions.


Loop Constructs

Loops can be formed with the usual for and while-do, or repeat-until constructs or by using a goto and a label. However, the loops must have a single entry and a single exit to be vectorized.

Example: Correct Usage of Loop Constructs
while (i < n)
{
/* if branch inside body of loop */
a[i] = b[i] * c[i];
if (a[i] < 0.0)
{
a[i] = 0.0;
}
i++;
}

Example: Incorrect Usage of Loop Constructs
while (i < n)
{
if (condition) break;
/* 2nd exit */
++i;
}


Loop Exit Conditions

Loop exit conditions determine the number of iterations that a loop executes. For example, fixed indexes for loops determine the iterations. The loop iterations must be countable; that is, the number of iterations must be expressed as one of the following:

  • a constant
  • a loop invariant term
  • a linear function of outermost loop indices

Loops whose exit depends on computation are not countable. Examples below show countable and non-countable loop constructs.

Example: Correct Usage for Countable Loop
count = N; /* exit condition specified by "N - 1b + 1" */
...
while (count != 1b)
{
/* 1b is not affected within loop */
a[i] = b[i] * x;
b[i] = c[i] + sqrt(d[i]);
--count;
}

Example: Correct Usage for Countable Loop
/* exit condition is "(n-m+2)/2" */
i = 0;
for (l=m; l<n; l+=2)
{
a[i] = b[i] * x;
b[i] = c[i] + sqrt(d[i]);
++i;
}

Example: Incorrect Usage for Non-countable Loop
i = 0;
/* iterations dependent on a[i] */
while (a[i] > 0.0)
{
a[i] = b[i] * c[i];
++i;
}


Types of Loops Vectorized

For integer loops, the Intel® Wireless MMX(TM) coprocessor provides SIMD instructions for most arithmetic and logical operators on 32-bit, 16-bit, and 8-bit integer data types. Vectorization may proceed if the final precision of integer wrap-around arithmetic will be preserved. A 32-bit shift-right operator, for instance, is not vectorized if the final stored value is a 16-bit integer. Also, note that because the Intel® Wireless MMX(TM) instruction set is not fully orthogonal (byte shifts, for instance, are not supported), not all integer operations can actually be vectorized.


Stripmining and Cleanup

The compiler automatically stripmines your loop and generates a cleanup loop. This means you do not need to unroll your loops, and, in most cases, this will also enable more vectorization.

Example: Stripmining and Cleanup
Before vectorization:
i = 0;
while (i < n)
{
/* original loop code */
a[i] = b[i] + c[i];
++i;
}
After Vectorization:
/* the vectorizer generates the following two loops */
i = 0;
while (i < (n - n%4) )
{
/* vector strip-mined loop */
/* subscript [i:i+3] denotes SIMD execution */
a[i:i+3] = b[i:i+3] + c[i:i+3];
i = i + 4;
}
while (i < n)
{
/* scalar clean-up loop */
a[i] = b[i] + c[i];
}


Statements in the Loop Body

The vectorizable operations are supported only on integer data. The vectorizable operations are not supported on floating point data yet.


Integer Array Operations

The statements within the loop body may contain char, unsigned char, short, unsigned short, int, and unsigned int. Calls to functions such as sqrt and fabs are also supported. Arithmetic operations are limited to addition, subtraction, bitwise AND, OR, and XOR operators, division (16-bit only), multiplication (16-bit only), min, and max. You can mix data types only if the conversion can be done without a loss of precision. Some example operators where you can mix data types are multiplication, shift, or unary operators.


Other Operations

No statements other than the preceding integer operations are allowed. In particular, note that the special __m64 data type is not vectorizable. The loop body cannot contain any function calls.


Language Support and Directives

This topic addresses language features that better help to vectorize code. The declspec(align(n)) declaration enables you to overcome hardware alignment constraints. The restrict qualifier and the pragmas address the stylistic issues due to lexical scope, data dependence, and ambiguity resolution.


Language Support

Table: Language Support
Option | Description
__declspec(align(n)) | Directs the compiler to align the variable to an n-byte boundary. Address of the variable is address mod n = 0.
__declspec(align(n,off)) | Directs the compiler to align the variable to an n-byte boundary with offset off within each n-byte boundary. Address of the variable is address mod n = off.
restrict | Permits the disambiguator flexibility in alias assumptions, which enables more vectorization.
__assume_aligned(a,n) | Instructs the compiler to assume that array a is aligned on an n-byte boundary; used in cases where the compiler has failed to obtain alignment information.
#pragma ivdep | Instructs the compiler to ignore assumed vector dependencies.
#pragma vector aligned #pragma vector unaligned #pragma vector always | Specifies how to vectorize the loop and indicates that efficiency heuristics should be ignored.
#pragma novector | Specifies that the loop should never be vectorized.


Multi-version Code

Multi-version code is generated by the compiler in cases where data dependence analysis fails to prove independence for a loop due to the occurrence of pointers with unknown values. This functionality is referred to as dynamic dependence testing.


Pragma Scope

These pragmas control the vectorization of only the subsequent loop in the program, but the compiler does not apply them to any nested loops. Each nested loop needs its own pragma preceding it in order for the pragma to be applied. You must place a pragma only before the loop control statement.


vector always
Syntax
#pragma vector always
Description

This pragma instructs the compiler to override any efficiency heuristic during the decision to vectorize or not. #pragma vector always will vectorize non-unit strides or very unaligned memory accesses.

Example: #pragma vector always
for(i = 0; i <= N; i++)
{
a[32*i] = b[99*i];
}


ivdep
Syntax
#pragma ivdep
Description

This pragma instructs the compiler to ignore assumed vector dependences. To ensure correct code, the compiler treats an assumed dependence as a proven dependence, which prevents vectorization. This pragma overrides that decision. Only use this when you know that the assumed loop dependences are safe to ignore.

The loop in this example will not vectorize with the ivdep pragma, since the value of k is not known (vectorization would be illegal if k<0).

Example: #pragma ivdep
#pragma ivdep
for (i = 0; i < m; i++)
{
a[i] = a[i + k] * c;
}


vector
Syntax
#pragma vector{aligned | unaligned}
Description

The vector loop pragma means the loop should be vectorized, if it is legal to do so, ignoring normal heuristic decisions about profitability. When the aligned (or unaligned) qualifier is used with this pragma, the loop should be vectorized using aligned (or unaligned) operations. Specify one and only one of aligned or unaligned.

Caution icon CAUTION.
If you specify aligned as an argument, you must be absolutely sure that the loop will be vectorizable using this instruction. Otherwise, the compiler will generate incorrect code.

The loop in the example below uses the aligned qualifier to request that the loop be vectorized with aligned instructions, as the arrays are declared in such a way that the compiler could not normally prove this would be safe to do so.

Example: #pragma vector
void foo (int *a)
{
#pragma vector aligned
for (i = 0; i < m; i++)
{
a[i] = a[i] * c;
}
}

The compiler has at its disposal several alignment strategies in case the alignment of data structures is not known at compile-time. A simple example is shown below (but several other strategies are supported as well). If, in the loop shown below, the alignment of a is unknown, the compiler will generate a prelude loop that iterates until the array reference that occurs the most hits an aligned address. This makes the alignment properties of a known, and the vector loop is optimized accordingly.

Example: Alignment Strategies Example
int *a;
/* alignment unknown */
for (i = 0; i < 100; i++)
{
a[i] = a[i] + 1.0f;
}
/* dynamic loop peeling */
p = a & 0x0f;
if (p != 0)
{
p = (16 - p) / 4;
for (i = 0; i < p; i++)
{
a[i] = a[i] + 1.0f;
}
}
/* loop with a aligned (will be vectorized accordingly) */
for (i = p; i < 100; i++)
{
a[i] = a[i] + 1.0f;
}


novector
Syntax
#pragma novector
Description

The novector loop pragma specifies that the loop should never be vectorized, even if it is legal to do so.

In this example, suppose you know the trip count (ub - lb) is too low to make vectorization worthwhile. You can use #pragma novector to tell the compiler not to vectorize, even if the loop is considered vectorizable.

Example: #pragma novector S
void foo (int lb, int ub)
{
#pragma novector
for (j = lb; j < ub; j++)
{
a[j] = a[j] + b[j];
}
}


Dynamic Dependence Testing

Example: Dynamic Dependence Testing
int *p, *q;
for (i = L; I <= U; i++)
{
p[i] = q[i];
}
...
pL = p * 4*L;
pH = p + 4*U;
qL = q + 4*L;
qH = q + 4*U;
if (pH < qL || pL > qH)
{
/* loop without data dependence */
for (i = L; i <= U; i++)
{
p[i] = q[i];
} else {
for (i = L; i <= U; i++)
{
p[i] = q[i];
}
}


Some Vectorization Examples

This section contains a few simple examples of some common issues in vector programming.


Argument Aliasing: A Vector Copy

The loop in the example below, a vector copy operation, vectorizes because the compiler can prove dest[i] and src[i] are distinct.

Example: Vectorizable Copy Due to Unproven Distinction
void vec_copy(int *dest, int *src, int len)
{
int i;
for (i = 0; i < len; i++;)
{
dest[i] = src[i];
}
}

The restrict keyword in the example below indicates that the pointers refer to distinct objects. Therefore, the compiler allows vectorization without generation of multi-version code.

Example: Using restrict to Prove Vectorizable Distinction

void vec_copy(int *restrict dest, int *restrict src, int len)

{

int i;

for (i = 0; i < len; i++)

{

dest[i] = src[i];

}

}


Data Alignment

An 8-byte or greater data structure or array should be aligned so that the beginning of each structure or array element is aligned in a way that its base address is a multiple of eight.

Figure 10-1, "Misaligned Data Crossing 8-Byte Boundary" on page 18 shows the effect of a data cache unit (DCU) split due to misaligned data. The code loads the misaligned data across an 8-byte boundary, which results in an additional memory access causing stall. You can avoid the stalls if you know that the data is aligned and you specify to assume alignment.

Figure: Misaligned Data Crossing 8-Byte Boundary

For example, if you know that elements a[0] and b[0] are aligned on an 8-byte boundary, then the following loop can be vectorized with the alignment option on (#pragma vector aligned):

Example: Alignment of Pointers is Known
short *a, *b;
int i;
for (int i = 0; i < 10; i++)
{
a[i] = b[i];
}

After vectorization, the loop is executed as shown here:

Figure: Vector and Scalar Clean-up Iterations

Both the vector iterations a[0:3] = b[0:3]; and a[4:7] = b[4:7]; can be implemented with aligned moves if both the elements a[0] and b[0] (or, likewise, a[4] and b[4]) are 8-byte aligned.

Caution icon CAUTION.
If you specify the vectorizer with incorrect alignment options, the compiler will exhibit unexpected behavior. Specifically, using aligned moves on unaligned data will result in an illegal instruction exception.


Data Alignment Examples

The example below contains a loop that vectorizes but only with unaligned memory instructions. The compiler can align the local arrays, but because lb is not known at compile-time. The correct alignment cannot be determined.

Example: Unaligned Loop
(Unknown Variable Value at Compile Time)
void f(int lb)
{
int z2[N], a2[N], y2[N], x2;
for (i = lb; i < N; i++)
{
a2[i] = a2[i] * x2 + y2[i];
}
}

If you know that lb is a multiple of 4, you can align the loop with #pragma vector aligned as shown in the example that follows:

Example: Assertion of Variable as Multiple of 4
void f(int lb)
{
int z2[N], a2[N], y2[N], x2;
assert(lb%4==0);
#pragma vector aligned
for (i = lb; i < N; i++)
{
a2[i] = a2[i] * x2 + y2[i];
}
}

The use of assert checks that lb is a multiple of 4.


Loop Interchange and Subscripts: Matrix Multiplication

Matrix multiplication is commonly written as shown in the example below:

Example: Typical Matrix Multiplication
for (i = 0; i < N; i++)
{
for (j = 0; j < n; j++)
{
for (k = 0; k < n; k++)
{
c[i][j] = c[i][j] + a[i][k] * b[k][j];
}
}
}

The use of b[k][j] is not a stride-1 reference and therefore will not normally be vectorizable. If the loops are interchanged, however, all the references will become stride-1 as shown in the "Matrix Multiplication With Stride-1" example.

Caution icon CAUTION.
Interchanging is not always possible because of dependencies, which can lead to different results.

Example: Matrix Multiplication With Stride-1
for (i = 0; i < N; i++)
{
for (k = 0; k < n; k++)
{
for (j = 0; j < n; j++)
{
c[i][j] = c[i][j] + a[i][k] * b[k][j];
}
}
}


Language Conformance Options

This chapter describes the language conformance of the Intel® C++ Compiler. The chapter comprises the following sections:

  • "Conformance to the C Standard" describes the Intel® C++ Compiler's conformance to the ANSI/ISO standard for C language compilation.
  • "Conformance to the C++ Standard" describes the Intel® C++ Compiler's conformance to the ANSI/ISO standard for the C++ language.


Conformance to the C Standard

You can set the Intel® C++ Compiler to accept either

  • strict ANSI conformance dialect using the /Za option, or
  • extended ANSI C dialect using the /Ze option

The compiler is set by default to accept extensions and not be limited to the ANSI/ISO standard.

The Intel® C++ Compiler provides conformance to the ANSI/ISO standard for C language compilation (ISO/IEC 9899:1999). This standard requires that conforming C compilers accept minimum translation limits. This compiler exceeds all of the ANSI/ISO requirements for minimum translation limits.

You set the compiler to accept only ANSI/ISO standard C code by using the /Za option. When you set the compiler to accept only ANSI/ISO standard C code, the compiler will flag nonstandard code it encounters during the translation process with warning and error messages.


Understanding the Extensions to ANSI/ISO Standard C Dialect

When you set the compiler to accept extensions to the ANSI/ISO standard, the compiler can process the following extensions.

Table: Understanding Extensions to ANSI/ISO Standard C Dialect
Extension Type
Description
Files and data storage
  • Input files with no text.
  • Incomplete array types for the last member of a structure, except when this is the only member of the structure.
  • Incomplete struct or union type file-scope arrays.
Note: The struct and union types must be completed before the array is subscripted. In addition, if the array is defined in the compilation, these types must be subscripted by the end of the compilation.
  • The enum tag names you define. You can declare an enum tag name and then define it later in the source file.
  • Initializer expressions not enclosed in braces though they initialize any of the following: a full static array, structure, or union. (Standard C requires the braces.)
Pointers
  • In initializers, pointer constant values cast to an integral type if the integral type is large enough to contain it.
  • In integral constant expressions, integer constants cast to a pointer type and then cast back to an integral type.
  • Assignments of pointers to integers and to other incompatible pointer types without explicit casts.
  • Fields selected in the form p->m when the p variable is a pointer, including when p does not point to a struct or union that contains m. (All definitions of field must have the same type and offset within their structure or union.)
  • Fields selected in the form x.m, including when x is not a structure or union containing m when:
    1. variable x is not a struct or union containing m and
    2. the x variable is an Ivalue. (All definitions of field must have the same type and offset within their structure or union.)
Types and syntax
  • Bitfields with enum base types or integral types other than int and unsigned int.
  • The type long float as a synonym for double.
  • Arbitrary text at the end of preprocessing directives.
  • Numbers that do not comply with the pp-number syntax, because numbers are scanned according to the syntax for numbers when extensions are allowed.
Example: The compiler would scan 0x123e+1 as three tokens. Under strict ANSI conformance mode, the compiler would use the pp-number syntax and scan this number as one invalid token.
Predicates
The macros #assert and #unassert to define and test predicate names.
Syntax with warnings
Note: When you have set the compiler to accept extensions, the compiler will accept the following tags and syntax but will tag them with a warning message.
  • An extra comma at the end of an enum list.
  • Omission of the final semicolon preceding the closing brace "}" of a struct or union.
  • A right brace immediately following a label definition. (Normally, a statement must follow a legal definition.)
  • An empty declaration, a semicolon with nothing preceding it.
Semantics with warnings
  • Differences in assignments and pointers between pointers to types that are interchangeable but not identical, such as unsigned char* and char*. (The compiler will issue a warning in this case.)
  • A string constant assigned to a pointer to any kind of character.
  • Comparison using >, >=, <, or <= operators between pointers to voids and other kinds of pointers, without using an explicit type cast. (Strict ANSI dialect mode requires such comparisons using == or != and issues no warnings.)
  • Inline assembly code inserted using the asm keyword. (Strict ANSI dialect mode requires the __asm keyword.)
  • Freestanding tag declarations in the parameter declaration list for a function with old-style parameters.


How to Set the Compiler for Extended C Dialect

You set the compiler to accept extensions to the ANSI/ISO standard C code by using the /Ze option.


Macros Included with the Compiler

The ANSI/ISO standard for C language requires that certain predefined macros be supplied with conforming compilers. The following table lists the macros that the Intel® C++ Compiler supplies in accordance with this standard.

Table: Macros Included with the Compiler
Macro | Description
__cplusplus | Defines C++ programs only.
__DATE__ | The date of compilation. As a string literal in the form Mmm dd yyyy.
__FILE__ | A string literal representing the name of the file being compiled.
__LINE__ | The current line number as a decimal constant.
__STDC__ | The constant 1 when you set the compiler to accept only standard ANSI conformance. This macro is not defined when you set the compiler to accept extensions.
__TIME__ | The time of compilation. As a string literal in the form hh:mm:ss.
__TIMESTAMP__ | The date and time of the last modification of the current source file in the form: Day Mon dd hh:mm:ss yyyy.

The compiler provides predefined macros in addition to the predefined macros required by the standard. For a list of these macros see Predefined Macros and the section on the preprocessor category in the Microsoft* Visual C++* User's Guide.


Conformance to the C++ Standard

The Intel® C++ Compiler conforms to the ANSI/ISO standard (ISO/IEC 14882:1998) for the C++ language, with the following exceptions:

  • Putting a try/catch around the initializers and body of a constructor is not implemented.
  • Universal character set escapes (for example, \uabcd) are not implemented.
  • The export keyword for templates is not implemented.

For compatibility with Microsoft* Visual C++*, the compiler also supports many extensions to the C++ language. For more information, see the Microsoft* Visual C++* documentation.


Libraries

This chapter describes which libraries are used by the Intel® C++ Compiler. The Intel® C++ Compiler uses the libraries provided by Microsoft as well as needs one additional library that is the Intel® Run-time Library.

The chapter covers the following topics:

  • "Overview of Libraries" provides a brief introduction to the libraries as they are used by the Intel® C++ Compiler.
  • "Managing Libraries" describes how the libraries are used within Microsoft Windows* CE .NET and on the command line.
  • "The Intel® Libm Mathematical Library" describes the functions of the Intel® Libm Mathematical Library.


Overview of Libraries

The Intel® C++ Compiler lets you use all the libraries that are part of Microsoft Windows* CE .NET. Additionally, the Intel® C++ Compiler provides the Intel® Run-Time Library. This run-time library named x0__ar10.lib is automatically included while linking the application. It does not replace any existing library provided by Microsoft*. The Intel® Run-Time Library contains all internally generated functions such as floating point emulation or integer division. Furthermore, the Intel® Run-Time Library contains optimized versions of the strcpy and strcmp functions.

Warning icon WARNING.
The Intel® Run-Time Library is required for all objects produced by the Intel® C++ Compiler.

The default directories of the Intel® Run-Time Library after the installation of the Intel® C++ Compiler are:

  • WINCE400\PUBLIC\COMMON\SDK\LIB\ARMV4I\DEBUG
  • WINCE400\PUBLIC\COMMON\SDK\LIB\ARMV4I\RETAIL


Managing Libraries

The usage of libraries inside the Microsoft Windows* CE .NET is managed by the LIB environment variable. The LIB environment variable contains a semicolon-separated list of directories in which the Microsoft* Linker will search for library (.lib) files. The Intel® C++ Compiler does not specify library names to the linker, but includes directives in the object file to specify the libraries to be linked with each object.

See Also


The Intel® Run-time Library

This section describes functions of the Intel® Run-time Library supported by the Intel® C++ Compiler. The name of this library is x0__ar00.a. Most of these are functions relating to floating point operations between variables of differing types.

These functions are assembly language functions and are implicitly called by the Intel® C++ Compiler when required. For example in the following piece of code:

double a,b,c; // declare three double variables

a=1.2345e7; // load variable a with data
b=1.67; // load variable b with data
c=a+b; // add variable a to variable b,
// save result to variable c

The compiler automatically calls the correct floating point function to carry out the addition of the two variables a and b.

Although it is not recommended, it is also possible to call these functions explicitly from the C/C++ source code. In order to do so the functions prototypes are required before a call is made to it in the correct manner. An example of this is provided for each of the functions described.

The chapter covers the following topics:

  • "General Remarks" provides general remarks applying to the Floating Point Library.
  • "Summary of the Functions" gives a summary of all supported floating point functions.
  • "__adddf3" - "ftp8" describe every available function in detail. They are given in alphabetical order and have examples where appropriate.


General Remarks

The following remarks apply to the Floating Point Library of the Intel® C++ Compiler:

  • All numerical values conform to IEEE floating point format standards 754.
  • 64-bit double precision floating point numbers are stored in register pairs such as R0:R1, where the most significant 32 bits are held in the lower numbered register of R0.
  • Values stored in memory do so with their least significant bytes at the lowest address - This method of keeping floating point data is known as "Little endian".
  • Upon return from these functions the state of the Condition Code Flags are undefined, except in the case of the comparison and test functions.
  • All functions in this library use 32-bit code.
  • In accordance with the IEEE standards it is possible for floating point numbers to be in an invalid state called a NaN, which stands for "Not a Number". This condition is frequently checked for within these functions and dealt with
  • The global symbol errno is not changed within these functions.
  • Scalar *mod* and *div* calls the various functions lmod0 and ldiv0 in the event of a divide by zero being attempted. These symbols are undefined if the default startup is not used.


Summary of the Functions

Functions are detailed in the following sections in alphabetical order. The tables below summarize which functions are available for each data type.

Note icon NOTE.
Some functions occur in more than one table where, for example, a conversion is being made from one data type to another.

Table: Functions for 32-bit Floating Point Numbers (float)
Function Group | Function | Description
Arithmetic | __addsf3 | Add.
 | __divsf3 | Divide.
 | __mulsf3 | Multiply.
 | __subsf3 | Subtract.
 | __negsf2 | Negate.
Comparisons |  |
 | __eqsf2 | Compare for equality.
 | __gesf2 | Compare for greater than or equal to.
 | __gtsf2 | Compare for greater than.
 | __lesf2 | Compare for less than or equal to.
 | __ltsf2 | Compare for less than.
 | __nesf2 | Compare for not equal to.
Conversions | __extendsfdf2 | Converts from 32-bit single precision floating point value to 64-bit double precision floating point value.
 | __fixsfsi | Converts from 32-bit single precision floating point value to 32-bit signed integer.
 | __fixunssfsi | Converts from 32-bit single precision floating point value to 32-bit unsigned integer.
 | __fixsfdi | Converts from 32-bit single precision floating point value to 64-bit signed integer.
 | __fixunssfdi | Converts from 32-bit single precision floating point value to 64-bit unsigned integer.
 | __truncdfsf2 | Converts from 64-bit double precision floating point value to 32-bit single precision floating point value.
 | __floatsisf | Converts from 32-bit signed integer to 32-bit single precision floating point value.
 | __floatunssisf | Converts from 32-bit unsigned integer to 32-bit single precision floating point value.
 | __floatdisf | Converts from 64-bit signed integer to 32-bit single precision floating point value.
 | __floatunsdisf | Converts from 64-bit unsigned integer to 32-bit single precision floating point value.

Table: Functions for 64-bit Floating Point Numbers (double)
Function Group | Function | Description
Arithmetic | __adddf3 | Add.
 | __divdf3 | Divide.
 | __muldf3 | Multiply.
 | __subdf3 | Subtract.
 | __negdf2 | Negate.
Comparisons | ftp8 | Analyze.
 | __eqdf2 | Compare for equality.
 | __gedf2 | Compare for greater than or equal to.
 | __gtdf2 | Compare for greater than.
 | __ledf2 | Compare for less than or equal to.
 | __ltdf2 | Compare for less than.
Conversions | __nedf2 | Compare for not equal to.
 | __truncdfsf2 | Converts from 64-bit double precision floating point value to 32-bit single precision floating point value.
 | __fixdfsi | Converts from 64-bit double precision floating point value to 32-bit signed integer.
 | __fixunsdfsi | Converts from 64-bit double precision floating point value to 32-bit unsigned integer.
 | __fixdfdi | Converts from 64-bit double precision floating point value to 64-bit signed Integer.
 | __fixunsdfdi | Converts from 64-bit double precision floating point value to 64-bit unsigned integer.
 | __extendsfdf2 | Converts from 32-bit floating point value to 64-bit double precision floating point value.
 | __floatsidf | Converts from 32-bit signed integer to 64-bit double precision floating point value.
 | __floatunssidf | Converts from 32-bit unsigned integer to 64-bit double precision floating point value.
 | __floatdidf | Converts from 64-bit signed integer to 64-bit double precision floating point value.
 | __floatunsdidf | Converts from 64-bit unsigned integer to 64-bit double precision floating point value.

Table: Functions for Integer Arithmetic
Function Group | Function | Description
Arithmetic | __divdi3 | 64-bit signed integer division.
 | __divsi3 | 32-bit signed integer division.
 | __udivdi3 | 64-bit unsigned integer division.
 | __udivsi3 | 32-bit unsigned integer division.
 | __moddi3 | 64-bit signed modulo division.
 | __modsi3 | 32-bit signed modulo division.
 | __umoddi3 | 64-bit unsigned modulo division.
 | __umodsi3 | 32-bit unsigned modulo division.
 | _lmul | 64-bit multiply.
Shifts | __ashldi3 | Arithmetic and Logical shift left.
 | __ashrdi3 | Arithmetic shift right.
 | __lshrdi3 | Logical shift right.
Memory | _memcopy | implicit memcopy call.
Conversions | __fixdfdi | Converts double to 64-bit Signed Integer.
 | __fixdfsi | Converts double to 32-bit Signed Integer.
 | __fixsfdi | Converts float to 64-bit Signed Integer.
 | __fixsfsi | Converts float to 32-bit Signed Integer.
 | __fixunsdfdi | Converts double to 64-bit Unsigned Integer.
 | __fixunsdfsi | Converts double to 32-bit Unsigned Integer.
 | __fixunssfdi | Converts float to 64-bit Unsigned Integer.
 | __fixunssfsi | Converts float to 32-bit Unsigned Integer.
 | __floatdidf | Converts from 64-bit Signed Integer to double.
 | __floatsidf | Converts from 32-bit Signed Integer to double.
 | __floatdisf | Converts from 64-bit Signed Integer to float.
 | __floatsisf | Converts from 32-bit Signed Integer to float.
 | __floatunsdidf | Converts from 64-bit Unsigned Integer to double.
 | __floatunssidf | Converts from 32-bit Unsigned Integer to double.
 | __floatunsdisf | Converts from 64-bit Unsigned Integer to float.
 | __floatunssisf | Converts from 32-bit Unsigned Integer to float.


__adddf3
Syntax
double
__adddf3(double x, double y);
Description

The function __adddf3 adds two 64-bit double precision floating point values to form a 64-bit double precision floating point result. The result is x+y. Both x and y may be any valid double precision values.

Diagnostics
    Underflow
    The result becomes zero if it is too small to be held as a double precision floating point value. +0 for positive, and -0 for negative values.
    Overflow
    The result becomes infinity if it is too large to be held as a double precision floating point value. +· for positive, and -· for negative values.
    Infinity
    If one or both inputs are +infinity the result is +infinity. If one or both inputs are -infinity the result is -infinity. If one input is +infinity and the other -infinity, a NaN is produced.
    NaNs
    If either or both inputs are NaNs, this produces a NaN. If one input is +infinity and the other -infinity, a NaN is produced.
Example: Function __adddf3
#include <stdio.h>
int main(void)
{
double x = .5, y = 10.;

printf("The value of %.2lf + %.2lf is %.2lf\n", x, y, __adddf3(x, y));

return 0;
}

The program above produces the following output:

The value of 0.50 + 10.00 is 10.50
See Also


__addsf3
Syntax
float
__addsf3(float x, float y);
Description

The function __addsf3 adds two 32-bit single precision floating point values together to form a 32-bit single precision floating point result. The result is x+y. Both x and y may be any valid single precision values.

Diagnostics
    Underflow
    The result becomes zero if it is too small to be held as a single precision floating point value. +0 for positive, and -0 for negative values.
    Overflow
    The result becomes infinity if it is too large to be held as a single precision floating point value. +· for positive, and -· for negative values.
    Infinity
    If one or both inputs are +infinity the result is +infinity. If one or both inputs are -infinity the result is -infinity. If one input is +infinity and the other -infinity, a NaN is produced.
    NaNs
    If either or both inputs are NaNs, this produces a NaN. If one input is +infinity and the other -infinity, a NaN is produced.
Example: Function __addsf3
#include <stdio.h>

int main(void)
{
float x = .5, y = 10;

printf("The value of %.2f + %.2f is %.2f\n", x, y, __addsf3(x, y));

return 0;
}

The program above produces the following output:

The value of 0.50 + 10.00 is 10.50
See Also


__ashldi3
Syntax
long long
__ashldi3(long long x, unsigned long long y);
Description

The function __ashldi3 carries out an Arithmetic/Logical shift left. The argument x
is shifted left y value of times, and the result returned. Shifting by more than 64 places will result in a zero result. The x value to be shifted is any valid 64-bit signed integer, while the value of times to be shifted y may be any valid 64-bit unsigned integers.

Example: Function __ashldi3
#include <stdio.h>

int main(void)
{
long long x = 0x800;
unsigned long long y = 3;

printf("The value of %lx shifted %lu times is %lx\n", x, y, __ashldi3(x, y));

return 0;
}

The program above produces the following output:

The value of 0x800 shifted 3 times is 0x100
See Also


__ashrdi3
Syntax
long long
__ashrdi3(long long x, unsigned long long y);
Description

The function __ashrdi3 carries out an arithmetic shift right, that is the most significant bit remains the same as the shift is carried out. Hence a negative value (most significant bit set) remains a negative value after the shift. The argument x is shifted right y value of times, and the result returned. Shifting by more than 64 places will result in a zero result. The x value to be shifted is any valid 64-bit signed integer, while the value of times to be shifted y may be any valid 64-bit unsigned integer.

Example: Function __ashrdi3
#include <stdio.h>

int main(void)
{
long long x = -0x800;
unsigned long long y = 3;

printf("The value of %lx shifted %lu times is %ld\n", x, y, __ashrdi3(x, y));

return 0;
}

The program above produces the following output:

The value of -0x800 shifted 3 times is -256
See Also


__divdf3
Syntax
double
__divdf3(double x, double y);
Description

The function __divdf3 divides one 64-bit double precision floating point value with another to form a 64-bit double precision floating point result. The result is x/y. Both x and y may be any valid double precision values.

Diagnostics
    Underflow
    The result becomes zero if it is too small to be held as a double precision floating point value. +0 for positive, and -0 for negative values.
    Overflow
    The result becomes infinity if it is too large to be held as a double precision floating point value. +· for positive, and -· for negative values.
    Infinity
    A numerator of ±infinity produces ±infinity. Dividing by zero will produce infinity. Dividing by infinity produces zero. Dividing infinity by infinity produces a NaN.
    NaNs
    If either or both inputs are NaNs, this produces a NaN. Dividing zero by zero produces a NaN. Dividing infinity by infinity produces a NaN.
Example: Function __divdf3
#include <stdio.h>

int main(void)
{
double x = .5, y = 10;

printf("The value of %.2lf / %.2lf is %.2lf\n", x, y, __divdf3(x, y));

return 0;
}

The program above produces the following output:

The value of 0.50 / 10.00 is 0.05
See Also


__divdi3
Syntax
long long
__divdi3(long long x, long long y);
Description

The function __divdi3 carries out an integer division of one 64-bit signed integer value by another to form a 64-bit signed integer result. The result is integer x/y. Both x and y may be any valid 64-bit signed integers.

Diagnostics
    Divide by Zero
    The result becomes the largest value it can be 0x7FFFFFFFFFFFFFFF.
Example: Function __divdi3
#include <stdio.h>

int main(void)
{
long long x = -7, y = -2;

printf("The value of integer %ld / %ld is %ld\n", x, y, __divdi3(x, y));

return 0;
}

The program above produces the following output:

The value of integer -7 / -2 is 3
See Also


__divsf3
Syntax
float
__divsf3(float x, float y);
Description

The function __divsf3 divides one 32-bit single precision floating point value with another to form a 32-bit single precision floating point result. The result is x/y. Both x and y may be any valid single precision values.

Diagnostics
    Underflow
    The result becomes zero if it is too small to be held as a single precision floating point value. +0 for positive, and -0 for negative values.
    Overflow
    The result becomes infinity if it is too large to be held as a single precision floating point value. +· for positive, and -· for negative values.
    Infinity
    A numerator of ±infinity produces ±infinity. Dividing by zero will produce infinity. Dividing by infinity produces zero. Dividing infinity by infinity produces a NaN.
    NaNs
    If either or both inputs are NaNs, this produces a NaN. Dividing zero by zero produces a NaN. Dividing infinity by infinity produces a NaN.
Example: Function __divsf3
#include <stdio.h>

int main(void)
{
float x = .5, y = 10;

printf("The value of %.2f / %.2f is %.2f\n", x, y, __divsf3(x, y));

return 0;
}

The program above produces the following output:

The value of 0.50 / 10.00 is 0.05
See Also


__divsi3
Syntax
long
__divsi3(long x, long y);
Description

The function __divsi3 carries out an integer division of one 32-bit signed integer with another to form a 32-bit signed integer result. The result is integer x/y. Both x and y may be any valid 32-bit signed integers.

Diagnostics
    Divide by Zero
    The result becomes the largest value it can be 0x7FFFFFFF.
Example: Function __divsi3
#include <stdio.h>

int main(void)
{
long x = -7, y = 2;

printf("The value of integer %d / %d is %d\n", x, y, __divsi3(x, y));

return 0;
}

The program above produces the following output:

The value of integer -7 / 2 is -3
See Also


__eqdf2
Syntax
long
__eqdf2(double x, double y);
Description

The function __eqdf2 compares two 64-bit double precision floating point values for equality,
returning the result as a 32-bit signed integer. The function calculate x-y, setting the return value according to the result, the result itself being thrown away. Both x and y may be any valid double precision values.

The return from this function is:

    Value
    Description
    0
    If equal.
    1
    If not equal, or an operand is a NaN.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N,Z and Q flags being cleared and the C and V flags being set.
Example: Function __eqdf2
#include <stdio.h>

int main(void)
{
double x = 1.2345, y = 6.7;

if( __eqdf2(x, y) == 0)
printf("%.2lf is equal to %.2lf\n", x, y);
else
printf("%.2lf is not equal to %.2lf\n", x, y);
return 0;
}

The program above produces the following output:

1.23 is not equal to 6.70
See Also


__eqsf2
Syntax
long
__eqsf2(float x, float y);
Description

The function __eqsf2 compares two 32-bit single precision floating point values for equality,
returning the result as a 32-bit signed integer. The function calculates x-y, and sets the return values according to the result, the result itself being thrown away. Both x and y may be any valid single precision values.

The return from this function is:

    Value
    Description
    0
    if equal.
    1
    if not equal, or an operand is a NaN.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N,Z and Q flags being cleared and the C and V flags being set.
Example: Function __eqsf2
#include <stdio.h>

int main(void)
{
float x = 1.234, y = 2.468;

if( __eqsf2(x, y) == 0)
printf("%.2lf is equal to %.2f\n", x, y);
else
printf("%.2lf is not equal to %.2f\n", x, y);
return 0;
}

The program above produces the following output:

1.23 is not equal to 2.47
See Also


__extendsfdf2
Syntax
double
__extendsfdf2(float x);
Description

The function __extendsfdf2 converts a 32-bit single precision floating point value into a 64-bit double precision floating point value. The argument x may be any valid single precision floating point value, and the function returns a double precision floating point value.

Diagnostics
    Infinity
    If the given operand is ±infinity, the result will be ±infinity.
    NaNs
    If the given operand is a NaN, the result will be a NaN.
Example: Function __extendsfdf2
#include <stdio.h>

int main(void)
{
float x = -1.5234;

printf("The double precision value of %.4f is %.9lf\n", x, __extendsfdf2(x));

return 0;
}

The program above produces the following output:

The double precision value of -1.5234 is -1.523400000
See Also

"__fixdfdi"
"__fixdfsi"
"__fixsfdi"
"__fixsfsi"
"__fixunsdfdi"
"__fixunsdfsi"
"__fixunssfdi"
"__fixunssfsi"
"__floatdidf"
"__floatdisf"
"__floatsidf"
"__floatsisf"
"__floatunsdidf"
"__floatunsdisf"
"__floatunssidf"
"__floatunssisf"
"__truncdfsf2"


__fixdfdi
Syntax
long long
__fixdfdi(double x);
Description

The function __fixdfdi converts a 64-bit double precision floating point value into a 64-bit signed integer. The argument x may be any valid double precision value.

Diagnostics
    Out of Range
    If the result after rounding is less than -263, the result is forced to the hexadecimal value 0x8000000000000000. If the result after rounding is greater than 263 - 1, the result is forced to the hexadecimal value 0x7FFFFFFFFFFFFFFF.
    Infinity
    If the given operand is -infinity, the result is forced to the hexadecimal value 0x8000000000000000. If the given operand is +infinity, the result is forced to the hexadecimal value 0x7FFFFFFFFFFFFFFF.
    NaNs
    If the given operand is a NaN, the result is forced to the hexadecimal value 0x0000000000000000.
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __fixdfdi
#include <stdio.h>

int main(void)
{
double x = -0.54321e12;

printf("The value %lf expressed as an integer is %ld\n", x, __fixdfdi(x));
return 0;
}

The program above produces the following output:

The value -0.54321e12 expressed as an integer is -543210000000
See Also


__fixdfsi
Syntax
long
__fixdfsi(double x);
Description

The function __fixdfsi converts a 64-bit double precision floating point value into a 32-bit signed integer. The argument x may be any valid double precision value.

Diagnostics
    Out of Range
    If the result after rounding is less than -231, the result is forced to the hexadecimal value 0x80000000. If the result after rounding is greater than 231 - 1, the result is forced to the hexadecimal value 0x7FFFFFFF.
    Infinity
    If the given operand is -infinity, the result is forced to the hexadecimal value 0x80000000. If the given operand is +infinity, the result is forced to the hexadecimal value 0x7FFFFFFF.
    NaNs
    If the given operand is a NaN, the result is forced to the hexadecimal value 0x00000000.
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __fixdfsi
#include <stdio.h>

int main(void)
{
double x = -0.54321e6;

printf("The value %lf expressed as an integer is %d\n", x, __fixdfsi(x));
return 0;
}

The program above produces the following output:

The value -0.54321e6 expressed as an integer is -543210
See Also


__fixsfdi
Syntax
long long
__fixsfdi(float x);
Description

The function __fixsfdi converts a 32-bit single precision floating point value into a 64-bit signed integer. The argument x may be any valid single precision value.

Diagnostics
    Out of Range
    If the result after rounding is less than -263, the result is forced to the hexadecimal value 0x8000000000000000. If the result after rounding is greater than 263 - 1, the result is forced to the hexadecimal value 0x7FFFFFFFFFFFFFFF.
    Infinity
    If the given operand is -infinity, the result is forced to the hexadecimal value 0x8000000000000000. If the given operand is +infinity, the result is forced to the hexadecimal value 0x7FFFFFFFFFFFFFFF.
    NaNs
    If the given operand is a NaN, the result is forced to the hexadecimal value 0x0000000000000000.
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __fixsfdi
#include <stdio.h>

int main(void)
{
float x = -0.54321e12;

printf("The value %f expressed as an integer is %ld\n", x, __fixsfdi(x));

return 0;
}

The program above produces the following output:

The value -0.54321e12 expressed as an integer is -543210000000
See Also


__fixsfsi
Syntax
long
__fixsfsi(float x);
Description

The __fixsfsi function converts a 32-bit single precision floating point value into a 32-bit signed integer. The argument x may be any valid single precision value.

Diagnostics
    Out of Range
    If the result after rounding is less than -231, the result is forced to the hexadecimal value 0x80000000. If the result after rounding is greater than 231 - 1, the result is forced to the hexadecimal value 0x7FFFFFFF.
    Infinity
    If the given operand is -infinity, the result is forced to the hexadecimal value 0x80000000. If the given operand is +infinity, the result is forced to the hexadecimal value 0x7FFFFFFF.
    NaNs
    If the given operand is a NaN, the result is forced to the hexadecimal value 0x00000000.
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __fixsfsi
#include <stdio.h>

int main(void)
{
float x = -0.54321e6;

printf("The value %f expressed as an integer is %d\n", x, __fixsfsi(x));
return 0;
}

The program above produces the following output:

The value -0.54321e6 expressed as an integer is -543210
See Also


__fixunsdfdi
Syntax
unsigned long long
__fixunsdfdi(double x);
Description

The function __fixunsdfdi converts a 64-bit double precision floating point value into a 64-bit unsigned integer. The argument x may be any valid positive double precision value.

Diagnostics
    Out of Range
    If the result after rounding is less than 0, the result is forced to the hexadecimal value 0x0000000000000000. If the result after rounding is greater than 264 - 1, the result is forced to the hexadecimal value 0xFFFFFFFFFFFFFFFF.
    Infinity
    If the given operand is -infinity, the result is forced to the hexadecimal value 0x0000000000000000. If the given operand is +infinity, the result is forced to the hexadecimal value 0xFFFFFFFFFFFFFFFF.
    NaNs
    If the given operand is a NaN, the result is forced to the hexadecimal value 0x0000000000000000.
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __fixunsdfdi
#include <stdio.h>

int main(void)
{
double x = 0.54321e12;

printf("The value %lf expressed as an integer is %lu\n", x, __fixunsdfdi(x));

return 0;
}

The program above produces the following output:

The value 0.54321e12 expressed as an integer is 543210000000
See Also


__fixunsdfsi
Syntax
unsigned long
__fixunsdfsi(double x);
Description

The function __fixunsdfsi converts a 64-bit double precision floating point value into a 32-bit unsigned integer. The argument x may be any valid positive double precision value.

Diagnostics
    Out of Range
    If the result after rounding is less than 0, the result is forced to the hexadecimal value 0x00000000. If the result after rounding is greater than 232 - 1, the result is forced to the hexadecimal value 0xFFFFFFFF.
    Infinity
    If the given operand is -infinity, the result is forced to the hexadecimal value 0x00000000. If the given operand is +infinity, the result is forced to the hexadecimal value 0xFFFFFFFF.
    NaNs
    If the given operand is a NaN, the result is forced to the hexadecimal value 0x00000000.
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __fixunsdfsi
#include <stdio.h>

int main(void)
{
double x = 0.54321e6;

printf("The value %lf expressed as an integer is %u\n", x, __fixunsdfsi(x));
return 0;
}

The program above produces the following output:

The value 0.54321e6 expressed as an integer is 543210
See Also


__fixunssfdi
Syntax
unsigned long long
__fixunssfdi(float x);
Description

The function __fixunssfdi converts a 32-bit single precision floating point value into a 64-bit unsigned integer. The argument x may be any valid positive single precision value.

Diagnostics
    Out of Range
    If the result after rounding is less than 0, the result is forced to the hexadecimal value 0x0000000000000000. If the result after rounding is greater than 264 - 1, the result is forced to the hexadecimal value 0xFFFFFFFFFFFFFFFF.
    Infinity
    If the given operand is -infinity, the result is forced to the hexadecimal value 0x0000000000000000. If the given operand is +infinity, the result is forced to the hexadecimal value 0xFFFFFFFFFFFFFFFF.
    NaNs
    If the given operand is a NaN, the result is forced to the hexadecimal value 0x0000000000000000.
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __fixunssfdi
#include <stdio.h>

int main(void)
{
float x = 0.54321e12;

printf("The value %f expressed as an integer is %lu\n", x, __fixunssfdi(x));

return 0;
}

The program above produces the following output:

The value 0.54321e12 expressed as an integer is 543210000000
See Also


__fixunssfsi
Syntax
unsigned long
__fixunssfsi(float x);
Description

The function __fixunssfsi converts a 32-bit single precision floating point value into a 32-bit unsigned integer. The argument x may be any valid positive single precision value.

Diagnostics
    Out of Range
    If the result after rounding is less than 0, the result is forced to the hexadecimal value 0x00000000. If the result after rounding is greater than 232 - 1, the result is forced to the hexadecimal value 0xFFFFFFFF.
    Infinity
    If the given operand is -infinity, the result is forced to the hexadecimal value 0x00000000. If the given operand is +infinity, the result is forced to the hexadecimal value 0xFFFFFFFF.
    NaNs
    If the given operand is a NaN, the result is forced to the hexadecimal value 0x00000000.
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __fixunssfsi
#include <stdio.h>

int main(void)
{
float x = 0.54321e6;

printf("The value %f expressed as an integer is %u\n", x, __fixunssfsi(x));
return 0;
}

The program above produces the following output:

The value 0.54321e6 expressed as an integer is 543210
See Also


__floatdidf
Syntax
double
__floatdidf(long long x);
Description

The function __floatdidf converts a 64-bit signed integer into a 64-bit double precision floating point value. The argument x may be any valid 64-bit signed integer.

Diagnostics
    Zero
    A given integer of 0 will result in +0.0
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __floatdidf
#include <stdio.h>

int main(void)
{
long long x = -12345;

printf("The value %ld expressed as a double is %.6lf\n", x, __floatdidf(x));
return 0;
}

The program above produces the following output:

The value -12345 expressed as a double is -1.234500e4
See Also


__floatdisf
Syntax
float
__floatdisf(long long x);
Description

The function __floatdisf converts a 64-bit signed integer into a 32-bit single precision floating point value. The argument x may be any valid 64-bit signed integer.

Diagnostics
    Zero
    A given integer of 0 will result in +0.0
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __floatdisf
#include <stdio.h>

int main(void)
{
long long x = -12345;

printf("The value %ld expressed as a float is %.6f\n", x, __floatdisf(x));
return 0;
}

The program above produces the following output:

The value -12345 expressed as a float is -1.234500e4
See Also


__floatsidf
Syntax
double
__floatsidf(long x);
Description

The function __floatsidf converts a 32-bit signed integer into a 64-bit double precision floating point value. The argument x may be any valid 32-bit signed integer.

Diagnostics
    Zero
    A given integer of 0 will result in +0.0
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __floatsidf
#include <stdio.h>

int main(void)
{
unsigned long x = -12345;

printf("The value %d expressed as a double is %.6lf\n", x, __floatsidf(x));
return 0;
}

The program above produces the following output:

The value -12345 expressed as a double is -1.234500e4
See Also


__floatsisf
Syntax
float
__floatsisf(long x);
Description

The function __floatsisf converts a 32-bit signed integer into a 32-bit single precision floating point value. The argument x may be any valid 32-bit signed integer.

Diagnostics
    Zero
    A given integer of 0 will result in +0.0
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __floatsisf
#include <stdio.h>

int main(void)
{
unsigned long x = -12345;

printf("The value %d expressed as a float is %.6f\n", x, __floatsisf(x));
return 0;
}

The program above produces the following output:

The value -12345 expressed as a float is -1.234500e4
See Also


__floatunsdidf
Syntax
double
__floatunsdidf(unsigned long long x);
Description

The function __floatunsdidf converts a 64-bit unsigned integer into a 64-bit double precision floating point value. The argument x may be any valid 64-bit unsigned integer.

Diagnostics
    Zero
    A given integer of 0 will result in +0.0
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __floatunsdidf
#include <stdio.h>

int main(void)
{
unsigned long x = 12345;

printf("The value %lu expressed as a double is %.6lf\n", x, __floatunsdidf(x));
return 0;
}

The program above produces the following output:

The value 12345 expressed as a double is 1.234500e4
See Also


__floatunsdisf
Syntax
float
__floatunsdisf(unsigned long long x);
Description

The function __floatunsdisf converts a 64-bit unsigned integer into a 32-bit single precision floating point value. The argument x may be any valid 64-bit unsigned integer.

Diagnostics
    Zero
    A given integer of 0 will result in +0.0
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __floatunsdisf
#include <stdio.h>

int main(void)
{
unsigned long x = 12345;

printf("The value %lu expressed as a float is %.6f\n", x, __floatunsdisf(x));
return 0;
}

The program above produces the following output:

The value 12345 expressed as a float is 1.234500e4
See Also


__floatunssidf
Syntax
double
__floatunssidf(unsigned long x);
Description

The function __floatunssidf converts a 32-bit unsigned integer into a 64-bit double precision floating point value. The argument x may be any valid 32-bit unsigned integer.

Diagnostics
    Zero
    A given integer of 0 will result in +0.0
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __floatunssidf
#include <stdio.h>

int main(void)
{
unsigned long x = 12345;

printf("The value %u expressed as a double is %.6lf\n", x, __floatunssidf(x));
return 0;
}

The program above produces the following output:

The value 12345 expressed as a double is 1.234500e4
See Also


__floatunssisf
Syntax
float
__floatunssisf(unsigned long x);
Description

The function __floatunssisf converts a 32-bit unsigned integer into a 32-bit single precision floating point value. The argument x may be any valid 32-bit unsigned integer.

Diagnostics
    Zero
    A given integer of 0 will result in +0.0
    In Range
    Accuracy of the result may suffer if an exact conversion cannot be made.
Example: Function __floatunssisf
#include <stdio.h>

int main(void)
{
unsigned long x = 12345;

printf("The value %u expressed as a float is %.6f\n", x, __floatunssisf(x));
return 0;
}

The program above produces the following output:

The value 12345 expressed as a float is 1.234500e4
See Also


__gedf2
Syntax
long
__gedf2(double x, double y);
Description

The function __gedf2 compares two 64-bit double precision floating point values being greater than or equal to, returning the result as a 32-bit signed integer. The function carries out x-y, setting the return value according to the result, the result itself being thrown away. The parameters x and y may be any valid double precision values.

The return value of this function is:

    Value
    Description
    -1
    if x is less than y, or an operand is a NaN.
    0
    if x is equal to y.
    1
    if x is greater than y.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N, Z and Q flags being cleared and the C and V flags being set.
Example: Function __gedf2
#include <stdio.h>

int main(void)
{
double x = 1.2345, y = 6.7;

if( __gedf2(x, y) >= 0)
printf("%.2lf is greater than or equal to %.2lf\n", y, x);
else
printf("%.2lf is less than %.2lf\n", y, x);
return 0;
}

The program above produces the following output:

6.70 is greater than or equal to 1.23
See Also


__gesf2
Syntax
long
__gesf2(float x, float y);
Description

The function __gesf2 compares two 32-bit single precision floating point values on being greater than or equal to, returning the result as a 32-bit signed integer. The function carries out x-y, setting the return value according to the result, the result itself being thrown away. The parameters x and y may be any valid single precision values.

The return value of this function is:

    Value
    Description
    -1
    if x is less than y, or an operand is a NaN.
    0
    if x is equal to y.
    1
    if x is greater than y.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N, Z and Q flags being cleared and the C and V flags being set.
Example: Function __gesf2
#include <stdio.h>

int main(void)
{
float x = 12.345, y = 6.7;

if( __gesf2(x, y) >= 0)
printf("%.2f is greater than or equal to %.2f\n", y, x);
else
printf("%.2f is less than %.2f\n", y, x);
return 0;
}

The program above produces the following output:

6.70 is less than 12.35
See Also


__gtdf2
Syntax
long
__gtdf2(double x, double y);
Description

The function __gtdf2 compares two 64-bit double precision floating point values for being greater than, returning the result as a 32-bit signed integer. The function carries out x-y, setting the return value according to the result, the result itself being thrown away. The parameters x and y may be any valid double precision values.

The return value of this function is:

    Value
    Description
    -1
    if x is less than y, or an operand is a NaN.
    0
    if x is equal to y.
    1
    if x is greater than y.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N, Z and Q flags being cleared and the C and V flags being set.
Example: Function __gtdf2
#include <stdio.h>

int main(void)
{
double x = 1.2345, y = 6.7;

if( __gtdf2(x, y) > 0)
printf("%.2lf is greater than %.2lf\n", y, x);
else
printf("%.2lf is less than or equal to %.2lf\n", y, x);
return 0;
}

The program above produces the following output:

6.70 is greater than 1.23
See Also


__gtsf2
Syntax
long
__gtsf2(float x, float y);
Description

The function __gtsf2 compares two 32-bit single precision floating point values for being greater than, returning the result as a 32-bit signed integer. The function carries out x-y, setting the return value according to the result, the result itself being thrown away. The parameters x and y may be any valid single precision values.

The return value of this function is:

    Value
    Description
    -1
    if x is less than y, or an operand is a NaN.
    0
    if x is equal to y.
    1
    if x is greater than y.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaN
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N,Z and Q flags being cleared and the C and V flags being set.
Example: Function __gtsf2
#include <stdio.h>

int main(void)
{
float x = 12.345, y = 6.7;

if( __gtsf2(x, y) > 0)
printf("%.2f is greater than %.2f\n", y, x);
else
printf("%.2f is less than or equal to %.2f\n", y, x);
return 0;
}

The program above produces the following output:

6.70 is less than or equal to 12.35
See Also


__ledf2
Syntax
long
__ledf2(double x, double y);
Description

The function __ledf2 compares two 64-bit double precision floating point values being less than or equal to, returning the result as a 32-bit signed integer. The function carries out x-y, setting the return value according to the result, the result itself being thrown away. The parameters x and y may be any valid double precision values.

The return value of this function is:

    Value
    Description
    -1
    If x is less than y.
    0
    if x is equal to y.
    1
    if x is greater than y, or an operand is a NaN.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N, Z and Q flags being cleared and the C and V flags being set.
Example: Function __ledf2
#include <stdio.h>

int main(void)
{
double x = 1.2345, y = 6.7;

if( __ledf2(x, y) <= 0)
printf("%.2lf is less than or equal to %.2lf\n", y, x);
else
printf("%.2lf is greater than %.2lf\n", y, x);
return 0;
}

The program above produces the following output:

6.70 is greater than 1.23
See Also


__lesf2
Syntax
long
__lesf2(float x, float y);
Description

The function __lesf2 compares two 32-bit single precision floating point values being less than or equal to, returning the result as a 32-bit signed integer. The function carries out x-y,setting the return value according to the result, the result itself being thrown away. The parameters x and y may be any valid single precision values.

The return value of this function is:

    Value
    Description
    -1
    If x is less than y.
    0
    if x is equal to y.
    1
    if x is greater than y, or an operand is a NaN.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N, Z and Q flags being cleared and the C and V flags being set.
Example: Function __lesf2
#include <stdio.h>

int main(void)
{
float x = 12.345, y = 6.7;

if( __lesf2(x, y) <= 0)
printf("%.2f is less than or equal to %.2f\n", y, x);
else
printf("%.2f is greater than %.2f\n", y, x);
return 0;
}

The program above produces the following output:

6.70 is less than or equal to 12.35
See Also


__lshrdi3
Syntax
long long
__lshrdi3(long long x, unsigned long long y);
Description

The function __lshrdi3 carries out a logical shift right. The argument x is shifted right y value of times, and the result returned. Shifting by 64 or more places will yield a zero result. The x value to be shifted is any valid 64-bit signed integer, while the value of times to be shifted y may be any valid 64-bit unsigned integer.

Example: Function __lshrdi3
#include <stdio.h>

int main(void)
{
unsigned long x = 0x800;
unsigned long y = 3;

printf("The value %ld shifted %lu times is %ld\n", x, y, __lshrdi3(x, y));

return 0;
}

The program above produces the following output:

The value of 2048 shifted 3 times is 256
See Also


__ltdf2
Syntax
long
__ltdf2(double x, double y);
Description

The function __ltdf2 compares two 64-bit double precision floating point values being less than, returning the result as a 32-bit signed integer. The function carries out x-y, setting the return value according to the result, the result itself being thrown away. The parameters x and y may be any valid double precision values.

The return value of this function is:

    Value
    Description
    -1
    x is less than y.
    0
    if x is equal to y.
    1
    if x is greater than y, or an operand is a NaN.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N, Z and Q flags being cleared and the C and V flags being set.
Example: Function __ltdf2
#include <stdio.h>

int main(void)
{
double x = 1.2345, y = 6.7;

if( __ltdf2(x, y) < 0)
printf("%.2lf is less than %.2lf\n", y, x);
else
printf("%.2lf is greater than or equal to %.2lf\n", y, x);
return 0;
}

The program above produces the following output:

6.70 is greater than or equal to 1.23
See Also


__ltsf2
Syntax
long
__ltsf2(float x, float y);
Description

The function __ltsf2 compares two 32-bit single precision floating point values for the first being greater than the second, returning the result as a 32-bit signed integer. The function carries out x-y, setting the return value according to the result, the result itself being thrown away. The parameters x and y may be any valid single precision values.

The return value of this function is:

    Value
    Description
    -1
    If x is less than y.
    0
    if x is equal to y.
    1
    if x is greater than y, or an operand is a NaN.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N, Z and Q flags being cleared and the C and V flags being set.
Example: Function __ltsf2
#include <stdio.h>

int main(void)
{
float x = 12.345, y = 6.7;

if( __ltsf2(x, y) < 0)
printf("%.2f is less than %.2f\n", y, x);
else
printf("%.2f is greater than or equal to %.2f\n", y, x);
return 0;
}

The program above produces the following output:

6.70 is less than 12.35
See Also


__moddi3
Syntax
long long
__moddi3(long long x, long long y);
Description

The function __moddi3 carries out a modulus division of one 64-bit signed integer value by another to form a 64-bit signed integer result. The result is integer remainder of x/y. Both x and y may be any valid 64-bit signed integers.

Diagnostics
    Divide by Zero
    The result becomes the largest value it can be 0x7FFFFFFFFFFFFFFF.
Example: Function __moddi3
#include <stdio.h>

int main(void)
{
long x = -7, y = -2;

printf("The remainder of %ld / %ld is %ld\n", x, y, __moddi3(x, y));

return 0;
}

The program above produces the following output:

The remainder of -7 / -2 is -1
See Also


__modsi3
Syntax
long
__modsi3(long x, long y);
Description

The function __modsi3 carries out a modulus division of one 32-bit signed integer value by another to form a 32-bit signed integer result. The result is integer remainder of x/y. Both x and y may be any valid 32-bit signed integers.

Diagnostics
    Divide by Zero
    The result becomes the largest value it can be 0x7FFFFFFF.
Example: Function __modsi3
#include <stdio.h>

int main(void)
{
long x = -11, y = 3;

printf("The remainder of %d / %d is %d\n", x, y, __modsi3(x, y));

return 0;
}

The program above produces the following output:

The remainder of -11 / 3 is -2
See Also


__muldf3
Syntax
double
__muldf3(double x, double y);
Description

The function __muldf3 multiplies two 64-bit double precision floating point values to form a 64-bit double precision floating point result.

Diagnostics
    Underflow
    The result becomes zero if it is too small to be held as a double precision floating point value. +0 for positive, and -0 for negative values.
    Overflow
    The result becomes infinity if it is too large to be held as a double precision floating point value. +· for positive, and -· for negative values.
    Infinity
    If both inputs are ±infinity, this produces ±infinity with the correct sign. If one input is ±infinity with the other a non-zero value, this produces ±infinity with the correct sign. If one input is zero and the other ±infinity, this produces a NaN.
    NaNs
    If either or both inputs are NaNs, this produces a NaN. If one input is zero and the other ±infinity, this produces a NaN.
Example: Function __muldf3
#include <stdio.h>

int main(void)
{
double x = .5, y = 10.;

printf("The value of %.2lf * %.2lf is %.2lf\n", x, y, __muldf3(x, y));

return 0;
}

The program above produces the following output:

The value of 0.50 * 10.00 is 5.00
See Also


__mulsf3
Syntax
float
__mulsf3(float x, float y);
Description

The function __mulsf3 multiplies two 32-bit single precision floating point values to form a 32-bit single precision floating point result.

Diagnostics
    Underflow
    The result becomes zero if it is too small to be held as a single precision floating point value. +0 for positive, and -0 for negative values.
    Overflow
    The result becomes infinity if it is too large to be held as a single precision floating point value. +· for positive, and -· for negative values.
    Infinity
    If both inputs are ±infinity, this produces ±infinity with the correct sign. If one input is ±infinity with the other a non-zero value, this produces ±infinity with the correct sign. If one input is zero and the other ±infinity, this produces a NaN.
    NaNs
    If either or both inputs are NaNs, this produces a NaN. If one input is zero and the other ±infinity, this produces a NaN.
Example: Function __mulsf3
#include <stdio.h>

int main(void)
{
float x = .5, y = 10.;

printf("The value of %.2f * %.2f is %.2f\n", x, y, __mulsf3(x, y));

return 0;
}

The program above produces the following output:

The value of 0.50 * 10.00 is 5.00
See Also


__nedf2
Syntax
long
__nedf2(double x, double y);
Description

The function __nedf2 compares two 64-bit double precision floating point values, returning the result as a 32-bit signed integer. The function carries out x-y, setting the return value according to the result, the result itself being thrown away. The parameters x and y may be any valid double precision values.

The return value of this function is:

    Value
    Description
    0
    if x is equal to y, or an operand is a NaN.
    1
    if x is not equal to y.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N, Z and Q flags being cleared and the C and V flags being set.
Example: Function __nedf2
#include <stdio.h>

int main(void)
{
double x = 1.2345, y = 6.7;

if( __nedf2(x, y))
printf("%.2lf is not equal to %.2lf\n", x, y);
else
printf("%.2lf is equal to %.2lf\n", x, y);
return 0;
}

The program above produces the following output:

1.23 is not equal to 6.70
See Also


__negdf2
Syntax
double
__negdf2(double x);
Description

The function __negdf2 negates a 64-bit double precision floating point value. Its sign is changed. The given argument x may be any valid double precision floating point value, and the function returns a double precision floating point value.

Example: Function __negdf2
#include <stdio.h>

int main(void)
{
double x = 9.579711e7;

printf("The negative value of %.2lf is %.2lf\n", x, __negdf2(x));

return 0;
}

The program above produces the following output:

The negative value of 9.579711e7 is -9.579711e7
See Also


__negsf2
Syntax
float
__negsf2(float x);
Description

The function __negsf2 negates a 32-bit single precision floating point value. Its sign is changed. The given argument x may be any valid single precision floating point value, and the function returns a single precision floating point value.

Example: Function __negsf2
#include <stdio.h>

int main(void)
{
float x = 1.2345;

printf("The negative value of %.2f is %.2f\n", x, __negsf2(x));

return 0;
}

The program above produces the following output:

The negative value of 1.23 is -1.23
See Also


__nesf2
Syntax
long
__nesf2(float x, float y);
Description

The function __nesf2 compares two 32-bit single precision floating point values, returning the result as a 32-bit signed integer. The function carries out x-y, setting the return value according to the result, the result itself being thrown away. The parameters x and y may be any valid single precision values.

The return from this function is:

    Value
    Description
    0
    if x is equal to y, or an operand is a NaN.
    1
    if x is not equal to y.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N,Z and Q flags being cleared and the C and V flags being set.
Example: Function __nesf2
#include <stdio.h>

int main(void)
{
float x = 1.234, y = 1.234;

if( __nesf2(x, y))
printf("%.2lf is not equal to %.2f\n", x, y);
else
printf("%.2lf is equal to %.2f\n", x, y);
return 0;
}

The program above produces the following output:

1.23 is equal to 1.23
See Also


__subdf3
Syntax
double
__subdf3(double x, double y);
Description

The function __subdf3 subtracts one 64-bit double precision floating point value from another to form a 64-bit double precision floating point result. The result is x-y. Both x and y may be any valid double precision values.

Diagnostics
    Underflow
    The result becomes zero if it is too small to be held as a double precision floating point value. +0 for positive, and -0 for negative values.
    Overflow
    The result becomes infinity if it is too large to be held as a double precision floating point value. +· for positive, and -· for negative values.
    Infinity
    If only one input is +infinity the result is +infinity. If only one input is -infinity the result is -infinity. +infinity minus -infinity produces +infinity. -infinity minus +infinity produces -infinity. If both inputs are +infinity, or both -infinity the result is a NaN.
    NaNs
    If either or both inputs are NaNs, this produces a NaN. If both inputs are +infinity, or both -infinity the result is a NaN.
Example: Function __subdf3
#include <stdio.h>

int main(void)
{
double x = .5, y = 10.;

printf("The value of %.2lf - %.2lf is %.2lf\n", x, y, __subdf3(x, y));

return 0;
}

The program above produces the following output:

The value of 0.50 - 10.00 is -9.50
See Also


__subsf3
Syntax
float
__subsf3(float x, float y);
Description

The function __subsf3 subtracts one 32-bit single precision floating point value from another to form a 32-bit single precision floating point result. The result is x-y. Both x and y may be any valid single precision values.

Diagnostics
    Underflow
    The result becomes zero if it is too small to be held as a single precision floating point value. +0 for positive, and -0 for negative values.
    Overflow
    The result becomes infinity if it is too large to be held as a single precision floating point value. +· for positive, and -· for negative values.
    Infinity
    If only one input is +infinity the result is +infinity. If only one input is -infinity the result is -infinity. +infinity minus -infinity produces +infinity. -infinity minus +infinity produces -infinity. If both inputs are +infinity, or both -infinity the result is a NaN.
    NaNs
    If either or both inputs are NaNs, this produces a NaN. If both inputs are +infinity, or both -infinity the result is a NaN.
Example: Function __subsf3
#include <stdio.h>

int main(void)
{
float x = .5, y = 10.;

printf("The value of %.2f - %.2f is %.2f\n", x, y, __subsf3(x, y));

return 0;
}

The program above produces the following output:

The value of 0.50 - 10.00 is -9.50
See Also


__truncdfsf2
Syntax
float
__truncdfsf2(double x);
Description

The function __truncdfsf2 converts a 64-bit double precision floating point value into a 32-bit single precision floating point value. The argument x may be any valid double precision floating point value, and the function returns a single precision floating point value.

Diagnostics
    Out of Range
    If the value of the given operand is too large, the result will be ±infinity.
    Infinity
    If the given operand is ±infinity, the result will be ±infinity.
    NaNs
    If the given operand is a NaN, the result will be a NaN.
Example: Function __truncdfsf2
#include <stdio.h>

int main(void)
{
double x = .5;

printf("The single precision value of %.2lf is %.2f\n", x, __truncdfsf2(x));

return 0;
}

The program above produces the following output:

The single precision value of 0.50 is 0.50
See Also

"__extendsfdf2"
"__fixdfdi"
"__fixdfsi"
"__fixsfdi"
"__fixsfsi"
"__fixunsdfdi"
"__fixunsdfsi"
"__fixunssfdi"
"__fixunssfsi"
"__floatdidf"
"__floatdisf"
"__floatsidf"
"__floatsisf"
"__floatunsdidf"
"__floatunsdisf"
"__floatunssidf"
"__floatunssisf"


__udivdi3
Syntax
unsigned long long
__udivdi3(unsigned long long x, unsigned long long y);
Description

The function __udivdi3 carries out an integer division of one 64-bit unsigned integer value by another to form a 64-bit unsigned integer result. The result is integer x/y. Both x and y may be any valid 64-bit unsigned integers.

Diagnostics
    Divide by Zero
    The result becomes the largest value it can be 0xFFFFFFFFFFFFFFFF.
Example: Function __udivdi3
#include <stdio.h>

int main(void)
{
unsigned long long x = 7, y = 2;

printf("The value of integer %lu / %lu is %lu\n", x, y, __udivdi3(x, y));

return 0;
}

The program above produces the following output:

The value of integer 7 / 2 is 3
See Also


__udivsi3
Syntax
unsigned long
__udivsi3(unsigned long x, unsigned long y);
Description

The function __udivsi3 carries out an integer division of one 32-bit unsigned integer value by another to form a 32-bit unsigned integer result. The result is integer x/y. Both x and y may be any valid 32-bit unsigned integers.

Diagnostics
    Divide by Zero
    The result becomes the largest value it can be 0xFFFFFFFF.
Example: Function __udivsi3
#include <stdio.h>

int main(void)
{
unsigned long x = 7, y = 2;

printf("The value of integer %u / %u is %u\n", x, y, __udivsi3(x, y));

return 0;
}

The program above produces the following output:

The value of integer 7 / 2 is 3
See Also


__umoddi3
Syntax
unsigned long long
__umoddi3(unsigned long long x, unsigned long long y);
Description

The function __umoddi3 carries out a modulus division of one 64-bit unsigned integer value by another to form a 64-bit unsigned integer result. The result being the remainder of the integer division product. Both x and y may be any valid 64-bit unsigned integers.

Diagnostics
    Divide by Zero
    The result becomes the largest value it can be 0xFFFFFFFFFFFFFFFF.
Example: Function __umoddi3
#include <stdio.h>

int main(void)
{
unsigned long long x = 7, y = 2;

printf("The remainder of integer %lu / %lu is %lu\n", x, y, __umoddi3(x, y));

return 0;
}

The program above produces the following output:

The remainder of integer 7 / 2 is 1
See Also


__umodsi3
Syntax
unsigned long
__umodsi3(unsigned long x, unsigned long y);
Description

The function __umodsi3 carries out a modulus division of one 32-bit unsigned integer value by another to form a 32-bit unsigned integer result. The result being the remainder of the integer division product. The result is integer remainder of x/y. Both x and y may be any valid 32-bit unsigned integers.

Diagnostics
    Divide by Zero
    The result becomes the largest value it can be 0xFFFFFFFF.
Example: Function __umodsi3
#include <stdio.h>

int main(void)
{
unsigned long x = 11, y = 3;

printf("The remainder of integer %u / %u is %u\n", x, y, __umodsi3(x, y));

return 0;
}

The program above produces the following output:

The remainder of integer 11 / 3 is 2
See Also


_lmul
Syntax
long long
_lmul(long long x, long long y);
Description

The function _lmul multiplies two 64-bit signed integer values to form a 64-bit signed integer result.

Diagnostics
    Overflow
    The result becomes the largest value it can be 0x7FFFFFFFFFFFFFFF.
Example: Function _lmul
#include <stdio.h>

int main(void)
{
long long x = -72, y = -3;

printf("The value of %ld * %ld is %ld\n", x, y, _lmul(x, y));

return 0;
}

The program above produces the following output:

The value of integer -72 * -3 is 216
See Also

"ftp8"


_memcopy
Syntax
unsigned long
_memcopy(unsigned long dest, unsigned long source, unsigned long len);
Description

The function _memcopy copies one section of memory to another.

The address where to start copying to (the destination address) is taken from argument dest. The address from which the copying is to start (the source address) is taken from argument source. The number of bytes to copy is taken from argument len.

The data at memory address source is copied to the memory address dest. Then dest and source are incremented and the next byte is copied between them. This is repeated until the value of bytes copied is equal to the value len.

Since both dest and source are addresses, they must be 32-bit unsigned integers. The number of bytes to be copied, len, must be a positive value, therefore it too must be a 32-bit unsigned integer.

Warning icon WARNING.
If the areas of memory being copied overlap and the source start address is before the destination start address (source<=dest<=source+len) then incorrect data will result.

Example: Function _memcopy
#include <stdio.h>

int main(void)
{
unsigned long x = 0x8000, y = 0x1000, z = 0x400;

printf("Destination address is %X\n", x );
printf("Source address is %X\n", y );
printf("Number of bytes to copy is %X\n", z )
printf("Final destination address is %X\n", _memcopy(x, y, z));

return 0;
}

The program above produces the following output:

Destination address is 0x8000
Source address is 0x1000
Number of bytes to copy is 0x400
Final destination address is 0x83FF
See Also

"ftp8"


ftp8
Syntax
long
ftp8(double x);
Description

The function ftp8 tests given argument x and returns an analysis. The value x being tested may be any valid 64-bit double precision floating point value.

The returned analysis is a 32-bit signed integer, whose bits are:

s000 0000 0000 0000 0000 0000 000N Idnz

where

    s
    sign bit, 1 is negative, 0 is positive.
    N
    if 1 then number is a NaN (Not a Number).
    I
    if 1 then number is an infinity value.
    d
    if 1 then number is a "de-normalized" number.
    n
    if 1 then number is a "normal" number.
    z
    if 1 then number has zero value.

Example: Function ftp8
#include <stdio.h>

int main(void)
{
double x = -1.67e31;
printf("The analysis of %.2lf is %lx\n", x, ftp8( x ));
return 0;
}

The program above produces the following output:

The analysis of -1.67e31 is 0x8000002
See Also


The Intel® Libm Mathematical Library

Intel also supplies a mathematical library which enhances the performance of the Intel® C++ Compiler. It also includes single precision floating point versions of the traditional double precision mathematical functions. All these functions are included in the x0__ar10.lib library.

Table: Summary of Double Precision Functions in the Libm Library
Function | Description | See also
asin | arc sine | "asin"
acos | arc cosine | "acos"
acosh | arc hyperbolic cosine | "acosh"
atan | arc tangent | "atan"
atan2 | 2 argument arc tangent | "atan2"
sin | sine | "sin"
sinh | hyperbolic sine | "sinh"
cos | cosine | "cos"
tan | tangent | "tan"
tanh | hyperbolic tangent | "tanh"
exp | exponential | "exp"
exp10 | base 10 exponential | "exp10"
exp2 | base 2 exponential | "exp2"
expm1 | exponential minus 1 | "expm1"
log | natural logarithm | "log"
log10 | base 10 logarithm | "log10"
log1p | natural logarithm plus 1 | "log1p"
log2 | base 2 logarithm | "log2"
logb | natural logarithm as an integer in floating point format | "logb"
ilogb | natural logarithm as an integer | "ilogb"
sqrt | square root | "sqrt"
pow | number raised to a power | "pow"
lround | round to a long integer | "lround"
llround | round to a long long integer | "llround"
trunc | truncate to an integer, but returned in floating point format | "trunc"

Table: Summary of Single Precision Functions in the Libm Library
Function | Description | See also
asinf | arc sine | "asinf"
acosf | arc cosine | "acosf"
acoshf | arc hyperbolic cosine | "acoshf"
atanf | arc tangent | "atanhf"
atan2f | 2 argument arc tangent | "atan2f"
atanhf | arc hyperbolic tangent | "atanhf"
sinf | sine | "sinf"
sinhf | hyperbolic sine | "sinhf"
cosf | cosine | "cosf"
coshf | hyperbolic cosine | "coshf"
tanf | tangent | "tanf"
tanhf | hyperbolic tangent | "tanhf"
expf | exponential | "expf"
exp10f | base 10 exponential | "exp10f"
exp2f | base 2 exponential | "exp2f"
expm1f | exponential minus 1 | "expm1f"
logf | natural logarithm | "logf"
log10f | base 10 logarithm | "log10f"
log1pf | natural logarithm plus 1 | "log1pf"
log2f | base 2 logarithm | "log2f"
logbf | natural logarithm as an integer in floating point format | "logbf"
ilogbf | natural logarithm as an integer | "ilogbf"
sqrtf | square root | "sqrtf"
cbrtf | cube root | "cbrtf"
powf | number raised to a power | "powf"
lroundf | round to a long integer | "lroundf"
llroundf | round to a long long integer | "llroundf"
truncf | truncate to an integer, but returned in floating point format | "truncf"


acos
Syntax
#include <math.h>
double acos (double x);
Description

The function acos computes the arc cosine of x in the range of 0 to p radians. The parameter x may be any valid floating point value in the range of [-1,1].

Diagnostics

The function acos returns the arc cosine in the range of [0,p]. If x is less than -1 or greater than 1, the function sets errno to EDOM. In this case the return value is 0.

Example: Function acos
#include <stdio.h>

int main(void)
{
double x = .5;
printf("The arc cosine of %.2f is %lf.\n", x, acos(x));
return 0;
}

The program above produces the following output:

The arc cosine of 0.50 is 1.047198.
See Also


acosf
Syntax
#include <math.h>
float acosf (float x);
Description

The function acosf returns the arc cosine of x in the range of 0 to p radians. The parameter x must be between -1 and 1. This function is a single precision version of the double precision acos function.

Diagnostics

The function acosf returns the arc cosine in the range of [0,p]. If x is less than -1 or greater than 1, the function sets errno to EDOM. In this case the return value is 0.

Example: Function acosf
#include <stdio.h>

int main(void)
{
float x = .5;
printf("The arc cosine of %.2f is %f.\n", x, acosf(x));
return 0;
}

The program above produces the following output:

The arc cosine of 0.50 is 1.047198.

See Also


acosh
Syntax
#include <math.h>
double acoshf (double x);
Description

The function acosh computes the arc hyperbolic cosine of x in the range of 0 to p radians. The value of x must be between -1 and 1.

Diagnostics

The function acosh returns the arc hyperbolic cosine in the range of [0,p]. If x is less than -1 or greater than 1, the function sets errno to EDOM. In this case the return value is 0.

Example: Function acosh
#include <stdio.h>

int main(void)
{
double x = .5;
printf("The arc hyperbolic cosine of %.2f is %f.\n", x, acosh(x));
return 0;
}

The program above produces the following output:

The arc hyperbolic cosine of 0.50 is 1.047198.
See Also


acoshf
Syntax
#include <math.h>
float acoshf (float x);
Description

The function acoshf computes the arc hyperbolic cosine of x in the range of 0 to p radians. The value of x must be between -1 and 1. This function is a single precision version of the double precision function acosh.

Diagnostics

The function acoshf returns the arc hyperbolic cosine in the range of [0,p]. If x is less than -1 or greater than 1, the function sets errno to EDOM. In this case the return value is 0.

Example: Function acoshf
#include <stdio.h>

int main(void)
{
float x = .5;
printf("The arc hyperbolic cosine of %.2f is %f.\n", x, acoshf(x));
return 0;
}

The program above produces the following output:

The arc hyperbolic cosine of 0.50 is 1.047198.
See Also


asin
Syntax
#include <math.h>
double asin (double x);
Description

The function asin computes the arc sine of x in the range of -p/2 to p/2 radians. The value of x must be between -1 and 1.

Diagnostics

The function asin returns the arc sine in the range of [-p/2, p/2]. If x is less than -1 or greater than 1, the function sets errno to EDOM. In this case the return value is 0.

Example: Function asin
#include <stdio.h>

int main(void)
{
double x = .5;

printf("The arc sine of %.2lf is %lf\n", x, asin(x));
printf("arc cosine %lf\n", acos(x));
return 0;
}

The program above produces the following output:

The arc sine of 0.50 is 0.523599
arc cosine 1.047198
See Also


asinf
Syntax
#include <math.h>
float asinf (float x);
Description

The function asinf computes the arc sine of x in the range of -p/2 to p/2 radians. The value of x must be between -1 and 1. This function is a single precision version of the double precision function asin.

Diagnostics

The function asinf returns the arc sine in the range of [-p/2, p/2]. If x is less than -1 or greater than 1, the function sets errno to EDOM. In this case the return value is 0.

Example: Function asinf
#include <stdio.h>

int main(void)
{
float x = .5;

printf("The arc sine of %.2f is %f\n", x, asinf(x));
printf("arc cosine %f\n", acosf(x));
return 0;
}

The program above produces the following output:

The arc sine of 0.50 is 0.523599
arc cosine 1.047198
See Also


asinhf
Syntax
#include <math.h>
float asinhf (float x);
Description

The function asinhf computes the arc hyperbolic sine of x in the range of -p/2 to p/2 radians. The value of x must be between -1 and 1.

Diagnostics

The function asinhf returns the arc hyperbolic sine in the range of [-p/2, p/2]. If x is less than -1 or greater than 1, the function sets errno to EDOM. In this case the return value is 0.

Example: Function asinhf
#include <stdio.h>

int main(void)
{
float x = .5;

printf("The arc hyperbolic sine of %.2f is %f\n", x, asinhf(x));
printf("arc cosine %f\n", acosf(x));
return 0;
}

The program above produces the following output:

The arc hyperbolic sine of 0.50 is 0.050224
arc cosine 1.047198
See Also


atan
Syntax
#include <math.h>
double atan (double x);
Description

The function atan computes the arc tangent of x, where x may be any valid double precision floating point number.

Diagnostics

The function atan returns the arc tangent of x. The result is in the range of (-p/2, p/2).

Example: Function atan
#include <stdio.h>

int main(void)
{
double x = .5;

printf( "The arc tangent of %.2lf is %lf.\n", x, atan(x));
return 0;
}

The program above produces the following output:

The arc tangent of 0.50 is 0.463648.
See Also


atanf
Syntax
#include <math.h>
float atanf (float x);
Description

The function atanf computes the arc tangent of x, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function atan.

Diagnostics

The function atanf returns the arc tangent of x. The result is in the range of (-p/2, p/2).

Example: Function atanf
#include <stdio.h>

int main(void)
{
float x = .5;

printf( "The arc tangent of %.2f is %f.\n", x, atanf(x));
return 0;
}

The program above produces the following output:

The arc tangent of 0.50 is 0.463648.
See Also


atanhf
Syntax
#include <math.h>
float atanhf (float x);
Description

The function atanhf computes the arc hyperbolic tangent of x, where x may be any valid single precision floating point number.

Diagnostics

The function atanhf returns the arc hyperbolic tangent of x. The result is in the range of (-p/2, p/2).

Example: Function atanhf
#include <stdio.h>

int main(void)
{
float x = .5;

printf( "The arc hyperbolic tangent of %.2f is %f.\n", x, atanhf(x));
return 0;
}

The program above produces the following output:

The arc hyperbolic tangent of 0.50 is 0.000000.
See Also


atan2
Syntax
#include <math.h>
double atan2 (double y, double x);
Description

The function atan2 computes the arc tangent of y/x using the signs of both arguments to determine the quadrant of the return value, where x and y may be any valid double precision floating point numbers. Both arguments must not be zero at the same time.

Diagnostics

The function atan2 returns the arc tangent of y/x, in the range of [-p, p]. If x and y are both zero, the function sets errno to EDOM. In this case the return value is zero.

Example: Function atan2
#include <stdio.h>

int main(void)
{
double x = .5, y = 2.;

printf("The arc tangent of %.2lf/%.2lf = %.2lf is %lf.\n", x, y, x/y, atan2(x,y));
return 0;
}

The program above produces the following output:

The arc tangent of 0.50/2.00 = 0.25 is 0.244979.
See Also


atan2f
Syntax
#include <math.h>
float atan2f (float y, float x);
Description

The function atan2f computes the arc tangent of y/x using the signs of both arguments to determine the quadrant of the return value, where x and y may be any valid single precision floating point numbers. Both arguments must not be zero at the same time.
This function is a single precision version of the double precision function atan2.

Diagnostics

The function atan2f returns the arc tangent of y/x, in the range of [-p, p]. If x and y are both zero, the function sets errno to EDOM. In this case the return value is zero.

Example: Function atan2f
#include <stdio.h>

int main(void)
{
float x = .5, y = 2.;

printf("The arc tangent of %.2f/%.2f = %.2f is %f.\n", x, y, x/y, atan2f(x,y));
return 0;
}

The program above produces the following output:

The arc tangent of 0.50/2.00 = 0.25 is 0.244979.
See Also


cbrtf
Syntax
#include <math.h>
float cbrtf (float x);
Description

The function cbrtf computes the cube root of the argument x, where x may be any valid single precision floating point number.

Example: Function cbrtf
#include <stdio.h>

int main(void)
{
float x = -0.125;
printf("The cube root of %.3f is %f\n", x, cbrtf(x));
return 0;
}

The program above produces the following output:

The cube root of -0.125 is -0.500000
See Also


cos
Syntax
#include <math.h>
double cos (double x);
Description

The function cos calculates the cosine of x.

Diagnostics

The function cos returns the cosine value of x, where x may be any valid double precision floating point number. If x is large, a partial loss of significance in the result may occur.

Example: Function cos
#include <stdio.h>

int main(void)
{
double x = .5;
printf("The cosine of %.2lf is %lf\n", x, cos(x));
printf(" sine is %lf\n", sin(x));
return 0;
}

The program above produces the following output:

The cosine of 0.50 is 0.877583
sine is 0.479426
See Also


cosf
Syntax
#include <math.h>
float cosf (float x);
Description

The function cosf returns the cosine value of x, where x may be any valid single precision floating point number. If x is large, a partial loss of significance in the result may occur. This function is a single precision version of the double precision function cos.

Example: Function cosf
#include <stdio.h>

int main(void)
{
float x = .5;
printf("The cosine of %.2f is %f\n", x, cosf(x));
printf(" sine is %f\n", sinf(x));
return 0;
}

The program above produces the following output:

The cosine of 0.50 is 0.877583
sine is 0.479426
See Also


cosh
Syntax
#include <math.h>
double cosh (double x);
Description

The function cosh calculates the hyperbolic cosine of x, where x may be any valid double precision floating point number.

Diagnostics

The function cosh returns the hyperbolic cosine value of x. If x is too large (greater than DBL_MAX), the function returns HUGE_VAL and sets errno to ERANGE.

Example: Function cosh
#include <stdio.h>

int main(void)
{
double x = .5;

printf("The hyperbolic cosine of %.2lf is %lf\n", x, cosh(x));
printf("The hyperbolic sine is %lf\n", sinh(x));
printf("The cosine is %lf\n", cos(x));
return 0;
}

The program above produces the following output:

The hyperbolic cosine of 0.50 is 1.127626
The hyperbolic sine is 0.521095
The cosine is 0.877583
See Also


coshf
Syntax
#include <math.h>
float coshf (float x);
Description

The function coshf calculates the hyperbolic cosine of x, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function cosh.

Diagnostics

The function coshf returns the hyperbolic cosine value of x. If x is too large, the function returns HUGE_VALF and sets errno to ERANGE.

Example: Function coshf
#include <stdio.h>

int main(void)
{
float x = .5;

printf("The hyperbolic cosine of %.2f is %f\n", x, coshf(x));
printf("The hyperbolic sine is %f\n", sinhf(x));
printf("The cosine is %f\n", cosf(x));
return 0;
}

The program above produces the following output:

The hyperbolic cosine of 0.50 is 1.127626
The hyperbolic sine is 0.521095
The cosine is 0.877583
See Also


exp
Syntax
#include <math.h>
double exp (double x);
Description

The function exp computes the exponent of x, where x may be any valid double precision floating point number.

Diagnostics

The function returns ex. HUGE_VAL is returned on overflow and errno is set to ERANGE. On underflow, zero is returned but errno is not set.

Example: Function exp
#include <stdio.h>

int main(void)
{
double x = .5, y = 2.3025851;

printf("exp(%.2lf) = %lf\n", x, exp(x));
printf("exp(%lf) = %lf\n", y, exp(y));
return 0;
}

The program above produces the following output:

exp(0.50) = 1.648721
exp(2.302585) = 10.000000
See Also


expf
Syntax
#include <math.h>
float expf (float x);
Description

The function expf computes the exponent of x, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function exp.

Diagnostics

The function returns ex. HUGE_VALF is returned on overflow and errno is set to ERANGE. On underflow, zero is returned but errno is not set.

Example: Function expf
#include <stdio.h>

int main(void)
{
float x = .5, y = 2.3025851;

printf("exp(%.2f) = %f\n", x, expf(x));
printf("exp(%f) = %f\n", y, expf(y));
return 0;
}

The program above produces the following output:

exp(0.50) = 1.648721
exp(2.302585) = 10.000000
See Also


exp10
Syntax
#include <math.h>
double exp10 (double x);
Description

The function exp10 computes the base 10 exponent of x, where x may be any valid double precision floating point number.

Diagnostics

The function returns 10x. HUGE_VAL is returned on overflow and errno is set to ERANGE. On underflow, zero is returned but errno is not set.

Example: Function exp10
#include <stdio.h>

int main(void)
{
double x = 2.0, y = 3.0;

printf("exp10(%.2lf) = %lf\n", x, exp10(x));
printf("exp10(%lf) = %lf\n", y, exp10(y));
return 0;
}

The program above produces the following output:

exp10(2.0) = 100.000000
exp10(3.0)= 1000.000000
See Also


exp10f
Syntax
#include <math.h>
float exp10f (float x);
Description

The function exp10f computes the base 10 exponent of x, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function exp10.

Diagnostics

The function returns 10x. HUGE_VALF is returned on overflow and errno is set to ERANGE. On underflow, zero is returned but errno is not set.

Example: Function exp10f
#include <stdio.h>

int main(void)
{
float x = 2.0, y = 3.0;

printf("exp10(%.2f) = %f\n", x, exp10f(x));
printf("exp10(%f) = %f\n", y, exp10f(y));
return 0;
}

The program above produces the following output:

exp10(2.0) = 100.000000
exp10(3.0) = 1000.000000
See Also


exp2
Syntax
#include <math.h>
double exp2 (double x);
Description

The function exp2 computes the base 2 exponent of x, where x may be any valid double precision floating point number.

Diagnostics

The function returns 2x. HUGE_VAL is returned on overflow and errno is set to ERANGE. On underflow, zero is returned but errno is not set.

Example: Function exp2
#include <stdio.h>

int main(void)
{
double x = 2.0, y = 3.0;

printf("exp2(%.2lf) = %lf\n", x, exp2(x));
printf("exp2(%lf) = %lf\n", y, exp2(y));
return 0;
}

The program above produces the following output:

exp2(2.0) = 4.000000
exp2(3.0)= 8.000000
See Also


exp2f
Syntax
#include <math.h>
float exp2f (float x);
Description

The function exp2f computes the base 2 exponent of x, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function exp2.

Diagnostics

The function returns 2x. HUGE_VALF is returned on overflow and errno is set to ERANGE. On underflow, zero is returned but errno is not set.

Example: Function exp2f
#include <stdio.h>

int main(void)
{
float x = 2.0, y = 3.0;

printf("exp2(%.2f) = %f\n", x, exp2f(x));
printf("exp2(%f) = %f\n", y, exp2f(y));
return 0;
}

The program above produces the following output:

exp2(2.0) = 4.000000
exp2(3.0) = 8.000000
See Also


expm1
Syntax
#include <math.h>
double expm1 (double x);
Description

The function expm1 computes the exponent of x minus 1, where x may be any valid double precision floating point number.

Diagnostics

The function returns ex - 1. HUGE_VAL is returned on overflow and errno is set to ERANGE. On underflow, zero is returned but errno is not set.

Example: Function expm1
#include <stdio.h>

int main(void)
{
double x = .5, y = 2.3025851;

printf("expm1(%.2lf) = %lf\n", x, expm1(x));
printf("expm1(%lf) = %lf\n", y, expm1(y));
return 0;
}

The program above produces the following output:

expm1(0.50) = 0.648721
expm1(2.302585) = 9.000000
See Also


expm1f
Syntax
#include <math.h>
float expm1f (float x);
Description

The function expm1f computes the exponent of x minus 1, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function expm1.

Diagnostics

The function returns ex - 1. HUGE_VALF is returned on overflow and errno is set to ERANGE. On underflow, zero is returned but errno is not set.

Example: Function expm1f
#include <stdio.h>

int main(void)
{
float x = .5, y = 2.3025851;

printf("expm1(%.2f) = %f\n", x, expm1f(x));
printf("expm1(%f) = %f\n", y, expm1f(y));
return 0;
}

The program above produces the following output:

exp(0.50) = 0.648721
exp(2.302585) = 9.000000
See Also


ilogb
Syntax
#include <math.h>
int ilogb (double x);
Description

The function ilogb computes the logarithm of x to base e as a signed integer value, where x may be any valid double precision floating point number.

Diagnostics

If the argument is negative, the function returns 0 and sets errno to EDOM. If the argument is zero, the function returns 0 and sets errno to ERANGE.

Example: Function ilogb
#include <stdio.h>

int main(void)
{
double x = .5, y = 10.;

printf("The integer natural logarithm of %.2lf is %ld\n", x, ilogb(x));
printf("ilogb(%.0lf) = %d\n", y, ilogb(y));
return 0;
}

The program above produces the following output:

The integer natural logarithm of 0.50 is -1
ilogb(10) = 2
See Also


ilogbf
Syntax
#include <math.h>
int ilogbf (float x);
Description

The function ilogbf computes the logarithm of x to base e as a signed integer value, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function ilogb.

Diagnostics

If the argument is negative, the function returns 0 and sets errno to EDOM. If the argument is zero, the function returns 0 and sets errno to ERANGE.

Example: Function ilogbf
#include <stdio.h>

int main(void)
{
float x = .5, y = 10.;

printf("The integer natural logarithm of %.2f is %d\n", x, ilogbf(x));
printf("logb(%f) = %d\n", y, ilogbf(y));
return 0;
}

The program above produces the following output:

The integer natural logarithm of 0.50 is -1
ilogb(10) = 2
See Also


log
Syntax
#include <math.h>
double log (double x);
Description

The function log computes the logarithm of x to base e, where x may be any valid double precision floating point number.

Diagnostics

If the argument is negative, the function returns 0.0 and sets errno to EDOM. If the argument is zero, the function returns 0.0 and sets errno to ERANGE.

Example: Function log
#include <stdio.h>

int main(void)
{
double x = .5, y = 10.;

printf("The natural logarithm of %.2lf is %lf\n", x, log(x));
printf("log(%.0lf) = %.8lf\n", y, log(y));
return 0;
}

The program above produces the following output:

The natural logarithm of 0.50 is -0.693147
log(10) = 2.30258509
See Also


logb
Syntax
#include <math.h>
double logb (double x);
Description

The function logb computes the logarithm of x to base e as a signed integer value in floating point format, where x may be any valid double precision floating point number.

Diagnostics

If the argument is negative, the function returns 0.0 and sets errno to EDOM. If the argument is zero, the function returns 0.0 and sets errno to ERANGE.

Example: Function logb
#include <stdio.h>

int main(void)
{
double x = .5, y = 10.;

printf("The integer natural logarithm of %.2lf is %lf\n", x, logb(x));
printf("logb(%.0lf) = %.8lf\n", y, logb(y));
return 0;
}

The program above produces the following output:

The integer natural logarithm of 0.50 is -1.000000
logb(10) = 2.00000000
See Also


logbf
Syntax
#include <math.h>
float logbf (float x);
Description

The function logbf computes the logarithm of x to base e as a signed integer value in floating point format, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function logbf.

Diagnostics

If the argument is negative, the function returns 0.0 and sets errno to EDOM. If the argument is zero, the function returns 0.0 and sets errno to ERANGE.

Example: Function logbf
#include <stdio.h>

int main(void)
{
float x = .5, y = 10.;

printf("The integer natural logarithm of %.2f is %f\n", x, logbf(x));
printf("logb(%f) = %.8f\n", y, logbf(y));
return 0;
}

The program above produces the following output:
The integer natural logarithm of 0.50 is -1.000000
logb(10) = 2.00000000
See Also


logf
Syntax
#include <math.h>
float logf (float x);
Description

The function logf computes the logarithm of x to base e, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function logf.

Diagnostics

If the argument is negative, the function returns 0.0 and sets errno to EDOM. If the argument is zero, the function returns 0.0 and sets errno to ERANGE.

Example: Function logf
#include <stdio.h>

int main(void)
{
float x = .5, y = 10.;

printf("The natural logarithm of %.2f is %f\n", x, logf(x));
printf("log(%.0f) = %.8f\n", y, logf(y));
return 0;
}

The program above produces the following output:

The natural logarithm of 0.50 is -0.693147
log(10) = 2.30258509
See Also


log10
Syntax
#include <math.h>
double log10 (double x);
Description

The function log10 computes the logarithm of x to base 10, where x may be any valid double precision floating point number.

Diagnostics

If the argument is negative, the function returns 0.0 and sets errno to EDOM. If the argument is zero, the function returns 0.0 and sets errno to ERANGE.

Example: Function log10
#include <stdio.h>

int main(void)
{
double x = .5, y = 10.;

printf("The logarithm (base 10) of %.2lf is %lf\n", x, log10(x));
printf("log10(%.0lf) = %lf\n", y, log10(y));
return 0;
}

The program above produces the following output:

The logarithm (base 10) of 0.50 is -0.301030
log10(10) = 1.000000
See Also


log10f
Syntax
#include <math.h>
float log10f (float x);
Description

The function log10f computes the logarithm of x to base 10, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function log10.

Diagnostics

If the argument is negative, the function returns 0.0 and sets errno to EDOM. If the argument is zero, the function returns 0.0 and sets errno to ERANGE.

Example: Function log10f
#include <stdio.h>

int main(void)
{
float x = .5, y = 10.;

printf("The logarithm (base 10) of %.2f is %f\n", x, log10f(x));
printf("log10(%.0f) = %f\n", y, log10f(y));
return 0;
}

The program above produces the following output:

The logarithm (base 10) of 0.50 is -0.301030
log10(10) = 1.000000
See Also


log1p
Syntax
#include <math.h>
double log1p (double x);
Description

The function log1p computes the logarithm to base e of (x+1), where x may be any valid double precision floating point number.

Diagnostics

If the argument is negative, the function returns 0.0 and sets errno to EDOM. If the argument is zero, the function returns 0.0 and sets errno to ERANGE.

Example: Function log1p
#include <stdio.h>

int main(void)
{
double x = -0.5, y = 9.;

printf("The natural logarithm of %.2lf+1 is %lf\n", x, log1p(x));
printf("log(%.0lf+1) = %.8lf\n", y, log1p(y));
return 0;
}

The program above produces the following output:

The natural logarithm of -0.5+1 is -0.693147
log(9+1) = 2.30258509
See Also


log1pf
Syntax
#include <math.h>
float log1pf (float x);
Description

The function log1pf computes the logarithm to base e of (x+1), where x may be any valid single precision floating point number. This function is a single precision version of the double precision function log1pf.

Diagnostics

If the argument is negative, the function returns 0.0 and sets errno to EDOM. If the argument is zero, the function returns 0.0 and sets errno to ERANGE.

Example: Function log1pf
#include <stdio.h>

int main(void)
{
float x = -0.5, y = 9.;

printf("The natural logarithm of %.2f+1 is %f\n", x, log1pf(x));
printf("log(%.0f+1) = %.8f\n", y, log1pf(y));
return 0;
}

The program above produces the following output:

The natural logarithm of -0.50+1 is -0.693147
log(9+1) = 2.30258509
See Also


log2
Syntax
#include <math.h>
double log2 (double x);
Description

The function log2 computes the logarithm of x to base 2, where x may be any valid double precision floating point number.

Diagnostics

If the argument is negative, the function returns 0.0 and sets errno to EDOM. If the argument is zero, the function returns 0.0 and sets errno to ERANGE.

Example: Function log2
#include <stdio.h>

int main(void)
{
double x = .25, y = 8.;

printf("The logarithm base 2 of %.2lf is %lf\n", x, log2(x));
printf("log base 2(%.0lf) = %.8lf\n", y, log2(y));
return 0;
}

The program above produces the following output:

The logarithm base 2 of 0.25 is -2.000000
log base 2(8) = 3.00000000
See Also


log2f
Syntax
#include <math.h>
float log2f (float x);
Description

The function log2f computes the logarithm of x to base 2, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function log2f.

Diagnostics

If the argument is negative, the function returns 0.0 and sets errno to EDOM. If the argument is zero, the function returns 0.0 and sets errno to ERANGE.

Example: Function log2f
#include <stdio.h>

int main(void)
{
float x = .25, y = 8.;

printf("The logarithm base 2 of %.2f is %f\n", x, log2f(x));
printf("log base 2(%.0f) = %.8f\n", y, log2f(y));
return 0;
}

The program above produces the following output:

The logarithm base 2 of 0.250 is -2.000000
log(8) = 3.000000
See Also


llround
Syntax
#include <math.h>
long long llround (double x);
Description

The function llround rounds x to the nearest 64-bit integer, where x may be any valid double precision floating point number.

Diagnostics

The function llround returns a range error, setting errno to EDOM if the argument is too large.

Example: Function llround
#include <stdio.h>

int main(void)
{
double x = 6.723E2

printf("The nearest integer of %.2lf is %ld\n", x, llround(x));
return 0;
}

The program above produces the following output:

The nearest integer of 6.723E2 is 672
See Also


llroundf
Syntax
#include <math.h>
long long llroundf (float x);
Description

The function llroundf rounds x to the nearest 64-bit integer, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function llround.

Diagnostics

The function llroundf returns a range error, setting errno to EDOM if the argument is too large.

Example: Function llroundf
#include <stdio.h>

int main(void)
{
float x = 6.728E2

printf("The nearest integer of %.2lf is %ld\n", x, llroundf(x));
return 0;
}

The program above produces the following output:

The nearest integer of 6.728E2 is 673
See Also


lround
Syntax
#include <math.h>
long lround (double x);
Description

The function lround rounds x to the nearest 32-bit integer, where x may be any valid double precision floating point number.

Diagnostics

The function lround returns a range error, setting errno to EDOM if the argument is too large.

Example: Function lround
#include <stdio.h>

int main(void)
{
double x = 6.723E2

printf("The nearest integer of %.2lf is %d\n", x, lround(x));
return 0;
}

The program above produces the following output:

The nearest integer of 6.723E2 is 672
See Also


lroundf
Syntax
#include <math.h>
long lroundf (float x);
Description

The function lroundf rounds x to the nearest 32-bit integer, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function lround.

Diagnostics

The function lroundf returns a range error, setting errno to EDOM if the argument is too large.

Example: Function lroundf
#include <stdio.h>

int main(void)
{
float x = 6.728E2

printf("The nearest integer of %.2f is %d\n", x, lroundf(x));
return 0;
}

The program above produces the following output:

The nearest integer of 6.728E2 is 673
See Also


pow
Syntax
#include <math.h>
double pow (double x, double y);
Description

The function pow computes x raised to the power of y, where x and y may be any valid double precision floating point numbers.

Diagnostics

If both values are 0.0, NaN is returned and errno is set to EDOM.
If x is negative and y is not an integer, NaN is returned and errno is set to EDOM.
If x is 0.0 and y is negative, NaN is returned and errno is set to EDOM.
If an overflow results, errno is set to ERANGE and HUGE_VAL is returned.

Note icon NOTE.
pow does not recognize integral floating point values greater than 264 such as 1.0E100.

Example: Function pow
#include <stdio.h>

int main(void)
{
double x = 2, y = 5;

printf("%.1lf to the power of %.1lf is %.1lf\n", x, y, pow(x, y));
return 0;
}

The program above produces the following output:

2.0 to the power of 5.0 is 32.0
See Also


powf
Syntax
#include <math.h>
float powf (float x, float y);
Description

The function powf computes x raised to the power of y, where x and y may be any valid single precision floating point numbers. This function is a single precision version of the double precision function pow.

Diagnostics

If both values are 0.0, NaN is returned and errno is set to EDOM.
If x is negative and y is not an integer, NaN is returned and errno is set to EDOM.
If x is 0.0 and y is negative, NaN is returned and errno is set to EDOM.
If an overflow results, errno is set to ERANGE and HUGE_VAL is returned.

Note icon NOTE.
powf does not recognize integral floating point values greater than 232 such as 1.0E100.

Example: Function powf
#include <stdio.h>

int main(void)
{
float x = 2, y = 5;

printf("%.1f to the power of %.1f is %.1f\n", x, y, powf(x, y));
return 0;
}

The program above produces the following output:

2.0 to the power of 5.0 is 32.0
See Also


sin
Syntax
#include <math.h>
double sin (double x);
Description

The function sin computes the sine of x, where x may be any valid double precision floating point number.

Diagnostics

The function sin returns the sine of x. If x is greater than DBL_MAX, a partial loss of significance in the result may occur.

Example: Function sin
#include <stdio.h>

int main(void)
{
double x = 0.5;

printf("The sine of %.2lf is %lf.\n", x, sin(x));
return 0;
}

The program above produces the following output:

The sine of 0.50 is 0.479426.
See Also


sinf
Syntax
#include <math.h>
float sinf (float x);
Description

The function sinf computes the sine of x, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function sin.

Diagnostics

The function sinf returns the sine of x. If x is greater than DBL_MAX, a partial loss of significance in the result may occur.

Example: Function sinf
#include <stdio.h>

int main(void)
{
float x = 0.5;

printf("The sine of %.2f is %f.\n", x, sinf(x));
return 0;
}

The program above produces the following output:

The sine of 0.50 is 0.479426.
See Also


sinh
Syntax
#include <math.h>
double sinh (double x);
Description

The function sinh computes the hyperbolic sine of x, where x may be any valid double precision floating point number.

Diagnostics

The function sinh returns the hyperbolic sine of x. If x is greater than DBL_MAX, HUGE_VAL is returned, and errno is set to ERANGE.

Example: Function sinh
#include <stdio.h>

int main (void)
{
double x = .5;
printf("The hyperbolic sine of %.2lf is %lf\n", x, sinh(x));
printf("The sine is %lf\n", sin(x));
printf("The hyperbolic cosine is %lf\n", cosh(x));
return 0;
}

The program above produces the following output:

The hyperbolic sine of 0.50 is 0.521095
The sine is 0.479426
The hyperbolic cosine is 1.127626
See Also


sinhf
Syntax
#include <math.h>
float sinhf (float x);
Description

The function sinhf computes the hyperbolic sine of x, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function sinh.

Diagnostics

The function sinhf returns the hyperbolic sine of x. If x is greater than DBL_MAX, HUGE_VALF is returned, and errno is set to ERANGE.

Example: Function sinhf
#include <stdio.h>

int main (void)
{
float x = .5;
printf("The hyperbolic sine of %.2lf is %lf\n", x, sinhf(x));
printf("The sine is %f\n", sinf(x));
printf("The hyperbolic cosine is %f\n", coshf(x));
return 0;
}

The program above produces the following output:

The hyperbolic sine of 0.50 is 0.521095
The sine is 0.479426
The hyperbolic cosine is 1.127626
See Also


sqrt
Syntax
#include <math.h>
double sqrt (double x);
Description

The function sqrt computes the non-negative square root of the argument x, where x may be any valid double precision floating point number.

Diagnostics

If x is negative, zero is returned and errno is set to EDOM.

Example: Function sqrt
#include <stdio.h>

int main(void)
{
double x = 361;
printf("The square root of %.2lf is %lf \n", x, sqrt(x));
return 0;
}

The program above produces the following output:

The square root of 361.00 is 19.000000
See Also


sqrtf
Syntax
#include <math.h>
float sqrtf (float x);
Description

The function sqrtf computes the non-negative square root of the argument x, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function sqrt.

Diagnostics

If x is negative, zero is returned and errno is set to EDOM.

Example: Function sqrtf
#include <stdio.h>

int main(void)
{
float x = 361;
printf("The square root of %.2lf is %lf \n", x, sqrtf(x));
return 0;
}

The program above produces the following output:

The square root of 361.00 is 19.000000
See Also


tan
Syntax
#include <math.h>
double tan (double x);
Description

The function tan computes the tangent of the argument x, where x may be any valid double precision floating point number.

Diagnostics

The function tan returns the tangent of x. If x is greater than DBL_MAX, zero is returned and errno is set to ERANGE.

Example: Function tan
#include <stdio.h>

int main(void)
{
double x = .5;
printf("The tangent of %.2lf is %lf\n", x, tan(x));
return 0;
}

The program above produces the following output:

The tangent of 0.50 is 0.546302
See Also


tanf
Syntax
#include <math.h>
float tanf (float x);
Description

The function tanf computes the tangent of the argument x, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function tan.

Diagnostics

The function tanf returns the tangent of x. If x is greater than DBL_MAX, zero is returned and errno is set to ERANGE.

Example: Function tanf
#include <stdio.h>

int main(void)
{
float x = .5;
printf("The tangent of %.2f is %f\n", x, tanf(x));
return 0;
}

The program above produces the following output:

The tangent of 0.50 is 0.546302
See Also


tanh
Syntax
#include <math.h>
double tanh (double x);
Description

The function tanh computes the hyperbolic tangent of the argument x, where x may be any valid double precision floating point number.

Diagnostics

The function tanh returns the hyperbolic tangent of x. If x is greater than DBL_MAX, the function returns HUGE_VAL and sets errno to ERANGE.

Example: Function tanh
#include <stdio.h>

int main(void)
{
double x = .5;
printf("The hyperbolic tangent of %.2lf is %lf\n", x, tanh(x));
return 0;
}

The program above produces the following output:

The hyperbolic tangent of 0.50 is 0.462117
See Also


tanhf
Syntax
#include <math.h>
float tanhf (float x);
Description

The function tanhf computes the hyperbolic tangent of the argument x, where x may be any valid single precision floating point number. This function is a single precision version of the double precision function tanh.

Diagnostics

The function tanhf returns the hyperbolic tangent of x. If x is greater than DBL_MAX, the function returns HUGE_VAL and sets errno to ERANGE.

Example: Function tanhf
#include <stdio.h>

int main(void)
{
float x = .5;
printf("The hyperbolic tangent of %.2f is %f\n", x, tanhf(x));
return 0;
}

The program above produces the following output:

The hyperbolic tangent of 0.50 is 0.462117
See Also


trunc
Syntax
#include <math.h>
double trunc (double x);
Description

The function trunc truncates x to an integer value, but returns it as a double precision floating point number. The parameter x may be any valid double precision floating point number.

Diagnostics

If x is greater than DBL_MAX, the function sets errno to EDOM.

Example: Function trunc
#include <stdio.h>

int main(void)
{
double x = 6.728E2

printf("The truncate of %.2lf is %lf\n", x, trunc(x));
return 0;
}

The program above produces the following output:

The truncate of 6.728E2 is 672.000000
See Also


truncf
Syntax
#include <math.h>
float truncf (float x);
Description

The function truncf truncates x to an integer value, but returns it as a single precision floating point number. The parameter x may be any valid single precision floating point number. This function is a single precision version of the double precision function trunc.

Diagnostics

If x is greater than DBL_MAX, the function sets errno to EDOM.

Example: Function truncf
#include <stdio.h>

int main(void)
{
float x = 6.728E2

printf("The truncate of %.2f is %f\n", x, truncf(x));
return 0;
}

The program above produces the following output:

The truncate of 6.728E2 is 672.000000
See Also


The Intel® Run-time Library

This chapter describes functions of the Intel® Run-time Library supported by the Intel® C++ Compiler. The name of this library is x0__ar00.a. Most of these are functions relating to floating point operations between variables of differing types.

These functions are assembly language functions and are implicitly called by the Intel® C++ Compiler when required. For example in the following piece of code:

double a,b,c; // declare three double variables

a=1.2345e7; // load variable a with data
b=1.67; // load variable b with data
c=a+b; // add variable a to variable b,
// save result to variable c

The compiler automatically calls the correct floating point function to carry out the addition of the two variables a and b.

Although it is not recommended, it is also possible to call these functions explicitly from the C/C++ source code. In order to do so the functions prototypes are required before a call is made to it in the correct manner. An example of this is provided for each of the functions described.

The chapter covers the following topics:

  • "General Remarks" provides general remarks applying to the Floating Point Library.
  • "Summary of the Functions" gives a summary of all supported floating point functions.


General Remarks

The following remarks apply to the Floating Point Library of the Intel® C++ Compiler:

  • All numerical values conform to IEEE floating point format standards 754.
  • 64-bit double precision floating point numbers are stored in register pairs such as R0:R1, where the most significant 32 bits are held in the lower numbered register of R0.
  • Values stored in memory do so with their least significant bytes at the lowest address - This method of keeping floating point data is known as "Little-endian".
  • Upon return from these functions the state of the Condition Code Flags are undefined, except in the case of the comparison and test functions.
  • All functions in this library use 32-bit code.
  • In accordance with the IEEE standards it is possible for floating point numbers to be in an invalid state called a NaN, which stands for "Not a Number". This condition is frequently checked for within these functions and dealt with
  • The global symbol errno is not changed within these functions.
  • Scalar *mod* and *div* calls the various functions lmod0 and ldiv0 in the event of a divide by zero being attempted. These symbols are undefined if the default startup is not used.


__eqdf2
Syntax
long
__eqdf2(double x, double y);
Description

The function __eqdf2 compares two 64-bit double precision floating point values for equality, returning the result as a 32-bit signed integer. The function calculates x-y, setting the return value according to the result, the result itself being thrown away. Both x and y may be any valid double precision values.

The return from this function is:

Value
Description
    0
    If equal.
    1
    If not equal, or an operand is a NaN.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N,Z and Q flags being cleared and the C and V flags being set.
Example: Function __eqdf2
#include <stdio.h>

int main(void)
{
double x = 1.2345, y = 6.7;

if( __eqdf2(x, y) == 0)
printf("%.2lf is equal to %.2lf\n", x, y);
else
printf("%.2lf is not equal to %.2lf\n", x, y);
return 0;
}

The program above produces the following output:

1.23 is not equal to 6.70
See Also


__gesf2
Syntax
long
__gesf2(float x, float y);
Description

The function __gesf2 compares two 32-bit single precision floating point values on being greater than or equal to, returning the result as a 32-bit signed integer. The function carries out x-y, setting the return value according to the result, the result itself being thrown away. The parameters x and y may be any valid single precision values.

The return value of this function is:

Value | Description
-1 | if x is less than y, or an operand is a NaN.
0 | if x is equal to y.
1 | if x is greater than y.

Diagnostics
    Zero
    Comparison of two zeros, one positive and the other negative are deemed to be equal.
    Infinity
    Comparison of two positive infinities, or two negative infinities will result in them being equal. But a positive infinity is not equal to a negative infinity.
    NaNs
    If either or both inputs are NaNs, the result is considered to be unordered which results in the N, Z and Q flags being cleared and the C and V flags being set.
Example: Function __gesf2
#include <stdio.h>

int main(void)
{
float x = 12.345, y = 6.7;

if( __gesf2(x, y) >= 0)
printf("%.2f is greater than or equal to %.2f\n", y, x);
else
printf("%.2f is less than %.2f\n", y, x);
return 0;
}

The program above produces the following output:

6.70 is less than 12.35
See Also


The Intel® C++ Class Libraries

The Intel® C++ Class Libraries enable Single-Instruction, Multiple-Data (SIMD) operations. The principle of SIMD operations is to exploit microprocessor architecture through parallel processing. The effect of parallel processing is increased data throughput using fewer clock cycles. The objective is to improve application performance of complex and computation-intensive audio, video, and graphical data bit streams.


Introduction to the Class Libraries

The Intel® C++ Class Libraries for SIMD Operations support integer vector (Ivec) class. You can find the definitions for these operations in the header file ivec.h. The classes are named according to the underlying type of operation. The header file ivec.h is specific to architectures with Intel® Wireless MMX™ technology.

This documentation is intended for programmers writing code for the Intel® architecture, particularly code that would benefit from the use of SIMD instructions. You should be familiar with C++ and the use of C++ classes.


Hardware and Software Requirements

You must have the Intel® C++ Compiler version 2.0 or higher installed on your system to use the class libraries. The Intel® C++ Class Libraries are functions abstracted from the from the instruction extensions available on Intel® processors as specified in the table that follows.

Table: Processor Requirements for Use of Class Libraries
Header File | Extension Set | Available on These Processors
ivec.h | Intel® Wireless MMX™ technology | Pentium® II, Pentium® III, Pentium® 4, Intel® Xeon™, and Itanium® processors


Details About the Libraries

The Intel® C++ Class Libraries for SIMD Operations provide a convenient interface to access the underlying instructions for processors as specified in "Processor Requirements for Use of Class Libraries". These processor-instruction extensions enable parallel processing using the single instruction-multiple data (SIMD) technique as illustrated in the following figure.

Figure: SIMD Data Flow

Performing four operations with a single instruction improves efficiency by a factor of four for that particular instruction.


C++ Classes and SIMD Operations

The use of C++ classes for SIMD operations is based on the concept of operating on arrays, or vectors of data, in parallel. Consider the addition of two vectors, A and B, where each vector contains four elements. Using the integer vector (Ivec) class, the elements A[i] and B[i] from each array are summed as shown in the following example.

Example: Typical Method of Adding Elements Using a Loop
short a[4], b[4], c[4];
for (i=0; i<4; i++) /* needs four iterations */
c[i] = a[i] + b[i]; /* returns c[0], c[1], c[2], c[3] *

The following example shows the same results using one operation with Ivec classes.

Example: SIMD Method of Adding Elements Using Ivec Classes
Is16vec4 ivecA, ivecB, ivec C; /*needs one iteration */
ivecC = ivecA + ivecB; /*returns ivecC0, ivecC1, ivecC2, ivecC3 */


Available Classes

The Intel® C++ SIMD classes available for systems based on the Intel XScale® technology provide parallelism, which is not easily implemented using typical mechanisms of C++. The following table shows how the Intel® C++ SIMD classes use the classes and libraries.

Table: SIMD Vector Classes
Instruction Set | Class | Signedness | Data Type | Size | Elements | Header File
Intel® Wireless MMX™ technology (available for IA-32- and Itanium®- based systems) | I64vec1 | unspecified | __m64 | 64 | 1 | ivec.h
 | I32vec2 | unspecified | int | 32 | 2 | ivec.h
 | Is32vec2 | signed | int | 32 | 2 | ivec.h
 | Iu32vec2 | unsigned | int | 32 | 2 | ivec.h
 | I16vec4 | unspecified | short | 16 | 4 | ivec.h
 | Is16vec4 | signed | short | 16 | 4 | ivec.h
 | Iu16vec4 | unsigned | short | 16 | 4 | ivec.h
 | I8vec8 | unspecified | char | 8 | 8 | ivec.h
 | Is8vec8 | signed | char | 8 | 8 | ivec.h
 | Iu8vec8 | unsigned | char | 8 | 8 | ivec.h

Most classes contain similar functionality for all data types and are represented by all available intrinsics. However, some capabilities do not translate from one data type to another without suffering from poor performance, and are therefore excluded from individual classes.

Note icon NOTE.
Intrinsics that take immediate values and cannot be expressed easily in classes are not implemented.
(For example, _mm_shuffle_ps, _mm_shuffle_pi16, _mm_extract_pi16, _mm_insert_pi16).


Access to Classes Using Header Files

The required class header files are installed in the include directory with the Intel® C++ Compiler. To enable the classes, use the #include directive in your program file as shown in the table that follows.

Table: Include Directives for Enabling Classes
Instruction Set Extension | Include Directive
Intel® Wireless MMX™ technology | #include <ivec.h>


Usage Precautions

When using the C++ classes, you should follow some general guidelines. More detailed usage rules are listed in "Integer Vector Classes".


Capabilities

The fundamental capabilities of each C++ SIMD class include:

  • computation
  • horizontal data motion
  • branch compression/elimination

Understanding each of these capabilities and how they interact is crucial to achieving desired results.


Computation

The SIMD C++ classes contain vertical operator support for most arithmetic operations, including shifting and saturation.

Computation operations include: +, -, *.


Horizontal Data Support

The C++ SIMD classes provide horizontal data support for some arithmetic operations. The term "horizontal" indicates computation across the elements of one vector, as opposed to the vertical, element-by-element operations on two different vectors.

The add_horizontal, unpack_low and pack_sat functions are examples of horizontal data support. This support enables certain algorithms that cannot exploit the full potential of SIMD instructions.

Typically every instruction with horizontal data flow contains some inefficiency in the implementation. If possible, implement your algorithms without using the horizontal capabilities.


Branch Compression/Elimination

Branching in SIMD architectures can be complicated and expensive, possibly resulting in poor predictability and code expansion. The SIMD C++ classes provide functions to eliminate branches, using logical operations, max and min functions, conditional selects, and compares. Consider the following example:

short a[4], b[4], c[4];
for (i=0; i<4; i++)
c[i] = a[i] > b[i] ? a[i] : b[i];

This operation is independent of the value of i. For each i, the result could be either A or B depending on the actual values. A simple way of removing the branch altogether is to use the select_gt function, as follows:

Is16vec4 a, b, c
c = select_gt(a, b, a, b)


Integer Vector Classes

The Ivec classes provide an interface to SIMD processing using integer vectors of various sizes. The class hierarchy is represented in the following figure.

Figure: Ivec Class Hierarchy

The M64 class defines the __m64 data types from which the rest of the Ivec classes are derived. The first generation of child classes are derived based solely on bit sizes of 64, 32, 16, and 8 respectively for the I64vec1, I32vec2, I16vec4, and I8vec8 classes. The latter six of the these classes require specification of signedness and saturation.

The signedness is indicated by the s and u in the class names:

Is32vec2
Iu32vec2
Is16vec4
Iu16vec4
Is8vec8
Iu8vec8


Terms, Conventions, and Syntax

The following are special terms and syntax used in this chapter to describe functionality of the classes with respect to their associated operations.


Ivec Class Syntax Conventions

The name of each class denotes the data type, signedness, bit size, number of elements using the following generic format:

<type><signedness><bits>vec<elements>
{ I } { s | u } { 64 | 32 | 16 | 8 } vec { 8 | 4 | 2 | 1 }

where:

type | indicates integer (I)
signedness | indicates signed (s) or unsigned (u). For the Ivec class, leaving this field blank indicates an intermediate class.
bits | specifies the number of bits per element
elements | specifies the number of elements


Special Terms and Conventions

The following terms are used to define the functionality and characteristics of the classes and operations defined in this manual.

  • Nearest Common Ancestor -- This is the intermediate or parent class of two classes of the same size. For example, the nearest common ancestor of Iu8vec8 and Is8vec8 is I8vec8. Also, the nearest common ancestor between Iu8vec8 and I16vec4 is M64.
  • Casting -- Changes the data type from one class to another. When an operation uses different data types as operands, the return value of the operation must be assigned to a single data type. Therefore, one or more of the data types must be converted to a required data type. This conversion is known as a typecast. Sometimes, typecasting is automatic, other times you must use special syntax to explicitly typecast it yourself.
  • Operator Overloading -- This is the ability to use various operators on the same user-defined data type of a given class. Once you declare a variable, you can add, subtract, multiply, and perform a range of operations. Each family of classes accepts a specified range of operators, and must comply by rules and restrictions regarding typecasting and operator overloading as defined in the header files. The following table shows the notation used in this document to address typecasting, operator overloading, and other rules.

Table: Class Syntax Notation Conventions
Class Name | Description
I[s|u][N]vec[N] | Any value except I64vec1
I64vec1 | __m64 data type
I[s|u]32vec2 | two 32-bit values of any signedness
I[s|u]16vec4 | four 16-bit values of any signedness
I[s|u]8vec8 | eight 8-bit values of any signedness


Rules for Operators

To use operators with the Ivec classes you must use one of the following three syntax conventions:

[ Ivec_Class ] R = [ Ivec_Class ] A [ operator ][ Ivec_Class ] B
Example:
I64vec1 R = I64vec1 A & I64vec1 B;
[ Ivec_Class ] R =[ operator ] ([ Ivec_Class ] A,[ Ivec_Class ] B)
Example:
I64vec1 R = andnot(I64vec1 A, I64vec1 B);
[ Ivec_Class ] R [ operator ]= [ Ivec_Class ] A
Example:
I64vec1 R &= I64vec1 A;
    [ operator ]
    an operator (for example, &, |, or ^ )
    [ Ivec_Class ]
    an Ivec class
    R, A, B
    variables declared using the pertinent Ivec classes; R is result, A and B are operands.

The table that follows shows automatic and explicit sign and size typecasting. "Explicit" means that it is illegal to mix different types without an explicit typecasting. "Automatic" means that you can mix types freely and the compiler will do the typecasting for you.

Table: Summary of Rules Major Operators
Operators | Sign Typecasting | Size Typecasting | Other Typecasting Requirements
Assignment | N/A | N/A | N/A
Logical | Automatic | Automatic (to left) | Explicit typecasting is required for different types used in non-logical expressions on the right side of the assignment.
Addition and Subtraction | Automatic | Explicit | N/A
Multiplication | Automatic | Explicit | N/A
Shift | Automatic | Explicit | Casting Required to ensure arithmetic shift.
Compare | Automatic | Explicit | Explicit casting is required for signed classes for the less-than or greater-than operations.
Conditional Select | Automatic | Explicit | Explicit casting is required for signed classes for less-than or greater-than operations.


Data Declaration and Initialization

The following table shows literal examples of constructor declarations and data type initialization for all class sizes. All values are initialized with the most significant element on the left and the least significant to the right.

Table: Declaration and Initialization Data Types for Ivec Classes
Operation
Class
Syntax
Declaration
M64
I64vec1 A;
__m64 Initialization
M64
I64vec1 A(__m64 m);Iu8vec8 A(__m64 m);
__int64 Initialization
M64
I64vec1 A = __int64 m; Iu8vec8 A =__int64 m;
int i Initialization
M64
I64vec1 A = int i; Iu8vec8 A = int i;
int Initialization
I32vec2
I32vec2 A(int A1, int A0);
Is32vec2 A(signed int A1, signed int A0);
Iu32vec2 A(unsigned int A1, unsigned int A0);
short int Initialization
I16vec4
I16vec4 A(short A3, short A2, short A1, short A0);
Is16vec4 A(signed short A3, ..., signed short A0);
Iu16vec4 A(unsigned short A3, ..., unsigned short A0);
char Initialization
I8vec8
I8vec8 A(char A7, char A6, ..., char A1, char A0);
Is8vec8 A(signed char A7, ..., signed char A0);
Iu8vec8 A(unsigned char A7, ..., unsigned char A0);


Assignment Operator

Any Ivec object can be assigned to any other Ivec object; conversion on assignment from one Ivec object to another is automatic.


Assignment Operator Examples

Is16vec4 A;
Is8vec8 B;
I64vec1 C;
A = B; /* assign Is8vec8 to Is16vec4 */
B = C; /* assign I64vec1 to Is8vec8 */
B = A & C; /* assign M64 result of '&' to Is8vec8 */


Multiplication Operators

The multiplication operators can only accept and return data types from the I[s|u]16vec4 classes, as shown in the following example.


Syntax Usage for Multiplication Operators

Explicitly convert B to Is16vec4.

Is16vec4 A,C;
Iu32vec2 B;
C = A * C;
C = A * (Is16vec4)B;

Return nearest common ancestor type, I16vec4

Is16vec4 A;
Iu16vec4 B;
I16vec4 C;
C = A + B;

The mul_high and mul_add functions take Is16vec4 data only.

Is16vec4 A,B,C,D;
C = mul_high(A,B);
D = mul_add(A,B);
Table: Multiplication Operators with Corresponding Intrinsics
Symbols
Intrinsic
*
*=
R = A * B
R *= A
mul_high
N/A
R = mul_high(A, B)
mul_add
N/A
R = mul_high(A, B)

The multiplication return operators always return the nearest common ancestor as listed in the table that follows. The two operands must be 16 bits in size, otherwise you must explicitly indicate typecasting.

Table: Multiplication Operator Overloading
R | Mul | A | B
I16vec4 R | * | I[s|u]16vec4 A | I[s|u]16vec4 B
Is16vec4 R | mul_add | Is16vec4 A | Is16vec4 B
Is32vec2 R | mul_high | Is16vec4 A | Is16vec4 B

The following table shows the return values and data type assignments for operands of the multiplication operators with assignment. All operands must be 16 bytes in size. If the operands are not the right size, you must use an explicit typecast.

Table: Multiplication with Assignment
Return Value (R) | Left Side (R) | Mul | Right Side (A)
I[x]16vec4 | I[x]16vec4 | *= | I[s|u]16vec4 A;


Logical Operators

The logical operators use the symbols and intrinsics listed in the following table.

Table: Logical Operators
Bitwise Operation | Operator Symbols |  |
 | w/assign | Standard |
AND | & | &= | R = A & B
OR | | | |= | R = A | B
XOR | ^ | ^= | R = A^B
ANDNOT | andnot | N/A | R = A andnot B


Logical Operators and Miscellaneous Exceptions

A and B converted to M64. Result assigned to Iu8vec8.

I64vec1 A;
Is8vec8 B;
Iu8vec8 C;
C = A & B;

Same size and signedness operators return the nearest common ancestor.

I32vec2 R = Is32vec2 A ^ Iu32vec2 B;

A&B returns M64, which is cast to Iu8vec8.

C = Iu8vec8(A&B)+ C;

When A and B are of the same class, they return the same type. When A and B are of different classes, the return value is the return type of the nearest common ancestor.

The logical operator return values for combinations of classes, listed in the following tables, apply when A and B are of different classes.

Table: Ivec Logical Operator Overloading
Return (R) | AND | OR | XOR | NAND | A Operand | B Operand
I32vec2 R | & | | | ^ | andnot | I[s|u]32vec2 A | I[s|u]32vec2 B
I16vec4 R | & | | | ^ | andnot | I[s|u]16vec4 A | I[s|u]16vec4 B
I8vec8 R | & | | | ^ | andnot | I[s|u]8vec8 A | I[s|u]8vec8 B

For logical operators with assignment, the return value of R is always the same data type as the pre-declared value of R as listed in the table that follows.

Table: Ivec Logical Operator Overloading with Assignment
Return Type | Left Side (R) | AND | OR | XOR | Right Side (Any Ivec Type)
I64vec1 | I64vec1 R | &= | |= | ^= | I[s|u][N]vec[N] A;
I[x]32vec2 | I[x]32vec2 R | &= | |= | ^= | I[s|u][N]vec[N] A;
I[x]16vec4 | I[x]16vec4 R | &= | |= | ^= | I[s|u][N]vec[N] A;
I[x]8vec8 | I[x]8vec8 R | &= | |= | ^= | I[s|u][N]vec[N] A;


Addition and Subtraction Operators

The addition and subtraction operators return the class of the nearest common ancestor when the right-side operands are of different signs. The following code provides examples of usage and miscellaneous exceptions.


Syntax Usage for Addition and Subtraction Operators

Return nearest common ancestor type, I16vec4.

Is16vec4 A;
Iu16vec4 B;
I16vec4 C;
C = A + B;

Returns type left-hand operand type.

Is16vec4 A;
Iu16vec4 B;
A += B;
B -= A;

Explicitly convert B to Is16vec4.

Is16vec4 A,C;
Iu32vec2 B;
C = A + C;
C = A + (Is16vec4)B;
Table: Addition and Subtraction Operators with Corresponding Intrinsics
Operation
Symbols
Syntax
Corresponding Intrinsics
Addition
+
+=
R = A + B
R += A
_mm_add_pi32
_mm_add_pi16
_mm_add_pi8
Subtraction
-
-=
R = A - B
R -= A
_mm_sub_pi32
_mm_sub_pi16
_mm_sub_pi8

The following table lists addition and subtraction return values for combinations of classes when the right side operands are of different signedness. The two operands must be the same size, otherwise you must explicitly indicate the typecasting.

Table: Addition and Subtraction Operator Overloading
Return Value | Available Operators
R | Add | Sub
I32vec2 R | + | -
I16vec4 R | + | -
I8vec8 R | + | -

The following table shows the return data type values for operands of the addition and subtraction operators with assignment. The left side operand determines the size and signedness of the return value. The right side operand must be the same size as the left operand; otherwise, you must use an explicit typecast.

Table: Addition and Subtraction with Assignment
Return Value (R) | Left Side (R) | Add | Sub | Right Side (A)
I[x]32vec2 R | I[x]32vec2 R | += | -= | I[s|u]32vec2 A;
I[x]16vec4 | I[x]16vec4 | += | -= | I[s|u]16vec4 A;
I[x]8vec8 | I[x]8vec8 | += | -= | I[s|u]8vec8 A;


Shift Operators

The right shift argument can be any integer or Ivec value, and is implicitly converted to a M64 data type. The first or left operand of a << can be of any type.


Example Syntax Usage for Shift Operators

Automatic size and sign conversion.

Is16vec4 A,C;
Iu32vec2 B;
C = A;

A&B returns I16vec4, which must be cast to Iu16vec4 to ensure logical shift, not arithmetic shift.

Is16vec4 A, C;
Iu16vec4 B, R;
R = (Iu16vec4)(A & B) C;

A&B returns I16vec4, which must be cast to Is16vec4 to ensure arithmetic shift, not logical shift.

R = (Is16vec4)(A & B) C;
Table: Shift Operators with Corresponding Intrinsics
Operation
Symbols
Syntax
Usage Intrinsic
Shift Left
<<
&=
R = A << B
R &= A
_mm_sll_si64
_mm_slli_si64
_mm_sll_pi32
_mm_slli_pi32
_mm_sll_pi16
_mm_slli_pi16
Shift Right
>>
R = A >> B
R >>= A
_mm_srl_si64
_mm_srli_si64
_mm_srl_pi32
_mm_srli_pi32
_mm_srl_pi16
_mm_srli_pi16
_mm_sra_pi32
_mm_srai_pi32
_mm_sra_pi16
_mm_srai_pi16

Right shift operations with signed data types use arithmetic shifts. All unsigned and intermediate classes correspond to logical shifts. The following table shows how the return type is determined by the first argument type.

Table: Shift Operator Overloading
Operation | R | Right Shift |  | Left Shift |  | A | B
Logical | I64vec1 | >> | >>= | << | <<= | I64vec1 A; | I64vec1 B;
Logical | I32vec2 | >> | >>= | << | <<= | I32vec2 A; | I32vec2 B;
Arithmetic | Is32vec2 | >> | >>= | << | <<= | Is32vec2 A; | I[s|u]Nvec[N] B;
Logical | Iu32vec2 | >> | >>= | << | <<= | Iu32vec2 A; | I[s|u]Nvec[N] B;
Logical | I16vec4 | >> | >>= | << | <<= | I16vec4 A; | I16vec4 B;
Arithmetic | Is16vec4 | >> | >>= | << | <<= | Is16vec4 A; | I[s|u]Nvec[N] B;
Logical | Iu16vec4 | >> | >>= | << | <<= | Iu16vec4 A; | I[s|u]Nvec[N] B;


Comparison Operators

The equality and inequality comparison operands can have mixed signedness, but they must be of the same size. The comparison operators for less-than and greater-than must be of the same sign and size.


Example of Syntax Usage for Comparison Operator

The nearest common ancestor is returned for compare for equal/not-equal operations.

Iu8vec8 A;
Is8vec8 B;
I8vec8 C;
C = cmpneq(A,B);

Type cast needed for different-sized elements for equal/not-equal comparisons.

Iu8vec8 A, C;
Is16vec4 B;
C = cmpeq(A,(Iu8vec8)B);

Type cast needed for sign or size differences for less-than and greater-than comparisons.

Iu16vec4 A;
Is16vec4 B, C;
C = cmpge((Is16vec4)A,B);
C = cmpgt(B,C);
Table: Inequality Comparison Symbols and Corresponding Intrinsics
Compare For: | Operators | Syntax | Intrinsic
Equality | cmpeq | R = cmpeq(A, B) | _mm_cmpeq_pi32 _mm_cmpeq_pi16 _mm_cmpeq_pi8
Inequality | cmpneq | R = cmpneq(A, B) | _mm_cmpeq_pi32 _mm_cmpeq_pi16 _mm_cmpeq_pi8
Greater Than | cmpgt | R = cmpgt(A, B) | _mm_cmpgt_pi32 _mm_cmpgt_pi16 _mm_cmpgt_pi8
Greater Than or Equal To | cmpge | R = cmpge(A, B) | _mm_cmpgt_pi32 _mm_cmpgt_pi16 _mm_cmpgt_pi8
Less Than | cmplt | R = cmplt(A, B) | _mm_cmpgt_pi32 _mm_cmpgt_pi16 _mm_cmpgt_pi8
Less Than or Equal To | cmple | R = cmple(A, B) | _mm_cmpgt_pi32 _mm_cmpgt_pi16 _mm_cmpgt_pi8

Comparison operators have the restriction that the operands must be the size and sign as listed in the table "Compare Operator Overloading".

Table: Compare Operator Overloading
R | Comparison | A | B
I32vec2 R | cmpeq cmpne | I[s|u]32vec2 B | I[s|u]32vec2 B
I16vec4 R |  | I[s|u]16vec4 B | I[s|u]16vec4 B
I8vec8 R |  | I[s|u]8vec8 B | I[s|u]8vec8 B
I32vec2 R | cmpgt cmpge cmplt cmple | Is32vec2 B | Is32vec2 B
I16vec4 R |  | Is16vec4 B | Is16vec4 B
I8vec8 R |  | Is8vec8 B | Is8vec8 B


Conditional Select Operators

For conditional select operands, the third and fourth operands determine the type returned. Third and fourth operands with same size, but different signedness, return the nearest common ancestor data type.


Conditional Select Syntax Usage

Return the nearest common ancestor data type if third and fourth operands are of the same size, but different signs.

I16vec4 R = select_neq(Is16vec4, Is16vec4, Is16vec4, Iu16vec4);

Conditional Select for Equality

R0 := (A0 == B0) ? C0 : D0;
R1 := (A1 == B1) ? C1 : D1;
R2 := (A2 == B2) ? C2 : D2;
R3 := (A3 == B3) ? C3 : D3;

Conditional Select for Inequality

R0 := (A0 != B0) ? C0 : D0;
R1 := (A1 != B1) ? C1 : D1;
R2 := (A2 != B2) ? C2 : D2;
R3 := (A3 != B3) ? C3 : D3;
Table: Conditional Select Symbols and Corresponding Intrinsics
Conditional Select For | Operators | Syntax | Corresponding Intrinsic | Additional Intrinsic (Applies to All)
Equality | select_eq | R = select_eq (A, B, C, D) | _mm_cmpeq_pi32 _mm_cmpeq_pi16 _mm_cmpeq_pi8 | _mm_and_si64 _mm_or_si64 _mm_andnot_si64
Inequality | select_neq | R = select_neq (A, B, C, D) | _mm_cmpeq_pi32 _mm_cmpeq_pi16 _mm_cmpeq_pi8 |
Greater Than | select_gt | R = select_gt (A, B, C, D) | _mm_cmpgt_pi32 _mm_cmpgt_pi16 _mm_cmpgt_pi8 |
Greater Than or Equal To | select_ge | R = select_gt (A, B, C, D) | _mm_cmpge_pi32 _mm_cmpge_pi16 _mm_cmpge_pi8 |
Less Than | select_lt | R = select_lt (A, B, C, D) | _mm_cmplt_pi32 _mm_cmplt_pi16 _mm_cmplt_pi8 |
Less Than or Equal To | select_le | R = select_le (A, B, C, D) | _mm_cmple_pi32 _mm_cmple_pi16 _mm_cmple_pi8 |

All conditional select operands must be of the same size. The return data type is the nearest common ancestor of operands C and D. For conditional select operations using greater-than or less-than operations, the first and second operands must be signed as listed in the table that follows.

Table: Conditional Select Operator Overloading
R | Comparison | A and B | C | D
I32vec2 R | select_eq select_ne | I[s|u]32vec2 | I[s|u]32vec2 | I[s|u]32vec2
I16vec4 R |  | I[s|u]16vec4 | I[s|u]16vec4 |
I8vec8 R |  | I[s|u]8vec8 | I[s|u]8vec8 |
I32vec2 R | select_gt select_ge select_lt select_le | Is32vec2 | Is32vec2 | Is32vec2
I16vec4 R |  | Is16vec4 | Is16vec4 |
I8vec8 R |  | Is8vec8 | Is8vec8 |

The following table shows the mapping of return values from R0 to R7 for any number of elements. The same return value mappings also apply when there are fewer than four return values.

Table: Conditional Select Operator Return Value Mapping
Return Value | A and B Operands
 | Available Operators
R0:= | A0 | ==
R1:= | A0 | ==
R2:= | A0 | ==
R3:= | A0 | ==
R4:= | A0 | ==
R5:= | A0 | ==
R6:= | A0 | ==
R7:= | A0 | ==


Debugging

The debug operations are provided for debugging programs only. Use of these operations may result in loss of performance, so you should not use them outside of debugging.


Output

The two 32-bit values of A are placed in the output buffer and printed in the following format (default in decimal):

cout << Is32vec2 A;
cout << Iu32vec2 A;
cout << hex << Iu32vec2 A; /* print in hex format */
"[1]:A1 [0]:A0"

Corresponding Intrinsics: none

The four 16-bit values of A are placed in the output buffer and printed in the following format (default in decimal):

cout << Is16vec4 A;
cout << Iu16vec4 A;
cout << hex << Iu16vec4 A; /* print in hex format */
"[3]:A3 [2]:A2 [1]:A1 [0]:A0"

Corresponding Intrinsics: none

The eight 8-bit values of A are placed in the output buffer and printed in the following format (default is decimal):

cout << Is8vec8 A; cout << Iu8vec8 A;cout << hex << Iu8vec8 A;
/* print in hex format instead of decimal*/
"[7]:A7 [6]:A6 [5]:A5 [4]:A4 [3]:A3 [2]:A2 [1]:A1 [0]:A0"

Corresponding Intrinsics: none


Element Access Operators

int R = Is32vec2 A[i];
unsigned int R = Iu32vec2 A[i];
short R = Is16vec4 A[i];
unsigned short R = Iu16vec4 A[i];
signed char R = Is8vec8 A[i];
unsigned char R = Iu8vec8 A[i];

Access and read element i of A. If DEBUG is enabled and the user tries to access an element outside of A, a diagnostic message is printed and the program aborts.

Corresponding Intrinsics: none


Element Assignment Operators

Is32vec2 A[i] = int R;
Iu32vec2 A[i] = unsigned int R;
Is16vec4 A[i] = short R;
Iu16vec4 A[i] = unsigned short R;
Is8vec8 A[i] = signed char R;
Iu8vec8 A[i] = unsigned char R;

Assign R to element i of A. If DEBUG is enabled and the user tries to assign a value to an element outside of A, a diagnostic message is printed and the program aborts.

Corresponding Intrinsics: none


Unpack Operators

Interleave the 32-bit value from the high half of A with the 32-bit value from the high half of B.

I32vec2 unpack_high(I32vec2 A, I32vec2 B);
Is32vec2 unpack_high(Is32vec2 A, Is32vec2 B);
Iu32vec2 unpack_high(Iu32vec2 A, Iu32vec2 B);
R0 = A1;
R1 = B1;

Corresponding intrinsic: _mm_unpackhi_pi32

Interleave the two 16-bit values from the high half of A with the two 16-bit values from the high half of B.

I16vec4 unpack_high(I16vec4 A, I16vec4 B);
Is16vec4 unpack_high(Is16vec4 A, Is16vec4 B);
Iu16vec4 unpack_high(Iu16vec4 A, Iu16vec4 B);
R0 = A2;R1 = B2;
R2 = A3;R3 = B3;

Corresponding intrinsic: _mm_unpackhi_pi16

Interleave the four 8-bit values from the high half of A with the four 8-bit values from the high half of B.

I8vec8 unpack_high(I8vec8 A, I8vec8 B);
Is8vec8 unpack_high(Is8vec8 A, I8vec8 B);
Iu8vec8 unpack_high(Iu8vec8 A, I8vec8 B);
R0 = A4;
R1 = B4;
R2 = A5;
R3 = B5;
R4 = A6;
R5 = B6;
R6 = A7;
R7 = B7;

Corresponding intrinsic: _mm_unpackhi_pi8

Interleave the 32-bit value from the low half of A with the 32-bit value from the low half of B.

I32vec2 unpack_low(I32vec2 A, I32vec2 B);
Is32vec2 unpack_low(Is32vec2 A, Is32vec2 B);
Iu32vec2 unpack_low(Iu32vec2 A, Iu32vec2 B);
R0 = A0;
R1 = B0;

Corresponding intrinsic: _mm_unpacklo_pi32

Interleave the two 16-bit values from the low half of A with the two 16-bit values from the low half of B.

I16vec4 unpack_low(I16vec4 A, I16vec4 B);
Is16vec4 unpack_low(Is16vec4 A, Is16vec4 B);
Iu16vec4 unpack_low(Iu16vec4 A, Iu16vec4 B);
R0 = A0;
R1 = B0;
R2 = A1;
R3 = B1;

Corresponding intrinsic: _mm_unpacklo_pi16

Interleave the four 8-bit values from the high low of A with the four 8-bit values from the low half of B.

I8vec8 unpack_low(I8vec8 A, I8vec8 B);
Is8vec8 unpack_low(Is8vec8 A, Is8vec8 B);
Iu8vec8 unpack_low(Iu8vec8 A, Iu8vec8 B);
R0 = A0;
R1 = B0;
R2 = A1;
R3 = B1;
R4 = A2;
R5 = B2;
R6 = A3;
R7 = B3;

Corresponding intrinsic: _mm_unpacklo_pi8


Pack Operators

Pack the four 32-bit values found in A and B into eight 16-bit values with signed saturation.

Is16vec4 pack_sat(Is32vec2 A,Is32vec2 B);
Corresponding intrinsic: _mm_packs_pi32

Pack the eight 16-bit values found in A and B into eight 8-bit values with signed saturation.

Is8vec8 pack_sat(Is16vec4 A,Is16vec4 B);
Corresponding intrinsic: _mm_packs_pi16

Pack the eight 16-bit values found in A and B into eight 8-bit values with unsigned saturation.

Iu8vec8 packu_sat(Is16vec4 A,Is16vec4 B);
Corresponding intrinsic: _mm_packs_pi16


Classes Quick Reference

This appendix contains tables listing the class, functionality, and corresponding intrinsics for each class in the Intel® C++ Class Libraries for SIMD Operations. The following table lists all Intel® C++ Compiler intrinsics that are not implemented in the C++ SIMD classes.

Table: Logical Operators: Corresponding Intrinsics and Classes
Operators | Corresponding Intrinsic | I64vec, I32vec, I16vec, I8vec8
&, &= | _mm_and_[x] | si64
|, |= | _mm_or_[x] | si64
^, ^= | _mm_xor_[x] | si64
Andnot | _mm_andnot_[x] | si64

Table: Arithmetic: Corresponding Intrinsics and Classes
Operators | Corresponding Intrinsic | I32vec2 | I16vec4 | I8vec8
+, += | _mm_add_[x] | pi32 | pi16 | pi8
-, -= | _mm_sub_[x] | pi32 | pi16 | pi8
*, *= | _mm_mullo_[x] | N/A | pi16 | N/A
/, /= | _mm_div_[x] | N/A | N/A | N/A
mul_high | _mm_mulhi_[x] | N/A | pi16 | N/A
mul_add | _mm_madd_[x] | N/A | pi16 | N/A
sqrt | _mm_sqrt_[x] | N/A | N/A | N/A
rcp | _mm_rcp_[x] | N/A | N/A | N/A
rcp_nr | _mm_rcp_[x] _mm_add_[x] _mm_sub_[x] _mm_mul_[x] | N/A | N/A | N/A
rsqrt | _mm_rsqrt_[x] | N/A | N/A | N/A
rsqrt_nr | _mm_rsqrt_[x] _mm_sub_[x] _mm_mul_[x] | N/A | N/A | N/A

Table: Shift Operators: Corresponding Intrinsics and Classes
Operators | Corresponding Intrinsic | I64vec1 | I32vec2 | I16vec4 | I8vec8
>>,>>= | _mm_srl_[x] _mm_srli_[x] _mm_sra__[x] _mm_srai_[x] | si64 si64 N/A N/A | pi32 pi32 pi32 pi32 | pi16 pi16 pi16 pi16 | N/A N/A N/A N/A
<<, <<= | _mm_sll_[x] _mm_slli_[x] | si64 si64 | pi32 pi32 | pi16 pi16 | N/A N/A

Table: Comparison Operators: Corresponding Intrinsics and Classes, Part 1
Operators | Corresponding Intrinsic | I32vec2 | I16vec4 | I8vec8
cmpeq | _mm_cmpeq_[x] | pi32 | pi16 | pi8
cmpneq | _mm_cmpeq_[x] _mm_andnot_[y]* | pi32 si64 | pi16 si64 | pi8 si64
cmpgt | _mm_cmpgt_[x] | pi32 | pi16 | pi8
cmpge | _mm_cmpge_[x] _mm_andnot_[y]* | pi32 si64 | pi16 si64 | pi8 si64
cmplt | _mm_cmplt_[x] | pi32 | pi16 | pi8
cmple | _mm_cmple_[x] _mm_andnot_[y]* | pi32 si64 | pi16 si64 | pi8 si64
cmpngt | _mm_cmpngt_[x] | pi32 | pi16 | pi8
cmpnge | _mm_cmpnge_[x] | N/A | N/A | N/A
cmnpnlt | _mm_cmpnlt_[x] | N/A | N/A | N/A
cmpnle | _mm_cmpnle_[x] | N/A | N/A | N/A

Table: Conditional Select Operators: Corresponding Intrinsics and Classes
Operators | Corresponding Intrinsic | I32vec2 | I16vec4 | I8vec8
select_eq | _mm_cmpeq_[x] _mm_and_[y] _mm_andnot_[y]* _mm_or_[y] | pi32 si64 si64 si64 | pi16 si64 si64 si64 | pi8 si64 si64 si64
select_neq | _mm_cmpeq_[x] _mm_and_[y] _mm_andnot_[y]* _mm_or_[y] | pi32 si64 si64 si64 | pi16 si64 si64 si64 | pi8 si64 si64 si64
select_gt | _mm_cmpgt_[x] _mm_and_[y] _mm_andnot_[y]* _mm_or_[y] | pi32 si64 si64 si64 | pi16 si64 si64 si64 | pi8 si64 si64 si64
select_ge | _mm_cmpge_[x] _mm_and_[y] _mm_andnot_[y]* _mm_or_[y] | pi32 si64 si64 si64 | pi16 si64 si64 si64 | pi8 si64 si64 si64
select_lt | _mm_cmplt_[x] _mm_and_[y] _mm_andnot_[y]* _mm_or_[y] | pi32 si64 si64 si64 | pi16 si64 si64 si64 | pi8 si64 si64 si64
select_le | _mm_cmple_[x] _mm_and_[y] _mm_andnot_[y]* _mm_or_[y] | pi32 si64 si64 si64 | pi16 si64 si64 si64 | pi8 si64 si64 si64
select_ngt | _mm_cmpgt_[x] | N/A | N/A | N/A
select_nge | _mm_cmpge_[x] | N/A | N/A | N/A
select_nlt | _mm_cmplt_[x] | N/A | N/A | N/A
select_nle | _mm_cmple_[x] | N/A | N/A | N/A

* Note that _mm_andnot_[y] intrinsics do not apply to the fvec classes.

Table: Packing and Unpacking Operators: Corresponding Intrinsics and Classes
Operators | Corresponding Intrinsic | I32vec2 | I16vec4 | I8vec8
unpack_high | _mm_unpackhi_[x] | pi32 | pi16 | pi8
unpack_low | _mm_unpacklo_[x] | pi32 | pi16 | pi8
pack_sat | _mm_packs_[x] | pi32 | pi16 | N/A
packu_sat | _mm_packus_[x] | N/A | pu16 | N/A
sat_add | _mm_adds_[x] | N/A | pi16 | pi8
sat_sub | _mm_subs_[x] | N/A | pi16 | pi8


Intrinsic Functions

Intrinsics are special coding extensions that allow using the syntax of C/C++ function calls and variables to access the underlying assembly language. Many assembler instructions have a corresponding C/C++ intrinsic that implements these instructions. This frees the user from managing registers and allows the compiler to optimize the instruction scheduling.

Some intrinsic functions are also available as library functions. Using the intrinsic functions instead of library functions improves the code performance; however, it may also increase the size of the code.

This chapter comprises the following sections:

  • "Intrinsic Syntax" defines the syntax used in the descriptions of the individual functions.
  • "String and Block Functions" describes in detail the group of intrinsic functions dealing with string or memory block operations.
  • "General-purpose Integer Functions" describes in detail functions that take the absolute value, rotate left or right, reverse the bytes, multiply, or count bits of their parameters.
  • "System Functions" describes in detail functions dealing with stack memory.
  • "ARM* DSP-Enhanced Instructions Set Intrinsic Functions" describes in detail various arithmetic functions that multiply and/or add their parameters.
  • "Intel XScale® Technology Instruction Set Functions" describes in detail functions that operate on the accumulator of the processor or coprocessors.


Intrinsic Syntax

To use the intrinsic functions, the appropriate header file must be included. This file contains the data type definitions and ANSI C prototypes for the intrinsic functions.

The syntax of the intrinsic prototype is as follows:

Syntax
data_type
intrinsic_name (parameters);

    data_type
    Is the data type of the return value. Intrinsics may return other data types that are described in the intrinsic syntax definitions.
    intrinsic_name
    Is the name of the intrinsic, which behaves like a function that you can use in your C/C++ code instead of inlining the actual instruction.
    parameters
    Represents the parameters required by the intrinsic.


String and Block Functions

This section describes the following functions:

    "memchr"
    Search a range of memory for a character.
    "memcmp"
    Compare two ranges of memory.
    "memcpy"
    Copy a range of memory to another address.
    "memset"
    Initialize a range of memory with a given character.
    "strcat"
    Concatenate two strings.
    "strcmp"
    Compare two strings.
    "strcpy"
    Copy a string to another address.
    "strlen"
    Get the length of a string.


memchr
Syntax
#include <string.h>
void *
memchr (const void *buffer, int ch, size_t count);
Description

This function receives a pointer to a buffer, buffer, a character, ch, and a number, count. It looks for the first occurrence of the character in the first count bytes of the buffer.

Diagnostics

If the character ch is found within the first count bytes of the buffer, the function returns a pointer to the first occurrence of ch. Otherwise, it returns NULL.

Example: Function memchr
char *string = "abcXdXeXfX";

xptr = memchr (string, 'X', n);

If n > 3, the above statement sets xptr to the address of the first 'X' in string. In other words, xptr points to "XdXeXfX".

If n <= 3, xptr is set to NULL.


memcmp
Syntax
#include <string.h>
int
memcmp (const void *buffer1, const void *buffer2, size_t count);
Description

This function receives pointers to two buffers, buffer1 and buffer2, and a number, count. It compares the buffers, byte by byte, until it detects a difference. At most count bytes are being compared.

Diagnostics

The function returns:

    a positive value
    if the differing character of buffer1 has a greater ASCII value than its counterpart in buffer2.
    0
    if the buffers do not differ in the first count characters.
    a negative value
    if the differing character of buffer1 has a smaller ASCII value than its counterpart in buffer2.

Example: Function memcmp
char *string1 = "abcd_e";
char *string2 = "abcd_z";

greater = memcmp (string1, string2, n);

The above statement sets greater to 0 if n is 0,..., 5. For n > 5, greater is set to -1.

See Also

"strcmp"


memcpy
Syntax
#include <string.h>
void *
memcpy (void *to, const void *from, size_t count);
Description

This function receives pointers to two buffers, to and from, and a number, count. It copies the first count bytes from from to to.

Diagnostics

The function returns the address of the buffer to.

Note icon NOTE.
If the memory ranges overlap, the result is unpredictable.

Example: Function memcpy
char *string1 = "abc";
char *between = "123456789";
char *string2 = "defghijk";

memcpy (string1, string2, 5);

The above source code fragment writes the text "defgh" into the memory, starting at the address of string1. Note that not only the three bytes of the original string1, "abc", were overwritten but also the two bytes following. Depending on the alignment, the contents of between might be changed.

See Also


memset
Syntax
#include <string.h>
void *
memset (void *buffer, int ch, size_t count);
Description

The function memset() receives a pointer to a buffer, buffer, a character, ch, and a number, count. It writes the character ch into each of the first count bytes of the buffer.

Diagnostics

The function returns the address of the buffer.

Example: Function memset
char *abuf = "123456789ABCDEF";

memset (abuf, 'a', 7);

The above statement changes the abuf string to "aaaaaaa89ABCDEF".


strcat
Syntax
#include <string.h>
char *
strcat (char *to, const char *from);
Description

This function receives pointers to two buffers, to and from. Both buffers are assumed to be zero-terminated. The function copies the contents of the from buffer to the end of the to buffer and adds a NULL byte.

Diagnostics

The function returns the address of the to buffer.

Note icon NOTE.
This operation overwrites the memory following the to buffer.

Note icon NOTE.
If the memory ranges overlap, the result is unpredictable.

Example: Function strcat
char poem[40];

strcpy (poem, "Roses are red");
strcat (poem, ", violets are blue");

The above statement sets the poem string to "Roses are red, violets are blue".

See Also


strcmp
Syntax
#include <string.h>
int
strcmp (const char *string1, const char *string2);
Description

This function receives pointers to two character strings, string1 and string2. It compares the strings, character by character, until it detects a difference or encounters the terminating NULL byte of a string.

Diagnostics

The function returns:

    a positive value
    if the differing character of string1 has a greater ASCII value than its counterpart in string2.
    0
    if the strings do not differ.
    a negative value
    if the differing character of string1 has a smaller ASCII value than its counterpart in string2.

Example: Function strcmp
greater = strcmp ("abcde", "abc");

The above statement sets greater to a positive value because 'd' has a greater value than the terminating NULL byte of the second string.

See Also

"memcmp"


strcpy
Syntax
#include <string.h>
void *
strcpy (char *to, const char *from);
Description

This function receives pointers to two character strings, to and from. It copies all characters from from to to, up to and including the terminating NULL byte of the from string.

Diagnostics

The function returns the address of the string to.

Note icon NOTE.
If the memory ranges overlap, the result is unpredictable.

Example: Function strcpy
char *string1 = "abc";
char *between = "123456789";
char *string2 = "defghijk";

strcpy (string1, string2);

The above source code fragment writes the text "defghijk" into the memory, starting at the address of string1. Note that not only the three bytes of the original string1, "abc", were overwritten but also the five bytes following. Depending on the alignment, the contents of between might be changed.

See Also


strlen
Syntax
#include <string.h>
size_t
strlen (const char *string);
Description

This function receives a pointer to a zero-terminated character string. It counts the characters of the string.

Diagnostics

The function returns the number of characters up to, but not including, the terminating NULL byte of the string.

Example: Function strlen
char *text = "123456789 123456789";
size_t m, n;

m = strlen (text);
text[0] = 0;
n = strlen (text);

The code fragment above sets m to 19 and n to 0.


General-purpose Integer Functions

This section describes the following functions:

    "_abs64"
    Return the absolute value.
    "_byteswap_uint64"
    Reverse bytes.
    "_byteswap_ulong"
    Reverse bytes.
    "_byteswap_ushort"
    Reverse bytes.
    "_CountLeadingOnes"
    Count leading 1 bits.
    "_CountLeadingOnes64"
    Count leading 1 bits.
    "_CountLeadingZeros"
    Count leading 0 bits.
    "_CountLeadingZeros64"
    Count leading 0 bits.
    "_CountOneBits"
    Count all 1 bits.
    "_lrotl"
    Rotate bits left.
    "_lrotr"
    Rotate bits right.
    "_MulHigh"
    Multiply.
    "_MulUnsignedHigh"
    Multiply.
    "_rotl"
    Rotate bits left.
    "_rotl64"
    Rotate bits left.
    "_rotr"
    Rotate bits right.
    "_rotr64"
    Rotate bits right.
    "labs"
    Return the absolute value.


_abs64
Syntax
#include <math.h>
__int64
_abs64 (__int64 number);
Description

This function returns the absolute value of its argument, number.

Diagnostics

This function does not issue any diagnostic output.

Example: Function _abs64
__int64 number, absolute;

number = -100;
absolute = _abs64 (number);

The variable absolute is set to 100.

See Also

"labs"


_byteswap_uint64
Syntax
#include <stdlib.h>
unsigned __int64
_byteswap_uint64 (unsigned __int64 value);
Description

This function receives a value and reverses the order of its bytes. The last byte comes first, then the penultimate one, and so on.

Diagnostics

The function returns the reversed value.

Example: Function _byteswap_uint64
unsigned __int64 old_order;
unsigned __int64 new_order;

old_order = 0x0102030405060708;
new_order = _byteswap_uint64 (old_order);

The variable new_order is set to 0x0807060504030201.

See Also


_byteswap_ulong
Syntax
#include <stdlib.h>
unsigned long
_byteswap_ulong (unsigned long value);
Description

This function receives a value and reverses the order of its bytes. The last byte comes first, then the penultimate one, and so on.

Diagnostics

The function returns the reversed value.

Example: Function _byteswap_ulong
unsigned long old_order;
unsigned long new_order;

old_order = 0x12345678;
new_order = _byteswap_ulong (old_order);

The variable new_order is set to 0x78563412.

See Also


_byteswap_ushort
Syntax
#include <stdlib.h>
unsigned short
_byteswap_ushort (unsigned short value);
Description

This function receives a value and reverses the order of its bytes. The last byte comes first, then the penultimate one, and so on.

Diagnostics

The function returns the reversed value.

Example: Function _byteswap_ushort
unsigned short old_order;
unsigned short new_order;

old_order = 0x1234;
new_order = _byteswap_ushort (old_order);

The variable new_order is set to 0x3412.

See Also


_CountLeadingOnes
Syntax
#include <cmnintrin.h>
unsigned
_CountLeadingOnes (long value);
Description

This function counts the number of contiguous 1 bits of its argument, starting with the most significant bit.

Diagnostics

The function returns a number in the range [0..32].

Example: Function _CountLeadingOnes
long value;

unsigned long ret;
value = 0xFFFF0000;
ret = _CountLeadingOnes (value);

The variable ret is set to 16.

See Also


_CountLeadingOnes64
Syntax
#include <cmnintrin.h>
unsigned
_CountLeadingOnes64 (__int64 value);
Description

This function counts the number of contiguous 1 bits of its argument, starting with the most significant bit.

Diagnostics

The function returns a number in the range [0..64].

Example: Function _CountLeadingOnes64
__int64 value;
unsigned long ret;

value = 0xFFFFFFFF00000000;
ret = _CountLeadingOnes64 (value);

The variable ret is set to 32.

See Also


_CountLeadingZeros
Syntax
#include <cmnintrin.h>
unsigned
_CountLeadingZeros (long value);
Description

This function counts the number of contiguous 0 bits of its argument, starting with the most significant bit.

Diagnostics

The function returns a number in the range [0..32].

Example: Function _CountLeadingZeros
long value;
unsigned long ret;

value = 0x0000FFFF;
ret = _CountLeadingZeros (value);

The variable ret is set to 16.

See Also


_CountLeadingZeros64
Syntax
#include <cmnintrin.h>
unsigned
_CountLeadingZeros64 (__int64 value);
Description

This function counts the number of contiguous 0 bits of its argument, starting with the most significant bit.

Diagnostics

The function returns a number in the range [0..64].

Example: Function _CountLeadingZeros64
__int64 value;
unsigned long ret;

value = 0x00000000FFFFFFFF;
ret = _CountLeadingZeros64 (value);

The variable ret is set to 32.

See Also


_CountOneBits
Syntax
#include <cmnintrin.h>
unsigned
_CountOneBits (long value);
Description

This function counts the number of 1 bits of its argument.

Diagnostics

The function returns a number in the range [0..32].

Example: Function _CountOneBits
unsigned long ret;
long val;

val = 0x00FFFF00;
ret = _CountOneBits (val);

The variable ret is set to 16.

See Also


_lrotl
Syntax
#include <stdlib.h>
unsigned
long _lrotl (unsigned long number, int count);
Description

This function receives a long number, number, and a rotate counter, count. It rotates the bits of its argument number to the left by count bits.

Diagnostics

The function returns the rotated number.

Example: Function _lrotl
unsigned long num, ret;

num = 0x78123456;
ret = _lrotl (num, 8);

The variable ret is set to 0x12345678.

See Also


_lrotr
#include <stdlib.h>
unsigned long
_lrotr (unsigned long number, int count);
Description

This function receives a long number, number, and a rotate counter, count. It rotates the bits of its argument number to the right by count bits.

Diagnostics

The function returns the rotated number.

Example: Function _lrotr
unsigned long num, ret;

num = 0x34567812;
ret = _lrotr (num, 8);

The variable ret is set to 0x12345678.

See Also


_MulHigh
Syntax
#include <cmnintrin.h>
long
_MulHigh (long first, long second);
Description

This function multiplies the two numbers it receives.

Diagnostics

The function returns the high-order 32 bits of the multiplication result.

Example: Function _MulHigh
long first, second, result;

first = 0x00050000;
second = 0x00050000;
result = _MulHigh (first, second);

The variable result is set to 25.

See Also

"_MulUnsignedHigh"


_MulUnsignedHigh
Syntax
#include <cmnintrin.h>
unsigned long
_MulUnsignedHigh (unsigned long first, unsigned long second);
Description

This function multiplies the two unsigned numbers it receives.

Diagnostics

The function returns the unsigned high-order 32 bits of the multiplication result.

Example: Function _MulUnsignedHigh
unsigned long first, second, result;

first = 0x00050000;
second = 0x00050000;
result = _MulUnsignedHigh (first, second);

The variable result is set to 25.

See Also

"_MulHigh"


_rotl
Syntax
#include <stdlib.h>
unsigned int
_rotl (unsigned int number, int count);
Description

This function receives an unsigned number, number, and a rotate counter, count. It rotates the bits of its argument number to the left by count bits.

Diagnostics

The function returns the rotated number.

Example: Function _rotl
unsigned int num, ret;

num = 0x78123456;
ret = _rotl (num, 8);

The variable ret is set to 0x12345678.

See Also


_rotl64
Syntax
#include <stdlib.h>
unsigned __int64 __cdecl
_rotl64 (unsigned __int64 number, int count);
Description

This function receives a 64-bit number, number, and a rotate counter, count. It rotates the bits of its argument number to the left by count bits.

Diagnostics

The function returns the rotated number.

Example: Function _rotl64
unsigned __int64 num, ret;

num = 0xFF12345678123456;
ret = _rotl64 (num, 8);

The variable ret is set to 0x12345678123456FF.

See Also


_rotr
Syntax
#include <stdlib.h>
unsigned int
_rotr (unsigned int number, int count);
Description

This function receives an unsigned number, number, and a rotate counter, count. It rotates the bits of its argument number to the right by count bits.

Diagnostics

The function returns the rotated number.

Example: Function _rotr
unsigned int num, ret;

num = 0x34567812;
ret = _rotr (num, 8);

The variable ret is set to 0x12345678.

See Also


_rotr64
Syntax
#include <stdlib.h>
unsigned __int64
_rotr64 (unsigned __int64 number, int count);
Description

This function receives a 64-bit number, number, and a rotate counter, count. It rotates the bits of its argument number to the right by count bits.

Diagnostics

The function returns the rotated number.

Example: Function _rotr64
unsigned __int64 num, ret;

num = 0x12345678123456FF;
ret = _rotr64 (num, 8);

The variable ret is set to 0xFF12345678123456.

See Also


labs
Syntax
#include <math.h>
long
labs (long number);
Description

This function returns the absolute value of its argument, number.

Diagnostics

This function does not issue any diagnostic output.

Example: Function labs
long absolute, ret;

absolute = -1500;
ret = labs (absolute);

The variable ret is set to 1500.

See Also

"_abs64"


System Functions

This section describes the following functions:

    "__trap"
    Create a software breakpoint.
    "_alloca"
    Allocate stack memory.


__trap
Syntax
#include <cmnintrin.h>
int
__trap (int trapnum);
Description

This function creates a software breakpoint with the specified number, trapnum.

Diagnostics

The function returns the return value of the trap handler. If the trap handler does not return a value, the return value of __trap() is undefined.


_alloca
Syntax
#include <malloc.h>
void *
_alloca (size_t number);
Description

This function allocates stack memory. The argument number specifies the number of bytes to be allocated. The allocated space is correctly aligned for any type of data.

Note icon NOTE.
The allocated space is automatically freed when the function that called _alloca() exits. Do not explicitly free this space by calling the function free()!

Diagnostics

If the requested amount could be allocated, the function returns a void pointer to the allocated stack memory.

If the requested amount could not be allocated, a stack overflow exception is thrown.

Example: Function _alloca
int * memory;

memory = (int *) _alloca (sizeof(int) * 10);

The variable memory now holds the address of an allocated piece of stack memory large enough to store 10 integers.


ARM* DSP-Enhanced Instructions Set Intrinsic Functions

This section describes the following functions:

    "_AddSatInt"
    Saturate an add instruction.
    "_DAddSatInt"
    Double an integer and saturate, then add to another integer and saturate.
    "_DSubSatInt"
    Double an integer and saturate, then subtract from another integer and saturate.
    "_ReadCoProcessor"
    Read 64-bit data from coprocessor.
    "_SmulAddHi_SW_SL"
    Multiply 16-bit values and add to 32-bit value.
    "_SmulAddHi_SW_SQ"
    Multiply 16-bit values and add to 64-bit value.
    "_SmulAddHiLo_SW_SL"
    Multiply 16-bit values and add to 32-bit value.
    "_SmulAddHiLo_SW_SQ"
    Multiply 16-bit values and add to 64-bit value.
    "_SmulAddLo_SW_SL"
    Multiply 16-bit values and add to 32-bit value.
    "_SmulAddLo_SW_SQ"
    Multiply 16-bit values and add to 64-bit value.
    "_SmulAddLoHi_SW_SL"
    Multiply 16-bit values and add to 32-bit value.
    "_SmulAddLoHi_SW_SQ"
    Multiply 16-bit values and add to 64-bit value.
    "_SmulAddWHi_SW_SL"
    Multiply 16-bit values and add to 64-bit value.
    "_SmulAddWLo_SW_SL"
    Multiply 32-bit value with 16-bit value and add to 32-bit value.
    "_SmulHi_SW_SL"
    Multiply 16-bit values.
    "_SmulHiLo_SW_SL"
    Multiply 16-bit values.
    "_SmulLo_SW_SL"
    Multiply 16-bit values
    "_SmulLoHi_SW_SL"
    Multiply 16-bit values
    "_SmulWHi_SW_SL"
    Multiply 32-bit value with 16-bit value, returning the upper 32 bit.
    "_SmulWLo_SW_SL"
    Multiply 32-bit value with 16-bit value, returning the upper 32 bit.
    "_SubSatInt"
    Subtract and saturate.
    "_WriteCoProcessor"
    Write 64-bit data to coprocessor.


_AddSatInt
Syntax
#include <armintr.h>
int
_AddSatInt (int add1, int add2);
Description

This function adds its parameters add1 and add2 with saturation.

Diagnostics

The function returns the result of the addition.

Example: Function _AddSatInt
int val1, val2, result;

val1 = 2147483645;
val2 = 3;
result = _AddSatInt (val1, val2);

The arithmetical result would be 2147483648 or 0x80000000. Because of the saturation, result is actually set to 2147483647 or 0x7FFFFFFF.

See Also


_DAddSatInt
Syntax
#include <armintr.h>
int
_DAddSatInt (int addval, int doubleval);
Description

This function doubles the value of its second parameter, doubleval, then adds the first parameter, addval, to the result. Both operations are performed with saturation.

Diagnostics

The function returns the result of the addition.

Example: Function _DAddSatInt
int add, doubleadd, result;

add = 2147483640;
doubleadd = 5;
result = _DAddSatInt (add, doubleadd);

The arithmetical result would be 2147483650 or 0x80000002. Because of the saturation, result is actually set to 2147483647 or 0x7FFFFFFF.

See Also


_DSubSatInt
Syntax
#include <armintr.h>
int
_DSubSatInt (int doublesub, int value);
Description

This function doubles the value of its first parameter, doublesub, then subtracts the result from value. Both operations are performed with saturation.

Diagnostics

The function returns the result of the subtraction.

Example: Function _DSubSatInt
int sub, value, result;

sub = 5;
value = -2147483640;
result = _DSubSatInt (sub, value);

The arithmetical result would be -2147483650. Because of the saturation, result is actually set to -2147483648.

See Also


_ReadCoProcessor
Syntax
#include <armintr.h>
__int64
_ReadCoProcessor (int copro);
Description

This function receives the number of a coprocessor, copro, and reads the value of the accumulator, acc0, of the specified coprocessor.

Diagnostics

The function returns the value of the coprocessor accumulator.

Example: Function _ReadCoProcessor
__int64 acc0;

acc0 = _ReadCoProcessor (0);

The variable acc0 is set to the current value of the coprocessor 0 accumulator.

See Also

"_WriteCoProcessor"


_SmulAddHi_SW_SL
Syntax
#include <armintr.h>
int
_SmulAddHi_SW_SL (int add, int mult1, int mult2);
Description

This function multiplies the higher 16 bit of mult1 with the higher 16 bit of mult2 and adds the 32-bit result to add.

Diagnostics

The function returns the result of the addition.

Example: Function _SmulAddHi_SW_SL
int add, mult1, mult2, result;

mult1 = 0x00050000;
mult2 = 0x00050000;
add = 100;
result = _SmulAddHi_SW_SL (add, mult1, mult2);

The variable result is set to 125 or 0x07d.

See Also

"_SmulAddHi_SW_SQ"
"_SmulAddHiLo_SW_SL"
"_SmulAddHiLo_SW_SQ"
"_SmulAddLo_SW_SL"
"_SmulAddLo_SW_SQ"
"_SmulAddLoHi_SW_SL"
"_SmulAddLoHi_SW_SQ"
"_SmulAddWHi_SW_SL"
"_SmulAddWLo_SW_SL"


_SmulAddHi_SW_SQ
Syntax
#include <armintr.h>
__int64
_SmulAddHi_SW_SQ (__int64 add, int mult1, int mult2);
Description

This function multiplies the higher 16 bit of mult1 with the higher 16 bit of mult2 and adds the 32-bit result to add.

Diagnostics

The function returns the 64-bit result of the addition.

See Also

"_SmulAddHi_SW_SL"
"_SmulAddHiLo_SW_SL"
"_SmulAddHiLo_SW_SQ"
"_SmulAddLo_SW_SL"
"_SmulAddLo_SW_SQ"
"_SmulAddLoHi_SW_SL"
"_SmulAddLoHi_SW_SQ"
"_SmulAddWHi_SW_SL"
"_SmulAddWLo_SW_SL"


_SmulAddHiLo_SW_SL
Syntax
#include <armintr.h>
int
_SmulAddHiLo_SW_SL (int add, int mult1, int mult2);
Description

This function multiplies the higher 16 bit of mult1 with the lower 16 bit of mult2 and adds the 32-bit result to add.

Diagnostics

The function returns the result of the addition.

Example: Function _SmulAddHiLo_SW_SL
int mult1, mult2, add, result;

mult1 = 0x00050000;
mult2 = 0x00000005;
add = 100;
result = _SmulAddHiLo_SW_SL (add, mult1, mult2);

The variable result is set to 125.

See Also

"_SmulAddHi_SW_SL"
"_SmulAddHi_SW_SQ"
"_SmulAddHiLo_SW_SQ"
"_SmulAddLo_SW_SL"
"_SmulAddLo_SW_SQ"
"_SmulAddLoHi_SW_SL"
"_SmulAddLoHi_SW_SQ"
"_SmulAddWHi_SW_SL"
"_SmulAddWLo_SW_SL"


_SmulAddHiLo_SW_SQ
Syntax
#include <armintr.h>
__int64
_SmulAddHiLo_SW_SQ (__int64 add, int mult1, int mult2);
Description

This function multiplies the higher 16 bit of mult1 with the lower 16 bit of mult2 and adds the 32-bit result to add.

Diagnostics

The function returns the 64-bit result of the addition.

See Also

"_SmulAddHi_SW_SL"
"_SmulAddHi_SW_SQ"
"_SmulAddHiLo_SW_SL"
"_SmulAddLo_SW_SL"
"_SmulAddLo_SW_SQ"
"_SmulAddLoHi_SW_SL"
"_SmulAddLoHi_SW_SQ"
"_SmulAddWHi_SW_SL"
"_SmulAddWLo_SW_SL"


_SmulAddLo_SW_SL
Syntax
#include <armintr.h>
int
_SmulAddLo_SW_SL (int add, int mult1, int mult2);
Description

This function multiplies the lower 16 bit of mult1 with the lower 16 bit of mult2 and adds the 32-bit result to add.

Diagnostics

The function returns the result of the addition.

Example: Function _SmulAddLo_SW_SL
int mult1, mult2, add, result;

mult1 = 0x00000005;
mult2 = 0x00000005;
add = 100;
result = _SmulAddLo_SW_SL (add, mult1, mult2);

The variable result is set to 125.

See Also

"_SmulAddHi_SW_SL"
"_SmulAddHi_SW_SQ"
"_SmulAddHiLo_SW_SL"
"_SmulAddHiLo_SW_SQ"
"_SmulAddLo_SW_SQ"
"_SmulAddLoHi_SW_SL"
"_SmulAddLoHi_SW_SQ"
"_SmulAddWHi_SW_SL"
"_SmulAddWLo_SW_SL"


_SmulAddLo_SW_SQ
Syntax
#include <armintr.h>
__int64
_SmulAddLo_SW_SQ (__int64 add, int mult1, int mult2);
Description

This function multiplies the lower 16 bit of mult1 with the lower 16 bit of mult2 and adds the 32-bit result to add.

Diagnostics

The function returns the 64-bit result of the addition.

See Also

"_SmulAddHi_SW_SL"
"_SmulAddHi_SW_SQ"
"_SmulAddHiLo_SW_SL"
"_SmulAddHiLo_SW_SQ"
"_SmulAddLo_SW_SL"
"_SmulAddLoHi_SW_SL"
"_SmulAddLoHi_SW_SQ"
"_SmulAddWHi_SW_SL"
"_SmulAddWLo_SW_SL"


_SmulAddLoHi_SW_SL
Syntax
#include <armintr.h>
int
_SmulAddLoHi_SW_SL (int add, int mult1, int mult2);
Description

This function multiplies the lower 16 bit of mult1 with the higher 16 bit of mult2 and adds the 32-bit result to add.

Diagnostics

The function returns the result of the addition.

Example: Function _SmulAddLoHi_SW_SL
int mult1, mult2, result;

mult1 = 0x0000000F; // 15
mult2 = 0x000F0000; // 15
result = _SmulLoHi_SW_SL (mult1, mult2);

The variable result is set to 225 or 0x0E1.

See Also

"_SmulAddHi_SW_SL"
"_SmulAddHi_SW_SQ"
"_SmulAddHiLo_SW_SL"
"_SmulAddHiLo_SW_SQ"
"_SmulAddLo_SW_SL"
"_SmulAddLo_SW_SQ"
"_SmulAddLoHi_SW_SQ"
"_SmulAddWHi_SW_SL"
"_SmulAddWLo_SW_SL"


_SmulAddLoHi_SW_SQ
Syntax
#include <.h>
__int64
_SmulAddLoHi_SW_SQ (__int64 add, int mult1, int mult2);

This function multiplies the lower 16 bit of mult1 with the higher 16 bit of mult2 and adds the 32-bit result to add.

Diagnostics

The function returns the 64-bit result of the addition.

See Also

"_SmulAddHi_SW_SL"
"_SmulAddHi_SW_SQ"
"_SmulAddHiLo_SW_SL"
"_SmulAddHiLo_SW_SQ"
"_SmulAddLo_SW_SL"
"_SmulAddLo_SW_SQ"
"_SmulAddLoHi_SW_SL"
"_SmulAddWHi_SW_SL"
"_SmulAddWLo_SW_SL"


_SmulAddWHi_SW_SL
Syntax
#include <armintr.h>
int
_SmulAddWHi_SW_SL (int add, int mult1, int mult2);
Description

This function multiplies mult1 with the higher 16 bit of mult2 and adds the higher 32 bit of the 48-bit result to add.

Diagnostics

The function returns the result of the addition.

Example: Function _SmulAddWHi_SW_SL
int result, mult1, mult2, add;

mult1 = 655360; // -> 0x000A0000
mult2 = 0x000A0000;
add = 100;
result = _SmulAddWHi_SW_SL (add, mult1, mult2);

The variable result is set to 200.

See Also

"_SmulAddHi_SW_SL"
"_SmulAddHi_SW_SQ"
"_SmulAddHiLo_SW_SL"
"_SmulAddHiLo_SW_SQ"
"_SmulAddLo_SW_SL"
"_SmulAddLo_SW_SQ"
"_SmulAddLoHi_SW_SL"
"_SmulAddLoHi_SW_SQ"
"_SmulAddWLo_SW_SL"


_SmulAddWLo_SW_SL
Syntax
#include <armintr.h>
int
_SmulAddWLo_SW_SL (int add, int mult1, int mult2);
Description

This function multiplies mult1 with the lower 16 bit of mult2 and adds the upper 32 bit of the 48-bit result to add.

Diagnostics

The function returns the result of the addition.

Example: Function _SmulAddWLo_SW_SL
int result, mult1, mult2, add;

mult1 = 655360; // -> 0x000a0000
mult2 = 0x0000000a;
add = 100;
result = _SmulAddWLo_SW_SL (add, mult1, mult2);

The variable result is set to 200.

See Also

"_SmulAddHi_SW_SL"
"_SmulAddHi_SW_SQ"
"_SmulAddHiLo_SW_SL"
"_SmulAddHiLo_SW_SQ"
"_SmulAddLo_SW_SL"
"_SmulAddLo_SW_SQ"
"_SmulAddLoHi_SW_SL"
"_SmulAddLoHi_SW_SQ"
"_SmulAddWHi_SW_SL"


_SmulHi_SW_SL
Syntax
#include <armintr.h>
int
_SmulHi_SW_SL (int mult1, int mult2);
Description

This function multiplies the higher 16 bit of mult1 with the higher 16 bit of mult2.

Diagnostics

The function returns the result of the multiplication.

Example: Function _SmulHi_SW_SL
int mult1, mult2, result;

mult1 = 0x000F0000; // 15
mult2 = 0x0000000F; // 15
result = _SmulHi_SW_SL (mult1, mult2);

The variable result is set to 225 or 0x0E1.

See Also


_SmulHiLo_SW_SL
Syntax
#include <armintr.h>
int
_SmulHiLo_SW_SL (int mult1, int mult2);
Description

This function multiplies the higher 16 bit of mult1 with the lower 16 bit of mult2.

Diagnostics

The function returns the result of the multiplication.

Example: Function _SmulHiLo_SW_SL
int mult1, mult2, result;

mult1 = 0x000F0000; // 15
mult2 = 0x0000000F; // 15
result = _SmulHiLo_SW_SL (mult1, mult2);

The variable result is set to 225 or 0x0E1.

See Also


_SmulLo_SW_SL
Syntax
#include <armintr.h>
int
_SmulLo_SW_SL (int mult1, int mult2);
Description

This function multiplies the lower 16 bit of mult1 with the lower 16 bit of mult2.

Diagnostics

The function returns the result of the multiplication.

Example: Function _SmulLo_SW_SL
int mult1, mult2, result;

mult1 = 0x0000000F; // 15
mult2 = 0x0000000F; // 15
result = _SmulLo_SW_SL (mult1, mult2);

The variable result is set to 225 or 0xE1.

See Also


_SmulLoHi_SW_SL
Syntax
#include <armintr.h>
int
_SmulLoHi_SW_SL (int mult1, int mult2);
Description

This function multiplies the lower 16 bit of mult1 with the higher 16 bit of mult2.

Diagnostics

The function returns the result of the multiplication.

Example: Function _SmulLoHi_SW_SL
int mult1, mult2, result;

mult1 = 0x0000000F; // 15
mult2 = 0x000F0000; // 15
result = _SmulLoHi_SW_SL (mult1, mult2);

The variable result is set to 225 or 0x0E1.

See Also


_SmulWHi_SW_SL
Syntax
#include <armintr.h>
int
_SmulWHi_SW_SL (int mult1, int mult2);
Description

This function multiplies mult1 with the higher 16 bit of mult2.

Diagnostics

The function returns the higher 32 bit of the 48-bit result of the multiplication.

Example: Function _SmulWHi_SW_SL
int result, mult1, mult2;

mult1 = 655360; // -> 0x000A0000
mult2 = 0x000A0000;
result = _SmulWHi_SW_SL (mult1, mult2);

The variable result is set to 100.

See Also


_SmulWLo_SW_SL
Syntax
#include <armintr.h>
int
_SmulWLo_SW_SL (int mult1, int mult2);
Description

This function multiplies mult1 with the lower 16 bit of mult2.

Diagnostics

The function returns the higher 32 bit of the 48-bit result of the multiplication.

Example: Function _SmulWLo_SW_SL
int result, mult1, mult2;
mult1 = 655360; // -> 0x000a0000
mult2 = 0x0000000a;
result = _SmulWLo_SW_SL (mult1, mult2);

The variable result is set to 100.

See Also


_SubSatInt
Syntax
#include <armintr.h>
int
_SubSatInt (int value, int sub);
Description

This function subtracts its parameter sub from value with saturation.

Diagnostics

The function returns the result of the subtraction.

Example: Function _SubSatInt
int sub, value, result;

value = 2147483645;
sub = -5;
result = _SubSatInt (value, sub);

The arithmetical result would be 2147483650 or 0x80000002. Because of the saturation, result is actually set to 2147483647 or 0x7FFFFFFF.

See Also


_WriteCoProcessor
Syntax
#include <armintr.h>
void
_WriteCoProcessor (__int64 value, int copro);
Description

This function receives the number of a coprocessor, copro, and a 64-bit value, value. It writes the value of value into the accumulator, acc0, of the specified coprocessor.

Note icon NOTE.
The second parameter, copro, must be an immediate value, not a variable.

Diagnostics

The function does not provide a return value.

Example: Function _WriteCoProcessor
__int64 val;

val = 0x1234567812345678;
_WriteCoProcessor (val, 0);

The value 0x1234567812345678 is written to the accumulator.

See Also

"_ReadCoProcessor"


Intel XScale® Technology Instruction Set Functions

This section describes the following functions:

    "_PreLoad"
    Hint to the memory system that a memory access to the specified address will occur shortly.
    "_SmulAdd_SL_ACC"
    Multiply two signed values and add the result to the 40-bit accumulator.
    "_SmulAddHi_SW_ACC"
    Perform a 16-bit signed multiplication and accumulate the result to the 40-bit accumulator.
    "_SmulAddHiLo_SW_ACC"
    Perform a 16-bit signed multiplication and accumulate the result to the 40-bit accumulator.
    "_SmulAddLo_SW_ACC"
    Perform a 16-bit signed multiplication and accumulate the result to the 40-bit accumulator.
    "_SmulAddLoHi_SW_ACC"
    Perform a 16-bit signed multiplication and accumulate the result to the 40-bit accumulator.
    "_SmulAddPack_2SW_ACC"
    Perform two 16-bit signed multiplications on packed half word data and accumulate the result to the 40-bit accumulator.


_PreLoad
Syntax
#include <armintr.h>
void
_PreLoad (unsigned long *address);
Description

This function is used to indicate that a memory access from a specified address is imminent. This enables the memory system to preload the cache line containing the specified address, thereby optimizing memory system performance.

Diagnostics

The function does not provide a return value.

Example: Function _PreLoad
unsigned long *address;

address = 0x0000ABCD;
_PreLoad (address);


_SmulAdd_SL_ACC
Syntax
#include <armintr.h>
void
_SmulAdd_SL_ACC (int mult1, int mult2);
Description

This function multiplies the values of its parameters, mult1 and mult2, and adds the result into the accumulator of the processor, acc0.

Diagnostics

The function does not provide a return value.

Example: Function _SmulAdd_SL_ACC
__int64 result, add;
int mult1, mult2;

mult1 = 5;
mult2 = 5;
add = 100;
_WriteCoProcessor (add, 0);
_SmulAdd_SL_ACC (mult1, mult2);
result = _ReadCoProcessor (0);

The variable result is set to 125 or 0x07d.

See Also


_SmulAddHi_SW_ACC
Syntax
#include <armintr.h>
void
_SmulAddHi_SW_ACC (int mult1, int mult2);
Description

This function multiplies the higher 16 bit of mult1 with the higher 16 bit of mult2. The result is added into the accumulator of the processor, acc0.

Diagnostics

The function does not provide a return value.

Example: Function _SmulAddHi_SW_ACC
__int64 result, add;
int mult1, mult2;

mult1 = 0x00050000; // 5
mult2 = 0x00050000; // 5
add = 100;
_WriteCoProcessor (add, 0);
_SmulAddHi_SW_ACC (mult1, mult2);
result = _ReadCoProcessor (0);

The variable result is set to 125 or 0x07d.

See Also


_SmulAddHiLo_SW_ACC
Syntax
#include <armintr.h>
void
_SmulAddHiLo_SW_ACC (int mult1, int mult2);
Description

This function multiplies the higher 16 bit of mult1 with the lower 16 bit of mult2. The result is added into the accumulator of the processor, acc0.

Diagnostics

The function does not provide a return value.

Example: Function _SmulAddHiLo_SW_ACC
__int64 result, add;

int mult1, mult2;
mult1 = 0x00050000; // 5
mult2 = 0x00000005; // 5
add = 100;
_WriteCoProcessor (add, 0);
_SmulAddHiLo_SW_ACC (mult1, mult2);
result = _ReadCoProcessor (0);

The variable result is set to 125 or 0x07d.

See Also


_SmulAddLo_SW_ACC
Syntax
#include <armintr.h>
void
_SmulAddLo_SW_ACC (int mult1, int mult2);
Description

This function multiplies the lower 16 bit of mult1 with the lower 16 bit of mult2. The result is added into the accumulator of the processor, acc0.

Diagnostics

The function does not provide a return value.

Example: Function _SmulAddLo_SW_ACC
__int64 result, add;

int mult1, mult2;
mult1 = 0x00000005; // 5
mult2 = 0x00000005; // 5
add = 100;
_WriteCoProcessor (add, 0);
_SmulAddLo_SW_ACC (mult1, mult2);
result = _ReadCoProcessor (0);

The variable result is set to 125.

See Also


_SmulAddLoHi_SW_ACC
Syntax
#include <armintr.h>
void
_SmulAddLoHi_SW_ACC (int mult1, int mult2);
Description

This function multiplies the lower 16 bit of mult1 with the higher 16 bit of mult2. The result is added into the accumulator of the processor, acc0.

Diagnostics

The function does not provide a return value.

Example: Function _SmulAddLoHi_SW_ACC
int mult1, mult2, add, result;

mult1 = 0x00000005;
mult2 = 0x00050000;
add = 100;
result = _SmulAddLoHi_SW_SL (add, mult1, mult2);

The variable result is set to 125.

See Also


_SmulAddPack_2SW_ACC
Syntax
#include <armintr.h>
void
_SmulAddPack_2SW_ACC (int mult1, int mult2);
Description

This function performs two multiplications: It multiplies the higher 16 bit of mult1 with the higher 16 bit of mult2, and the lower 16 bit of mult1 with the lower 16 bit of mult2. The results are both added into the accumulator of the processor, acc0.

Diagnostics

The function does not provide a return value.

Example: Function _SmulAddPack_2SW_ACC
__int64 result, add;
int mult1, mult2;

add = 100;
mult1 = 0x0005000A;
mult2 = 0x0005000A;
_WriteCoProcessor (add, 0);
_SmulAddPack_2SW_ACC (mult1, mult2);
result = _ReadCoProcessor (0);

The variable result is set to 225 or 0x0E1.

See Also


Intel® Wireless MMX(TM) Technology Intrinsic Support

Intel® Wireless MMX(TM) technology is a high-performance, low-power, 64-bit multimedia coprocessor for the Intel XScale® technology. It is a media-enhancement technology that exploits data parallelism. Intel® Wireless MMX(TM) technology gives developers all the components for developing, debugging and running multimedia applications on a handheld platform. And this technology offers its powerful new capabilities in a model already familiar to programmers who have used Intel MMX(TM) and integer Intel® SSE (Streaming SIMD Extensions).

Intel® Wireless MMX(TM) technology exploits the data parallelism present in a large number of multimedia algorithms by executing the same operation on different data elements in parallel. Data parallelism requires that the same operations are performed on many data samples. It requires that this be done concurrently, with multiple pixels in an image going through the same operations independently. This is accomplished this by packing multiple data elements into one 64-bit register. To process this packed data, the Intel® Wireless MMX(TM) technology extends the existing Intel XScale® technology with new instructions for operating on packed-data formats.

Intrinsics are special coding extensions that allow using the syntax of C function calls and C variables to access the Intel® Wireless MMX(TM) technology. Most Intel® Wireless MMX(TM) instructions have a corresponding C intrinsic that implements these instructions. This frees the user from managing registers and allows the compiler to optimize the instruction scheduling.

Intel® Wireless MMX(TM) instructions use the following new features:

  • New registers enable packed data of up to 64 bits in length for SIMD processing.
  • New data types enable packing of up to 8 elements of data in one register.


Intel® Wireless MMX(TM) Technology Data Types

Intel® Wireless MMX(TM) technology intrinsic functions use the data type __m64 for Intel® Wireless MMX(TM) technology registers and intrinsic function operands. The __m64 data type can hold eight 8-bit values, four 16-bit values, two 32-bit values, or one 64-bit value.


New Data Types Usage Guidelines

Since the new data type is not one of the basic ANSI C data types, you must observe the following usage restrictions:

  • The __m64 data type can be used only on either side of an assignment, as a return value, or as a parameter. You cannot use it with other arithmetic expressions ("+", "-", etc.).
  • The __m64 data type can be used as objects in aggregates (such as unions) to access the byte elements and structures.
  • The __m64 data type can be used only with the respective intrinsics described in this documentation. The new data type is supported on both sides of an assignment statement: as parameters to a function call, and as a return value from a function call.


Naming and Usage Syntax

Most of the Intel® Wireless MMX(TM) technology intrinsic names use a notational convention as follows:

_mm_intrin_suffix

intrin Indicates the intrinsics basic operation; for example, add for addition and sub for subtraction.

suffix Denotes the type of data operated on by the instruction. The first one or two letters of each suffix denotes whether the data is packed (p), or scalar (s).
The remaining letters denote the type:

    i64
    signed 64-bit integer
    u64
    unsigned 64-bit integer
    i32
    signed 32-bit integer
    u32
    unsigned 32-bit integer
    i16
    signed 16-bit integer
    u16
    unsigned 16-bit integer
    i8
    signed 8-bit integer
    u8
    unsigned 8-bit integer

A number appended to a variable name indicates the element of a packed object. For example, r0 is the lowest part of r. The packed values are represented in right-to-left order, with the lowest value being used for scalar operations.

Due to the nature of the instruction, some intrinsics require their arguments to be immediate values (integer literals). Some intrinsics are "composite" because they require more than one instruction to map.


Intrinsic Syntax

To use Intel® Wireless MMX(TM) technology intrinsics, the mmintrin.h file must be included. This file contains __m64 data type definitions and ANSI C prototypes for the Intel® Wireless MMX(TM) technology intrinsic functions.

The syntax of Intel® Wireless MMX(TM) technology intrinsic prototype is as follows:

Syntax
data_type intrinsic_name (parameters);

data_type Is the return data type, which is usually void, int, or __m64. Intrinsics may return other data types that are described in the intrinsic syntax definitions.

intrinsic_name Is the name of the intrinsic, which behaves like a function that you can use in your C/C++ code instead of inlining the actual instruction.

parameters Represents the parameters required by each intrinsic.


Intel® Wireless MMX(TM) Technology Arithmetic Intrinsics

Table: Overview of Intel® Wireless MMX(TM) Technology Arithmetic Intrinsics
Intrinsic Name | Intel® Wireless MMX™ Technology Instruction | Operation | Signed | Argument: |  | Result:
 |  |  |  | Number of values | Bits per value | Number of values | Bits per value
"_mm_add_pi8" | WADDB | Addition | -- | 8 | 8 | 8 | 8
"_mm_add_pi16" | WADDH | Addition | -- | 4 | 16 | 4 | 16
"_mm_add_pi32" | WADDW | Addition | -- | 2 | 32 | 2 | 32
"_mm_adds_pi8" | WADDBSS | Addition | Yes | 8 | 8 | 8 | 8
"_mm_adds_pi16" | WADDHSS | Addition | Yes | 4 | 16 | 4 | 16
"_mm_adds_pi32" | WADDWSS | Addition | Yes | 2 | 32 | 2 | 32
"_mm_adds_pu8" | WADDBUS | Addition | No | 8 | 8 | 8 | 8
"_mm_adds_pu16" | WADDHUS | Addition | No | 4 | 16 | 4 | 16
"_mm_adds_pu32" | WADDWUS | Addition | No | 2 | 32 | 2 | 32
"_mm_sub_pi8" | WSUBB | Subtraction | -- | 8 | 8 | 8 | 8
"_mm_sub_pi16" | WSUBH | Subtraction | -- | 4 | 16 | 4 | 16
"_mm_sub_pi32" | WSUBW | Subtraction | -- | 2 | 32 | 2 | 32
"_mm_subs_pi8" | WSUBBSS | Subtraction | Yes | 8 | 8 | 8 | 8
"_mm_subs_pi16" | WSUBHSS | Subtraction | Yes | 4 | 16 | 4 | 16
"_mm_subs_pi32" | WSUBWSS | Subtraction | Yes | 2 | 32 | 2 | 32
"_mm_subs_pu8" | WSUBBUS | Subtraction | No | 8 | 8 | 8 | 8
"_mm_subs_pu16" | WSUBHS | Subtraction | No | 4 | 16 | 4 | 16
"_mm_subs_pu32" | WSUBWUS | Subtraction | No | 2 | 32 | 2 | 32
"_mm_madd_pi16" | WMADDS | Multiplication | -- | 4 | 16 | 2 | 32
"_mm_madd_pu16" | WMADDU | Multiplication | No | 4 | 16 | 2 | 32
"_mm_mulhi_pi16" | WMULSH | Multiplication | Yes | 4 | 16 | 4 | 16
"_mm_mulhi_pu16" | WMULUH | Multiplication | Yes | 4 | 16 | 4 | 16
"_mm_mullo_pi16" | WMULSL WMULUL | Multiplication | -- | 4 | 16 | 4 | 16
"_mm_mulhi_pi32" | WMULWSM | Multiplication | Yes | 2 | 32 | 2 | 32
"_mm_mulhi_pu32" | WMULWSUM | Multiplication | No | 2 | 32 | 2 | 32
"_mm_mullo_pi32" | WMULWL | Multiplication | --- | 2 | 32 | 2 | 32
"_mm_mulhir_pi32" | WMULWSMR | Multiplication | Yes | 2 | 32 | 2 | 32
"_mm_mulhir_pu32" | WMULWUMR | Multiplication | No | 2 | 32 | 2 | 32
"_mm_qmulm_pi16" | WQMULM | Multiplication | --- | 4 | 16 | 4 | 16
"_mm_qmulmr_pi16" | WQMULMR | Multiplication | --- | 4 | 16 | 4 | 16
"_mm_qmulm_pi32" | WQMULWM | Multiplication | --- | 2 | 32 | 2 | 32
"_mm_qmulmr_pi32" | WQMULWMR | Multiplication | --- | 2 | 32 | 2 | 32
"_mm_acc_pu8" | WACCB | Accumulation | No | 8 | 8 | 1 | 8
"_mm_acc_pu16" | WACCH | Accumulation | No | 4 | 16 | 1 | 16
"_mm_acc_pu32" | WACCW | Accumulation | No | 2 | 32 | 1 | 32
"_mm_mac_pi16" | WMACS | Multiply- Accumulation | Yes | 4 | 16 | 4 | 16
"_mm_mac_pu16" | WMACU | Multiply- Accumulation | No | 4 | 16 | 4 | 16
"_mm_macz_pi16" | WMACSZ | Multiply- Accumulation | Yes | 4 | 16 | 4 | 16
"_mm_macz_pu16" | WMACUZ | Multiply- Accumulation | No | 4 | 16 | 4 | 16
"_mm_mia_si64" | TMIA | Multiply- Accumulation | Yes | 2 | 32 | 1 | 64
"_mm_miaph_si64" | TMIAPH | Multiply- Accumulation | Yes | 2 | 16 | 1 | 64
"_mm_miabb_si64" | TMIABB | Multiply- Accumulation | Yes | 2 | 16 | 1 | 64
"_mm_miabt_si64" | TMIABT | Multiply- Accumulation | Yes | 2 | 16 | 1 | 64
"_mm_miatb_si64" | TMIATB | Multiply- Accumulation | Yes | 2 | 16 | 1 | 64
"_mm_miatt_si64" | TMIATT | Multiply- Accumulation | Yes | 2 | 16 | 1 | 64
"_mm_wmiabb_si64" | WMIABB | Multiply- Accumulation | --- | 2 | 16 | 1 | 64
"_mm_wmiabt_si64" | WMIABT | Multiply- Accumulation | --- | 2 | 16 | 1 | 64
"_mm_wmiatb_si64" | WMIATB | Multiply- Accumulation | --- | 2 | 16 | 1 | 64
"_mm_wmiatt_si64" | WMIATT | Multiply- Accumulation | --- | 2 | 16 | 1 | 64
"_mm_wmiabbn_si64" | WMIABB | Multiply- Accumulation | --- | 2 | 16 | 1 | 64
"_mm_wmiabtn_si64" | WMIABTN | Multiply- Accumulation | --- | 2 | 16 | 1 | 64
"_mm_wmiatbn_si64" | WMIATBN | Multiply- Accumulation | --- | 2 | 16 | 1 | 64
"_mm_wmiattn_si64" | WMIATTN | Multiply- Accumulation | --- | 2 | 16 | 1 | 64
"_mm_wmiawbb_si64" | WMIAWBB | Multiply- Accumulation | --- | 1 | 32 | 1 | 64
"_mm_wmiawbt_si64" | WMIAWBT | Multiply- Accumulation | --- | 1 | 32 | 1 | 64
"_mm_wmiawtb_si64" | WMIAWTB | Multiply- Accumulation | --- | 1 | 32 | 1 | 64
"_mm_wmiawtt_si64" | WMIAWBTT | Multiply- Accumulation | --- | 1 | 32 | 1 | 64
"_mm_wmiawbbn_si64" | WMIAWBBN | Multiply- Accumulation | --- | 1 | 32 | 1 | 64
"_mm_wmiawbtn_si64" | WMIAWBTN | Multiply- Accumulation | --- | 1 | 32 | 1 | 64
"_mm_wmiawtbn_si64" | WMIAWTBN | Multiply- Accumulation | --- | 1 | 32 | 1 | 64
"_mm_wmiawttn_si64" | WMIAWBTTN | Multiply- Accumulation | --- | 1 | 32 | 1 | 64
"_mm_qmiabb_pi32" | WQMIABB | Multiply- Accumulation | --- | 2 | 16 | 2 | 32
"_mm_qmiabt_pi32" | WQMIABT | Multiply- Accumulation | --- | 2 | 16 | 2 | 32
"_mm_qmiatb_pi32" | WQMIATB | Multiply- Accumulation | --- | 2 | 16 | 2 | 32
"_mm_qmiatt_pi32" | WQMIATT | Multiply- Accumulation | --- | 2 | 16 | 2 | 32
"_mm_qmiabbn_pi32" | WQMIABBN | Multiply- Accumulation | --- | 2 | 16 | 2 | 32
"_mm_qmiabtn_pi32" | WQMIABTN | Multiply- Accumulation | --- | 2 | 16 | 2 | 32
"_mm_qmiatbn_pi32" | WQMIATBN | Multiply- Accumulation | --- | 2 | 16 | 2 | 32
"_mm_qmiattn_pi32" | WQMIATTN | Multiply- Accumulation | --- | 2 | 16 | 2 | 32
"_mm_abs_pi8" | WABSB | Absolute Value | Yes | 8 | 8 | 8 | 8
"_mm_abs_pi16" | WABSH | Absolute Value | Yes | 4 | 16 | 4 | 16
"_mm_abs_pi32" | WABSW | Absolute Value | Yes | 2 | 32 | 2 | 32
"_mm_absdiff_pu8" | WABSDIFFB | Subtract Absolute | No | 8 | 8 | 8 | 8
"_mm_absdiff_pu16" | WABSDIFFH | Subtract Absolute | No | 4 | 16 | 4 | 16
"_mm_absdiff_pu32" | WABSDIFFW | Subtract Absolute | No | 2 | 32 | 2 | 32
"_mm_addbhusm_pu8" | WASSBHUSM | Mixed-mode Addition | --- | 4 | 16, 8 | 4 | 8
"_mm_addbhusl_pu8" | WADDBHUSL | Mixed-mode Addition | --- | 4 | 16, 8 | 4 | 8
"_mm_addsubhx_pi16" | WADDSUBHX | Addition- Subtraction | Yes | 4 | 16 | 4 | 16
"_mm_avg4_pu8" | WAVG4 | Average | No | 8 | 8 | 1 | 64
"_mm_avg4r_pu8" | WAVG4 | Average | No | 8 | 8 | 1 | 64
"_mm_merge_si64" | WMERGE | Merge | --- | var | 8 | 1 | 64
"_mm_subaddhx_pi16" | WSUBADDHX | Subtraction- Addition | Yes | 4 | 16 | 4 | 16


Intel® Wireless MMX(TM) Technology Shift Intrinsics

Table: Overview of Intel® Wireless MMX(TM) Technology Shift Intrinsics
Intrinsic Name | Shift Direction | Shift Type | Intel® Wireless MMX(TM) Technology Instruction
"_mm_sra_pi16" | Right | Arithmetic | WSRAH
"_mm_srai_pi16" | Right | Arithmetic | Composite
"_mm_sra_pi32" | Right | Arithmetic | WSRAW
"_mm_srai_pi32" | Right | Arithmetic | Composite
"_mm_sra_si64" | Right | Arithmetic | WSRAD
"_mm_srai_si64" | Right | Arithmetic | Composite
"_mm_sll_pi16" | Left | Logical | WSLLH
"_mm_slli_pi16" | Left | Logical | Composite
"_mm_sll_pi32" | Left | Logical | WSLLW
"_mm_slli_pi32" | Left | Logical | Composite
"_mm_sll_si64" | Left | Logical | WSLLD
"_mm_slli_si64" | Left | Logical | Composite
"_mm_srl_pi16" | Right | Logical | WSRLH
"_mm_srli_pi16" | Right | Logical | Composite
"_mm_srl_pi32" | Right | Logical | WSRLW
"_mm_srli_pi32" | Right | Logical | Composite
"_mm_srl_si64" | Right | Logical | WSRLD
"_mm_srli_si64" | Right | Logical | Composite
"_mm_ror_pi16" | Rotate right | Logical | WRORH
"_mm_ror_pi32" | Rotate right | Logical | WRORW
"_mm_ror_si64" | Rotate right | Logical | WRORD
"_mm_rori_pi16" | Rotate right | Logical | Composite
"_mm_rori_pi32" | Rotate right | Logical | Composite
"_mm_rori_si64" | Rotate right | Logical | Composite


Intel® Wireless MMX(TM) Technology Logical Intrinsics

Table: Overview of Intel® Wireless MMX(TM) Technology Logical Intrinsics
Intrinsic Name | Operation | Intel® Wireless MMX(TM) Technology Instruction
"_mm_and_si64" | Bitwise AND | WAND
"_mm_andnot_si64" | Logical NOT | WANDN
"_mm_or_si64" | Bitwise OR | WOR
"_mm_xor_si64" | Bitwise Exclusive OR | WXOR


Intel® Wireless MMX™ Technology Compare Intrinsics

Table: Overview of Intel® Wireless MMX(TM) Technology Compare Intrinsics
Intrinsic Name | Comparison | Number of Elements | Element Bit Size | Intel® Wireless MMXI Technology Instruction
"_mm_cmpeq_pi8" | equal | 8 | 8 | WCMPEQB
"_mm_cmpeq_pi16" | equal | 4 | 16 | WCMPEQH
"_mm_cmpeq_pi32" | equal | 2 | 32 | WCMPEQW
"_mm_cmpgt_pi8" | signed greater than | 8 | 8 | WCMPGTSB
"_mm_cmpgt_pu8" | unsigned greater than | 8 | 8 | WCMPGTUB
"_mm_cmpgt_pi16" | signed greater than | 4 | 16 | WCMPGTSH
"_mm_cmpgt_pu16" | unsigned greater than | 4 | 16 | WCMPGTUH
"_mm_cmpgt_pi32" | signed greater than | 2 | 32 | WCMPGTSW
"_mm_cmpgt_pu32" | unsigned greater than | 2 | 32 | WCMPGTUW


Intel® Wireless MMX™ Technology PACK/UNPACK Intrinsics

Table: Overview of Intel® Wireless MMX(TM) Technology PACK/UNPACK Intrinsics
Intrinsic Name | Intel® Wireless MMX(TM) Technology Instruction | Operation | Signed | Saturation
"_mm_unpackhi_pi8" | WUNPCKIHB | Interleave | -- | --
"_mm_unpackhi_pi16" | WUNPCKIHH | Interleave | -- | --
"_mm_unpackhi_pi32" | WUNPCKIHW | Interleave | -- | --
"_mm_unpacklo_pi8" | WUNPCKILB | Interleave | -- | --
"_mm_unpacklo_pi16" | WUNPCKILH | Interleave | -- | --
"_mm_unpacklo_pi32" | WUNPCKILW | Interleave | -- | --
"_mm_packs_pi16" | WPACKHSS | Pack | Yes | Yes
"_mm_packs_pi32" | WPACKWSS | Pack | Yes | Yes
"_mm_packs_pu16" | WPACKHUS | Pack | No | Yes
"_mm_packs_si64" | WPACKDSS | Pack | Yes | Yes
"_mm_packs_su64" | WPACKDUS | Pack | No | Yes
"_mm_packs_pu32" | WPACKWUS | Pack | No | Yes
"_mm_unpackeh_pi8" | WUNPCKEHSB | Sign-extended | Yes | No
"_mm_unpackeh_pi16" | WUNPCKEHSH | Sign-extended | Yes | No
"_mm_unpackeh_pi32" | WUNPCKEHSW | Sign-extended | Yes | No
"_mm_unpackel_pi8" | WUNPCKELSB | Sign-extended | Yes | No
"_mm_unpackel_pi16" | WUNPCKELSH | Sign-extended | Yes | No
"_mm_unpackel_pi32" | WUNPCKELSW | Sign-extended | Yes | No
"_mm_unpackeh_pu8" | WUNPCKEHUB | Zero-extended | No | No
"_mm_unpackeh_pu16" | WUNPCKEHUH | Zero-extended | No | No
"_mm_unpackeh_pu32" | WUNPCKEHUW | Zero-extended | No | No
"_mm_unpackel_pu8" | WUNPCKELUB | Zero-extended | No | No
"_mm_unpackel_pu16" | WUNPCKELUH | Zero-extended | No | No
"_mm_unpackel_pu32" | WUNPCKELUW | Zero-extended | No | No


Intel® Wireless MMX(TM) technology Set Intrinsics

Table: Overview of Intel® Wireless MMX(TM) Technology Set Intrinsics
Intrinsic Name | Operation | Number of Elements | Instruction | Element Bit Size | Signed | Reverse Order
"_mm_setzero_si64" | Set to zero | 1 | WZERO | 64 | No | No
"_mm_set_pi32" | Set integer values | 2 | Composite | 32 | No | No
"_mm_set_pi16" | Set integer values | 4 | Composite | 16 | No | No
"_mm_set_pi8" | Set integer values | 8 | Composite | 8 | No | No
"_mm_set1_pi32" | Set integer values | 2 | TBCSTW | 32 | Yes | No
"_mm_set1_pi16" | Set integer values | 4 | TBCSTH | 16 | Yes | No
"_mm_set1_pi8" | Set integer values | 8 | TBCSTB | 8 | Yes | No
"_mm_setr_pi32" | Set integer values | 2 | Composite | 32 | No | Yes
"_mm_setr_pi16" | Set integer values | 4 | Composite | 16 | No | Yes
"_mm_setr_pi8" | Set integer values | 8 | Composite | 8 | No | Yes
"_mm_setwcx" | Set control register | -- | TMCR | -- | -- | --
"_mm_getwcx" | Get control register | -- | TMRC | -- | -- | --

Note icon NOTE.
In the following descriptions regarding the order of bits of the Intel® Wireless MMX(TM) technology registers, bit 0 is the least significant one and bit 63 is the most significant one.


Intel® Wireless MMX(TM) Technology General Support Intrinsics

Table: Intel® Wireless MMX(TM) Technology General Support Intrinsics
Intrinsic Name | Operation | Intel® Wireless MMX(TM) Technology Instruction | Sign
"_mm_extract_pi8" | Extract one of eight bytes | TEXTRMSB | Yes
"_mm_extract_pi16" | Extract one of four halfwords | TEXTRMSH | Yes
"_mm_extract_pi32" | Extract one of two words | TEXTRMSW | Yes
"_mm_extract_pu8" | Extract one of eight bytes | TEXTRMUB | No
"_mm_extract_pu16" | Extract one of four half words | TEXTRMUH | No
"_mm_extract_pu32" | Extract one of two words | TEXTRMUW | No
"_mm_insert_pi8" | Insert a byte | TINSRB | --
"_mm_insert_pi16" | Insert a halfword | TINSRH | --
"_mm_insert_pi32" | Insert a word | TINSRW | --
"_mm_max_pi8" | Compute the maximum | WMAXSB |
"_mm_max_pi16" | Compute the maximum | WMAXSH |
"_mm_max_pi32" | Compute the maximum | WMAXSW |
"_mm_max_pu8" | Compute the maximum, unsigned | WMAXUB |
"_mm_max_pu16" | Compute the maximum, unsigned | WMAXUH |
"_mm_max_pu32" | Compute the maximum, unsigned | WMAXUW |
"_mm_min_pi8" | Compute the minimum | WMINSB |
"_mm_min_pi16" | Compute the minimum | WMINSH |
"_mm_min_pi32" | Compute the minimum | WMINSW |
"_mm_min_pu8" | Compute the minimum, unsigned | WMINUB |
"_mm_min_pu16" | Compute the minimum, unsigned | WMINUH |
"_mm_min_pu32" | Compute the minimum, unsigned | WMINUW |
"_mm_movemask_pi8" | Create an 8-bit mask | TMOVMSKB |
"_mm_movemask_pi16" | Create a four halfword mask | TMOVMSKH |
"_mm_movemask_pi32" | Create a two-word mask | TMOVMSKW |
"_mm_shuffle_pi16" | Return a combination of four words | WSHUFH |
"_mm_avg_pu8" | Compute rounded average | WAVG2BR |
"_mm_avg_pu16" | Compute rounded average | WAVG2HR |
"_mm_avg2_pu8" | Compute rounded average without rounding +1 | WAVG2B |
"_mm_avg2_pu16" | Compute rounded average without rounding +1 | WAVG2H |
"_mm_sad_pu8" | Compute sum of absolute differences | WSADBZ |
"_mm_sad_pu16" | Compute sum of absolute differences | WSADHZ |
"_mm_sada_pu8" | Accumulate sum of absolute differences | WSADB |
"_mm_sada_pu16" | Accumulate sum of absolute differences | WSADH |
"__mm_align_si64" | Extract a 64-bit value | WALIGNI/WALIGNR | --
"_mm_cvtsi64_m64" | Transfer | TMCRR | --
"_mm_cvtm64_si64" | Transfer | TMRRC | --
"_mm_cvtsi32_si64" | Convert from integer | TMCRR | --
"_mm_cvtsi64_si32" | Convert to integer | TMRRC | --


__mm_align_si64
Syntax
__m64 __mm_align_si64(__m64 m1, __m64 m2, int count)
Description

Extracts a 64-bit value from the two 64-bit input values m1, m2 with count byte offset.

If r = __mm_align_si64(m1, m2, count), the action is

r = Low_DB_word((m1, m2) >> (count * 8));

Note icon NOTE.
The parameter count has to be a numeric value or expression that can be evaluated at compile-time; it cannot be a variable.


_mm_abs_pi8
Syntax
__m64 _mm_abs_pi8 (__m64 m1)
Description

Changes the eight 8-bit values in m1 to their absolute values and returns the result.

This function uses the assembler instruction WABSB.

See Also

Intel® Assembler Reference Manual


_mm_abs_pi16
Syntax
__m64 _mm_abs_pi16 (__m64 m1)
Description

Changes the four 16-bit values in m1 to their absolute values and returns the result.

This function uses the assembler instruction WABSH.

See Also

Intel® Assembler Reference Manual


_mm_abs_pi32
Syntax
__m64 _mm_abs_pi32 (__m64 m1)
Description

Changes the two 32-bit values in m1 to their absolute values and returns the result.

This function uses the assembler instruction WABSW.

See Also

Intel® Assembler Reference Manual


_mm_absdiff_pu8
Syntax
__m64 _mm_absdiff_pu8 (__m64 a, __m64 b)
Description

Subtracts the unsigned eight 8-bit values of a from their counterparts in b and returns the absolute values of the results.

This function uses the assembler instruction WABSDIFFB.

See Also

Intel® Assembler Reference Manual


_mm_absdiff_pu16
Syntax
__m64 _mm_absdiff_pu16 (__m64 a, __m64 b)
Description

Subtracts the four unsigned 16-bit values of a from their counterparts in b and returns the absolute values of the results.

This function uses the assembler instruction WABSDIFFH.

See Also

Intel® Assembler Reference Manual


_mm_absdiff_pu32
Syntax
__m64 _mm_absdiff_pu32 (__m64 a, __m64 b)
Description

Subtracts the two unsigned 32-bit values of a from their counterparts in b and returns the absolute values of the results.

This function uses the assembler instruction WABSDIFFW.

See Also

Intel® Assembler Reference Manual


_mm_acc_pu8
Syntax
__m64 _mm_acc_pu8 (__m64 m1)
Description

Unsigned accumulate across eight 8-bit values in m1.


_mm_acc_pu16
Syntax
__m64 _mm_acc_pu16 (__m64 m1)
Description

Unsigned accumulate across four 16-bit values in m1.


_mm_acc_pu32
Syntax
__m64 _mm_acc_pu32 (__m64 m1)
Description

Unsigned accumulate across two 32-bit values in m1.


_mm_add_pi8
Syntax
__m64 _mm_add_pi8 (__m64 m1, __m64 m2)
Description

Adds the eight 8-bit values in m1 to the eight 8-bit values in m2.


_mm_add_pi16
Syntax
__m64 _mm_add_pi16 (__m64 m1, __m64 m2)
Description

Adds the four 16-bit values in m1 to the four 16-bit values in m2.


_mm_add_pi32
Syntax
__m64 _mm_add_pi32 (__m64 m1, __m64 m2)
Description

Adds the two 32-bit values in m1 to the two 32-bit values in m2.


_mm_addbhusl_pu8
Syntax
__m64 _mm_addbhusl_pu8 (__m64 a, __m64 b)
Description

Performs a vector mixed mode addition of four 16-bit values of parameter a and four 8-bit zero-extended values from the lower half of parameter b and returns the result in the lower half of the return value.

This function uses the assembler instruction WADDBHUSL.

See Also

Intel® Assembler Reference Manual


_mm_addbhusm_pu8
Syntax
__m64 _mm_addbhusm_pu8 (__m64 a, __m64 b)
Description

Performs a vector mixed mode addition of four 16-bit values of parameter a and four 8-bit zero-extended values from the upper half of parameter b and returns the result in the upper half of the return value.

This function uses the assembler instruction WADDBHUSM.

See Also

Intel® Assembler Reference Manual


_mm_adds_pi8
Syntax
__m64 _mm_adds_pi8 (__m64 m1, __m64 m2)
Description

Adds the eight signed 8-bit values in m1 to the eight signed 8-bit values in m2 using saturating arithmetic.


_mm_adds_pi16
Syntax
__m64 _mm_adds_pi16 (__m64 m1, __m64 m2)
Description

Adds the four signed 16-bit values in m1 to the four signed 16-bit values in m2 using saturating arithmetic.


_mm_adds_pi32
Syntax
__m64 _mm_adds_pi32 (__m64 m1, __m64 m2)
Description

Adds the two signed 32-bit values in m1 to the two signed 32-bit values in m2 using saturating arithmetic.


_mm_adds_pu8
Syntax
__m64 _mm_adds_pu8 (__m64 m1, __m64 m2)
Description

Adds the eight unsigned 8-bit values in m1 to the eight unsigned 8-bit values in m2 using saturating arithmetic.


_mm_adds_pu16
Syntax
__m64 _mm_adds_pu16 (__m64 m1, __m64 m2)
Description

Adds the four unsigned 16-bit values in m1 to the four unsigned 16-bit values in m2 using saturating arithmetic.


_mm_adds_pu32
Syntax
__m64 _mm_adds_pu32 (__m64 m1, __m64 m2)
Description

Two unsigned 32-bit values in m1 to the two unsigned 16-bit values in m2 using saturating arithmetic.


_mm_addsubhx_pi16
Syntax
__m64 _mm_addsubhx_pi16 (__m64 a, __m64 b)
Description

Performs complex vector addition/subtraction of its parameters a and b for vectors of 16-bit data. The four operands from each of the parameters are alternately added and subtracted using a cross selection in each of the parallel operations. The result of the operation is saturated to the signed limits and returned.

This function uses the assembler instruction WADDSUBHX.

See Also

Intel® Assembler Reference Manual


_mm_and_si64
Syntax
__m64 _mm_and_si64 (__m64 m1, __m64 m2)
Description

Performs a bitwise AND of the 64-bit value in m1 with the 64-bit value in m2.


_mm_andnot_si64
Syntax
__m64 _mm_andnot_si64 (__m64 m1, __m64 m2)
Description

Performs a logical NOT on the 64-bit value in m1 and use the result in a bitwise AND with the 64-bit value in m2.


_mm_avg_pu8
Syntax
__m64 _mm_avg_pu8(__m64 a, __m64 b)
Description

Computes the (rounded) averages of the unsigned bytes in a and b.

If r = _mm_avg_pu8(a, b), the action is

t = (unsigned short)a0 + (unsigned short)b0;
r0 = (t >> 1) | (t & 0x01);
...
t = (unsigned short)a7 + (unsigned short)b7;
r7 = (unsigned char)((t >> 1) | (t & 0x01));


_mm_avg_pu16
Syntax
__m64 _mm_avg_pu16(__m64 a, __m64 b)
Description

Computes the (rounded) averages of the unsigned words in a and b.

If r = _mm_avg_pu16(a, b), the action is

t = (unsigned int)a0 + (unsigned int)b0;
r0 = (t >> 1) | (t & 0x01);
...
t = (unsigned word)a7 + (unsigned word)b7;
r7 = (unsigned short)((t >> 1) | (t & 0x01));


_mm_avg2_pu8
Syntax
__m64 _mm_avg2_pu8(__m64 a, __m64 b)
Description

Computes the without rounded averages of the unsigned bytes in a and b.

If r = _mm_avg2_pu8(a, b), the action is

t = (unsigned byte)a0 + (unsigned byte)b0;
r0 = (t >> 1);
...
t = (unsigned byte)a7 + (unsigned byte)b7;
r7 = (unsigned char)(t >> 1);


_mm_avg2_pu16
Syntax
__m64 _mm_avg2_pu16(__m64 a, __m64 b)
Description

Computes the with out rounded averages of the unsigned words in a and b.

If r = _mm_avg2_pu16(a, b), the action is

t = (unsigned half word)a0 + (unsigned half word)b0;
r0 = (t >> 1);
...
t = (unsigned half word)a3 + (unsigned half word)b3;
r3 = (unsigned short)(t >> 1);


_mm_avg4_pu8
Syntax
__m64 _mm_avg4_pu8 (__m64 a, __m64 b)
Description

Performs seven 4-pixel averages of unsigned 8-bit operands obtained from the bytes of the parameters a and b, and returns the result.

This function uses the assembler instruction WAVG4.

See Also

Intel® Assembler Reference Manual


_mm_avg4r_pu8
Syntax
__m64 _mm_avg4r_pu8 (__m64 a, __m64 b)
Description

Performs seven 4-pixel averages of unsigned 8-bit operands obtained from the bytes of the parameters a and b, and returns the result. Biased rounding is performed by adding +2 or +1 to the intermediate result before the divide-by-2.

This function uses the assembler instruction WAVG4R.

See Also

Intel® Assembler Reference Manual


_mm_cmpeq_pi8

Syntax
__m64 _mm_cmpeq_pi8 (__m64 m1, __m64 m2)
Description

If the respective 8-bit values in m1 are equal to the respective 8-bit values in m2, the function sets the respective 8-bit resulting values to all ones, otherwise it sets them to all zeros.


_mm_cmpeq_pi16
Syntax
__m64 _mm_cmpeq_pi16 (__m64 m1, __m64 m2)
Description

If the respective 16-bit values in m1 are equal to the respective 16-bit values in m2, the function sets the respective 16-bit resulting values to all ones, otherwise it sets them to all zeros.


_mm_cmpeq_pi32
Syntax
__m64 _mm_cmpeq_pi32 (__m64 m1, __m64 m2)
Description

If the respective 32-bit values in m1 are equal to the respective 32-bit values in m2, the function sets the respective 32-bit resulting values to all ones, otherwise it sets them to all zeros.


_mm_cmpgt_pi8
Syntax
__m64 _mm_cmpgt_pi8 (__m64 m1, __m64 m2)
Description

If the respective 8-bit values in m1 are greater than the respective 8-bit values in m2, the function sets the respective 8-bit resulting values to all ones, otherwise it sets them to all zeros.


_mm_cmpgt_pi16
Syntax
__m64 _mm_cmpgt_pi16 (__m64 m1, __m64 m2)
Description

If the respective 16-bit values in m1 are greater than the respective 16-bit values in m2, the function sets the respective 16-bit resulting values to all ones, otherwise it sets them to all zeros.


_mm_cmpgt_pi32
Syntax
__m64 _mm_cmpgt_pi32 (__m64 m1, __m64 m2)
Description

If the respective 32-bit values in m1 are greater than the respective 32-bit values in m2, the function sets the respective 32-bit resulting values to all ones, otherwise it sets them all to zeros.


_mm_cmpgt_pu8
Syntax
__m64 _mm_cmpgt_pu8 (__m64 m1, __m64 m2)
Description

If the respective 8-bit values in m1 are unsigned greater than the respective 8-bit values in m2, the function sets the respective 8-bit resulting values to all ones, otherwise it sets them to all zeros.


_mm_cmpgt_pu16
Syntax
__m64 _mm_cmpgt_pu16 (__m64 m1, __m64 m2)
Description

If the respective 16-bit values in m1 are unsigned greater than the respective 16-bit values in m2, the function sets the respective 16-bit resulting values to all ones, otherwise it sets them to all zeros.


_mm_cmpgt_pu32
Syntax
__m64 _mm_cmpgt_pu32 (__m64 m1, __m64 m2)
Description

If the respective 32-bit values in m1 are unsigned greater than the respective 32-bit values in m2, the function sets the respective 32-bit resulting values to all ones, otherwise it sets them all to zeros.


_mm_cvtm64_si64
Syntax
__int64 _mm_cvtm64_si64 (__m64 m)
Description

Converts the 64-bit __m64 object m to __int64 bit integer.

If r = _mm_cvtm64_si64(a), then the action is

r0 = a[31:0]; (lower word)
r1 = a[63:32]; (upper word)


_mm_cvtsi32_si64
Syntax
__m64 _mm_cvtsi32_si64 (int i)
Description

Converts the integer object i to a 64-bit __m64 object. The integer value is zero-extended to 64 bits.

If r = _mm_cvtsi32_si64(i), then the action is

r [0:31] = i;
r[32:63] = 0;


_mm_cvtsi64_m64
Syntax
__m64 _mm_cvtsi64_m64 (__int64 i)
Description

Converts the __int64 integer i to a 64-bit __m64 object.

If r = _mm_cvtsi64_m64(a), then the action is

r [31:0] = a0; (lower word)
r[63:32] = a1; (upper word)


_mm_cvtsi64_si32
Syntax
int _mm_cvtsi64_si32 (__m64 m)
Description

Converts the lower 32 bits of the __m64 object m to an integer.

If i = _mm_cvtsi64_si32(m), then the action is

i = a[31:0]; (lower word)


_mm_extract_pi8
Syntax
int _mm_extract_pi8(__m64 a, const int n)
Description

Extracts one of the eight bytes of a. The selector n must be an immediate. The n variable selects the byte that should be extracted.

If r = _mm_extract_pi8(a, n), the action is

r[7:0] = a[Byte n[2:0]];
r[31:8] = SignReplicate(a[Byte n[2:0]], 24);


_mm_extract_pi16
Syntax
int _mm_extract_pi16(__m64 a, const int n)
Description

Extracts one of the four half words of a. The selector n must be an immediate.

If r = _mm_extract_pi16(a, n), the action is

r[15:0] = a[Halfword n[1:0]];
r[31:16] = SignReplicate(a[Byte n[1:0]], 16);


_mm_extract_pi32
Syntax
int _mm_extract_pi32(__m64 a, const int n)
Description

Extracts one of the two words of a. The selector n must be an immediate.

If r = _mm_extract_pi32(a, n), the action is

r[31:0] = a[Byte n[0]];


_mm_extract_pu8
Syntax
int _mm_extract_pu8(__m64 a, const int n)
Description

Extracts one of the eight bytes of a. The selector n must be an immediate.

If r = _mm_extract_pu8(a, n), the action is

r[7:0] = a[Byte n[2:0]];
r[31:8] = 0;


_mm_extract_pu16
Syntax
int _mm_extract_pu16(__m64 a, const int n)
Description

Extracts one of the four half words of a. The selector n must be an immediate.

If r = _mm_extract_pu16(a, n), the action is

r [15:0] = a[Halfword n[1:0]];
r[31:16] = 0;


_mm_extract_pu32
Syntax
int _mm_extract_pu32(__m64 a, const int n)
Description

This provides same functionality as _mm_extract_pi32.


_mm_getwcx
Syntax
int __mm_getwcx(int number)
Description

Returns contents of Intel® Wireless MMX(TM) technology control register, which is specified with number. Where number is the coprocessor register number.


_mm_insert_pi8
Syntax
__m64 _mm_insert_pi8(__m64 a, int d, int n)
Description

Inserts byte d into one of eight bytes of a. The selector n must be an immediate.

If r = _mm_insert_pi8(a, d, n), the action is

r0 = (n==0) ? d[7:0] : a0;
r1 = (n==1) ? d[7:0] : a1;
r2 = (n==2) ? d[7:0] : a2;
r3 = (n==3) ? d[7:0] : a3;
r4 = (n==4) ? d[7:0] : a4;
r5 = (n==5) ? d[7:0] : a5;
r6 = (n==6) ? d[7:0] : a6;
r7 = (n==7) ? d[7:0] : a7;


_mm_insert_pi16
Syntax
__m64 _mm_insert_pi16(__m64 a, int d, int n)
Description

Inserts half word d into one of four half words of a. The selector n must be an immediate.

If r = _mm_insert_pi16(a, d, n), the action is

r0 = (n==0) ? d[15:0] : a0;
r1 = (n==1) ? d[15:0] : a1;
r2 = (n==2) ? d[15:0] : a2;
r3 = (n==3) ? d[15:0] : a3;


_mm_insert_pi32
Syntax
__m64 _mm_insert_pi32(__m64 a, int d, int n)
Description

Inserts word d into one of two half words of a. The selector n must be an immediate.

If r = _mm_insert_pi32(a, d, n), the action is

r0 = (n==0) ? d[31:0] : a0;
r1 = (n==1) ? d[31:0] : a1;


_mm_mac_pi16
Syntax
__m64 _mm_mac_pi16 (__m64 m1, __m64 m2, __m64 m3)
Description

Multiplies four signed 16-bit values in signed m2 by four 16-bit values in m3 and accumulates result with value in m1.


_mm_mac_pu16
Syntax
__m64 _mm_mac_pu16 (__m64 m1, __m64 m2, __m64 m3)
Description

Multiplies four unsigned 16-bit values in unsigned m2 by four 16-bit values in m3 and accumulates result with value in m1.


_mm_macz_pi16
Syntax
__m64 _mm_macz_pi16 (__m64 m1, __m64 m2)
Description

Multiplies four signed 16-bit values in signed m1 by four 16-bit values in m2 and accumulates zero.


_mm_macz_pu16
Syntax
__m64 _mm_macz_pu16 (__m64 m1, __m64 m2)
Description

Multiplies four unsigned 16-bit values in unsigned m1 by four 16-bit values in m2 and accumulates result with zero.


_mm_madd_pi16
Syntax
__m64 _mm_madd_pi16 (__m64 m1, __m64 m2)
Description

Multiplies four 16-bit values in m1 by four 16-bit values in m2 producing four 32-bit intermediate results, which are then summed up: The sum of the lower two products yield the lower word and the sum of the upper two products yield the upper word of the result.


_mm_madd_pu16
Syntax
__m64 _mm_madd_pu16 (__m64 m1, __m64 m2)
Description

Multiplies four unsigned 16-bit values in m1 by four unsigned 16-bit values in m2 producing four 32-bit intermediate results, which are then summed the lower products into the bottom word and the upper two products into the upper word of result.


_mm_max_pi8
Syntax
__m64 _mm_max_pi8(__m64 a, __m64 b)
Description

Computes the element-wise maximum of the bytes in a and b.

If r = _mm_max_pi8(a, b), the action is

r0 = max(a0, b0);
r1 = max(a1, b1);
...
r7 = max(a7, b7);


_mm_max_pi16
Syntax
__m64 _mm_max_pi16(__m64 a, __m64 b)
Description

Computes the element-wise maximum of the half words in a and b.

If r = _mm_max_pi16(a, b), the action is

r0 = max(a0, b0);
r1 = max(a1, b1);
r2 = max(a2, b2);
r3 = max(a3, b3);


_mm_max_pi32
Syntax
__m64 _mm_max_pi32(__m64 a, __m64 b)
Description

Computes the element-wise maximum of the words in a and b.

If r = _mm_max_pi32(a, b), the action is

r0 = max(a0, b0);
r1 = max(a1, b1);


_mm_max_pu8
Syntax
__m64 _mm_max_pu8(__m64 a, __m64 b)
Description

Computes the element-wise maximum of the unsigned bytes in a and b.

If r = _mm_max_pu8(a, b), the action is

r0 = max(a0, b0);
r1 = max(a1, b1);
...
r7 = max(a7, b7);


_mm_max_pu16
Syntax
__m64 _mm_max_pu16(__m64 a, __m64 b)
Description

Computes the element-wise maximum of the unsigned half words in a and b.

If r = _mm_max_pu16(a, b), the action is

r0 = max(a0, b0);
r1 = max(a1, b1);
r2 = max(a2, b2);
r3 = max(a3, b3);


_mm_max_pu32
Syntax
__m64 _mm_max_pu32(__m64 a, __m64 b)
Description

Computes the element-wise maximum of the unsigned words in a and b.

If r = _mm_max_pu32(a, b), the action is

r0 = max(a0, b0);
r1 = max(a1, b1);


_mm_merge_si64
Syntax
__m64 _mm_merge_si64 (__m64 a, __m64 b, const int n)
Description

Extracts a 64-bit value that contains elements from the parameters a and b, and returns a merged 64-bit result. The number of elements, in bytes, to be taken from b is represented by the constant parameter n.

This function uses the assembler instruction WMERGE.

See Also

Intel® Assembler Reference Manual


_mm_mia_si64
Syntax
__m64 _mm_mia_si64 (__m64 m1, int a, int b)
Description

Multiplies two signed 32-bit values in a & b and accumulates the result with 64-bit value in m1.


_mm_miabb_si64
Syntax
__m64 _mm_miabb_si64(__m64 m1, int a, int b)

Multiplies bottom half of signed 16-bit values in a and bottom half of signed 16-bit value in b and accumulates the result with 64-bit values in m1.

Result = sign_extend(a[15:0] * b[15:0]) + m1;


_mm_miabt_si64
Syntax
__m64 _mm_miabt_si64(__m64 m1, int a, int b)
Description

Multiplies bottom half of signed 16-bit values in a and top half of signed 16-bit value in b and accumulates the result with 64-bit values in m1.

Result = sign_extend(a[15:0] * b[31:16]) + m1;


_mm_miaph_si64
Syntax
__m64 _mm_miaph_si64 (__m64 m1, int a, int b)
Description

Multiplies accumulate signed 16-bit values in a & b and accumulates the result with 64-bit values in m1.

Result = sign_extend((a[31:16] * b[31:16]) + (a[15:0] * b[15:0])) + m1;


_mm_miatb_si64
Syntax
__m64 _mm_miatb_si64(__m64 m1, int a, int b)
Description

Multiplies top half of signed 16-bit values in a and bottom half of signed 16-bit value in b and accumulates the result with 64-bit values in m1.

Result = sign_extend(a[31:16] * b[15:0]) + m1;


_mm_miatt_si64
Syntax
__m64 _mm_miatt_si64(__m64 m1, int a, int b)
Description

Multiplies top half of signed 16-bit values in a and top half of signed 16-bit value in b and accumulates the result with 64-bit values in m1.

Result = sign_extend(a[31:16] * b[31:16]) + m1;


_mm_min_pi8
Syntax
__m64 _mm_min_pi8(__m64 a, __m64 b)
Description

Computes the element-wise minimum of the bytes in a and b.

If r = _mm_min_pi8(a, b), the action is

r0 = min(a0, b0);
r1 = min(a1, b1);
...
r7 = min(a7, b7);


_mm_min_pi16
Syntax
__m64 _mm_min_pi16(__m64 a, __m64 b)
Description

Computes the element-wise minimum of the half words in a and b.

If r = _mm_min_pi16(a, b), the action is

r0 = min(a0, b0);
r1 = min(a1, b1);
r2 = min(a2, b2);
r3 = min(a3, b3);


_mm_min_pi32
Syntax
__m64 _mm_min_pi32(__m64 a, __m64 b)
Description

Computes the element-wise minimum of the words in a and b.

If r = _mm_min_pi32(a, b), the action is

r0 = min(a0, b0);
r1 = min(a1, b1);


_mm_min_pu8
Syntax
__m64 _mm_min_pu8(__m64 a, __m64 b)
Description

Computes the element-wise minimum of the unsigned bytes in a and b.

If r = _mm_min_pu8(a, b), the action is

r0 = min(a0, b0);
r1 = min(a1, b1);
...
r7 = min(a7, b7);


_mm_min_pu16
Syntax
__m64 _mm_min_pu16(__m64 a, __m64 b)
Description

Computes the element-wise minimum of the unsigned half words in a and b.

If r = _mm_min_pu16(a, b), the action is

r0 = min(a0, b0);
r1 = min(a1, b1);
r2 = min(a2, b2);
r3 = min(a3, b3);


_mm_min_pu32
Syntax
__m64 _mm_min_pu32(__m64 a, __m64 b)
Description

Computes the element-wise minimum of the unsigned words in a and b.

If r = _mm_min_pu32(a, b), the action is

r0 = min(a0, b0);
r1 = min(a1, b1);


_mm_movemask_pi8
Syntax
int _mm_movemask_pi8(__m64 a)
Description

Creates an 8-bit mask from the most significant bits of the bytes in a.

If r = _mm_movemask_pi8(a), the action is

r = 0;
r = sign(a7)<<7 | sign(a6)<<6 |... | sign(a0);


_mm_movemask_pi16
Syntax
int _mm_movemask_pi16(__m64 a)
Description

Creates a 4-bit mask from the most significant bits of the half words in a.

If r = _mm_movemask_pi16(a), the action is

r = 0;
r = sign(a3)<<3 | sign(a2)<<2 |... | sign(a0);


_mm_movemask_pi32
Syntax
int _mm_movemask_pi32(__m64 a)
Description

Creates a 2-bit mask from the most significant bits of the bytes in a.

If r = _mm_movemask_pi32(a), the action is

r = 0;
r = sign(a1)<<1 | sign(a0);


_mm_mulhi_pi16
Syntax
__m64 _mm_mulhi_pi16(__m64 a, __m64 b)
Description

Multiplies four signed 16-bit values in m1 by four unsigned 16-bit values in m2 and produces the upper 16 bits of the four results.

If r = _mm_mulhi_pi16(a, b), the action is

r0 = hiword(a0 * b0);
r1 = hiword(a1 * b1);
r2 = hiword(a2 * b2);
r3 = hiword(a3 * b3);


_mm_mulhi_pi32
Syntax
__m64 _mm_mulhi_pi32 (__m64 a, __m64 b)
Description

Performs a signed vector multiplication on the 32-bit words of parameters a and b, to produce 64-bit intermediate results. Only the higher 32 bits of the results are returned.

This function uses the assembler instruction WMULWSM.

See Also

Intel® Assembler Reference Manual


_mm_mulhi_pu16
Syntax
__m64 _mm_mulhi_pu16(__m64 a, __m64 b)
Description

Multiplies four unsigned 16-bit values in m1 by four unsigned 16-bit values in m2 and produces the upper 16 bits of the four results.

If r = _mm_mulhi_pu16(a, b), the action is

r0 = hiword(a0 * b0);
r1 = hiword(a1 * b1);
r2 = hiword(a2 * b2);
r3 = hiword(a3 * b3);


_mm_mulhi_pu32
Syntax
__m64 _mm_mulhi_pu32 (__m64 a, __m64 b)
Description

Performs an unsigned vector multiplication on the 32-bit words of parameters a and b, to produce 64-bit intermediate results. Only the higher 32 bits of the results are returned.

This function uses the assembler instruction WMULWUM.

See Also

Intel® Assembler Reference Manual


_mm_mulhir_pi32
Syntax
__m64 _mm_mulhir_pi32 (__m64 a, __m64 b)
Description

Performs a signed vector multiplication on the 32-bit words of parameters a and b, to produce 64-bit intermediate results. Then the function rounds the least significant 32 bits into the most significant 32 bits. Only the higher 32 bits of the results are returned.

This function uses the assembler instruction WMULWSMR.

See Also

Intel® Assembler Reference Manual


_mm_mulhir_pu32
Syntax
__m64 _mm_mulhir_pu32 (__m64 a, __m64 b)
Description

Performs an unsigned vector multiplication on the 32-bit words of parameters a and b, to produce 64-bit intermediate results. Then the function rounds the least significant 32 bits into the most significant 32 bits. Only the higher 32 bits of the results are returned.

This function uses the assembler instruction WMULWUMR.

See Also

Intel® Assembler Reference Manual


_mm_mullo_pi16
Syntax
__m64 _mm_mullo_pi16 (__m64 m1, __m64 m2)
Description

Multiplies four 16-bit values in m1 by four 16-bit values in m2 and produces the lower 16 bits of the four results.

If r = _mm_mullo_pu16(a, b), the action is

r0 = lowword(a0 * b0);
r1 = lowword(a1 * b1);
r2 = lowword(a2 * b2);
r3 = lowword(a3 * b3);


_mm_mullo_pi32
Syntax
__m64 _mm_mullo_pi32 (__m64 a, __m64 b)
Description

Performs a vector multiplication on the 32-bit words of parameters a and b, to produce 64-bit intermediate results. Only the lower 32 bits of the results are returned.

This function uses the assembler instruction WMULWL.

See Also

Intel® Assembler Reference Manual


_mm_or_si64
Syntax
__m64 _mm_or_si64 (__m64 m1, __m64 m2)
Description

Performs a bitwise OR of the 64-bit value in m1 with the 64-bit value in m2.


_mm_packs_pi16
Syntax
__m64 _mm_packs_pi16 (__m64 m1, __m64 m2)
Description

Packs the four 16-bit values from m1 into the lower four 8-bit values of the result with signed saturation, and packs the four 16-bit values from m2 into the upper four 8-bit values of the result with signed saturation.


_mm_packs_pi32
Syntax
__m64 _mm_packs_pi32 (__m64 m1, __m64 m2)
Description

Packs the two 32-bit values from m1 into the lower two 16-bit values of the result with signed saturation, and packs the two 32-bit values from m2 into the upper two 16-bit values of the result with signed saturation.


_mm_packs_pu16
Syntax
__m64 _mm_packs_pu16 (__m64 m1, __m64 m2)
Description

Packs the four 16-bit values from m1 into the lower four 8-bit values of the result with unsigned saturation, and packs the four 16-bit values from m2 into the upper four 8-bit values of the result with unsigned saturation.


_mm_packs_pu32
Syntax
__m64 _mm_packs_pu32 (__m64 m1, __m64 m2)
Description

Packs the two 32-bit values from m1 into the lower two 16-bit values of the result with unsigned saturation, and packs the two 32-bit values from m2 into the upper two 16-bit values of the result with unsigned saturation.


_mm_packs_si64
Syntax
__m64 _mm_packs_si64 (__m64 m1, __m64 m2)
Description

Packs the 64-bit value from m1 into the lower 32-bit value of the result with signed saturation, and packs the one 32-bit value from m2 into the upper 32-bit value of the result with signed saturation.


_mm_packs_su64
Syntax
__m64 _mm_packs_su64 (__m64 m1, __m64 m2)
Description

Packs the 64-bit value from m1 into the lower 32-bit value of the result with signed saturation, and packs the upper 32-bit value from m2 into the upper 32-bit value of the result with signed saturation.


_mm_qmiabb_pi32
Syntax
__m64 _mm__qmiabb_pi32 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit multiplication with the lower 16 bits (halfwords) of each of the two words of the parameters m1 and m2, then adds the two 32-bit results to the two words of the parameter acc and returns the result of this addition.

This function uses the assembler instruction WQMIABB.

See Also

Intel® Assembler Reference Manual


_mm_qmiabbn_pi32
Syntax
__m64 _mm__qmiabbn_pi32 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit multiplication with the lower 16 bits (halfwords) of each of the two words of the parameters m1 and m2, then subtracts the result from the parameter acc and returns the result of this subtraction.

This function uses the assembler instruction WQMIABBN.

See Also

Intel® Assembler Reference Manual


_mm_qmiabt_pi32
Syntax
__m64 _mm__mm__qmiabt_pi32 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit multiplication with the lower 16 bits (halfwords) of each of the two words of parameter m1 and the higher 16 bits (halfwords) of each of the two words of the parameter m2, then adds the two 32-bit results to the two words of the parameter acc and returns the result of this addition.

This function uses the assembler instruction WQMIABT.

See Also

Intel® Assembler Reference Manual


_mm_qmiabtn_pi32
Syntax
__m64 _mm__mm__qmiabtn_pi32 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit multiplication with the lower 16 bits (halfwords) of each of the two words of parameter m1 and the higher 16 bits (halfwords) of each of the two words of the parameter m2, then subtracts the result from the parameter acc and returns the result of this subtraction.

This function uses the assembler instruction WQMIABTN.

See Also

Intel® Assembler Reference Manual


_mm_qmiatb_pi32
Syntax
__m64 _mm__mm__qmiatb_pi32 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit multiplication with the higher 16 bits (halfwords) of each of the two words of parameter m1 and the lower 16 bits (halfwords) of each of the two words of the parameter m2, then adds the two 32-bit results to the two words of the parameter acc and returns the result of this addition.

This function uses the assembler instruction WQMIATB.

See Also

Intel® Assembler Reference Manual


_mm_qmiatbn_pi32
Syntax
__m64 _mm__mm__qmiatbn_pi32 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit multiplication with the higher 16 bits (halfwords) of each of the two words of parameter m1 and the lower 16 bits (halfwords) of each of the two words of the parameter m2, then subtracts the result from the parameter acc and returns the result of this subtraction.

This function uses the assembler instruction WQMIATBN.

See Also

Intel® Assembler Reference Manual


_mm_qmiatt_pi32
Syntax
__m64 _mm__qmiatt_pi32 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit multiplication with the higher 16 bits (halfwords) of each of the two words of the parameters m1 and m2, then adds the two 32-bit results to the two words of the parameter acc and returns the result of this addition.

This function uses the assembler instruction WQMIATT.

See Also

Intel® Assembler Reference Manual


_mm_qmiattn_pi32
Syntax
__m64 _mm__qmiattn_pi32 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit multiplication with the higher 16 bits (halfwords) of each of the two words of the parameters m1 and m2, then subtracts the result from the parameter acc and returns the result of this subtraction.

This function uses the assembler instruction WQMIATTN.

See Also

Intel® Assembler Reference Manual


_mm_qmulm_pi16
Syntax
__m64 _mm_qmulm_pi16 (__m64 a, __m64 b)
Description

Performs parallel vector multiplication on the four 16-bit halfwords of the parameters a and b. The higher order 16 bits of the four 32-bit intermediate results are returned.

This function uses the assembler instruction WQMULM.

See Also

Intel® Assembler Reference Manual


_mm_qmulm_pi32
Syntax
__m64 _mm_qmulm_pi32 (__m64 a, __m64 b)
Description

Performs parallel vector multiplication on the two 32-bit words of the parameters a and b. The higher order 32 bits of the two 64-bit results are returned.

This function uses the assembler instruction WQMULWM.

See Also

Intel® Assembler Reference Manual


_mm_qmulmr_pi16
Syntax
__m64 _mm_qmulmr_pi16 (__m64 a, __m64 b)
Description

Performs parallel vector multiplication on the four 16-bit halfwords of the parameters a and b. The higher order 16 bits of the four 32-bit intermediate results are returned, with the least significant 16 bits rounded into the most significant 16 bits.

This function uses the assembler instruction WQMULMR.

See Also

Intel® Assembler Reference Manual


_mm_qmulmr_pi32
Syntax
__m64 _mm_qmulmr_pi32 (__m64 a, __m64 b)
Description

Performs parallel vector multiplication on the two 32-bit words of the parameters a and b. The higher order 32 bits of the two 64-bit results are returned, with the least significant 32 bits rounded into the most significant 32 bits.

This function uses the assembler instruction WQMULWMR.

See Also

Intel® Assembler Reference Manual


_mm_ror_pi16
Syntax
__m64 _mm_ror_pi16 (__m64 m, __m64 count)
Description

Rotates four 16-bit values in m right the amount specified by count.


_mm_ror_pi32
Syntax
__m64 _mm_ror_pi32 (__m64 m, __m64 count)
Description

Rotates two 32-bit values in m right the amount specified by count.


_mm_ror_si64
Syntax
__m64 _mm_ror_si64 (__m64 m, __m64 count)
Description

Rotates 64-bit value in m right the amount specified by count.


_mm_rori_pi16
Syntax
__m64 _mm_rori_pi16 (__m64 m, int count)
Description

Rotates four 16-bit values in m right the amount specified by count.


_mm_rori_pi32
Syntax
__m64 _mm_rori_pi32 (__m64 m, int count)
Description

Rotates two 32-bit values in m right the amount specified by count.


_mm_rori_si64
Syntax
__m64 _mm_rori_si64 (__m64 m, int count)
Description

Rotates 64-bit value in m right the amount specified by count.


_mm_sad_pu8
Syntax
__m64 _mm_sad_pu8(__m64 a, __m64 b)
Description

Computes the sum of the absolute differences of the unsigned bytes in a and b, returning the value in the lower word. The upper word of the result is cleared.

If r = _mm_sad_pu8(a, b), the action is

r [0:31] = abs(a0-b0) +... + abs(a7-b7);
r[32:63] = 0;


_mm_sad_pu16
Syntax
__m64 _mm_sad_pu16(__m64 a, __m64 b)
Description

Computes the sum of the absolute differences of the unsigned half words in a and b, returning the value in the lower word. The upper word of the result is cleared.

If r = _mm_sad_pu16(a, b), the action is

r [0:31] = abs(a0-b0) +... + abs(a3-b3);
r[32:63] = 0;


_mm_sada_pu8
Syntax
__m64 _mm_sada_pu8(__m64 a, __m64 b, __m64 c)
Description

Computes the sum of the absolute differences of the bytes in b and c, and accumulates the result with the lower word of a. The upper word of the result is cleared.

If r = _mm_sada_pu8(a, b, c), the action is

r [0:31] = a[0:31] + abs(b0-c0) +... + abs(b7-c7);
r[32:63] = 0;


_mm_sada_pu16
Syntax
__m64 _mm_sada_pu16(__m64 a, __m64 b, __m64 c)
Description

Computes the sum of the absolute differences of the half words in b and c, and accumulates the result with the lower word of a.The upper word of the result is cleared.

If r = _mm_sada_pu16(a, b, c), the action is

r [0:31] = a[0:31] + abs(b0-c0) +... + abs(b3-c3);
r[32:63] = 0;


_mm_set_pi16
Syntax
__m64 _mm_set_pi16 (short w3, short w2, short w1, short w0)
Description

Sets the 4 signed 16-bit integer values.

If r = _mm_set_pi16 (w3, w2, w1, w0), the action is

r0 = w0;
r1 = w1;
r2 = w2;
r3 = w3;


_mm_set_pi32
Syntax
__m64 _mm_set_pi32 (int i1, int i0)
Description

Sets the 2 signed 32-bit integer values.

If r = _mm_set_pi32(i1, i0), the action is

r0 = i0;
r1 = i1;


_mm_set_pi8
Syntax
__m64 _mm_set_pi8 (char b7, char b6,
char b5, char b4,
char b3, char b2,
char b1, char b0)
Description

Sets the 8 signed 8-bit integer values.

If r = _mm_set_pi8 (b7, b6, b5, b4, b3, b2, b1, b0), the action is

r0 = b0;
r1 = b1;
...
r7 = b7;


_mm_set1_pi16
Syntax
__m64 _mm_set1_pi16 (short w)
Description

Sets the 4 signed 16-bit integer values to w.

If r = _mm_set1_pi16 (w), action is

r0 = w;
r1 = w;
r2 = w;
r3 = w;


_mm_set1_pi32
Syntax
__m64 _mm_set1_pi32 (int i)
Description

Sets the 2 signed 32-bit integer values to i.

If r = _mm_set1_pi32 (i), the action is

r0 = i;
r1 = i;


_mm_set1_pi8
Syntax
__m64 _mm_set1_pi8 (char b)
Description

Sets the 8 signed 8-bit integer values to b.

If r = _mm_set1_pi8 (b), the action is

r0 = b;
r1 = b;
...
r7 = b;


_mm_setr_pi16
Syntax
__m64 _mm_setr_pi16 (short w0, short w1,short w2, short w3)

If r = _mm_setr_pi16 (w0, w1, w2, w3), the action is

r0 = w0;
r1 = w1;
r2 = w2;
r3 = w3;


_mm_setr_pi32
Syntax
__m64 _mm_setr_pi32 (int i0, int i1)
Description

Sets the 2 signed 32-bit integer values in reverse order.

If r = _mm_setr_pi32 (i0, i1), the action is

r0 = i0;
r1 = i1;


_mm_setr_pi8
Syntax
__m64 _mm_setr_pi8 (char b0, char b1,char b2, char b3,
char b4, char b5,
char b6, char b7)
Description

Sets the 8 signed 8-bit integer values in reverse order.

If r = _mm_setr_pi8 (b0, b1, b2, b3, b4, b5, b6, b7), the action is

r0 = b0;
r1 = b1;
...
r7 = b7;


_mm_setwcx
Syntaxvoid
__mm_setwcx(int value, int number)
Description

Sets the Intel® Wireless MMX(TM) technology control register specified by number to the contents of value.


_mm_setzero_si64
Syntax
__m64 _mm_setzero_si64 ()
Description

Sets the 64-bit value to zero.

If r = _mm_setzero_si64(), the action is

r = 0x0;


_mm_shuffle_pi16
Syntax
__m64 _mm_shuffle_pi16(__m64 a, int n)
Description

Returns a combination of the four half words of a. The selector n must be an immediate.

If r = _mm_shuffle_pi16(a, n), the action is

r0 = Half word (n&0x3) of a
r1 = Half word ((n>>2)&0x3) of a
r2 = Half word ((n>>4)&0x3) of a
r3 = Half word ((n>>6)&0x3) of a


_mm_sll_pi16
Syntax
__m64 _mm_sll_pi16 (__m64 m, __m64 count)
Description

Shifts four 16-bit values in m left the amount specified by count while shifting in zeros.


_mm_sll_pi32
Syntax
__m64 _mm_sll_pi32 (__m64 m, __m64 count)
Description

Shifts two 32-bit values in m left the amount specified by count while shifting in zeros.


_mm_sll_si64
Syntax
__m64 _mm_sll_si64 (__m64 m, __m64 count)
Description

Shifts the 64-bit value in m left the amount specified by count while shifting in zeros.


_mm_slli_pi16
Syntax
__m64 _mm_slli_pi16 (__m64 m, int count)
Description

Shifts four 16-bit values in m left the amount specified by count while shifting in zeros.


_mm_slli_pi32
Syntax
__m64 _mm_slli_pi32 (__m64 m, int count)
Description

Shifts two 32-bit values in m left the amount specified by count while shifting in zeros.


_mm_slli_si64
Syntax
__m64 _mm_slli_si64 (__m64 m, int count)
Description

Shifts the 64-bit value in m left the amount specified by count while shifting in zeros.


_mm_sra_pi16
Syntax
__m64 _mm_sra_pi16 (__m64 m, __m64 count)
Description

Shifts four 16-bit values in m right the amount specified by count while shifting in the sign bit.


_mm_sra_pi32
Syntax
__m64 _mm_sra_pi32 (__m64 m, __m64 count)
Description

Shifts two 32-bit values in m right the amount specified by count while shifting in the sign bit.


_mm_sra_si64
Syntax
__m64 _mm_sra_si64 (__m64 m, __m64 count)
Description

Shifts 64-bit value in m right the amount specified by count while shifting in the sign bit.


_mm_srai_pi16
Syntax
__m64 _mm_srai_pi16 (__m64 m, int count)
Description

Shifts four 16-bit values in m right the amount specified by count while shifting in the sign bit.


_mm_srai_pi32
Syntax
__m64 _mm_srai_pi32 (__m64 m, int count)
Description

Shifts two 32-bit values in m right the amount specified by count while shifting in the sign bit.


_mm_srai_si64
Syntax
__m64 _mm_srai_si64 (__m64 m, int count)
Description

Shifts 64-bit value in m right the amount specified by count while shifting in the sign bit.


_mm_srl_pi16
Syntax
__m64 _mm_srl_pi16 (__m64 m, __m64 count)
Description

Shifts four 16-bit values in m right the amount specified by count while shifting in zeros.


_mm_srl_pi32
Syntax
__m64 _mm_srl_pi32 (__m64 m, __m64 count)
Description

Shifts two 32-bit values in m right the amount specified by count while shifting in zeros.


_mm_srl_si64
Syntax
__m64 _mm_srl_si64 (__m64 m, __m64 count)
Description

Shifts the 64-bit value in m right the amount specified by count while shifting in zeros.


_mm_srli_pi16
Syntax
__m64 _mm_srli_pi16 (__m64 m, int count)
Description

Shifts four 16-bit values in m right the amount specified by count while shifting in zeros.


_mm_srli_pi32
Syntax
__m64 _mm_srli_pi32 (__m64 m, int count)
Description

Shifts two 32-bit values in m right the amount specified by count while shifting in zeros.


_mm_srli_si64
Syntax
__m64 _mm_srli_si64 (__m64 m, int count)
Description

Shifts the 64-bit value in m right the amount specified by count while shifting in zeros.


_mm_sub_pi8
Syntax
__m64 _mm_sub_pi8 (__m64 m1, __m64 m2)
Description

Subtracts the eight 8-bit values in m2 from the eight 8-bit values in m1.


_mm_sub_pi16
Syntax
__m64 _mm_sub_pi16 (__m64 m1, __m64 m2)
Description

Subtracts the four 16-bit values in m2 from the four 16-bit values in m1.


_mm_sub_pi32
Syntax
__m64 _mm_sub_pi32 (__m64 m1, __m64 m2)
Description

Subtracts the two 32-bit values in m2 from the two 32-bit values in m1.


_mm_subaddhx_pi16
Syntax
__m64 _mm_subaddhx_pi16 (__m64 a, __m64 b)
Description

The four halfwords of parameter b are alternately added and subtracted from/to the halfwords of parameter a using a cross selection in each of the parallel operations. The result of the operation is saturated to the signed limits. and returned.

This function uses the assembler instruction WSUBADDHX.

See Also

Intel® Assembler Reference Manual


_mm_subs_pi8
Syntax
__m64 _mm_subs_pi8 (__m64 m1, __m64 m2)
Description

Subtracts the eight signed 8-bit values in m2 from the eight signed 8-bit values in m1 using saturating arithmetic.


_mm_subs_pi16
Syntax
__m64 _mm_subs_pi16 (__m64 m1, __m64 m2)
Description

Subtracts the four signed 16-bit values in m2 from the four signed 16-bit values in m1 using saturating arithmetic.


_mm_subs_pi32
Syntax
__m64 _mm_subs_pi32 (__m64 m1, __m64 m2)
Description

Subtracts the two signed 32-bit values in m2 from the two signed 32-bit values in m1 using saturating arithmetic.


_mm_subs_pu8
Syntax
__m64 _mm_subs_pu8 (__m64 m1, __m64 m2)
Description

Subtracts the eight unsigned 8-bit values in m2 from the eight unsigned 8-bit values in m1 using saturating arithmetic.


_mm_subs_pu16
Syntax
__m64 _mm_subs_pu16 (__m64 m1, __m64 m2)
Description

Subtracts the four unsigned 16-bit values in m2 from the four unsigned 16-bit values in m1 using saturating arithmetic.


_mm_subs_pu32
Syntax
__m64 _mm_subs_pu32 (__m64 m1, __m64 m2)
Description

Subtracts the two unsigned 32-bit values in m2 from the two unsigned 32-bit values in m1 using saturating arithmetic.


_mm_unpackeh_pi8
Syntax
__m64 _mm_unpackeh_pi8 (__m64 m1)
Description

Unpacks the four 8-bit values from the upper half of m1 and sign-extends each value.


_mm_unpackeh_pi16
Syntax
__m64 _mm_unpackeh_pi16 (__m64 m1)
Description

Unpacks the two 16-bit values from the upper half of m1 and sign-extends each value.


_mm_unpackeh_pi32
Syntax
__m64 _mm_unpackeh_pi32 (__m64 m1)
Description

Unpacks the 32-bit value from the upper half of m1 and sign-extends each value.


_mm_unpackeh_pu8
Syntax
__m64 _mm_unpackeh_pu8 (__m64 m1)
Description

Unpacks the four 8-bit values from the upper half of m1 and zero-extends each value.


_mm_unpackeh_pu16
Syntax
__m64 _mm_unpackeh_pu16 (__m64 m1)
Description

Unpacks the two 16-bit values from the upper half of m1 and zero-extends each value.


_mm_unpackeh_pu32
Syntax
__m64 _mm_unpackeh_pu32 (__m64 m1)
Description

Unpacks the 32-bit value from the upper half of m1 and zero-extends each value.


_mm_unpackel_pi8
Syntax
__m64 _mm_unpackel_pi8 (__m64 m1)
Description

Unpacks the four 8-bit values from the lower half of m1 and sign-extends each value.


_mm_unpackel_pi16
Syntax
__m64 _mm_unpackel_pi16 (__m64 m1)
Description

Unpacks the two 16-bit values from the lower half of m1 and sign-extends each value.


_mm_unpackel_pi32
Syntax
__m64 _mm_unpackel_pi32 (__m64 m1)
Description

Unpacks the 32-bit value from the lower half of m1 and sign-extends each value.


_mm_unpackel_pu8
Syntax
__m64 _mm_unpackel_pu8 (__m64 m1)
Description

Unpacks the four 8-bit values from the lower half of m1 and zero-extends each value.


_mm_unpackel_pu16
Syntax
__m64 _mm_unpackel_pu16 (__m64 m1)
Description

Unpacks the two 16-bit values from the lower half of m1 and zero-extends each value.


_mm_unpackel_pu32
Syntax
__m64 _mm_unpackel_pu32 (__m64 m1)
Description

Unpacks the 32-bit value from the lower half of m1 and zero-extends each value.


_mm_unpackhi_pi8
Syntax
__m64 _mm_unpackhi_pi8 (__m64 m1, __m64 m2)
Description

Interleaves the four 8-bit values from the upper half of m1 with the four values from the upper half of m2. The interleaving begins with the data from m1.


_mm_unpackhi_pi16
Syntax
__m64 _mm_unpackhi_pi16 (__m64 m1, __m64 m2)
Description

Interleaves the two 16-bit values from the upper half of m1 with the two values from the upper half of m2. The interleaving begins with the data from m1.


_mm_unpackhi_pi32
Syntax
__m64 _mm_unpackhi_pi32 (__m64 m1, __m64 m2)
Description

Interleaves the 32-bit value from the upper half of m1 with the 32-bit value from the upper half of m2. The interleaving begins with the data from m1.


_mm_unpacklo_pi8
Syntax
__m64 _mm_unpacklo_pi8 (__m64 m1, __m64 m2)
Description

Interleaves the four 8-bit values from the lower half of m1 with the four values from the lower half of m2. The interleaving begins with the data from m1.


_mm_unpacklo_pi16
Syntax
__m64 _mm_unpacklo_pi16 (__m64 m1, __m64 m2)
Description

Interleaves the two 16-bit values from the lower half of m1 with the two values from the lower half of m2. The interleaving begins with the data from m1.


_mm_unpacklo_pi32
Syntax
__m64 _mm_unpacklo_pi32 (__m64 m1, __m64 m2)
Description

Interleaves the 32-bit value from the lower half of m1 with the 32-bit value from the lower half of m2. The interleaving begins with the data from m1.


_mm_wmiabb_si64
Syntax
__m64 _mm_wmiabb_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit parallel multiply-accumulate with the lower 16 bits (halfwords) of each of the two words of the parameters m1 and m2, then adds the result to the parameter acc and returns the result of this addition.

This function uses the assembler instruction WMIABB.

See Also

Intel® Assembler Reference Manual


_mm_wmiabbn_si64
Syntax
__m64 _mm_wmiabbn_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit parallel multiply-accumulate with the lower 16 bits (halfwords) of each of the two words of the parameters m1 and m2, then subtracts the result from the parameter acc and returns the result of this subtraction.

This function uses the assembler instruction WMIABBN.

See Also

Intel® Assembler Reference Manual


_mm_wmiabt_si64
Syntax
__m64 _mm_wmiabt_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit parallel multiply-accumulate with the lower 16 bits (halfwords) of each of the two words of the parameter m1 and the upper 16 bits (halfwords) of each of the two words of the parameter m2, then adds the result to the parameter acc and returns the result of this addition.

This function uses the assembler instruction WMIABT.

See Also

Intel® Assembler Reference Manual


_mm_wmiabtn_si64
Syntax
__m64 _mm_wmiabtn_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit parallel multiply-accumulate with the lower 16 bits (halfwords) of each of the two words of the parameter m1 and the upper 16 bits (halfwords) of each of the two words of the parameter m2, then subtracts the result from the parameter acc and returns the result of this subtraction.

This function uses the assembler instruction WMIABTN.

See Also

Intel® Assembler Reference Manual


_mm_wmiatb_si64
Syntax
__m64 _mm_wmiatb_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit parallel multiply-accumulate with the upper 16 bits (halfwords) of each of the two words of the parameter m1 and the lower 16 bits (halfwords) of each of the two words of the parameter m2, then adds the result to the parameter acc and returns the result of this addition.

This function uses the assembler instruction WMIATB.

See Also

Intel® Assembler Reference Manual


_mm_wmiatbn_si64
Syntax
__m64 _mm_wmiatbn_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit parallel multiply-accumulate with the upper 16 bits (halfwords) of each of the two words of the parameter m1 and the lower 16 bits (halfwords) of each of the two words of the parameter m2, then subtracts the result from the parameter acc and returns the result of this subtraction.

This function uses the assembler instruction WMIATBN.

See Also

Intel® Assembler Reference Manual


_mm_wmiatt_si64
Syntax
__m64 _mm_wmiatt_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit parallel multiply-accumulate with the upper 16 bits (halfwords) of each of the two words of the parameters m1 and m2, then adds the result to the parameter acc and returns the result of this addition.

This function uses the assembler instruction WMIATT.

See Also

Intel® Assembler Reference Manual


_mm_wmiattn_si64
Syntax
__m64 _mm_wmiattn_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit parallel multiply-accumulate with the upper 16 bits (halfwords) of each of the two words of the parameters m1 and m2, then subtracts the result from the parameter acc and returns the result of this subtraction.

This function uses the assembler instruction WMIATTN.

See Also

Intel® Assembler Reference Manual


_mm_wmiawbb_si64
Syntax
__m64 _mm_wmiawbb_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 32-bit parallel multiply-accumulate with the lower 32 bits (bottom word) of each of the parameters m1 and m2, then adds the result to the parameter acc and returns the result of this addition.

This function uses the assembler instruction WMIAWBB.

See Also

Intel® Assembler Reference Manual


_mm_wmiawbbn_si64
Syntax
__m64 _mm_wmiawbbn_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 16-bit parallel multiply-accumulate with the lower 16 bits (halfwords) of each of the two words of the parameters m1 and m2, then subtracts the result from the parameter acc and returns the result of this subtraction.

This function uses the assembler instruction WMIAWBBN.

See Also

Intel® Assembler Reference Manual


_mm_wmiawbt_si64
Syntax
__m64 _mm_wmiawbt_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 32-bit parallel multiply-accumulate with the lower 32 bits (bottom word) of the parameter m1 and the upper 32 bits (top word) of the parameter m2, then adds the result to the parameter acc and returns the result of this addition.

This function uses the assembler instruction WMIAWBT.

See Also

Intel® Assembler Reference Manual


_mm_wmiawbtn_si64
Syntax
__m64 _mm_wmiawbtn_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 32-bit parallel multiply-accumulate with the lower 32 bits (bottom word) of the parameter m1 and the upper 32 bits (top word) of the parameter m2, then subtracts the result from the parameter acc and returns the result of this subtraction.

This function uses the assembler instruction WMIAWBTN.

See Also

Intel® Assembler Reference Manual


_mm_wmiawtb_si64
Syntax
__m64 _mm_wmiawtb_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 32-bit parallel multiply-accumulate with the upper 32 bits (top word) of the parameter m1 and the lower 32 bits (bottom word) of the parameter m2, then adds the result to the parameter acc and returns the result of this addition.

This function uses the assembler instruction WMIAWTB.

See Also

Intel® Assembler Reference Manual


_mm_wmiawtbn_si64
Syntax
__m64 _mm_wmiawtbn_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 32-bit parallel multiply-accumulate with the upper 32 bits (top word) of the parameter m1 and the lower 32 bits (bottom word) of the parameter m2, then subtracts the result from the parameter acc and returns the result of this subtraction.

This function uses the assembler instruction WMIAWTBN.

See Also

Intel® Assembler Reference Manual


_mm_wmiawtt_si64
Syntax
__m64 _mm_wmiawtt_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 32-bit parallel multiply-accumulate with the upper 32 bits (top word) of the parameters m1 and m2, then adds the result to the parameter acc and returns the result of this addition.

This function uses the assembler instruction WMIAWTT.

See Also

Intel® Assembler Reference Manual


_mm_wmiawttn_si64
Syntax
__m64 _mm_wmiawttn_si64 (__m64 m1, __m64 m2, __m64 acc)
Description

Performs a 32-bit parallel multiply-accumulate with the upper 32 bits (top word) of the parameters m1 and m2, then subtracts the result from the parameter acc and returns the result of this subtraction.

This function uses the assembler instruction WMIAWTTN.

See Also

Intel® Assembler Reference Manual


_mm_xor_si64
Syntax
__m64 _mm_xor_si64 (__m64 m1, __m64 m2)
Description

Performs a bitwise XOR of the 64-bit value in m1 with the 64-bit value in m2.


Microsoft* Compatibility

This chapter describes the compatibility between the Intel® C++ Compiler and the Microsoft* Visual C++* Compiler. The Intel® C++ Compiler supports the extensions to the C and C++ languages which are required by the Microsoft* Visual C++* Compiler, though a few are treated differently. This chapter details these differences showing how they are handled and interpreted by the Intel® C++ Compiler. The chapter comprises the following sections:

  • "Overview of Microsoft* Compatibility" provides an overview of the areas of compatibility differences.
  • "Microsoft* Compatibility" describes the compatibility differences of the Intel® C++ Compiler to the Microsoft* Visual C++* Compiler in detail.


Overview of Microsoft* Compatibility

The Intel® C++ Compiler supports the Microsoft* Visual C++* extensions to the C and C++ languages. This section lists the differences in the way the Intel® C++ Compiler interprets some of the Microsoft* Visual C++* extensions. The differences are in the following areas:

  • "Compiler Pragmas"
  • "Microsoft* Compatibility Option"
  • "Microsoft* Version Compatibility Options"
  • "Unsupported Compiler Options"
  • "Differences in PCH Support"
  • "Precompiled Header Files Coexistence"
  • "Allocating Memory for Precompiled Header Files"
  • "Compilation and Execution Differences"
  • "Declaration in Scope of Function Defined in a Namespace"
  • "Signedness of enum Bitfields"
  • "Structured Exception Handling"


Microsoft* Compatibility

The following sections describe the compatibility differences of the Intel® C++ Compiler to the Microsoft* Visual C++* Compiler in detail.


Compiler Pragmas

The Intel® C++ Compiler supports the Microsoft* Visual C++* pragmas with the following limitations:

The optimize pragma of Microsoft* Visual C++* accepts a list that allows the enabling and disabling of specific optimizations. The Intel® C++ Compiler ignores this list, either enabling or disabling all optimizations specified by options on the command line.

The following pragmas, which sometimes appear in header files, are accepted without error but have no effect:

  • auto_inline
  • component
  • function
  • include_alias
  • inline_depth
  • inline_recursion
  • intrinsic
  • setlocale

For more information on these pragmas, see the on-line help or the documentation that accompanies your copy of Microsoft* Visual C++*.


Microsoft* Compatibility Option

In a limited number of cases, the Microsoft* compiler compiles source code without generating an error while the Intel® C++ Compiler generates an error for the same source code. If this occurs in a file that is part of a third-party distribution (such as "include" files or C++ class library files), it might not be convenient to correct the error in the source file. In such cases, using the /Qms option with the Intel® C++ Compiler may allow a successful compilation. The /Qms option is OFF by default.


Microsoft* Version Compatibility Options

For compilations to run on Intel XScale® technology in Microsoft Windows* CE .NET, you can use the Intel® C++ Compiler with the Platform Builder for Microsoft Windows* CE .NET.


Unsupported Compiler Options

The Intel® C++ Compiler supports most of the same options as the Microsoft* Visual C++* Compiler, as well as Intel®-specific options. However, a small subset of Microsoft* Visual C++* Compiler options are not supported by the Intel® C++ Compiler. Most of these unsupported options, while useful for development purposes, are not required to build a working application. The unsupported options are listed in the table below.

Table: Unsupported Compiler Options
Option | Description
/Fd | Names the PDB file used for debug information for specified source files.
/Gi | Enables incremental compilation.
/Gm | Enables minimal rebuild.
/QIf | Emits FPO (frame pointer optimization) records.
/Yd | Puts debug information in every object (Microsoft* PCH-specific option).
/Zmn | Control of maximum memory allocated by the compiler.

The Intel® C++ Compiler silently ignores the following options: /Fd, /Gi, /Gm, /Yd, and /Zmn.


Differences in PCH Support

There are some differences between the Intel® C++ Compiler and the Microsoft* Visual C++* Compiler regarding the way precompiled header (PCH) files are supported. These differences include the following:

  • The PCH information generated by the Intel® C++ Compiler is not compatible with the PCH information generated by the Microsoft* Visual C++* Compiler.
  • The Intel® C++ Compiler does not support PCH generation and use in the same translation unit.
  • The Intel® C++ Compiler does not generate PCH information beyond a point where a declaration is seen in the primary translation unit. When the /Yu option is specified, the Microsoft* Visual C++* Compiler ignores all text, including declarations preceding the #include statement of the specified file.


Precompiled Header Files Coexistence

The /Qpchi[-] option enables (default) or disables the precompiled header (PCH) files coexistence, which reduces build time.

The /Qpchi option causes the compiler to name its PCH files with a .pchi filename suffix. This prevents PCH files generated by the Intel® C++ Compiler from overwriting the PCH files generated by the Microsoft* Visual C++* Compiler. This feature can reduce build time, especially when the /FR or /FD options are used. In particular, the /Qpchi option helps reduce build time from within Microsoft* Visual Studio*, since /FD is always specified by the Visual Studio* build system.

Note icon NOTE.
Because this feature causes an additional set of PCH files to be left on disk, you may disable this feature with /Qpchi- in cases where build time is not an issue, or where disk space is a bigger issue.


Allocating Memory for Precompiled Header Files

Use the /Qpch_memN option to specify the amount of pre-allocated memory available to create precompiled header files. When you generate precompiled header files, the compiler pre-allocates a block of memory usually large enough for all translation units. However, this pre-allocated amount might not be sufficient for extremely large translation units; in such cases the Intel® C++ Compiler generates a warning like the following:

foo.h(36): warning #682: insufficient preallocated memory for generation of precompiled header file use /Qpch_mem36

The warning diagnostic indicates the memory size required for the translation unit of the precompiled header file. The following example allocates the required memory:

ccxscce /Qpch_mem38 my_prog.cpp /Ycmy_app.h
Note icon NOTE.
N in this case is specified as 38 (MB), which is 2 MB more than that required according to the diagnostic warning. The extra 2 MB are recommended to avoid resetting this parameter in case there is extra memory required at a later time.


Compilation and Execution Differences

While the Intel® C++ Compiler is compatible with the Microsoft* Visual C++* Compiler, some differences can prevent successful compilation. Also there can be some incompatible generated-code behavior of some source files with the Intel® C++ Compiler. In most cases, a modification of the user source file enables successful compilation with both the Intel® C++ Compiler and the Microsoft* Visual C++* Compiler. The differences between the compilers are listed below.


Preprocessor Macro Expansion

The Intel® C++ Compiler differs from the Microsoft* Visual C++* Compiler in the way it expands preprocessor macros that are used within #include directives. In some cases the code passes a macro as a parameter to another macro that uses the token-concatenation operator. In such a case, the macro that is used as a parameter is not expanded before concatenation. This is demonstrated in the following example:

#define D var
#define Decl(d) int my ## d;
Decl(D)

Both compilers would preprocess the preceding source and produce the following code:

int myD;

When a similar macro is used in a #include directive, the Intel® C++ Compiler behaves similarly to the preceding example. However, the Microsoft* Visual C++* Compiler performs an extra preprocessing scan through the #include directive to produce different results. In the following example, the D and F macros, when used in the #include directive, are not expanded by the Intel® C++ Compiler.

#define D sys
#define F stat.h
#define INC(d,f) < ## d ## / ## f ## >
#include INC(D,F)

Microsoft* Visual C++* Compiler interpretation is:

#include <sys/stat.h>

Intel® C++ Compiler interpretation is:

#include <D/F>

The Intel® C++ Compiler issues an error for this code when it fails to find the file called D/F. The Microsoft* Visual C++* Compiler expands the D and F macros and accepts this code. An alternative is shown below.

The following alternative code achieves the intended result with either the Intel® C++ Compiler and the Microsoft* Visual C++* Compiler:

#define D sys
#define F stat.h
#define CAT5(a,b,c,d,e) a ## b ## c ## d ## e
#define INC(d,f) CAT5(<,d,/,f,>)
#include INC(D,F)


Evaluation of Left Shift Operations

The Intel® C++ Compiler differs from the Microsoft* Visual C++* Compiler in the evaluation of left shift operations where the right operand, or shift count, is equal to or greater than the size of the left operand expressed in bits. The ANSI C standard states that the behavior of such left-shift operations is undefined, meaning a program should not expect a certain behavior from these operations. This difference is only evident when both operands of the shift operation are constants.

The following example illustrates this difference between the Intel® C++ Compiler and the Microsoft* Visual C++* Compiler:

int x;
int y = 1;
void func()
{
x = 1 << 32;
// Visual C++ Compiler generates code to set x=0
// Intel® C++ Compiler generates code to set x=1
y = y << 32;
// Visual C++ Compiler generates code to set y=1
// Intel® C++ Compiler generates code to set y=1
}


Declaration in Scope of Function Defined in a Namespace

In accordance with the C++ language specification, if a function declaration is encountered within a function definition, the function referenced is taken to be another member of the namespace of the containing function; regardless of whether the containing function definition is lexically within a namespace definition. The Microsoft* Visual C++* Compiler takes the referenced function to be a global function (not in any namespace). Functions declared in global or namespace scopes are interpreted the same way by both the Intel® C++ Compiler and the Microsoft* Visual C++* Compiler.


Signedness of enum Bitfields

The Intel® C++ Compiler and the Microsoft* Visual C++* Compiler differ in how they attribute signedness to bitfields declared with an enum type. Apparently, Microsoft* Visual C++* always considers enum bitfields to be signed, even if not all values of the enum type can be represented by the bitfield. On the other hand, the Intel® C++ Compiler considers an enum bitfield to be unsigned, unless the enum type has at least one enum constant with a negative value. In any case, the Intel® C++ Compiler produces a warning if the bitfield is declared with too few bits to represent all the values of the enum type.


Structured Exception Handling

The Intel® C++ Compiler supports structured exception handling (SEH).


Diagnostics and Messages

This chapter provides a detailed description of the many diagnostic and other messages which can be generated by the Intel® C++ Compiler.

The chapter is divided into several parts:

  • "Overview" explains the mechanism for diagnostics and other messages generated by the Intel® C++ Compiler.
  • "Diagnostics" describes command line and language diagnostics and provides a description of how you can control the severity of diagnostics.
  • "Messages" describes compiler information messages, diagnostic messages including remark, warning, and error messages.


Overview

During its compilation process the Intel® C++ Compiler can generate a number of diagnostic and other messages. These may be due to errors in the command line, or problems within the source code. Syntactic and semantic problems within the source code may result in simple remarks or warnings which won't stop the compilation process from completing, and are generated as a way of information to the user. Other problems may result in messages informing of errors, which are fatal and must be corrected, since they stop the compilation and linking process from completing.

The severity of these diagnostic messages may be altered, allowing the user to select which messages are generated, and their type. All messages generated by the Intel® C++ Compiler are displayed on the standard output stream.


Diagnostics

This section describes command line and language diagnostics, and provides a description of how you can control the severity of diagnostics.


Command Line Diagnostics

Command Line Diagnostics report improper and unrecognized command line arguments of filenames and options, and constitute both warning and error messages. Warning messages are generated where the compiler is able to make assumptions about the interpretation of the arguments and continue. Error messages are generated when the compiler is not able to continue.

Command line diagnostics take the form:

  • Command line warning: message describing the warning.
  • Command line error: message describing the error.
Example

The following command

ccxscce

will generate the error:

ccxscce: Command line error: no files specified; for help type "ccxscce /HELP"


Language Diagnostics

These diagnostic messages provide information relating to the source code being compiled, and include semantic as well as syntactic information. Examples of syntactic information would include syntax errors and use of nonstandard code while examples of semantic information would include unreachable code and unnecessary loops and branching.

Diagnostic messages include remarks, warnings and errors. Remarks and warnings are informational messages to the user and do not stop the compilation and linking process. The user may then choose to act upon these messages or not. Errors on the other hand interrupt the compilation process, the Intel® C++ Compiler attempting to continue but with no linking taking place. These errors must be corrected before an executable file can be made.

For a diagnostic message the Intel® C++ Compiler will display the name of the source file and the line to which the diagnostic refers, a diagnostic number, and a brief description of the problem. A typical diagnostic message has the following format:

filename(linenumber): type [#nn]: message

with

    filename
    Name of source file being compiled.
    linenumber
    Line number of source file to which diagnostic refers.
    type
    Type of diagnostic (remark, warning or error).
    #nn
    Number of diagnostic (hard errors do not have numbers associated with them)
    message
    Brief description of problem.

Example

The following example shows you how to generate remarks with the compiler by setting option /W5

ccxscce alpha.c /W5

can generate the following output

alpha.c:
alpha.c(257): remark #177: variable "inst" was declared but never referenced.

The compiler can also issue internal error messages on the standard error stream; these take the form:

FATAL COMPILER ERROR: message

Should this occur contact Intel customer support for advice.


Controlling the Severity of the Diagnostics

The compiler returns two types of diagnostics:

Hard errors An error diagnostic is always generated if the source code is definitely wrong or questionable. Hard errors do not have any message numbers associated with them. A hard error leads to a direct abort.

Soft errors All other diagnostics, including warnings and remarks, are considered soft diagnostics, and these always have message numbers associated with them. Their severity can be changed by use of the options described in the table below.

Table: Soft Error Severity Changes
/Qwdnumber{,number} | Disable the diagnostics having the listed corresponding numbers
/Qwrnumber{,number} | Override the severity of the diagnostics having the listed corresponding numbers, and make them to remarks
/Qwwnumber{,number} | Override the severity of the diagnostics having the listed corresponding numbers, and make them to warnings
/Qwenumber{,number} | Override the severity of the diagnostics having the listed corresponding numbers, and make them to errors
Example

In the following example the soft diagnostics numbered 68 and 152 have their severity changed to be remarks only while the source file alpha.c is being compiled and linked:

ccxscce /Qwr68,152 alpha.c
Note icon NOTE.
Only soft diagnostic messages, those having numbers generated with them, can have their severity changed. Should it not be known if a particular message carries a number, that is if it is a soft diagnostic, then in the first instance the compiler can be allowed to generate the message, with its error number. Once the soft errors are identified the compilation can be repeated with any changes of severity made that are required to the soft diagnostic messages.
Example

The following compilation

ccxscce alpha.c

can produce a soft diagnostic message:

alpha.c:
alpha.c(341): warning#191: type qualifier is meaningless on cast type

This identifies this warning as being a soft diagnostic, that is it has a number generated with it. To remove this warning, you can reduce it to a remark. By default remarks are not generated by a compilation. You can repeat the above exercise to remove the warning.

ccxscce /Qwr191 alpha.c

will produce no diagnostic messages:

alpha.c


Messages

This section describes compiler information messages and diagnostic messages including remark, warning, and error messages.


Compiler Information Messages

These messages consist of the Intel® C++ Compiler start message and the help list of the more useful Intel® C++ Compiler options. Both messages are optional, being controlled by options on the command line.

The start message is controlled by the option /nologo. It disables the display of the compiler version (or start) message. When the compiler is invoked, it displays the following information:

ID The unique identification number for this compiler.

a.b.c Version number; for example: 2.3.10

Years Years for which the compiler is copyrighted.

The help list is controlled by the option /HELP or /?. It displays help messages. You can display a list of the most useful compiler options by specifying the /HELP (or /?) option to the compiler. To display this list, use this command:

ccxscce /HELP

or

ccxscce /?


Diagnostic Messages

Diagnostic messages provide syntactic and semantic information about your source text. Syntactic information can include syntax errors and use of nonstandard C or C++. Semantic information includes such things as unreachable code. Diagnostic messages can be any of the following:

  • Remark messages
  • Warning messages
  • Error message

The severity of some of the diagnostic messages can be changed by compiler options. Some warnings can become errors, and remarks become warnings.


Remark Messages

Remark messages report common but sometimes unconventional usage of the C/C++ language within the source code. Such remarks do not interfere with the compilation process, compilation and linking proceed to their final stages producing the required output files with no alterations.

The compiler does not generate remark messages unless requested by specifying the /W option to be at level 4. That is option /W4 informational messages.

Example

Some examples of remark messages:

alpha.c (321): Remark #193: Zero used for undefined preprocessing identifier.
alpha.c (456): Remark #577: Use of local type to specify an exception.
alpha.c (501): Remark #981: Operands are evaluated in unspecified order.


Warning Messages

Warning messages report legal but questionable use of the C/C++ language within the source code. Such warnings do not interfere with the compilation process, compilation and linking proceed to their final stages producing the required output files with no alterations.

The Intel® C++ Compiler generates warning messages by default, unless suppressed by specifying the /W option to be at level 0. The option /W0 generates no warnings.

Example

Some examples of warning messages:

alpha.c (123): Warning #170: Pointer points outside of underlying object.
alpha.c (321): Warning #457: Delete of pointer to incomplete class.
alpha.c (405): Warning #945: Type qualifier ignored.


Error Messages

Error messages report C/C++ language syntactic and semantic errors within the source code. Such errors suppress the generation of object code for the source module in which the error occurred, but parsing continues to allow any other errors to be found.

The Intel® C++ Compiler error messages cannot be suppressed.

Example

Some examples of error messages:

alpha.c (101): Error #226: asm macro parameter must have basic or pointer type.
alpha.c (235): Error #611: Invalid C output file.
alpha.c (312): Error #936: A variable length array cannot have static storage duration.