Reputation: 1
I have just started to learn about SIMD. I use VScode to try what I learn. I wanna try an example thay goes:
#include <stdio.h>
#include <altivec.h>
int a[4] __attribute__((aligned(16))) = { 1, 3, 5, 7 };
int b[4] __attribute__((aligned(16))) = { 2, 4, 6, 8 };
int c[4] __attribute__((aligned(16)));
int main(int argc, char **argv)
{
__vector signed int *va = (__vector signed int *) a;
__vector signed int *vb = (__vector signed int *) b;
__vector signed int *vc = (__vector signed int *) c;
*vc = vec_add(*va, *vb); // 1 + 2, 3 + 4, 5 + 6, 7 + 8
printf("c[0]=%d, c[1]=%d, c[2]=%d, c[3]=%d¥n", c[0], c[1], c[2], c[3]);
return 0;
}
When I run it in my WSL I write:
gcc exercice.c -o main && ./main
But I get the error message:
fatal error: altivec.h: No such file or directory
I have tried with diferent things such as using "-march=native", headerfiles: immintrin.h and x86intrin.h. But no luck. With CPU-Z I can see my CPU support AVX and AVX2 instructions.
Is there something I'am missing?
Upvotes: 0
Views: 237