15. SPU Assembly Language

This topic is not for the faint of heart. Thus far, the book has explained Cell programming in terms of C functions with friendly names like spu_add and mfc_get. The applications operate on variables with straightforward datatypes such as vector signed short, and if you don’t know the result of an operation, you can find out by calling printf.

None of these luxuries are available when you code with assembly. The code in a *.s file consists of instructions like ai, il, hbrz, and stqx. They don’t operate on typed variables, but instead manipulate bits, bytes, halfwords, words, doublewords, and quadwords in the SPU’s general-purpose registers. This means printf won’t suffice; if you want to see what an instruction accomplished, ...

Get Programming the Cell Processor: For Games, Graphics, and Computation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.