Intel(R) C++ Intrinsic Reference
Total Page:16
File Type:pdf, Size:1020Kb
Intel® C++ Intrinsic Reference Document Number: 312482-003US Disclaimer and Legal Information INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL® PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. 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. UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR. Intel may make changes to specifications and product descriptions at any time, without notice. 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 information here is subject to change without notice. Do not finalize a design with this information. The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request. Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order. Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or by visiting Intel's Web Site. Intel processor numbers are not a measure of performance. Processor numbers differentiate features within each processor family, not across different processor families. See http://www.intel.com/products/processor_number for details. BunnyPeople, Celeron, Celeron Inside, Centrino, Centrino logo, Core Inside, FlashFile, i960, InstantIP, Intel, Intel logo, Intel386, Intel486, Intel740, IntelDX2, IntelDX4, IntelSX2, Intel Core, Intel Inside, Intel Inside logo, Intel. Leap ahead., Intel. Leap ahead. logo, Intel NetBurst, Intel NetMerge, Intel NetStructure, Intel SingleDriver, Intel SpeedStep, Intel StrataFlash, Intel Viiv, Intel vPro, Intel XScale, IPLink, Itanium, Itanium Inside, MCS, MMX, Oplus, OverDrive, PDCharm, Pentium, Pentium Inside, skoool, Sound Mark, The Journey Inside, VTune, Xeon, and Xeon Inside are trademarks of Intel Corporation in the U.S. and other countries. * Other names and brands may be claimed as the property of others. Copyright (C) 1996–2007, Intel Corporation. All rights reserved. Portions Copyright (C) 2001, Hewlett-Packard Development Company, L.P. Table Of Contents Overview: Intrinsics Reference......................................................................... 1 Intrinsics for Intel® C++ Compilers............................................................... 1 Availability of Intrinsics on Intel Processors ..................................................... 1 Details about Intrinsics ................................................................................... 2 Registers ................................................................................................... 2 Data Types................................................................................................. 2 New Data Types Available.......................................................................... 2 __m64 Data Type..................................................................................... 3 __m128 Data Types.................................................................................. 3 Data Types Usage Guidelines ..................................................................... 3 Accessing __m128i Data............................................................................ 3 Naming and Usage Syntax .............................................................................. 5 References.................................................................................................... 7 Intrinsics for Use across All IA.......................................................................... 8 Overview: Intrinsics for All IA........................................................................ 8 Integer Arithmetic Intrinsics ......................................................................... 8 Floating-point Intrinsics................................................................................ 9 String and Block Copy Intrinsics ...................................................................11 Miscellaneous Intrinsics...............................................................................12 MMX(TM) Technology Intrinsics.......................................................................15 Overview: MMX(TM) Technology Intrinsics .....................................................15 The EMMS Instruction: Why You Need It........................................................15 Why You Need EMMS to Reset After an MMX(TM) Instruction .........................15 EMMS Usage Guidelines ..............................................................................16 iii Table Of Contents MMX(TM) Technology General Support Intrinsics.............................................16 MMX(TM) Technology Packed Arithmetic Intrinsics ..........................................18 MMX(TM) Technology Shift Intrinsics.............................................................20 MMX(TM) Technology Logical Intrinsics..........................................................23 MMX(TM) Technology Compare Intrinsics.......................................................23 MMX(TM) Technology Set Intrinsics...............................................................24 MMX(TM) Technology Intrinsics on IA-64 Architecture .....................................27 Data Types................................................................................................27 Streaming SIMD Extensions............................................................................28 Overview: Streaming SIMD Extensions..........................................................28 Floating-point Intrinsics for Streaming SIMD Extensions...................................28 Arithmetic Operations for Streaming SIMD Extensions .....................................28 Logical Operations for Streaming SIMD Extensions..........................................32 Comparisons for Streaming SIMD Extensions .................................................33 Conversion Operations for Streaming SIMD Extensions ....................................42 Load Operations for Streaming SIMD Extensions.............................................46 Set Operations for Streaming SIMD Extensions...............................................47 Store Operations for Streaming SIMD Extensions............................................49 Cacheability Support Using Streaming SIMD Extensions...................................50 Integer Intrinsics Using Streaming SIMD Extensions........................................51 Intrinsics to Read and Write Registers for Streaming SIMD Extensions ...............54 Miscellaneous Intrinsics Using Streaming SIMD Extensions ...............................55 Using Streaming SIMD Extensions on IA-64 Architecture..................................56 Data Types .............................................................................................57 Compatibility versus Performance ..............................................................57 iv Table Of Contents Macro Functions............................................................................................59 Macro Function for Shuffle Using Streaming SIMD Extensions ...........................59 Shuffle Function Macro .............................................................................59 View of Original and Result Words with Shuffle Function Macro.......................59 Macro Functions to Read and Write the Control Registers .................................59 Exception State Macros with _MM_EXCEPT_DIV_ZERO..................................60 Macro Function for Matrix Transposition.........................................................61 Matrix Transposition Using _MM_TRANSPOSE4_PS Macro ..............................61 Streaming SIMD Extensions 2 .........................................................................62 Overview: Streaming SIMD Extensions 2 .......................................................62 Floating-point Intrinsics...............................................................................63 Floating-point Arithmetic Operations for Streaming SIMD Extensions 2............63 Floating-point Logical Operations for Streaming SIMD Extensions 2 ................66 Floating-point Comparison Operations for Streaming SIMD Extensions 2..........67 Floating-point Conversion Operations for Streaming SIMD Extensions 2...........74 Floating-point Load Operations for Streaming SIMD Extensions 2 ...................78 Floating-point Set Operations for Streaming SIMD Extensions 2 .....................80 Floating-point Store Operations for Streaming SIMD Extensions 2 ..................81 Integer Intrinsics........................................................................................83