summaryrefslogtreecommitdiffstats
path: root/clang/lib/Headers/Intrin.h
Commit message (Collapse)AuthorAgeFilesLines
* Rename Intrin.h to intrin.h, that's how all the documentation calls it.Nico Weber2016-06-141-957/+0
| | | | llvm-svn: 272701
* [Intrin.h] Sort the __read[fg]s intrinsicsDavid Majnemer2016-05-271-8/+8
| | | | | | No functional change is intended. llvm-svn: 270952
* Remove a duplicate declaration specifier from _ReadBarrierDavid Majnemer2016-02-201-1/+0
| | | | | | This fixes PR26675. llvm-svn: 261388
* Intrin.h: implement __emul and __emuluHans Wennborg2015-10-141-0/+11
| | | | llvm-svn: 250301
* [X86] Add XSAVE intrinsic familyAmjad Aboud2015-10-131-6/+0
| | | | | | | | | | | | Add intrinsics for the XSAVE instructions (XSAVE/XSAVE64/XRSTOR/XRSTOR64) XSAVEOPT instructions (XSAVEOPT/XSAVEOPT64) XSAVEC instructions (XSAVEC/XSAVEC64) XSAVES instructions (XSAVES/XSAVES64/XRSTORS/XRSTORS64) Differential Revision: http://reviews.llvm.org/D13014 llvm-svn: 250158
* ms Intrin.h: Fix __movsw's and __stosw's inline asm.Nico Weber2015-09-221-2/+2
| | | | | | | | | | | Before, clang's internal assembler would reject the inline asm in clang's Intrin.h. To make sure this doesn't happen for other Intrin.h functions using __asm__ blocks, add 32-bit and 64-bit codegen tests for Intrin.h. Sadly, these tests discovered that __readcr3 and __writecr3 have bad implementations in 64-bit builds. This will have to be fixed in a follow-up. llvm-svn: 248234
* [X86] Remove unnecessary MMX declarations from Intrin.hSimon Pilgrim2015-08-251-3/+0
| | | | | | | | | | | | As discussed in PR23648 - the intrinsics _m_from_int, _m_to_int and _m_prefetch are defined in mmintrin.h and prfchwintrin.h so we don't need to in Intrin.h Added tests for _m_from_int and _m_to_int D11338 already added a test for _m_prefetch Differential Revision: http://reviews.llvm.org/D12272 llvm-svn: 245975
* Revert r245923 since it breaks mingw.Michael Kuperstein2015-08-251-0/+20
| | | | llvm-svn: 245929
* [X86] Expose the various _rot intrinsics on non-MS platformsMichael Kuperstein2015-08-251-20/+0
| | | | | | | | | | | | | | _rotl, _rotwl and _lrotl (and their right-shift counterparts) are official x86 intrinsics, and should be supported regardless of environment. This is in contrast to _rotl8, _rotl16, and _rotl64 which are MS-specific. Note that the MS documentation for _lrotl is different from the Intel documentation. Intel explicitly documents it as a 64-bit rotate, while for MS, since sizeof(unsigned long) for MSVC is always 4, a 32-bit rotate is implied. Differential Revision: http://reviews.llvm.org/D12271 llvm-svn: 245923
* [Intrin.h] Use compiler builtins to model memory barriersDavid Majnemer2015-07-161-6/+4
| | | | | | | | | | | | | | _ReadBarrier, _WriteBarrier, and _ReadWriteBarrier are essentially memory barriers of one form or another. Model these as atomic_signal_fence(ATOMIC_SEQ_CST). __faststorefence is a curious intrinsic. It's single purpose seems to an alternative to mfence when that instruction is slow. However, mfence is not always slow and is, in general, preferable to a 'lock or' sequence on certain CPUs. Give the compiler freedom to select the best sequence to get a fence. llvm-svn: 242378
* [Intrin.h] Use __ATOMIC_SEQ_CST instead of '5'David Majnemer2015-07-131-31/+37
| | | | | | No functionality change is intended. llvm-svn: 242087
* [Intrin.h] Make the variable names more consistentDavid Majnemer2015-07-131-34/+32
| | | | | | No functionality change intended. llvm-svn: 242086
* Intrin.h: Don't invade the program's namespaceDavid Majnemer2015-07-131-34/+34
| | | | | | | The program is permitted to have stuff like '#define x' in it so avoid using identifiers not reserved for the implementation. llvm-svn: 242010
* Intrin.h: Clean up our atomic intrinsicsDavid Majnemer2015-07-131-43/+31
| | | | | | | | | | | | | | Three things: - The atomic intrinsics mandate memory barriers, let's start emitting some. - We don't need to manually create RMW operations, we can just do __atomic_fetch_foo instead of performing __atomic_foo_fetch and undoing foo. - Don't use inline assembly, we don't need it for these intrinsics. This fixes PR24101. llvm-svn: 242009
* [X86] Rename DEFAULT_FN_ATTR macro to __DEFAULT_FN_ATTRMichael Kuperstein2015-06-301-88/+88
| | | | llvm-svn: 241065
* [X86] Add FXSR intrinsicsMichael Kuperstein2015-06-301-4/+0
| | | | | | | | | Add intrinsics for the FXSR instructions (FXSAVE/FXSAVE64/FXRSTOR/FXRSTOR64) These were previously declared in Intrin.h for MSVC compatibility, but now that we have them implemented, these declarations can be removed. llvm-svn: 241053
* Use a macro for the omnipresent attributes on header functions in Intrin.h.Eric Christopher2015-06-151-86/+91
| | | | | | Saves some typing and if someone wants to change them it makes it much easier. llvm-svn: 239782
* Revert accidental commitDavid Majnemer2015-06-051-2/+7
| | | | | | This change was unrelated to r239170. llvm-svn: 239176
* [AST] There is no message for C++1z-style static_assertDavid Majnemer2015-06-051-7/+2
| | | | | | | | | | We would crash in the DeclPrinter trying to pretty-print the static_assert message. C++1z-style assertions don't have a message so we would crash. This fixes PR23756. llvm-svn: 239170
* Headers: Don't use attribute keywords which aren't reservedDavid Majnemer2015-02-041-5/+5
| | | | | | Instead of using 'unavailable', use '__unavailable__' llvm-svn: 228087
* Intrin.h: define _XCR_XFEATURE_ENABLED_MASKHans Wennborg2015-01-271-0/+1
| | | | | | Users expect to be able to use this with _xgetbv. llvm-svn: 227270
* Implement __umulh with __int128 arithmeticReid Kleckner2014-12-031-1/+6
| | | | | | Use the same approach as _umul128, but just return the high half. llvm-svn: 223316
* FullProduct should be _FullProductDavid Majnemer2014-12-021-2/+2
| | | | llvm-svn: 223179
* Intrin: shrx_u64 should be _shrx_u64David Majnemer2014-12-021-1/+1
| | | | llvm-svn: 223176
* Intrin: Add _umul128David Majnemer2014-12-021-3/+12
| | | | | | | | | | | | | | Implement _umul128; it provides the high and low halves of a 128-bit multiply. We can simply use our __int128 arithmetic to implement this, we generate great code for it: movq %rdx, %rax mulq %rcx movq %rdx, (%r8) retq Differential Revision: http://reviews.llvm.org/D6486 llvm-svn: 223175
* Add FSGSBASE intrinsics to x86 intrinsic headers.Craig Topper2014-11-031-8/+0
| | | | llvm-svn: 221130
* Remove definitions from Intrin.h that already exist in one of the other x86 ↵Craig Topper2014-11-031-52/+0
| | | | | | intrinsic headers. Add a run line with Broadwell as the cpu type to ms-intrin.cpp test to catch some of these in the future. llvm-svn: 221127
* CodeGen: add __readfsdword builtinSaleem Abdulrasool2014-10-291-4/+0
| | | | | | | | | The Windows NT SDK uses __readfsdword and declares it as a compiler provided builtin (#pragma intrinsic(__readfsword). Because intrin.h is not referenced by winnt.h, it is not possible to provide an out-of-line definition for the intrinsic. Provide a proper compiler builtin definition. llvm-svn: 220859
* Don't pull in setjmp.h in -ffreestanding compiles.Nico Weber2014-07-081-2/+7
| | | | | | | | Also provide _setjmpex(). r200243 put in _setjmp() and _setjmpex() behind a comment since jmp_buf wasn't available. r200344 added jmp_buf and put in _setjmp(), but missed _setjmpex(). llvm-svn: 212557
* Headers: conditionalise more declarationsSaleem Abdulrasool2014-07-081-0/+2
| | | | | | | | Protect MMX specific declarations under a __MMX__ guard. This header can be included on non-x86 architectures (e.g. ARM) which do not support the MMX ISA. Use the preprocessor to prevent these declarations from being processed. llvm-svn: 212512
* Headers: be a bit more careful about inline asmSaleem Abdulrasool2014-06-251-0/+12
| | | | | | | | | Conditionally include x86intrin.h if we are building for x86 or x86_64. Conditionalise definition of inline assembly routines which use x86 or x86_64 inline assembly. This is needed as clang can target Windows on ARM where these definitions may be included into user code. llvm-svn: 211716
* CodeGen: improve ms instrincics supportSaleem Abdulrasool2014-06-181-22/+1
| | | | | | | | | Add support for _InterlockedCompareExchangePointer, _InterlockExchangePointer, _InterlockExchange. These are available as a compiler intrinsic on ARM and x86. These are used directly by the Windows SDK headers without use of the intrin header. llvm-svn: 211216
* Define the InterlockedCompareExchange64 intrinsic on 32-bits tooTimur Iskhodzhanov2014-05-131-2/+0
| | | | llvm-svn: 208699
* Intrin.h: remove __rdtsc and __rdtscp declarationsHans Wennborg2014-04-241-3/+0
| | | | | | Since r207132, these are defined in ia32intrin.h. llvm-svn: 207134
* 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-311-6/+0
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D3212 llvm-svn: 205172
* 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
* Reapply 201734 but with appropriate gcc compatibilityWarren Hunt2014-02-211-18/+0
| | | | | | | | | | 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-201-0/+18
| | | | | | | | | | | | | | | | | | | | | 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
* Add _mm_prefetch and some others as MS builtinsWarren Hunt2014-02-191-18/+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
* 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
OpenPOWER on IntegriCloud