I know XMVECTOR has to be 16-byte-aligned and therefore shouldn't be a member of a class (unless I ensure the alignment). However, can I do sth like this?
class A
{
public:
XMVECTOR vect;
};
void fun(void)
{
A a;
XMVECTOR localVect = a.vect;
// can I now use localVect correctly?
}
The compiler is likely to use movaps to implement the assignment, which would fail due to alignment on most CPUs.
The way to make this not require alignment is to use:
This compiles to a single movups.