AltiVec Technology. AltiVec is a trademark of Motorola, Inc.

Similar documents
PowerPC 740 and 750

1. PowerPC 970MP Overview

1. Microprocessor Architectures. 1.1 Intel 1.2 Motorola

Storage I/O Summary. Lecture 16: Multimedia and DSP Architectures

Media Instructions, Coprocessors, and Hardware Accelerators. Overview

Intel s MMX. Why MMX?

6x86 PROCESSOR Superscalar, Superpipelined, Sixth-generation, x86 Compatible CPU

Pipelining and Vector Processing

Contents of Lecture 11

CPE300: Digital System Architecture and Design

Advanced processor designs

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

CS6303 Computer Architecture Regulation 2013 BE-Computer Science and Engineering III semester 2 MARKS

Inside Intel Core Microarchitecture

Chapter 13 Reduced Instruction Set Computers

Processing Unit CS206T

Like scalar processor Processes individual data items Item may be single integer or floating point number. - 1 of 15 - Superscalar Architectures

EE382 Processor Design. Concurrent Processors

Instruction Set Architecture (ISA) for MAHA

The Nios II Family of Configurable Soft-core Processors

Universität Dortmund. ARM Architecture

Chapter 2: Data Manipulation

Intel 64 and IA-32 Architectures Software Developer s Manual

TDT Coarse-Grained Multithreading. Review on ILP. Multi-threaded execution. Contents. Fine-Grained Multithreading

Vertex Shader Design I

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

INSTITUTO SUPERIOR TÉCNICO. Architectures for Embedded Computing

RISC Processors and Parallel Processing. Section and 3.3.6

Digital Semiconductor Alpha Microprocessor Product Brief

Parallel Computing: Parallel Architectures Jin, Hai

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation

A brief History of INTEL and Motorola Microprocessors Part 1

This Material Was All Drawn From Intel Documents

DSP Platforms Lab (AD-SHARC) Session 05

Higher Level Programming Abstractions for FPGAs using OpenCL

PERFORMANCE ANALYSIS OF ALTERNATIVE STRUCTURES FOR 16-BIT INTEGER FIR FILTER IMPLEMENTED ON ALTIVEC SIMD PROCESSING UNIT

CMSC 611: Advanced Computer Architecture

Topics in computer architecture

Thomas Polzer Institut für Technische Informatik

ConnX D2 DSP Engine. A Flexible 2-MAC DSP. Dual-MAC, 16-bit Fixed-Point Communications DSP PRODUCT BRIEF FEATURES BENEFITS. ConnX D2 DSP Engine

Next Generation Technology from Intel Intel Pentium 4 Processor

Architectural Performance. Superscalar Processing. 740 October 31, i486 Pipeline. Pipeline Stage Details. Page 1

Implementation of DSP Algorithms

Instruction Set Architecture. "Speaking with the computer"

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

This section covers the MIPS instruction set.

Intel 64 and IA-32 Architectures Software Developer s Manual

Advanced d Instruction Level Parallelism. Computer Systems Laboratory Sungkyunkwan University

ENGN1640: Design of Computing Systems Topic 06: Advanced Processor Design

Instruction Sets: Characteristics and Functions

Fundamental CUDA Optimization. NVIDIA Corporation

MIPS R5000 Microprocessor. Technical Backgrounder. 32 kb I-cache and 32 kb D-cache, each 2-way set associative

The ARM10 Family of Advanced Microprocessor Cores

VIII. DSP Processors. Digital Signal Processing 8 December 24, 2009

Chapter 06: Instruction Pipelining and Parallel Processing. Lesson 14: Example of the Pipelined CISC and RISC Processors

COPROCESSOR APPROACH TO ACCELERATING MULTIMEDIA APPLICATION [CLAUDIO BRUNELLI, JARI NURMI ] Processor Design

Programmable Logic Design Grzegorz Budzyń Lecture. 15: Advanced hardware in FPGA structures

COSC 6385 Computer Architecture - Memory Hierarchy Design (III)

