Marco Belli
Marco Belli

Reputation: 103

gcc vector extension assign operator

I'm experiment with gcc vector extension and I don't know how assign data to a vector

typedef int simdScore __attribute__ ((vector_size (16)));
simdScore x ={0,0,0,0};
simdScore y= {5,5,5,5};
x += y;

//ERROR by compiler
x = {1,2,3,4};

x = {1,2,3,4} seems to be usable only for initialization, but it's not possbile use it after the initialization. Is there some way to load data in a vector without creating a local variabile or doing:

x[0] =1;
x[1] =2;
x[2] =3;
x[3] =4;

thank you all

Upvotes: 1

Views: 234

Answers (1)

evan
evan

Reputation: 1683

Does x = simdScore{1, 2, 3, 4}; work?

Upvotes: 2

Related Questions