using a standard tool project and setting the -faltivec flag the following code:
#include <stdio.h>
#include <Accelerate/Accelerate.h>
int main (int argc, const char * argv[]) {
// vector unsigned char v0 = (vector unsigned char) ('H','e','l','l','o',' ','W','o','r','l','d',' ','1','2','3','4');
vUInt8 v1 = (vUInt8) {'H','e','l','l','o',' ','W','o','r','l','d',' ','1','2','3','4'};
vUInt8 v2 = (vUInt8) {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
vUInt8 v3=v2;
printf("message = %vc\n", v1);
printf("v1 = %vd\n", v1);
printf("v2 = %vd\n", v2);
printf("v3 = %vd\n", v3);
printf("v3 = %vhd\n", v3);
return 0;
}
gives this output:
[Session started at 2007-12-26 13:22:41 -0800.]
message = Hello World 1234
v1 = 72 101 108 108 111 32 87 111 114 108 100 32 49 50 51 52
v2 = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
v3 = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
v3 = 257 257 257 257 257 257 257 257
The Debugger has exited with status 0.
However, I can't get the commented out code to work and I don't know where to go from here inorder to play with the altivec ops.
I'm hoping if I can get some basic things going then I can the use the Freescale documents to learn with.
Help. Thanks.