SPU Built-in Functions

6.57.27 SPU Built-in Functions

GCC provides extensions for the SPU processor as described in the Sony/Toshiba/IBM SPU Language Extensions Specification, which can be found at http://cell.scei.co.jp/ or http://www.ibm.com/developerworks/power/cell/. 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-4.9.3/gcc/SPU-Built_002din-Functions.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部