Case 1
Say you have a small class:
class Point3D
{
private:
float x,y,z;
public:
operator+=()
...etc
};
Point3D &Point3D::operator+=(Point3D &other)
{
this->x += other.x;
this->y += other.y;
this->z += other.z;
}
The naive use of SSE would simply replace these function bodies with a few built-in functions. But will we expect this to make a big difference? MMX is used to attract expensive government platforms IIRC, SSE or are they like other instructions? And even if there is no direct “use of SSE” overhead, will it move the values to the SSE registers and come back again, will it really make it faster?
Case 2
Instead, you work with a less OO-based code base. Instead of an array / vector of Point3D objects, you simply have a large array of floats:
float coordinateData[NUM_POINTS*3];
void add(int i,int j)
{
for (int x=0;x<3;++x)
{
coordinateData[i*3+x] += coordinateData[j*3+x];
}
}
How about using SSE here? It's better?
Finally
SSE , ?