summaryrefslogtreecommitdiff
path: root/test/CodeGen/ms-intrinsics.c
Commit message (Collapse)AuthorAgeFilesLines
* Updated the signature for some stack related intrinsics (CLANG)Christudasan Devadasan2019-07-221-1/+1
| | | | | | | | | | | | | Modified the intrinsics int_addressofreturnaddress, int_frameaddress & int_sponentry. This commit depends on the changes in rL366679 Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D64563 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366683 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Make __iso_volatile_* available on all targetsReid Kleckner2019-03-281-0/+29
| | | | | | | | | | | Future versions of MSVC make these intrinsics available on x86 & x64, according to: http://lists.llvm.org/pipermail/cfe-dev/2019-March/061711.html The purpose of these builtins is to emit plain, non-atomic, volatile stores when /volatile:ms (-cc1 -fms-volatile) is enabled. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357220 91177308-0d34-0410-b5e6-96231b3b80d8
* [COFF, ARM64] Add ARM64 support for MS intrinsic _fastfailTom Tan2019-02-061-3/+2
| | | | | | | | | | | The MSDN document was also updated to reflect this, but it probably will take a few days to show in below link. https://docs.microsoft.com/en-us/cpp/intrinsics/fastfail Differential Revision: https://reviews.llvm.org/D57631 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353337 91177308-0d34-0410-b5e6-96231b3b80d8
* [COFF, ARM64] Implement InterlockedDecrement*_* builtinsMandeep Singh Grang2018-11-061-0/+81
| | | | | | | | This is eight in a series of patches to move intrinsic definitions out of intrin.h. Differential: https://reviews.llvm.org/D54068 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346208 91177308-0d34-0410-b5e6-96231b3b80d8
* [COFF, ARM64] Implement InterlockedIncrement*_* builtinsMandeep Singh Grang2018-11-061-0/+81
| | | | | | | | This is seventh in a series of patches to move intrinsic definitions out of intrin.h. Differential: https://reviews.llvm.org/D54067 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346207 91177308-0d34-0410-b5e6-96231b3b80d8
* [COFF, ARM64] Implement InterlockedAnd*_* builtinsMandeep Singh Grang2018-11-061-0/+96
| | | | | | | | This is sixth in a series of patches to move intrinsic definitions out of intrin.h. Differential: https://reviews.llvm.org/D54066 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346206 91177308-0d34-0410-b5e6-96231b3b80d8
* [COFF, ARM64] Implement InterlockedXor*_* builtinsMandeep Singh Grang2018-11-061-0/+96
| | | | | | | | | This is fifth in a series of patches to move intrinsic definitions out of intrin.h. Note: This was reviewed and approved in D54065 but somehow that diff was messed up. Committing this again with the proper diff. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346205 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[COFF, ARM64] Implement InterlockedXor*_* builtins"Mandeep Singh Grang2018-11-061-0/+1002
| | | | | | This reverts commit cc3d3cd0fbeb88412d332354c261ff139c4ede6b. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346192 91177308-0d34-0410-b5e6-96231b3b80d8
* [COFF, ARM64] Implement InterlockedXor*_* builtinsMandeep Singh Grang2018-11-061-1002/+0
| | | | | | | | | | | | | | Summary: This is fifth in a series of patches to move intrinsic definitions out of intrin.h. Reviewers: rnk, efriedma, mstorsjo, TomTan Reviewed By: efriedma Subscribers: javed.absar, kristof.beyls, chrib, jfb, kristina, cfe-commits Differential Revision: https://reviews.llvm.org/D54065 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346191 91177308-0d34-0410-b5e6-96231b3b80d8
* [COFF, ARM64] Implement InterlockedOr*_* builtinsMandeep Singh Grang2018-11-061-0/+96
| | | | | | This is fourth in a series of patches to move intrinsic definitions out of intrin.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346190 91177308-0d34-0410-b5e6-96231b3b80d8
* [COFF, ARM64] Implement InterlockedCompareExchange*_* builtinsMandeep Singh Grang2018-11-061-0/+108
| | | | | | | | | | | | | | Summary: This is third in a series of patches to move intrinsic definitions out of intrin.h. Reviewers: rnk, efriedma, mstorsjo, TomTan Reviewed By: efriedma Subscribers: javed.absar, kristof.beyls, chrib, jfb, kristina, cfe-commits Differential Revision: https://reviews.llvm.org/D54062 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346189 91177308-0d34-0410-b5e6-96231b3b80d8
* [COFF, ARM64] Implement InterlockedExchange*_* builtinsMandeep Singh Grang2018-11-021-0/+84
| | | | | | | | | | | | | | Summary: Windows SDK needs these intrinsics to be proper builtins. This is second in a series of patches to move intrinsic defintions out of intrin.h. Reviewers: rnk, mstorsjo, efriedma, TomTan Reviewed By: rnk, efriedma Subscribers: javed.absar, kristof.beyls, chrib, jfb, kristina, cfe-commits Differential Revision: https://reviews.llvm.org/D54046 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346044 91177308-0d34-0410-b5e6-96231b3b80d8
* [COFF, ARM64] Implement llvm.addressofreturnaddress intrinsicMandeep Singh Grang2018-11-011-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345808 91177308-0d34-0410-b5e6-96231b3b80d8
* [ARM64] [Windows] Implement _InterlockedExchangeAdd*_* builtins.Eli Friedman2018-10-311-2/+90
| | | | | | | | | | | These apparently need to be proper builtins to handle the Windows SDK. Differential Revision: https://reviews.llvm.org/D53916 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345779 91177308-0d34-0410-b5e6-96231b3b80d8
* [COFF, ARM64] Add _InterlockedCompareExchangePointer_nf intrinsicMandeep Singh Grang2018-10-051-0/+15
| | | | | | | | | | | | Reviewers: rnk, mstorsjo, compnerd, TomTan, haripul, efriedma Reviewed By: efriedma Subscribers: efriedma, kristof.beyls, chrib, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D52807 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343881 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate instances of `EmitScalarExpr(E->getArg(n))` in EmitX86BuiltinExpr().Nico Weber2018-08-211-6/+13
| | | | | | | | | | | | | EmitX86BuiltinExpr() emits all args into Ops at the beginning, so don't do that work again. This changes behavior: If e.g. ++a was passed as an arg, we incremented a twice previously. This change fixes that bug. https://reviews.llvm.org/D50979 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340348 91177308-0d34-0410-b5e6-96231b3b80d8
* [COFF] Add more missing MSVC ARM64 intrinsicsMandeep Singh Grang2018-07-171-3/+7
| | | | | | | | | | | | | | | | | | | Summary: Added the following intrinsics: _BitScanForward, _BitScanReverse, _BitScanForward64, _BitScanReverse64 _InterlockedAnd64, _InterlockedDecrement64, _InterlockedExchange64, _InterlockedExchangeAdd64, _InterlockedExchangeSub64, _InterlockedIncrement64, _InterlockedOr64, _InterlockedXor64. Reviewers: compnerd, mstorsjo, rnk, javed.absar Reviewed By: mstorsjo Subscribers: kristof.beyls, chrib, llvm-commits Differential Revision: https://reviews.llvm.org/D49445 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337327 91177308-0d34-0410-b5e6-96231b3b80d8
* [X86] Correct the inline assembly implementations of __movsb/w/d/q and ↵Craig Topper2018-06-211-0/+83
| | | | | | | | | | | | __stosw/d/q to mark registers/memory as modified The inline assembly for these didn't mark that edi, esi, ecx are modified by movs/stos instruction. It also didn't mark that memory is modified. This issue was reported to llvm-dev last year http://lists.llvm.org/pipermail/cfe-dev/2017-November/055863.html but no bug was ever filed. Differential Revision: https://reviews.llvm.org/D48448 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335270 91177308-0d34-0410-b5e6-96231b3b80d8
* [X86] Add inline assembly versions of ↵Craig Topper2018-06-141-0/+49
| | | | | | | | | | _InterlockedExchange_HLEAcquire/Release and _InterlockedCompareExchange_HLEAcquire/Release for MSVC compatibility. Clang/LLVM doesn't have a way to pass an HLE hint through to the X86 backend to emit HLE prefixed instructions. So this is a good short term fix. Differential Revision: https://reviews.llvm.org/D47672 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334751 91177308-0d34-0410-b5e6-96231b3b80d8
* Reimplement the bittest intrinsic family as builtins with inline asmReid Kleckner2018-06-051-11/+0
| | | | | | | | | | | We need to implement _interlockedbittestandset as a builtin for windows.h, so we might as well do the whole family. It reduces code duplication anyway. Fixes PR33188, a long standing bug in our bittest implementation encountered by Chakra. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333978 91177308-0d34-0410-b5e6-96231b3b80d8
* Bring r325915 back.Rafael Espindola2018-02-231-1/+1
| | | | | | | | | | | | | | | The tests that failed on a windows host have been fixed. Original message: Start setting dso_local for COFF. With this there are still some GVs where we don't set dso_local because setGVProperties is never called. I intend to fix that in followup commits. This is just the bare minimum to teach shouldAssumeDSOLocal what it should do for COFF. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325940 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Start setting dso_local for COFF."Rafael Espindola2018-02-231-1/+1
| | | | | | | | This reverts commit r325915. It will take some time to fix the failures on a windows host. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325929 91177308-0d34-0410-b5e6-96231b3b80d8
* Start setting dso_local for COFF.Rafael Espindola2018-02-231-1/+1
| | | | | | | | | With this there are still some GVs where we don't set dso_local because setGVProperties is never called. I intend to fix that in followup commits. This is just the bare minimum to teach shouldAssumeDSOLocal what it should do for COFF. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325915 91177308-0d34-0410-b5e6-96231b3b80d8
* Change memcpy/memove/memset to have dest and source alignment attributes ↵Daniel Neilson2018-01-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | (Step 1). Summary: Upstream LLVM is changing the the prototypes of the @llvm.memcpy/memmove/memset intrinsics. This change updates the Clang tests for this change. The @llvm.memcpy/memmove/memset intrinsics currently have an explicit argument which is required to be a constant integer. It represents the alignment of the dest (and source), and so must be the minimum of the actual alignment of the two. This change removes the alignment argument in favour of placing the alignment attribute on the source and destination pointers of the memory intrinsic call. For example, code which used to read: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 100, i32 4, i1 false) will now read call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %dest, i8* align 4 %src, i32 100, i1 false) At this time the source and destination alignments must be the same (Step 1). Step 2 of the change, to be landed shortly, will relax that contraint and allow the source and destination to have different alignments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322964 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen][X86] Implement _InterlockedCompareExchange128 intrinsicReid Kleckner2017-12-141-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: InterlockedCompareExchange128 is a bit more complicated than the other InterlockedCompareExchange functions, so it requires a bit more work. It doesn't directly refer to 128bit ints, instead it takes pointers to 64bit ints for Destination and ComparandResult, and exchange is taken as two 64bit ints (high & low). The previous value is written to ComparandResult, and success is returned. This implementation does the following in order to produce a cmpxchg instruction: 1. Cast everything to 128bit ints or int pointers, and glues together the Exchange values 2. Reads from CompareandResult to get the comparand 3. Calls cmpxchg volatile (on X86 this will produce a lock cmpxchg16b instruction) 1. Result 0 (previous value) is written back to ComparandResult 2. Result 1 (success bool) is zext'ed to a uchar and returned Resolves bug https://llvm.org/PR35251 Patch by Colden Cullen! Reviewers: rnk, agutowski Reviewed By: rnk Subscribers: majnemer, cfe-commits Differential Revision: https://reviews.llvm.org/D41032 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320730 91177308-0d34-0410-b5e6-96231b3b80d8
* Attempt to fix ms-intrinsics.c testHans Wennborg2017-04-071-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299785 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement _interlockedbittestandset as a builtinHans Wennborg2017-04-071-0/+11
| | | | | | | | | It's used by MS headers in VS 2017 without including intrin.h, so we can't implement it in the header anymore. Differential Revision: https://reviews.llvm.org/D31736 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299782 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Add support for __ud2 and __int2c MSVC intrinsicsReid Kleckner2017-03-061-1/+15
| | | | | | This was requested in PR31958 and elsewhere. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297057 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Implement the __fastfail intrinsic as a builtinReid Kleckner2017-02-091-1/+13
| | | | | | | | | | __fastfail terminates the process immediately with a special system call. It does not run any process shutdown code or exception recovery logic. Fixes PR31854 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294606 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement __stosb intrinsic as a volatile memsetAlbert Gutowski2016-10-141-0/+16
| | | | | | | | | | | | Summary: We need `__stosb` to be an intrinsic, because SecureZeroMemory function uses it without including intrin.h. Implementing it as a volatile memset is not consistent with MSDN specification, but it gives us target-independent IR while keeping the most important properties of `__stosb`. Reviewers: rnk, hans, thakis, majnemer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25334 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284253 91177308-0d34-0410-b5e6-96231b3b80d8
* Add 64-bit MS _Interlocked functions as builtins againAlbert Gutowski2016-10-131-0/+69
| | | | | | | | | | | | Summary: Previously global 64-bit versions of _Interlocked functions broke buildbots on i386, so now I'm adding them as builtins for x86-64 and ARM only (should they be also on AArch64? I had problems with testing it for AArch64, so I left it) Reviewers: hans, majnemer, mstorsjo, rnk Subscribers: cfe-commits, aemerson Differential Revision: https://reviews.llvm.org/D25576 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284172 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement MS _ReturnAddress and _AddressOfReturnAddress intrinsicsAlbert Gutowski2016-10-131-3/+19
| | | | | | | | | | Reviewers: rnk, thakis, majnemer, hans Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25540 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284131 91177308-0d34-0410-b5e6-96231b3b80d8
* fix ms-intrinsics labels code to work with builds with assertionsAlbert Gutowski2016-10-121-8/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284083 91177308-0d34-0410-b5e6-96231b3b80d8
* fix regexes for label names in ms-intrinsics testAlbert Gutowski2016-10-121-8/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284062 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement MS _BitScan intrinsicsAlbert Gutowski2016-10-121-3/+65
| | | | | | | | | | | | Summary: _BitScan intrinsics (and some others, for example _Interlocked and _bittest) are supposed to work on both ARM and x86. This is an attempt to isolate them, avoiding repeating their code or writing separate function for each builtin. Reviewers: hans, thakis, rnk, majnemer Subscribers: RKSimon, cfe-commits, aemerson Differential Revision: https://reviews.llvm.org/D25264 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284060 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement __emul, __emulu, _mul128 and _umul128 MS intrinsicsAlbert Gutowski2016-10-101-26/+0
| | | | | | | | | | | Reviewers: rnk, thakis, majnemer, hans Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25353 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283785 91177308-0d34-0410-b5e6-96231b3b80d8
* Separate builtins for x84-64 and i386; implement __mulh and __umulhAlbert Gutowski2016-10-041-1/+6
| | | | | | | | | | | | | Summary: We need x86-64-specific builtins if we want to implement some of the MS intrinsics - winnt.h contains definitions of some functions for i386, but not for x86-64 (for example _InterlockedOr64), which means that we cannot treat them as builtins for both i386 and x86-64, because then we have definitions of builtin functions in winnt.h on i386. Reviewers: thakis, majnemer, hans, rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24598 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283264 91177308-0d34-0410-b5e6-96231b3b80d8
* Temporary fix for MS _Interlocked intrinsicsAlbert Gutowski2016-09-131-66/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281401 91177308-0d34-0410-b5e6-96231b3b80d8
* Add bunch of _Interlocked builtinsAlbert Gutowski2016-09-131-9/+281
| | | | | | | | | | | Reviewers: compnerd, thakis, Prazek, majnemer, rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24153 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281378 91177308-0d34-0410-b5e6-96231b3b80d8
* s/Intrin.h/intrin.h/, trying to fix the build after r272701Hans Wennborg2016-06-141-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272702 91177308-0d34-0410-b5e6-96231b3b80d8
* Missed a spot in r261251, also ignore attributes on all pointer parametersKrzysztof Parzyszek2016-02-181-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261253 91177308-0d34-0410-b5e6-96231b3b80d8
* Make test less prone to attribute changesKrzysztof Parzyszek2016-02-181-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261251 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Clang tests to handle explicitly typed load changes in LLVM.David Blaikie2015-02-271-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230795 91177308-0d34-0410-b5e6-96231b3b80d8
* Update tests due to r224849David Majnemer2014-12-261-1/+1
| | | | | | Inferring nuw caused some clang tests to change their output. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224851 91177308-0d34-0410-b5e6-96231b3b80d8
* Add test for __umulhReid Kleckner2014-12-031-12/+34
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223319 91177308-0d34-0410-b5e6-96231b3b80d8
* test: generalise the test matchingSaleem Abdulrasool2014-10-291-3/+3
| | | | | | The value names may change in different builds, use pattern based tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220861 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: add __readfsdword builtinSaleem Abdulrasool2014-10-291-1/+14
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220859 91177308-0d34-0410-b5e6-96231b3b80d8
* tests: relax ms-intrinsics testSaleem Abdulrasool2014-06-181-17/+14
| | | | | | | | | | Relax the tests to allow for differences between release and debug builds. This should fix the buildbots. Thanks to Benjamin Kramer and Eric Christo for their invaluable tip that this was release build specific issue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211227 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: improve ms instrincics supportSaleem Abdulrasool2014-06-181-0/+41
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211216 91177308-0d34-0410-b5e6-96231b3b80d8