arrow_back_ios Back to List

Using SPU Instrinsics

Offload KB - features

Old Content Alert

Please note that this is a old document archive and the will most likely be out-dated or superseded by various other products and is purely here for historical purposes.

Offload allows the use of SPU intrinsics from an offload context.

#include <liboffload>

__offload static vector unsigned int zeros_si()
{
	return (vector unsigned int )si_fmsbi(0);
}

__offload static vector unsigned int zeros_spu()
{
	return (vector unsigned int) spu_splats(0);
}

static void func()
{
	__blockingoffload()
	{
		vector unsigned int bar1 = zeros_si();
		vector unsigned int bar2 = zeros_spu();
	};
}

The above example compiles and works fine, and allows the use of both the si and spu intrinsics that GCC supports. the <liboffload> header must be included though, as it contains the required definitions for the offload functions.Any attempt to call an SPU method from outwith an offload context will result in a compile time error.