Add ALIGNED(x) support#2410
Conversation
|
Is there any immediate advantage in doing this? |
| typedef float quat __attribute__((ext_vector_type(4))); | ||
| #else | ||
| typedef struct | ||
| #pragma pack(push, 1) |
There was a problem hiding this comment.
Why are you only using the #pragma pack from MSVC and not the PACKED_PREFIX and PACKED_SUFFIX macros?
What is the benefit of setting the alignment here?
There was a problem hiding this comment.
The #pragma pack(push,1)/#pragma pack(pop) works for all supported compilers. Not all the MSVC compilers support __attribute__ directive used in PACKED_PREFIX.
Probably the combination of PACKED_PREFIX and ALIGNED won't work.
There was a problem hiding this comment.
Okay, but why do we need ALIGNED? I suppose it could theoretically improve performance if the compiler uses SIMD vector instructions. Did you measure the improvement?
For now, it seems like an unnecessary complication that might become obsolete with future CPUs or compilers.
There was a problem hiding this comment.
@jopadan could you please elaborate on the "why should we?" question?
Pack and Aligned some alignable types.
xmust be a power of 2 integer constant.Using expressions like
sizeof(float)*2won't work