W3cubDocs

/GCC 9

6.60.29 SPU Built-in Functions

GCC provides extensions for the SPU processor as described in the Sony/Toshiba/IBM SPU Language Extensions Specification. GCC’s implementation differs in several ways.

  • The optional extension of specifying vector constants in parentheses is not supported.
  • A vector initializer requires no cast if the vector constant is of the same type as the variable it is initializing.
  • If signed or unsigned is omitted, the signedness of the vector type is the default signedness of the base type. The default varies depending on the operating system, so a portable program should always specify the signedness.
  • By default, the keyword __vector is added. The macro vector is defined in <spu_intrinsics.h> and can be undefined.
  • GCC allows using a typedef name as the type specifier for a vector type.
  • For C, overloaded functions are implemented with macros so the following does not work:
    spu_add ((vector signed int){1, 2, 3, 4}, foo);

    Since spu_add is a macro, the vector constant in the example is treated as four separate arguments. Wrap the entire argument in parentheses for this to work.

  • The extended version of __builtin_expect is not supported.

Note: Only the interface described in the aforementioned specification is supported. Internally, GCC uses built-in functions to implement the required functionality, but these are not supported and are subject to change without notice.

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/SPU-Built_002din-Functions.html