summaryrefslogtreecommitdiffstats
path: root/clang/lib/Headers
Commit message (Collapse)AuthorAgeFilesLines
* Implement AVX1 vbroadcast intrinsics with vector initializersAdam Nemet2014-05-291-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These intrinsics are special because they directly take a memory operand (AVX2 adds the register counterparts). Typically, other non-memop intrinsics take registers and then it's left to isel to fold memory operands. In order to LICM intrinsics directly reading memory, we require that no stores are in the loop (LICM) or that the folded load accesses constant memory (MachineLICM). When neither is the case we fail to hoist a loop-invariant broadcast. We can work around this limitation if we expose the load as a regular load and then just implement the broadcast using the vector initializer syntax. This exposes the load to LICM and other optimizations. At the IR level this is translated into a series of insertelements. The sequence is already recognized as a broadcast so there is no impact on the quality of codegen. _mm256_broadcast_pd and _mm256_broadcast_ps are not updated by this patch because right now we lack the DAG-combiner smartness to recover the broadcast instructions. This will be tackled in a follow-on. There will be completing changes on the LLVM side to remove the LLVM intrinsics and to auto-upgrade bitcode files. Fixes <rdar://problem/16494520> llvm-svn: 209846
* added Intel's BMI intrinsic variants Sanjay Patel2014-05-281-1/+34
| | | | | | (fixes PR19431 - http://llvm.org/bugs/show_bug.cgi?id=19431) llvm-svn: 209769
* Fix a bug in xmmintrin.h.Akira Hatanaka2014-05-231-1/+1
| | | | | | | | | | The last step of _mm_cvtps_pi16 should use _mm_packs_pi32, which is a function that reads two __m64 values and packs four 32-bit values into four 16-bit values. <rdar://problem/16873717> llvm-svn: 209489
* Define the InterlockedCompareExchange64 intrinsic on 32-bits tooTimur Iskhodzhanov2014-05-131-2/+0
| | | | llvm-svn: 208699
* Patched clang to emit x86 blends as shufflevectors.Filipe Cabecinhas2014-05-133-8/+62
| | | | | | | | | | | | | | | | | Summary: Most of the clang header patch by Simon Pilgrim @ SCEE. Also fixed (or added) clang tests for these intrinsics. LLVM tests to make sure we get the blend instruction out of these shufflevectors are at http://reviews.llvm.org/D3600 Reviewers: eli.friedman, craig.topper, rafael Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3601 llvm-svn: 208664
* Let stddef.h respect __need_{wchar_t, size_t, NULL, ptrdiff_t, wint_t}.Nico Weber2014-04-301-4/+34
| | | | | | | | | | | | | | | | glibc expects that stddef.h only defines a single thing if either of these defines is set. For example, before this change, a C file containing #include <stdlib.h> int ptrdiff_t = 0; would compile with gcc but not with clang. Now it compiles with clang too. This also fixes PR12997, where older versions of the Linux headers would define NULL incorrectly, and glibc would define __need_NULL and expect stddef.h to redefine NULL with the correct definition. llvm-svn: 207606
* Revert r207482; I fail at reading IRC.Nico Weber2014-04-291-16/+0
| | | | llvm-svn: 207483
* Let stddef.h redefine NULL if __need_NULL is set, as needed by glibc, PR12997.Nico Weber2014-04-291-0/+16
| | | | | | | | | See the bug and the cfe-commits thread "[patch] Let stddef.h redefine NULL if __need_NULL is set" for discussion. Fixes PR12997 and is similar to the __need_wint_t bits already in this file. llvm-svn: 207482
* Intrin.h: remove __rdtsc and __rdtscp declarationsHans Wennborg2014-04-241-3/+0
| | | | | | Since r207132, these are defined in ia32intrin.h. llvm-svn: 207134
* [X86] Add Clang support for intrinsics __rdtsc and __rdtscp.Andrea Di Biagio2014-04-241-3/+7
| | | | | | | | | | | | | | This patch: 1. Adds a definition for two new GCCBuiltins in BuiltinsX86.def: __builtin_ia32_rdtsc; __builtin_ia32_rdtscp; 2. Replaces the already existing definition of intrinsic __rdtsc in ia32intrin.h with a simple call to the new GCC builtin __builtin_ia32_rdtsc. 3. Adds a definition for the new intrinsic __rdtscp in ia32intrin.h llvm-svn: 207132
* Rename lib/Headers/module.map to module.modulemapBen Langmuir2014-04-173-5/+5
| | | | | | Don't install a file using the legacy spelling. llvm-svn: 206431
* intrin.h: Fix up bugs in the cr3 and msr intrinsicsReid Kleckner2014-04-081-9/+6
| | | | | | | | | | | Don't include input and output regs in clobbers. Prefix some identifiers with __. Add a memory constraint to __readcr3 to prevent reordering. This constraint is heavy handed, but conservatively correct. Thanks to PaX Team for the suggestions. llvm-svn: 205778
* intrin.h: Implement __readmsr, __readcr3, and __writecr3Reid Kleckner2014-04-081-0/+35
| | | | | | | | Fixes PR19301. Based on a patch from Steven Graf! llvm-svn: 205751
* Added _rdtsc intrinsics by Robert KhasanovAlexey Volkov2014-03-312-6/+10
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D3212 llvm-svn: 205172
* Install: add arm_neon.h header backTim Northover2014-03-291-4/+3
| | | | | | | I'd gone too far pruning aarch64_simd.h this time and took out one instance of arm_neon.h. This should restore us to the status quo. llvm-svn: 205111
* Remove stray references to aarch64_simd.hTim Northover2014-03-291-2/+2
| | | | | | They were causing the autotools builds to fail. llvm-svn: 205103
* ARM64: initial clang support commit.Tim Northover2014-03-291-4/+5
| | | | | | | | | | | This adds Clang support for the ARM64 backend. There are definitely still some rough edges, so please bring up any issues you see with this patch. As with the LLVM commit though, we think it'll be more useful for merging with AArch64 from within the tree. llvm-svn: 205100
* Intrin.h: Implement _InterlockedExchangePointerReid Kleckner2014-03-261-0/+6
| | | | llvm-svn: 204827
* MS intrinsics: __interlockedbittestandset(64) (PR19054)Hans Wennborg2014-03-131-0/+22
| | | | llvm-svn: 203816
* MS intrinsics: implement the __movs and __stos intrinsics (PR19054)Hans Wennborg2014-03-121-0/+54
| | | | llvm-svn: 203722
* MS intrinsics: implement __readgs{byte,word,dword,qword} (PR19054)Hans Wennborg2014-03-121-4/+27
| | | | llvm-svn: 203715
* MS intrinsics: don't declare __readeflags and __writeeflags in Intrin.hHans Wennborg2014-03-121-2/+0
| | | | | | | | They're already defined in ia32intrin.h, and this would cause including Intrin.h in 64-bit mode to fail because of conflicting types. Update ms-intrin.cpp to also run in 64-bit mode to catch things like this. llvm-svn: 203714
* Headers: Provide an ABI compatible max_align_t when _MSC_VER is definedDavid Majnemer2014-03-041-0/+4
| | | | | | | | | | | | | | | | Summary: Our usual definition of max_align_t wouldn't match up with MSVC if it was used in a template argument. Reviewers: chandlerc, rsmith, rnk Reviewed By: chandlerc CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2924 llvm-svn: 202911
* The wmmintrin.h header includes two different sub-headers: one for AES supportRoman Divacky2014-03-041-1/+1
| | | | | | | | | | and one for PCLMUL support. The current immintrin.h header only includes wmmintrin.h if AES support is enabled. It should include it if either AES or PCLMUL is enabled (GCC's version of immintrin.h does this). Patch by John Baldwin! llvm-svn: 202871
* [CMake] Add the newly introduced compiler header.Argyrios Kyrtzidis2014-03-041-0/+1
| | | | llvm-svn: 202792
* Fix for r202778 - Implement __readeflags and __writeeflags intrinsics ↵Alexey Bataev2014-03-041-6/+6
| | | | | | (renamed res to __res) llvm-svn: 202784
* Implement __readeflags and __writeeflags intrinsicsAlexey Bataev2014-03-042-0/+84
| | | | llvm-svn: 202778
* [_mm_prefetch] Returning previously deleted comment.Warren Hunt2014-02-221-0/+3
| | | | | | | No functional change. It's unclear if the word FIXME is relevant given that the macro behaves as intended. llvm-svn: 201920
* Reapply 201734 but with appropriate gcc compatibilityWarren Hunt2014-02-212-21/+2
| | | | | | | | | | Because GCC incorrectly defines _mm_prefetch to take anything that casts to void*, people have started using that behavior. The previous patch that made _mm_prefetch actually take a const char * broke compatibility with existing code. This update to the patch leaves the macro that defines _mm_prefetch with the (void*) cast when _MSC_VER is not defined. llvm-svn: 201901
* Revert r201734 and r201742.Daniel Jasper2014-02-202-0/+23
| | | | | | | | | | | | | | | | | | | | | This breaks backwards compatibility with existing code. Previously, this was defined as #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel))) Which basically accepts any pointer. Changing this to char* simply breaks a lot of existing code. I have tried changing char* to "const void*", which seems to be the right thing as per Intel specification this should work on basically any pointer. However, apparently this breaks windows compatibility (because of a conflicting declaration in windows.h). So, we probably need to #ifdef this based on whether clang is compiling for windows. According to Chandler, this might be done by introducing an additional symbol to a fake type in BuiltinsX86.def and then condition the type expansion on the platform. llvm-svn: 201775
* Fix two pedantic issues with our builtin headers. The __STDC_VERSION__Chandler Carruth2014-02-192-2/+2
| | | | | | | | | for C99 is '199901L' and we shouldn't be comparing it with anything else. Neither of these should have had any impact in practice. llvm-svn: 201738
* Add _mm_prefetch and some others as MS builtinsWarren Hunt2014-02-192-23/+0
| | | | | | | | | | | | | This patch adds several built-ins that are required for ms compatibility. _mm_prefetch must be a built-in because it takes a compile-time constant argument and our prior approach of using a #define to the current built-in doesn't work in the presence of re-declaration of _mm_prefetch. The others can be obtained by including the windows system headers. If a user includes the windows system headers but not intrin.h they still need to work and therefore must be built-in because we don't get a chance to implement them in intrin.h in this case. llvm-svn: 201734
* Remove a broken attempt to cope with someone #undef'ing __has_include_next.Richard Smith2014-02-193-5/+3
| | | | | | | This was broken because __has_include_next(...) would not be valid in a preprocessor condition if __has_include_next is not defined. llvm-svn: 201731
* Teach Clang to provide ::max_align_t in C11 and C++11 modes.Chandler Carruth2014-02-191-0/+10
| | | | | | | | | | | | | | | | | | | | | | | This definition is not chosen idly. There is an unfortunate reality with max_align_t -- the specific nature of its definition leaks into the ABI almost immediately. Because it is part of C11 and C++11 it becomes essential for it to match with other systems on that ABI. There is an effort to discourage any further use of this construct as a consequence -- using max_align_t introduces an immediate ABI problem. We can never update it to have larger alignment even as the microarchitecture changes to necessitate higher alignment. =/ The particular definition here exactly matches the ABI of GCC's chosen ::max_align_t definition, for better or worse. This was written with the help of Richard Smith who was decoding the exact ABI implications of the selected definition in GCC. Notably, in-register arguments are impacted by the particular definition chosen. =/ No one is under the illusion that this is a "good" or "useful" definition of max_align_t, and we are working with the standards committee to specify a more useful interface to address this need. llvm-svn: 201729
* MS Intrin.h: implement __cpuidex and simplify __cpuidHans Wennborg2014-01-311-7/+7
| | | | | | | The two identical implementations of __cpuid for X86 / X86_64 were leftovers from my first iteration on the patch that implemented it. llvm-svn: 200568
* Intrin.h: include setjmp.h to get a jmp_buf definitionHans Wennborg2014-01-281-4/+4
| | | | | | | This makes sure that the ms-intrin.cpp test passes by providing a mock setjmp.h as a test input. llvm-svn: 200344
* Intrin.h: implement __rdtsc and __haltHans Wennborg2014-01-281-0/+12
| | | | llvm-svn: 200343
* Revert "intrin.h: include setjmp.h to get a jmp_buf definition"Reid Kleckner2014-01-271-4/+6
| | | | | | | | | | | This failed the ms-intrin.cpp test. This reverts commit r200237. This also comments out the _setjmpex declaration for now so that intrin.h will work on x64 targets. llvm-svn: 200243
* Add implementations of some MSVC intrinsicsReid Kleckner2014-01-271-0/+16
| | | | | | | | | Adds an implementation for _InterlockedCompareExchangePointer() and __faststorefence(). Patch by David Ziman! llvm-svn: 200239
* intrin.h: include setjmp.h to get a jmp_buf definitionReid Kleckner2014-01-271-4/+3
| | | | | | | This fixes an error on our _setjmpex declaration for 64-bit code and allows us to declare _setjmp for 32-bit code. llvm-svn: 200237
* Add 'static __inline__' to MSVC intrinsics with implementationsReid Kleckner2014-01-271-0/+9
| | | | | | This avoids warnings visible with -Wsystem-headers. llvm-svn: 200235
* One more intrinsic.Eric Christopher2014-01-251-0/+2
| | | | llvm-svn: 200061
* Add missing intrinsics, fix a couple of typos in intrinsic names,Eric Christopher2014-01-241-6/+40
| | | | | | and remove duplicate declarations. llvm-svn: 199992
* Add implementations of __readfs{byte,word,dword,qword} to Intrin.hHans Wennborg2014-01-241-0/+33
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2606 llvm-svn: 199958
* Intrin.h: fix definitions of _Interlocked{In,De}crement16Hans Wennborg2014-01-231-4/+4
| | | | | | | The declarations seem correct, but the definitions were using chars instead of shorts. llvm-svn: 199923
* [CMake] Deprecate CLANG_RUNTIME_OUTPUT_INTDIR and CLANG_LIBRARY_OUTPUT_INTDIR.NAKAMURA Takumi2014-01-191-1/+1
| | | | | | LLVM_*_OUTPUT_INTDIR should be available everywhere. It was my mistake when I introduced INTDIR stuff. llvm-svn: 199597
* Add implementations of _cpuid and _xgetbv to Intrin.hHans Wennborg2014-01-161-0/+19
| | | | | | | | | | | The _cpuid() implementation is the same as in lib/Headers/cpuid.h with the parameter names adjusted to match the interface. _xgetbv just does what the Intel manual says. Differential Revision: http://llvm-reviews.chandlerc.com/D2564 llvm-svn: 199439
* [CMake][VS][XCode] Restruct the output directory layout more comfortable, ↵NAKAMURA Takumi2013-12-301-34/+1
| | | | | | | | | | | | | | | | | | ${BINARY_DIR}/${BUILD_MODE}/(bin|lib) We have been seeing nasty directory layout with CMake multiconfig, such as, bin/Release/clang.exe lib/clang/3.x/... lib/Release/clang/3.x/.. (duplicated) Move the layout similar to autoconf's; Release/bin/clang.exe Release/lib/clang/3.x/... Checked on Visual Studio 10. Could you guys please confirm my change on XCode(and other multiconfig builders)? Note: Don't set variables CMAKE_*_OUTPUT_DIRECTORY any more, or a certain builder, for eaxample, msbuild.exe, would be confused. llvm-svn: 198205
* [CMake] clang/lib/Headers: Install just-generated ↵NAKAMURA Takumi2013-12-211-6/+7
| | | | | | ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h, instead of copied arm_neon.h. llvm-svn: 197852
* clang/lib/Headers/CMakeLists.txt: Revert part of r197395. It should not be ↵NAKAMURA Takumi2013-12-171-1/+1
| | | | | | staged yet. llvm-svn: 197441
OpenPOWER on IntegriCloud