Job Posting (Aug. 19) ECE 425. ARM7 Block Diagram. ARM Programming. Assembly Language Programming. ARM Architecture 9/7/2017. Microprocessor Systems

REAL TIME DIGITAL SIGNAL PROCESSING

Microprocessors vs. DSPs (ESC-223)

Chapter 4. MARIE: An Introduction to a Simple Computer

Real instruction set architectures. Part 2: a representative sample

Computer Architecture: SIMD and GPUs (Part I) Prof. Onur Mutlu Carnegie Mellon University

Vector IRAM: A Microprocessor Architecture for Media Processing

AMD Extensions to the. Instruction Sets Manual

Computer and Hardware Architecture I. Benny Thörnberg Associate Professor in Electronics

Microprocessor Extensions for Wireless Communications

PowerPC TM 970: First in a new family of 64-bit high performance PowerPC processors

Using Intel Streaming SIMD Extensions for 3D Geometry Processing

ECE 486/586. Computer Architecture. Lecture # 7

UNIT 2 PROCESSORS ORGANIZATION CONT.

COMPUTER ORGANIZATION & ARCHITECTURE

Lode DSP Core. Features. Overview

FAST FIR FILTERS FOR SIMD PROCESSORS WITH LIMITED MEMORY BANDWIDTH

The S6000 Family of Processors

This Unit: Putting It All Together. CIS 371 Computer Organization and Design. Sources. What is Computer Architecture?

Advanced Computer Architecture

Enabling a Superior 3D Visual Computing Experience for Next-Generation x86 Computing Platforms One AMD Place Sunnyvale, CA 94088

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands

Floating Point Arithmetic

Co-processor Math Processor. Richa Upadhyay Prabhu. NMIMS s MPSTME February 9, 2016

C 1. Last time. CSE 490/590 Computer Architecture. Complex Pipelining I. Complex Pipelining: Motivation. Floating-Point Unit (FPU) Floating-Point ISA

Chapter 4. MARIE: An Introduction to a Simple Computer. Chapter 4 Objectives. 4.1 Introduction. 4.2 CPU Basics

PIPELINE AND VECTOR PROCESSING

MARIE: An Introduction to a Simple Computer

Design and Implementation of a Super Scalar DLX based Microprocessor

Advance CPU Design. MMX technology. Computer Architectures. Tien-Fu Chen. National Chung Cheng Univ. ! Basic concepts

The Processor: Instruction-Level Parallelism

Media Signal Processing

CPE300: Digital System Architecture and Design

EC 513 Computer Architecture

The VIS TM Instruction Set

Superscalar Processor

Chapter 3. Arithmetic Text: P&H rev

s complement 1-bit Booth s 2-bit Booth s

Module 2. Embedded Processors and Memory. Version 2 EE IIT, Kharagpur 1

16.1. Unit 16. Computer Organization Design of a Simple Processor

Chapter Introduction

06-2 EE Lecture Transparency. Formatted 14:50, 4 December 1998 from lsli

Transcription:

AltiVec Technology On May 7, 1998, Motorola disclosed a new technology which integrates into the existing PowerPC Architecture a new high bandwidth, parallel operation vector execution unit Motorola s new AltiVec technology expands the capabilities of PowerPC Microprocessors by providing leading-edge, general-purpose processing performance while concurrently addressing high-bandwidth data processing and algorithmic-intensive computations in a single-chip solution Branding of the new AltiVec technology defines and expresses Motorola s leadership and long-term commitment to the PowerPC Architecture and its customers AltiVec is a trademark of Motorola, Inc.

