llvm-project/clang/lib/Headers
Craig Topper 1f2b181689 [Builltins][X86] Provide implementations of __lzcnt16, __lzcnt, __lzcnt64 for MS compatibility. Remove declarations from intrin.h and implementations from lzcntintrin.h
intrin.h had forward declarations for these and lzcntintrin.h had implementations that were only available with -mlzcnt or a -march that supported the lzcnt feature.

For MS compatibility we should always have these builtins available regardless of X86 being the target or the CPU support the lzcnt instruction. The backends should be able to gracefully fallback to something support even if its just shifts and bit ops.

Unfortunately, gcc also implements 2 of the 3 function names here on X86 when lzcnt feature is enabled.

This patch adds builtins for these for MSVC compatibility and drops the forward declarations from intrin.h. To keep the gcc compatibility the two intrinsics that collided have been turned into macros that use the X86 specific builtins with the lzcnt feature check. These macros are only defined when _MSC_VER is not defined. Without them being macros we can get a redefinition error because -ms-extensions doesn't seem to set _MSC_VER but does make the MS builtins available.

Should fix PR40014

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

llvm-svn: 349098
2018-12-14 00:21:02 +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 [CUDA] Re-land support for <complex> (r283683 and r283680). 2016-10-11 17:36:03 +00:00
__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 [CUDA] Added basic support for compiling with CUDA-10.0 2018-09-24 23:10:44 +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 more intrinsics to match icc. 2018-10-20 19:28:52 +00:00
avx512cdintrin.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
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 missing intrinsics to match icc. 2018-10-20 19:28:50 +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] Remove __extension__ from macro intrinsics when its not needed. 2018-05-31 00:51:20 +00:00
avx512vbmi2intrin.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
avx512vbmiintrin.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
avx512vbmivlintrin.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
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 more intrinsics to match icc. 2018-10-20 19:28:52 +00:00
avx512vlcdintrin.h Remove trailing space 2018-07-30 19:24:48 +00:00
avx512vldqintrin.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
avx512vlintrin.h [X86] Add missing intrinsics to match icc. 2018-10-20 19:28:50 +00:00
avx512vlvbmi2intrin.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
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 [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
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 more of the icc unaligned load/store to/from 128 bit vector intrinsics 2018-09-29 17:49:42 +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 [X86] Add the movbe instruction intrinsics from icc. 2018-09-28 17:09:51 +00:00
intrin.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
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 [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
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 [mips] MSA intrinsics header file 2016-09-20 15:07:36 +00:00
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] Add support of cl_intel_device_side_avc_motion_estimation extension 2018-11-08 11:25:41 +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 Guard __gnuc_va_list typedef. 2017-01-23 19:09:21 +00:00
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] Add support for IBM z14 processor (3/3) 2017-07-17 17:47:35 +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 __builtin_ia32_selectss_128 and __builtin_ia32_selectsd_128 that is suitable for use in scalar mask intrinsics. 2018-07-10 00:37:25 +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] 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
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