summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGBuiltin.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Pass the function type instead of the return type to FunctionDecl::CreateJonas Devlieghere2018-11-111-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix places where the return type of a FunctionDecl was being used in place of the function type FunctionDecl::Create() takes as its T parameter the type of function that should be created, not the return type. Passing in the return type looks to have been copypasta'd around a bit, but the number of correct usages outweighs the incorrect ones so I've opted for keeping what T is the same and fixing up the call sites instead. This fixes a crash in Clang when attempting to compile the following snippet of code with -fblocks -fsanitize=function -x objective-c++ (my original repro case): void g(void(^)()); void f() { __block int a = 0; g(^(){ a++; }); } as well as the following which only requires -fsanitize=function -x c++: void f(char * buf) { __builtin_os_log_format(buf, ""); } Patch by: Ben (bobsayshilol) Differential revision: https://reviews.llvm.org/D53263 llvm-svn: 346601
* T was unused on assertion disabled builds.Kadir Cetinkaya2018-11-061-5/+6
| | | | llvm-svn: 346216
* Cast to uint64_t instead of to unsigned.Akira Hatanaka2018-11-061-1/+1
| | | | | | This is a follow-up to r346211. llvm-svn: 346212
* os_log: Allow specifying mask type in format string.Akira Hatanaka2018-11-061-1/+6
| | | | | | | | | | A mask type is a 1 to 8-byte string that follows the "mask." annotation in the format string. This enables obfuscating data in the event the provided privacy level isn't enabled. rdar://problem/36756282 llvm-svn: 346211
* [COFF, ARM64] Implement InterlockedDecrement*_* builtinsMandeep Singh Grang2018-11-061-10/+49
| | | | | | | This is eight in a series of patches to move intrinsic definitions out of intrin.h. Differential: https://reviews.llvm.org/D54068 llvm-svn: 346208
* [COFF, ARM64] Implement InterlockedIncrement*_* builtinsMandeep Singh Grang2018-11-061-9/+48
| | | | | | | This is seventh in a series of patches to move intrinsic definitions out of intrin.h. Differential: https://reviews.llvm.org/D54067 llvm-svn: 346207
* [COFF, ARM64] Implement InterlockedAnd*_* builtinsMandeep Singh Grang2018-11-061-0/+42
| | | | | | | This is sixth in a series of patches to move intrinsic definitions out of intrin.h. Differential: https://reviews.llvm.org/D54066 llvm-svn: 346206
* [COFF, ARM64] Implement InterlockedXor*_* builtinsMandeep Singh Grang2018-11-061-0/+42
| | | | | | | | | 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. llvm-svn: 346205
* Revert "[COFF, ARM64] Implement InterlockedXor*_* builtins"Mandeep Singh Grang2018-11-061-0/+13148
| | | | | | This reverts commit cc3d3cd0fbeb88412d332354c261ff139c4ede6b. llvm-svn: 346192
* [COFF, ARM64] Implement InterlockedXor*_* builtinsMandeep Singh Grang2018-11-061-13148/+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 llvm-svn: 346191
* [COFF, ARM64] Implement InterlockedOr*_* builtinsMandeep Singh Grang2018-11-061-0/+42
| | | | | | This is fourth in a series of patches to move intrinsic definitions out of intrin.h. llvm-svn: 346190
* [COFF, ARM64] Implement InterlockedCompareExchange*_* builtinsMandeep Singh Grang2018-11-061-10/+83
| | | | | | | | | | | | | | 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 llvm-svn: 346189
* [COFF, ARM64] Implement InterlockedExchange*_* builtinsMandeep Singh Grang2018-11-021-0/+42
| | | | | | | | | | | | | | 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 llvm-svn: 346044
* [COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentryMandeep Singh Grang2018-11-021-2/+5
| | | | | | | | | | | | | | | | Summary: ARM64 setjmp expects sp on entry instead of framepointer. Patch by: Yin Ma (yinma@codeaurora.org) Reviewers: mgrang, eli.friedman, ssijaric, mstorsjo, rnk, compnerd Reviewed By: mgrang Subscribers: efriedma, javed.absar, kristof.beyls, chrib, cfe-commits Differential Revision: https://reviews.llvm.org/D53998 llvm-svn: 346024
* Reapply Logging: make os_log buffer size an integer constant expression.Tim Northover2018-11-021-8/+1
| | | | | | | | | | | | The size of an os_log buffer is known at any stage of compilation, so making it a constant expression means that the common idiom of declaring a buffer for it won't result in a VLA. That allows the compiler to skip saving and restoring the stack pointer around such buffers. This also moves the OSLog and other FormatString helpers from libclangAnalysis to libclangAST to avoid a circular dependency. llvm-svn: 345971
* Fix clang -Wimplicit-fallthrough warnings across llvm, NFCReid Kleckner2018-11-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch should not introduce any behavior changes. It consists of mostly one of two changes: 1. Replacing fall through comments with the LLVM_FALLTHROUGH macro 2. Inserting 'break' before falling through into a case block consisting of only 'break'. We were already using this warning with GCC, but its warning behaves slightly differently. In this patch, the following differences are relevant: 1. GCC recognizes comments that say "fall through" as annotations, clang doesn't 2. GCC doesn't warn on "case N: foo(); default: break;", clang does 3. GCC doesn't warn when the case contains a switch, but falls through the outer case. I will enable the warning separately in a follow-up patch so that it can be cleanly reverted if necessary. Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu Differential Revision: https://reviews.llvm.org/D53950 llvm-svn: 345882
* Revert "[COFF, ARM64] Change setjmp for AArch64 Windows to use ↵Mandeep Singh Grang2018-11-011-5/+2
| | | | | | | | Intrinsic.sponentry" This reverts commit 619111f5ccf349b635e4987ec02d15777c571495. llvm-svn: 345872
* Revert "Reapply Logging: make os_log buffer size an integer constant ↵Tim Northover2018-11-011-1/+8
| | | | | | | | expression." Still more dependency hell. llvm-svn: 345871
* Reapply Logging: make os_log buffer size an integer constant expression.Tim Northover2018-11-011-8/+1
| | | | | | | | | | | | The size of an os_log buffer is known at any stage of compilation, so making it a constant expression means that the common idiom of declaring a buffer for it won't result in a VLA. That allows the compiler to skip saving and restoring the stack pointer around such buffers. This also moves the OSLog helpers from libclangAnalysis to libclangAST to avoid a circular dependency. llvm-svn: 345866
* Revert "Logging: make os_log buffer size an integer constant expression.Tim Northover2018-11-011-0/+7
| | | | | | | | This also reverts a couple of follow-up commits trying to fix the dependency issues. Latest revision added a cyclic dependency that can't just be patched up in 5 minutes. llvm-svn: 345846
* Logging: make os_log buffer size an integer constant expression.Tim Northover2018-11-011-7/+0
| | | | | | | | | The size of an os_log buffer is known at any stage of compilation, so making it a constant expression means that the common idiom of declaring a buffer for it won't result in a VLA. That allows the compiler to skip saving and restoring the stack pointer around such buffers. llvm-svn: 345828
* [COFF, ARM64] Implement llvm.addressofreturnaddress intrinsicMandeep Singh Grang2018-11-011-0/+5
| | | | llvm-svn: 345808
* [WebAssembly] Fix type names in truncation builtinsThomas Lively2018-11-011-4/+4
| | | | | | | | | | | | Summary: Use the same convention as all the other WebAssembly builtin names. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits Differential Revision: https://reviews.llvm.org/D53724 llvm-svn: 345804
* [COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentryMandeep Singh Grang2018-10-311-2/+5
| | | | | | | | | | | | | | Summary: ARM64 setjmp expects sp on entry instead of framepointer. Reviewers: mgrang, rnk, TomTan, compnerd, mstorsjo, efriedma Reviewed By: mstorsjo Subscribers: javed.absar, kristof.beyls, chrib, cfe-commits Differential Revision: https://reviews.llvm.org/D53684 llvm-svn: 345792
* [ARM64] [Windows] Implement _InterlockedExchangeAdd*_* builtins.Eli Friedman2018-10-311-4/+46
| | | | | | | | | These apparently need to be proper builtins to handle the Windows SDK. Differential Revision: https://reviews.llvm.org/D53916 llvm-svn: 345779
* [AArch64] Implement FP16FML intrinsicsBryan Chan2018-10-251-0/+36
| | | | | | | | | | | | | Generate the FP16FML intrinsics into arm_neon.h (AArch64 only for now). Add two new type modifiers to NeonEmitter to handle the new prototypes. Define __ARM_FEATURE_FP16FML when +fp16fml is enabled and guard the intrinsics with the macro in arm_neon.h. Based on a patch by Gao Yiling. Differential Revision: https://reviews.llvm.org/D53633 llvm-svn: 345344
* [WebAssembly] Bitselect and min/max builtinsThomas Lively2018-10-251-0/+28
| | | | | | | | | | Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits Differential Revision: https://reviews.llvm.org/D53685 llvm-svn: 345301
* [WebAssembly] Lower to target-independent saturating addThomas Lively2018-10-251-2/+2
| | | | | | | | | | | | Summary: Goes along with D53721. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits Differential Revision: https://reviews.llvm.org/D53722 llvm-svn: 345300
* [X86] Add support for more than 32 features for __builtin_cpu_isCraig Topper2018-10-201-27/+50
| | | | | | | | | | | | | | libgcc supports more than 32 features by adding a new 32-bit variable __cpu_features2. This adds the clang support for checking these feature bits. Patches for compiler-rt and llvm to support this are coming as well. Probably still need an additional patch for target multiversioning in clang. Differential Revision: https://reviews.llvm.org/D53458 llvm-svn: 344832
* [X86] When checking the bits in cpu_features for function multiversioning ↵Craig Topper2018-10-201-3/+3
| | | | | | | | | | | | | | | | | | | dispatcher in the resolver, make sure all the required bits are set. Not just one of them Summary: The multiversioning code repurposed the code from __builtin_cpu_supports for checking if a single feature is enabled. That code essentially performed (_cpu_features & (1 << C)) != 0. But with the multiversioning path, the mask is no longer guaranteed to be a power of 2. So we return true anytime any one of the bits in the mask is set not just all of the bits. The correct check is (_cpu_features & mask) == mask Reviewers: erichkeane, echristo Reviewed By: echristo Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53460 llvm-svn: 344824
* [COFF, ARM64] Add _ReadStatusReg and_WriteStatusReg intrinsicsMandeep Singh Grang2018-10-181-0/+37
| | | | | | | | | | | | Reviewers: rnk, compnerd, mstorsjo, efriedma, TomTan, haripul, javed.absar Reviewed By: efriedma Subscribers: dmajor, kristof.beyls, chrib, cfe-commits Differential Revision: https://reviews.llvm.org/D53115 llvm-svn: 344765
* AMDGPU: add __builtin_amdgcn_update_dppYaxun Liu2018-10-171-5/+9
| | | | | | | | | | Emit llvm.amdgcn.update.dpp for both __builtin_amdgcn_mov_dpp and __builtin_amdgcn_update_dpp. The first argument to llvm.amdgcn.update.dpp will be undef for __builtin_amdgcn_mov_dpp. Differential Revision: https://reviews.llvm.org/D52320 llvm-svn: 344665
* [WebAssembly] Saturating float-to-int builtinsThomas Lively2018-10-111-0/+24
| | | | | | | | | | | | Summary: Depends on D53007 and D53004. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits Differential Revision: https://reviews.llvm.org/D53009 llvm-svn: 344205
* [COFF, ARM64] Add _InterlockedAdd intrinsicMandeep Singh Grang2018-10-051-0/+9
| | | | | | | | | | | | Reviewers: rnk, mstorsjo, compnerd, TomTan, haripul, javed.absar, efriedma Reviewed By: efriedma Subscribers: efriedma, kristof.beyls, chrib, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D52811 llvm-svn: 343894
* [COFF, ARM64] Add _InterlockedCompareExchangePointer_nf intrinsicMandeep Singh Grang2018-10-051-5/+8
| | | | | | | | | | | | 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 llvm-svn: 343881
* [WebAssembly] abs and sqrt builtinsThomas Lively2018-10-051-0/+12
| | | | | | | | | | | | Summary: Depends on D52910. Reviewers: aheejin, dschuff, craig.topper Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits Differential Revision: https://reviews.llvm.org/D52913 llvm-svn: 343838
* [WebAssembly] any_true and all_true builtinsThomas Lively2018-10-051-0/+29
| | | | | | | | | | | | Summary: Depends on D52858. Reviewers: aheejin, dschuff, craig.topper Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits Differential Revision: https://reviews.llvm.org/D52910 llvm-svn: 343837
* [WebAssembly] saturating arithmetic builtinsThomas Lively2018-10-051-0/+34
| | | | | | | | | | | | Summary: Depends on D52856. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits Differential Revision: https://reviews.llvm.org/D52858 llvm-svn: 343836
* [WebAssembly] __builtin_wasm_replace_lane_* builtinsThomas Lively2018-10-051-0/+28
| | | | | | | | | | | | Summary: Depends on D52852. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits Differential Revision: https://reviews.llvm.org/D52856 llvm-svn: 343835
* [WebAssembly] __builtin_wasm_extract_lane_* builtinsThomas Lively2018-10-051-0/+30
| | | | | | | | | | Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits Differential Revision: https://reviews.llvm.org/D52852 llvm-svn: 343834
* [COFF, ARM64] Add __getReg intrinsicMandeep Singh Grang2018-10-041-0/+17
| | | | | | | | | | | | Reviewers: rnk, mstorsjo, compnerd, TomTan, haripul, javed.absar, efriedma Reviewed By: efriedma Subscribers: peter.smith, efriedma, kristof.beyls, chrib, cfe-commits Differential Revision: https://reviews.llvm.org/D52838 llvm-svn: 343824
* [COFF, ARM64] Add _ReadWriteBarrier intrinsicMandeep Singh Grang2018-10-031-0/+4
| | | | | | | | | | | | Reviewers: rnk, mstorsjo, compnerd, TomTan, haripul, javed.absar Reviewed By: rnk Subscribers: kristof.beyls, chrib, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D52809 llvm-svn: 343699
* [X86] For lzcnt/tzcnt intrinsics use cttz/ctlz intrinsics with zero_undef ↵Craig Topper2018-09-261-0/+12
| | | | | | | | | | | | 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 llvm-svn: 343126
* [PowerPC] [Clang] Add vector int128 pack/unpack builtinsQingShan Zhang2018-09-201-0/+22
| | | | | | | | | | | | unsigned long long builtin_unpack_vector_int128 (vector int128_t, int); vector int128_t builtin_pack_vector_int128 (unsigned long long, unsigned long long); Builtins should behave the same way as in GCC. Patch By: wuzish (Zixuan Wu) Differential Revision: https://reviews.llvm.org/D52074 llvm-svn: 342614
* [X86] Custom emit __builtin_rdtscp so we can emit an explicit store for the ↵Craig Topper2018-09-071-0/+6
| | | | | | | | | | out parameter This is the clang side of D51803. The llvm intrinsic now returns two results. So we need to emit an explicit store in IR for the out parameter. This is similar to addcarry/subborrow/rdrand/rdseed. Differential Revision: https://reviews.llvm.org/D51805 llvm-svn: 341699
* [X86] Modify addcarry/subborrow builtins to emit an 2 result and intrinsic ↵Craig Topper2018-09-071-0/+35
| | | | | | | | | | and an store instruction. This is the clang side of D51769. The llvm intrinsics now return two results instead of using an out parameter. Differential Revision: https://reviews.llvm.org/D51771 llvm-svn: 341678
* [X86] Add ktest intrinsics to match gcc and icc.Craig Topper2018-08-311-0/+44
| | | | | | | | | | | | These aren't documented in the Intel Intrinsics Guide, but are supported by gcc and icc. Includes these intrinsics: _ktestc_mask8_u8, _ktestz_mask8_u8, _ktest_mask8_u8 _ktestc_mask16_u8, _ktestz_mask16_u8, _ktest_mask16_u8 _ktestc_mask32_u8, _ktestz_mask32_u8, _ktest_mask32_u8 _ktestc_mask64_u8, _ktestz_mask64_u8, _ktest_mask64_u8 llvm-svn: 341265
* [X86] Add k-mask conversion and load/store instrinsics to match gcc and icc.Craig Topper2018-08-311-0/+11
| | | | | | | | | | | | This adds: _cvtmask8_u32, _cvtmask16_u32, _cvtmask32_u32, _cvtmask64_u64 _cvtu32_mask8, _cvtu32_mask16, _cvtu32_mask32, _cvtu64_mask64 _load_mask8, _load_mask16, _load_mask32, _load_mask64 _store_mask8, _store_mask16, _store_mask32, _store_mask64 These are currently missing from the Intel Intrinsics Guide webpage. llvm-svn: 341251
* [X86] Add kshift intrinsics to match gcc and icc.Craig Topper2018-08-311-0/+44
| | | | | | | | | | | | | | This adds the following intrinsics: _kshiftli_mask8 _kshiftli_mask16 _kshiftli_mask32 _kshiftli_mask64 _kshiftri_mask8 _kshiftri_mask16 _kshiftri_mask32 _kshiftri_mask64 llvm-svn: 341234
* [X86] Add kadd intrinsics to match gcc and icc.Craig Topper2018-08-281-1/+29
| | | | | | | | | | | | This adds the following intrinsics: _kadd_mask64 _kadd_mask32 _kadd_mask16 _kadd_mask8 These are missing from the Intel Intrinsics Guide, but are implemented by both gcc and icc. llvm-svn: 340879
OpenPOWER on IntegriCloud