AltiVec Technology in in Publications The ability to access a high-performance vector unit in addition to the integer and floating point units in the RISC core provides a leap in performance beyond the traditional advances in CPU clock frequency... In the end, AltiVec should have a profound impact on digital signal processing applications that require both flexibility and performance. The fact that it will be available in a high-performance general-purpose RISC processor is icing on the cake. Richard Jaenicke, SKY Computers, Real Time Computing 5/98. Jim Turley, a senior editor at Microprocessor Report, said AltiVec is similar to MMX, but it doubles the amount of data that can be processed in the MMX technology. Turley said that as the PowerPC Architecture moves further away from the desktop, its network capabilities will become more important. AltiVec makes PowerPC a much more interesting Alternative than it was just last week, Turley said. It really does bring quite a lot to the party. Austin American Statesman 5/8/98. Think of the chip as having a doorway in and out of the chip that s 32 bits wide, but the hallways are 128 bits wide, Turley offers. Once data is moved out of (main memory) and into the chip, they can really swing lots of data around and do special number crunching, more so than other chips. CNET 5/6/98.

Technology Introduction Development of AltiVec technology was driven by customer demands for next-generation performance for high bandwidth applications Motorola s premier installed base and long term customer relationships in the networking and telecommunications markets provide early and widespread design win opportunities Combination of the powerful superscalar PowerPC microprocessor core with the new functionality provided by AltiVec technology on a single chip creates a unique new product class This new class of product will enable new microprocessor applications and performance levels through ultra-high bandwidth and parallel data manipulation Provides leading edge general purpose processing performance while concurrently addressing high-bandwidth data handling processing and algorithmic intensive computations in a single chip solution Targets networking, computing and other performance-driven applications The existing comprehensive tool vendor support for PowerPC Architecture will be leveraged to rapidly deliver full infrastructure support for the AltiVec technology Motorola is working with leading tools providers to develop simulators, assemblers, linkers and compilers to assure full support for the AltiVec technology

Goals of AltiVec Meet computational demands of networking infrastructure Enable faster, more secure encryption methods optimized for SIMD processing model Provide compelling performance on multimedia-oriented desktop computers, desktop publishing, and digital video processing Enable real-time processing of the most demanding data streams (MPEG-2 decode, continuous speech recognition, real-time, highresolution 3D graphics...)

What is is a Vector Architecture? A vector architecture allows the simultaneous processing of many data items in parallel Vector architecture has roots in supercomputing, which attempted to extract large amounts of parallelism from software Massive parallel capabilities but limited data types Great for computation intensive applications but not for systems requiring more diverse processing and real-time constraints Operations are performed on multiple data elements by a single instruction referred to as Single Instruction Multiple Data (SIMD) parallel processing AltiVec technology is a short vector architecture Uses 128-bit wide registers to provide 4-, 8-, or 16-way parallelism Supports a wide variety of data types SIMD extension to PowerPC ISA Processes multiple data streams/blocks in a single cycle Common approach to accelerate processing of next-gen data types (audio, video, packet data)

Benefits of AltiVec Provides a single high-performance RISC microprocessor with DSP-like compute power for controller and signal processing functions Supplements the performance-leading PowerPC architecture with a new class of execution unit New vector processing engine provides for highly parallel operations, allowing for the simultaneous execution of up to 16 operations in a single clock cycle Can accelerate many traditional computing and embedded processing operations with its wide datapaths and wide field operations Provides product designers and customers with a new one part one code base approach to product design while also providing a tremendous jump in performance Offers a programmable solution that can easily migrate via software upgrades to follow changing standards and customer requirements Because this integrated solution is still 100% compatible with the industry standard PowerPC architecture, design and support are simplified Leverage PowerPC compatibility and legacy code, add AltiVec performance as you need it

AltiVec A Solution to to Many Embedded Computing Problems Access Concentrators/DSLAMs ADSL and Digital Data Concentrators Speech Recognition Voice/Sound Processing Image and Video Processing Array Numeric Processing Basestation Processing Infrastructure

AltiVec The Best Solution to to Computing Problems High bandwidth data communications Realtime Continuous Speech I/O HMM, Viterbi Acceleration, Neural Algorithms Soft-Modem V.34, 56K 3D Graphics Games, Entertainment High precision CAD Virtual Reality Motion Video MPEG2, MPEG4 H.234 High Fidelity Audio 3D Audio, AC-3 Machine Intelligence

