llvm-project/clang/lib/Headers
Craig Topper be4cbe8726 [X86] Add explicit alignment to __m128/__m128i/__m128d/etc. to allow matching of MSVC behavior with #pragma pack.
Summary:
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 its 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__). Using the now explicitly aligned types wouldn't produce align 1 accesses when targeting Windows.

Reviewers: rnk, erichkeane, spatel, RKSimon

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D57961

llvm-svn: 353555
2019-02-08 19:45:08 +00:00
..
cuda_wrappers [CUDA] Added missing 'inline' for functions defined in a header. 2018-12-07 22:20:53 +00:00
CMakeLists.txt [CMake] Store path to vendor-specific headers in clang-headers target property 2018-12-03 10:34:25 +00:00
__clang_cuda_builtin_vars.h Fix typos in clang 2018-04-06 15:14:32 +00:00
__clang_cuda_cmath.h [CUDA] Remove implementations of nexttoward. 2017-11-17 01:15:43 +00:00
__clang_cuda_complex_builtins.h
__clang_cuda_device_functions.h [CUDA] Provide integer SIMD functions for CUDA-9.2 2018-07-20 17:44:34 +00:00
__clang_cuda_intrinsics.h [CUDA] added missing __ldg(const signed char *) 2018-04-18 18:33:43 +00:00
__clang_cuda_libdevice_declares.h [CUDA] Provide integer SIMD functions for CUDA-9.2 2018-07-20 17:44:34 +00:00
__clang_cuda_math_forward_declares.h [CUDA] Remove implementations of nexttoward. 2017-11-17 01:15:43 +00:00
__clang_cuda_runtime_wrapper.h Basic CUDA-10 support. 2019-02-05 22:38:58 +00:00
__stddef_max_align_t.h
__wmmintrin_aes.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
__wmmintrin_pclmul.h [X86] Fix some places where macro arguments to intrinsics weren't cast to _m512(i|d)/_m256(i|d/_m128(i|d) first. 2018-05-31 01:24:40 +00:00
adxintrin.h [X86] Remove the addcarry builtins. Leaving only the addcarryx builtins since that matches gcc. 2018-12-10 06:07:59 +00:00
altivec.h [PowerPC] Vector load/store builtins overstate alignment of pointers 2018-11-26 14:35:38 +00:00
ammintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
arm64intr.h [clang] Add ARM64 support to armintr.h for MSVC compatibility 2017-07-26 05:29:40 +00:00
arm_acle.h [ARM] ACLE Chapter 9 intrinsics 2017-05-04 08:37:59 +00:00
armintr.h
avx2intrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
avx512bitalgintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
avx512bwintrin.h [X86] Add explicit alignment to __m128/__m128i/__m128d/etc. to allow matching of MSVC behavior with #pragma pack. 2019-02-08 19:45:08 +00:00
avx512cdintrin.h [X86] Remove mask and passthru arguments from vpconflict builtins. Use select in IR instead. 2019-01-25 07:08:22 +00:00
avx512dqintrin.h [X86] Add ktest intrinsics to match gcc and icc. 2018-08-31 22:29:56 +00:00
avx512erintrin.h [X86] Remove __extension__ from macro intrinsics when its not needed. 2018-05-31 00:51:20 +00:00
avx512fintrin.h [X86] Add explicit alignment to __m128/__m128i/__m128d/etc. to allow matching of MSVC behavior with #pragma pack. 2019-02-08 19:45:08 +00:00
avx512ifmaintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
avx512ifmavlintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
avx512pfintrin.h [X86] Make the pointer arguments to avx512 gather/scatter intrinsics 'void*' to match gcc and Intel's documentation. 2019-01-09 07:36:01 +00:00
avx512vbmi2intrin.h Recommit r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins." 2019-01-07 21:00:41 +00:00
avx512vbmiintrin.h [X86] Remove mask parameter from avx512 pmultishiftqb intrinsics. Use select in IR instead. 2019-01-14 08:46:51 +00:00
avx512vbmivlintrin.h [X86] Remove mask parameter from avx512 pmultishiftqb intrinsics. Use select in IR instead. 2019-01-14 08:46:51 +00:00
avx512vlbitalgintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
avx512vlbwintrin.h [X86] Add explicit alignment to __m128/__m128i/__m128d/etc. to allow matching of MSVC behavior with #pragma pack. 2019-02-08 19:45:08 +00:00
avx512vlcdintrin.h [X86] Remove mask and passthru arguments from vpconflict builtins. Use select in IR instead. 2019-01-25 07:08:22 +00:00
avx512vldqintrin.h [X86] Remove the cvtuqq2ps256/cvtqq2ps256 mask builtins. Replace with uitofp/sitofp and select. 2019-01-20 19:04:56 +00:00
avx512vlintrin.h [X86] Add explicit alignment to __m128/__m128i/__m128d/etc. to allow matching of MSVC behavior with #pragma pack. 2019-02-08 19:45:08 +00:00
avx512vlvbmi2intrin.h Recommit r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins." 2019-01-07 21:00:41 +00:00
avx512vlvnniintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
avx512vnniintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
avx512vpopcntdqintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
avx512vpopcntdqvlintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
avxintrin.h [X86] Add explicit alignment to __m128/__m128i/__m128d/etc. to allow matching of MSVC behavior with #pragma pack. 2019-02-08 19:45:08 +00:00
bmi2intrin.h
bmiintrin.h [X86] For lzcnt/tzcnt intrinsics use cttz/ctlz intrinsics with zero_undef flag set to false. 2018-09-26 17:01:44 +00:00
cetintrin.h [X86] Fix some inconsistent formatting in the first line of our intrinsics headers. 2018-05-04 21:45:25 +00:00
cldemoteintrin.h [X86] Move all Intel defined intrinsic includes into immintrin.h 2018-05-23 18:32:58 +00:00
clflushoptintrin.h [X86] Fix some inconsistent formatting in the first line of our intrinsics headers. 2018-05-04 21:45:25 +00:00
clwbintrin.h Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
clzerointrin.h Remove trailing space 2018-07-30 19:24:48 +00:00
cpuid.h [x86] invpcid intrinsic 2018-05-25 06:34:42 +00:00
emmintrin.h [X86] Add explicit alignment to __m128/__m128i/__m128d/etc. to allow matching of MSVC behavior with #pragma pack. 2019-02-08 19:45:08 +00:00
f16cintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
float.h [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL 2018-08-08 20:38:38 +00:00
fma4intrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
fmaintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
fxsrintrin.h [X86] Remove 'return' from a bunch of intrinsics that return void and use a builtin that returns void. 2018-05-30 17:23:45 +00:00
gfniintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
htmintrin.h
htmxlintrin.h Fix typos in clang 2018-04-06 15:14:32 +00:00
ia32intrin.h [X86] Remove 'return' from a bunch of intrinsics that return void and use a builtin that returns void. 2018-05-30 17:23:45 +00:00
immintrin.h Recommit r351160 "[X86] Make _xgetbv/_xsetbv on non-windows platforms" 2019-01-16 22:56:25 +00:00
intrin.h [COFF, ARM64] Fix types for _ReadStatusReg, _WriteStatusReg 2019-02-08 01:17:49 +00:00
inttypes.h
invpcidintrin.h [x86] invpcid intrinsic 2018-05-25 06:34:42 +00:00
iso646.h
limits.h
lwpintrin.h Remove trailing space 2018-07-30 19:24:48 +00:00
lzcntintrin.h [Builltins][X86] Provide implementations of __lzcnt16, __lzcnt, __lzcnt64 for MS compatibility. Remove declarations from intrin.h and implementations from lzcntintrin.h 2018-12-14 00:21:02 +00:00
mm3dnow.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
mm_malloc.h
mmintrin.h [X86] Add explicit alignment to __m128/__m128i/__m128d/etc. to allow matching of MSVC behavior with #pragma pack. 2019-02-08 19:45:08 +00:00
module.modulemap [x86] invpcid intrinsic 2018-05-25 06:34:42 +00:00
movdirintrin.h [X86] Use C style comments in intrinsic headers for overall consistency. 2018-05-30 22:33:21 +00:00
msa.h
mwaitxintrin.h [X86] Consistently use double underscore at the beginning of the include guards in our intrinsic headers. 2018-04-24 17:40:47 +00:00
nmmintrin.h [X86] Consistently use double underscore at the beginning of the include guards in our intrinsic headers. 2018-04-24 17:40:47 +00:00
opencl-c.h OpenCL: Use length modifier for warning on vector printf arguments 2019-01-29 20:49:54 +00:00
pconfigintrin.h [X86] Move all Intel defined intrinsic includes into immintrin.h 2018-05-23 18:32:58 +00:00
pkuintrin.h [X86] Remove 'return' from a bunch of intrinsics that return void and use a builtin that returns void. 2018-05-30 17:23:45 +00:00
pmmintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
popcntintrin.h Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
prfchwintrin.h [X86] Remove some preprocessor feature checks from intrinsic headers 2018-05-21 06:07:49 +00:00
ptwriteintrin.h [X86] Move all Intel defined intrinsic includes into immintrin.h 2018-05-23 18:32:58 +00:00
rdseedintrin.h [X86] Move all Intel defined intrinsic includes into immintrin.h 2018-05-23 18:32:58 +00:00
rtmintrin.h
s390intrin.h
sgxintrin.h [X86] Move all Intel defined intrinsic includes into immintrin.h 2018-05-23 18:32:58 +00:00
shaintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
smmintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
stdalign.h
stdarg.h
stdatomic.h Revert "Emit an error when mixing <stdatomic.h> and <atomic>" 2018-05-02 19:52:07 +00:00
stdbool.h In stdbool.h, define bool, false, true only in gnu++98 2017-12-08 08:28:08 +00:00
stddef.h
stdint.h Fix typos in clang 2018-04-06 15:14:32 +00:00
stdnoreturn.h
tbmintrin.h
tgmath.h [Headers] Reapply: Add #include_next for tgmath.h on Darwin 2017-03-16 23:19:00 +00:00
tmmintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
unwind.h [Headers] Expand _Unwind_Exception for SEH on MinGW/x86_64 2018-08-07 20:02:40 +00:00
vadefs.h
vaesintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
varargs.h
vecintrin.h [SystemZ] Fix wrong codegen caused by typos in vecintrin.h 2018-12-20 13:09:09 +00:00
vpclmulqdqintrin.h [X86] Remove leftover semicolons at end of macros 2018-06-01 09:40:50 +00:00
waitpkgintrin.h [X86] Move all Intel defined intrinsic includes into immintrin.h 2018-05-23 18:32:58 +00:00
wbnoinvdintrin.h [X86] Move all Intel defined intrinsic includes into immintrin.h 2018-05-23 18:32:58 +00:00
wmmintrin.h [X86] Consistently use double underscore at the beginning of the include guards in our intrinsic headers. 2018-04-24 17:40:47 +00:00
x86intrin.h [X86] Move the include of clzerointrin.h from immintrin.h back to x86intrin.h. 2018-05-23 21:04:26 +00:00
xmmintrin.h [X86] Add explicit alignment to __m128/__m128i/__m128d/etc. to allow matching of MSVC behavior with #pragma pack. 2019-02-08 19:45:08 +00:00
xopintrin.h [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
xsavecintrin.h [X86] Fix some inconsistent formatting in the first line of our intrinsics headers. 2018-05-04 21:45:25 +00:00
xsaveintrin.h [X86] Only define _XCR_XFEATURE_ENABLED_MASK in xsaveintrin.h when _MSC_VER is defined. Remove from intrin.h. 2019-01-18 17:51:51 +00:00
xsaveoptintrin.h [X86] Remove 'return' from a bunch of intrinsics that return void and use a builtin that returns void. 2018-05-30 17:23:45 +00:00
xsavesintrin.h [X86] Fix some inconsistent formatting in the first line of our intrinsics headers. 2018-05-04 21:45:25 +00:00
xtestintrin.h [X86] Fix some inconsistent formatting in the first line of our intrinsics headers. 2018-05-04 21:45:25 +00:00