I'm following IBM documents for Cell programming. Now I'm trying to compile some SIMD examples, but I'm totally lost for the next reasons:
My most inmediate problem: according with IBM docs, I have to use 'vector' type, and this type is totally unknown by the compiler. Also, I dont know what is the header file needed for the SIMD intrinsics (like vec_perm, vec_sums, etc)
The IBM document called: "Programming tutorial" from the Cell SDK 3.0 says the next: "You do not need to setup, to enter in a special mode, or to include a special header file".
Its obvious that this is not true, so, what should I do in order to use that types and intrinsics?
I'm running Yellow Dog 6 with the SDK 3.0, and this is exactly the code I'm trying to run:
Code: Select all
union SumArray
{
int i[4];
vector signed int v;
};
int vect_sum( unsigned char bytes[] )
{
SumArray sum;
vector unsigned char vbytes;
vector unsigned int zero =(unsigned int){0};
vbytes = vec_perm( vec_ld(0, bytes), vector_ld( 16, bytes), vector_lvsl(0, bytes) );
sum.v = vec_sums( (vector signed int) vec4_sum4s( vbytes,zero), (vector signed int) zero);
return sum.i[3];
}
int main()
{
unsigned char bytes[16];
for(int i=0; i < 16; ++i )
bytes[i] = 2;
int sum = vect_sum( bytes );
printf( "\nLa suma es: %d\n", sum );
return 0;
}
ppu-g++ -c main.cpp -o main.o -fno-inline-functions -fmessage-length=0 -Wall -I./include -m64 -G0 -D_DEBUG -DPLATFORM_PS3 -g
With all this, I got errors like:
main.cpp|21|error: ISO C++ forbids declaration of 'vector' with no type|
main.cpp|29|error: 'vec_ld' was not declared in this scope|
main.cpp|29|error: 'vec_perm' was not declared in this scope|
etc.
Any clue will be appreciated :)
Regards,
Jacobo.