Altivec Technology Programming Interface Manual MOTOROLA
Total Page:16
File Type:pdf, Size:1020Kb
Freescale Semiconductor, Inc. ALTIVECPIM/D 6/1999 Rev. 0 . c n ™ I AltiVec Technology , r o Programming Interface Manual t c u d n o c i m e S e l a c s e e r F ™ For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. c n I , r o t c u d DigitalDNA and Mfax are trademarks of Motorola, Inc. n The PowerPC name and the PowerPC logotype are trademarks of International Business Machines Corporation used by Motorola under license from o International Business Machines Corporation. c i This document contains information on a new product under development. Motorola reserves the right to change or discontinue this product without notice. m Information in this document is provided solely to enable system and software implementers to use PowerPC microprocessors. There are no express or implied copyright licenses granted hereunder to design or fabricate PowerPC integrated circuits or integrated circuits based on the information in this e document. S Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Motorola assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. “Typical” parameters can and do e vary in different applications. All operating parameters, including “Typicals” must be validated for each customer application by customer’s technical l experts. Motorola does not convey any license under its patent rights nor the rights of others. Motorola products are not designed, intended, or authorized a for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a situation where personal injury or death may occur. Should Buyer purchase or use c Motorola products for any such unintended or unauthorized application, Buyer shall indemnify and hold Motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, s any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Motorola was negligent e regarding the design or manufacture of the part. Motorola and are registered trademarks of Motorola, Inc. Motorola, Inc. is an Equal Opportunity/ Affirmative Action Employer. e r Motorola Literature Distribution Centers: USA/EUROPE: Motorola Literature Distribution; P.O. Box 5405; Denver, Colorado 80217; Tel.: 1-800-441-2447 or 1-303-675-2140/ F JAPAN: Nippon Motorola Ltd SPD, Strategic Planning Office 4-32-1, Nishi-Gotanda Shinagawa-ku, Tokyo 141, Japan Tel.: 81-3-5487-8488 ASIA/PACIFC: Motorola Semiconductors H.K. Ltd.; 8B Tai Ping Industrial Park, 51 Ting Kok Road, Tai Po, N.T., Hong Kong; Tel.: 852-26629298 Mfaxª: [email protected]; TOUCHTONE 1-602-244-6609; US & Canada ONLY (800) 774-1848; World Wide Web Address: http://sps.motorola.com/mfax INTERNET: http://motorola.com/sps Technical Information: Motorola Inc. SPS Customer Support Center 1-800-521-6274; electronic mail address: [email protected]. Document Comments: FAX (512) 895-2638, Attn: RISC Applications Engineering. World Wide Web Addresses: http://www.mot.com/PowerPC http://www.mot.com/netcomm http://www.mot.com/HPESD © Motorola Inc. 1999. All rights reserved. For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Overview 1 High-Level Language Interface 2 Application Binary Interface 3 . c AltiVec Operations and Predicates 4 n I , r o t c AltiVec Instruction Set/Operations/Predicates Cross-Reference A u d n Glossary of Terms and Abbreviations GLO o c i m Index IND e S e l a c s e e r F For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. 1 Overview 2 High-Level Language Interface 3 Application Binary Interface . 4 AltiVec Operations and Predicates c n I , r o t A AltiVec Instruction Set/Operations/Predicates Cross-Reference c u d GLO Glossary of Terms and Abbreviations n o c i IND Index m e S e l a c s e e r F For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. CONTENTS Paragraph Page Title Number Number Audience .............................................................................................................. xvi Organization......................................................................................................... xvi Suggested Reading.............................................................................................. xvii PowerPC Documentation................................................................................ xvii General Information....................................................................................... xviii . Chapter 1 . Overview c n 1.1 High-Level Language Interface ........................................................................... 1-1 I 1.2 Application Binary Interface (ABI)..................................................................... 1-2 , r o Chapter 2 t High-Level Language Interface c u 2.1 Data Types ........................................................................................................... 2-1 d 2.2 New Keywords..................................................................................................... 2-2 2.2.1 The Keyword and Predefine Method............................................................... 2-2 n 2.2.2 The Context Sensitive Keyword Method......................................................... 2-3 o 2.3 Alignment ............................................................................................................ 2-3 c i 2.3.1 Alignment of Vector Types ............................................................................. 2-3 2.3.2 Alignment of Non-Vector Types ..................................................................... 2-3 m 2.3.3 Alignment of Aggregates and Unions Containing Vector Types.................... 2-3 e 2.4 Extensions of C/C++ Operators for the New Types............................................ 2-4 S 2.4.1 sizeof() ............................................................................................................. 2-4 2.4.2 Assignment ...................................................................................................... 2-4 e l 2.4.3 Address Operator ............................................................................................. 2-4 a 2.4.4 Pointer Arithmetic............................................................................................ 2-4 c 2.4.5 Pointer Dereferencing...................................................................................... 2-4 s 2.4.6 Type Casting.................................................................................................... 2-5 e 2.5 New Operators ..................................................................................................... 2-5 e 2.5.1 Vector Literals ................................................................................................. 2-5 r 2.5.2 Vector Literals and Casts................................................................................. 2-6 F 2.5.3 Value for Adjusting Pointers ........................................................................... 2-7 2.5.4 New Operators Representing AltiVec Operations........................................... 2-7 2.6 Programming Interface ........................................................................................ 2-8 Chapter 3 Application Binary Interface (ABI) 3.1 Data Representation............................................................................................. 3-1 3.2 Register Usage Conventions................................................................................ 3-1 MOTOROLA Contents v For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. CONTENTS Paragraph Page Title Number Number 3.3 The Stack Frame .................................................................................................. 3-2 3.3.1 SVR4 ABI and EABI Stack Frame.................................................................. 3-3 3.3.2 Apple Macintosh ABI and AIX ABI Stack Frame.......................................... 3-5 3.3.3 Vector Register Saving and Restoring Functions............................................ 3-7 3.4 Function Calls ...................................................................................................... 3-9 3.4.1 SVR4 ABI and EABI Parameter Passing and Varargs.................................... 3-9 3.4.2 Apple Macintosh ABI and AIX ABI Parameter Passing without Varargs...... 3-9 . 3.4.3 Apple Macintosh ABI and AIX ABI Parameter Passing with Varargs......... 3-10 . 3.5 malloc(), vec_malloc(), and new ....................................................................... 3-10 c 3.6 setjmp() and longjmp() ...................................................................................... 3-11 n 3.7 Debugging Information...................................................................................... 3-11 I 3.8 printf() and scanf() Control Strings...................................................................