Language-extension differences between PPE and SPE SIMD support

The SPE's SPU instruction set is similar to that of the PPE's Vector/SIMD Multimedia Extension instruction set, in that both operate on 128-bit SIMD vectors.

However, from a programmer's perspective, these instruction sets are quite different, and their respective language extensions have different intrinsics and data types.

Table 1 specifies the supported vector data types for each of the SIMD engines (PPE and SPE) in the Cell Broadband Engine, where:
Table 1. PPE versus SPU Vector Data Types
Vector Data Type PPE SPU
vector unsigned char x x
vector signed char x x
vector bool char x
vector unsigned short x x
vector signed short x x
vector bool short x
vector pixel x
vector unsigned int x x
vector signed int x x
vector bool int x
vector float x x
vector unsigned long long x
vector signed long long x
vector double x

The key differences are:

The SPUs quadword data type is excluded from the list because it is a type-agnostic register reference instead of a specific vector data type. The quadword data type is used exclusively as an operand in specific intrinsics — those which have a one-to-one mapping with a single assembly-language instruction. For details, see Intrinsic classes.

Also, the Vector/SIMD Multimedia Extension instruction set provides these operations that are not directly supported by a single instruction in the SPU instruction set:

Likewise, the SPU instruction set provides these operations that are not directly supported by a single instruction in the Vector/SIMD Multimedia Extension instruction set:

These differences between the Vector/SIMD Multimedia Extension and SPU instruction sets must be kept in mind when porting code from the PPE to the SPE. Ported programs need to consider not only equivalent instructions but also code performance. See Porting SIMD code from the PPE to the SPEs for more on porting code.

To improve code portability between PPE and SPU programs, spu_intrinsics.h provides single-token typedefs for vector keyword data types. These typedefs are shown in Table 2.

These single-token types serve as class names for extending generic intrinsics for mapping to-and-from Vector/SIMD Multimedia Extension intrinsics and SPU intrinsics.

Table 2. Single-Token Vector Keyword Data Types
Vector Keyword Data Type Single-Token Typedef
vector unsigned char vec_uchar16
vector signed char vec_char16
vector unsigned short vec_ushort8
vector signed short vec_short8
vector unsigned int vec_unit4
vector signed int vec_int4
vector unsigned long long vec_ullong2
vector signed long long vec_llong2
vector float vec_float4
vector double vec_double2