Let's say I have a struct
typdef struct point{
float x;
float y;
float z;
} point;
I have an array of these structs and I want to do the following -
std::vector<point> copyArray;
for(auto p : array_of_points){
point newPoint;
newPoint.x = p.x;
newPoint.y = p.y;
newPoint.z = p.z;
copyArray.push_back(newPoint);
}
Now this particular section in my code can be accelerated using vector operations, if I can operate on multiple structs at once.
I have a two part question
- How can this be done using SIMD intrinsic. I am not sure how I would load structs.
- Can OpenMP achieve the desired vectorization. I am not that comfortable with assembly and was not able to figure out whether it was indeed being vectorized efficiently or not.