[PATCH] D57961: [X86] Add explicit alignment to __m128/__m128i/__m128d/etc. to allow matching of MSVC behavior with #pragma pack.
Craig Topper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 8 09:55:47 PST 2019
craig.topper created this revision.
craig.topper added reviewers: rnk, erichkeane, spatel, RKSimon.
Herald added a project: clang.
With MSVC, #pragma pack is ignored when there is explicit alignment. This differs from gcc. Clang emulates this difference when compiling for Windows.
It appears that MSVC and headers consider the __m128/__m128i/__m128d/etc. types to be explicitly aligned and ignores #pragma pack for them. Since we don't have explicit alignment on them in our headers, we don't match the MSVC behavior here.
This patch adds explicit alignment to match this behavior. I'm hoping this won't cause any problems when we're not emulating MSVC. But if someone knows of something that would be different we can swith to conditionally adding the alignment based on _MSC_VER.
I had to add explicitly unaligned types as well so we could use them in the loadu/storeu intrinsics which use __attribute__(__packed__). So the explicitly aligned types wouldn't produce align 1 accesses when targeting Windows.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 19507 bytes
Desc: not available
More information about the cfe-commits