The second argument for vec_slo
needs to be vector signed char
or vector unsigned char
. So change:
vector unsigned int a;
to:
vector unsigned char a;
and change:
a = vec_ld(0, (vector unsigned int *)buf1);
to:
a = vec_ld(0, (vector unsigned char *)buf1);
There are a couple of other problems with your code which you'll see when you get it compile and run:
buf
andbuf1
need to be 16 byte aligned- the value for the shift in
buf1
needs to be a 4 bit literal integer shifted left by 3 bits, not a character
Here is a simplified/corrected version of your example code - it's written for gcc so may need minor changes for whatever compiler you are using (xlc ?):
int main(void)
{
vector unsigned char v = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
vector unsigned char vshift = vec_splat_u8(1 << 3); // shift left by 1 byte
vector unsigned char vshifted = vec_slo(v, vshift);
printf("v = %vu\n", v);
printf("vshift = %vu\n", vshift);
printf("vshifted = %vu\n", vshifted);
return 0;
}