Power Vector Intrinsic Programming Reference
Total Page:16
File Type:pdf, Size:1020Kb
REVIEW DRAFT www.openpowerfoundation.org Power Vector Intrinsic Program- February 11, 2020 Revision 1.0.0_prd2 ming Reference Power Vector Intrinsic Programming Reference System Software Work Group <[email protected]> OpenPower Foundation Revision 1.0.0_prd2 (February 11, 2020) Copyright © 2017-2020 OpenPOWER Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 REVIEW DRAFT - Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. The limited permissions granted above are perpetual and will not be revoked by OpenPOWER or its successors or assigns. This document and the information contained herein is provided on an "AS IS" basis AND TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE OpenPOWER Foundation AS WELL AS THE AUTHORS AND DEVELOPERS OF THIS STANDARDS FINAL DELIVERABLE OR OTHER DOCUMENT HEREBY DISCLAIM ALL OTHER WARRANTIES AND CONDITIONS, EITHER EXPRESS, REVIEW DRAFT - IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES, DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF WORKMANLIKE EFFORT, OF LACK OF VIRUSES, OF LACK OF NEGLIGENCE OR NON-INFRINGEMENT. OpenPOWER, the OpenPOWER logo, and openpowerfoundation.org are trademarks or registered trademarks of OpenPOWER Foundation, Inc., registered in many jurisdictions worldwide. Other company, product, and service names may be trademarks or service marks of others. Abstract The purpose of this document is to provide a guide for vector programming on OpenPOWER systems, with an emphasis on examples of best practices. It further provides a reference for intrinsics provided by compliant compilers on OpenPOWER systems. REVIEW DRAFT - This document is a Standard Track, Work Group Specification work product owned by the System Software Workgroup and handled in compliance with the requirements outlined in the OpenPOWER Foundation Work Group (WG) Process document. It was created using the Master Template Guide version 1.0.0. Comments, questions, etc. can be submitted to the public mailing list for this document at <[email protected]>. REVIEW DRAFT - Workgroup Specification OpenPOWER Foundation ii Standard Track REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - Power Vector Intrinsic Program- February 11, 2020 Revision 1.0.0_prd2 ming Reference Table of Contents Preface .......................................................................................................................................... ix 1. Conventions ...................................................................................................................... ix 2. Document change history ................................................................................................... x 1. Introduction to Vector Programming on Power ........................................................................... 1 1.1. A Brief History ................................................................................................................. 1 1.1.1. Little-Endian Linux ................................................................................................ 2 1.2. The Unified Vector Register Set ...................................................................................... 2 REVIEW DRAFT - 1.3. Where to Report Bugs .................................................................................................... 3 1.4. Useful Links .................................................................................................................... 3 1.5. Conformance to this Specification ................................................................................... 4 2. The Power Bi-Endian Vector Programming Model ...................................................................... 5 2.1. Language Elements ........................................................................................................ 5 2.2. Vector Data Types .......................................................................................................... 6 2.3. Vector Operators ............................................................................................................. 7 2.4. Vector Layout and Element Numbering ........................................................................... 7 2.5. Vector Built-In Functions ................................................................................................. 8 2.5.1. Extended Data Movement Functions .................................................................... 9 2.5.2. Big-Endian Vector Layout in Little-Endian Environments (Deprecated) .................. 9 2.6. Language-Specific Vector Support for Other Languages ............................................... 10 REVIEW DRAFT - 2.6.1. Fortran ............................................................................................................... 10 2.7. Examples and Limitations ............................................................................................. 11 2.7.1. Unaligned vector access .................................................................................... 11 2.7.2. vec_sld is not bi-endian ...................................................................................... 11 2.7.3. Limitations on bi-endianness of vec_perm .......................................................... 12 3. Vector Programming Techniques .............................................................................................. 14 3.1. Help the Compiler Help You .......................................................................................... 14 3.2. Use Portable Intrinsics .................................................................................................. 15 3.3. Use Assembly Code Sparingly ...................................................................................... 15 3.4. Other Vector Programming APIs ................................................................................... 16 3.4.1. x86 Vector Portability Headers ........................................................................... 16 3.4.2. The Power Vector Library (pveclib) ..................................................................... 16 4. Vector Intrinsic Reference ........................................................................................................ 17 REVIEW DRAFT - 4.1. How to Use This Reference .......................................................................................... 17 4.2. Built-In Vector Functions ............................................................................................... 19 5. Instruction/Intrinsic Cross-Reference ...................................................................................... 251 A. OpenPOWER Foundation overview ....................................................................................... 276 A.1. Foundation documentation .......................................................................................... 276 A.2. Technical resources .................................................................................................... 276 A.3. Contact the foundation ................................................................................................ 277 REVIEW DRAFT - Workgroup Specification OpenPOWER Foundation iii Standard Track REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - Power Vector Intrinsic Program- February 11, 2020 Revision 1.0.0_prd2 ming Reference List of Figures 1.1. Floating-Point Registers as Part of VSRs ................................................................................ 2 1.2. Vector Registers as Part of VSRs ........................................................................................... 3 4.1. Operation of vec_gb ............................................................................................................ 115 REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - Workgroup Specification OpenPOWER Foundation iv Standard Track REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - REVIEW DRAFT - Power Vector Intrinsic Program- February 11, 2020 Revision 1.0.0_prd2 ming Reference List of Tables 2.1. Vector Types ........................................................................................................................... 6 2.2. VMX Memory Access Built-In Functions .................................................................................. 9 2.3. Fortran Vector Data Types .................................................................................................... 10 2.4. Built-In Vector Conversion Functions ..................................................................................... 10 4.1. Supported type signatures for vec_abs ................................................................................