summaryrefslogtreecommitdiffstats
path: root/lib/Headers/lzcntintrin.h
Commit message (Collapse)AuthorAgeFilesLines
* Move the builtin headers to use the new license file header.Chandler Carruth2019-04-081-17/+3
| | | | | | | | | | | | | | | | | | Summary: These all had somewhat custom file headers with different text from the ones I searched for previously, and so I missed them. Thanks to Hal and Kristina and others who prompted me to fix this, and sorry it took so long. Reviewers: hfinkel Subscribers: mcrosier, javed.absar, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60406 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357941 91177308-0d34-0410-b5e6-96231b3b80d8
* [Builltins][X86] Provide implementations of __lzcnt16, __lzcnt, __lzcnt64 ↵Craig Topper2018-12-141-10/+6
| | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349098 91177308-0d34-0410-b5e6-96231b3b80d8
* [X86] For lzcnt/tzcnt intrinsics use cttz/ctlz intrinsics with zero_undef ↵Craig Topper2018-09-261-5/+5
| | | | | | | | | | | | flag set to false. Previously we used a select and the zero_undef=true intrinsic. In -O2 this pattern will get optimized to zero_undef=false. But in -O0 this optimization won't happen. This results in a compare and cmov being wrapped around a tzcnt/lzcnt instruction. By using the zero_undef=false intrinsic directly without the select, we can improve the -O0 codegen to just an lzcnt/tzcnt instruction. Differential Revision: https://reviews.llvm.org/D52392 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343126 91177308-0d34-0410-b5e6-96231b3b80d8
* [DOXYGEN] Formatting changes for better intrinsics documentation renderingEkaterina Romanova2018-05-231-0/+4
| | | | | | | | | | (1) I added some \see cross-references to a few select intrinsics that are related (and have the same or similar semantics). (2) pmmintrin.h, smmintrin.h, xmmintrin.h have very few minor formatting changes. They make rendering of our intrinsics documentation better. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333065 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-5/+5
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331834 91177308-0d34-0410-b5e6-96231b3b80d8
* Add doxygen comments for lzcntintrin.h's intrinsics.Ekaterina Romanova2016-11-181-0/+50
| | | | | | | | | | | | The doxygen comments are automatically generated based on Sony's intrinsics document. I got an OK from Eric Christopher to commit doxygen comments without prior code review upstream. This patch was internally reviewed by Charles Li. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@287317 91177308-0d34-0410-b5e6-96231b3b80d8
* [X86] Rename DEFAULT_FN_ATTR macro to __DEFAULT_FN_ATTRMichael Kuperstein2015-06-301-7/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241065 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the intel intrinsic headers to use the target attribute support.Eric Christopher2015-06-171-5/+1
| | | | | | | | | | | | | | | | | | | This involved removing the conditional inclusion and replacing them with target attributes matching the original conditional inclusion and checks. The testcase update removes the macro checks for each file and replaces them with usage of the __target__ attribute, e.g.: int __attribute__((__target__(("sse3")))) foo(int a) { _mm_mwait(0, 0); return 4; } This usage does require the enclosing function have the requisite __target__ attribute for inlining and code generation - also for any macro intrinsic uses in the enclosing function. There's no change for existing uses of the intrinsic headers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239883 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a define for per-file function attributes for the Intel intrinsic headers.Eric Christopher2015-06-171-5/+10
| | | | | | | This is a precursor to changing them to use the new target attribute code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239882 91177308-0d34-0410-b5e6-96231b3b80d8
* Add _lzcnt_u32 and _lzcnt_u64 to lzcntintrin.h to match Intel documentation ↵Craig Topper2014-11-011-0/+12
| | | | | | names for these intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221066 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid undefined behavior in the x86 lzcnt header file by explicitly checking ↵Craig Topper2014-11-011-3/+3
| | | | | | for 0 before calling __builtin_clz. Without this the optimizers may take advantage of the undefined behavior and produce incorrect results. LLVM itself still needs to be taught to merge the zero check into the llvm.ctlz with defined zero behavior. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221064 91177308-0d34-0410-b5e6-96231b3b80d8
* Add intrinsics for lzcnt and tzcnt instructions.Craig Topper2011-12-251-0/+55
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147263 91177308-0d34-0410-b5e6-96231b3b80d8