AltiVec Features Provides SIMD (Single Instruction, Multiple Data) functionality for embedded applications with massive data processing needs Key elements of Motorola s AltiVec technology include: 128-bit vector execution unit with 32-entry 128-bit register file Parallel processing with Vector permute unit and Vector ALU 162 new instructions New data types:» Packed byte, halfword, and word integers» Packed IEEE single-precision floats Saturation arithmetic Simplified architecture No interrupts other than data storage interrupt on loads and stores No hardware unaligned access support No penalty for running AltiVec and standard PowerPC instructions simultaneously Streamlined architecture to facilitate efficient implementation Maintains PowerPC architecture s RISC register-to-register programming model

AltiVec Features Supports parallel operation on byte, halfword, word and 128-bit operands Intra and inter-element arithmetic instructions Intra and inter-element conditional instructions Powerful Permute, Shift and Rotate instructions Vector integer and floating-point arithmetic Data types» 8-, 16- and 32-bit signed- and unsigned-integer data types» 32-bit IEEE single-precision floating-point data ype» 8-, 16-, and 32-bit Boolean data types (e.g. 0xFFFF % 16-bit TRUE) Modulo & saturation integer arithmetic 32-bit IEEE-default single-precision floating-point arithmetic» IEEE-default exception handling» IEEE-default round-to-nearest» fast non-ieee mode (e.g. denorms flushed to zero) Control flow with highly flexible bit manipulation engine Compare creates field mask used by select function Compare Rc bit enables setting Condition Register» Trivial accept/reject in 3D graphics» Exception detection via software polling

AltiVec s Vector Execution Unit Instruction Stream IU GPRs 32 Dispatch FPU FPRs 64 Vector Unit Vector Register File 32 64 128 PowerPC Execution Flow 128 bits Cache / Memory Concurrency with integer and floating-point units Separate, dedicated 32 128-bit vector registers Larger namespace = reduced register pressure/spillage Longer vector length = more data-level parallelism Separate files can all be accessed by execution units in parallel Deeper register files allow more sophisticated software optimizations No penalty for mingling integer, floating point and AltiVec technology operations

128-bit Vector Architecture 128-bit wide data paths between L1 cache, L2 cache, Load/Store Units and Registers Wider data paths speed save and restore operations Offers SIMD processing support for 16-way parallelism for 8-bit signed and unsigned integers and characters 8-way parallelism for 16-bit signed and unsigned integers 4-way parallelism for 32-bit signed and unsigned integers and IEEE floating point numbers Two fully pipelined independent execution units Vector Permute Unit is a highly flexible byte manipulation engine Vector ALU (Arithmetic Logical Unit) performs up to 16 operations in a single clock cycle» Contains Vector Simple Fixed-Point, Vector Complex Fixed-Point, and Vector Floating-Point execution engines Dual Altivec instruction issue: One arithmetic, one permute

Sample Based Processing SISD AC3 - Audio Decode do { decode ( channel 1 ) decode ( channel 2 ) decode ( channel 3 ) decode ( channel 4 ) decode ( channel 5 ) decode ( channel 6 ) } while (Amplifier is on; step time) do { SIMD AC3 - Audio Decode decode (ch 1, ch2, c3, c4, c5, c6) } while (Amplifier is on; step time) Approx 6x performance improvement.

Simplified Systems Design Existing DSP based systems model is Single MPU with Multiple DSPs 2 different architectures, software code bases, and hardware types DSPs limit frequency and algorithm support Upgrades in performance require new hardware, and at least 1 major software change Result: High-cost upgrades, slow time-to-market, in-field hardware swap required New Model is Single or Multiple MPUs One architecture, one code base, and one hardware type Very high frequency with total algorithm support Performance upgrades available with only a software change Result: Low cost upgrades, fast time-to-market, no in-field hardware swap

