summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGBuiltin.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [X86][SSE4A] Use native IR for mask movntsd/movntss intrinsics.Simon Pilgrim2016-06-171-0/+20
| | | | | | Depends on llvm side commit r273002. llvm-svn: 273003
* [ARM] Add mrrc/mrrc2 intrinsics and update existing mcrr/mcrr2 intrinsics.Ranjeet Singh2016-06-171-0/+68
| | | | | | | | | | Reapplying patch in r272777 which was reverted because the llvm patch which added support for generating the mcrr/mcrr2 instructions from the intrinsic was causing an assertion failure. This has now been fixed in llvm. llvm-svn: 272983
* [x86] generate IR for AVX2 integer min/max builtinsSanjay Patel2016-06-161-5/+17
| | | | | | | Sibling patch to r272932: http://reviews.llvm.org/rL272932 llvm-svn: 272933
* [Builtin] Make __builtin_thread_pointer target-independent.Marcin Koscielnicki2016-06-161-0/+7
| | | | | | | | This is now supported for ARM, AArch64, PowerPC, SystemZ, SPARC, Mips. Differential Revision: http://reviews.llvm.org/D19589 llvm-svn: 272893
* [x86] translate SSE packed FP comparison builtins to IRSanjay Patel2016-06-151-124/+74
| | | | | | | | | | | | | As noted in the code comment, a potential follow-on would be to remove the builtins themselves. Other than ord/unord, this already works as expected. Eg: typedef float v4sf __attribute__((__vector_size__(16))); v4sf fcmpgt(v4sf a, v4sf b) { return a > b; } Differential Revision: http://reviews.llvm.org/D21268 llvm-svn: 272840
* [x86] generate IR for SSE integer min/max builtinsSanjay Patel2016-06-151-0/+27
| | | | | | | Sibling patch to r272806: http://reviews.llvm.org/rL272806 llvm-svn: 272807
* Reverting r272777 because one of the testsRanjeet Singh2016-06-151-68/+0
| | | | | | | added in the llvm patch is causing an assertion to fail. llvm-svn: 272790
* [AVX512] Use native IR for mask pcmpeq/pcmpgt intrinsics.Craig Topper2016-06-151-0/+49
| | | | llvm-svn: 272787
* [ARM] Add mrrc/mrrc2 intrinsics and update existing mcrr/mcrr2 intrinsics.Ranjeet Singh2016-06-151-0/+68
| | | | | | | | | | | | | | Patch adds intrinsics for mrrc/mrrc2. The intrinsics for mrrc/mrrc2 return a single uint64_t to represent two 32 bit values. The mcrr/mcrr2 intrinsic was changed to accept a single uint64_t instead of two 32 bit values as the input for consistency. Differential Revision: http://reviews.llvm.org/D21179 llvm-svn: 272777
* Fix unused variable warningSimon Pilgrim2016-06-131-51/+50
| | | | llvm-svn: 272541
* [Clang][X86] Convert non-temporal store builtins to generic ↵Simon Pilgrim2016-06-131-63/+51
| | | | | | | | | | | | | | __builtin_nontemporal_store in headers We can now use __builtin_nontemporal_store instead of target specific builtins for naturally aligned nontemporal stores which avoids the need for handling in CGBuiltin.cpp The scalar integer nontemporal (unaligned) store builtins will have to wait as __builtin_nontemporal_store currently assumes natural alignment and doesn't accept the 'packed struct' trick that we use for normal unaligned load/stores. The nontemporal loads require further backend support before we can safely convert them to __builtin_nontemporal_load Differential Revision: http://reviews.llvm.org/D21272 llvm-svn: 272540
* [CodeGen] Update to use an ArrayRef of uint32_t instead of int in calls to ↵Craig Topper2016-06-121-10/+10
| | | | | | CreateShuffleVector to match llvm interface change. llvm-svn: 272492
* [X86] Handle AVX2 pslldqi and psrldqi intrinsics shufflevector creation ↵Craig Topper2016-06-091-52/+0
| | | | | | directly in the header file instead of in CGBuiltin.cpp. Simplify the sse2 equivalents as well. llvm-svn: 272246
* [X86] Reuse the EmitX86Select routine to handle the select for masked ↵Craig Topper2016-06-091-16/+7
| | | | | | palignr too. llvm-svn: 272245
* [AVX512] Emit select instruction instead of using x86 specific instrinsics.Igor Breger2016-06-081-33/+59
| | | | | | | | This will allow us to remove the x86 instrinics from the backend. Differential Revision: http://reviews.llvm.org/D21060 llvm-svn: 272141
* [AVX512] Convert masked palignr builtins directly to native IR similar to ↵Craig Topper2016-06-061-5/+23
| | | | | | the other palignr builtins, but with a select to handle masking. llvm-svn: 271873
* [AVX512] Convert masked load builtins to generic masked load intrinsics ↵Craig Topper2016-05-311-0/+67
| | | | | | | | instead of the x86 specific ones. This will allow the x86 intrinsics to be removed from the backend. llvm-svn: 271253
* [AVX512] Emit generic masked store instrinsics instead of using x86 specific ↵Craig Topper2016-05-311-0/+68
| | | | | | | | intrinsics. This will allow us to remove the x86 instrinics from the backend. llvm-svn: 271246
* [X86] Simplify alignr builtin support by recognizing that NumLaneElts is ↵Craig Topper2016-05-291-9/+7
| | | | | | always 16. NFC llvm-svn: 271176
* [CodeGen] Use the ArrayRef form CreateShuffleVector instead of building ↵Craig Topper2016-05-291-48/+39
| | | | | | ConstantVectors or ConstantDataVectors and calling the other form. llvm-svn: 271165
* AMDGPU: Add fract builtinMatt Arsenault2016-05-281-0/+3
| | | | llvm-svn: 271080
* [CodeGen] Don't crash when sizeof(long) != 4 for some intrinsDavid Majnemer2016-05-271-6/+9
| | | | | | | | | | _InterlockedIncrement and _InterlockedDecrement have 'long' in their prototypes. We assumed 'long' was the same size as an i32 which is incorrect for other targets. This fixes PR27892. llvm-svn: 270953
* [OpenCL] Add to_{global|local|private} builtin functions.Yaxun Liu2016-05-201-0/+23
| | | | | | | | | | | | | | | | | | OpenCL builtin functions to_{global|local|private} accepts argument of pointer type to arbitrary pointee type, and return a pointer to the same pointee type in different addr space, i.e. global gentype *to_global(gentype *p); It is not desirable to declare it as global void *to_global(void *); in opencl header file since it misses diagnostics. This patch implements these builtin functions as Clang builtin functions. In the builtin def file they are defined to have signature void*(void*). When handling call expressions, their declarations are re-written to have correct parameter type and return type corresponding to the call argument. In codegen call to addr void *to_addr(void*) is generated with addrcasts or bitcasts to facilitate implementation in builtin library. Differential Revision: http://reviews.llvm.org/D19932 llvm-svn: 270261
* Add all the avx512 flavors to __builtin_cpu_supports's list.Benjamin Kramer2016-05-201-0/+21
| | | | | | | | This is matching what trunk gcc is accepting. Also adds a missing ssse3 case. PR27779. The amount of duplication here is annoying, maybe it should be factored into a separate .def file? llvm-svn: 270224
* [CUDA] Implement __ldg using intrinsics.Justin Lebar2016-05-191-0/+45
| | | | | | | | | | | | | | | | | | Summary: Previously it was implemented as inline asm in the CUDA headers. This change allows us to use the [addr+imm] addressing mode when executing ld.global.nc instructions. This translates into a 1.3x speedup on some benchmarks that call this instruction from within an unrolled loop. Reviewers: tra, rsmith Subscribers: jhen, cfe-commits, jholewinski Differential Revision: http://reviews.llvm.org/D19990 llvm-svn: 270150
* [WebAssembly] Rename memory_size intrinsic to current_memoryDerek Schuff2016-05-021-2/+2
| | | | | | This follows the recent change in the wasm spec. llvm-svn: 268256
* [AArch64] Fix D19098 fallout.Marcin Koscielnicki2016-04-191-5/+0
| | | | | | | | | | The intrinsic is now called llvm.thread.pointer, not llvm.aarch64.thread.pointer. Also, the code handling it in CGBuiltin.cpp is dead - it's already covered by GCCBuiltin. Remove it. Differential Revision: http://reviews.llvm.org/D19099 llvm-svn: 266817
* [ARM NEON] Define vfms_f32 on ARM, and all vfms using vfma.Ahmed Bougacha2016-04-191-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r259537 added vfma/vfms to armv7, but the builtin was only lowered on the AArch64 side. Instead of supporting it on ARM, get rid of it. The vfms builtin lowered to: %nb = fsub float -0.0, %b %r = @llvm.fma.f32(%a, %nb, %c) Instead, define the operation in terms of vfma, and swap the multiplicands. It now lowers to: %na = fsub float -0.0, %a %r = @llvm.fma.f32(%na, %b, %c) This matches the instruction more closely, and lets current LLVM generate the "natural" operand ordering: fmls.2s v0, v1, v2 instead of the crooked (but equivalent): fmls.2s v0, v2, v1 Except for theses changes, assembly is identical. LLVM accepts both commutations, and the LLVM tests in: test/CodeGen/AArch64/arm64-fmadd.ll test/CodeGen/AArch64/fp-dp3.ll test/CodeGen/AArch64/neon-fma.ll test/CodeGen/ARM/fusedMAC.ll already check either the new one only, or both. Also verified against the test-suite unittests. llvm-svn: 266807
* make __builtin_isfinite more efficient (PR27145)Sanjay Patel2016-04-071-19/+12
| | | | | | | | | | | | | | isinf (is infinite) and isfinite should be implemented with the same function except we change the comparison operator. See PR27145 for more details: https://llvm.org/bugs/show_bug.cgi?id=27145 Ref: forked off of the discussion in D18513. Differential Revision: http://reviews.llvm.org/D18648 llvm-svn: 265675
* NFC: make AtomicOrdering an enum classJF Bastien2016-04-061-55/+52
| | | | | | | | | | | | Summary: See LLVM change D18775 for details, this change depends on it. Reviewers: jyknight, reames Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18776 llvm-svn: 265569
* AMDGPU: Add frexp_mant + frexp_exp builtinsMatt Arsenault2016-03-301-0/+8
| | | | llvm-svn: 264960
* Silencing warnings from MSVC 2015 Update 2. Both of these changes silence ↵Aaron Ballman2016-03-301-1/+1
| | | | | | "C4334 '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)". NFC. llvm-svn: 264932
* Add missing __builtin_bitreverse8Matt Arsenault2016-03-231-0/+1
| | | | | | Also add documentation for bitreverse builtins llvm-svn: 264203
* [CUDA] Implement atomicInc and atomicDec builtinsJustin Lebar2016-03-221-0/+16
| | | | | | | | | | | | | | | These functions cannot be implemented as atomicrmw or cmpxchg instructions, so they are implemented as a call to the NVVM intrinsics @llvm.nvvm.atomic.load.inc.32.p0i32 and @llvm.nvvm.atomic.load.dec.32.p0i32. Patch by Jason Henline. Reviewers: jlebar Differential Revision: http://reviews.llvm.org/D18322 llvm-svn: 264009
* Preserve ExtParameterInfos into CGFunctionInfo.John McCall2016-03-111-3/+1
| | | | | | | | | As part of this, make the function-arrangement interfaces a little simpler and more semantic. NFC. llvm-svn: 263191
* [PPC] FE support for generating VSX [negated] absolute value instructionsKit Barton2016-03-091-0/+10
| | | | | | | | | | Includes new built-in, conversion of built-in to target-independent intrinsic and update in the header file. Tests are also updated. There is a second part in the backend for which I will post a separate code-review. BACKEND PART SHOULD BE COMMITTED FIRST. Phabricator: http://reviews.llvm.org/D17816 llvm-svn: 263051
* Add __builtin_canonicalizeMatt Arsenault2016-02-271-0/+5
| | | | llvm-svn: 262122
* AMDGPU: Add sin/cos builtinsMatt Arsenault2016-02-131-0/+6
| | | | llvm-svn: 260783
* AMDGPU: Update builtin for intrinsic changeMatt Arsenault2016-02-131-3/+3
| | | | llvm-svn: 260781
* Add builtins for bitreverse intrinsicMatt Arsenault2016-02-031-42/+45
| | | | | | | Follow the naming convention that bswap uses since it's a similar sort of operation. llvm-svn: 259671
* Recommit: R258773 [OpenCL] Pipe builtin functionsXiuli Pan2016-01-261-0/+136
| | | | | | | | | | | | | | | | | Fix arc patch fuzz error. Summary: Support for the pipe built-in functions for OpenCL 2.0. The pipe builtin functions may have infinite kinds of element types, one approach would be to just generate calls that would always use generic types such as void*. This patch is based on bader's opencl support patch on SPIR-V branch. Reviewers: Anastasia, pekka.jaaskelainen Subscribers: keryell, bader, cfe-commits Differential Revision: http://reviews.llvm.org/D15914 llvm-svn: 258782
* Revert "[OpenCL] Pipe builtin functions"David Majnemer2016-01-261-135/+0
| | | | | | | This reverts commit r258773, it broke the build bots: http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/43853 llvm-svn: 258775
* [OpenCL] Pipe builtin functionsXiuli Pan2016-01-261-0/+135
| | | | | | | | | | | | | | | | Summary: Support for the pipe built-in functions for OpenCL 2.0. The pipe builtin functions may have infinite kinds of element types, one approach would be to just generate calls that would always use generic types such as void*. This patch is based on bader's opencl support patch on SPIR-V branch. Reviewers: Anastasia, pekka.jaaskelainen Subscribers: keryell, bader, cfe-commits Differential Revision: http://reviews.llvm.org/D15914 llvm-svn: 258773
* [CUDA] Make printf work.Justin Lebar2016-01-231-0/+3
| | | | | | | | | | | | | | | | | | Summary: The code in CGCUDACall is largely based on a patch written by Eli Bendersky: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20140324/210218.html That patch implemented an LLVM pass lowering printf to vprintf; this one does something similar, but in Clang codegen. Reviewers: echristo Subscribers: cfe-commits, jhen, tra, majnemer Differential Revision: http://reviews.llvm.org/D16372 llvm-svn: 258642
* AMDGPU: Rename builtins to use amdgcn prefixMatt Arsenault2016-01-221-25/+39
| | | | | | | | | Keep the ones still used by libclc around for now. Emit the new amdgcn intrinsic name if not targeting r600, in which case the old AMDGPU name is still used. llvm-svn: 258560
* Reordering fields to reduce padding in Clang. NFCBen Craig2015-12-141-6/+6
| | | | llvm-svn: 255552
* Add the `pass_object_size` attribute to clang.George Burgess IV2015-12-021-20/+72
| | | | | | | | | | | | | `pass_object_size` is our way of enabling `__builtin_object_size` to produce high quality results without requiring inlining to happen everywhere. A link to the design doc for this attribute is available at the Differential review link below. Differential Revision: http://reviews.llvm.org/D13263 llvm-svn: 254554
* Move checkTargetFeatures to CodeGenFunction.cpp to make itEric Christopher2015-11-121-42/+0
| | | | | | more obvious that it's generic. llvm-svn: 252833
* In preparation to use it in more places renameEric Christopher2015-11-121-11/+11
| | | | | | | checkBuiltinTargetFeatures to checkTargetFeatures and sink the error handling into the function. llvm-svn: 252832
* Extract out a function onto CodeGenModule for getting the map ofEric Christopher2015-11-111-26/+3
| | | | | | | features for a particular function, then use it to clean up some code. llvm-svn: 252819
OpenPOWER on IntegriCloud