Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Introduction to AltiVec/SSE Migration Guide
AltiVec/SSE Migration Guide will assist experienced developers who need to migrate their vector-oriented code from the PowerPC AltiVec extensions to the Intel x86 SSE extensions. Both of these are sets of SIMD (single instruction, multiple data) instructions, accessible through C intrinsics. The instructions operate on special sets of 128-bit registers that can be used to hold vectors of smaller-sized data, to be operated on in parallel.
The two sets of instructions serve the same purposes, but are implemented differently; porting of algorithms from one to the other must be done carefully.
Most work involving vector-oriented calculations can be done via Apple’s Accelerate frameworks, which provide higher-level functions for image processing, signal processing, linear algebra, vector math, and operations on large numbers. The advantage of using these frameworks is that the hardware dependencies are abstracted away by highly optimized library code that will be maintained not only for PowerPC and Apple’s initial Intel processors, but also for future processors.
Developers who have already written AltiVec code should consider adopting the Accelerate frameworks, instead of porting to SSE. However, some developers will need to port their code, or to write new AltiVec and SSE versions of new algorithms. Similarly, those who are porting Windows applications to Mac OS X may need to port existing SSE code to AltiVec.
Who Should Read This Document
Any developer who needs to port existing AltiVec code to SSE or vice versa, or who needs to write custom-optimized code for both architectures.
Organization of This Document
This document is organized into the following chapters:
AltiVec to SSE Migration Overview This chapter introduces basic information on migrating vector-oriented code from the PowerPC AltiVec extensions to the Intel x86 SSE extensions.
Programming SSE in C This chapter describes the intrinsics and data types provided for programming SSE in C.
Translating Altivec to SSE This chapter provides in-depth tutorial information on translating AltiVec to to SSE code.
Assumptions
The document assumes the following:
Your application runs in Mac OS X.
Your application can use any of the Mac OS X development environments: Carbon, Cocoa, Java, or BSD UNIX.
If your application runs in a version of the Mac OS that is earlier than Mac OS X version 10.0, you should first read Carbon Porting Guide and Technical Note TN2003 Moving Your Code to Mac OS X.
If your application runs in the UNIX operating system but not specifically in Mac OS X, you should first read Porting UNIX/Linux Applications to Mac OS X.
If your application runs only in the Windows operating system, you should first read Porting to Mac OS X from Windows Win32 API.
You know how to use Xcode.
Currently Xcode is the only GUI tool available that compiles code to run universally.
If you are unfamiliar with Xcode, you might want to take a look at Xcode 2.1 User Guide.
If you have been using CodeWarrior, you should read Moving Projects from CodeWarrior to Xcode.
Conventions
The term x86 is a generic term used in some parts of this book to refer to the class of microprocessors manufactured by Intel. This book uses the term x86 as a synonym for IA-32 (Intel Architecture 32-bit).
Copyright © 2005 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2005-09-08