AltiVec Instruction Set Features 162 new instructions added to the PowerPC ISA 4-operand, non-destructive instructions Up to three source operands and a single destination operand Supports advanced multiply-add/sum and permute primitives All instructions fully pipelined with single-cycle throughput Simple ops: 1 cycle latency Compound ops: 3-4 cycle latency No restriction on issue with scalar instructions Enhanced cache/memory interface Software hints for data re-use probability Prefetch support (stride-n access) Simplified load/store architecture Simple byte, halfword, word and quadword loads & stores No unaligned accesses software-managed via permute instruction

In In summary...... AltiVec Technology provides a robust instruction set In terms of operations In terms of data types and sizes In terms of other options (such as saturation, data movement) Allows a streamlined hardware implementation (cycle time, latency, throughput) AltiVec enables a broad range of embedded and computing applications

AltiVec Instruction Set Vector Intra-element Instructions Integer Arithmetic Instructions Floating-Point Arithmetic Instructions Conditional Control Flow Instructions Rotate, Shift and Logical Instructions Memory Access Instructions Vector Inter-element Instructions Permute Instruction Data Movement/Manipulation Instructions Integer Multiply Odd/Even Instructions Integer Multiply-Sum Instructions Integer Sum Across Instructions

SIMD Intra-element Instructions 16 x 8-bit elements VC op op op op op op op op op op op op op op op op 8 x 16-bit elements VC op op op op op op op op 4 x 32-bit elements VC op op op op

Integer Arithmetic Instructions VC op op op op op op op op Vector Byte Unsigned Add Modulo Subtract Halfword Signed Saturate Word Unsigned Word and Write Carry Out Byte Odd Unsigned Even Halfword Signed Multiply Word -Low-Add Unsigned Halfword Modulo -High[-Round]-Add Signed Halfword Saturate Byte Unsigned Average Halfword Signed Word

Multiply Odd and Even byte Multipy Odd half-word * * * * * * * * * * * * byte Multipy Even half-word * * * * * * * * * * * *

Multiply-High and Add * * * * * * * * prod s 17 16 s s s s s s s VC + + + + + + + + 16 temp sat Vector Multiply High-Add Signed Halfword Saturate vmhaddshs,,, VC

Multiply-High Round and Add * * * * * * * * prod s 18 17 16 s s s s s s s VC 0...01 0...01 0...01 0...01 0...01 0...01 0...01 0...01 const + + + + + + + + 16 temp sat Vector Multiply High-Round and Add Signed Halfword Saturate vmhraddshs,,, VC

Multiply Low and Add * * * * * * * * prod VC + + + + + + + + temp Vector Multiply-Low and Add Unsigned Halfword Modulo vmladduhm,,, VC

Floating-Point Arithmetic Instructions VC op op op op Add Subtract Multiply-Add Negative Multiply-Subtract Vector Reciprocal Reciprocal Square Root Estimate Log base 2 2 raised to Exponent Floating-Point Performs four 32-bit IEEE-default single-precision floating point arithmetic operations in parallel Pipelined 4-cycle latency for Add, Subtract, and Fused Multiply-Add

Floating-Point Conversion Instructions op op op op Vector Round to Floating-Point Integer Convert to Nearest toward Zero toward +infinity toward infinity To Unsigned From Signed Fixed-Point Word

Conditional Instructions Conditional Instructions Vector Compare EQ Unsigned GT Unsigned Signed Byte Halfword Word EQ GT GE Bounds Floating-Point and Record Select Maximum Minimum Unsigned Signed Byte Halfword Word Floating-Point VC op op op op op op op op

Compare-Select Supports IF-THEN-ELSE by computing results for both branch paths and then selecting correct path s results Reduces inefficient control flow feedback to branch unit Compare creates field masks target element set to ones where comparison is true target element set to zeroes where comparison false Select performs a bit-wise selection based on generated mask

Compare-Select vcmp,, vcmp = = = = = = = = 00...00 FF...FF 00...00 FF...FF 00...00 FF...FF 00...00 FF...FF vsel,,,vc...... vsel 01001100......... VC

Rc Bit Rc bit enables setting CR field 6 with summary comparison status CR bit 24 set if all compare result elements are equal to all ones CR bit 26 set if all compare result elements are equal to all zeroes Provides limited but critical control flow support Trivial accept/reject on 3D clipping 3D lighting Special handling of exceptions» Software polls for occurrence of saturation» Image processing application identified that needs to reset thresholds of other pixel components when one component saturates

Algorithmic Features vmsum vmx_cmpeq( vsum ) vsel vcmp vmx_sel( ) Vector Dot Product (FIR) X X X X X X X X X X X X X X X X Vector Compare and Select C1 00 00 00 1A 1A C1 1A 00 C1 00 00 1A 00 1A C1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 = = = = = = = = = = = = = = = = 00 FF FF FF 00 00 00 00 FF 00 FF FF 00 FF 00 00 C1 00 00 00 1A 1A C1 1A 00 C1 00 00 1A 00 1A C1 9A 9A 9A 9A 9A 9A 9A 9A 9A 9A 9A 9A 9A 9A 9A 9A C1 9A 9A 9A 1A 1A C1 1A 9A C1 9A 9A 1A 9A 1A C1 Application: Used heavily in DSP code Performance: PowerPC: 36 instructions ( 18 cycles throughput ) PowerPC + AltiVec: 2 instructions ( 2 cycles throughput ) Application: Permits removal of control flow Performance: PowerPC: 48 instructions ( 32 cycles throughput ) PowerPC + AltiVec: 2 instructions ( 3 cycles throughput )

Rotate, Shift and Logical Instructions op op op op op op op op Vector Shift Rotate Left Unsigned Left Unsigned Right Unsigned Signed Byte Halfword Word =shift count

Load/Store Vector Instructions Load Store MRU Vector LRU Memory 0x0000 0x0010 0x0020 0x0030 Byte Load Store Vector Element Halfword Word Memory 0x0000 0x0010 0x0020 0x0030 Load Vector for Shift Left Right

Enhanced Cache/Memory Interface Load & store with LRU instructions Performs memory access and marks cache block next to be replaced Avoids flushing cache with multimedia data exhibiting limited data reuse Software-managed memory buffer in cache Data stream touch and stop instructions Enables reuse of data cache as a memory access buffer Alleviates memory access latency by enabling early data prefetch Data stream touch offers software directed cache prefetch» Specifies N blocks of data to be prefetched from memory into cache» Each block to be prefetched is K bytes in length» The first block to be prefetched is located at address X, the second at address X+N, the third at address X+2N,... Data stream stop» Allows stopping of a data stream operation when speculative-incorrectly started» Selectively stop any stream via ID tag Transient/static hint for cache placement strategy

AltiVec Data Stream Prefetch Provides a hardware engine for Data Stream Prefetching Four simultaneous streams are supported, independent and asynchronous, addressable via 2-bit ID tag Data Stream Prefetch Block Size = 0-32 Vectors 0-256 Blocks Q Data Stream Engine DST Inst. Dispatch Load/ Store Unit Unit 1 2 3 N Memory Select Stride = ±32KBytes Data Cache Data MMU Bus

Permute Instruction VC 0x15 0x00 0x14 0x00 0x16 0x0F 0x1A 0x0A 0x17 0x0C 0x1F 0x08 0x1D 0x1E 0x1C 0x05 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF B5 A0 B4 A0 B6 AF BA AA B7 AC BF A8 BD BE BC A5 Provides full byte-wide data crossbar for 128-bit registers Selects any 16 8-bit elements from 2x16 8-bit elements Other AltiVec instructions are special cases of permute Pack, unpack, and merge Splat (element or literal replication) Shift left long immediate Permute also supports other higher-level functions Software-managed unaligned access Table look-up

Data Management Features Block Size = 0-32 Vectors 0-256 Blocks VR A 1 2 3 N Memory Stride = ±32KBytes Control Vector Data Stream Prefetch Vector Permute 1718 D E F 1E 1 0 1211 10 A 141414 14 Input Vectors VR C VR B 0 1 2 3 4 5 6 7 8 9 A B C D E F 10111213 1415161718191A1B1C1D1E1F Applications: Software-directed prefetch into cache Up to 4 simultaneous streams Hides memory latency for stream processing applications (MPEG, FIR, etc) Performance: PowerPC: Does not exist PowerPC + AltiVec: 1 instruction ( Can save hundreds of clocks) Applications: Byte interleaving (conv. encoding) Dynamic memory address alignment Fast 32-element table lookup Output Vector VR T Performance: PowerPC: 5 to 50 instructions, depending on application PowerPC + AltiVec: 1 instruction ( 1 cycle throughput )

Unaligned Accesses For a single vector, A0: mod16(addr(a0)) For a series of array elements: A0, A1, A2, A3 lvx lvx lvsl vperm v00,&a0 v01 v02,&a1,&a0 v10,v00,v01,v02 N+1 memory accesses for software, 2N accesses for hardware lvx lvx lvsl vperm lvx vperm lvx vperm lvx vperm v00,&a0 v01 v02,&a1,&a0 v10,v00,v01,v02 v00,&a2 v11,v01,v00,v02 v01,&a3 v12,v00,v01,v02 v00,&(a3+16) v13,v01,v00,v02 A0 A1 A2 A3 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xA0 A1 v00 A0 A2 A0 A0 A2 A2 v01 A1 A1 A3 A3 A1 A3 v00 A0 A0 v10 v02 A2 A0 v01 A1 vt A0 A1 A2 A3 (v10-v13)

Unpack Instructions Vector Unpack High Signed Pixel* Byte Halfword ss ss ss ss ss ss ss ss Vector Unpack Low Signed Pixel* Byte Halfword ssss ssss ssss ssss * unpacks 1-5-5-5 pixels into 4 8-bit components

Pack Instructions Vector Pack Unsigned Signed Pixel* Halfword Modulo Word Saturate Halfword Word Saturate * packs 4 8-bit components into 1-5-5-5 pixels

Merge Instructions Vector Merge High Byte Halfword Word Vector Merge Low Byte Halfword Word

Splat Instructions Vector Splat [Immediate Signed] Byte Halfword Word IMM select Useful for scalar operands

Shift Left Double Immediate Example: vsldi,,,#0004 IMM = 4 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 Immediate form of permute Supports 128-bit rotate/shift left/right Rotate via specifying = Shift left via specifying ()=0 Shift right via specifying ()=0 & shift left count = 16 shift right count

Shift Quadword Instructions 121 124 don t care 5 00 00 00 00 00......... Shift Cnt Vector Shift Left Right by Octet by bit Shift vector left or right by octets, zero fill.

Vector Shift 125 127 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 Shift Cnt 0..0 6 Vector Shift Left Right Shift entire vector left or right by bit up to 8 bits, zero fill.

Multiply-Sum Integer Instructions Vector Multiply-Sum 8x8bit mult Unsigned Mixed-signed Byte Modulo 4x16bit + 32-bit sum VC Vector Multiply-Sum Unsigned Signed Halfword Modulo Saturate 16x16 bit multiply 3x32-bit Sum VC

Sum Across Integer Instructions Vector Sum Across Signed Integer32 Signed Saturate 5x32-bit sum

Sum Across Partial Integer Instructions Vector Sum Across Partial (1/2) Signed Integer32 Saturate 3x32-bit sum 3x32-bit sum Vector Sum Across Partial (1/4) Signed Integer8 Saturate Vector Sum Across Partial (1/4) Signed Integer16 Saturate 2x16-bit + 32-bit sum 2x16-bit + 32-bit sum 2x16-bit + 32-bit sum 2x16-bit + 32-bit sum

Partial Product 16 bits A A A X X X B Bhigh Blow Bhigh 0000000 ssssssss Blow = = = 32 bits 24 bit partial products Use permute to duplicate the A operands and spread the B operands Can then use mulsum to produce up to 40 bits of accumulation Need to combine partial sums after the main loop

128 Bit Permute Problem: arbitrary permute of each bit in a vector register, assume static permute 0 1 2 3 4 5 Ê Ê Ê Ê Ê Ê Ê Ê 124 125 126 127 Ê Ê Ê Ê Strategy: 1) break 128 bit vector into 16 bytes 2) pre-calculate permute, rotate and select control vectors 3) use permute to get byte to correct location 4) use rotate to get bit to correct location with each byte 5) use select to merge bit into result byte 6) repeat for all eight bits in each byte

128 Bit Permute permute rotate 0000000 1 0000000 1 0000000 1 0000000 1 select

Multiply-Sum Integer Instructions Vector Multiply-Sum Unsigned Mixed-signed Byte Modulo 8x8-bit multiply 8x8-bit multiply 8x8-bit multiply 8x8-bit multiply 8x8-bit multiply 8x8-bit multiply 8x8-bit multiply 8x8-bit multiply 8x8-bit multiply VC 8x8-bit multiply 8x8-bit multiply 8x8-bit multiply 8x8-bit multiply 8x8-bit multiply 8x8-bit multiply 8x8-bit multiply 4x16-bit + 32-bit sum 4x16-bit + 32-bit sum 4x16-bit + 32 6bit sum 4x16-bit + 32-bit sum Vector Multiply-Sum Unsigned Modulo Signed Halfword Saturate 16x16-bit multiply 16x16-bit multiply 16x16-bit multiply 16x16-bit multiply VC 16x16-bit multiply 16x16-bit multiply 16x16-bit multiply 16x16-bit multiply 3x32-bit sum 3x32-bit sum 3x32-bit sum 3x32-bit sum

Parallel Table Lookup Example: 64 entry table, 8-Bit entries Strategy 1. Divide table into two 32-Entry tables 2. Load table into vector registers 3. Load values to be looked up (indices) into VC 4. Do two permutes, one using the upper half of the table as inputs, one using the lower half 5. Do a vector compare greater than each index with constant 0001 1111. This results in 0X00 when the index is less than 31 (entry is in first half of table) and 0XFF when the index is greater than 31 (entry is in second half of table) 6. Use vector select with the result of the compare to select (MUX) the correct entry. This is equivalent to a MUX using sixth bit of the index as the select input.

Parallel Table Lookup Parallel lookup is scalable: table can be up to size of vector register file (minus a few) 32 entry table = 16 lookup/inst 64 entry table = 4 lookup/inst 256 entry table = 4/5 lookup/inst non-simd code ~ 1/2 lookup/inst but table size unlimited Can be further improved piecewise linear approx. Applications Galois Field multiplication (used in Reed-Solomon ECC) image/video processing (color correction)

Parallel Table Lookup V11 V12 0 1 2 14 15 29 30 31 V13 V14 32 33 34 61 62 63 V11 V12 V13 V14 Index 0:4 32 : 1 32 : 1 VPERM Index 5 2:1 VCMPGT VSEL

Parallel Table Lookup AltiVec code for 64-entry parallel table lookup 16-element parallel lookup into a table of 64 byte elements ; Assume V31 holds the 16 valid 6-bit index values ; which are to be looked up from a 64-element table, ; contained in V11 through V14. ; Assume V02 holds the looked up values. ; Assume following replicated constant: 0b00011111, in V27. vperm V00,V11,V12,V31 ; lookup within first 32 elems vperm V01,V13,V14,V31 ; lookup within second 32 elems vcmpgtub V08,V31,V27 ; this comparison with 0b00011111 ; will splat/replicate the 6th bit vsel V02,V00,V01,V08 ; use 6th bit for choosing between ; the two lookups

256-Byte Table 32-Byte Chunks bit # 0:4 00 01 00 01 00 01 00 01 VPERM 5 VCMP VSEL 6 VCMP VSEL 7 VCMP VSEL